Beispiel #1
0
        public void Load()
        {
            using (
                MediaPortal.Profile.Settings xmlreader =
                    new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                Mp3                 = xmlreader.GetValueAsBool("radiotime", "mp3", true);
                Wma                 = xmlreader.GetValueAsBool("radiotime", "wma", true);
                Real                = xmlreader.GetValueAsBool("radiotime", "real", false);
                ShowPresets         = xmlreader.GetValueAsBool("radiotime", "showpresets", false);
                UseVideo            = xmlreader.GetValueAsBool("radiotime", "UseVideo", false);
                JumpNowPlaying      = xmlreader.GetValueAsBool("radiotime", "JumpNowPlaying", false);
                User                = xmlreader.GetValueAsString("radiotime", "user", string.Empty);
                Password            = xmlreader.GetValueAsString("radiotime", "password", string.Empty);
                FolderId            = xmlreader.GetValueAsString("radiotime", "FolderId", string.Empty);
                PluginName          = xmlreader.GetValueAsString("radiotime", "pluginname", "RadioTime");
                StartWithFastPreset = xmlreader.GetValueAsBool("radiotime", "StartWithFastPreset", false);

                SearchHistory.Clear();
                ArtistSearchHistory.Clear();
                string searchs = xmlreader.GetValueAsString("radiotime", "searchHistory", "");
                if (!string.IsNullOrEmpty(searchs))
                {
                    string[] array = searchs.Split('|');
                    for (int i = 0; i < array.Length && i < 25; i++)
                    {
                        if (!string.IsNullOrEmpty(array[i]))
                        {
                            SearchHistory.Add(array[i]);
                        }
                    }
                }

                searchs = xmlreader.GetValueAsString("radiotime", "artistSearchHistory", "");
                if (!string.IsNullOrEmpty(searchs))
                {
                    string[] array = searchs.Split('|');
                    for (int i = 0; i < array.Length && i < 25; i++)
                    {
                        if (!string.IsNullOrEmpty(array[i]))
                        {
                            ArtistSearchHistory.Add(array[i]);
                        }
                    }
                }


                PartnerId = "41";
            }
        }
Beispiel #2
0
        public void Load()
        {
            var passwordNeedsUpdate = false;

            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
            {
                Mp3            = xmlreader.GetValueAsBool("radiotime", "mp3", true);
                Wma            = xmlreader.GetValueAsBool("radiotime", "wma", true);
                Real           = xmlreader.GetValueAsBool("radiotime", "real", false);
                ShowPresets    = xmlreader.GetValueAsBool("radiotime", "showpresets", false);
                UseVideo       = xmlreader.GetValueAsBool("radiotime", "UseVideo", false);
                JumpNowPlaying = xmlreader.GetValueAsBool("radiotime", "JumpNowPlaying", false);
                User           = xmlreader.GetValueAsString("radiotime", "user", string.Empty);
                var encryptedPassword = xmlreader.GetValueAsString("radiotime", "encryptedPassword", string.Empty);
                if (!string.IsNullOrEmpty(encryptedPassword))
                {
                    {
                        Password = PasswordUtility.DecryptData(encryptedPassword, DataProtectionScope.LocalMachine);
                        if (string.IsNullOrEmpty(Password))
                        {
                            Password = string.Empty;
                        }
                    }
                }
                else
                {
                    Password            = xmlreader.GetValueAsString("radiotime", "password", string.Empty);
                    passwordNeedsUpdate = true;
                }
                FolderId            = xmlreader.GetValueAsString("radiotime", "FolderId", string.Empty);
                PluginName          = xmlreader.GetValueAsString("radiotime", "pluginname", "RadioTime");
                StartWithFastPreset = xmlreader.GetValueAsBool("radiotime", "StartWithFastPreset", false);

                SearchHistory.Clear();
                ArtistSearchHistory.Clear();
                var searchs = xmlreader.GetValueAsString("radiotime", "searchHistory", "");
                if (!string.IsNullOrEmpty(searchs))
                {
                    var array = searchs.Split('|');
                    for (var i = 0; i < array.Length && i < 25; i++)
                    {
                        if (!string.IsNullOrEmpty(array[i]))
                        {
                            SearchHistory.Add(array[i]);
                        }
                    }
                }

                searchs = xmlreader.GetValueAsString("radiotime", "artistSearchHistory", "");
                if (!string.IsNullOrEmpty(searchs))
                {
                    var array = searchs.Split('|');
                    for (var i = 0; i < array.Length && i < 25; i++)
                    {
                        if (!string.IsNullOrEmpty(array[i]))
                        {
                            ArtistSearchHistory.Add(array[i]);
                        }
                    }
                }


                PartnerId = "41";
            }

            if (passwordNeedsUpdate)
            {
                SaveEncryptedPassword();
            }
        }