public ChannelList GetChannelList(SignalSource searchMask) { foreach (ChannelList list in channelLists) { if (FlagsHelper.IsSet(searchMask, SignalSource.Analog | SignalSource.Digital) && !FlagsHelper.IsSet(list.SignalSource, searchMask & (SignalSource.Analog | SignalSource.Digital))) { continue; } if (FlagsHelper.IsSet(searchMask, SignalSource.AvInput | SignalSource.Antenna | SignalSource.Cable | SignalSource.Sat) && !FlagsHelper.IsSet(list.SignalSource, searchMask & (SignalSource.AvInput | SignalSource.Antenna | SignalSource.Cable | SignalSource.Sat))) { continue; } if (FlagsHelper.IsSet(searchMask, SignalSource.IP) && !FlagsHelper.IsSet(list.SignalSource, searchMask & SignalSource.IP)) { continue; } if (FlagsHelper.IsSet(searchMask, SignalSource.TVAndRadioAndData) && !FlagsHelper.IsSet(list.SignalSource, searchMask & SignalSource.TVAndRadioAndData)) { continue; } if (FlagsHelper.IsSet(searchMask, SignalSource.AllProvider) && !FlagsHelper.IsSet(list.SignalSource, searchMask & SignalSource.AllProvider)) { continue; } return(list); } return(null); }
private string CreateCaption(SignalSource signalSource) { var sb = new StringBuilder(); if (FlagsHelper.IsSet(signalSource, SignalSource.DVBT)) { sb.Append("DVB-T"); } else if (FlagsHelper.IsSet(signalSource, SignalSource.DVBC)) { sb.Append("DVB-C"); } else if (FlagsHelper.IsSet(signalSource, SignalSource.DVBS)) { sb.Append("DVB-S"); } else if (FlagsHelper.IsSet(signalSource, SignalSource.IP)) { sb.Append("IP"); } else if (FlagsHelper.IsSet(signalSource, SignalSource.Analog)) { sb.Append("Analog"); } sb.Append(" "); if (FlagsHelper.IsSet(signalSource, SignalSource.TV)) { sb.Append("TV"); } else if (FlagsHelper.IsSet(signalSource, SignalSource.Radio)) { sb.Append("Radio"); } else { sb.Append("Data"); } return(sb.ToString()); }
} = new List <string>(); // initialized by MainForm public ChannelList(SignalSource source, string caption) { if (!FlagsHelper.IsSet(source, SignalSource.Analog | SignalSource.Digital)) { FlagsHelper.Set(source, SignalSource.Analog | SignalSource.Digital); } if (!FlagsHelper.IsSet(source, SignalSource.Antenna | SignalSource.Cable | SignalSource.Sat)) { FlagsHelper.Set(source, SignalSource.Antenna | SignalSource.Cable | SignalSource.Sat); } if (!FlagsHelper.IsSet(source, SignalSource.TVAndRadioAndData)) { FlagsHelper.Set(source, SignalSource.TVAndRadioAndData); } SignalSource = source; ShortCaption = caption; FirstProgramNumber = (source & SignalSource.Digital) != 0 ? 1 : 0; VisibleColumnFieldNames = DefaultVisibleColumns.ToList(); // create copy of default list, so it can be modified }
private static SignalSource GetSignalSource(ref int slot, string uid, IList <string> parts) { // new lists store a bitmask which defines the type of channel and list it came from if (parts.Count >= 6 && parts[5].Length >= 4) { SignalSource s = SignalSource.Any; var code = parts[5]; if (code[0] == 'A') { FlagsHelper.Set(ref s, SignalSource.Analog); } else if (code[0] == 'D') { FlagsHelper.Set(ref s, SignalSource.Digital); } if (code[1] == 'A') { FlagsHelper.Set(ref s, SignalSource.Antenna); } else if (code[1] == 'C') { FlagsHelper.Set(ref s, SignalSource.Cable); } else if (code[1] == 'S') { FlagsHelper.Set(ref s, SignalSource.Sat); } else if (code[1] == 'I') { FlagsHelper.Set(ref s, SignalSource.IP); } if (code[2] == 'T') { FlagsHelper.Set(ref s, SignalSource.TV); } else if (code[2] == 'R') { FlagsHelper.Set(ref s, SignalSource.Radio); } s |= (SignalSource)(int.Parse(code.Substring(3)) << 12); return(s); } // compatibility for older lists var isTv = slot < 0x4000; slot &= 0x3FFFF; SignalSource signalSource = SignalSource.Any; switch (uid[0]) { case 'S': FlagsHelper.Set(ref signalSource, SignalSource.DVBS); break; case 'C': FlagsHelper.Set(ref signalSource, SignalSource.DVBT); FlagsHelper.Set(ref signalSource, SignalSource.DVBC); break; case 'A': FlagsHelper.Set(ref signalSource, SignalSource.AnalogAntenna | SignalSource.AnalogCable); break; case 'H': FlagsHelper.Set(ref signalSource, SignalSource.Preset_AstraHdPlus); break; default: return(0); } if (isTv) { FlagsHelper.Set(ref signalSource, SignalSource.TV); } else { FlagsHelper.Set(ref signalSource, SignalSource.Radio); } return(signalSource); }