Beispiel #1
0
 /// <summary>
 /// Kills the debug reporter, stops all reporting
 /// </summary>
 /// <param name="reason">Reason to kill the reporter.</param>
 private static void KillDebugReporter(string reason)
 {
     if (DebugReporter._dManagerStatus == ReporterStatus.OK)
     {
         DebugReporter.DebugMode = DebugMode.Output;
         DebugReporter.Report(MessageType.Internal,
                              "Error", reason);
         DebugReporter._dManagerStatus = ReporterStatus.Dead;
     }
     else
     {
         DebugReporter._dManagerStatus = ReporterStatus.Dead;
         return;
     }
 }
Beispiel #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());
        }