当前位置: 首页>>代码示例>>C#>>正文


C# IVsOutputWindowPane.OutputTaskItemString方法代码示例

本文整理汇总了C#中IVsOutputWindowPane.OutputTaskItemString方法的典型用法代码示例。如果您正苦于以下问题:C# IVsOutputWindowPane.OutputTaskItemString方法的具体用法?C# IVsOutputWindowPane.OutputTaskItemString怎么用?C# IVsOutputWindowPane.OutputTaskItemString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVsOutputWindowPane的用法示例。


在下文中一共展示了IVsOutputWindowPane.OutputTaskItemString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObsoleteBuild

        public virtual bool ObsoleteBuild(uint vsopts, string config, IVsOutputWindowPane output, bool fCleanBuild)
        {
            if (fCleanBuild)
            {
                // we are done
                return true;
            }

            lock (Project.BuildLock)
            {
                ProjectOptions options = this.GetProjectOptions(config);
                CompilerResults results;
                ArrayList files = new ArrayList();
/*UNDONE: need to get this to use MSBuild
                foreach (XmlElement e in doc.SelectNodes("//Files/Include/File"))
                {
                    //TODO: Support other "BuildActions" like "EmbeddedResource"...
                    if (e.GetAttribute("BuildAction") == "Compile")
                    {
                        string rel = e.GetAttribute("RelPath");
                        Url url = new Url(new Url(doc.BaseURI), rel);
                        files.Add(url.AbsoluteUrl);
                    }
                }
*/
                try
                {
                    ICodeCompiler compiler = this.GetCompiler();
                    if (files.Count == 1)
                    {
                        string filename = (string)files[0];
                        results = compiler.CompileAssemblyFromFile(options, filename);
                    }
                    else
                    {
                        string[] fileNames = (string[])files.ToArray(typeof(string));
                        results = compiler.CompileAssemblyFromFileBatch(options, fileNames);
                    }
                }
                catch (Exception e)
                {
                    results = new CompilerResults(options.TempFiles);
                    results.Errors.Add(new CompilerError(options.OutputAssembly, 1, 1, "", "Internal Compiler Error: " + e.ToString() + "\n"));
                    results.NativeCompilerReturnValue = 1;
                }
                taskProvider.Tasks.Clear();

                int errorCount = 0;
                int warningCount = 0;

                foreach (CompilerError e in results.Errors)
                {
                    if (e.IsWarning) warningCount++;
                    else
                        errorCount++;

                    NativeMethods.ThrowOnFailure(output.OutputTaskItemString(GetFormattedErrorMessage(e, false) + "\n", VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, "", -1, e.FileName, (uint)e.Line - 1, e.ErrorText));
                }

                NativeMethods.ThrowOnFailure(output.OutputStringThreadSafe("Build complete -- " + errorCount + " errors, " + warningCount + " warnings")); //TODO: globalize
                NativeMethods.ThrowOnFailure(output.FlushToTaskList()); 
                return results.NativeCompilerReturnValue == 0;
            }
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:64,代码来源:Project.cs

示例2: ShowDiagnostics

 /// <summary>
 /// Displays a diagnostic message in the error list window as well as in the output pane
 /// </summary>
 /// <param name="djangoDiagnostics"></param>
 /// <param name="filePath"></param>
 public void ShowDiagnostics(IVsOutputWindowPane djangoDiagnostics, string filePath)
 {
     if (node.ErrorMessage.Severity > 0)
     {
         ITextSnapshotLine line = snapshotSpan.Snapshot.GetLineFromPosition(node.Position);
         djangoDiagnostics.OutputTaskItemString(
             node.ErrorMessage.Message + "\n",
             VSTASKPRIORITY.TP_HIGH,
             VSTASKCATEGORY.CAT_BUILDCOMPILE,
             "",
             (int)_vstaskbitmap.BMP_COMPILE,
             filePath,
             (uint)line.LineNumber,
             node.ErrorMessage.Message + "\n"
             );
     }
     foreach (DesignerNode child in children)
         child.ShowDiagnostics(djangoDiagnostics, filePath);
 }
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:24,代码来源:DesignerNode.cs

示例3: Build

    //////////////////////////////////////////////////////////////////////////////////////////////////    
    // This is called from the compiler background thread.
    //    fCleanBuild is not part of the vsopts, but passed down as the callpath is differently
    //
    //////////////////////////////////////////////////////////////////////////////////////////////////    
    /// <include file='doc\Project.uex' path='docs/doc[@for="Project.Build"]/*' />
    public virtual bool Build(uint vsopts, XmlElement config, IVsOutputWindowPane output, bool fCleanBuild){
      if (fCleanBuild){
        // we are done
        return true;
      }
      lock (Project.BuildLock){
#if LookForMemoryLeaks
        System.GC.Collect();
        System.GC.WaitForPendingFinalizers();
        System.GC.Collect();
        System.GC.WaitForPendingFinalizers();
        long usedMemoryBeforeBuild = System.GC.GetTotalMemory(true);
#endif        
        int errorCount = 0;
        int warningCount = 0;
        CompilerResults results = this.CompileProject(config);

#if WHIDBEY
        if (this.taskManager != null && this.taskManagerBuild != null) {
          taskManager.ClearTasksOnProject(this.Caption);
          taskManagerBuild.ClearTasksOnProject(this.Caption);
          bool runVerifierBuildOnly = this.GetBoolAttr(config, "RunProgramVerifier") && !this.GetBoolAttr(config, "RunProgramVerifierWhileEditing");
          string verifierCode = ((int)System.Compiler.Error.GenericWarning).ToString("0000");
          
          foreach (CompilerError e in results.Errors) {
            if (e.IsWarning)
              warningCount++;
            else
              errorCount++;

            // output.OutputTaskItemString(GetFormattedErrorMessage(e, false) + "\n", VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, "", -1, e.FileName, (uint)e.Line - 1, e.ErrorText);
            int endLine;
            int endColumn;
            if (e is System.Compiler.CompilerErrorEx) {
              System.Compiler.CompilerErrorEx errorEx = (System.Compiler.CompilerErrorEx)e;
              endLine = errorEx.EndLine;
              endColumn = errorEx.EndColumn;
            }
            else {
              endLine = e.Line;
              endColumn = e.Column + 1;
            }

            bool isBuildOnly = runVerifierBuildOnly && e.ErrorNumber == verifierCode;
            
            (isBuildOnly ? taskManagerBuild : taskManager).AddTask(e.ErrorText, null, e.ErrorNumber, "CS" + e.ErrorNumber,
              TaskPriority.Normal, (e.IsWarning ? TaskCategory.Warning : TaskCategory.Error),
              (isBuildOnly ? TaskMarker.Error : (e.IsWarning ? TaskMarker.Warning : TaskMarker.CodeSense)),
              TaskOutputPane.Build, this.Caption, e.FileName,
              e.Line, e.Column, endLine, endColumn, null);
          }
          taskManager.OutputString("Build complete -- " + errorCount + " errors, " + warningCount + " warnings\n", TaskOutputPane.Build);
          taskManager.Refresh();
          taskManagerBuild.Refresh();
        }
        else {
#endif        
          this.taskProvider.ClearErrors();
          foreach (CompilerError e in results.Errors) {
            if (e.IsWarning) warningCount++;
            else
              errorCount++;
            output.OutputTaskItemString(GetFormattedErrorMessage(e, false) + "\n", VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, "", -1, e.FileName, (uint)e.Line - 1, e.ErrorText);
          }
          output.OutputStringThreadSafe("Build complete -- " + errorCount + " errors, " + warningCount + " warnings\n"); //TODO: globalize
          output.FlushToTaskList();
#if WHIDBEY
        }
#endif
        bool success = results.NativeCompilerReturnValue == 0;
#if LookForMemoryLeaks
        results = null;
        System.GC.Collect();
        System.GC.WaitForPendingFinalizers();
        System.GC.Collect();
        System.GC.WaitForPendingFinalizers();
        long usedMemoryAfterBuild = System.GC.GetTotalMemory(true);
        output.OutputStringThreadSafe("Build leaked "+(usedMemoryAfterBuild-usedMemoryBeforeBuild)+" bytes");
#endif
        return success;
      }
    }
开发者ID:dbremner,项目名称:specsharp,代码行数:88,代码来源:Project.cs


注:本文中的IVsOutputWindowPane.OutputTaskItemString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。