示例#1
0
        private static void ReportToConsole(MessageType messageType, string timestamp, string File, string Method, string Linenumber, string TypeName, string title, string body)
        {
            try
            {
                if (DebugReporter._isConsoleOpen == false)
                {
                    DebugReporter.OpenDebugConsole();
                }

                if (messageType == MessageType.Error)
                {
                    Console.WriteLine("*****************");
                }
                Console.WriteLine(messageType.ToString());
                Console.WriteLine(timestamp);
                Console.WriteLine("File: " + File);
                Console.WriteLine("Type: " + TypeName);
                Console.WriteLine("Method: " + Method);
                Console.WriteLine("Line: " + Linenumber);
                Console.WriteLine(title);
                Console.WriteLine(body);
                if (messageType == MessageType.Error)
                {
                    Console.WriteLine("*****************");
                }
                Console.WriteLine("");
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
0
        private static void SetDebugMode(DebugMode mode)
        {
            //Perform Setup for the new mode...
            switch (mode)
            {
            case DebugMode.File:
                try
                {
                    FileInfo fi = new FileInfo(DebugReporter._outputFilePath);

                    if (!Directory.Exists(fi.Directory.FullName))
                    {
                        Directory.CreateDirectory(fi.Directory.FullName);
                    }

                    if (File.Exists(DebugReporter._outputFilePath))
                    {
                        break;
                    }
                    else
                    {
                        File.CreateText(DebugReporter._outputFilePath).Close();
                    }

                    DebugReporter._debugMode = mode;
                }
                catch (Exception ex)
                {
                    DebugReporter.KillDebugReporter("Failed to set DebugMode File.\nException:\n" + ex.Message);
                    return;
                }
                break;

            case DebugMode.Email:
                throw new NotImplementedException("This feature is not available in this project...");

            case DebugMode.Console:
                try
                {
                    DebugReporter.OpenDebugConsole();
                    DebugReporter._debugMode = mode;
                }
                catch (Exception ex)
                {
                    DebugReporter.KillDebugReporter("Failed to set DebugMode Console.\nException:\n" + ex.Message);
                    return;
                }

                break;

            case DebugMode.Wreq_v1:
                throw new NotImplementedException("This feature is not available in this project...");

            case DebugMode.None:
                DebugReporter._debugMode = mode;
                break;

            default:
                break;
            }

            DebugReporter.Report(MessageType.Internal,
                                 "Debug mode changed.",
                                 "DebugReporter Debug Mode changed to:\n" +
                                 DebugReporter._debugMode.ToString());
        }