示例#1
0
 public ProblemReason this[DbgKey key]
 {
     get
     {
         return((ProblemReason)probs[key.Name]);
     }
 }
示例#2
0
 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();
 }
示例#3
0
        // 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);
        }
示例#4
0
 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);
     }
 }
示例#5
0
 public bool Contains(DbgKey key)
 {
     return(probs.Contains(key.Name));
 }
示例#6
0
 public void Add(DbgKey key, string problem, string[] reasonList)
 {
     probs.Add(key.Name, new ProblemReason(problem, reasonList));
 }