} // 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
} // 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
} // DumpProperties internal void TransferMergeProperties(UiBroadcastService service) { IsInactive = service.IsInactive; IsHidden = service.IsHidden; LockLevel = service.LockLevel; UserDisplayName = service.UserDisplayName; UserLogicalNumber = service.UserLogicalNumber; } // TransferMergeProperties
} // this[string] public bool TryGetService(string serviceKey, out UiBroadcastService service) { if (ServicesDictionary == null) { BuildServicesDictionary(); } return(ServicesDictionary.TryGetValue(serviceKey, out service)); } // TryGetService
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
} // 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
} // 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
public void Add(UiBroadcastService uiService) { var servicesCount = (IsHighDefinitionTv(uiService)) ? HD : SD; servicesCount.Add(uiService); } // Add