コード例 #1
0
        protected void LogWarning(string warningCaption)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(String.Format("\t {0}", warningCaption));
            Console.ResetColor();
            ProgramStepReport step = new ProgramStepReport
            {
                Text = warningCaption,
                Time = DateTime.UtcNow,
                Type = ProgramStepReportType.Warning
            };

            Report.Steps.Add(step);
        }
コード例 #2
0
        protected void LogHint(string hintCaption)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(String.Format("\t {0}", hintCaption));
            Console.ResetColor();
            ProgramStepReport step = new ProgramStepReport
            {
                Text = hintCaption,
                Time = DateTime.UtcNow,
                Type = ProgramStepReportType.Hint
            };

            Report.Steps.Add(step);
        }
コード例 #3
0
 public virtual void OnError(Exception exception)
 {
     Console.CursorLeft = Console.WindowWidth - 7;
     Console.Write("[");
     Console.ForegroundColor = ConsoleColor.Red;
     Console.Write("FAIL");
     Console.ResetColor();
     Console.WriteLine("]");
     ActionStarted = false;
     if (CurrentStep != null)
     {
         CurrentStep.Success = false;
         CurrentStep.Error   = exception.Message;
         Report.Steps.Add(CurrentStep);
         CurrentStep = null;
     }
 }
コード例 #4
0
        protected void LogStage(string stageCaption)
        {
            if (ActionStarted)
            {
                LogActionSuccess();
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(String.Format("\t {0}", stageCaption));
            Console.ResetColor();

            ProgramStepReport step = new ProgramStepReport
            {
                Text = stageCaption,
                Time = DateTime.UtcNow,
                Type = ProgramStepReportType.Stage
            };

            Report.Steps.Add(step);
        }
コード例 #5
0
 protected void LogActionSuccess()
 {
     if (ActionStarted)
     {
         Console.CursorLeft = Console.WindowWidth - 5;
         Console.Write("[");
         Console.ForegroundColor = ConsoleColor.Green;
         Console.Write("OK");
         Console.ResetColor();
         Console.WriteLine("]");
         ActionStarted = false;
         if (CurrentStep != null)
         {
             CurrentStep.Success = true;
             Report.Steps.Add(CurrentStep);
             CurrentStep = null;
         }
     }
 }
コード例 #6
0
        protected void LogStartAction(string actionCaption)
        {
            if (ActionStarted)
            {
                LogActionSuccess();
            }
            Console.Write(" ({0})\t {1}", ++ActionCounter, actionCaption);
            ActionStarted = true;

            CurrentStep = new ProgramStepReport
            {
                Time  = DateTime.UtcNow,
                Type  = ProgramStepReportType.Step,
                Text  = actionCaption,
                Index = ActionCounter
            };

            Console.CursorLeft      = Console.WindowWidth - 5;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write("[??]");
            Console.ResetColor();
        }