Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello.. I want to develop a utility which can work as other compression applications like Power ISO, Win RAR in C#.NET.

Suppose i want to compress a file or folder using Win RAR it creates a.rar file. The thing i want is to write my own application which can compress file/folders and save them with the extension of my own and only my application can perform I/O on it. I am trying to find a solution from many days but all in vain.

If someone could just give me a nudge in the correct direction, I'd really appreciate it.

Regards
-Saim Shaukat
Posted
Comments
[no name] 28-Aug-14 4:19am    
And you will still be "in vain". There is really nothing you can do to prevent anyone from perform I/O on your file. All you can really do is format the data in your file to make it unintelligible to the casual user. And even then someone can still open your file with a hex editor.

 
Share this answer
 
Comments
SaimShaukat 28-Aug-14 5:47am    
can i change the .gz extension to any other?
Any file that can be read, can be read by any application. You cannot prevent that - because it would also prevent your application form being able to read it and that turns your hard drive into Write Only Memory.

What you can do is encrypt of obfuscate the file contents so that only your can understand the content once it is read. That's not difficult, but requires a good deal background reading in order to make it secure.

Start here: http://msdn.microsoft.com/en-us/library/as0w18af(v=vs.110).aspx[^] and follow the links. Then start thinking about exactly what you are trying to achieve and what best fits that.

In order to compress as well, you will need to use a package like zipsharp, or write your own: http://en.wikipedia.org/wiki/Data_compression[^] gives an overview of the various methods you might implement.
 
Share this answer
 
Only a suggestion , need improvements.

C#
using System;                                                                              
using System.IO;
using System.IO.Compression;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string startPath = @"c:\example\start";
            string zipPath = @"c:\example\result.zip";
            string extractPath = @"c:\example\extract";
            string myFile = @"c:\example\result.xxx";

            ZipFile.CreateFromDirectory(startPath, zipPath);

            /// Scamble zip file in xxx file with an MyScrambleAlgo function, likely using an array of byte
            /// TODO

            /// Change name : zipPath =>  myFile.xxx
            /// TODO

            /// Now you have your custom zip and scrambled file , only you can open it
 
            /// To read your file do the same in reverse order
            /// Unscramble xxx file in zip file with an MyUnScrambleAlgo function, likely using an array of byte
            /// TODO

            /// Change name myfile.xxx => zipPath
            /// TODO

            ZipFile.ExtractToDirectory(zipPath, extractPath);
        }



    }
}


Hope help
Hi
 
Share this answer
 
v2
check on this link

http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream%28v=vs.110%29.aspx


this will help you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900