예제 #1
0
        } // AssignLogicalNumbers

        public static bool IsHighDefinitionTv(UiBroadcastService uiService)
        {
            // TODO: get this information in a content provider agnostic way
            // Create IContentProvider and a default implementation
            // Specific details of movistar+ will be provided by an overriden version of the default implementation

            // movistar+ specific
            if (uiService.IsHighDefinitionTv)
            {
                return(true);
            }
            if (uiService.ServiceType == "1")
            {
                return(false);                              // 1 == SD TV MPEG-2
            }
            if (uiService.ServiceType == "22")
            {
                if (uiService.ReplacementService != null)
                {
                    return(true);
                }
            } // if

            return(false);
        } // IsHighDefinitionTv
예제 #2
0
        }         // AssignNumbers

        private void AssignNumber(UiBroadcastService uiService, string logicalNumber, IDictionary <string, int> numbers)
        {
            string serviceLogicalNumber;
            int    count;

            if (!numbers.TryGetValue(logicalNumber, out count))
            {
                // number not assigned; assign direct logical number
                serviceLogicalNumber           = logicalNumber;
                uiService.ServiceLogicalNumber = serviceLogicalNumber;
                count = 0;
            }
            else
            {
                // number already assigned
                var prefix = IsHighDefinitionTv(uiService) ? "H" : "S";
                serviceLogicalNumber = prefix + logicalNumber;

                // avoid duplicated H/S numbers
                if (!numbers.TryGetValue(serviceLogicalNumber, out count))
                {
                    // H/S number not assigned; assign H/S logical number
                    count = 0;
                    uiService.ServiceLogicalNumber = serviceLogicalNumber;
                }
                else
                {
                    // H/S number already assign; create unique H/S number by adding a sufix leter
                    uiService.ServiceLogicalNumber = string.Format("{0}{1}", serviceLogicalNumber, (char)('a' + (count - 1)));
                } // if-else
            }     // if-else

            // increase count
            numbers[serviceLogicalNumber] = count + 1;
        } // AssignNumber
예제 #3
0
        } // DumpProperties

        internal void TransferMergeProperties(UiBroadcastService service)
        {
            IsInactive        = service.IsInactive;
            IsHidden          = service.IsHidden;
            LockLevel         = service.LockLevel;
            UserDisplayName   = service.UserDisplayName;
            UserLogicalNumber = service.UserLogicalNumber;
        } // TransferMergeProperties
예제 #4
0
        }     // this[string]

        public bool TryGetService(string serviceKey, out UiBroadcastService service)
        {
            if (ServicesDictionary == null)
            {
                BuildServicesDictionary();
            }
            return(ServicesDictionary.TryGetValue(serviceKey, out service));
        } // TryGetService
예제 #5
0
            public void Add(UiBroadcastService uiService)
            {
                int count;

                if (Services.TryGetValue(uiService, out count))
                {
                    Services[uiService] = count + 1;
                }
                else
                {
                    count = 1;
                    Services.Add(uiService, count);
                } // if-else
            }     // Add
예제 #6
0
        }     // OriginalLocationUrl

        #endregion

        public bool IsSameService(UiBroadcastService service)
        {
            if (this.Key != service.Key)
            {
                return(false);
            }
            if (this.LocationUrl != service.LocationUrl)
            {
                return(false);
            }
            if (this.DisplayOriginalName != service.DisplayOriginalName)
            {
                return(false);
            }
            if (this.ServiceType != service.ServiceType)
            {
                return(false);
            }

            return(true);
        } // IsSameService
예제 #7
0
        } // Assign

        private Dictionary <string, IList <UiBroadcastService> > GetNumbersList(IEnumerable <Package> packages)
        {
            var numbers = new Dictionary <string, IList <UiBroadcastService> >();

            foreach (var package in packages)
            {
                foreach (var service in package.Services)
                {
                    if (service.TextualIdentifiers == null)
                    {
                        continue;                                     // no services assigned to logical number
                    }
                    foreach (var textualIdentifier in service.TextualIdentifiers)
                    {
                        IList <UiBroadcastService> listUiServices;

                        var uiServiceKey = UiBroadcastService.GetKey(textualIdentifier, DefaultDomain);
                        var uiService    = UiDiscovery.TryGetService(uiServiceKey);
                        if (uiService == null)
                        {
                            continue;                    // service not found in global list of services
                        }
                        // get list of services assigned to logical number, or create if not found
                        if (!numbers.TryGetValue(service.LogicalChannelNumber, out listUiServices))
                        {
                            listUiServices = new List <UiBroadcastService>();
                            numbers.Add(service.LogicalChannelNumber, listUiServices);
                        } // if

                        listUiServices.Add(uiService);
                    } /// foreach textualIdentifier
                }     // foreach service
            }         // foreach package

            return(numbers);
        } // GetNumbersList
예제 #8
0
            public void Add(UiBroadcastService uiService)
            {
                var servicesCount = (IsHighDefinitionTv(uiService)) ? HD : SD;

                servicesCount.Add(uiService);
            } // Add