Exemple #1
0
 static void PrintConclusion(string prefix, Conclusion conclusion)
 {
     if (conclusion is MultiConclusions)
     {
         foreach (var c in ((MultiConclusions)conclusion).Conclusions)
         {
             PrintConclusion(prefix + "    ", c);
         }
     }
     else if (conclusion is SuccessConclusion)
     {
         FancyConsole.WriteLine("#g" + prefix + ((SuccessConclusion)conclusion).Message);
     }
     else if (conclusion is ExceptionConclusion)
     {
         FancyConsole.DumpException(prefix, ((ExceptionConclusion)conclusion).Exception);
     }
     else if (conclusion is SingeOutputConclusion)
     {
         FancyConsole.WriteLine(prefix + ((SingeOutputConclusion)conclusion).Output);
     }
     else if (conclusion is MultiOutputConclusion)
     {
         var result  = (MultiOutputConclusion)conclusion;
         var outputs = result.GetOutputStrings();
         if (outputs != null && outputs.Count > 0)
         {
             foreach (var s in outputs)
             {
                 FancyConsole.WriteLine(prefix + s);
             }
         }
     }
 }
Exemple #2
0
 public static void DumpException(string prefix, Exception exp)
 {
     if (exp == null)
     {
         return;
     }
     FancyConsole.WriteLine("#r" + prefix + exp.Message);
     if (exp is AggregateException)
     {
         foreach (var e in ((AggregateException)exp).InnerExceptions)
         {
             DumpException("    " + prefix, e);
         }
     }
     else if (exp.InnerException != null)
     {
         DumpException("    " + prefix, exp.InnerException);
     }
 }