Beispiel #1
0
        public static string UnRar(string rarPath, string unPath)
        {
            string mapPath = FPFile.GetMapPath("/bin/WinRAR.exe");

            if (new FileInfo(mapPath).Exists)
            {
                try
                {
                    string text = "x -inul -y -o+ -v[t,b]";
                    text = text + " " + rarPath + " " + unPath;
                    ProcessStartInfo processStartInfo = new ProcessStartInfo();
                    processStartInfo.FileName    = mapPath;
                    processStartInfo.Arguments   = text;
                    processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    Process process = new Process();
                    processStartInfo.UseShellExecute = false;
                    process.StartInfo = processStartInfo;
                    process.Start();
                    while (!process.HasExited)
                    {
                    }
                    process.WaitForExit();
                    return("");
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
            return("请安装WinRar.exe!");
        }