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