} // default constructor public AssignNumbersArgs(UiBroadcastDiscovery currentUiDiscovery, PackageDiscoveryRoot packageDiscovery, UiServiceProvider serviceProvider, bool highDefinitionPriority) { Current = currentUiDiscovery; PackageDiscovery = packageDiscovery; ServiceProvider = serviceProvider; HighDefinitionPriority = highDefinitionPriority; } // constructor
} // IsHighDefinitionTv private UiServicesLogicalNumbers(UiBroadcastDiscovery uiDiscovery, PackageDiscoveryRoot packageDiscovery, string defaultDomain, bool highDefinitionPriority, bool clear = false) { UiDiscovery = uiDiscovery; PackageDiscovery = packageDiscovery; DefaultDomain = defaultDomain; HighDefinitionPriority = highDefinitionPriority; } // constructor
} // GetLogicalNumbers private void DumpPackagesInfo(UiBroadcastDiscovery uiDiscovery, PackageDiscoveryRoot packageDiscovery) { var data = new Dictionary <UiBroadcastService, IList <KeyValuePair <string, string> > >(uiDiscovery.Services.Count); foreach (var service in uiDiscovery.Services) { data.Add(service, new List <KeyValuePair <string, string> >()); } // foreach var packages = from discovery in packageDiscovery.PackageDiscovery from package in discovery.Packages select package; foreach (var package in packages) { foreach (var service in package.Services) { var fullName = service.TextualIdentifiers[0].ServiceName + "@" + SelectedServiceProvider.DomainName; var refService = uiDiscovery.TryGetService(fullName); if (refService == null) { continue; } data[refService].Add(new KeyValuePair <string, string>(service.LogicalChannelNumber, package.Id)); } // foreach service } // foreach package var filename = string.Format("{0}\\channels-numbers.csv", AppUiConfiguration.Current.Folders.Cache); using (var file = new System.IO.StreamWriter(filename)) { foreach (var entry in data) { file.WriteLine("\"{0}\";{1};;", entry.Key.ServiceName, entry.Key.DisplayName); foreach (var number in entry.Value) { file.WriteLine(";;{0};\"{1}\"", number.Key, number.Value); } // foreach } // foreach entry } // using file var numbers = new Dictionary <string, IList <UiBroadcastService> >(); foreach (var package in packages) { foreach (var service in package.Services) { var fullName = service.TextualIdentifiers[0].ServiceName + "@" + SelectedServiceProvider.DomainName; var refService = uiDiscovery.TryGetService(fullName); IList <UiBroadcastService> list; if (!numbers.TryGetValue(service.LogicalChannelNumber, out list)) { list = new List <UiBroadcastService>(); numbers.Add(service.LogicalChannelNumber, list); } // if list.Add(refService); } // foreach service } // foreach package filename = string.Format("{0}\\numbers-channels.csv", AppUiConfiguration.Current.Folders.Cache); using (var file = new System.IO.StreamWriter(filename)) { file.WriteLine("\"Logical\";"); foreach (var entry in numbers) { file.WriteLine("{0}", entry.Key); foreach (var channel in entry.Value) { file.WriteLine(";\"{0}\";{1};{2};\"{3}\";\"{4}\";{5}", channel.DisplayName, channel.IsHighDefinitionTv ? "HD" : null, (channel.ReplacementService != null) ? "~HD" : null, channel.ServiceName, (channel.ReplacementService == null) ? null : channel.ReplacementService.ServiceName, channel.ServiceType); } // foreach channel } // foreach entry } // using file } // DumpPackagesInfo
} // LoadBroadcastDiscovery private void GetLogicalNumbers(UiBroadcastDiscovery uiDiscovery, PackageDiscoveryRoot packageDiscovery, bool highDefinitionPriority) { DumpPackagesInfo(uiDiscovery, packageDiscovery); UiServicesLogicalNumbers.AssignLogicalNumbers(uiDiscovery, packageDiscovery, SelectedServiceProvider.DomainName, highDefinitionPriority); } // GetLogicalNumbers
} // ClearLogicalNumbers public static void AssignLogicalNumbers(UiBroadcastDiscovery uiDiscovery, PackageDiscoveryRoot packageDiscovery, string defaultDomain, bool highDefinitionPriority = true) { var aux = new UiServicesLogicalNumbers(uiDiscovery, packageDiscovery, defaultDomain, highDefinitionPriority); aux.Assign(); } // AssignLogicalNumbers