Handling Zip Files Without Third Party Lib in .NET 4.0? - c#

There is a similar question for 3.5 here:
Is there a built-in zip library in .NET 3.5?
that speculated that 4.0 would have it, but I can't find any info about it. If not, does anyone know why not? Seems like it would be fairly high on the list of things to include support for.

Take a look at the System.IO.Packaging namespace, which contains support for ZIP files, but not all of the features of ZIP files.
Still, it might be enough for your needs.

You may have already moved along, but ZiP API is added in .NET 4.5
http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive.aspx
go nuts.

Not for 4.0, but a ZipArchive class is being considered for the next version. You can find details about this on the BCL Team blog.
Edit: Otherwise, assuming that it's still available, and depending on your definition of built in (at least it comes/came with Visual Studio), you might be able to use the J# classes to zip files as described in this article: Using the Zip Classes in the J# Class Libraries to Compress Files and Data with C#
Edit2: Though note the comments below, that the J# option is probably not the right option except in certain unusual circumstances.

Most easiest to deal with, is with sample code here.
You need to add a new assembly just to find he Zip archive.
Working with Zip files in .NET 4.5

Related

Decompling .net assembly

Hey i have done a few of decompiling in .net as i am learning c# so it helps me to see codes as it helps a lot. But lately i have come acrossed few program that i know are .net but in reflector show up as non .net assemblies. Here is the example of program named: Proxy Multiply.
I am not trying to do any illegal stuff or something. Just trying to learn. I have tried to google this but i was not able to achieve any good result.
Thanks
here is the link to image.
There are many .Net code protection alternative, that obfuscate the IL codes so that they are not that much exposed to IL disassembler application.
.Net Reactor
Themida
SmartAssembly
the list is huge . . .
many of the protector modify the Exe (PE Header info), .Net exe contains some extra MetaData that helps disassembler to identify it.
Download this little application it may tell you a little more about the exe.
Download PEiD 0.95
PEiD is an intuitive application that relies on its user-friendly
interface to detect packers, cryptors and compilers found in PE
executable files – its detection rate is higher than that of other
similar tools since the app packs more than 600 different signatures
in PE files.
PEiD comes with three different scanning methods, each suitable for a
distinct purpose. The Normal one scans the user-specified PE file at
its Entry Point for all its included signatures. The so-called Deep
Mode comes with increased detection ratio since it scans the file's
Entry Point containing section, whereas the Hardcore mode scans the
entire file for all the documented signatures.
My best guess the assembly you are looking for is Protected by .Net Reactor or Themida
I have same problem with dot net reflector before,
try JetBrains dotPeek version 1.0 Decompling(this application will show code that obfuscated)
Decompiling .NET 1.0-4.5 assemblies to C#
Support for .dll, .exe, .zip, .vsix, .nupkg, and .winmd files
Quick jump to a type, assembly, symbol, or type member
Effortless navigation to symbol declarations,
implementations, derived and base symbols, and more
Accurate search for symbol usages
with advanced presentation of search results
Overview of inheritance chains
Support for downloading code from source servers
Syntax highlighting
Complete keyboard support
dotPeek is free!
Just because it is .NET doesn't mean that you can just decompile it like that. They probably used ILMerge. That's not to say it's impossible but it will require more work.
See Is it possible to “decompile” a Windows .exe? Or at least view the Assembly?

parsing json in C# with json.net requires the json.net .dll?

I have a simple c# library (myLib.dll) that can be registered to applications. It can be used as a plug-in. Now i would like to use the json.net library from Newton King, but i do not want to have 2 .dll that i have to send around.
Is there a way to use json.net and somehow embed the .dll into myLib.dll that in the end i have only my .dll?
Edit: to clerify: Is it allowed to merge the jsonNET.dll with my own myLib.dll so that only myLib.dll will be visible as a file?
ok it has the MIT License: http://json.codeplex.com/license
You can merge the libraries together using ilmerge.
http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx
Make sure to carefully read the licence of any libraries you are merging in, as it may affect the distribution rules for your library. Also any application that uses your library will also have access to any merged libraries.
You can achieve this remarkably easily using Netz, a .net NET Executables Compressor & Packer.
Finally, as a few have already mentioned, ILMerge may be another option to consider, albeit somewhat more involved.

What language is Mono written in and how do I read the source code?

I want to read the source code for Mono. I looked up this URL and there are several folders here.
What language is the Mono project written in?
Which folder/file do I download to read its source?
From looking at the folder hierarchy, it appears (although my assumption could be wrong) that it has been written in several languages and that I could download any one of them.
But I'd just like to make sure.
You'll want the mono subdirectory, pick the version you are interested in.
The equivalent of the CLR and the jitter were written in C. You'll find it in the mono/mini subdirectory.
The C# compiler was written in C#. You'll find it in the mcs/mcs subdirectory.
The framework classes were written in C#. You'll find them in the mcs/class subdirectories.
For the most part, C#. There is a page on the Mono website that talks about the various languages. So look here: MonoProject - Languages

Export embedded resources from C# assembly?

I have a C# dll that has some embedded resources and i'm having troubles with a couple of them. What would be the best app's to pull these resources out so that I can check them over?
Try DotNetResourcesExtract
UPDATE:
Seems like doesn't work with .Net 3.5 files.
Try Resource Tuner. Looks promising and it has a 30 day fully functional trial version available for download.
I found that opening the file with .Net Reflector allowed me to see the Resources!

Is it possible to use Java to retrieve assembly version(DLL)?

I recently pickup Java so I have very limited knowledge, but I would like to know if it's possible to get DLL version using Java. If it is not possible, is it possible to use C# to get Jar version through the manifest file?
It's certainly possible in each case - you just need to write code to read the appropriate file format.
I suspect it's vastly simpler to find the manifest in a jar file from C# than the assembly version from Java though - it's just a case of loading a zip file and finding the META-INF/MANIFEST.MF file. Reading the file is easy, as it's plain text.
Depending on exactly what you mean by the version of a DLL, you may need to do all manner of things - if you're talking about .NET assembly attributes, I don't know whether they're placed in some easily-fetchable place; my experience of parsing Portable Executable (PE) files is that it's slightly tricky unless you've got library support. Of course if you can find a Java library which knows the format already, it may become trivial...

Categories