Example #1
0
        public static void Add(MyModContext context, string message, TErrorSeverity severity, bool writeToLog = true)
        {
            var e = new Error()
            {
                ModName   = context.ModName,
                ErrorFile = context.CurrentFile,
                Message   = message,
                Severity  = severity,
            };

            m_errors.Add(e);

            if (context.ModName == null)
            {
                Debug.Fail(e.ToString());
            }

            if (writeToLog)
            {
                WriteError(e);
            }

            if (severity == TErrorSeverity.Critical)
            {
                ShouldShowModErrors = true;
            }
        }
Example #2
0
 public static Color GetSeverityColor(TErrorSeverity severity)
 {
     try
     {
         return(severityColors[(int)severity]);
     }
     catch (Exception e)
     {
         MyLog.Default.WriteLine(String.Format("Error type does not have color assigned: message: {0}, stack:{1}", e.Message, e.StackTrace));
         return(Color.White);
     }
 }
Example #3
0
 public static string GetSeverityName(TErrorSeverity severity, bool plural)
 {
     try
     {
         if (plural)
         {
             return(severityNamePlural[(int)severity]);
         }
         {
             return(severityName[(int)severity]);
         }
     }
     catch (Exception e)
     {
         MyLog.Default.WriteLine(String.Format("Error type does not have name assigned: message: {0}, stack:{1}", e.Message, e.StackTrace));
         return(plural ? "Errors" : "Error");
     }
 }
Example #4
0
 public Message(TErrorSeverity severity, string text) : this()
 {
     Severity = severity;
     Text     = text;
 }
 public Message(TErrorSeverity severity, string text) : this()
 {
     Severity = severity;
     Text = text;
 }