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");
            }
        }
Exemple #2
0
        private GlobalConfig(string filePath) : base(filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            Blacklist.AddRange(GlobalBlacklist);
            Save();
        }