public static int MainInner() { DisplayTitle(); var CmdLine = CommandLine.GetCmdLine(); var UseLoadTest = false; var UsePerformanceTest = false; foreach (var opt in CmdLine.Options) { if ((opt.Name.ToLower() == "?") || (opt.Name.ToLower() == "help")) { DisplayInfo(); return(0); } else if (opt.Name.ToLower() == "load") { UseLoadTest = true; } else if (opt.Name.ToLower() == "perf") { UsePerformanceTest = true; } } var argv = CmdLine.Arguments; if (argv.Length != 1) { DisplayInfo(); return(-1); } var ConnectionString = argv[0]; using (var cl = new CascadeLock()) { var dam = new DataAccessManager(ConnectionString, cl); if (UseLoadTest) { LoadTest.DoTest(dam); } else if (UsePerformanceTest) { PerformanceTest.DoTest(dam); } else { DisplayInfo(); return(-1); } } return(0); }
public static int MainInner() { DisplayTitle(); var CmdLine = CommandLine.GetCmdLine(); foreach (var opt in CmdLine.Options) { if ((opt.Name.ToLower() == "?") || (opt.Name.ToLower() == "help")) { DisplayInfo(); return(0); } } var argv = CmdLine.Arguments; if (argv.Length != 1) { DisplayInfo(); return(-1); } var ConnectionString = argv[0]; using (var cl = new CascadeLock()) using (var dam = new DataAccessManager(ConnectionString, cl)) { s = new MailService(dam); Console.WriteLine("输入help获得命令列表。"); while (true) { Console.Write("#"); var Line = Console.ReadLine(); if (System.Diagnostics.Debugger.IsAttached) { if (!RunLine(Line)) { break; } } else { try { if (!RunLine(Line)) { break; } } catch (Exception ex) { Console.WriteLine(ExceptionInfo.GetExceptionInfo(ex)); return(-1); } } } } return(0); }