support for different "favNotSet"-values between D and E series

This commit is contained in:
hbeham
2013-04-03 15:41:04 +02:00
parent 8d22767ec2
commit edc384b8e0
7 changed files with 24 additions and 15 deletions

View File

@@ -9,7 +9,8 @@ namespace ChanSort.Loader.ScmFile
#region ctor()
public AnalogChannel(int slot, SignalSource signalSource, DataMapping mapping, decimal freq) : base(mapping)
public AnalogChannel(int slot, SignalSource signalSource, DataMapping mapping, decimal freq, int favoriteNotSetValue) :
base(mapping, favoriteNotSetValue)
{
this.InitCommonData(slot, signalSource, mapping);

View File

@@ -10,7 +10,6 @@
map-SateD = 144
Favorites = 4
[Series:C]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
@@ -31,6 +30,7 @@
map-SateD = 172
map-AstraHDPlusD = 212
Favorites = 5
FavoriteNotSet = 0
[Series:E]
SatDataBase.dat = 145
@@ -42,6 +42,7 @@
map-SateD = 168
map-AstraHDPlusD = 212
Favorites = 5
FavoriteNotSet = -1
[Analog:28]
; map-AirA and map-CableA for B series

View File

@@ -7,7 +7,9 @@ namespace ChanSort.Loader.ScmFile
{
private const string _ChannelOrTransponder = "offChannelTransponder";
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data, IDictionary<int, decimal> transpFreq) : base(data)
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data,
IDictionary<int, decimal> transpFreq, int favoriteNotSetValue) :
base(data, favoriteNotSetValue)
{
this.InitCommonData(slot, signalSource, data);
this.InitDvbData(data);

View File

@@ -14,6 +14,7 @@ namespace ChanSort.Loader.ScmFile
public readonly int dvbtFineTuneLength;
public readonly Favorites supportedFavorites;
public readonly int ptcLength;
public readonly int favoriteNotSetValue;
public ModelConstants(IniFile.Section iniSection)
{
@@ -31,6 +32,7 @@ namespace ChanSort.Loader.ScmFile
for (int i = 0; i < numFavorites; i++)
mask = (mask << 1) | 1;
this.supportedFavorites = (Favorites)mask;
this.favoriteNotSetValue = iniSection.GetInt("FavoriteNotSet");
}
}
}

View File

@@ -6,7 +6,8 @@ namespace ChanSort.Loader.ScmFile
{
private const string _TransponderIndex = "offTransponderIndex";
public SatChannel(int slot, DataMapping data, DataRoot dataRoot) : base(data)
public SatChannel(int slot, DataMapping data, DataRoot dataRoot, int favoriteNotSetValue) :
base(data, favoriteNotSetValue)
{
this.InitCommonData(slot, SignalSource.DvbS, data);
if (!this.InUse)

View File

@@ -1,4 +1,5 @@
using System.Text;
using System;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.ScmFile
@@ -27,6 +28,8 @@ namespace ChanSort.Loader.ScmFile
private const string _SymbolRate = "offSymbolRate";
private static readonly Encoding Utf16BigEndian = new UnicodeEncoding(true, false);
private static readonly byte[] favoriteSetValue = new byte[] { 1, 0, 0, 0 };
private readonly byte[] favoriteNotSetValue;
protected readonly DataMapping mapping;
protected readonly byte[] rawData;
@@ -34,12 +37,13 @@ namespace ChanSort.Loader.ScmFile
internal bool InUse { get; set; }
protected ScmChannelBase(DataMapping data)
protected ScmChannelBase(DataMapping data, int favoriteNotSetValue)
{
this.mapping = data;
this.rawData = data.Data;
this.baseOffset = data.BaseOffset;
this.mapping.DefaultEncoding = Utf16BigEndian;
this.favoriteNotSetValue = BitConverter.GetBytes(favoriteNotSetValue);
}
#region InitCommonData()
@@ -71,7 +75,7 @@ namespace ChanSort.Loader.ScmFile
byte mask = 0x01;
foreach (int off in offsets)
{
if ((System.BitConverter.ToInt32(this.rawData, baseOffset + off) + 1) > 1) // -1 and 0 mean "not set"
if ((BitConverter.ToInt32(this.rawData, baseOffset + off) + 1) > 1) // unset/set: D=0, E=-1
fav |= mask;
mask <<= 1;
}
@@ -139,10 +143,8 @@ namespace ChanSort.Loader.ScmFile
byte mask = 0x01;
foreach (int off in offsets)
{
this.rawData[baseOffset + off + 0] = (byte)((fav & mask) == 0 ? 0 : 1);
this.rawData[baseOffset + off + 1] = 0;
this.rawData[baseOffset + off + 2] = 0;
this.rawData[baseOffset + off + 3] = 0;
// unset/set: D-Series=0/1, E-Series=-1/1
Array.Copy((fav & mask) == 0 ? favoriteNotSetValue : favoriteSetValue, 0, this.rawData, baseOffset + off, 4);
mask <<= 1;
}
}

View File

@@ -323,7 +323,7 @@ namespace ChanSort.Loader.ScmFile
#region MapAnalogChannel()
private void MapAnalogChannel(DataMapping rawChannel, int slotIndex, ChannelList list, decimal freq)
{
AnalogChannel ci = new AnalogChannel(slotIndex, list.SignalSource, rawChannel, freq);
AnalogChannel ci = new AnalogChannel(slotIndex, list.SignalSource, rawChannel, freq, c.favoriteNotSetValue);
if (!ci.InUse)
return;
@@ -370,7 +370,7 @@ namespace ChanSort.Loader.ScmFile
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
DigitalChannel ci = new DigitalChannel(slotIndex, list.SignalSource, rawChannel, frequency);
DigitalChannel ci = new DigitalChannel(slotIndex, list.SignalSource, rawChannel, frequency, c.favoriteNotSetValue);
if (ci.OldProgramNr != 0)
this.DataRoot.AddChannel(list, ci);
@@ -456,7 +456,7 @@ namespace ChanSort.Loader.ScmFile
mapping.SetDataPtr(dvbsFileContent, 0);
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
SatChannel ci = new SatChannel(slotIndex, mapping, this.DataRoot);
SatChannel ci = new SatChannel(slotIndex, mapping, this.DataRoot, c.favoriteNotSetValue);
if (ci.InUse)
this.DataRoot.AddChannel(this.dvbsChannels, ci);
@@ -479,7 +479,7 @@ namespace ChanSort.Loader.ScmFile
mapping.SetDataPtr(hdplusFileContent, 0);
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
SatChannel ci = new SatChannel(slotIndex, mapping, this.DataRoot);
SatChannel ci = new SatChannel(slotIndex, mapping, this.DataRoot, c.favoriteNotSetValue);
if (ci.InUse)
this.hdplusChannels.AddChannel(ci);
mapping.BaseOffset += entrySize;