/// <summary> /// Main function /// </summary> /// <param name="args">arguments</param> public static void Main( string[] args ) { if ( args.Length != 0 && args[0] == "debug" ) { PollServer pollServer = new PollServer(); pollServer.Run(); } else { ServiceBase.Run( new PollServer() ); } }
/// <summary> /// Main function /// </summary> /// <param name="args">arguments</param> public static void Main(string[] args) { // Configure logger XmlConfigurator.Configure(new System.IO.FileInfo(PATH_TO_LOG_CONFIG)); // Parse command line NameValueCollection commandLineParameters = CommandLineParametersHelper.Parse(args); if (commandLineParameters["host"] != null && commandLineParameters["host"] != String.Empty) { try { host = IPAddress.Parse(commandLineParameters["host"]); } catch (Exception exception) { log.Error("Invalid host. " + exception.Message); } } if (commandLineParameters["port"] != null && commandLineParameters["port"] != String.Empty) { try { port = Convert.ToInt32(commandLineParameters["port"]); } catch (Exception exception) { log.Error("Invalid port. " + exception.Message); } } /*if (commandLineParameters["data"] != null && commandLineParameters["data"] != String.Empty) pathToDatabase = commandLineParameters["data"];*/ // Start server PollServer pollServer = new PollServer(); pollServer.Start(); pollServer.Stop(); }