public override void PostRun(Command cmd) { if (cmd.ErrorThrown) { return; } if (cmd is CommandWithFileOutput && cmd.Execute) { CommandWithFileOutput cmdWithOutput = (CommandWithFileOutput)cmd; if (string.IsNullOrEmpty(cmdWithOutput.FileName)) { return; } try { if (cmdWithOutput.CreateBackupFile && File.Exists(cmdWithOutput.FileName)) { string backupFileName = string.IsNullOrEmpty(Path.GetDirectoryName(cmdWithOutput.FileName)) ? Path.GetFileNameWithoutExtension(cmdWithOutput.FileName) : Path.GetDirectoryName(cmdWithOutput.FileName) + @"\" + Path.GetFileNameWithoutExtension(cmdWithOutput.FileName); backupFileName += ".bak"; File.Copy(cmdWithOutput.FileName, backupFileName, true); } TextWriter tw = new StreamWriter(cmdWithOutput.FileName, cmdWithOutput.Append); if (cmd.OutputManager.HasUCFOutput) { Write(tw, !cmdWithOutput.OutputManager.UCFTraceEndsWithNewLine, cmdWithOutput.OutputManager.GetUCFOuput()); } if (cmd.OutputManager.HasVHDLOutput) { Write(tw, !cmdWithOutput.OutputManager.VHDLTraceEndsWithNewLine, cmdWithOutput.OutputManager.GetVHDLOuput()); } if (cmd.OutputManager.HasTCLOutput) { Write(tw, !cmdWithOutput.OutputManager.TCLTraceEndsWithNewLine, cmdWithOutput.OutputManager.GetTCLOuput()); } if (cmd.OutputManager.HasOutput) { Write(tw, !cmdWithOutput.OutputManager.OutputEndsWithNewLine, cmdWithOutput.OutputManager.GetOutput()); } if (cmd.OutputManager.HasWrapperOutput) { Write(tw, !cmdWithOutput.OutputManager.WrapperTraceEndsWithNewLine, cmdWithOutput.OutputManager.GetWrapperOuput()); } tw.Close(); } catch (Exception e) { Console.WriteLine(e.Message); } } }
public override void PostRun(Command cmd) { // no print outs when mute if (CommandExecuter.Instance.MuteOutput || cmd.Mute) { return; } // no console print out for command with file outputs if (cmd is CommandWithFileOutput) { CommandWithFileOutput cmdWithOutput = (CommandWithFileOutput)cmd; if (!string.IsNullOrEmpty(cmdWithOutput.FileName)) { return; } } if (cmd.OutputManager.HasWarnings) { Console.ForegroundColor = ConsoleColor.Yellow; Write(cmd.OutputManager.GetWarnings()); Console.ResetColor(); } if (cmd.OutputManager.HasOutput) { Write(cmd.OutputManager.GetOutput()); } // console takes verly long to print huge text, supress output /* * if (cmd.OutputManager.HasUCFOutput) * { * this.Write(cmd.OutputManager.GetUCFOuput()); * } * if (cmd.OutputManager.HasVHDLOutput) * { * this.Write(cmd.OutputManager.GetVHDLOuput()); * }*/ }