Unrar C#
Nu när man bytt till win7 finns det såklart en massa kod som inte funkar
I xp använde jag denna kod för att packa upp rar-filer
string the_rar;
RegistryKey the_Reg;
object the_Obj;
string the_Info;
ProcessStartInfo the_StartInfo;
Process the_Process;
try
{
the_Reg = Registry.ClassesRoot.OpenSubKey(@Applications\WinRAR.exe\Shell\Open\Command);
the_Obj = the_Reg.GetValue("");
the_rar = the_Obj.ToString();
the_Reg.Close();
the_rar = the_rar.Substring(1, the_rar.Length - 7);
//Vad rar filen heter (test.rar) och vart den ska packas upp (C:\test\)
the_Info = " X " + " test.rar " + @C:\test";
the_StartInfo = new ProcessStartInfo();
the_StartInfo.FileName = the_rar;
the_StartInfo.Arguments = the_Info;
the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
//Vart rar filen ligger (C:\)
the_StartInfo.WorkingDirectory = @C:\test\";
the_Process = new Process();
the_Process.StartInfo = the_StartInfo;
the_Process.Start();
label2.Text = "unrar lyckat";
}
catch
{
label2.Text = "unrar misslyckat";
}
Men den funkar inte längre.. Behöver jag ändra något för att få den att funka i win7?
Eller finns det ngt annat sätt att packa upp rar-filer?