//解压
public bool DoUnPack()
{
bool r = false;
// string strR = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "update"+"//";
string strR = Application.StartupPath + "//" + "update";
//MessageBox.Show(strR);
Console.WriteLine("开始解压......");
RegistryKey reg;
string rarPath;
Process process = new Process(); try
{
reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
rarPath = reg.GetValue("").ToString();
rarPath = rarPath.Substring(1, rarPath.Length - 7);
process.StartInfo.FileName = rarPath;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
// -0+ 如果已经存在则覆盖
process.StartInfo.Arguments = string.Format(" x -o+ {0} {1}", strR, Application.StartupPath + "//");//这里是命令行请参考winrar的说明
//开始解压
process.Start();
while (!process.HasExited)
{
}
//进程终止
if (process.HasExited)
{
int exitCode = process.ExitCode;
if (exitCode == 0)
{
Console.WriteLine("{0} 正常完成", exitCode.ToString());
r= true;
}
else
{
Console.WriteLine("{0} 正常完成", exitCode.ToString());
}
}
Console.WriteLine("解压完成");
return r;
}
catch (Exception ex)
{
//MessageBox.Show("123");
throw ex;
}
finally
{
//释放资源
process.Close();
}
} 安装路径 有update.rar 文件 但提示找不到压缩文件 求大侠指点
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货