各位高手们,7-zip压缩包能检测它是否正常吗?也就是能正常解压
各位高手们,7-zip压缩包能检测它是否正常吗?也就是能正常解压 --------------------编程问答-------------------- 参考http://blog.csdn.net/wbloveilove/article/details/7879362 c#调用7z压缩和解压缩文件
http://www.cnblogs.com/qanholas/archive/2011/10/03/2198487.html 7Z命令行 --------------------编程问答--------------------
//解压 public bool DoUnPack() { bool r = false; string strR = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "update"; 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) { throw ex; } //这里就是解压错误 finally { //释放资源 process.Close(); } }
补充:.NET技术 , C#