static void run_console(string[] args) { SampleVarMgr tvm = new SampleVarMgr(); CalcMachine cs = null; if (args.Length > 0) { cs = new CalcMachine(tvm, args[0]); } else { System.IO.StreamReader srRules = new StreamReader("rule.out"); cs = new CalcMachine(tvm, srRules); } /*顯示運算式中變數值 */ Console.WriteLine("Initalize Variables:"); foreach (DictionaryEntry entry in tvm.getHashtable()) { Console.WriteLine(entry.Key + " = " + entry.Value); } Console.WriteLine("---------------"); cs.Cal(); /*顯示運算式中變數值 */ Console.WriteLine("Values After Calculation:"); foreach (DictionaryEntry entry in tvm.getHashtable()) { Console.WriteLine(entry.Key + " = " + entry.Value); } Console.WriteLine("---------------"); Console.ReadLine(); }
public static void run_test_cx(string srRules, TextWriter _output) { SampleVarMgr tvm = new SampleVarMgr(); CalcMachine cs = new CalcMachine(tvm, srRules); /*顯示運算式中變數值 */ _output.WriteLine("Initalize Variables:"); foreach (DictionaryEntry entry in tvm.getHashtable()) { _output.WriteLine(entry.Key + " = " + entry.Value); } _output.WriteLine("---------------"); cs.Cal(); /*顯示運算式中變數值 */ _output.WriteLine("Values After Calculation:"); foreach (DictionaryEntry entry in tvm.getHashtable()) { _output.WriteLine(entry.Key + " = " + entry.Value); } _output.WriteLine("---------------"); }