public override List<string> read(Setting setting) { List<string> strings = new List<string>(); List<XmlElement> nodes = getNodes(setting.path, false); foreach (XmlElement node in nodes) { strings.Add(node.InnerText); } return strings; }
public override void write(Setting setting, string value) { List<string> path = new List<string>(setting.path); string name = path[path.Count - 1]; path.RemoveAt(path.Count - 1); XmlElement node = getNodes(path, true)[0]; XmlElement new_node = config.CreateElement(name); new_node.InnerText = value; node.AppendChild(new_node); }
public override List<string> erase(Setting setting) { List<string> strings = new List<string>(); List<XmlElement> nodes = getNodes(setting.path, false); while (nodes.Count > 0) { XmlElement node = nodes[0]; strings.Add(node.InnerText); node.ParentNode.RemoveChild(node); nodes.Remove(node); } return strings; }
public override bool erase(Setting setting, string value) { bool found = false; List<XmlElement> nodes = getNodes(setting.path, false); while (nodes.Count > 0) { XmlElement node = nodes[0]; if (node.InnerText == value) { node.ParentNode.RemoveChild(node); found = true; } nodes.Remove(node); } return found; }
private void NotifyPropertyChanged(Setting setting) { foreach (string notify in setting.all_notifications) { NotifyPropertyChanged(notify); } }
protected override SettingsCollection createSettings(SettingsCollection settings) { settings = base.createSettings(settings); Setting new_setting = new Setting("backup_path", null, "paths", "backup"); new_setting.addAdditionalNotification("IsBackupPathSet"); new_setting.addAdditionalNotification("backup_path_not_set"); settings.Add(new_setting); new_setting = new Setting("sync_path", null, "paths", "sync"); new_setting.addAdditionalNotification("any_sync_enabled"); new_setting.addAdditionalNotification("sync_path_set"); settings.Add(new_setting); new_setting = new Setting("steam_override", null, "paths", "steam_override"); new_setting.addAdditionalNotification("steam_path"); settings.Add(new_setting); new_setting = new Setting("save_paths", null, "paths", "saves"); settings.Add(new_setting); settings.Add(new Setting("IgnoreDateCheck", false, "date_check", "ignore")); settings.Add(new Setting("MonitoredGames", null, "games", "monitor")); settings.Add(new Setting("VersioningEnabled", false, "versioning", "enabled")); settings.Add(new Setting("VersioningUnit", VersioningUnit.Hours, "versioning", "unit")); settings.Add(new Setting("VersioningFrequency", 5, "versioning", "frequency")); settings.Add(new Setting("VersioningMax", 100, "versioning", "max")); settings.Add(new Setting("SuppressSubmitRequests", false, "suppress", "submit_requests")); settings.Add(new Setting("SuppressElevationWarnings", false, "suppress", "elevation_warnings")); return settings; }
public abstract List<string> erase(Setting setting);
// Erasing existing settings public abstract bool erase(Setting setting, string value);
// This ADDS a setting to the stack public abstract void write(Setting setting, string value);
public bool overwrite(Setting setting, string old_value, string new_value) { bool result = erase(setting, old_value); write(setting, new_value); return result; }
// This erases all the existing settings with the new setting public List<string> overwrite(Setting setting, string value) { List<string> return_me = read(setting); erase(setting); write(setting, value); return return_me; }
public abstract List<string> read(Setting setting);