예제 #1
0
        public void HandleException(VulcanMessage e)
        {
            ConsoleColor color = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Red;
            //Console.Error.WriteLine("{0}:{1}", Name, e.Message);
            Console.ForegroundColor = color;
        }
예제 #2
0
        public void Trace(VulcanMessage e)
        {
            ClearStatus();

            _errorDictionary[e.Severity].Add(e);
            if (e.Severity == Severity.Debug)
            {
                if (VulcanEngine.Properties.Settings.Default.ShowDebug)
                {
                    Console.WriteLine("{0}:{1}", Name, e.Message);
                }
            }
            else if (e.Severity == Severity.Alert)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("{0}:{1}", Name, e.Message);
                Console.ForegroundColor = color;
            }
            else if (e.Severity == Severity.Warning)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Error.WriteLine("{0}:{1}", Name, e.Message);
                Console.ForegroundColor = color;
            }
            else if (e.Severity == Severity.Error)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Error.WriteLine("{0}:{1}", Name, e.Message);
                Console.ForegroundColor = color;
            }
            else
            {
                if (VulcanEngine.Properties.Settings.Default.ShowNotifications || e.Severity == Severity.Alert)
                {
                    Console.WriteLine("{0}:{1}", Name, e.Message);
                }
            }
            if ((e.Severity == Severity.Error) && (_breakOnError))
            {
                HandleException(e);
                ThrowException(e);
            }

            DisplayStatus();
        }
예제 #3
0
        public static void Trace(VulcanMessage vulcanMessage)
        {
            _errorDictionary[vulcanMessage.Severity].Add(vulcanMessage);

            if (!MSBuildTrace(vulcanMessage))
            {
                ClearStatus();
                int lineWidth = _consoleIsValid ? Console.BufferWidth : Int32.MaxValue;
                if (vulcanMessage.Severity == Severity.Debug)
                {
                    if (Settings.Default.ShowDebug)
                    {
                        WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth);
                    }
                }
                else if (vulcanMessage.Severity == Severity.Alert)
                {
                    ConsoleColor color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Green;
                    WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth);
                    Console.ForegroundColor = color;
                }
                else if (vulcanMessage.Severity == Severity.Warning)
                {
                    ConsoleColor color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Error, lineWidth);
                    Console.ForegroundColor = color;
                }
                else if (vulcanMessage.Severity == Severity.Error)
                {
                    ConsoleColor color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Red;
                    WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Error, lineWidth);
                    Console.ForegroundColor = color;
                }
                else
                {
                    if (Settings.Default.ShowNotifications || vulcanMessage.Severity == Severity.Alert)
                    {
                        WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth);
                    }
                }
                DisplayStatus();
            }
        }
예제 #4
0
        private static bool MSBuildTrace(VulcanMessage message)
        {
            if (MSBuildTask != null)
            {
                switch (message.Severity)
                {
                    case Severity.Error:
                        MSBuildTask.BuildEngine.LogErrorEvent
                            (
                            new BuildErrorEventArgs
                                (
                                String.Empty,
                                message.Code, message.FileName,
                                message.Line, message.Offset,
                                0,
                                0,
                                message.AnnotatedMessage,
                                String.Empty,
                                String.Empty
                                )
                             );

                        break;
                    case Severity.Warning:
                        MSBuildTask.BuildEngine.LogWarningEvent(
                            new BuildWarningEventArgs
                                (
                                String.Empty,
                                message.Code, message.FileName,
                                message.Line, message.Offset,
                                0,
                                0,
                                message.AnnotatedMessage,
                                String.Empty,
                                String.Empty
                                )
                            );
                        break;
                    case Severity.Notification:
                        MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low));
                        break;
                    case Severity.Alert:
                        MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.High));
                        break;
            #if DEBUG
                    case Severity.Debug:
                        MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low));
                        break;
            #endif
                    default:
                        MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Normal));
                        break;
                } // end switch(message.Severity)
                return true;
            } // end #if msbuild!=null
            return false;
        }
예제 #5
0
        public static void Trace(VulcanMessage vulcanMessage)
        {
            _errorDictionary[vulcanMessage.Severity].Add(vulcanMessage);

            if (!MSBuildTrace(vulcanMessage))
            {
                ClearStatus();
                int lineWidth = _consoleIsValid ? Console.BufferWidth : Int32.MaxValue;
                if (vulcanMessage.Severity == Severity.Debug)
                {
                    if (Settings.Default.ShowDebug)
                    {
                        WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth);
                    }
                }
                else if (vulcanMessage.Severity == Severity.Alert)
                {
                    ConsoleColor color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Green;
                    WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth);
                    Console.ForegroundColor = color;
                }
                else if (vulcanMessage.Severity == Severity.Warning)
                {
                    ConsoleColor color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Error, lineWidth);
                    Console.ForegroundColor = color;
                }
                else if (vulcanMessage.Severity == Severity.Error)
                {
                    ConsoleColor color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Red;
                    WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Error, lineWidth);
                    Console.ForegroundColor = color;
                }
                else
                {
                    if (Settings.Default.ShowNotifications || vulcanMessage.Severity == Severity.Alert)
                    {
                        WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth);
                    }
                }
                DisplayStatus();
            }
        }
예제 #6
0
        private static bool MSBuildTrace(VulcanMessage message)
        {
            if (MSBuildTask != null)
            {
                switch (message.Severity)
                {
                case Severity.Error:
                    MSBuildTask.BuildEngine.LogErrorEvent
                    (
                        new BuildErrorEventArgs
                        (
                            String.Empty,
                            message.Code, message.FileName,
                            message.Line, message.Offset,
                            0,
                            0,
                            message.AnnotatedMessage,
                            String.Empty,
                            String.Empty
                        )
                    );

                    break;

                case Severity.Warning:
                    MSBuildTask.BuildEngine.LogWarningEvent(
                        new BuildWarningEventArgs
                        (
                            String.Empty,
                            message.Code, message.FileName,
                            message.Line, message.Offset,
                            0,
                            0,
                            message.AnnotatedMessage,
                            String.Empty,
                            String.Empty
                        )
                        );
                    break;

                case Severity.Notification:
                    MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low));
                    break;

                case Severity.Alert:
                    MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.High));
                    break;

#if DEBUG
                case Severity.Debug:
                    MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low));
                    break;
#endif
                default:
                    MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Normal));
                    break;
                } // end switch(message.Severity)
                return(true);
            }     // end #if msbuild!=null
            return(false);
        }
예제 #7
0
파일: Message.cs 프로젝트: japj/vulcan
 public void HandleException(VulcanMessage e)
 {
     ConsoleColor color = Console.ForegroundColor;
     Console.ForegroundColor = ConsoleColor.Red;
     //Console.Error.WriteLine("{0}:{1}", Name, e.Message);
     Console.ForegroundColor = color;
 }
예제 #8
0
파일: Message.cs 프로젝트: japj/vulcan
 public void ThrowException(VulcanMessage e)
 {
     throw new Exception(e.Message);
 }
예제 #9
0
파일: Message.cs 프로젝트: japj/vulcan
        public void Trace(VulcanMessage e)
        {
            ClearStatus();

            _errorDictionary[e.Severity].Add(e);
            if (e.Severity == Severity.Debug)
            {
                if (VulcanEngine.Properties.Settings.Default.ShowDebug)
                {
                    Console.WriteLine("{0}:{1}", Name, e.Message);
                }
            }
            else if (e.Severity == Severity.Alert)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("{0}:{1}", Name, e.Message);
                Console.ForegroundColor = color;
            }
            else if (e.Severity == Severity.Warning)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Error.WriteLine("{0}:{1}", Name, e.Message);
                Console.ForegroundColor = color;
            }
            else if (e.Severity == Severity.Error)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Error.WriteLine("{0}:{1}", Name, e.Message);
                Console.ForegroundColor = color;
            }
            else
            {
                if (VulcanEngine.Properties.Settings.Default.ShowNotifications || e.Severity == Severity.Alert)
                {
                    Console.WriteLine("{0}:{1}", Name, e.Message);
                }
            }
            if ((e.Severity == Severity.Error) && (_breakOnError))
            {
                HandleException(e);
                ThrowException(e);
            }

            DisplayStatus();
        }
예제 #10
0
파일: Message.cs 프로젝트: japj/vulcan
 public void Trace(Severity severity, Exception exception, string message, params object[] formatParameters)
 {
     VulcanMessage ve = new VulcanMessage(severity, exception, message, formatParameters);
     this.Trace(ve);
 }
예제 #11
0
 public void ThrowException(VulcanMessage e)
 {
     throw new Exception(e.Message);
 }
예제 #12
0
        public void Trace(Severity severity, Exception exception, string message, params object[] formatParameters)
        {
            VulcanMessage ve = new VulcanMessage(severity, exception, message, formatParameters);

            this.Trace(ve);
        }