/// <summary> /// The main entry point for the application. /// </summary> static int Main(string[] args) { try { var options = new MasterOptions(); var parser = new CommandLineParser(); var helpWriter = new StringWriter(); if (!parser.ParseArguments(args, options, helpWriter)) { MessageBox.Show(helpWriter.ToString(), "VMTool Master"); return 1; } var server = new MasterServer(options); if (options.Debug) { GlobalContext.Properties["LogToConsole"] = "true"; server.Run(); } else { ServiceBase.Run(new MasterService(server)); } return 0; } catch (Exception ex) { log.Fatal("Fatal exception.", ex); return 1; } }
public MasterService(MasterServer server) { if (server == null) throw new ArgumentNullException("server"); this.server = server; ServiceName = "VMTool Master"; }