Example #1
0
 private void ParseNames()
 {
   mapping.SetDataPtr(this.rawData, this.baseOffset);
   DvbStringDecoder dec = new DvbStringDecoder(mapping.DefaultEncoding);
   string longName, shortName;
   dec.GetChannelNames(this.rawData, this.baseOffset + mapping.GetOffsets(_Name)[0], mapping.GetByte(_NameLength), 
     out longName, out shortName);
   this.Name = longName;
   this.ShortName = shortName;      
 }
    private void InsertChannelData(DbCommand cmd, int listId)
    {
      PrepareChannelInsert(cmd);

      DvbStringDecoder decoder = new DvbStringDecoder(this.DefaultEncoding);
      DataMapping dvbsMapping = this.dvbsMappings.GetMapping(this.dvbsBlockSize);
      dvbsMapping.SetDataPtr(this.fileContent, this.dvbsBlockOffset + this.satConfig.ChannelListOffset);
      for (int slot = 0; slot < this.dvbsChannelCount; slot++)
      {
        cmd.Parameters["@listid"].Value = listId;
        cmd.Parameters["@slot"].Value = slot;
        cmd.Parameters["@seq"].Value = DBNull.Value;
        cmd.Parameters["@isdel"].Value = dvbsMapping.GetFlag("InUse") ? 0 : 1;
        cmd.Parameters["@progmask"].Value = dvbsMapping.GetWord("offProgramNr");
        cmd.Parameters["@prognr"].Value = dvbsMapping.GetWord("offProgramNr") & 0x3FFF;
        cmd.Parameters["@progfix"].Value = dvbsMapping.GetWord("offProgramNrPreset");
        int absNameOffset = dvbsMapping.BaseOffset + dvbsMapping.GetOffsets("offName")[0];
        string longName, shortName;
        decoder.GetChannelNames(fileContent, absNameOffset, dvbsMapping.GetByte("offNameLength"), out longName, out shortName);
        cmd.Parameters["@name"].Value = longName;
        cmd.Parameters["@tpnr"].Value = dvbsMapping.GetWord("offTransponderIndex");
        var transp = this.DataRoot.Transponder.TryGet(dvbsMapping.GetWord("offTransponderIndex"));
        cmd.Parameters["@satnr"].Value = transp == null ? (object)DBNull.Value : transp.Satellite.Id;
        cmd.Parameters["@onid"].Value = transp == null ? (object)DBNull.Value : transp.OriginalNetworkId;
        cmd.Parameters["@tsid"].Value = transp == null ? (object)DBNull.Value : transp.TransportStreamId;
        cmd.Parameters["@ssid"].Value = (int)dvbsMapping.GetWord("offServiceId");
        cmd.Parameters["@uid"].Value = transp == null
                                         ? (object) DBNull.Value
                                         : transp.TransportStreamId + "-" + transp.OriginalNetworkId + "-" +
                                           dvbsMapping.GetWord("offServiceId");
        cmd.Parameters["@favcrypt"].Value = (int)dvbsMapping.GetByte("offFavorites");
        cmd.Parameters["@lockskiphide"].Value = (int)dvbsMapping.GetByte("offLock");
        cmd.ExecuteNonQuery();
        dvbsMapping.BaseOffset += this.satConfig.dvbsChannelLength;
      }
    }