private List <string> CallBsarch(string eventName, string arg, bool verbose) { var startInfo = new ProcessStartInfo { WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, FileName = ConfigurationPath.PathBsarch, Arguments = arg }; // var process = new Process { StartInfo = startInfo }; process.Start(); Progresser.EventStart(eventName); List <string> result = new List <string>(); string error = null; process.OutputDataReceived += (sender, args) => { result.Add(args.Data); var data = args.Data; if (!string.IsNullOrWhiteSpace(data)) { data = data.Trim(); if (data.StartsWith("[") && data.EndsWith("%]")) { data = data.Replace("[", string.Empty); data = data.Replace("%]", string.Empty); int i; if (int.TryParse(data, out i)) { Progresser.ChangeProgressPct(eventName, i / 100d); } } else if (data.StartsWith("EFCreateError", StringComparison.OrdinalIgnoreCase)) { error = string.Format("File system error, file name not ASCII ? {0}", data); } else if (data.ToLower().Contains("exception")) { error = data; } else { if (verbose) { Logger.Log(data); } } } }; process.BeginOutputReadLine(); process.WaitForExit(); Progresser.EventEnd(eventName); if (error != null) { throw new Exception(error); } return(result); }