Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
              }
        }