Esempio n. 1
0
        void Compile(string cl, string args, VCFile file)
        {
            Process process = new Process();

            process.StartInfo.FileName               = cl;
            process.StartInfo.Arguments              = args;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.WorkingDirectory       = Path.GetDirectoryName(m_dte.Solution.FullName);

            EnvDTE.Window           window       = m_dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
            EnvDTE.OutputWindow     outputWindow = (EnvDTE.OutputWindow)window.Object;
            EnvDTE.OutputWindowPane buildPane    = outputWindow.OutputWindowPanes.Item(BuildPaneName);
            buildPane.Clear();
            buildPane.Activate();

            process.OutputDataReceived += (sender, eventArgs) => BuildOutputReceived(buildPane, eventArgs);

            process.Start();
            process.BeginOutputReadLine();

            OnCompilationStart();
            System.Threading.Tasks.Task.Run(() => BuildTask(process, file));
        }
Esempio n. 2
0
        public void Execute(string exe, string args, string workDir, bool showWindow)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            bool buildPaneIsActive = false;

            EnvDTE.OutputWindow     outputWin = getOutputWindow();
            EnvDTE.OutputWindowPane pane      = getOutputPane(_outputPane);
            if (outputWin != null && pane != null)
            {
                if (!buildPaneIsActive)
                {
                    outputWin.Parent.Activate();
                    pane.Activate();
                    buildPaneIsActive = true;
                }
                pane.Clear();
            }

            ProcessStartInfo si = new ProcessStartInfo();

            si.FileName               = exe;
            si.Arguments              = args;
            si.UseShellExecute        = false;
            si.RedirectStandardOutput = true;
            si.CreateNoWindow         = !showWindow;
            si.WorkingDirectory       = workDir;

            Process proc = new Process();

            proc.StartInfo           = si;
            proc.OutputDataReceived += new DataReceivedEventHandler(OnOutputDataReceived);
            proc.Start();
            proc.BeginOutputReadLine();
        }
    private EnvDTE.OutputWindowPane LoadOutputWindowPane(DTE dte)
    {
        const string windowName = "pMixins Code Generator";

        EnvDTE.OutputWindowPane pane   = null;
        EnvDTE.Window           window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
        if (window != null)
        {
            EnvDTE.OutputWindow output = window.Object as EnvDTE.OutputWindow;
            if (output != null)
            {
                pane = output.ActivePane;
                if (pane == null || pane.Name != windowName)
                {
                    for (int ix = output.OutputWindowPanes.Count; ix > 0; ix--)
                    {
                        pane = output.OutputWindowPanes.Item(ix);
                        if (pane.Name == windowName)
                        {
                            break;
                        }
                    }
                    if (pane == null || pane.Name != windowName)
                    {
                        pane = output.OutputWindowPanes.Add(windowName);
                    }
                    if (pane != null)
                    {
                        pane.Activate();
                    }
                }
            }
        }
        return(pane);
    }
Esempio n. 4
0
 private static void ShowOutputWindowPane(string paneName)
 {
     EnvDTE.OutputWindow     outputWindow = CodeRush.Windows.Active.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).Object as EnvDTE.OutputWindow;
     EnvDTE.OutputWindowPane buildPane    = outputWindow.OutputWindowPanes.Item(paneName);
     System.Diagnostics.Debug.Assert(buildPane != null);
     buildPane.Activate();
     outputWindow.Parent.SetFocus();
 }
Esempio n. 5
0
 private EnvDTE.OutputWindowPane GetBizTalkBuildAndDeployPane(EnvDTE.OutputWindow ow)
 {
     foreach (EnvDTE.OutputWindowPane p in ow.OutputWindowPanes)
     {
         if (p.Name == "bizilante Build & Deploy")
         {
             return(p);
         }
     }
     EnvDTE.OutputWindowPane owp = ow.OutputWindowPanes.Add("bizilante Build & Deploy");
     return(owp);
 }
Esempio n. 6
0
        EnvDTE.OutputWindow getOutputWindow()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            EnvDTE80.DTE2 dte = _package.GetDTE();
            if (dte != null)
            {
                EnvDTE.OutputWindow ouputWin = dte.ToolWindows.OutputWindow;
                return(ouputWin);
            }

            return(null);
        }
Esempio n. 7
0
        private EnvDTE.OutputWindowPane GetOutputPane()
        {
            try
            {
                if (DTE == null)
                {
                    return(null);
                }

                string windowName              = GetType().Name;
                EnvDTE.OutputWindowPane pane   = null;
                EnvDTE.Window           window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
                if (window != null)
                {
                    EnvDTE.OutputWindow output = window.Object as EnvDTE.OutputWindow;
                    if (output != null)
                    {
                        pane = output.ActivePane;
                        if (pane == null || pane.Name != windowName)
                        {
                            for (int ix = output.OutputWindowPanes.Count; ix > 0; ix--)
                            {
                                pane = output.OutputWindowPanes.Item(ix);
                                if (pane.Name == windowName)
                                {
                                    break;
                                }
                            }
                            if (pane == null || pane.Name != windowName)
                            {
                                pane = output.OutputWindowPanes.Add(windowName);
                            }
                            if (pane != null)
                            {
                                pane.Activate();
                            }
                        }
                    }
                }
                return(pane);
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Fetch the test output window
        /// </summary>
        /// <returns></returns>
        private static EnvDTE.OutputWindowPane GetImpromptuOutputPane()
        {
            EnvDTE.OutputWindow outputWindow = CodeRush.Windows.Active.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).Object as EnvDTE.OutputWindow;
            const string        kTestsPane   = "Impromptu";

            EnvDTE.OutputWindowPane ourPane;
            try
            {
                ourPane = outputWindow.OutputWindowPanes.Item(kTestsPane);
                ourPane.Clear();
            }
            catch
            {
                ourPane = outputWindow.OutputWindowPanes.Add(kTestsPane);
            }
            System.Diagnostics.Debug.Assert(ourPane != null);
            ourPane.Activate();
            return(ourPane);
        }
Esempio n. 9
0
        internal Logcat()
        {
            var frame = VSLogcatPackage.Current.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
            Debug.Assert(frame != null);
            OutputWnd = frame.Object as EnvDTE.OutputWindow;
            DebugPane = OutputWnd.OutputWindowPanes.Item(GuidList.guidVSDebugOutputWndString);

            regex = new Regex(@"^\[(?<name>[a-zA-Z0-9\u4e00-\u9fa5_\-]+)\].*", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);

            OutputPanes = new Dictionary<string, EnvDTE.OutputWindowPane>(16);

            AddLogPane(LogType.VERBOSE);
            AddLogPane(LogType.DEBUG);
            AddLogPane(LogType.INFO);
            AddLogPane(LogType.WARN);
            AddLogPane(LogType.ERROR);

            Current = this;
        }
Esempio n. 10
0
        /// [exec start process]
        public void StartProcess(string exePath, string args, string workDir, bool enableBoostParsing)
        {
            try
            {
                // Ensure executable exists
                if (!System.IO.File.Exists(exePath))
                {
                    WriteLine(1, "Executable not found: " + exePath);
                    m_mainEvents.OnTestTerminated(Result.Failed, exePath, false, new TimeSpan(0), "Executable not found: " + exePath);
                    return;
                }

                // Ensure output pane exists
                if (m_outputPane == null)
                {
                    EnvDTE.OutputWindow ow = dte.ToolWindows.OutputWindow;
                    m_outputPane = ow.OutputWindowPanes.Add("Run UnitTest");
                }
                m_outputPane.Activate();
                m_outputPane.Clear();

                // -----  Prepare process data  -----
                m_process = new System.Diagnostics.Process();
                m_process.StartInfo.FileName         = exePath;
                m_process.StartInfo.WorkingDirectory = workDir;
                m_process.StartInfo.Arguments        = args.Trim();
                boostProcessOutputParser.Clear();
                boostProcessOutputParser.EnableParsing = enableBoostParsing;

                if (m_getNotificationWhenProcessTerminates)
                {
                    // Remark: Method Executor.Process_Exited will be called
                    // from some system thread when the process has terminated.
                    // Synchronization will be needed!
                    m_process.Exited += new System.EventHandler(Process_Exited);
                    m_process.EnableRaisingEvents = true;
                }

                if (m_catchStdOutAndStdErr)
                {
                    m_process.StartInfo.UseShellExecute        = false;
                    m_process.StartInfo.RedirectStandardOutput = true;
                    m_process.StartInfo.RedirectStandardError  = true;
                    m_process.StartInfo.CreateNoWindow         = true;
                    m_process.OutputDataReceived += new System.Diagnostics.
                                                    DataReceivedEventHandler(boostProcessOutputParser.StandardOutputReceiver);
                    m_process.ErrorDataReceived += new System.Diagnostics.
                                                   DataReceivedEventHandler(boostProcessOutputParser.StandardErrorReceiver);
                }

                // -----  Start the new process and start redirection of output  -----
                m_process.Start();
                if (m_catchStdOutAndStdErr)
                {
                    m_process.BeginOutputReadLine();
                    m_process.BeginErrorReadLine();
                }

                WriteLine(2, "Started " + m_process.StartInfo.FileName);
            }
            catch (Exception e)
            {
                string info = "EXCEPTION: Could not start executable " + exePath + " " + e.ToString();
                WriteLine(1, info);
                m_mainEvents.OnTestTerminated(Result.Failed, exePath, false, new TimeSpan(0), info);
            }
        }
Esempio n. 11
0
        public Logger()
        {
            var dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE));

            OutputWindow = (EnvDTE.OutputWindow)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).Object;
        }
 private void WriteOutput(string message)
 {
     if (defaultOutputWindow == null) {
         var window = applicationObject.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
         defaultOutputWindow = (EnvDTE.OutputWindow)window.Object;
     }
     var pane = defaultOutputWindow.OutputWindowPanes.Item("Debug");
     defaultOutputWindow.Parent.Visible = true;
     pane.Activate();
     pane.OutputString(message + "\r\n");
 }