public void Load() { if (!File.Exists(SettingsPath)) { LunaXmlSerializer.WriteXml(Activator.CreateInstance(SettingsHolderType), SettingsPath); } SettingsHolder = LunaXmlSerializer.ReadXml(SettingsHolderType, SettingsPath); }
public void Load() { if (!File.Exists(SettingsPath)) { LunaXmlSerializer.WriteXml(new SettingsDefinition(), SettingsPath); } SettingsHolder = LunaXmlSerializer.ReadXml <SettingsDefinition>(SettingsPath); }
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); } } } }
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)); }