C # file Compression plus decryption

Source: Internet
Author: User

1. This method can also be done to encrypt the file, decryption and decompression, only in the compression and decompression will appear compression window

1.1 Encryption compression

Strzippath: Compressed Package path
Strtxtpath: File path to be compressed
Password: encrypt password
 Public BOOLZip (stringStrzippath,stringStrtxtpath,stringpassword) {            Try{System.Diagnostics.Process Process1=NewSystem.Diagnostics.Process (); Process1.StartInfo.FileName="Winrar.exe"; Process1.StartInfo.CreateNoWindow=true; Process1.StartInfo.Arguments="a-p"+ Password +" "+ Strzippath +" "+Strtxtpath; //Strtxtpath = "C://Freezip//"; //Process1.StartInfo.Arguments = "x-p123456" + Strzippath + "" + Strtxtpath;Process1.start (); if(process1.hasexited) {return true; }                return true; }            Catch(Exception) {return false; }                    }

1.2 Decryption Decompression

1   Public BOOLUZip (stringStrzippath,stringStrtxtpath,stringpassword)2         {3             Try4             {5System.Diagnostics.Process Process1 =NewSystem.Diagnostics.Process ();6Process1.StartInfo.FileName ="Winrar.exe";7Process1.StartInfo.CreateNoWindow =true;8                 //Process1.StartInfo.Arguments = "a-p123456" + Strzippath + "" + Strtxtpath;9                 //Strtxtpath = "C://Freezip//";TenProcess1.StartInfo.Arguments ="x-p"+ Password +" "+ Strzippath +" "+Strtxtpath; One Process1.start (); A                 if(process1.hasexited) -                 { -                     return true; the                 } -                 return true; -             } -             Catch(Exception) +             { -  +                 return false; A             } at              -}
View Code

C # file Compression plus decryption

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.