@@ -50,6 +50,18 @@ private static int Main(string[] args)
5050 bool booCounter = true ;
5151 bool booResetCounter = false ;
5252
53+ ////// / / / / / / / / / / / / /
54+ // Log writer START
55+ Trace . AutoFlush = false ;
56+
57+ Logger . traceSwitch . Level = ( TraceLevel ) verbosity ; //TraceLevel.Info;
58+ Trace . Listeners . Clear ( ) ;
59+
60+ TextWriterTraceListener listener = new TextWriterTraceListener ( Console . Out ) ;
61+ Trace . Listeners . Add ( listener ) ;
62+
63+ ConsoleWidth = Logger . GetConsoleWidth ( ) ;
64+
5365 var p = new OptionSet ( ) {
5466 { "i|input=" , "The {INPUTFILE} to process. " + Environment . NewLine + "If file extention is omitted, .gcode will be assumed." ,
5567 v => strINputFile = v } ,
@@ -91,17 +103,6 @@ private static int Main(string[] args)
91103 return 1 ;
92104 }
93105
94- ////// / / / / / / / / / / / / /
95- // Log writer START
96- Trace . AutoFlush = true ;
97- ConsoleWidth = Logger . GetConsoleWidth ( ) ;
98-
99- Logger . traceSwitch . Level = ( TraceLevel ) verbosity ; //TraceLevel.Info;
100- Trace . Listeners . Clear ( ) ;
101-
102- TextWriterTraceListener listener = new TextWriterTraceListener ( Console . Out ) ;
103- Trace . Listeners . Add ( listener ) ;
104-
105106 if ( show_help )
106107 {
107108 ShowHelp ( p ) ;
@@ -129,9 +130,9 @@ private static int Main(string[] args)
129130 if ( ! WaitForFile ( strINputFile , 30 ) )
130131 {
131132 Console . WriteLine ( " " ) ;
132- Logger . LogInfo ( "I assume there is no file:" ) ;
133+ Logger . LogWarning ( "I assume there is no file:" ) ;
133134 PrintFileSummary ( strINputFile ) ;
134- Logger . LogInfo ( "Please try again later or check your input." ) ;
135+ Logger . LogWarning ( "Please try again later or check your input." ) ;
135136#if DEBUG
136137 {
137138 Console . WriteLine ( "Press any key to continue . . ." ) ;
@@ -567,16 +568,30 @@ private static string TrimComment(string line)
567568
568569 private static void ShowHelp ( OptionSet p )
569570 {
571+ ConsoleColor fg = Console . ForegroundColor ;
572+ ConsoleColor bg = Console . BackgroundColor ;
573+
570574 Console . WriteLine ( ) ;
571- Console . WriteLine ( "This program is for use with Slic3r or standalone." ) ;
575+ Console . BackgroundColor = ConsoleColor . Black ;
576+ Console . ForegroundColor = ConsoleColor . Yellow ;
577+
578+ string textnote = "This program is for use with Slic3r (or standalone)." ;
579+ int textlength = textnote . Length ;
580+ int paaad = ( Program . ConsoleWidth - textlength ) / 2 ;
581+
582+ Console . WriteLine ( "" . PadLeft ( paaad ) + textnote . PadRight ( Program . ConsoleWidth - paaad ) ) ;
583+ Console . ResetColor ( ) ;
572584 Console . WriteLine ( ) ;
573585 Console . WriteLine ( "Slic3r -> Print Settings -> Output options" ) ;
574586 Console . WriteLine ( " * Enable Verbose G-Code (!)" ) ;
575587 Console . WriteLine ( " * Put full filename to " + Path . GetFileName ( System . Reflection . Assembly . GetEntryAssembly ( ) . Location ) + " in Post-Processing Scripts." ) ;
576588 Console . WriteLine ( " Current filename: \" " + System . Reflection . Assembly . GetEntryAssembly ( ) . Location + "\" " ) ;
577589
578590 Console . WriteLine ( ) ;
579- Console . WriteLine ( "Standalone usage: Slic3rPostProcessing [OPTIONS]" ) ;
591+ Console . BackgroundColor = ConsoleColor . Black ;
592+ Console . ForegroundColor = ConsoleColor . Yellow ;
593+ Console . WriteLine ( "Standalone usage: Slic3rPostProcessing [OPTIONS]" . PadRight ( Program . ConsoleWidth ) ) ;
594+ Console . ResetColor ( ) ;
580595 Console . WriteLine ( ) ;
581596 Console . WriteLine ( "Options:" ) ;
582597 p . WriteOptionDescriptions ( Console . Out ) ;
@@ -651,21 +666,37 @@ internal class Logger
651666 private static int origBWidth { get ; set ; }
652667 private static int origBHeight { get ; set ; }
653668
669+ private static ConsoleColor fg = Console . ForegroundColor ;
670+ private static ConsoleColor bg = Console . BackgroundColor ;
671+
654672 public static int GetConsoleWidth ( )
655673 {
656- return Console . WindowWidth ;
674+ // IntPtr myHandle = Process.GetCurrentProcess().MainWindowHandle;
675+ // NOW WHAT?! What do I do with myHandle? I Need the console!
676+
677+ //return Console.WindowWidth;
678+
679+ return 80 ;
657680 }
658681
659682 public static void LogInfo ( string message )
660683 {
661684 Trace . WriteLineIf ( Logger . traceSwitch . TraceInfo , "Info : " + message ) ;
662685 }
663686
687+ /// <summary>
688+ /// Overwrites current line
689+ /// </summary>
690+ /// <param name="message"></param>
664691 public static void LogInfoOverwrite ( string message )
665692 {
666693 Console . Write ( "\r " + message ) ;
667694 }
668695
696+ /// <summary>
697+ /// Writeline with datetime stamp
698+ /// </summary>
699+ /// <param name="message"></param>
669700 public static void Log ( string message )
670701 {
671702 Trace . WriteLine ( DateTime . Now + " : " + message ) ;
@@ -678,7 +709,10 @@ public static void LogError(string message)
678709
679710 public static void LogWarning ( string message )
680711 {
712+ Console . ForegroundColor = ConsoleColor . Yellow ;
713+ Console . BackgroundColor = ConsoleColor . Black ;
681714 Trace . WriteLineIf ( Logger . traceSwitch . TraceWarning , "WARNING : " + message ) ;
715+ Console . ResetColor ( ) ;
682716 }
683717
684718 public static void LogError ( Exception e )
0 commit comments