public static Preset LoadPreset(string path) { Stream stream = PresetManager.OpenPresetFile(path, FileMode.Open, FileAccess.Read); XmlReader reader = new XmlTextReader(stream); Preset preset = new Preset(Path.GetFileNameWithoutExtension(path)); ReadPreset(reader, preset); reader.Close(); return(preset); }
public static void SavePreset(Preset preset) { string path = string.Format("{0}.xml", preset.Name); Stream stream = PresetManager.OpenPresetFile(path, FileMode.Create, FileAccess.ReadWrite); XmlWriter writer = new XmlTextWriter(stream, UTF8Encoding.UTF8); WritePreset(writer, preset); writer.Flush(); writer.Close(); }