Beispiel #1
0
        } = 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);
        }