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


C# BuildFinishedEventArgs.ToPropertyValues方法代码示例

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


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

示例1: BuildFinished

        void BuildFinished(object sender, BuildFinishedEventArgs e)
        {
            AppendLine(string.Format("#Build Finished"));
            if (IsVerbosityAtLeast(LoggerVerbosity.Detailed)) {
                AppendLine(e.ToPropertyValues().ToMarkdownTable().ToMarkdown());
            }

            AppendLine("Target summary".ToMarkdownSubHeader().ToMarkdown());
            var targetSummary = from t in this._targetsExecuted
                     orderby  t.Value.TimeSpent descending
                     select new Tuple<string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

            AppendLine(targetSummary.ToList().ToMarkdownBarChart().ToMarkdown());

            AppendLine("Task summary".ToMarkdownSubHeader().ToMarkdown());
            var taskSummary = from t in this._taskExecuted
                                orderby t.Value.TimeSpent descending
                                select new Tuple<string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

            AppendLine(taskSummary.ToList().ToMarkdownBarChart().ToMarkdown());
        }
开发者ID:sayedihashimi,项目名称:msbuild-analyzer,代码行数:21,代码来源:MarkdownLogger.cs

示例2: BuildFinished

        void BuildFinished(object sender, BuildFinishedEventArgs e)
        {
            AppendLine(string.Format("####Build Finished").ToMarkdownRawMarkdown());
            AppendLine(e.Message.ToMarkdownParagraph());

            if (IsVerbosityAtLeast(LoggerVerbosity.Diagnostic)) {
                AppendLine(e.ToPropertyValues().ToMarkdownTable().ToMarkdown().ToMarkdownRawMarkdown());

                if (e.BuildEventContext != null) {
                    AppendLine(e.BuildEventContext.ToPropertyValues().ToMarkdownTable().ToMarkdown().ToMarkdownRawMarkdown());
                }

            AppendLine("Target summary".ToMarkdownSubHeader());
            var targetSummary = from t in this._targetsExecuted
                                orderby t.Value.TimeSpent descending
                                select new Tuple<string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

            AppendLine(targetSummary.ToList().ToMarkdownBarChart());

            AppendLine("Task summary".ToMarkdownSubHeader());
            var taskSummary = from t in this._taskExecuted
                              orderby t.Value.TimeSpent descending
                              select new Tuple<string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

            AppendLine(taskSummary.ToList().ToMarkdownBarChart());
            }

            List<IMarkdownElement> toc = new List<IMarkdownElement>();
            toc.Add("#### Build Summary\r\n".ToMarkdownRawMarkdown());
            // toc.Add(new HorizontalRule());

            foreach (var project in this._projectsExecuted.OrderBy(p=>p.StartedArgs.Timestamp)) {
                string formatStr = @" - [{0}]({1}) | {2} | ```time={3} targets={4}```";

                ProjectFinishedEventArgs finishedArgs = project.FinishedArgs as ProjectFinishedEventArgs;
                string failStr = finishedArgs.Succeeded ? string.Empty : @"<font color=""red"">Failed</font>";

                string color = finishedArgs.Succeeded ? "green" : "red";

                string statusString = string.Format(
                    @"<font color=""{0}"">{1}</font>",
                    color,
                    finishedArgs.Succeeded ? "Succeeded" : "Failed");

                string targetNames = (project.StartedArgs as ProjectStartedEventArgs).TargetNames;
                if (string.IsNullOrEmpty(targetNames)) {
                    targetNames = "(default targets)";
                }

                string md = string.Format(
                                formatStr,
                                Path.GetFileName(project.Name),
                                this.GetLinkNameFor(project.StartedArgs as ProjectStartedEventArgs),
                                statusString,
                                string.Format("{0}s",project.TimeSpent.TotalSeconds),
                                targetNames
                                );

                toc.Add(md.ToMarkdownRawMarkdown());
            }
            toc.AddRange(MdElements);
            MdElements = toc;
        }
开发者ID:40a,项目名称:psbuild-1,代码行数:63,代码来源:MarkdownLogger.cs


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