public CommandReader(String CommandName, String CommandLine, ResultWriter ResultLineWriter = null) : this(ResultLineWriter) { if (File.Exists(CommandLine)) { AddFile(CommandLine); } else { AddCommandBlock(CommandName, CommandLine); } }
public CommandReader(String CommandName, String[] args, ResultWriter ResultLineWriter = null) : this(ResultLineWriter) { if (args.Length == 1 && File.Exists(args[0])) { AddFile(args[0]); } else if (args.Length >= 1) { AddCommandList(CommandName, args); } }
public CommandReader(String[] args, ResultWriter ResultLineWriter = null) : this(ResultLineWriter) { // args = CheckForOptions(args); if (args.Length == 1 && File.Exists(args[0])) { AddFile(args[0]); } else if (args.Length >= 1) { AddCommandList("Command list", args); } }
/* * Start options: * Command Line arguments: "//read ShortenFractions" "// read AllTestFiles" "// expression()" "include EpotFunc" * * Special test 1 * Command Line arguments: "E:\Alle Brugere\Klaus\Programmering\Git_Repositories\KiloBravoLima\2019\PhysicalMeasure_\PhysCalculator\TestResults\Klaus_SORTE-PC 2019-04-22 19_59_29\Out\unittest_1.cal" * */ public static void Main(string[] args) { ConsolAnyColorClass.SetColor(ConsoleColor.Blue, Color.FromArgb(50, 50, 255)); // Slightly light blue ResultWriter ResultLineWriter = new ResultWriter(); CommandReader CommandLineReader = new CommandReader(args, ResultLineWriter); if (CommandLineReader == null) { ResultLineWriter.WriteErrorLine(String.Format("PhysCalculator CommandReader failed to load with {0} arguments: \"{1}\" ", args.Count(), args.ToString())); } else { CommandLineReader.ReadFromConsoleWhenEmpty = true; #if DEBUG // Unit tests only included in debug build if (System.Reflection.Assembly.GetEntryAssembly() == null) { // Do some setup to avoid error // We want the test to run only the commands in the args CommandLineReader.ReadFromConsoleWhenEmpty = false; } #endif PhysCalculator Calculator = new PhysCalculator(CommandLineReader, ResultLineWriter); if (Calculator == null) { ResultLineWriter.WriteErrorLine($"PhysCalculator failed to load with {args.Count()} arguments: \"{args.ToString()}\" "); } else { // #if DEBUG ResultLineWriter.WriteErrorLine($"PhysCalculator called with {args.Count()} arguments: \"{args.ToStringList()}\" "); // #endif ResultLineWriter.ForegroundColor = ConsoleColor.Blue; ResultLineWriter.WriteLine("PhysCalculator ready"); ResultLineWriter.ResetColor(); Calculator.Run(); ResultLineWriter.ForegroundColor = ConsoleColor.Blue; ResultLineWriter.WriteLine("PhysCalculator finished"); } } }
public CommandReader(ResultWriter ResultLineWriter = null) { this.ResultLineWriter = ResultLineWriter; }