Esempio n. 1
0
        /// <summary>
        /// Called when the analyze thread has completed.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void AnalyzeCompleteMain(object sender, EventArgs e)
        {
            Param.AssertNotNull(sender, "sender");
            Param.Ignore(e);

            EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.serviceProvider).OutputPane;
            if (pane != null)
            {
                if (this.core.Cancel)
                {
                    pane.OutputString(string.Format(
                                          CultureInfo.InvariantCulture, Strings.LogBreak, Strings.Cancelled));
                }
                else
                {
                    pane.OutputString(string.Format(
                                          CultureInfo.InvariantCulture, Strings.LogBreak, Strings.Done));

                    pane.OutputString(string.Format(CultureInfo.InvariantCulture, Strings.ViolationCount, this.violationCount) + "\n\n\n");
                }
            }

            if (this.violationCount > 0)
            {
                this.ProvideEndAnalysisResult(this.violations);
                this.violations = null;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Signals the helper to output that no files were avaliable for analysis.
 /// </summary>
 protected override void NoFilesToAnalyze()
 {
     EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.ServiceProvider).OutputPane;
     if (pane != null)
     {
         pane.OutputString(string.Format(
                               CultureInfo.InvariantCulture, Strings.MiniLogBreak, Strings.NoFilesToAnalyze));
     }
 }
Esempio n. 3
0
 public void LogMessages(string message)
 {
     GetOutputWindow();
     if (newOutputWindow != null && message != null && message.Length > 0)
     {
         // write the text and append a new line after
         newOutputWindow.OutputString(message + "\n");
         System.Windows.Forms.Application.DoEvents();
     }
 }
Esempio n. 4
0
        public void WriteLine(string line)
        {
            if (!Initialize() || line == null)
            {
                return;
            }

            line += "\r\n";
            Match match = WarningsRegex.Match(line);

            if (match.Success)
            {
                _outputPane.OutputTaskItemString(line, vsTaskPriority.vsTaskPriorityMedium, null, vsTaskIcon.vsTaskIconComment, match.Groups[1].Value, int.Parse(match.Groups[2].Value), match.Groups[3].Value);
            }
            else if ((match = ErrorsRegex.Match(line)).Success)
            {
                _outputPane.OutputTaskItemString(line, vsTaskPriority.vsTaskPriorityHigh, null, vsTaskIcon.vsTaskIconCompile, match.Groups[1].Value, int.Parse(match.Groups[2].Value), match.Groups[3].Value);
            }
            else
            {
                _outputPane.OutputString(line);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Signals the helper to output that analysis has begun.
        /// </summary>
        protected override void SignalAnalysisStarted()
        {
            // Write out our header to the output window.
            EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.ServiceProvider).OutputPane;
            if (pane != null)
            {
                pane.Clear();
                pane.Activate();

                VSWindows.GetInstance(this.ServiceProvider).OutputWindow.Activate();

                pane.OutputString(string.Format(
                                      CultureInfo.InvariantCulture, Strings.MiniLogBreak, Strings.StyleCopStarted));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Called when output should be added to the Ouput pane.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">Contains the output string.</param>
        private void CoreOutputGenerated(object sender, OutputEventArgs e)
        {
            Param.Ignore(sender, e);

            // Make sure this is running on the main thread.
            if (InvisibleForm.Instance.InvokeRequired)
            {
                EventHandler <OutputEventArgs> outputDelegate = new EventHandler <OutputEventArgs>(
                    this.CoreOutputGenerated);

                InvisibleForm.Instance.Invoke(outputDelegate, sender, e);
            }
            else
            {
                EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this.serviceProvider).OutputPane;
                if (pane != null)
                {
                    pane.OutputString(e.Output);
                }
            }
        }
Esempio n. 7
0
        public static void OutPut(this DTE dte, string message, bool isnewline, string panename = "")
        {
            var outputwindow = ((DTE2)dte).ToolWindows.OutputWindow;

            EnvDTE.OutputWindowPane pane = outputwindow.ActivePane;
            if (!string.IsNullOrWhiteSpace(panename))
            {
                pane = null;
                foreach (OutputWindowPane item in outputwindow.OutputWindowPanes)
                {
                    if (item.Name.Equals(panename))
                    {
                        pane = item;
                        break;
                    }
                }
                if (pane == null)
                {
                    pane = outputwindow.OutputWindowPanes.Add(panename);
                }
            }
            pane.OutputString(message + (isnewline ? Environment.NewLine : ""));
        }
Esempio n. 8
0
 public static EnvDTE.OutputWindowPane writeLine(this EnvDTE.OutputWindowPane outputWindow, string text)
 {
     outputWindow.OutputString(text.line());
     return(outputWindow);
 }
Esempio n. 9
0
 public void OutputString(string s)
 {
     _outputWindowPane.OutputString(s);
 }