public static void WriteToFile(InterfaceModel interFace) { var dialog = new Microsoft.Win32.SaveFileDialog { DefaultExt = ".xml", Filter = Resources.ProfileInfoLoc.ExportFilter, CheckPathExists = true, AddExtension = true, FileName = Resources.ProfileInfoLoc.ExportDefaultFilename }; if (!dialog.ShowDialog() ?? false) { return; } var writer = new System.Xml.Serialization.XmlSerializer(typeof(ProfileInfoExport)); var profiles = interFace.GetProfileInfos(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(dialog.FileName)) { writer.Serialize(file, new ProfileInfoExport { Profiles = profiles.Select(x => new ProfileInfoExportItem { ProfileName = x.profileName, Profile = interFace.GetProfileXml(x.profileName), Flags = x.profileFlags }).ToList(), Version = Assembly.GetExecutingAssembly().GetName().Version.ToString() }); } }
private void DoRenameSelected() { Effect = true; try { var newProfile = selectedInterface.GetProfileXml(selectedProfile); var newProfileInfo = selectedInterface.GetProfileInfos().FirstOrDefault(x => x.profileName == SelectedProfile); selectedInterface.interFace.SetProfile(newProfileInfo.profileFlags, newProfile, false); selectedInterface.interFace.DeleteProfile(selectedProfile); RefreshProfiles(); } finally { Effect = false; } }