private void ReadXml() { var content = ReadContent(); if (String.IsNullOrWhiteSpace(content)) { return; } try { var xml = XDocument.Parse(content).Root; if (xml != null) { SessionId = (string)xml.Element("SessionId"); SteamLogin = (string)xml.Element("SteamLogin"); SteamLoginSecure = (string)xml.Element("SteamLoginSecure"); SteamProfileUrl = (string)xml.Element("SteamProfileUrl"); SteamParental = (string)xml.Element("SteamParental"); SteamRememberLogin = (string)xml.Element("SteamRememberLogin"); MachineAuth = (string)xml.Element("MachineAuth"); IgnoreClient = ReadBool(xml.Element("IgnoreClient")); SteamAvatarUrl = (string)xml.Element("SteamAvatarUrl"); SteamBackgroundUrl = (string)xml.Element("SteamBackgroundUrl"); SteamUserName = (string)xml.Element("SteamUserName"); SteamLevel = (string)xml.Element("SteamLevel"); CustomBackgroundUrl = (string)xml.Element("CustomBackgroundUrl"); SteamBadgeTitle = (string)xml.Element("SteamBadgeTitle"); SteamBadgeUrl = (string)xml.Element("SteamBadgeUrl"); BadgeFilter = (string)xml.Element("BadgeFilter"); ShowcaseFilter = (string)xml.Element("ShowcaseFilter"); IdleMode = ReadInt(xml.Element("IdleMode")); MaxIdleProcessCount = ReadByte(xml.Element("MaxIdleProcessCount")); PeriodicSwitchRepeatCount = ReadByte(xml.Element("PeriodicSwitchRepeatCount")); TrialPeriod = ReadDouble(xml.Element("TrialPeriod")); SwitchMinutes = ReadByte(xml.Element("SwitchMinutes")); SwitchSeconds = ReadByte(xml.Element("SwitchSeconds")); AllowShowcaseSync = ReadBool(xml.Element("AllowShowcaseSync")); ShowInTaskbar = ReadBool(xml.Element("ShowInTaskbar"), true); IdleQueue.AddRange(GetStringList(xml.Element("IdleQueue"))); Blacklist.AddRange(GetStringList(xml.Element("Blacklist"))); ShowcaseBookmarks.AddRange(GetStringList(xml.Element("ShowcaseBookmarks"))); Games.AddRange(GetStringList(xml.Element("Games"))); AppBrushes.AddRange(GetStringList(xml.Element("AppBrushes"))); } Logger.Info("Settings storage initialized"); } catch (Exception ex) { Logger.Exception(ex, "Settings storage"); } }
private void WriteXml() { var xe = new XElement("Settings", new XElement("SessionId", SessionId), new XElement("SteamLogin", SteamLogin), new XElement("SteamLoginSecure", SteamLoginSecure), new XElement("SteamProfileUrl", SteamProfileUrl), new XElement("SteamParental", SteamParental), new XElement("SteamRememberLogin", SteamRememberLogin), new XElement("MachineAuth", MachineAuth), new XElement("IgnoreClient", IgnoreClient), new XElement("SteamAvatarUrl", SteamAvatarUrl), new XElement("SteamBackgroundUrl", SteamBackgroundUrl), new XElement("SteamUserName", SteamUserName), new XElement("SteamLevel", SteamLevel), new XElement("CustomBackgroundUrl", CustomBackgroundUrl), new XElement("SteamBadgeUrl", SteamBadgeUrl), new XElement("SteamBadgeTitle", SteamBadgeTitle), new XElement("BadgeFilter", BadgeFilter), new XElement("ShowcaseFilter", ShowcaseFilter), new XElement("IdleMode", IdleMode), new XElement("MaxIdleProcessCount", MaxIdleProcessCount), new XElement("PeriodicSwitchRepeatCount", PeriodicSwitchRepeatCount), new XElement("TrialPeriod", TrialPeriod), new XElement("SwitchMinutes", SwitchMinutes), new XElement("SwitchSeconds", SwitchSeconds), new XElement("AllowShowcaseSync", AllowShowcaseSync), new XElement("ShowInTaskbar", ShowInTaskbar), new XElement("ShowBackground", ShowBackground), new XElement("Dimensions", Dimensions), new XElement("PricesCatalogDate", PricesCatalogDate), new XElement("IdleQueue", String.Join(",", IdleQueue.Cast <string>())), new XElement("Blacklist", String.Join(",", Blacklist.Cast <string>())), new XElement("ShowcaseBookmarks", String.Join(",", ShowcaseBookmarks.Cast <string>())), new XElement("Games", String.Join(",", Games.Cast <string>())), new XElement("AppBrushes", String.Join(",", AppBrushes.Cast <string>())) ); WriteContent(xe.ToString()); }