public string RunExternalExe(string filename, string arguments = null) { var process = new Process(); process.StartInfo.FileName = filename; if (!string.IsNullOrEmpty(arguments)) { process.StartInfo.Arguments = arguments; } process.StartInfo.CreateNoWindow = true; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardOutput = true; var stdOutput = new StringBuilder(); process.OutputDataReceived += (sender, args) => stdOutput.Append(args.Data); string stdError = null; try { // process.Start("rtmpdump.exe"); System.Diagnostics.Process.Start("rtmpdump", filename); // Process.Start(filename); process.BeginOutputReadLine(); stdError = process.StandardError.ReadToEnd(); process.WaitForExit(); } catch (Exception e) { throw new Exception("OS error while executing " + Format(filename, arguments) + ": " + e.Message, e); } if (process.ExitCode == 0 || process.ExitCode == 2) { string yes = "yes"; return yes; } else { return "no"; } } private static string Format(string filename, string arguments) { return "'" + filename + ((string.IsNullOrEmpty(arguments)) ? string.Empty : " " + arguments) + "'"; }
string currentLocation = AppDomain.CurrentDomain.BaseDirectory; string[] s= currentLocation.Split('b'); string final = s[0] +"b"+ s[1] +"b"+ s[2]; string rtmpDump = Path.Combine(final, "Tool\\Rtmpdump\\rtmpdump.exe");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)