public void SaveProfileSetAsXml(FileStream stream) { // save the settings; xml format XmlSerializer s = new XmlSerializer(typeof(ProfileSet)); ProfileSet ps = new ProfileSet(); ps.Profiles = this.Profiles; s.Serialize(stream, ps); }
public void LoadProfileSetFromXml(FileStream stream) { // load the settings; xml format XmlSerializer s = new XmlSerializer(typeof(ProfileSet)); ProfileSet ps = (ProfileSet)s.Deserialize(stream); profiles = ps.Profiles; currentProfile = null; // Xml serialization cannot handle circular referencing, so each of the plugins need to be // assigned their AquisitorConfigurations 'by hand'. foreach (Profile p in profiles) { p.AcquisitorConfig.outputPlugin.Config = p.AcquisitorConfig; p.AcquisitorConfig.switchPlugin.Config = p.AcquisitorConfig; p.AcquisitorConfig.shotGathererPlugin.Config = p.AcquisitorConfig; p.AcquisitorConfig.pgPlugin.Config = p.AcquisitorConfig; p.AcquisitorConfig.yagPlugin.Config = p.AcquisitorConfig; p.AcquisitorConfig.analogPlugin.Config = p.AcquisitorConfig; } window.UpdateUI(); }