using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Runtime.InteropServices; using System.Diagnostics; namespace CrashDumpReader { class Program { static public void Execute(string exeName, string Arguments, ref string output) { ProcessStartInfo startInfo = new ProcessStartInfo(exeName); startInfo.Arguments = Arguments; string error = ""; if (output != null) { startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.UseShellExecute = false; } else { startInfo.WindowStyle = ProcessWindowStyle.Hidden; } Process process = null; process = Process.Start(startInfo); if (output != null) { output = process.StandardOutput.ReadToEnd(); error = process.StandardError.ReadToEnd(); } output = error; process.WaitForExit(); } static void Main(string[] args) { if (args.Length>=1) { string pathName = args[0]; const string CLPrefix = "_CL"; int pos = pathName.LastIndexOf(CLPrefix); if (pos!=-1) { try { string extractCL = pathName.Substring(pos + CLPrefix.Length); int posDot = extractCL.LastIndexOf('.'); if (posDot != -1) { extractCL = extractCL.Substring(0, posDot); string client = Environment.GetEnvironmentVariable("CLIENTCRASHDUMP"); if (client == null) { Console.WriteLine("please set a client using CLIENTCRASHDUMP environment variable"); return; } //start syncing code; string output = ""; string[] extension = { "cpp", "cc", "h", "inl" }; foreach (string ext in extension) { string arguments = @"-c "+ client + " sync //...." + ext + "@" + extractCL; Execute("p4",arguments, ref output); Console.WriteLine(output); } //open devenv output = ""; string devPath = Environment.GetEnvironmentVariable("VS90COMNTOOLS"); Execute(devPath + @"..\IDE\devenv.exe", pathName, ref output); } } catch (System.Exception) { } } } } } }