示例#1
0
        static void LoadConfig()
        {
            Logger.Instance.LogMessage("FTLAdmin.LoadConfig()");
            try
            {
                var worldname = MyAPIGateway.Session.Name;
                worldname = Regex.Replace(worldname, "[<>:\"/\\|?*]", "");  // Remove invalid filename chars

                System.IO.TextReader reader = MyAPIGateway.Utilities.ReadFileInLocalStorage(string.Format(ConfigFileName, worldname), typeof(FTLAdmin));
                var xmlData = reader.ReadToEnd();
                Configuration = MyAPIGateway.Utilities.SerializeFromXML <FTLConfig>(xmlData);
                reader.Close();

                Logger.Instance.Debug = Configuration.Debug;
            }
            catch (System.IO.FileNotFoundException)
            {
                // Config file doesn't exist, that's fine. Ignore the error.
            }
            catch (Exception ex)
            {
                Logger.Instance.LogMessage("FTLAdmin.LoadConfig() - Error");
                Logger.Instance.LogMessage(ex.GetType().Name);
                Logger.Instance.LogException(ex);
                // Continue Processing
            }
            Globals.Reload();
            FTLData.ReloadAll();
            FTLInhibitor.ReloadAll();
        }
示例#2
0
 static FTLAdmin()
 {
     _config = new FTLConfig();
 }