コード例 #1
0
        public void Load()
        {
            if (!File.Exists(SettingsPath))
            {
                LunaXmlSerializer.WriteXml(Activator.CreateInstance(SettingsHolderType), SettingsPath);
            }

            SettingsHolder = LunaXmlSerializer.ReadXml(SettingsHolderType, SettingsPath);
        }
コード例 #2
0
        public void Load()
        {
            if (!File.Exists(SettingsPath))
            {
                LunaXmlSerializer.WriteXml(new SettingsDefinition(), SettingsPath);
            }

            SettingsHolder = LunaXmlSerializer.ReadXml <SettingsDefinition>(SettingsPath);
        }
コード例 #3
0
 public static void LoadGroups()
 {
     lock (FileLock)
     {
         if (File.Exists(GroupsFilePath))
         {
             var values = LunaXmlSerializer.ReadXml <List <Group> >(GroupsFilePath);
             foreach (var value in values)
             {
                 Groups.TryAdd(value.Name, value);
             }
         }
     }
 }
コード例 #4
0
        public static SettingStructure ReadSettings()
        {
            CheckDataDirectory();

            RestoreBackupIfNoSettings();

            if (!File.Exists(SettingsFilePath))
            {
                CreateDefaultSettingsFile();
            }

            if (!File.Exists(BackupSettingsFilePath))
            {
                LunaLog.Log("[LMP]: Backing up player token and settings file!");
                File.Copy(SettingsFilePath, BackupSettingsFilePath);
            }

            return(LunaXmlSerializer.ReadXml <SettingStructure>(SettingsFilePath));
        }