/// <summary> /// The main entry point for the application. /// </summary> static void Main() { const string genlogfilename = "ShinkenStartlog.txt"; // Default (and const) values... const string logfileconffilename = "Shinken_Reactionner"; DirectLog.WriteFileEntry(genlogfilename, "Shinken Reactionner log configuration step...", DirectLog.LogLevel.Info); // Set a log file if specified into the configuration file NameValueCollection appSettings = ConfigurationManager.AppSettings; string logconf_filename = appSettings[logfileconffilename]; if (logconf_filename != null) { // For a windows service, the current dir is %WINDIR%\SYSTEM32, so we have // to change all the .\ or the relative path with the application startup path string currentconf = Application.StartupPath + @"\" + logconf_filename; DirectLog.WriteFileEntry(genlogfilename, "Shinken Reactionner logging conf set to " + currentconf, DirectLog.LogLevel.Info); XmlConfigurator.Configure(new System.IO.FileInfo(currentconf)); } #if DEBUG ShinkenReactionner_Service ShinkenReactionner = new ShinkenReactionner_Service(); ShinkenReactionner.DirectStart(); #else ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new ShinkenReactionner_Service() }; // Run the set of services DirectLog.WriteFileEntry(genlogfilename, "Shinken Reactionner starting...", DirectLog.LogLevel.Info); ServiceBase.Run(ServicesToRun); #endif }