44using System . Reflection ;
55using System . Text ;
66using System . Threading . Tasks ;
7+ using static System . Net . Mime . MediaTypeNames ;
78
89namespace DescribeCompilerCLI
910{
@@ -79,6 +80,14 @@ internal static void printLogo3()
7980 }
8081 internal static void printLogo3 ( ConsoleColor logoColor )
8182 {
83+ Log += @" /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ " + Environment . NewLine ;
84+ Log += @" / \\\\ / \\\\ / \\\\ / \\\\ / \\\\ _\ \\\\ / \\\\ / \\\\ " + Environment . NewLine ;
85+ Log += @" / /\ \\\\ / \ \\\\ /\ \ \\\\ / /\ \\\\ / \ \\\\ /\/ \\\\ / \ \\\\ / \ \\\\" + Environment . NewLine ;
86+ Log += @" \ \/ //// \ \ \//// \ \ \//// \ \\\//// \| //// \ /\//// \ \ //// \ \ \////" + Environment . NewLine ;
87+ Log += @" \ //// \ \//// \ //// \ \\\\ | \//// \ \\\\ \ //// \ \//// " + Environment . NewLine ;
88+ Log += @" \//// \//// \//// \//// \|||| \//// \//// \//// " + Environment . NewLine ;
89+ Log += Environment . NewLine ;
90+
8291 ConsoleColor col = Console . ForegroundColor ;
8392 Console . ForegroundColor = logoColor ;
8493 Console . WriteLine ( ) ;
@@ -97,6 +106,14 @@ internal static void printLogo2()
97106 }
98107 internal static void printLogo2 ( ConsoleColor logoColor )
99108 {
109+ Log += @" /\\\ /\\\ /\\\ /\\\ /\\\ /\\\ /\\\ /\\\ " + Environment . NewLine ;
110+ Log += @" / \\\ / \\\ / \\\ / \\\ / \\\ _\ \\\ / \\\ / \\\ " + Environment . NewLine ;
111+ Log += @" / /\ \\\ / \ \\\ /\ \ \\\ / /\ \\\ / \ \\\ /\/ \\\ / \ \\\ / \ \\\" + Environment . NewLine ;
112+ Log += @" \ \/ /// \ \ \/// \ \ \/// \ \\\/// \| /// \ /\/// \ \ /// \ \ \///" + Environment . NewLine ;
113+ Log += @" \ /// \ \/// \ /// \ \\\ | \/// \ \\\ \ /// \ \/// " + Environment . NewLine ;
114+ Log += @" \/// \/// \/// \/// \||| \/// \/// \/// " + Environment . NewLine ;
115+ Log += Environment . NewLine ;
116+
100117 ConsoleColor col = Console . ForegroundColor ;
101118 Console . ForegroundColor = logoColor ;
102119 Console . WriteLine ( ) ;
@@ -115,6 +132,14 @@ internal static void printLogo3Bicolor()
115132 }
116133 internal static void printLogo3Bicolor ( ConsoleColor colorA , ConsoleColor colorB )
117134 {
135+ Log += @" /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ /\\\\ " + Environment . NewLine ;
136+ Log += @" / \\\\ / \\\\ / \\\\ / \\\\ / \\\\ _\ \\\\ / \\\\ / \\\\ " + Environment . NewLine ;
137+ Log += @" / /\ \\\\ / \ \\\\ /\ \ \\\\ / /\ \\\\ / \ \\\\ /\/ \\\\ / \ \\\\ / \ \\\\" + Environment . NewLine ;
138+ Log += @" \ \/ //// \ \ \//// \ \ \//// \ \\\//// \| //// \ /\//// \ \ //// \ \ \////" + Environment . NewLine ;
139+ Log += @" \ //// \ \//// \ //// \ \\\\ | \//// \ \\\\ \ //// \ \//// " + Environment . NewLine ;
140+ Log += @" \//// \//// \//// \//// \|||| \//// \//// \//// " + Environment . NewLine ;
141+ Log += Environment . NewLine ;
142+
118143 ConsoleColor col = Console . ForegroundColor ;
119144 Console . WriteLine ( ) ;
120145
@@ -256,59 +281,62 @@ internal static void printCmdLine(string[] args)
256281 }
257282 internal static void printExtTemplatesSuccess ( string path )
258283 {
284+ //add to log
285+ Log += "Templates outputted to \" " + path + "\" " + Environment . NewLine ;
286+ Log += "Press any key to exit." + Environment . NewLine ;
287+
288+ //add to console
259289 Console . ForegroundColor = INFO_COLOR ;
260290 Console . WriteLine ( "Templates outputted to \" " + path + "\" " ) ;
261291 Console . WriteLine ( "Press any key to exit." ) ;
262-
263292 Console . ForegroundColor = TEXT_COLOR ;
264293 Console . ReadKey ( ) ;
265294 }
266295 internal static void printHelpMessage ( )
267296 {
268297 ConsoleLogInfo ( "-----------------------------------------------------------------" ) ;
269- Console . WriteLine ( "usage: " + thisName + " help | -h" ) ;
298+ ConsoleLog ( "usage: " + thisName + " help | -h" ) ;
270299 ConsoleLogInfo ( "Display this help message" ) ;
271- Console . WriteLine ( ) ;
300+ ConsoleLog ( "" ) ;
272301 ConsoleLogInfo ( "-----------------------------------------------------------------" ) ;
273- Console . WriteLine ( "usage: " + thisName + " ext [ RESULT_PATH ]" ) ;
302+ ConsoleLog ( "usage: " + thisName + " ext [ RESULT_PATH ]" ) ;
274303 ConsoleLogInfo ( "externalize all the templates" ) ;
275304 ConsoleLogInfo ( "* RESULT_PATH (optionally) - specify path to write the template folders to. Current folder will be used otherwise" ) ;
276- Console . WriteLine ( ) ;
305+ ConsoleLog ( "" ) ;
277306 ConsoleLogInfo ( "-----------------------------------------------------------------" ) ;
278- Console . WriteLine ( "usage: " + thisName + " extone TEMPLATE_NAME [ RESULT_PATH ]" ) ;
307+ ConsoleLog ( "usage: " + thisName + " extone TEMPLATE_NAME [ RESULT_PATH ]" ) ;
279308 ConsoleLogInfo ( "externalize a specific template set" ) ;
280309 ConsoleLogInfo ( "TEMPLATE_NAME - the template set to be externalized: \" HTML_PARACORD\" or \" JSON_COMMONER\" " ) ;
281310 ConsoleLogInfo ( "* RESULT_PATH (optionally) - specify path to write the template folders to. Current folder will be used otherwise" ) ;
282- Console . WriteLine ( ) ;
311+ ConsoleLog ( "" ) ;
283312 ConsoleLogInfo ( "-----------------------------------------------------------------" ) ;
284- Console . WriteLine ( "usage: " + thisName + " parse-file PARSE_PATH RESULT_PATH [ template=(TEMPLATE_NAME|TEMPLATE_PATH) ]\n [ dsonly[=true|=false] ] [ verbosity=<verb> | log-verbosity=<verb> ] [ onerror=<verb> ] \n [ artifacts=<verb> [artifacts-path=ARTIFACTS_PATH ]] [ logfile=LOG_PATH ]" ) ;
313+ ConsoleLog ( "usage: " + thisName + " parse-file PARSE_PATH RESULT_PATH [ template=(TEMPLATE_NAME|TEMPLATE_PATH) ]\n [ dsonly[=true|=false] ] [ verbosity=<verb> | log-verbosity=<verb> ]\n [ artifacts=<verb> [artifacts-path=ARTIFACTS_PATH ]] [ logfile=LOG_PATH ]" ) ;
285314 ConsoleLogInfo ( "template - the name (inbuilt) or path (external) of the template set to use" ) ;
286315 ConsoleLogInfo ( "PARSE_PATH - the path of the file to parse" ) ;
287316 ConsoleLogInfo ( "RESULT_PATH - the path of the file to write the result to (existing file or not)" ) ;
288317 ConsoleLogInfo ( "* dsonly - weather to omit files that are not Describe source files (\" .DS\" ). (default is true): \" true\" , \" false\" " ) ;
289318 ConsoleLogInfo ( "* verbosity - set the log verbosity of the parser (default is high): \" l\" , \" low\" , \" m\" , \" medium\" , \" h\" , \" high\" " ) ;
290319 ConsoleLogInfo ( "* log-verbosity - can be used instead of verbosity" ) ;
291- ConsoleLogInfo ( "* onerror - what to do when there is an error in source code. (default is stop): \" stop\" , \" ignore\" , \" dart-stop\" , \" dart-ignore\" " ) ;
292320 ConsoleLogInfo ( "* artifacts - weather to use artifacts (default is no): \" m\" , \" makeonly\" , \" t\" , \" takeonly\" , \" u\" , \" use\" , \" n\" , \" no\" " ) ;
293321 ConsoleLogInfo ( "** ARTIFACTS_PATH - specify path of directory to store artifacts in" ) ;
294322 ConsoleLogInfo ( "* LOG_PATH - specify path of directory or file to output logs to" ) ;
295- Console . WriteLine ( ) ;
323+ ConsoleLog ( "" ) ;
296324 ConsoleLogInfo ( "-----------------------------------------------------------------" ) ;
297- Console . WriteLine ( "usage: " + thisName + " parse-folder PARSE_PATH RESULT_PATH [ template=(TEMPLATE_NAME|TEMPLATE_PATH) ]\n [ dsonly[=<verb>] ] [ toponly[=true|=false] ] [ verbosity=<verb> | log-verbosity=<verb> ]\n [ onerror=<verb> ] [ artifacts=<verb> [artifacts-path=ARTIFACTS_PATH ]] [ logfile=LOG_PATH ]" ) ;
325+ ConsoleLog ( "usage: " + thisName + " parse-folder PARSE_PATH RESULT_PATH [ template=(TEMPLATE_NAME|TEMPLATE_PATH) ]\n [ dsonly[=<verb>] ] [ toponly[=true|=false] ] [ verbosity=<verb> | log-verbosity=<verb> ]\n [ onerror=<verb> ] [ artifacts=<verb> [artifacts-path=ARTIFACTS_PATH ]] [ logfile=LOG_PATH ]" ) ;
298326 ConsoleLogInfo ( "template - the name (inbuilt) or path (external) of the template set to use" ) ;
299327 ConsoleLogInfo ( "PARSE_PATH - the path of the file to parse" ) ;
300328 ConsoleLogInfo ( "RESULT_PATH - the path of the folder to write the result to (existing or not)" ) ;
301329 ConsoleLogInfo ( "* dsonly - weather to omit files that are not Describe source files (\" .DS\" ). (default is true): \" true\" , \" false\" " ) ;
302330 ConsoleLogInfo ( "* toponly - weather to parse files in child directories or not. (default is false): \" true\" , \" false\" " ) ;
303331 ConsoleLogInfo ( "* verbosity - set the log verbosity of the parser (default is high): \" l\" , \" low\" , \" m\" , \" medium\" , \" h\" , \" high\" " ) ;
304332 ConsoleLogInfo ( "* log-verbosity - can be used instead of verbosity" ) ;
305- ConsoleLogInfo ( "* onerror - what to do when there is an error in source code. (default is stop): \" stop\" , \" ignore\" , \" dart-stop \" , \" dart-ignore \" " ) ;
333+ ConsoleLogInfo ( "* onerror - what to do when there is an error in source code. (default is stop): \" stop\" , \" ignore\" " ) ;
306334 ConsoleLogInfo ( "* artifacts - weather to use artifacts (default is no): \" m\" , \" makeonly\" , \" t\" , \" takeonly\" , \" u\" , \" use\" , \" n\" , \" no\" " ) ;
307335 ConsoleLogInfo ( "** ARTIFACTS_PATH - specify path of directory to store artifacts in" ) ;
308336 ConsoleLogInfo ( "* LOG_PATH - specify path of directory or file to output logs to" ) ;
309- Console . WriteLine ( ) ;
337+ ConsoleLog ( "" ) ;
310338 ConsoleLogInfo ( "-----------------------------------------------------------------" ) ;
311- Console . WriteLine ( "about: " + DescribeCompiler . DescribeCompiler . COMPILER_NAME ) ;
339+ ConsoleLog ( "about: " + DescribeCompiler . DescribeCompiler . COMPILER_NAME ) ;
312340 ConsoleLogInfo ( "Describe is a domain specific language used to write and maintain complex data lists" ) ;
313341 ConsoleLogInfo ( "that are compiled on demand to html, xaml, xml, sql, json and any other language needed." ) ;
314342 ConsoleLogInfo ( "Describe is licensed under the GNU Affero General Public License v3.0" ) ;
@@ -317,13 +345,16 @@ internal static void printHelpMessage()
317345
318346
319347 Console . ForegroundColor = INFO_COLOR ;
348+ Log += "Press any key to exit." + Environment . NewLine ;
320349 Console . WriteLine ( "Press any key to exit." ) ;
321350 Console . ForegroundColor = TEXT_COLOR ;
322351 Console . ReadKey ( ) ;
323352 }
324353 internal static void printWarning ( string message )
325354 {
326355 Console . ForegroundColor = INFO_COLOR ;
356+ Log += "Warning: " + message + Environment . NewLine ;
357+ Log += "Press any key to continue." + Environment . NewLine ;
327358 Console . WriteLine ( "Warning: " + message ) ;
328359 Console . WriteLine ( "Press any key to continue." ) ;
329360
@@ -333,12 +364,14 @@ internal static void printWarning(string message)
333364 internal static void printNoArgumentsError ( )
334365 {
335366 Console . ForegroundColor = ERROR_COLOR ;
367+ Log += "No arguments or invalid argument count." + Environment . NewLine ;
336368 Console . WriteLine ( "No arguments or invalid argument count." ) ;
337369
338370 Console . ForegroundColor = TEXT_COLOR ;
339371 printHelpMessage ( ) ;
340372
341373 Console . ForegroundColor = INFO_COLOR ;
374+ Log += "Press any key to exit." + Environment . NewLine ;
342375 Console . WriteLine ( "Press any key to exit." ) ;
343376
344377 Console . ForegroundColor = TEXT_COLOR ;
@@ -348,12 +381,14 @@ internal static void printArgumentError(string arg, int argIndex)
348381 {
349382 Console . ForegroundColor = ERROR_COLOR ;
350383 if ( ONE_BASED_ARG_INDEX ) argIndex ++ ;
384+ Log += "Invalid argument " + argIndex . ToString ( ) + " - \" " + arg + "\" " + Environment . NewLine ;
351385 Console . WriteLine ( "Invalid argument " + argIndex . ToString ( ) + " - \" " + arg + "\" " ) ;
352386
353387 Console . ForegroundColor = TEXT_COLOR ;
354388 printHelpMessage ( ) ;
355389
356390 Console . ForegroundColor = INFO_COLOR ;
391+ Log += "Press any key to exit." + Environment . NewLine ;
357392 Console . WriteLine ( "Press any key to exit." ) ;
358393
359394 Console . ForegroundColor = TEXT_COLOR ;
@@ -363,9 +398,12 @@ internal static void printArgumentError(string arg, int argIndex, string message
363398 {
364399 Console . ForegroundColor = ERROR_COLOR ;
365400 if ( ONE_BASED_ARG_INDEX ) argIndex ++ ;
401+ Log += "Invalid argument " + argIndex . ToString ( ) +
402+ " - \" " + arg + "\" - " + message + Environment . NewLine ;
366403 Console . WriteLine ( "Invalid argument " + argIndex . ToString ( ) + " - \" " + arg + "\" - " + message ) ;
367404
368405 Console . ForegroundColor = INFO_COLOR ;
406+ Log += "Press any key to exit." + Environment . NewLine ;
369407 Console . WriteLine ( "Press any key to exit." ) ;
370408
371409 Console . ForegroundColor = TEXT_COLOR ;
@@ -374,9 +412,11 @@ internal static void printArgumentError(string arg, int argIndex, string message
374412 internal static void printFatalError ( string message )
375413 {
376414 Console . ForegroundColor = ERROR_COLOR ;
415+ Log += "Fatal error: " + message + Environment . NewLine ;
377416 Console . WriteLine ( "Fatal error: " + message ) ;
378417
379418 Console . ForegroundColor = INFO_COLOR ;
419+ Log += "Press any key to exit." + Environment . NewLine ;
380420 Console . WriteLine ( "Press any key to exit." ) ;
381421
382422 Console . ForegroundColor = TEXT_COLOR ;
@@ -385,24 +425,33 @@ internal static void printFatalError(string message)
385425
386426
387427 //log
428+ internal static string Log
429+ {
430+ get ;
431+ private set ;
432+ }
388433 internal static void ConsoleLog ( string text )
389434 {
435+ Log += text + Environment . NewLine ;
390436 Console . WriteLine ( text ) ;
391437 }
392438 internal static void ConsoleLogInfo ( string text )
393439 {
440+ Log += text + Environment . NewLine ;
394441 Console . ForegroundColor = INFO_COLOR ;
395442 Console . WriteLine ( text ) ;
396443 Console . ForegroundColor = TEXT_COLOR ;
397444 }
398445 internal static void ConsoleLogError ( string text )
399446 {
447+ Log += text + Environment . NewLine ;
400448 Console . ForegroundColor = ERROR_COLOR ;
401449 Console . WriteLine ( text ) ;
402450 Console . ForegroundColor = TEXT_COLOR ;
403451 }
404452 internal static void ConsoleLogParseInfo ( string text )
405453 {
454+ Log += text + Environment . NewLine ;
406455 Console . ForegroundColor = MOREINFO_COLOR ;
407456 Console . WriteLine ( text ) ;
408457 Console . ForegroundColor = TEXT_COLOR ;
0 commit comments