예제 #1
0
        private ChannelList ReadChannels(SQLiteCommand cmd, string dbPath, Dictionary <long, string> providers, bool digital)
        {
            var signalSource = DetectSignalSource(cmd, digital);

            string        name        = Path.GetFileName(dbPath);
            ChannelList   channelList = new ChannelList(signalSource, name);
            string        table       = digital ? "SRV_DVB" : "SRV_ANL";
            List <string> fieldNames  = new List <string> {
                "chType", "chNum", "freq",                                                                                        // CHNL
                "SRV.srvId", "major", "progNum", "cast(srvName as blob)", "srvType", "hidden", "scrambled", "lockMode", "numSel", // SRV
            };

            if (digital)
            {
                fieldNames.AddRange(new[] { "onid", "tsid", "vidPid", "provId", "cast(shrtSrvName as blob)", "lcn" }); // SRV_DVB
            }
            var sql    = this.BuildQuery(table, fieldNames);
            var fields = this.GetFieldMap(fieldNames);

            cmd.CommandText = sql;
            using (var r = cmd.ExecuteReader())
            {
                while (r.Read())
                {
                    // 171027 - ohuseyinoglu: With our change in transponder indexing, we can directly look it up by "chNum" now!
                    var tp = this.DataRoot.Transponder.TryGet(r.GetInt32(1));
                    // ... and get the satellite from that transponder - if set
                    // Note that we can have channels from multiple satellites in the same list, so this is a loop variable now
                    var sat     = tp?.Satellite;
                    var channel = new DbChannel(r, fields, this.DataRoot, providers, sat, tp);
                    if (!channel.IsDeleted)
                    {
                        this.DataRoot.AddChannel(channelList, channel);
                        this.channelById.Add(channel.RecordIndex, channel);
                    }
                }
            }

            this.DataRoot.AddChannelList(channelList);
            return(channelList);
        }
예제 #2
0
        private ChannelList ReadChannels(SQLiteCommand cmd, string dbPath, Dictionary <long, string> providers, bool digital)
        {
            var signalSource = DetectSignalSource(cmd, digital);
            var sat          = (signalSource & SignalSource.Sat) == 0 ? null : this.DetectSatellite(cmd);

            string        name        = Path.GetFileName(dbPath);
            ChannelList   channelList = new ChannelList(signalSource, name);
            string        table       = digital ? "SRV_DVB" : "SRV_ANL";
            List <string> fieldNames  = new List <string> {
                "chType", "chNum", "freq",                                                                                        // CHNL
                "SRV.srvId", "major", "progNum", "cast(srvName as blob)", "srvType", "hidden", "scrambled", "lockMode", "numSel", // SRV
            };

            if (digital)
            {
                fieldNames.AddRange(new[] { "onid", "tsid", "vidPid", "provId", "cast(shrtSrvName as blob)", "lcn" }); // SRV_DVB
            }
            var sql    = this.BuildQuery(table, fieldNames);
            var fields = this.GetFieldMap(fieldNames);

            cmd.CommandText = sql;
            using (var r = cmd.ExecuteReader())
            {
                while (r.Read())
                {
                    var tp      = this.transponderByFreq?.TryGet(r.GetInt32(2));
                    var channel = new DbChannel(r, fields, this.DataRoot, providers, sat, tp);
                    if (!channel.IsDeleted)
                    {
                        this.DataRoot.AddChannel(channelList, channel);
                        this.channelById.Add(channel.RecordIndex, channel);
                    }
                }
            }

            this.DataRoot.AddChannelList(channelList);
            return(channelList);
        }
예제 #3
0
    private ChannelList ReadChannels(SQLiteCommand cmd, string dbPath, Dictionary<long, string> providers, bool digital)
    {
      var signalSource = DetectSignalSource(cmd, digital);
      var sat = (signalSource & SignalSource.Sat) == 0 ? null : this.DetectSatellite(cmd);

      string name = Path.GetFileName(dbPath);
      ChannelList channelList = new ChannelList(signalSource, name);
      string table = digital ? "SRV_DVB" : "SRV_ANL";
      List<string> fieldNames = new List<string> { 
                            "chType", "chNum", "freq", // CHNL
                            "SRV.srvId", "major", "progNum", "cast(srvName as blob)", "srvType", "hidden", "scrambled", "lockMode", "numSel", // SRV
                            };
      if (digital)
        fieldNames.AddRange(new[] {"onid", "tsid", "vidPid", "provId", "cast(shrtSrvName as blob)", "lcn"}); // SRV_DVB

      var sql = this.BuildQuery(table, fieldNames);
      var fields = this.GetFieldMap(fieldNames);

      cmd.CommandText = sql;
      using (var r = cmd.ExecuteReader())
      {
        while (r.Read())
        {
          var tp = this.transponderByFreq?.TryGet(r.GetInt32(2));
          var channel = new DbChannel(r, fields, this.DataRoot, providers, sat, tp);
          if (!channel.IsDeleted)
          {
            this.DataRoot.AddChannel(channelList, channel);
            this.channelById.Add(channel.RecordIndex, channel);
          }
        }
      }

      this.DataRoot.AddChannelList(channelList);
      return channelList;
    }