/// <Summary>
/// Compressed file
/// </Summary>
/// <Param name = "patch"> compressed file or its directory </param>
/// <Param name = "rarpatch"> directory for storing compressed files </param>
/// <Param name = "rarname"> name of the compressed file </param>
Private void rarsave (string patch, string rarpatch, string rarname)
{
String the_rar;
Microsoft. win32.registrykey the_reg;
Object the_obj;
String the_info;
System. Diagnostics. processstartinfo the_startinfo;
System. Diagnostics. Process the_process;
Try
{
String strcompressway = string. empty;
If (this. iscompress = "1" & this. compressway = "WinRAR ")
Strcompressway = @ "WinRAR ";
Else if (this. iscompress = "1" & this. compressway = "WinZip ")
Strcompressway = @ "WinZip ";
Else
Return;
The_reg = Microsoft. win32.registry. classesroot. opensubkey (strcompressway );
If (the_reg = NULL)
{
MessageBox. Show ("Please install WinRAR or WinZip software! ");
Return;
}
The_obj = the_reg.getvalue ("");
The_rar = the_obj.tostring ();
The_reg.close ();
// System. Io. Directory. createdirectory (patch );
The_rar = the_rar.substring (0, the_rar.length-5 );
// Command Parameters
The_info = "A" + rarname + "" + patch + "-R ";
The_startinfo = new system. Diagnostics. processstartinfo ();
The_startinfo.filename = the_rar; //; "WinRAR"
The_startinfo.arguments = the_info;
The_startinfo.windowstyle = system. Diagnostics. processwindowstyle. hidden;
// Directory for storing packaged files
The_startinfo.workingdirectory = rarpatch;
The_process = new system. Diagnostics. Process ();
The_process.startinfo = the_startinfo;
The_process.start ();
The_process.waitforexit ();
The_process.close ();
}
Catch (exception ex)
{
Throw ex;
}
}