public static void Save(Settings settings) { Contract.Requires(settings != null); EnsureSettingsDirectoryAvailable(); var path = Path.Combine(PathUtil.SettingsFolderPath, Constants.SettingsFile); using (var sw = new StreamWriter(path)) { var document = new XDocument( new XComment($"{Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"), new XComment($"Website: {Constants.HomepageUrl}"), new XElement( XmlRootElement, new XElement( XmlGeneralElement, XElementSerializer.ToXml(nameof(settings.LastProcess), settings.LastProcess), XElementSerializer.ToXml(nameof(settings.LastCoreProvider), settings.LastCoreProvider), XElementSerializer.ToXml(nameof(settings.StayOnTop), settings.StayOnTop), XElementSerializer.ToXml(nameof(settings.RunAsAdmin), settings.RunAsAdmin), XElementSerializer.ToXml(nameof(settings.RandomizeWindowTitle), settings.RandomizeWindowTitle) ), new XElement( XmlDisplayElement, XElementSerializer.ToXml(nameof(settings.ShowNodeAddress), settings.ShowNodeAddress), XElementSerializer.ToXml(nameof(settings.ShowNodeOffset), settings.ShowNodeOffset), XElementSerializer.ToXml(nameof(settings.ShowNodeText), settings.ShowNodeText), XElementSerializer.ToXml(nameof(settings.HighlightChangedValues), settings.HighlightChangedValues), XElementSerializer.ToXml(nameof(settings.ShowCommentFloat), settings.ShowCommentFloat), XElementSerializer.ToXml(nameof(settings.ShowCommentInteger), settings.ShowCommentInteger), XElementSerializer.ToXml(nameof(settings.ShowCommentPointer), settings.ShowCommentPointer), XElementSerializer.ToXml(nameof(settings.ShowCommentRtti), settings.ShowCommentRtti), XElementSerializer.ToXml(nameof(settings.ShowCommentSymbol), settings.ShowCommentSymbol), XElementSerializer.ToXml(nameof(settings.ShowCommentString), settings.ShowCommentString), XElementSerializer.ToXml(nameof(settings.ShowCommentPluginInfo), settings.ShowCommentPluginInfo) ), new XElement( XmlColorsElement, XElementSerializer.ToXml(nameof(settings.BackgroundColor), settings.BackgroundColor), XElementSerializer.ToXml(nameof(settings.SelectedColor), settings.SelectedColor), XElementSerializer.ToXml(nameof(settings.HiddenColor), settings.HiddenColor), XElementSerializer.ToXml(nameof(settings.OffsetColor), settings.OffsetColor), XElementSerializer.ToXml(nameof(settings.AddressColor), settings.AddressColor), XElementSerializer.ToXml(nameof(settings.HexColor), settings.HexColor), XElementSerializer.ToXml(nameof(settings.TypeColor), settings.TypeColor), XElementSerializer.ToXml(nameof(settings.NameColor), settings.NameColor), XElementSerializer.ToXml(nameof(settings.ValueColor), settings.ValueColor), XElementSerializer.ToXml(nameof(settings.IndexColor), settings.IndexColor), XElementSerializer.ToXml(nameof(settings.CommentColor), settings.CommentColor), XElementSerializer.ToXml(nameof(settings.TextColor), settings.TextColor), XElementSerializer.ToXml(nameof(settings.VTableColor), settings.VTableColor) ), settings.CustomData.Serialize(XmlCustomDataElement) ) ); document.Save(sw); } }
internal XElement Serialize(string name) { return(XElementSerializer.ToXml(name, data)); }