Ejemplo n.º 1
0
        protected virtual void LoadSettings()
        {
            var           settings      = ServiceRegistration.Get <ISettingsManager>().Load <BluRayPlayerSettings>();
            VideoSettings videoSettings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>();

            ServiceRegistration.Get <ILogger>().Info("BDPlayer: SetDefaultLanguages");
            try
            {
                var bdsettings = new BluRayAPI.BDPlayerSettings
                {
                    ParentalControl  = settings.ParentalControl,
                    CountryCode      = new CultureInfo(videoSettings.PreferredMenuLanguage).TwoLetterISOLanguageName,
                    AudioLanguage    = new CultureInfo(videoSettings.PreferredAudioLanguage).ThreeLetterISOLanguageName,
                    SubtitleLanguage = new CultureInfo(videoSettings.PreferredSubtitleLanguage).ThreeLetterISOLanguageName,
                    MenuLanguage     = new CultureInfo(videoSettings.PreferredMenuLanguage).ThreeLetterISOLanguageName,
                };

                IUserManagement userManagement = ServiceRegistration.Get <IUserManagement>();
                if (userManagement?.CurrentUser != null)
                {
                    if (userManagement.CurrentUser.TryGetAdditionalData(UserDataKeysKnown.KEY_PREFERRED_AUDIO_LANGUAGE, 0, out string audioLang))
                    {
                        bdsettings.AudioLanguage = audioLang;
                    }
                    if (userManagement.CurrentUser.TryGetAdditionalData(UserDataKeysKnown.KEY_PREFERRED_SUBTITLE_LANGUAGE, 0, out string subtitleLang))
                    {
                        bdsettings.SubtitleLanguage = subtitleLang;
                    }
                    if (userManagement.CurrentUser.TryGetAdditionalData(UserDataKeysKnown.KEY_PREFERRED_MENU_LANGUAGE, 0, out string menuLang))
                    {
                        bdsettings.CountryCode  = menuLang;
                        bdsettings.MenuLanguage = menuLang;
                    }
                }

                switch (settings.RegionCode)
                {
                case "A":
                    bdsettings.RegionCode = 1;
                    break;

                case "B":
                    bdsettings.RegionCode = 2;
                    break;

                case "C":
                    bdsettings.RegionCode = 4;
                    break;
                }
                _bdReader.SetBDPlayerSettings(bdsettings);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Error("BDPlayer: SetDefaultLanguages", ex);
            }
        }
Ejemplo n.º 2
0
        protected virtual void LoadSettings()
        {
            var           settings      = ServiceRegistration.Get <ISettingsManager>().Load <BluRayPlayerSettings>();
            VideoSettings videoSettings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>();

            ServiceRegistration.Get <ILogger>().Info("BDPlayer: SetDefaultLanguages");
            try
            {
                var bdsettings = new BluRayAPI.BDPlayerSettings
                {
                    ParentalControl  = settings.ParentalControl,
                    CountryCode      = new CultureInfo(videoSettings.PreferredMenuLanguage).TwoLetterISOLanguageName,
                    AudioLanguage    = new CultureInfo(videoSettings.PreferredAudioLanguage).ThreeLetterISOLanguageName,
                    SubtitleLanguage = new CultureInfo(videoSettings.PreferredSubtitleLanguage).ThreeLetterISOLanguageName,
                    MenuLanguage     = new CultureInfo(videoSettings.PreferredMenuLanguage).ThreeLetterISOLanguageName,
                };
                switch (settings.RegionCode)
                {
                case "A":
                    bdsettings.RegionCode = 1;
                    break;

                case "B":
                    bdsettings.RegionCode = 2;
                    break;

                case "C":
                    bdsettings.RegionCode = 4;
                    break;
                }
                _bdReader.SetBDPlayerSettings(bdsettings);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Error("BDPlayer: SetDefaultLanguages", ex);
            }
        }