/// <summary> /// Add a region to the collection. /// </summary> /// <param name="newRegion">The region to be added.</param> public void AddRegion(Region newRegion) { foreach (Region oldRegion in Regions) { if (oldRegion.Code == newRegion.Code) return; if (oldRegion.Code > newRegion.Code) { regions.Insert(regions.IndexOf(oldRegion), newRegion); return; } } regions.Add(newRegion); }
/// <summary> /// Add a region to the area. /// </summary> /// <param name="newRegion">The new region.</param> public void AddRegion(Region newRegion) { if (newRegion == null) throw (new ArgumentException("The region cannot be null", "newRegion")); foreach (Region oldRegion in Regions) { if (oldRegion.Code == newRegion.Code) return; if (oldRegion.Code > newRegion.Code) { regions.Insert(regions.IndexOf(oldRegion), newRegion); return; } } regions.Add(newRegion); }
/// <summary> /// Process the bouquet data. /// </summary> /// <param name="sections">A collection of MPEG2 sections containing the bouquet data.</param> protected override void ProcessBouquetSections(Collection<Mpeg2Section> sections) { foreach (Mpeg2Section section in sections) { BouquetAssociationSection bouquetSection = BouquetAssociationSection.ProcessBouquetAssociationTable(section.Data); if (bouquetSection != null) { bool added = BouquetAssociationSection.AddSection(bouquetSection); if (added) { if (bouquetSection.TransportStreams != null) { foreach (TransportStream transportStream in bouquetSection.TransportStreams) { if (transportStream.Descriptors != null) { foreach (DescriptorBase descriptor in transportStream.Descriptors) { OpenTVChannelInfoDescriptor infoDescriptor = descriptor as OpenTVChannelInfoDescriptor; if (infoDescriptor != null) { if (infoDescriptor.ChannelInfoEntries != null) { foreach (OpenTVChannelInfoEntry channelInfoEntry in infoDescriptor.ChannelInfoEntries) { OpenTVChannel channel = new OpenTVChannel(); channel.OriginalNetworkID = transportStream.OriginalNetworkID; channel.TransportStreamID = transportStream.TransportStreamID; channel.ServiceID = channelInfoEntry.ServiceID; channel.ChannelID = channelInfoEntry.ChannelID; channel.UserChannel = channelInfoEntry.UserNumber; channel.Type = channelInfoEntry.Type; channel.Flags = channelInfoEntry.Flags; channel.BouquetID = bouquetSection.BouquetID; channel.Region = infoDescriptor.Region; OpenTVChannel.AddChannel(channel); Bouquet bouquet = Bouquet.FindBouquet(channel.BouquetID); if (bouquet == null) { bouquet = new Bouquet(channel.BouquetID, BouquetAssociationSection.FindBouquetName(channel.BouquetID)); Bouquet.AddBouquet(bouquet); } Region region = bouquet.FindRegion(channel.Region); if (region == null) { region = new Region(string.Empty, channel.Region); bouquet.AddRegion(region); } region.AddChannel(channel); } } } } } } } } } } }
private void processOpenTVInfoDescriptor(OpenTVChannelInfoDescriptor openTVInfoDescriptor, int originalNetworkID, int transportStreamID, int bouquetID) { if (openTVInfoDescriptor.ChannelInfoEntries == null) return; if (eitChannels != 0) { OpenTVChannel.Channels.Clear(); eitChannels = 0; return; } foreach (OpenTVChannelInfoEntry channelInfoEntry in openTVInfoDescriptor.ChannelInfoEntries) { OpenTVChannel channel = new OpenTVChannel(); channel.OriginalNetworkID = originalNetworkID; channel.TransportStreamID = transportStreamID; channel.ServiceID = channelInfoEntry.ServiceID; channel.ChannelID = channelInfoEntry.ChannelID; channel.UserChannel = channelInfoEntry.UserNumber; channel.Type = channelInfoEntry.Type; channel.Flags = channelInfoEntry.Flags; channel.BouquetID = bouquetID; channel.Region = openTVInfoDescriptor.Region; OpenTVChannel.AddChannel(channel); openTVChannels++; Bouquet bouquet = Bouquet.FindBouquet(channel.BouquetID); if (bouquet == null) { bouquet = new Bouquet(channel.BouquetID, BouquetAssociationSection.FindBouquetName(channel.BouquetID)); Bouquet.AddBouquet(bouquet); } Region region = bouquet.FindRegion(channel.Region); if (region == null) { region = new Region(string.Empty, channel.Region); bouquet.AddRegion(region); } region.AddChannel(channel); } }
private void processFreeviewInfoDescriptor(FreeviewChannelInfoDescriptor freeviewInfoDescriptor, int originalNetworkID, int transportStreamID, int bouquetID) { if (freeviewInfoDescriptor.ChannelInfoEntries == null) return; if (openTVChannels != 0) return; foreach (FreeviewChannelInfoEntry channelInfoEntry in freeviewInfoDescriptor.ChannelInfoEntries) { EITChannel channel = new EITChannel(); channel.OriginalNetworkID = originalNetworkID; channel.TransportStreamID = transportStreamID; channel.ServiceID = channelInfoEntry.ServiceID; channel.UserChannel = channelInfoEntry.UserNumber; channel.Flags = channelInfoEntry.Flags; channel.BouquetID = bouquetID; EITChannel.AddChannel(channel); eitChannels++; Bouquet bouquet = Bouquet.FindBouquet(channel.BouquetID); if (bouquet == null) { bouquet = new Bouquet(channel.BouquetID, BouquetAssociationSection.FindBouquetName(channel.BouquetID)); Bouquet.AddBouquet(bouquet); } Region region = bouquet.FindRegion(channel.Region); if (region == null) { region = new Region(string.Empty, channel.Region); bouquet.AddRegion(region); } region.AddChannel(channel); } }
/// <summary> /// Add a time zone region to the country. /// </summary> /// <param name="newRegion">The region to be added.</param> /// <param name="addUndefined">True if an undefined entry is to be added to the start of the list; false otherwise.</param> public void AddTimeZone(Region newRegion, bool addUndefined) { if (addUndefined && TimeZones.Count == 0) TimeZones.Add(new Region("-- Undefined --", 0)); foreach (Region oldRegion in TimeZones) { if (oldRegion.Name == newRegion.Name) return; if (oldRegion.Name.CompareTo(newRegion.Name) > 0) { TimeZones.Insert(TimeZones.IndexOf(oldRegion), newRegion); return; } } TimeZones.Add(newRegion); }
/// <summary> /// Process the bouquet data. /// </summary> /// <param name="sections">A collection of MPEG2 sections containing the bouquet data.</param> protected override void ProcessBouquetSections(Collection<Mpeg2Section> sections) { foreach (Mpeg2Section section in sections) { if (RunParameters.Instance.TraceIDs.Contains("BOUQUETSECTIONS")) Logger.Instance.Dump("Bouquet Section", section.Data, section.Length); BouquetAssociationSection bouquetSection = BouquetAssociationSection.ProcessBouquetAssociationTable(section.Data); if (bouquetSection != null) { bool added = BouquetAssociationSection.AddSection(bouquetSection); if (added) { if (bouquetSection.TransportStreams != null) { foreach (TransportStream transportStream in bouquetSection.TransportStreams) { if (transportStream.Descriptors != null) { foreach (DescriptorBase descriptor in transportStream.Descriptors) { FreeSatChannelInfoDescriptor freeSatInfoDescriptor = descriptor as FreeSatChannelInfoDescriptor; if (freeSatInfoDescriptor != null) { if (freeSatInfoDescriptor.ChannelInfoEntries != null) { foreach (FreeSatChannelInfoEntry channelInfoEntry in freeSatInfoDescriptor.ChannelInfoEntries) { FreeSatChannel channel = new FreeSatChannel(); channel.OriginalNetworkID = transportStream.OriginalNetworkID; channel.TransportStreamID = transportStream.TransportStreamID; channel.ServiceID = channelInfoEntry.ServiceID; channel.UserChannel = channelInfoEntry.UserNumber; channel.Unknown1 = channelInfoEntry.Unknown1; channel.Unknown2 = channelInfoEntry.Unknown2; channel.BouquetID = bouquetSection.BouquetID; FreeSatChannel.AddChannel(channel); Bouquet bouquet = Bouquet.FindBouquet(channel.BouquetID); if (bouquet == null) { bouquet = new Bouquet(channel.BouquetID, BouquetAssociationSection.FindBouquetName(channel.BouquetID)); Bouquet.AddBouquet(bouquet); } Region region = bouquet.FindRegion(channel.Region); if (region == null) { region = new Region(string.Empty, channel.Region); bouquet.AddRegion(region); } region.AddChannel(channel); } } } } } } } } } } }