示例#1
0
文件: Program.cs 项目: 71/insider
        private static void MessageLogged(MessageLoggedEventArgs e)
        {
            string prefix = "";

            switch (e.Importance)
            {
            case MessageImportance.Info:
                Console.ForegroundColor = ConsoleColor.White;
                prefix = "[+] {0}";
                break;

            case MessageImportance.Debug:
                Console.ForegroundColor = ConsoleColor.Gray;
                prefix = "[*] {0}";
                break;

            case MessageImportance.Warning:
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                prefix = "[-] {0}";
                break;

            case MessageImportance.Error:
                Console.ForegroundColor = ConsoleColor.Red;
                prefix = "[!] {0}";
                break;
            }

            Console.WriteLine(prefix, e.Message);
            Console.ResetColor();

            if (e.StoppedWeaving)
            {
                EncounteredError = true;
            }
        }
示例#2
0
文件: WeaveTask.cs 项目: 71/insider
        private void MessageLogged(MessageLoggedEventArgs e)
        {
            if (e.StoppedWeaving)
            {
                BuildEngine.LogErrorEvent(new BuildErrorEventArgs("Weaving", "W00", TargetAssembly, -1, -1, -1, -1, e.Message, "", e.Target.GetType().FullName));
                EncounteredError = true;
            }
            else
            {
                switch (e.Importance)
                {
                case MessageImportance.Debug:
                case MessageImportance.Info:
                    BuildEngine.LogMessageEvent(new BuildMessageEventArgs(e.Message, "", e.Target.GetType().FullName, e.Importance == MessageImportance.Debug ? MBF.MessageImportance.Low : MBF.MessageImportance.Normal));
                    break;

                case MessageImportance.Warning:
                    BuildEngine.LogWarningEvent(new BuildWarningEventArgs("Weaving", "W00", TargetAssembly, -1, -1, -1, -1, e.Message, "", e.Target.GetType().FullName));
                    break;
                }
            }
        }