static void Main(string[] args) { using (localhost.Service service = new localhost.Service()) { var testProgram = TestProgram.GetTestPrograms().Where(f => f.Name.Contains("MySql_") && f.Name.Contains("_Hello")).Single(); //TestEngineThroughService(testProgram.Program, testProgram.Input, testProgram.Lang, testProgram.Args); TestEngineDirectly(testProgram.Program, testProgram.Input, testProgram.Lang, testProgram.Args); } }
static void Main(string[] args) { using (localhost.Service service = new localhost.Service()) { var testProgram = TestProgram.GetTestPrograms().Where(f => f.Name.Contains("VC_") && f.Name.Contains("_Hello")).Single(); //TestEngineThroughService(testProgram.Program, testProgram.Input, testProgram.Lang, testProgram.Args); TestEngineDirectly(testProgram.Program, testProgram.Input, testProgram.Lang, testProgram.Args); } }
static void TestEngineThroughService(string Program, string Input, Languages Lang, string Args) { OutputData odata; bool bytes = true; using (var s = new localhost.Service()) { Stopwatch watch = new Stopwatch(); watch.Start(); var res = s.DoWork(Program, Input, (localhost.Languages)Lang, GlobalUtils.TopSecret.Service_user, GlobalUtils.TopSecret.Service_pass, Args, bytes, false, false); watch.Stop(); if (res != null) { if (string.IsNullOrEmpty(res.Stats)) { res.Stats = ""; } else { res.Stats += ", "; } res.Stats += string.Format("absolute service time: {0} sec", Math.Round((double)watch.ElapsedMilliseconds / (double)1000, 2)); } odata = new OutputData() { Errors = res.Errors, Warnings = res.Warnings, Stats = res.Stats, Output = res.Output, Exit_Status = res.Exit_Status, System_Error = res.System_Error }; if (bytes) { if (res.Errors_Bytes != null) { odata.Errors = System.Text.Encoding.Unicode.GetString(res.Errors_Bytes); } if (res.Warnings_Bytes != null) { odata.Warnings = System.Text.Encoding.Unicode.GetString(res.Warnings_Bytes); } if (res.Output_Bytes != null) { odata.Output = System.Text.Encoding.Unicode.GetString(res.Output_Bytes); } } } ShowData(odata); }
static void TestEngineThroughService(string Program, string Input, Languages Lang, string Args) { OutputData odata; bool bytes = true; using (var s = new localhost.Service()) { Stopwatch watch = new Stopwatch(); watch.Start(); var res = s.DoWork(Program, Input, (localhost.Languages)Lang, GlobalUtils.TopSecret.Service_user, GlobalUtils.TopSecret.Service_pass, Args, bytes, false, false); watch.Stop(); if (res != null) { if (string.IsNullOrEmpty(res.Stats)) res.Stats = ""; else res.Stats += ", "; res.Stats += string.Format("absolute service time: {0} sec", Math.Round((double)watch.ElapsedMilliseconds / (double)1000, 2)); } odata = new OutputData() { Errors = res.Errors, Warnings = res.Warnings, Stats = res.Stats, Output = res.Output, Exit_Status = res.Exit_Status, System_Error = res.System_Error }; if (bytes) { if (res.Errors_Bytes != null) odata.Errors = System.Text.Encoding.Unicode.GetString(res.Errors_Bytes); if (res.Warnings_Bytes != null) odata.Warnings = System.Text.Encoding.Unicode.GetString(res.Warnings_Bytes); if (res.Output_Bytes != null) odata.Output = System.Text.Encoding.Unicode.GetString(res.Output_Bytes); } } ShowData(odata); }