/// <summary> /// Reads the config file and initializes tracing and logging /// </summary> public static void LoadConfiguration() { if (_config == null) { // Try to read the configuration try { _config = (TagConfig)ConfigurationSettings.GetConfig("TagConfig"); if (_config == null) { throw new ConfigurationException("Error parsing TagConfig section of config file"); } } catch (Exception e) { Console.WriteLine("Error loading Config file: {0}", e.Message); Console.WriteLine("Exiting..."); return; } // Make the configuration available to the CallsignHelper for ServerAdmin tags CallsignHelper.SetServerAdmins(_config.ServerAdmins); // Initialize tracing TagTrace.Initialize(_config.TraceLevel, _config.TracePath, _config.TraceArchiveDir, _config.TraceConsole, null); TagTrace.WriteLine(TraceLevel.Info, "TAG Build {0} is starting...", Build.ToString()); // Initialize reconnect timer ReconnectTimer.Initialize(_config.ReconnectInterval, _config.MaxRetries); ReconnectTimer.ShutdownTagEvent += new AsyncCallback(ReconnectShutdown); // Configure ASGS as necessary if (_config.AsgsUrl != null) { AsgsConnector.Initialize(_config.AsgsUrl, _config.PostTimeout); } if (_config.CssUrl != null) { CssConnector.Initialize(_config.CssUrl, _config.PostTimeout, _config.UseCss); } TagTrace.WriteLine(TraceLevel.Verbose, "Initializing logging..."); GameLogger.Initialize(_config.XmlPath); TagTrace.WriteLine(TraceLevel.Info, "Configuration Loaded."); } }