/// <summary> /// Writes a line of output to the output window. /// </summary> /// <param name="output">The text to output.</param> public void AddOutput(string output) { Param.RequireNotNull(output, "output"); if (InvisibleForm.Instance.InvokeRequired) { AddOutputEventHandler outputDelegate = new AddOutputEventHandler(this.AddOutput); InvisibleForm.Instance.Invoke(outputDelegate, output); } else { EnvDTE.OutputWindowPane pane = VSWindows.GetInstance(this).OutputPane; if (pane != null) { pane.OutputLine(output); } } }
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; }
private void WaitForBuildToFinish(EnvDTE.OutputWindowPane buildOutputWindowPane) { var buildManager = GetGlobalService <SVsSolutionBuildManager, IVsSolutionBuildManager2>(); using (var semaphore = new SemaphoreSlim(1)) using (var solutionEvents = new UpdateSolutionEvents(buildManager)) { semaphore.Wait(); UpdateSolutionEvents.UpdateSolutionDoneEvent @event = (bool succeeded, bool modified, bool canceled) => semaphore.Release(); solutionEvents.OnUpdateSolutionDone += @event; try { semaphore.Wait(); } finally { solutionEvents.OnUpdateSolutionDone -= @event; } } }
public OutputWindowPaneAppender(EnvDTE.OutputWindowPane outputWindowPane, Level maxLevel) { this.outputWindowPane = outputWindowPane; LevelRangeFilter filter = new LevelRangeFilter(); filter.LevelMin = maxLevel; base.AddFilter(filter); PatternLayout layout = new PatternLayout(); if (maxLevel.CompareTo(Level.Debug) <= 0) { layout.ConversionPattern = "%date %-5level %logger - %message%newline"; } else { layout.ConversionPattern = "[%level] %message%newline"; } layout.ActivateOptions(); base.Layout = layout; }
/// <summary> /// 输出信息到VS的"输出"窗口,如果"输出"窗口未打开,则打开后再输出 /// </summary> /// <param name="msg"></param> internal static void OutPutMsg(string msg, bool clear = false) { EnvDTE.OutputWindowPanes panels = _dte.ToolWindows.OutputWindow.OutputWindowPanes; // 输出窗口中的一个自定义项的标题 string title = "发布插件 消息"; // EnvDTE.OutputWindowPane panel = null; foreach (EnvDTE.OutputWindowPane item in panels) { if (item.Name == title) { panel = item; break; } } if (panel == null) { panel = panels.Add(title); } // 清空消息 if (clear) { panel.Clear(); } // 激活输出窗口的该面板 panel.Activate(); // 输出消息 panel.OutputString(msg); // 显示(激活) vs"输出"窗口 string winCaption = "输出"; _dte.Windows.Item(winCaption).Activate(); }
public BuildLogger(EnvDTE.OutputWindowPane outputPane) { OutputPane = outputPane; IndentLevel = 2; }
/// [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); } }
private void InitializeTool() { mOutLog = null; mProjItem = (EnvDTE.ProjectItem)GetService(typeof(EnvDTE.ProjectItem)); string tooln = "eBayWebServiceGenerator"; if (mProjItem == null || mProjItem.Name == String.Empty) { tooln = "eBayWebServiceGenerator"; } else { tooln = mProjItem.Name; EnvDTE.Window win = mProjItem.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); EnvDTE.OutputWindow ow = (EnvDTE.OutputWindow) win.Object; foreach (EnvDTE.OutputWindowPane owPane in ow.OutputWindowPanes) { if (owPane.Name == tooln) { mOutLog = owPane; break; } } if (mOutLog == null) { mOutLog = ow.OutputWindowPanes.Add(tooln); } mOutLog.Activate(); } }
/// <summary> /// Detaching OWP. /// </summary> public void paneDetach() { _paneCOM = null; _paneDTE = null; dte = null; }
/// <summary> /// Initialization of the EnvDTE.OutputWindowPane /// </summary> /// <param name="name">Name of the pane</param> /// <param name="dte2"></param> public void paneAttach(string name, EnvDTE80.DTE2 dte2) { dte = (EnvDTE.DTE)dte2; if(_paneCOM != null || _paneDTE != null) { Log.Debug("paneAttach-DTE: skipped"); return; // currently we work only with one pane } try { _paneDTE = dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item(name); } catch(ArgumentException) { _paneDTE = dte2.ToolWindows.OutputWindow.OutputWindowPanes.Add(name); } catch(Exception ex) { Log.Error("Log :: inner exception: '{0}'", ex.ToString()); } }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="applicationObject">Top-level Visual Studio Automation object</param> public static void Initialize(Package package, EnvDTE80.DTE2 applicationObject, EnvDTE.OutputWindowPane owp) { Instance = new CreateBizTalkBuildAndDeployScript(package); Instance._applicationObject = applicationObject; Instance._owp = owp; Helpers.BizTalkBuildAndDeployHelper.Owp = owp; owp.OutputString(string.Format("Create BizTalk Build and Deploy script command initialized")); owp.OutputString(Environment.NewLine); }
public VisualStudioWriter(DTE dte, System.IServiceProvider serviceProvider) { _outputWindowPane = LoadOutputWindowPane(dte); }
public BuildMonitorCallback(DTE2 dte) { var vsOutputWindow = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); var outputWindow = (EnvDTE.OutputWindow)vsOutputWindow.Object; buildPane = outputWindow.OutputWindowPanes.Item("Build"); }
public BuildCallback(IVsProject project, EnvDTE.OutputWindowPane outputPane) { _project = project; _outputPane = outputPane; }
void BuildOutputReceived(EnvDTE.OutputWindowPane buildPane, DataReceivedEventArgs args) { buildPane.OutputString(args.Data + Environment.NewLine); }