public LnbConfig(DataMapping mapping, DataRoot dataRoot) { this.Id = mapping.GetByte("SettingId"); if (this.Id == 0) return; int satIndex = mapping.GetByte("SatIndex"); this.Satellite = dataRoot.Satellites[satIndex]; }
public virtual void AddTransponder(Satellite sat, Transponder trans) { trans.Satellite = sat; if (this.Transponder.ContainsKey(trans.Id)) { this.Warnings.AppendFormat("Duplicate transponder data record for satellite #{0} with id {1}\r\n", sat?.Id, trans.Id); return; } sat?.Transponder.Add(trans.Id, trans); this.Transponder.Add(trans.Id, trans); }
public virtual void AddTransponder(Satellite sat, Transponder trans) { trans.Satellite = sat; if (this.transponder.ContainsKey(trans.Id)) { this.warnings.AppendFormat("Duplicate transponder data record for satellite #{0} with id {1}\r\n", sat?.Id, trans.Id); return; } if (sat != null) sat.Transponder.Add(trans.Id, trans); this.transponder.Add(trans.Id, trans); }
internal DbChannel(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, Dictionary<long, string> providers, Satellite sat, Transponder tp) { var chType = r.GetInt32(field["chType"]); this.SignalSource = DbSerializer.ChTypeToSignalSource(chType); this.RecordIndex = r.GetInt64(field["SRV.srvId"]); this.OldProgramNr = r.GetInt32(field["major"]); this.FreqInMhz = (decimal)r.GetInt32(field["freq"]) / 1000; this.ChannelOrTransponder = (this.SignalSource & SignalSource.DvbT) == SignalSource.DvbT ? LookupData.Instance.GetDvbtTransponder(this.FreqInMhz).ToString() : (this.SignalSource & SignalSource.DvbC) == SignalSource.DvbC ? LookupData.Instance.GetDvbcTransponder(this.FreqInMhz).ToString() : (this.SignalSource & SignalSource.Sat) == SignalSource.DvbS ? LookupData.Instance.GetAstraTransponder((int)this.FreqInMhz).ToString() : ""; this.Name = DbSerializer.ReadUtf16(r, 6); this.Hidden = r.GetBoolean(field["hidden"]); this.Encrypted = r.GetBoolean(field["scrambled"]); this.Lock = r.GetBoolean(field["lockMode"]); this.Skip = !r.GetBoolean(field["numSel"]); if (sat != null) { this.Satellite = sat.Name; this.SatPosition = sat.OrbitalPosition; } if (tp != null) { this.Transponder = tp; this.SymbolRate = tp.SymbolRate; } if ((this.SignalSource & SignalSource.Digital) != 0) this.ReadDvbData(r, field, dataRoot, providers); else this.ReadAnalogData(r, field); base.IsDeleted = this.OldProgramNr == -1; }
private void ReadSatellites(ZipFile zip) { byte[] data = ReadFileContent(zip, "SatDataBase.dat"); if (data == null || data.Length < 4) return; this.SatDatabaseVersion = System.BitConverter.ToInt32(data, 0); SatelliteMapping satMapping = new SatelliteMapping(data, 4); int count = data.Length/this.c.dvbsSatelliteLength; for (int i = 0; i < count; i++) { if (satMapping.MagicMarker == 'U') { string location = string.Format("{0}.{1}{2}", satMapping.Longitude / 10, satMapping.Longitude % 10, satMapping.IsEast ? "E" : "W"); Satellite satellite = new Satellite(satMapping.SatelliteNr); satellite.Name = satMapping.Name; satellite.OrbitalPosition = location; this.DataRoot.Satellites.Add(satMapping.SatelliteNr, satellite); } else if (satMapping.MagicMarker != 'E') throw new FileLoadException("Unknown SatDataBase.dat format"); satMapping.BaseOffset += this.c.dvbsSatelliteLength; } }
private void ReadSatellites(ref int off) { for (int i = 0; i < satConfig.satCount; i++) { Satellite sat = new Satellite(i); string satName = Encoding.ASCII.GetString(fileContent, off + 0, 32).TrimEnd('\0'); sat.Name = satName; sat.OrbitalPosition = GetSatLocation(fileContent[off + 32], fileContent[off + 33]); this.DataRoot.AddSatellite(sat); off += satConfig.satLength; } }
public virtual void AddSatellite(Satellite satellite) { this.Satellites.Add(satellite.Id, satellite); }
private void CreateDummySatellites() { for (int i = 1; i <= 4; i++) { var sat = new Satellite(i); sat.Name = "LNB "+i; sat.OrbitalPosition = i.ToString(); this.DataRoot.Satellites.Add(i, sat); } }
private void ReadSatellites(SQLiteCommand cmd) { cmd.CommandText = "select distinct satId, cast(satName as blob), satPos, satDir from SAT"; using (var r = cmd.ExecuteReader()) { while (r.Read()) { Satellite sat = new Satellite(r.GetInt32(0)); int pos = Math.Abs(r.GetInt32(2)); sat.OrbitalPosition = $"{pos/10}.{pos%10}{(r.GetInt32(3) == 1 ? "E" : "W")}"; sat.Name = ReadUtf16(r, 1); this.DataRoot.AddSatellite(sat); } } }
public virtual void AddSatellite(Satellite satellite) { this.satellites.Add(satellite.Id, satellite); }
private void ReadSatellites(SQLiteCommand cmd) { cmd.CommandText = "select distinct satellite_id, satellite_name, orbital_position, west_east_flag from satellite"; using (var r = cmd.ExecuteReader()) { while (r.Read()) { Satellite sat = new Satellite(r.GetInt32(0)); int pos = r.GetInt32(2); sat.OrbitalPosition = string.Format("{0}.{1}{2}", pos / 10, pos % 10, r.GetInt32(3) == 1 ? "E" : "W"); sat.Name = r.GetString(1) + " " + sat.OrbitalPosition; this.DataRoot.AddSatellite(sat); } } }
private void LoadSatelliteData(SQLiteCommand cmd) { var regex = new Regex(@"^satl_\d$"); foreach (var tableName in this.tableNames) { if (!regex.IsMatch(tableName)) continue; cmd.CommandText = "select satl_rec_id, mask, i2_orb_pos, ac_sat_name from " + tableName; using (var r = cmd.ExecuteReader()) { while (r.Read()) { var sat = new Satellite(r.GetInt32(0)); var pos = r.GetInt32(2); sat.OrbitalPosition = $"{(decimal) Math.Abs(pos)/10:n1}{(pos < 0 ? 'W' : 'E')}"; sat.Name = r.GetString(3); this.DataRoot.AddSatellite(sat); } } } }