public ProblemReason this[DbgKey key] { get { return((ProblemReason)probs[key.Name]); } }
public static void Assert(bool b, DbgKey key) { Trace.WriteLine("Assert: " + key.Name); if (problems.Contains(key)) { string explanation = GetExplanation(key); MessageBox.Show( explanation, "Program Stopped", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1); } else { MessageBox.Show( "A fatal problem has occurred.\n\nReference: " + key.Name, "Program Stopped", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1); } Trace.Close(); Process.GetCurrentProcess().Kill(); }
// Put together the list of possible reasons for the particular problem. private static string GetExplanation(DbgKey key) { ProblemReason ps = problems[key]; string explanation = ps.GetProblem() + "\n\nPossible reasons:\n\n"; int n = 1; foreach (string sol in ps.GetReasons()) { explanation += " " + n.ToString() + ". " + sol + "\n"; ++n; } return(explanation); }
public static void Warn(bool b, DbgKey key) { Trace.WriteLine("Warning: " + key.Name); if (problems.Contains(key)) { string explanation = GetExplanation(key); MessageBox.Show( explanation, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } else { MessageBox.Show( "A problem has occurred that should be corrected.\n\nReference: " + key.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } }
public bool Contains(DbgKey key) { return(probs.Contains(key.Name)); }
public void Add(DbgKey key, string problem, string[] reasonList) { probs.Add(key.Name, new ProblemReason(problem, reasonList)); }