public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, FavoritesIndexMode sortedFavorites, IDictionary <int, string> providerNames) : base(data, sortedFavorites) { this.InitCommonData(slot, SignalSource.DVBS | presetList, data); if (!this.InUse) { this.IsDeleted = true; return; } this.InitDvbData(data, providerNames); int transponderIndex = data.GetWord(_TransponderIndex); Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex); if (transponder == null) { var list = dataRoot.GetChannelList(this.SignalSource | SignalSource.TV); dataRoot.Warnings.AppendFormat("{0} channel record #{1} (Pr# {2} \"{3}\") contains invalid transponder index {4}\r\n", list.ShortCaption, slot, this.OldProgramNr, this.Name, transponderIndex); return; } Satellite sat = transponder.Satellite; this.Satellite = sat.Name; this.SatPosition = sat.OrbitalPosition; this.Polarity = transponder.Polarity; this.SymbolRate = transponder.SymbolRate; this.FreqInMhz = transponder.FrequencyInMhz; this.ChannelOrTransponder = ""; }
private void ReadChannels(SQLiteCommand cmd) { string[] fieldNames = { "rowid", "major_channel", "physical_ch", "sname", "freq", "skip", "running_status", "free_CA_mode", "child_lock", "profile1index", "profile2index", "profile3index", "profile4index", "stype", "onid", "tsid", "svcid", "ntype", "ya_svcid", "delivery", "delivery_type" }; string sql = string.Join(" ", "SELECT", "s.rowid, s.major_channel, s.physical_ch, cast(s.sname as blob), t.freq, s.skip, s.running_status,", "s.free_CA_mode, s.child_lock, s.profile1index, s.profile2index, s.profile3index, s.profile4index, s.stype,", "s.onid, s.tsid, s.svcid, s.ntype, s.ya_svcid, t.delivery, ifnull(t.delivery_type, 0)", "FROM SVL s", "LEFT OUTER JOIN TSL t ON s.physical_ch = t.physical_ch and s.tsid = t.tsid", "ORDER BY s.ntype, major_channel"); var fields = GetFieldMap(fieldNames); cmd.CommandText = sql; using (var r = cmd.ExecuteReader()) { while (r.Read()) { ChannelInfo channel = new DbChannel(r, fields, DataRoot, DefaultEncoding); if (!channel.IsDeleted) { ChannelList channelList = DataRoot.GetChannelList(channel.SignalSource); if (channelList != null) { DataRoot.AddChannel(channelList, channel); } } } } }