Ejemplo n.º 1
0
        } // Bootstrap

        public static UiContentProvider FromXmlConfiguration(IpTvProviderData contentProvider, IEnumerable <string> uiCultures)
        {
            if (contentProvider == null)
            {
                throw new ArgumentNullException();
            }
            if (uiCultures == null)
            {
                throw new ArgumentNullException();
            }

            var result = new UiContentProvider();

            result.Identification = UiContentProviderIdentification.FromXmlConfiguration(contentProvider.Identification, uiCultures);
            result.FriendlyNames  = UiContentProviderFriendlyNames.FromXmlConfiguration(contentProvider.FriendlyNames, uiCultures);
            result.Bootstrap      = contentProvider.Bootstrap;

            return(result);
        } // FromXmlConfiguration
Ejemplo n.º 2
0
        } // Validate

        #region Content provider

        protected InitializationResult LoadIpTvProviderData()
        {
            var xmlPath = Path.Combine(Folders.Base, "movistartv-config.xml");

            try
            {
                var ipTvProviderSettingsRegistrationGuid = new Guid(IpTvProviderSettingsRegistrationGuid);
                var ipTvProviderSettings = this[ipTvProviderSettingsRegistrationGuid];

                var result = ipTvProviderSettings.Initializate();
                if (!result.IsOk)
                {
                    return(result);
                }

                var xmlContentProvider = IpTvProviderData.Load(xmlPath);

                var validationResult = xmlContentProvider.Validate();
                if (validationResult != null)
                {
                    return(new InitializationResult()
                    {
                        Caption = Properties.Texts.LoadContentProviderDataValidationCaption,
                        Message = string.Format(Properties.Texts.LoadContentProviderDataValidation, xmlPath, validationResult),
                    });
                } // if

                ContentProvider = UiContentProvider.FromXmlConfiguration(xmlContentProvider, Cultures);
                return(InitializationResult.Ok);
            }
            catch (Exception ex)
            {
                return(new InitializationResult()
                {
                    Caption = Properties.Texts.LoadContentProviderDataExceptionCaption,
                    Message = string.Format(Properties.Texts.LoadContentProviderDataValidation, xmlPath, Properties.Texts.LoadContentProviderDataValidationException),
                    InnerException = ex
                });
            } // try-catch
        }     // LoadIpTvProviderData