Meta.TemplateProfiler.Instrument C# (CSharp) Method

Instrument() public method

public Instrument ( string compiler_binary, string compiler_args, string starting_directory, string source_to_instrument, string output ) : void
compiler_binary string
compiler_args string
starting_directory string
source_to_instrument string
output string
return void
        public void Instrument( string compiler_binary
                              , string compiler_args
                              , string starting_directory
                              , string source_to_instrument
                              , string output )
        {
            profileProcess = new System.Diagnostics.Process();

            try
            {
                string full_args = compiler_binary + " /TP " + source_to_instrument.Quote() + " /P /Fi" + output.Quote() + " " + compiler_args;

                profileProcess.StartInfo.UseShellExecute = false;
                profileProcess.StartInfo.FileName = "cmd.exe";
                profilePane.OutputStringThreadSafe("Command line: cmd.exe " + full_args + Environment.NewLine);
                profileProcess.StartInfo.Arguments = full_args;
                profileProcess.StartInfo.CreateNoWindow = true;
                profileProcess.StartInfo.WorkingDirectory = starting_directory;
                //System.Collections.Specialized.StringDictionary dict = profileProcess.StartInfo.EnvironmentVariables;
                //dict["Path"] += (";" + clTool.VSInstallDir + "Common7\\IDE");
                //profileProcess.StartInfo.RedirectStandardError = true;
                //profileProcess.OutputDataReceived += new DataReceivedEventHandler(OutputDataHandler);
                //profileProcess.StartInfo.RedirectStandardOutput = true;
                //profileProcess.ErrorDataReceived += new DataReceivedEventHandler(ErrorDataHandler);
                if (cancelProfile)
                    return;
                profileProcess.Start();
                //profileProcess.BeginOutputReadLine();
                //profileProcess.BeginErrorReadLine();
                profileProcess.WaitForExit();
                // This code assumes the process you are starting will terminate itself.
                // Given that is is started without a window so you cannot terminate it
                // on the desktop, it must terminate itself or you can do it programmatically
                // from this application using the Kill method.
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
            }
        }