Esempio n. 1
0
    internal static SatChannel CreateFromProxy(ChannelInfo proxy, DataRoot dataRoot, DataMapping mapping, int rawSize)
    {
      if (proxy.Transponder == null || proxy.Transponder.Satellite == null || proxy.Transponder.Satellite.LnbConfig == null)
        return null;

      byte[] rawData = mapping.Settings.GetBytes("newRecordTemplate");
      if (rawData == null)
        return null;

      mapping.SetDataPtr(rawData, 0);
      mapping.SetWord(_SatConfigIndex, proxy.Transponder.Satellite.LnbConfig.Id);
      mapping.SetWord(_TransponderIndex, proxy.Transponder.Id);
      mapping.SetWord(_ServiceId, proxy.ServiceId);
      var channel = new SatChannel(0, proxy.NewProgramNr, mapping, dataRoot);
      channel.Name = proxy.Name;
      return channel;
    }   
Esempio n. 2
0
        internal static SatChannel CreateFromProxy(ChannelInfo proxy, DataRoot dataRoot, DataMapping mapping, int rawSize)
        {
            if (proxy.Transponder == null || proxy.Transponder.Satellite == null || proxy.Transponder.Satellite.LnbConfig == null)
            {
                return(null);
            }

            byte[] rawData = mapping.Settings.GetBytes("newRecordTemplate");
            if (rawData == null)
            {
                return(null);
            }

            mapping.SetDataPtr(rawData, 0);
            mapping.SetWord(_SatConfigIndex, proxy.Transponder.Satellite.LnbConfig.Id);
            mapping.SetWord(_TransponderIndex, proxy.Transponder.Id);
            mapping.SetWord(_ServiceId, proxy.ServiceId);
            var channel = new SatChannel(0, proxy.NewProgramNr, mapping, dataRoot);

            channel.Name = proxy.Name;
            return(channel);
        }
Esempio n. 3
0
        private void UpdateChannelIndexInTransponderData(SatChannel channel, ref int prevTransponderIndex, int counter,
                                                    ref SatTransponder transponder)
        {
            if (channel.Transponder.Id == prevTransponderIndex)
            return;

              if (transponder != null)
              {
            transponder.LastChannelIndex = counter - 1;
            transponder.ChannelCount = counter - transponder.FirstChannelIndex;
              }

              transponder = (SatTransponder)channel.Transponder;
              transponder.FirstChannelIndex = counter;
              prevTransponderIndex = channel.Transponder.Id;
        }
Esempio n. 4
0
 private bool RemoveChannelIfDupe(SatChannel channel, ref int prevOrder, ref int removed)
 {
     int order = this.PhysicalChannelOrder(channel);
       if (order == prevOrder)
       {
     var list = this.DataRoot.GetChannelList(channel.SignalSource);
     list.RemoveChannel(channel);
     ++removed;
     channel.NewProgramNr = -1;
     channel.OldProgramNr = -1;
     return true;
       }
       prevOrder = order;
       return false;
 }
Esempio n. 5
0
        private void RelocateChannelData(SatChannel channel, ref int prevChannelOrderId,
                                     byte[] sortedChannels, ref int removed, ref int prevTransponderIndex, ref int counter,
                                     ref SatTransponder currentTransponder)
        {
            if (RemoveChannelIfDupe(channel, ref prevChannelOrderId, ref removed))
            return;

              UpdateChannelIndexInTransponderData(channel, ref prevTransponderIndex, counter, ref currentTransponder);

              Tools.MemCopy(
            channel.RawDataBuffer,
            channel.RawDataOffset,
            sortedChannels,
            counter*satConfig.dvbsChannelLength,
            satConfig.dvbsChannelLength);

              channel.RecordIndex = counter++;
              channel.baseOffset = this.dvbsBlockOffset + satConfig.ChannelListOffset + (int)channel.RecordIndex*satConfig.dvbsChannelLength;
        }
Esempio n. 6
0
        private void ReadDvbsChannels(ref int off, ushort startIndex)
        {
            var mapping = GetDvbsChannelMapping();
              ushort index = startIndex;
              for (int i = 0; i < this.dvbsChannelCount; i++)
              {
            int recordOffset = off + index*satConfig.dvbsChannelLength;
            mapping.SetDataPtr(fileContent, recordOffset);
            SatChannel ci = new SatChannel(i, index, mapping, this.DataRoot);
            if (!ci.InUse)
              ++this.deletedChannelsHard;
            else
            {
              if (ci.IsDeleted)
              {
            ci.OldProgramNr = -1;
            ci.NewProgramNr = -1;
            ++this.deletedChannelsSoft;
              }

              var list = this.DataRoot.GetChannelList(ci.SignalSource);
              var dupes = list.GetChannelByUid(ci.Uid);
              if (dupes.Count == 0)
              {
            if (ci.OldProgramNr == 0 && !ci.IsDeleted)
              ++this.dvbsChannelsAtPr0;
              }
              else
              {
            this.DataRoot.Warnings.AppendFormat(ERR_dupeChannel, ci.RecordIndex, ci.OldProgramNr, dupes[0].RecordIndex,
                                                dupes[0].OldProgramNr, dupes[0].Name).AppendLine();
            ++this.duplicateChannels;
              }
              this.DataRoot.AddChannel(list, ci);
            }

            if (!this.nextChannelIndex.TryGetValue(index, out index) || index == 0xFFFF)
              break;
              }
              off += satConfig.dvbsMaxChannelCount * satConfig.dvbsChannelLength;
        }