How to extract files from .CAB file using C#.Net? - c#

I have a CAB file generated from CABARC.EXE. I need to extract the file using ASP.Net C#.Net.
How to do it in C#.net itself? I don't want to use the same CABARC.EXE for extraction. Because we don't use this tool in production environment.
Please give your valuable suggestions/code to achieve this task.
Thanks in advance
Ganesh.

I googled this for you.
http://www.codeproject.com/KB/files/CABCompressExtract.aspx
Looks like it does everything you want.

If you want a native C# solution I suggest you start with the file specification for CAB files here:
http://msdn.microsoft.com/en-us/library/cc483132(EXCHG.80).aspx

Have a look at https://learn.microsoft.com/en-us/previous-versions//bb267310(v=vs.85)#microsoft-cabinet-file-format
There you have a file format description for the CAB file.

Related

How do I edit a .PDF file while its a resource?

I've been looking around on the web for an answer to a perplexing problem. I'm trying to code a program in C# and I'm looking for a snippet of code that'll take any information a user would input, i.e using a textbox or a check box, and transfer said information onto a .PDF file that I've added as a resource.
Right now I'm using Visual Studio 2008 for my coding, any help would be appreciated.
You can use librairies to create PDF on the fly:
ITextSharp
PDF's are a proprietary format. PDF4Net is a pretty good library for merging information via XDF into PDF's, but you are going to have a lot of trouble trying to do this on your own natively.

How to change a CAB file through .NET?

I have a CAB file (actually a WSP, but I think they are the same) that contains several files. One of the files is an XML that I would like to modify and re-insert into the CAB.
Is there anything that is built into .NET that will allow me to do this? If not, are there any third party libraries out there that will help me to do this?
Here's one cab compressions and extraction library:
http://www.codeproject.com/KB/files/CABCompressExtract.aspx

Extract file from .xsn using c#

I need to extract file (template.xml) from .xsn (InfoPath form template) using C#.
How can I do this? I tried to do it using "DotnetZip" and "Microsoft System.IO.Compression.DeflateSteam" but it doesn't work.
Any help please?
Thanks in advance!
XSN is not a Zip file, it is CAB.
Here is a blog article talking about manipulation of XSN in JavaScript - http://blogs.msdn.com/b/infopath/archive/2004/05/04/126147.aspx and another one with some samples I've never used http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/58d9cf34-9a43-4d58-96c7-44bff69ca5d4.
I've used "Unpack XSN file using extract.exe utility to the local temporary directory".
(Search for "C# cab extract" http://www.bing.com/search?q=c%23+cab+extract for more code samples)

Protecting a Xml file

I'm fairly new to coding, and I just got help figuring out how to create a Xml file; now I want to know, is there a way to protect my Xml file from being edited?
I'm making a simple Command Prompt game, and I'm going to include an Xml file for info storage purposes. Although I don't want the user to be able to change the info contained in the file.. Is there a way to achieve this? It doesn't need to be extensive at this time, due to the program only being a small project.
Anyway, I'm making the program with Visual Studio Pro 2010, and I'm coding it in C#.
Thank you, for any help in advance.
the standard way to verify that parts of your xml has not been modified is to use XML_Signature
this msdn example shows how this is done with dotnet4
I would embed your XML file as a resource of your console application's assembly. The XML file will exist as an embedded resource and not as a seperate file that the user could potentially change. If the user isn't meant to edit a configuration file, don't even let him see it, modify it, or delete it.
look at this topic decrypt and encrypt
i have created my own Encrypter class based from this classes. then you can create it for yourself for next use
You could simply compress it, if you don't need a high level of security. You could use a standard format (ZIP, CAB), or just deflate the stream and store it as a binary file. See the doc and examples about this here: DeflateStream Class
You can't prevent anyone from editing your xml file but you can encrypt your xml file to protect your data.

dat idx files database recognition

I have some .dat and .idx files and one .sup file in a directory , and i would like to know if there is any tool or .net programming tecnique to find out what type of database is?
I dont know if this could help, but if i open one .dat file as text file, i get this: 0~0904021846460509040218464605>ÀÀX2Ü
And the common part of all the .dat files, is the following string at the start 0~09040218.
Could you give me a hand?
Thanks a lot.
Kind Regards.
Josema.
Linux has a file command that uses a listing of magic numbers to try and id a file type. There's a Win32 port - but I can't vouch for it. Personally, I'd xfer it over to a Linux system and run it there.

Categories

Resources