- complete rework of TLL and SCM loaders, removing all "unsafe" code

- fixed various issues with SCM files
This commit is contained in:
hbeham
2013-04-03 12:47:24 +02:00
parent e194ff983b
commit 994235e020
78 changed files with 4896 additions and 2961 deletions

View File

@@ -82,11 +82,11 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Utils\ChannelMappingBase.cs" />
<None Include="Utils\ChannelMappingBase.cs" />
<Compile Include="Utils\DataMapping.cs" />
<Compile Include="Utils\Crc32.cs" />
<Compile Include="Utils\CsvFile.cs" />
<Compile Include="Utils\DvbChannelMappingBase.cs" />
<None Include="Utils\DvbChannelMappingBase.cs" />
<Compile Include="Utils\DvbStringDecoder.cs" />
<Compile Include="Utils\IniFile.cs" />
<Compile Include="Model\ChannelInfo.cs" />

View File

@@ -7,6 +7,7 @@ namespace ChanSort.Api
{
public DataRoot DataRoot;
public ChannelList ChannelList;
private UnsortedChannelMode unsortedChannelMode;
#if false
#region LoadDvbViewerFiles()
@@ -272,5 +273,71 @@ namespace ChanSort.Api
}
}
#endregion
#region AutoNumberingForUnassignedChannels()
public void AutoNumberingForUnassignedChannels(UnsortedChannelMode mode)
{
this.unsortedChannelMode = mode;
foreach (var list in DataRoot.ChannelLists)
{
var sortedChannels = list.Channels.OrderBy(ChanSortCriteria).ToList();
int maxProgNr = 0;
foreach (var appChannel in sortedChannels)
{
if (appChannel.RecordIndex < 0)
continue;
if (appChannel.NewProgramNr <= 0 && mode == UnsortedChannelMode.Hide)
continue;
int progNr = GetNewProgramNr(appChannel, ref maxProgNr);
appChannel.NewProgramNr = progNr;
}
}
}
#region ChanSortCriteria()
private string ChanSortCriteria(ChannelInfo channel)
{
// explicitly sorted
if (channel.NewProgramNr != 0)
return channel.NewProgramNr.ToString("d4");
// eventually hide unsorted channels
if (this.unsortedChannelMode == UnsortedChannelMode.Hide)
return "Z";
// eventually append in old order
if (this.unsortedChannelMode == UnsortedChannelMode.AppendInOrder)
return "B" + channel.OldProgramNr.ToString("d4");
// sort alphabetically, with "." and "" on the bottom
if (channel.Name == ".")
return "B";
if (channel.Name == "")
return "C";
return "A" + channel.Name;
}
#endregion
#region GetNewProgramNr()
private int GetNewProgramNr(ChannelInfo appChannel, ref int maxPrNr)
{
int prNr = appChannel.NewProgramNr;
if (prNr > maxPrNr)
maxPrNr = prNr;
if (prNr == 0)
{
if (appChannel.OldProgramNr != 0 && this.unsortedChannelMode != UnsortedChannelMode.Hide)
prNr = ++maxPrNr;
}
return prNr;
}
#endregion
#endregion
}
}

View File

@@ -4,13 +4,24 @@ namespace ChanSort.Api
{
public abstract class SerializerBase
{
public class SupportedFeatures
{
public bool EraseChannelData { get; set; }
public bool ChannelNameEdit { get; set; }
public bool FileInformation { get; set; }
public bool DeviceSettings { get; set; }
}
private Encoding defaultEncoding;
public string FileName { get; set; }
public DataRoot DataRoot { get; protected set; }
public SupportedFeatures Features { get; private set; }
protected SerializerBase(string inputFile)
{
this.Features = new SupportedFeatures();
this.FileName = inputFile;
this.DataRoot = new DataRoot();
this.defaultEncoding = Encoding.GetEncoding("iso-8859-9");
@@ -18,7 +29,7 @@ namespace ChanSort.Api
public abstract string DisplayName { get; }
public abstract void Load();
public abstract void Save(string tvOutputFile, string csvOutputFile, UnsortedChannelMode unsortedChannelMode);
public abstract void Save(string tvOutputFile, string csvOutputFile);
public virtual Encoding DefaultEncoding
{
@@ -26,13 +37,10 @@ namespace ChanSort.Api
set { this.defaultEncoding = value; }
}
public bool SupportsEraseChannelData { get; protected set; }
public virtual void EraseChannelData() { }
public virtual string GetFileInformation() { return ""; }
public virtual void ShowDeviceSettingsForm(object parentWindow) { }
public bool SupportsChannelNameEdit { get; protected set; }
}
}

View File

@@ -420,57 +420,6 @@ TRANSP;120;12728
SERVICETYPE;Number;Description
SERVICETYPE;01;SD-TV
SERVICETYPE;02;Radio
SERVICETYPE;12;Daten/Test
SERVICETYPE;12;Data/Test
SERVICETYPE;25;HD-TV
SERVICETYPE;211;Sky Select
DVBT;Channel;MHz
DVBT;21;474
DVBT;22;482
DVBT;23;490
DVBT;24;498
DVBT;25;506
DVBT;26;514
DVBT;27;522
DVBT;28;530
DVBT;29;538
DVBT;30;546
DVBT;31;554
DVBT;32;562
DVBT;33;570
DVBT;34;578
DVBT;35;586
DVBT;36;594
DVBT;37;602
DVBT;38;610
DVBT;39;618
DVBT;40;626
DVBT;41;634
DVBT;42;642
DVBT;43;650
DVBT;44;658
DVBT;45;666
DVBT;46;674
DVBT;47;682
DVBT;48;690
DVBT;49;698
DVBT;50;706
DVBT;51;714
DVBT;52;722
DVBT;53;730
DVBT;54;738
DVBT;55;746
DVBT;56;754
DVBT;57;762
DVBT;58;770
DVBT;59;778
DVBT;60;786
DVBT;61;794
DVBT;62;802
DVBT;63;810
DVBT;64;818
DVBT;65;826
DVBT;66;834
DVBT;67;842
DVBT;68;850
DVBT;69;858
SERVICETYPE;211;Option
1 ONID Start End Name Operator
420 SERVICETYPE 02 Radio
421 SERVICETYPE 12 Daten/Test Data/Test
422 SERVICETYPE 25 HD-TV
423 SERVICETYPE 211 Sky Select Option
424
425
DVBT 22 482
DVBT 23 490
DVBT 24 498
DVBT 25 506
DVBT 26 514
DVBT 27 522
DVBT 28 530
DVBT 29 538
DVBT 30 546
DVBT 31 554
DVBT 32 562
DVBT 33 570
DVBT 34 578
DVBT 35 586
DVBT 36 594
DVBT 37 602
DVBT 38 610
DVBT 39 618
DVBT 40 626
DVBT 41 634
DVBT 42 642
DVBT 43 650
DVBT 44 658
DVBT 45 666
DVBT 46 674
DVBT 47 682
DVBT 48 690
DVBT 49 698
DVBT 50 706
DVBT 51 714
DVBT 52 722
DVBT 53 730
DVBT 54 738
DVBT 55 746
DVBT 56 754
DVBT 57 762
DVBT 58 770
DVBT 59 778
DVBT 60 786
DVBT 61 794
DVBT 62 802
DVBT 63 810
DVBT 64 818
DVBT 65 826
DVBT 66 834
DVBT 67 842
DVBT 68 850
DVBT 69 858

View File

@@ -11,8 +11,9 @@ namespace ChanSort.Api
/// </summary>
public readonly List<ChannelInfo> Duplicates = new List<ChannelInfo>();
public SignalSource SignalSource { get; private set; }
public SignalType SignalType { get; private set; }
public virtual bool IsDeleted { get; set; }
public SignalSource SignalSource { get; protected set; }
public SignalType SignalType { get; protected set; }
public int RecordIndex { get; set; }
public int RecordOrder { get; set; }
public int OldProgramNr { get; set; }
@@ -42,6 +43,10 @@ namespace ChanSort.Api
public bool IsNameModified { get; set; }
#region ctor()
protected ChannelInfo()
{
}
/// <summary>
/// Constructor for exiting TV channel
/// </summary>
@@ -201,5 +206,13 @@ namespace ChanSort.Api
this.AddDebug(ptr[i]);
}
#endregion
public virtual void UpdateRawData()
{
}
public virtual void ChangeEncoding(System.Text.Encoding encoding)
{
}
}
}

View File

@@ -74,7 +74,8 @@ namespace ChanSort.Api
return list;
}
ChannelList newList = new ChannelList(signalSource, signalType);
this.AddChannelList(newList);
if (createIfNotExists)
this.AddChannelList(newList);
return newList;
}
#endregion

View File

@@ -46,13 +46,6 @@ namespace ChanSort.Api
}
#endregion
#region GetDvbtTransponderFrequency()
public int GetDvbtTransponderFrequency(int transponderNr)
{
return this.dvbtFreqInMhzByTransponder.TryGet(transponderNr);
}
#endregion
#region GetServiceTypeDescription()
public string GetServiceTypeDescription(int serviceType)
{

View File

@@ -34,11 +34,11 @@
#endregion
#region CalcCrc32()
public static unsafe uint CalcCrc32(byte* block, int length)
public static uint CalcCrc32(byte[] block, int start, int length)
{
uint crc32 = CrcMask;
for (int i = 0; i < length; i++)
crc32 = crc32Table[(crc32 & 0xff) ^ block[i]] ^ (crc32 >> 8);
crc32 = crc32Table[(crc32 & 0xff) ^ block[start + i]] ^ (crc32 >> 8);
return crc32;
}
#endregion

View File

@@ -1,202 +1,194 @@
using System.Text;
using System;
using System.Text;
namespace ChanSort.Api
{
public unsafe class DataMapping
public class DataMapping
{
protected readonly Encoding stringEncoding;
protected readonly IniFile.Section settings;
protected readonly int length;
private int baseOffset;
private byte[] data { get; set; }
public Encoding DefaultEncoding { get; set; }
#region ctor()
public DataMapping(IniFile.Section settings, int structureLength, Encoding stringEncoding)
public DataMapping(IniFile.Section settings)
{
this.settings = settings;
this.length = structureLength;
this.stringEncoding = stringEncoding;
this.DefaultEncoding = Encoding.Default;
}
#endregion
#region DataPtr
public byte* DataPtr { get; set; }
#endregion
#region DataLength
public int DataLength { get { return this.length; } }
#endregion
#region Next()
public void Next()
#region SetDataPtr(), Data, BaseOffset
public void SetDataPtr(byte[] data, int baseOffset)
{
this.DataPtr += this.length;
this.data = data;
this.baseOffset = baseOffset;
}
public byte[] Data { get { return this.data; } }
public int BaseOffset { get { return this.baseOffset; } set { this.baseOffset = value; } }
#endregion
#region GetOffsets()
protected int[] GetOffsets(string key)
public int[] GetOffsets(string key)
{
return settings.GetIntList(key);
}
#endregion
public IniFile.Section Settings { get { return this.settings; } }
#region GetByte()
public byte GetByte(int off)
{
return off < 0 ? (byte)0 : this.DataPtr[off];
}
#region Byte
public byte GetByte(string key)
{
var offsets = settings.GetIntList(key);
return offsets.Length > 0 ? this.GetByte(offsets[0]) : (byte)0;
if (offsets.Length==0) return 0;
return this.data[baseOffset + offsets[0]];
}
public void SetByte(string key, int value)
{
var offsets = settings.GetIntList(key);
foreach (int offset in offsets)
this.data[baseOffset + offset] = (byte)value;
}
#endregion
#region GetWord()
public ushort GetWord(int off)
{
return off < 0 ? (ushort)0 : *(ushort*) (this.DataPtr + off);
}
#region Word
public ushort GetWord(string key)
{
var offsets = settings.GetIntList(key);
return offsets.Length > 0 ? this.GetWord(offsets[0]) : (ushort)0;
}
#endregion
#region GetDword()
public uint GetDword(int off)
{
return off < 0 ? 0 : *(uint*) (this.DataPtr + off);
}
public uint GetDword(string key)
{
var offsets = settings.GetIntList(key);
return offsets.Length > 0 ? this.GetDword(offsets[0]) : 0;
}
#endregion
#region GetFloat()
public float GetFloat(int off)
{
return off < 0 ? 0 : *(float*) (this.DataPtr + off);
}
public float GetFloat(string key)
{
var offsets = settings.GetIntList(key);
return offsets.Length > 0 ? this.GetFloat(offsets[0]) : 0;
}
#endregion
#region GetFlag()
public bool GetFlag(int offset, byte mask)
{
return offset >= 0 && (this.GetByte(offset) & mask) != 0;
}
public bool GetFlag(string valueKey, string maskKey)
{
byte mask = (byte)settings.GetInt(maskKey);
var offsets = settings.GetIntList(valueKey);
return offsets.Length > 0 && this.GetFlag(offsets[0], mask);
}
#endregion
#region GetString()
public string GetString(int offset, int maxByteLen)
{
if (offset < 0) return null;
byte[] buffer = new byte[maxByteLen];
for (int i = 0; i < maxByteLen; i++)
buffer[i] = this.DataPtr[offset + i];
return stringEncoding.GetString(buffer).TrimEnd('\0');
}
public string GetString(string key, int maxLen)
{
var offsets = settings.GetIntList(key);
return offsets.Length == 0 ? null : GetString(offsets[0], maxLen);
}
#endregion
#region SetByte()
public void SetByte(int off, byte value)
{
if (off >= 0)
this.DataPtr[off] = value;
}
public void SetByte(string key, byte value)
{
var offsets = settings.GetIntList(key);
foreach(int offset in offsets)
this.SetByte(offset, value);
}
#endregion
#region SetWord()
public void SetWord(int off, int value)
{
if (off >= 0)
*(ushort*) (this.DataPtr + off) = (ushort)value;
if (offsets.Length == 0) return 0;
return BitConverter.ToUInt16(this.data, baseOffset + offsets[0]);
}
public void SetWord(string key, int value)
{
var offsets = settings.GetIntList(key);
foreach (int offset in offsets)
this.SetWord(offset, value);
{
this.data[baseOffset + offset + 0] = (byte)value;
this.data[baseOffset + offset + 1] = (byte)(value>>8);
}
}
#endregion
#region SetDword()
public void SetDword(int off, uint value)
#region DWord
public long GetDword(string key)
{
if (off >= 0)
*(uint*) (this.DataPtr + off) = value;
var offsets = settings.GetIntList(key);
if (offsets.Length == 0) return 0;
return BitConverter.ToUInt32(this.data, baseOffset + offsets[0]);
}
public void SetDword(string key, uint value)
public void SetDword(string key, long value)
{
var offsets = settings.GetIntList(key);
foreach (int offset in offsets)
this.SetDword(offset, value);
{
this.data[baseOffset + offset + 0] = (byte)value;
this.data[baseOffset + offset + 1] = (byte)(value >> 8);
this.data[baseOffset + offset + 2] = (byte)(value >> 16);
this.data[baseOffset + offset + 3] = (byte)(value >> 24);
}
}
#endregion
#region SetFloat()
public void SetFloat(int off, float value)
#region Float
public float GetFloat(string key)
{
if (off >= 0)
*(float*)(this.DataPtr + off) = value;
var offsets = settings.GetIntList(key);
if (offsets.Length == 0) return 0;
return BitConverter.ToSingle(this.data, baseOffset + offsets[0]);
}
public void SetFloat(string key, float value)
{
var offsets = settings.GetIntList(key);
var bytes = BitConverter.GetBytes(value);
foreach (int offset in offsets)
this.SetFloat(offset, value);
{
for (int i = 0; i < 4; i++)
this.data[baseOffset + offset + i] = bytes[i];
}
}
#endregion
#region GetFlag
public bool GetFlag(string key)
{
return GetFlag("off" + key, "mask" + key);
}
public bool GetFlag(string valueKey, string maskKey)
{
int mask = settings.GetInt(maskKey);
return GetFlag(valueKey, mask);
}
public bool GetFlag(string valueKey, int mask)
{
if (mask == 0) return false;
var offsets = settings.GetIntList(valueKey);
if (offsets.Length == 0) return false;
return (this.data[baseOffset + offsets[0]] & mask) == mask;
}
#endregion
#region SetFlag()
public void SetFlag(int offset, byte mask, bool set)
public void SetFlag(string key, bool value)
{
byte val = this.GetByte(offset);
this.SetByte(offset, (byte)(set ? val | mask : val & ~mask));
this.SetFlag("off" + key, "mask" + key, value);
}
public void SetFlag(string valueKey, string maskKey, bool set)
public void SetFlag(string valueKey, string maskKey, bool value)
{
byte mask = (byte)settings.GetInt(maskKey);
int mask = settings.GetInt(maskKey);
SetFlag(valueKey, mask, value);
}
public void SetFlag(string valueKey, int mask, bool value)
{
if (mask == 0) return;
var offsets = settings.GetIntList(valueKey);
foreach (int offset in offsets)
this.SetFlag(offset, mask, set);
foreach (var offset in offsets)
{
if (value)
this.data[baseOffset + offset] |= (byte)mask;
else
this.data[baseOffset + offset] &= (byte)~mask;
}
}
#endregion
#region GetString()
public string GetString(string key, int maxLen)
{
var offsets = settings.GetIntList(key);
if (offsets.Length == 0) return null;
int length = this.GetByte(key + "Length");
if (length == 0)
length = maxLen;
var encoding = this.DefaultEncoding;
return encoding.GetString(this.data, baseOffset + offsets[0], length).TrimEnd('\0');
}
#endregion
#region SetString()
public void SetString(string key, string text, int maxLen)
{
var bytes = this.DefaultEncoding.GetBytes(text);
int len = Math.Min(bytes.Length, maxLen);
foreach (var offset in settings.GetIntList(key))
{
Array.Copy(bytes, 0, this.data, baseOffset + offset, len);
for (int i = len; i < maxLen; i++)
this.data[baseOffset + offset + i] = 0;
}
}
#endregion
}

View File

@@ -70,7 +70,8 @@ namespace ChanSort.Api
null, "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-9", "iso-8859-10", "iso-8859-11",
null, "iso-8859-13", "iso-8859-14", "iso-8859-15", null, null, null, null,
null, // codePages2 prefix
"utf-16", "x-cp20949", "x-cp20936", "utf-16", "utf-8", null, null, null
"utf-16", "x-cp20949", "x-cp20936", "utf-16", "utf-8", null, null, null,
"utf-8", null, null, null, "utf-8"
};
static readonly string[] codePages2 =
@@ -89,49 +90,73 @@ namespace ChanSort.Api
public Encoding DefaultEncoding { get; set; }
#region GetChannelNames()
public unsafe void GetChannelNames(byte* name, int len, out string longName, out string shortName)
public void GetChannelNames(byte[] name, int off, int len, out string longName, out string shortName)
{
StringBuilder sbLong = new StringBuilder();
StringBuilder sbShort = new StringBuilder();
longName = "";
shortName = "";
if (len == 0)
return;
byte b = name[off];
if (b == 0)
return;
Decoder decoder = this.DefaultEncoding.GetDecoder();
bool inShortMode = false;
for (int i = 0; i < len; i++)
bool singleByteChar = true;
if (b < 0x20)
{
byte b = name[i];
if (b == 0x00)
break;
if (b == 0x10) // prefix for 3-byte code page
if (b == 0x10) // prefix for 2-byte code page
{
int cpIndex = name[i + 1] * 256 + name[i + 2];
i += 2;
int cpIndex = name[off + 1] * 256 + name[off + 2];
off += 2;
len -= 2;
SetDecoder(codePages2, cpIndex, ref decoder);
continue;
}
if (b <= 0x1F)
{
SetDecoder(codePages1, b, ref decoder);
continue;
}
singleByteChar = b < 0x10;
++off;
--len;
}
if (!singleByteChar)
{
char[] buffer = new char[100];
int l= decoder.GetChars(name, off, len, buffer, 0, false);
longName = new string(buffer, 0, l);
return;
}
StringBuilder sbLong = new StringBuilder();
StringBuilder sbShort = new StringBuilder();
bool inShortMode = false;
for (int c = 0; c < len; c++)
{
int i = off + c;
b = name[i];
if (b == 0x00)
break;
char ch = '\0';
switch (b)
if (singleByteChar)
{
case 0x86: inShortMode = true; break;
case 0x87: inShortMode = false; break;
case 0x8a: ch = '\n'; break;
default:
// read as many bytes as necessary to get a character
char[] charArray = new char[1];
fixed (char* pCh = charArray)
{
byte* start = name + i;
for (int j = 1; i < len && decoder.GetChars(start, j, pCh, 1, true) == 0; ++j)
++i;
}
ch = charArray[0];
break;
switch (b)
{
case 0x86: inShortMode = true; continue;
case 0x87: inShortMode = false; continue;
case 0x8a: ch = '\n'; break;
default:
if (b >= 0x80 && b <= 0x9f) // DVB-S control characters
continue;
break;
}
}
if (ch == '\0')
{
// read as many bytes as necessary to get a character
char[] charArray = new char[1];
for (int byteCnt = 1; decoder.GetChars(name, i, byteCnt, charArray, 0) == 0; byteCnt++)
++i;
ch = charArray[0];
}
if (ch == '\0')
continue;

View File

@@ -14,9 +14,9 @@ namespace ChanSort.Api
this.caption = caption;
}
public void AddMapping(T mapping)
public void AddMapping(int dataLength, T mapping)
{
mappings[mapping.DataLength] = mapping;
mappings[dataLength] = mapping;
}
public T GetMapping(int dataLength, bool throwException = true)

View File

@@ -23,5 +23,18 @@ namespace ChanSort.Api
name = name.Substring(0, idx);
return name;
}
public static string GetAnalogChannelNumber(int freq)
{
if (freq < 41) return "";
if (freq <= 68) return ((freq - 41)/7 + 1).ToString("d2"); // Band I (01-04)
if (freq < 105) return "";
if (freq <= 174) return "S" + ((freq - 105)/7 + 1).ToString("d2"); // Midband (S01-S10)
if (freq <= 230) return ((freq - 175)/7 + 5).ToString("d2"); // Band III (05-12)
if (freq <= 300) return "S" + ((freq - 231)/7 + 11); // Superband (S11-S20)
if (freq <= 469) return "S" + ((freq - 303)/8 + 21); // Hyperband (S21-S41)
if (freq <= 1000) return ((freq - 471)/8 + 21).ToString("d2"); // Band IV, V
return "";
}
}
}

View File

@@ -0,0 +1,29 @@
using ChanSort.Api;
namespace ChanSort.Loader.ScmFile
{
internal class AnalogChannel : ScmChannelBase
{
private const string _Skip = "Skip";
private const string _Frequency = "offFrequency";
#region ctor()
public AnalogChannel(int slot, SignalSource signalSource, DataMapping mapping, decimal freq) : base(mapping)
{
this.InitCommonData(slot, signalSource, mapping);
this.FreqInMhz = (decimal)mapping.GetFloat(_Frequency); // C,D,E series have the value in the data record
if (this.FreqInMhz == 0) // for B series take it from the Tuning table
this.FreqInMhz = freq;
if (this.FreqInMhz == 0) // fallback since Freq is part of the UID and requires a unique value
this.FreqInMhz = slot;
this.Skip = mapping.GetFlag(_Skip);
this.ChannelOrTransponder = "";
}
#endregion
}
}

View File

@@ -1,72 +0,0 @@
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.ScmFile
{
internal class AnalogChannelDataMapping : ChannelMappingBase
{
const string offFrequency = "offFrequency";
const string offChecksum = "offChecksum";
#region ctor()
public AnalogChannelDataMapping(IniFile.Section settings, int length) :
base(settings, length, new UnicodeEncoding(true, false))
{
}
#endregion
#region Favorites
public override Favorites Favorites
{
get
{
if (this.DataLength < 64)
return base.Favorites;
byte fav = 0;
byte mask = 0x01;
foreach (int off in this.GetOffsets(offFavorites))
{
if (this.GetByte(off) == 1)
fav |= mask;
mask <<= 1;
}
return (Favorites)fav;
}
set
{
if (this.DataLength < 64)
{
base.Favorites = value;
return;
}
int intValue = (int)value;
foreach (int off in this.GetOffsets(offFavorites))
{
if ((intValue & 1) != 0)
this.SetByte(off, 1);
intValue >>= 1;
}
}
}
#endregion
#region Frequency
public float Frequency
{
get { return this.GetFloat(offFrequency); }
set { this.SetFloat(offFrequency, value); }
}
#endregion
#region Checksum
public byte Checksum
{
get { return this.GetByte(offChecksum); }
set { this.SetByte(offChecksum, value); }
}
#endregion
}
}

View File

@@ -8,8 +8,8 @@
<ProjectGuid>{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Plugin.ScmFile</RootNamespace>
<AssemblyName>ChanSort.Plugin.ScmFile</AssemblyName>
<RootNamespace>ChanSort.Loader.ScmFile</RootNamespace>
<AssemblyName>ChanSort.Loader.ScmFile</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
@@ -37,7 +37,7 @@
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -67,14 +67,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AnalogChannelDataMapping.cs" />
<Compile Include="DvbSChannelDataMapping.cs" />
<Compile Include="DvbCtChannelDataMapping.cs" />
<Compile Include="AnalogChannel.cs" />
<Compile Include="DigitalChannel.cs" />
<Compile Include="ModelConstants.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SatChannel.cs" />
<Compile Include="SatelliteMapping.cs" />
<Compile Include="ScmChannelBase.cs" />
<Compile Include="ScmSerializer.cs" />
<Compile Include="ScmSerializerPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScmStructures.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
@@ -82,11 +83,6 @@
<Name>ChanSort.Api</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="ChanSort.Plugin.ScmFile.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -1,334 +0,0 @@
[Series:B]
SatDataBase.dat = 145
TransponderDataBase.dat = 49
FineTune = 20
FineTune_Digital = 28
map-AirA = 28
map-AirD = 248
map-CableD = 248
map-SateD = 144
Favorites = 4
[Series:C]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
map-AirA = 40
map-AirD = 292
map-CableD = 292
map-SateD = 144
Favorites = 4
[Series:D]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
map-AirA = 64
map-AirD = 320
map-CableD = 320
map-SateD = 172
map-AstraHDPlusD = 212
Favorites = 5
[Series:E]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
map-AirA = 64
map-AirD = 320
map-CableD = 320
map-SateD = 168
map-AstraHDPlusD = 212
Favorites = 5
[Analog:28]
; map-AirA and map-CableA for B series
offInUse = 0
maskInUse = 0x02
;offNameLength = 1
offProgramNr = 4
offFavorites =
offName = 12
lenName = 12
offChecksum = 27
[Analog:40]
; map-AirA and map-CableA for C series
offInUse = 1
maskInUse = 0x01
offSkip = 2
maskSkip = 0x01
offLock = 6
maskLock = 0x01
offTuned = 8
maskTuned = 0x01
offProgramNr = 9
offSlotNr = 16
offNameLength = 18
offName = 20
offFrequency = 32
offFavorites = 38
offChecksum = 39
[Analog:64]
; map-AirA and map-CableA for D series
offInUse = 1
maskInUse = 0x01
offSkip = 2
maskSkip = 0x01
offLock = 6
maskLock = 0x01
offTuned = 8
maskTuned = 0x01
offProgramNr = 9
offSlotNr = 16
offNameLength = 18
offName = 20
offFrequency = 32
offFavorite = 36,40,44,48,52
offChecksum = 63
[FineTune:20]
offIsCable = 0
maskIsCable = 0x01
offSlotNr = 4
offFrequency = 8
[FineTune_Digital:28]
offIsCable = 0
maskIsCable = 0x01
offChannelTransponder = 4
offFrequency = 16
[DvbCT:248]
; map-AirD and map-CableD for B series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offServiceId = 10
offStatus = 8
offQam = 7
offServiceType = 9
offEncrypted = 23
maskEncrypted = 0xff
offSymbolRate = 32
offLock = 244
maskLock = 0x01
offOriginalNetworkId = 12
offNetworkId = 14
offBouquet = 34
offChannelTransponder = 26
offLogicalProgramNr = 28
offTransportStreamId = 36
offName = 44
lenName = 100
offFavorites = 246
offChecksum = 247
offCodec =
offServiceProviderId =
offShortName =
lenShortName =
offVideoFormat =
[DvbCT:292]
; map-AirD and map-CableD for C series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offServiceId = 6
offStatus =
offQam = 12
offBandwidth = 14
offServiceType = 15
offCodec = 16
offHRes = 20
offVRes = 22
offEncrypted = 24
maskEncrypted = 0xff
offFrameRate = 25
offSymbolRate = 28
offLock = 31
maskLock = 0x01
offOriginalNetworkId = 32
offNetworkId = 34
offServiceProviderId = 40
offChannelTransponder = 42
offLogicalProgramNr = 44
offTransportStreamId = 48
offName = 64
lenName = 200
offShortName = 264
lenShortName = 18
offVideoFormat = 282
offFavorites = 289
offChecksum = 291
offBouquet =
[DvbCT:320]
; map-AirD and map-CableD for D and E series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offServiceId = 6
offStatus =
offQam = 12
offBandwidth = 14
offServiceType = 15
offCodec = 16
offHRes = 20
offVRes = 22
offEncrypted = 24
maskEncrypted = 0xff
offFrameRate = 25
offSymbolRate = 28
offLock = 31
maskLock = 0x01
offOriginalNetworkId = 32
offNetworkId = 34
offServiceProviderId = 40
offChannelTransponder = 42
offLogicalProgramNr = 44
offTransportStreamId = 48
offName = 64
lenName = 200
offShortName = 264
lenShortName = 18
offVideoFormat = 282
offFavorites = 292,296,300,304,308
offChecksum = 319
offBouquet =
[DvbS:144]
; map-SateD for B and C Series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offInUse = 7
maskInUse = 0x01
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderNr = 18
offSatelliteNr = 20
offTransportStreamId = 24
offOriginalNetworkId = 28
offHRes = 32
offVRes = 34
offName = 36
lenName = 100
offEncrypted = 136
maskEncrypted = 0x01
offBouquet = 138
offFavorites = 142
offChecksum = 143
offCodec =
offSymbolRate =
offNetworkId =
offServiceProviderId =
offChannelTransponder =
offLogicalProgramNr =
offShortName =
lenShortName =
offVideoFormat =
[DvbS:172]
; map-SateD for D Series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offInUse = 7
maskInUse = 0x01
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderNr = 18
offSatelliteNr = 20
offTransportStreamId = 24
offOriginalNetworkId = 28
offHRes = 32
offVRes = 34
offName = 36
lenName = 100
offEncrypted = 136
maskEncrypted = 0x01
offBouquet = 138
offFavorites = 140,144,148,152,156
offChecksum = 171
offCodec =
offSymbolRate =
offNetworkId =
offServiceProviderId =
offChannelTransponder =
offLogicalProgramNr =
offShortName =
lenShortName =
offVideoFormat =
[DvbS:168]
; map-SateD for E Series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offInUse = 7
maskInUse = 0x01
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderNr = 18
offSatelliteNr = 20
offTransportStreamId = 24
offOriginalNetworkId = 28
offHRes = 32
offVRes = 34
offName = 36
offEncrypted = 136
maskEncrypted = 0x01
lenName = 100
offBouquet = 138
offFavorites = 140,144,148,152,156
offChecksum = 167
offCodec =
offSymbolRate =
offNetworkId =
offServiceProviderId =
offChannelTransponder =
offLogicalProgramNr =
offShortName =
lenShortName =
offVideoFormat =
[AstraHDPlusD:212]
; map-AstraHDPlusD for D and E Series
offProgramNr = 0,20
offVideoPid =
offPcrPid =
offInUse = 14
maskInUse = 0xff
offLock =
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderNr = 18
offSatelliteNr =
offTransportStreamId = 36
offOriginalNetworkId = 32
offHRes =
offVRes =
offName = 48
offEncrypted = 180
maskEncrypted = 0x01
lenName = 100
offBouquet = 138
offFavorites = 184,188,192,196,200
offChecksum = 211
offCodec =
offSymbolRate =
offNetworkId =
offServiceProviderId =
offChannelTransponder =
offLogicalProgramNr =
offShortName =
lenShortName =
offVideoFormat =

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using ChanSort.Api;
namespace ChanSort.Loader.ScmFile
{
public class DigitalChannel : ScmChannelBase
{
private const string _ChannelOrTransponder = "offChannelTransponder";
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data, IDictionary<int, decimal> transpFreq) : base(data)
{
this.InitCommonData(slot, signalSource, data);
this.InitDvbData(data);
int transp = data.GetByte(_ChannelOrTransponder);
decimal freq = transpFreq.TryGet(transp);
if (freq == 0)
freq = transp*8 + 106;
this.ChannelOrTransponder = ((int)(freq-106)/8).ToString();
this.FreqInMhz = freq;
}
}
}

View File

@@ -1,63 +0,0 @@
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.ScmFile
{
internal class DvbCtChannelDataMapping : DvbChannelMappingBase
{
const string offChecksum = "offChecksum";
#region ctor()
public DvbCtChannelDataMapping(IniFile.Section settings, int dataLength)
: base(settings, dataLength, new UnicodeEncoding(true, false))
{
}
#endregion
#region Checksum
public byte Checksum
{
get { return this.GetByte(offChecksum); }
set { this.SetByte(offChecksum, value); }
}
#endregion
#region Favorites
public override Favorites Favorites
{
get
{
if (this.DataLength < 320)
return base.Favorites;
byte fav = 0;
byte mask = 0x01;
foreach (int off in this.GetOffsets(offFavorites))
{
if (this.GetByte(off) == 1)
fav |= mask;
mask <<= 1;
}
return (Favorites)fav;
}
set
{
if (this.DataLength < 320)
{
base.Favorites = value;
return;
}
int intValue = (int)value;
foreach (int off in this.GetOffsets(offFavorites))
{
if ((intValue & 1) != 0)
this.SetByte(off, 1);
intValue >>= 1;
}
}
}
#endregion
}
}

View File

@@ -1,83 +0,0 @@
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.ScmFile
{
internal class DvbSChannelDataMapping : DvbChannelMappingBase
{
private const string offChecksum = "offChecksum";
private const string offTransponderNr = "offTransponderNr";
private const string offSatelliteNr = "offSatelliteNr";
private readonly bool hasExtendedFavorites;
#region ctor()
public DvbSChannelDataMapping(IniFile.Section settings, int dataLength)
: base(settings, dataLength, new UnicodeEncoding(true, false))
{
this.hasExtendedFavorites = dataLength >= 168;
}
#endregion
#region TransponderNr
public ushort TransponderNr
{
get { return this.GetWord(offTransponderNr); }
set { this.SetWord(offTransponderNr, value); }
}
#endregion
#region SatelliteNr
public ushort SatelliteNr
{
get { return this.GetWord(offSatelliteNr); }
set { this.SetWord(offSatelliteNr, value); }
}
#endregion
#region Favorites
public override Favorites Favorites
{
get
{
if (!this.hasExtendedFavorites)
return base.Favorites;
byte fav = 0;
byte mask = 0x01;
foreach (int off in this.GetOffsets(offFavorites))
{
if (this.GetDword(off) == 1)
fav |= mask;
mask <<= 1;
}
return (Favorites)fav;
}
set
{
if (!this.hasExtendedFavorites)
{
base.Favorites = value;
return;
}
int intValue = (int)value;
foreach (int off in this.GetOffsets(offFavorites))
{
if ((intValue & 1) != 0)
this.SetDword(off, 1);
intValue >>= 1;
}
}
}
#endregion
#region Checksum
public byte Checksum
{
get { return this.GetByte(offChecksum); }
set { this.SetByte(offChecksum, value); }
}
#endregion
}
}

View File

@@ -1,6 +1,6 @@
using ChanSort.Api;
namespace ChanSort.Plugin.ScmFile
namespace ChanSort.Loader.ScmFile
{
internal class ModelConstants
{
@@ -13,12 +13,14 @@ namespace ChanSort.Plugin.ScmFile
public readonly int avbtFineTuneLength;
public readonly int dvbtFineTuneLength;
public readonly Favorites supportedFavorites;
public readonly int ptcLength;
public ModelConstants(IniFile.Section iniSection)
{
this.avbtChannelLength = iniSection.GetInt("map-AirA");
this.dvbtChannelLength = iniSection.GetInt("map-AirD");
this.dvbsChannelLength = iniSection.GetInt("map-SateD");
this.ptcLength = iniSection.GetInt("PTC");
this.hdplusChannelLength = iniSection.GetInt("map-AstraHDPlusD");
this.dvbsSatelliteLength = iniSection.GetInt("SatDataBase.dat");
this.dvbsTransponderLength = iniSection.GetInt("TransponderDataBase.dat");

View File

@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ChanSort.Plugin.ScmFile")]
[assembly: AssemblyTitle("ChanSort.Loader.ScmFile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Plugin.ScmFile")]
[assembly: AssemblyProduct("ChanSort.Loader.ScmFile")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@@ -0,0 +1,34 @@
using ChanSort.Api;
namespace ChanSort.Loader.ScmFile
{
class SatChannel : ScmChannelBase
{
private const string _TransponderIndex = "offTransponderIndex";
public SatChannel(int slot, DataMapping data, DataRoot dataRoot) : base(data)
{
this.InitCommonData(slot, SignalSource.DvbS, data);
if (!this.InUse)
return;
this.InitDvbData(data);
int transponderIndex = data.GetWord(_TransponderIndex);
Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex);
if (transponder == null)
{
dataRoot.Warnings.AppendLine("Invalid transponder index: " + transponderIndex);
return;
}
Satellite sat = transponder.Satellite;
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
this.Polarity = transponder.Polarity;
this.SymbolRate = transponder.SymbolRate;
this.FreqInMhz = transponder.FrequencyInMhz;
this.ChannelOrTransponder = "";
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Text;
namespace ChanSort.Loader.ScmFile
{
internal class SatelliteMapping
{
private static readonly Encoding utf16Encoding = new UnicodeEncoding(false, false);
private readonly byte[] data;
public int BaseOffset;
public SatelliteMapping(byte[] data, int offset)
{
this.data = data;
this.BaseOffset = offset;
}
public byte MagicMarker { get { return data[BaseOffset]; } }
public int SatelliteNr { get { return BitConverter.ToInt32(data, BaseOffset + 1); } }
public string Name { get { return utf16Encoding.GetString(data, BaseOffset + 9, 128); } }
public bool IsEast { get { return BitConverter.ToInt32(data, BaseOffset + 137) != 0; } }
public decimal Longitude { get { return (decimal)BitConverter.ToInt32(data, BaseOffset + 141) / 10; } }
}
}

View File

@@ -0,0 +1,156 @@
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.ScmFile
{
public class ScmChannelBase : ChannelInfo
{
// common
private const string _InUse = "InUse";
private const string _ProgramNr = "offProgramNr";
private const string _Name = "offName";
private const string _NameLength = "offNameLength";
private const string _ShortName = "offShortName";
private const string _Favorites = "offFavorites";
private const string _Deleted = "Deleted";
private const string _Encrypted = "Encrypted";
private const string _Lock = "Lock";
private const string _Checksum = "offChecksum";
// DVB
private const string _ServiceId = "offServiceId";
private const string _VideoPid = "offVideoPid";
private const string _AudioPid = "offAudioPid";
private const string _OriginalNetworkId = "offOriginalNetworkId";
private const string _TransportStreamId = "offTransportStreamId";
private const string _ServiceType = "offServiceType";
private const string _SymbolRate = "offSymbolRate";
private static readonly Encoding Utf16BigEndian = new UnicodeEncoding(true, false);
protected readonly DataMapping mapping;
protected readonly byte[] rawData;
internal readonly int baseOffset;
internal bool InUse { get; set; }
protected ScmChannelBase(DataMapping data)
{
this.mapping = data;
this.rawData = data.Data;
this.baseOffset = data.BaseOffset;
this.mapping.DefaultEncoding = Utf16BigEndian;
}
#region InitCommonData()
protected void InitCommonData(int slot, SignalSource signalSource, DataMapping data)
{
this.InUse = data.GetFlag(_InUse);
this.RecordIndex = slot;
this.RecordOrder = slot;
this.SignalSource = signalSource;
this.SignalType = SignalType.Mixed;
this.OldProgramNr = data.GetWord(_ProgramNr);
this.Name = data.GetString(_Name, data.Settings.GetInt("lenName"));
this.Favorites = this.ParseRawFavorites();
this.Lock = data.GetFlag(_Lock);
this.Encrypted = data.GetFlag(_Encrypted);
this.IsDeleted = data.GetFlag(_Deleted);
}
#endregion
#region ParseRawFavorites()
private Favorites ParseRawFavorites()
{
var offsets = mapping.GetOffsets(_Favorites);
if (offsets.Length == 1) // series B,C
return (Favorites) mapping.GetByte(_Favorites);
// series D,E
byte fav = 0;
byte mask = 0x01;
foreach (int off in offsets)
{
if ((System.BitConverter.ToInt32(this.rawData, baseOffset + off) + 1) > 1) // -1 and 0 mean "not set"
fav |= mask;
mask <<= 1;
}
return (Favorites) fav;
}
#endregion
#region InitDvbData()
protected void InitDvbData(DataMapping data)
{
this.ShortName = data.GetString(_ShortName, data.Settings.GetInt("lenShortName"));
this.ServiceId = data.GetWord(_ServiceId);
//this.PcrPid = data.GetWord(_PcrPid);
this.VideoPid = data.GetWord(_VideoPid);
this.AudioPid = data.GetWord(_AudioPid);
this.OriginalNetworkId = data.GetWord(_OriginalNetworkId);
this.TransportStreamId = data.GetWord(_TransportStreamId);
this.ServiceType = data.GetByte(_ServiceType);
this.SymbolRate = data.GetWord(_SymbolRate);
}
#endregion
#region GetSignalType()
protected SignalType GetSignalType(uint programNr)
{
if ((programNr & 0x4000) != 0)
return SignalType.Radio;
return SignalType.Tv;
}
#endregion
#region UpdateRawData()
public override void UpdateRawData()
{
mapping.SetDataPtr(this.rawData, this.baseOffset);
mapping.SetWord(_ProgramNr, this.NewProgramNr);
if (this.IsNameModified)
{
mapping.SetString(_Name, this.Name, mapping.Settings.GetInt("lenName"));
mapping.SetByte(_NameLength, this.Name.Length);
this.IsNameModified = false;
}
this.UpdateRawFavorites();
mapping.SetFlag(_Lock, this.Lock);
if (this.NewProgramNr == 0)
mapping.SetFlag(_Deleted, true);
this.UpdateChecksum();
}
#endregion
#region UpdateRawFavorites()
private void UpdateRawFavorites()
{
var offsets = mapping.GetOffsets(_Favorites);
if (offsets.Length == 1) // series B,C
mapping.SetByte(_Favorites, (byte)this.Favorites & 0x0F);
// series D,E
byte fav = (byte)this.Favorites;
byte mask = 0x01;
foreach (int off in offsets)
{
this.rawData[baseOffset + off] = (byte)((fav & mask) == 0 ? 0 : 1);
mask <<= 1;
}
}
#endregion
#region UpdateChecksum()
private void UpdateChecksum()
{
var offChecksum = this.mapping.GetOffsets(_Checksum)[0];
byte crc = 0;
for (int i = this.baseOffset; i < offChecksum; i++)
crc += this.rawData[i];
this.rawData[offChecksum] = crc;
}
#endregion
}
}

View File

@@ -1,23 +1,35 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using ChanSort.Api;
using ICSharpCode.SharpZipLib.Zip;
namespace ChanSort.Plugin.ScmFile
namespace ChanSort.Loader.ScmFile
{
class ScmSerializer : SerializerBase
{
public struct ChannelAndFreq
{
public int Channel;
public decimal Frequency;
public ChannelAndFreq(int ch, decimal freq)
{
this.Channel = ch;
this.Frequency = freq;
}
}
private readonly Dictionary<string, ModelConstants> modelConstants = new Dictionary<string, ModelConstants>();
private readonly MappingPool<AnalogChannelDataMapping> analogMappings = new MappingPool<AnalogChannelDataMapping>("Analog");
private readonly MappingPool<DvbCtChannelDataMapping> dvbctMappings = new MappingPool<DvbCtChannelDataMapping>("DVB-C/T");
private readonly MappingPool<DvbSChannelDataMapping> dvbsMappings = new MappingPool<DvbSChannelDataMapping>("DVB-S");
private readonly MappingPool<DvbSChannelDataMapping> hdplusMappings = new MappingPool<DvbSChannelDataMapping>("AstraHDPlus");
private readonly MappingPool<DataMapping> analogMappings = new MappingPool<DataMapping>("Analog");
private readonly MappingPool<DataMapping> dvbctMappings = new MappingPool<DataMapping>("DVB-C/T");
private readonly MappingPool<DataMapping> dvbsMappings = new MappingPool<DataMapping>("DVB-S");
private readonly MappingPool<DataMapping> hdplusMappings = new MappingPool<DataMapping>("AstraHDPlus");
private readonly MappingPool<DataMapping> analogFineTuneMappings = new MappingPool<DataMapping>("FineTune");
private readonly MappingPool<DataMapping> ptccableMappings = new MappingPool<DataMapping>("PTC");
private readonly MappingPool<DataMapping> transponderMappings = new MappingPool<DataMapping>("TransponderDataBase");
private readonly ChannelList avbtChannels = new ChannelList(SignalSource.AnalogT, SignalType.Mixed);
private readonly ChannelList avbcChannels = new ChannelList(SignalSource.AnalogC, SignalType.Mixed);
private readonly ChannelList dvbcChannels = new ChannelList(SignalSource.DvbC, SignalType.Mixed);
@@ -26,13 +38,14 @@ namespace ChanSort.Plugin.ScmFile
private readonly ChannelList hdplusChannels = new ChannelList(SignalSource.HdPlusD, SignalType.Mixed);
private readonly Dictionary<int, decimal> avbtFrequency = new Dictionary<int, decimal>();
private readonly Dictionary<int, decimal> avbcFrequency = new Dictionary<int, decimal>();
private readonly Dictionary<int, decimal> dvbcFrequency = new Dictionary<int, decimal>();
private readonly Dictionary<int, decimal> dvbtFrequency = new Dictionary<int, decimal>();
private byte[] avbtFileContent;
private byte[] avbcFileContent;
private byte[] dvbtFileContent;
private byte[] dvbcFileContent;
private byte[] dvbsFileContent;
private byte[] hdplusFileContent;
private UnsortedChannelMode unsortedChannelMode;
private ModelConstants c;
#region ctor()
@@ -61,15 +74,19 @@ namespace ChanSort.Plugin.ScmFile
if (section.Name.StartsWith("Series:"))
modelConstants.Add(section.Name, new ModelConstants(section));
else if (section.Name.StartsWith("Analog:"))
analogMappings.AddMapping(new AnalogChannelDataMapping(section, len));
analogMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("DvbCT:"))
dvbctMappings.AddMapping(new DvbCtChannelDataMapping(section, len));
dvbctMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("DvbS:"))
dvbsMappings.AddMapping(new DvbSChannelDataMapping(section, len));
dvbsMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("FineTune:"))
analogFineTuneMappings.AddMapping(new DataMapping(section, len, null));
analogFineTuneMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("AstraHDPlusD:"))
hdplusMappings.AddMapping(new DvbSChannelDataMapping(section, len));
hdplusMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("TransponderDataBase.dat:"))
transponderMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("PTC:"))
ptccableMappings.AddMapping(len, new DataMapping(section));
}
}
#endregion
@@ -85,8 +102,10 @@ namespace ChanSort.Plugin.ScmFile
ReadAnalogFineTuning(zip);
ReadAnalogChannels(zip, "map-AirA", this.avbtChannels, out this.avbtFileContent, this.avbtFrequency);
ReadAnalogChannels(zip, "map-CableA", this.avbcChannels, out this.avbcFileContent, this.avbcFrequency);
ReadDvbctChannels(zip, "map-AirD", this.dvbtChannels, out this.dvbtFileContent);
ReadDvbctChannels(zip, "map-CableD", this.dvbcChannels, out this.dvbcFileContent);
ReadDvbTransponderFrequenciesFromPtc(zip, "PTCAIR", this.dvbtFrequency);
ReadDvbctChannels(zip, "map-AirD", this.dvbtChannels, out this.dvbtFileContent, this.dvbtFrequency);
ReadDvbTransponderFrequenciesFromPtc(zip, "PTCCABLE", this.dvbcFrequency);
ReadDvbctChannels(zip, "map-CableD", this.dvbcChannels, out this.dvbcFileContent, this.dvbcFrequency);
ReadSatellites(zip);
ReadTransponder(zip, "TransponderDataBase.dat");
ReadTransponder(zip, "UserTransponderDataBase.dat");
@@ -250,7 +269,7 @@ namespace ChanSort.Plugin.ScmFile
#region ReadAnalogFineTuning()
private unsafe void ReadAnalogFineTuning(ZipFile zip)
private void ReadAnalogFineTuning(ZipFile zip)
{
int entrySize = c.avbtFineTuneLength;
if (entrySize == 0)
@@ -261,25 +280,22 @@ namespace ChanSort.Plugin.ScmFile
return;
var mapping = analogFineTuneMappings.GetMapping(c.avbtFineTuneLength);
fixed (byte* ptr = data)
mapping.SetDataPtr(data, 0);
int count = data.Length / c.avbtFineTuneLength;
for (int i = 0; i < count; i++)
{
mapping.DataPtr = ptr;
int count = data.Length / mapping.DataLength;
for (int i = 0; i < count; i++)
{
bool isCable = mapping.GetFlag("offIsCable", "maskIsCable"); // HACK: this is just a guess
int slot = mapping.GetWord("offSlotNr");
float freq = mapping.GetFloat("offFrequency");
var dict = isCable ? avbcFrequency : avbtFrequency;
dict[slot] = (decimal)freq;
mapping.Next();
}
bool isCable = mapping.GetFlag("offIsCable", "maskIsCable"); // HACK: this is just a guess
int slot = mapping.GetWord("offSlotNr");
float freq = mapping.GetFloat("offFrequency");
var dict = isCable ? avbcFrequency : avbtFrequency;
dict[slot] = (decimal)freq;
mapping.BaseOffset += c.avbtFineTuneLength;
}
}
#endregion
#region ReadAnalogChannels()
private unsafe void ReadAnalogChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data, Dictionary<int,decimal> freq)
private void ReadAnalogChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data, Dictionary<int,decimal> freq)
{
data = null;
int entrySize = c.avbtChannelLength;
@@ -291,48 +307,52 @@ namespace ChanSort.Plugin.ScmFile
return;
this.DataRoot.AddChannelList(list);
fixed (byte* ptr = data)
{
var rawChannel = analogMappings.GetMapping(entrySize);
rawChannel.DataPtr = ptr;
int count = data.Length / entrySize;
var rawChannel = analogMappings.GetMapping(entrySize);
rawChannel.SetDataPtr(data, 0);
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
MapAnalogChannel(rawChannel, slotIndex, list, freq);
rawChannel.DataPtr += entrySize;
}
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
MapAnalogChannel(rawChannel, slotIndex, list, freq.TryGet(slotIndex));
rawChannel.BaseOffset += entrySize;
}
}
#endregion
#region MapAnalogChannel()
private unsafe void MapAnalogChannel(AnalogChannelDataMapping rawChannel, int slotIndex, ChannelList list, Dictionary<int,decimal> freq)
private void MapAnalogChannel(DataMapping rawChannel, int slotIndex, ChannelList list, decimal freq)
{
if (!rawChannel.InUse)
AnalogChannel ci = new AnalogChannel(slotIndex, list.SignalSource, rawChannel, freq);
if (!ci.InUse)
return;
if (rawChannel.Checksum != CalcChecksum(rawChannel.DataPtr, c.avbtChannelLength))
this.DataRoot.Warnings.AppendFormat("{0}: Incorrect checksum for channel index {1}\r\n", list, slotIndex);
ChannelInfo ci = new ChannelInfo(list.SignalSource, list.SignalType, slotIndex, rawChannel.ProgramNr, rawChannel.Name);
ci.FreqInMhz = (decimal)Math.Round(rawChannel.Frequency, 2);
if (ci.FreqInMhz == 0)
ci.FreqInMhz = freq.TryGet(ci.RecordIndex);
if (ci.FreqInMhz == 0)
ci.FreqInMhz = slotIndex;
ci.Lock = rawChannel.Lock;
ci.Skip = rawChannel.Skip;
ci.Favorites = rawChannel.Favorites;
this.DataRoot.AddChannel(list, ci);
}
#endregion
#region ReadDvbTransponderFrequenciesFromPtc()
private void ReadDvbTransponderFrequenciesFromPtc(ZipFile zip, string file, IDictionary<int, decimal> table)
{
byte[] data = ReadFileContent(zip, file);
if (data == null)
return;
var mapping = ptccableMappings.GetMapping(c.ptcLength);
mapping.SetDataPtr(data, 0);
int count = data.Length / c.ptcLength;
for (int i = 0; i < count; i++)
{
int transp = mapping.GetWord("offChannelTransponder");
float freq = mapping.GetFloat("offFrequency");
table[transp] = (decimal)freq;
mapping.BaseOffset += c.ptcLength;
}
}
#endregion
#region ReadDvbctChannels()
private unsafe void ReadDvbctChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data)
private void ReadDvbctChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data, Dictionary<int, decimal> frequency)
{
data = null;
int entrySize = c.dvbtChannelLength;
@@ -344,204 +364,123 @@ namespace ChanSort.Plugin.ScmFile
return;
this.DataRoot.AddChannelList(list);
fixed (byte* ptr = data)
DataMapping rawChannel = dvbctMappings.GetMapping(entrySize);
rawChannel.SetDataPtr(data, 0);
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
DvbCtChannelDataMapping rawChannel = dvbctMappings.GetMapping(entrySize);
rawChannel.DataPtr = ptr;
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
MapDvbctChannel(rawChannel, slotIndex, list);
rawChannel.Next();
}
DigitalChannel ci = new DigitalChannel(slotIndex, list.SignalSource, rawChannel, frequency);
if (ci.OldProgramNr != 0)
this.DataRoot.AddChannel(list, ci);
rawChannel.BaseOffset += entrySize;
}
}
#endregion
#region MapDvbctChannel()
private unsafe void MapDvbctChannel(DvbCtChannelDataMapping rawChannel, int slotIndex, ChannelList list)
{
if (rawChannel.ProgramNr == 0)
return;
if (rawChannel.Checksum != CalcChecksum(rawChannel.DataPtr, rawChannel.DataLength))
this.DataRoot.Warnings.AppendFormat("{0}: Incorrect checksum for channel index {1}\r\n", list, slotIndex);
ChannelInfo ci = new ChannelInfo(list.SignalSource, list.SignalType, slotIndex, rawChannel.ProgramNr, rawChannel.Name);
ci.VideoPid = rawChannel.VideoPid;
ci.ServiceId = rawChannel.ServiceId;
ci.ServiceType = rawChannel.ServiceType;
ci.TransportStreamId = rawChannel.TransportStreamId;
ci.FreqInMhz = LookupData.Instance.GetDvbtTransponderFrequency(rawChannel.ChannelOrTransponder);
ci.OriginalNetworkId = rawChannel.OriginalNetworkId;
ci.Favorites = rawChannel.Favorites;
ci.Lock = rawChannel.Lock;
ci.ShortName = rawChannel.ShortName;
ci.SymbolRate = rawChannel.SymbolRate;
ci.Encrypted = rawChannel.Encrypted;
ci.ChannelOrTransponder = rawChannel.ChannelOrTransponder.ToString();
this.DataRoot.AddChannel(list, ci);
}
#endregion
#region ReadSatellites()
private unsafe void ReadSatellites(ZipFile zip)
private void ReadSatellites(ZipFile zip)
{
byte[] data = ReadFileContent(zip, "SatDataBase.dat");
if (data == null)
return;
var utf16Encoding = new UnicodeEncoding(false, false);
fixed (byte* ptr = data)
SatelliteMapping satMapping = new SatelliteMapping(data, 4);
int count = data.Length/this.c.dvbsSatelliteLength;
for (int i = 0; i < count; i++)
{
int count = data.Length/this.c.dvbsSatelliteLength;
for (int i = 0; i < count; i++)
{
SatDataBase* sat = (SatDataBase*)(ptr + 4 + i * this.c.dvbsSatelliteLength);
if (sat->Magic0x55 != 0x55)
throw new IOException("Unknown SatDataBase.dat format");
string name = utf16Encoding.GetString((byte*)sat->Name, 64*2);
string location = string.Format("{0}.{1}{2}", sat->LongitudeTimes10/10, sat->LongitudeTimes10%10, sat->IsWest != 0 ? "W" : "E");
if (satMapping.MagicMarker != 0x55)
throw new IOException("Unknown SatDataBase.dat format");
string location = string.Format("{0}{1}", satMapping.Longitude, satMapping.IsEast ? "E" : "W");
Satellite satellite = new Satellite(sat->SatelliteNr);
satellite.Name = name;
satellite.OrbitalPosition = location;
this.DataRoot.Satellites.Add(sat->SatelliteNr, satellite);
}
Satellite satellite = new Satellite(satMapping.SatelliteNr);
satellite.Name = satMapping.Name;
satellite.OrbitalPosition = location;
this.DataRoot.Satellites.Add(satMapping.SatelliteNr, satellite);
satMapping.BaseOffset += this.c.dvbsSatelliteLength;
}
}
#endregion
#region ReadTransponder()
private unsafe void ReadTransponder(ZipFile zip, string fileName)
private void ReadTransponder(ZipFile zip, string fileName)
{
byte[] data = ReadFileContent(zip, fileName);
if (data == null)
return;
fixed (byte* ptr = data)
int count = (data.Length-4)/c.dvbsTransponderLength;
var mapping = this.transponderMappings.GetMapping(c.dvbsTransponderLength);
for (int i=0; i<count; i++)
{
int count = data.Length/c.dvbsTransponderLength;
for (int i=0; i<count; i++)
mapping.SetDataPtr(data, 4 + i * c.dvbsTransponderLength);
if (mapping.GetByte("offMagicByte") == 0)
continue;
int transponderNr = (int)mapping.GetDword("offTransponderIndex");
if (transponderNr == 0)
continue;
int satelliteNr = (int)mapping.GetDword("offSatelliteIndex");
var sat = this.DataRoot.Satellites.TryGet(satelliteNr);
if (sat == null)
{
int baseOffset = 4 + i*c.dvbsTransponderLength;
TransponderDataBase* trans = (TransponderDataBase*) (ptr + baseOffset);
if (trans->Magic0x55 == 0)
continue;
if (trans->TransponderNr == 0)
continue;
var sat = this.DataRoot.Satellites.TryGet(trans->SatelliteNr);
if (sat == null)
{
DataRoot.Warnings.Append(string.Format("Transponder #{0} references invalid satellite #{1}",
trans->TransponderNr, trans->SatelliteNr));
continue;
}
Transponder transponder = new Transponder(trans->TransponderNr);
transponder.FrequencyInMhz = (uint) (trans->Frequency/1000);
transponder.Polarity = trans->IsVerticalPolarity == 1 ? 'V' : 'H';
transponder.SymbolRate = trans->SymbolRate/1000;
this.DataRoot.AddTransponder(sat, transponder);
DataRoot.Warnings.Append(string.Format("Transponder #{0} references invalid satellite #{1}",
transponderNr, satelliteNr));
continue;
}
Transponder transponder = new Transponder(transponderNr);
transponder.FrequencyInMhz = (uint)(mapping.GetDword("offFrequency")/1000);
transponder.SymbolRate = (int) (mapping.GetDword("offSymbolRate")/1000);
this.DataRoot.AddTransponder(sat, transponder);
}
}
#endregion
#region ReadDvbsChannels()
private unsafe void ReadDvbsChannels(ZipFile zip)
private void ReadDvbsChannels(ZipFile zip)
{
this.dvbsFileContent = ReadFileContent(zip, "map-SateD");
if (this.dvbsFileContent == null)
return;
this.DataRoot.AddChannelList(this.dvbsChannels);
fixed (byte* ptr = this.dvbsFileContent)
int entrySize = c.dvbsChannelLength;
int count = this.dvbsFileContent.Length/entrySize;
DataMapping mapping = dvbsMappings.GetMapping(entrySize);
mapping.SetDataPtr(dvbsFileContent, 0);
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
int entrySize = c.dvbsChannelLength;
int count = this.dvbsFileContent.Length/entrySize;
DvbSChannelDataMapping mapping = dvbsMappings.GetMapping(entrySize);
mapping.DataPtr = ptr;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
MapDvbsChannel(this.dvbsChannels, mapping, slotIndex);
mapping.Next();
}
SatChannel ci = new SatChannel(slotIndex, mapping, this.DataRoot);
if (ci.InUse)
this.DataRoot.AddChannel(this.dvbsChannels, ci);
mapping.BaseOffset += entrySize;
}
}
#endregion
#region MapDvbsChannel()
private void MapDvbsChannel(ChannelList channelList, DvbSChannelDataMapping rawChannel, int slotIndex)
{
if (!rawChannel.InUse)
return;
Transponder transponder = this.DataRoot.Transponder.TryGet(rawChannel.TransponderNr);
Satellite satellite = transponder == null ? null : transponder.Satellite;
string satPosition = satellite != null ? satellite.OrbitalPosition : "#" + rawChannel.SatelliteNr;
string satName = satellite != null ? satellite.Name : null;
ChannelInfo ci = new ChannelInfo(channelList.SignalSource, SignalType.Mixed, slotIndex, rawChannel.ProgramNr, rawChannel.Name);
ci.Satellite = satName;
ci.SatPosition = satPosition;
ci.VideoPid = rawChannel.VideoPid;
ci.ServiceId = rawChannel.ServiceId;
ci.ServiceType = rawChannel.ServiceType;
ci.TransportStreamId = rawChannel.TransportStreamId;
ci.OriginalNetworkId = rawChannel.OriginalNetworkId;
ci.Favorites = rawChannel.Favorites;
ci.Encrypted = rawChannel.Encrypted;
ci.Lock = rawChannel.Lock;
ci.ShortName = rawChannel.ShortName;
if (transponder != null)
{
ci.Transponder = transponder;
ci.FreqInMhz = transponder.FrequencyInMhz;
ci.ChannelOrTransponder = this.GetTransponderChannelNumber((ushort)transponder.FrequencyInMhz);
ci.SymbolRate = transponder.SymbolRate;
ci.Polarity = transponder.Polarity;
}
this.DataRoot.AddChannel(channelList, ci);
}
#endregion
#region GetTransponderChannelNumber()
private string GetTransponderChannelNumber(ushort frequency)
{
int nr = LookupData.Instance.GetTransponderNumber(frequency);
return nr <= 0 ? "" : nr.ToString("d3");
}
#endregion
#region ReadAstraHdPlusChannels()
private unsafe void ReadAstraHdPlusChannels(ZipFile zip)
private void ReadAstraHdPlusChannels(ZipFile zip)
{
this.hdplusFileContent = ReadFileContent(zip, "map-AstraHDPlusD");
if (hdplusFileContent == null || c.hdplusChannelLength == 0)
return;
this.DataRoot.AddChannelList(this.hdplusChannels);
fixed (byte* ptr = hdplusFileContent)
int entrySize = c.hdplusChannelLength;
int count = hdplusFileContent.Length / entrySize;
DataMapping mapping = hdplusMappings.GetMapping(entrySize);
mapping.SetDataPtr(hdplusFileContent, 0);
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
int entrySize = c.hdplusChannelLength;
int count = hdplusFileContent.Length / entrySize;
DvbSChannelDataMapping mapping = hdplusMappings.GetMapping(entrySize);
mapping.DataPtr = ptr;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
MapDvbsChannel(this.hdplusChannels, mapping, slotIndex);
mapping.Next();
}
SatChannel ci = new SatChannel(slotIndex, mapping, this.DataRoot);
if (ci.InUse)
this.hdplusChannels.AddChannel(ci);
mapping.BaseOffset += entrySize;
}
}
#endregion
@@ -562,13 +501,9 @@ namespace ChanSort.Plugin.ScmFile
}
#endregion
private unsafe delegate void UpdateFunc(ChannelInfo channelInfo, byte* fileContent);
#region Save()
public override unsafe void Save(string tvOutputFile, string csvOutputFile, UnsortedChannelMode unsortedMode)
public override void Save(string tvOutputFile, string csvOutputFile)
{
this.unsortedChannelMode = unsortedMode;
if (tvOutputFile != this.FileName)
{
File.Copy(this.FileName, tvOutputFile);
@@ -577,19 +512,19 @@ namespace ChanSort.Plugin.ScmFile
using (ZipFile zip = new ZipFile(tvOutputFile))
{
zip.BeginUpdate();
this.SaveChannels(zip, "map-AirA", this.avbtChannels, this.UpdateAnalogChannel, ref this.avbtFileContent);
this.SaveChannels(zip, "map-CableA", this.avbcChannels, this.UpdateAnalogChannel, ref this.avbcFileContent);
this.SaveChannels(zip, "map-AirD", this.dvbtChannels, this.UpdateDvbctChannel, ref this.dvbtFileContent);
this.SaveChannels(zip, "map-CableD", this.dvbcChannels, this.UpdateDvbctChannel, ref this.dvbcFileContent);
this.SaveChannels(zip, "map-SateD", this.dvbsChannels, this.UpdateDvbsChannel, ref this.dvbsFileContent);
this.SaveChannels(zip, "map-AstraHDPlusD", this.hdplusChannels, this.UpdateHdPlusChannel, ref this.hdplusFileContent);
this.SaveChannels(zip, "map-AirA", this.avbtChannels, ref this.avbtFileContent);
this.SaveChannels(zip, "map-CableA", this.avbcChannels, ref this.avbcFileContent);
this.SaveChannels(zip, "map-AirD", this.dvbtChannels, ref this.dvbtFileContent);
this.SaveChannels(zip, "map-CableD", this.dvbcChannels, ref this.dvbcFileContent);
this.SaveChannels(zip, "map-SateD", this.dvbsChannels, ref this.dvbsFileContent);
this.SaveChannels(zip, "map-AstraHDPlusD", this.hdplusChannels, ref this.hdplusFileContent);
zip.CommitUpdate();
}
}
#endregion
#region SaveChannels()
private unsafe void SaveChannels(ZipFile zip, string fileName, ChannelList channels, UpdateFunc updateChannel, ref byte[] fileContent)
private void SaveChannels(ZipFile zip, string fileName, ChannelList channels, ref byte[] fileContent)
{
if (fileContent == null)
return;
@@ -598,7 +533,7 @@ namespace ChanSort.Plugin.ScmFile
string tempFilePath = Path.GetTempFileName();
using (var stream = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
this.WriteChannels(channels, updateChannel, fileContent, stream);
this.WriteChannels(channels, fileContent, stream);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
int size = (int)new FileInfo(tempFilePath).Length;
@@ -611,122 +546,15 @@ namespace ChanSort.Plugin.ScmFile
#endregion
#region WriteChannels()
private unsafe void WriteChannels(ChannelList list, UpdateFunc updateChannel, byte[] fileContent, FileStream stream)
private void WriteChannels(ChannelList list, byte[] fileContent, FileStream stream)
{
fixed (byte* ptr = fileContent)
foreach (var channel in list.Channels)
{
int maxSlot = 0;
foreach (var channel in list.Channels.OrderBy(ChannelComparer))
{
if (channel.RecordIndex < 0) // channel only exists in reference list
continue;
int newProgNr;
if (channel.NewProgramNr == 0 && this.unsortedChannelMode == UnsortedChannelMode.Hide)
newProgNr = 0;
else
{
newProgNr = channel.NewProgramNr != 0 ? channel.NewProgramNr : ++maxSlot;
if (newProgNr > maxSlot)
maxSlot = channel.NewProgramNr;
}
var channels = new List<ChannelInfo>();
channels.Add(channel);
channels.AddRange(channel.Duplicates);
foreach (var channelInstance in channels)
{
channelInstance.OldProgramNr = newProgNr;
updateChannel(channelInstance, ptr);
}
}
stream.Write(fileContent, 0, fileContent.Length);
#if false
if (count == 0 || count%padToPageSize != 0)
{
byte[] padding = new byte[(padToPageSize - count%padToPageSize) * entrySize];
stream.Write(padding, 0, padding.Length);
}
#endif
channel.UpdateRawData();
channel.OldProgramNr = channel.NewProgramNr;
}
}
#endregion
#region UpdateAnalogChannel()
private unsafe void UpdateAnalogChannel(ChannelInfo channel, byte* ptr)
{
AnalogChannelDataMapping raw = analogMappings.GetMapping(c.avbtChannelLength);
int startOffset = channel.RecordIndex * raw.DataLength;
raw.DataPtr = ptr + startOffset;
raw.ProgramNr = (ushort)channel.OldProgramNr;
raw.Favorites = channel.Favorites;
raw.Lock = channel.Lock;
raw.Checksum = CalcChecksum(raw.DataPtr, raw.DataLength);
}
#endregion
#region UpdateDvbctChannel()
private unsafe void UpdateDvbctChannel(ChannelInfo channel, byte* ptr)
{
DvbCtChannelDataMapping raw = dvbctMappings.GetMapping(c.dvbtChannelLength);
int startOffset = channel.RecordIndex * raw.DataLength;
raw.DataPtr = ptr + startOffset;
raw.ProgramNr = (ushort)channel.OldProgramNr;
raw.Favorites = channel.Favorites;
raw.Lock = channel.Lock;
raw.Checksum = CalcChecksum(raw.DataPtr, raw.DataLength);
}
#endregion
#region UpdateDvbsChannel()
private unsafe void UpdateDvbsChannel(ChannelInfo channel, byte* ptr)
{
DvbSChannelDataMapping raw = dvbsMappings.GetMapping(c.dvbsChannelLength);
int startOffset = channel.RecordIndex*raw.DataLength;
raw.DataPtr = (ptr + startOffset);
raw.ProgramNr = (ushort)channel.OldProgramNr;
raw.Favorites = channel.Favorites;
raw.Lock = channel.Lock;
raw.Checksum = CalcChecksum(raw.DataPtr, raw.DataLength);
}
#endregion
#region UpdateHdPlusChannel()
private unsafe void UpdateHdPlusChannel(ChannelInfo channel, byte* ptr)
{
DvbSChannelDataMapping raw = hdplusMappings.GetMapping(c.hdplusChannelLength);
int startOffset = channel.RecordIndex * raw.DataLength;
raw.DataPtr = (ptr + startOffset);
raw.ProgramNr = (ushort)channel.OldProgramNr;
raw.Favorites = channel.Favorites;
raw.Lock = channel.Lock;
raw.Checksum = CalcChecksum(raw.DataPtr, raw.DataLength);
}
#endregion
#region CalcChecksum()
private static unsafe byte CalcChecksum(byte* ptr, int length)
{
byte checksum = 0;
for (int i = 1; i < length; i++)
checksum += *ptr++;
return checksum;
}
#endregion
#region ChannelComparer()
private string ChannelComparer(ChannelInfo channel)
{
if (channel.NewProgramNr != 0)
return "A" + channel.NewProgramNr.ToString("d4");
if (channel.OldProgramNr != 0)
{
if (this.unsortedChannelMode == UnsortedChannelMode.AppendInOrder)
return "B" + channel.OldProgramNr.ToString("d4");
return "B" + channel.Name;
}
return "Z";
stream.Write(fileContent, 0, fileContent.Length);
}
#endregion

View File

@@ -1,6 +1,6 @@
using ChanSort.Api;
namespace ChanSort.Plugin.ScmFile
namespace ChanSort.Loader.ScmFile
{
public class ScmSerializerPlugin : ISerializerPlugin
{

View File

@@ -1,97 +0,0 @@
using System.Runtime.InteropServices;
namespace ChanSort.Plugin.ScmFile
{
[StructLayout(LayoutKind.Sequential, Pack=1)]
unsafe struct SatDataBase
{
public byte Magic0x55;
public int SatelliteNr;
public int TransponderCount;
public fixed ushort Name[64];
public int IsWest;
public int LongitudeTimes10;
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TransponderDataBase
{
public byte Magic0x55;
public int TransponderNr;
public int SatelliteNr;
public int Frequency;
public int SymbolRate;
public int IsVerticalPolarity;
public int Modulation;
public int CodeRate;
public int Unknown1;
public int Unknown2;
public int Unknown3;
public int Unknown4;
};
#if false
[StructLayout(LayoutKind.Sequential, Pack=1)]
unsafe struct MapSateD
{
public ushort ChannelNumber;
public ushort VideoPid;
public ushort Pid;
public byte Mpeg4;
public byte Unknown8;
public ushort Unknown9;
public ushort Unknonw11;
public ushort Unknown13;
public byte ServiceType;
public byte Unknown16;
public ushort ServiceId;
public ushort TransponderNr;
public ushort SatelliteNr;
public ushort Unknown23;
public ushort TransportStreamId;
public ushort Unknown27;
public ushort OriginalNetworkId;
public ushort Unknown31;
public ushort HRes;
public ushort VRes;
public fixed ushort NameInBigEndianUtf16[51];
public ushort Bouquet;
public byte Unknown141;
public byte Locked;
public byte Favorites;
public byte ChecksumCSeries;
public fixed byte Padding [28];
}
#endif
#if false
[StructLayout(LayoutKind.Sequential, Pack = 1)]
unsafe struct MapAirD
{
public ushort ChannelNumber;
public ushort VideoPid;
public ushort PcrPid;
public ushort ServiceId;
public ushort Status;
public ushort Unknown11;
public ushort Qam;
public byte ServiceType;
public byte Codec;
public fixed byte Unknown17 [7];
public byte Encrypted;
public fixed byte Unknown25 [3];
public ushort Frequency;
public ushort LogicalChannelNumber;
public fixed byte Unknown31 [2];
public ushort SymbolRate;
public ushort Bouquet;
public ushort TransportStreamId;
public fixed byte Unknown39 [5];
public fixed ushort NameInBigEndianUtf16[100];
public byte Unknown244;
public ushort Locked;
public byte FavoritesX79;
public byte ChecksumBSeries;
public fixed byte PaddingCSeries [292 - 248];
}
#endif
}

View File

@@ -1,219 +0,0 @@
using System.Collections.Generic;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
#region class ActChannelDataMapping
/// <summary>
/// Mapping for Analog, Cable and Terrestrial
/// </summary>
public unsafe class ActChannelDataMapping : DvbChannelMappingBase
{
private readonly DvbStringDecoder dvbsStringDecoder;
private const string offFrequencyLong = "offFrequencyLong";
private const string offFavorites2 = "offFavorites2";
private const string offProgramNr2 = "offProgramNr2";
#region ctor()
public ActChannelDataMapping(IniFile.Section settings, int length, DvbStringDecoder dvbsStringDecoder) : base(settings, length, null)
{
this.dvbsStringDecoder = dvbsStringDecoder;
this.ReorderChannelData = settings.GetInt("reorderChannelData") != 0;
}
#endregion
#region Encoding
public Encoding Encoding
{
get { return this.dvbsStringDecoder.DefaultEncoding; }
set { this.dvbsStringDecoder.DefaultEncoding = value; }
}
#endregion
public bool ReorderChannelData { get; private set; }
#region Favorites
public override Favorites Favorites
{
get { return (Favorites)(this.GetByte(offFavorites) & 0x0F); }
set
{
int intValue = (int)value;
foreach (int off in this.GetOffsets(offFavorites))
this.DataPtr[off] = (byte) ((this.DataPtr[off] & 0xF0) | intValue);
intValue <<= 2;
foreach (int off in this.GetOffsets(offFavorites2))
this.DataPtr[off] = (byte)((this.DataPtr[off] & 0xC3) | intValue);
}
}
#endregion
#region ProgramNr
public override ushort ProgramNr
{
get { return base.ProgramNr; }
set
{
base.ProgramNr = value;
this.SetWord(offProgramNr2, (ushort)((value<<2) | (GetWord(offProgramNr2) & 0x03)));
}
}
#endregion
#region Name
public override string Name
{
get
{
string longName, shortName;
this.dvbsStringDecoder.GetChannelNames(this.NamePtr, this.NameLength, out longName, out shortName);
return longName;
}
set { ChannelDataMapping.SetChannelName(this, value, this.dvbsStringDecoder.DefaultEncoding); }
}
#endregion
#region ShortName
public override string ShortName
{
get
{
string longName, shortName;
this.dvbsStringDecoder.GetChannelNames(this.NamePtr, this.NameLength, out longName, out shortName);
return shortName;
}
}
#endregion
#region FrequencyLong
public virtual uint FrequencyLong
{
get { return this.GetDword(offFrequencyLong); }
set { this.SetDword(offFrequencyLong, value); }
}
#endregion
#region AnalogFrequency, AnalogChannelNr, AnalogChannelBand
public ushort AnalogFrequency
{
get { return this.PcrPid; }
set { this.PcrPid = value; }
}
public byte AnalogChannelNr
{
get { return (byte)(this.VideoPid & 0xFF); }
}
public byte AnalogChannelBand
{
get { return (byte)(this.VideoPid >> 8); }
}
#endregion
#region Validate()
public string Validate()
{
bool ok = true;
List<string> warnings = new List<string>();
ok &= ValidateByte(offChannelTransponder) || AddWarning(warnings, "Channel/Transponder number");
ok &= ValidateWord(offProgramNr) || AddWarning(warnings, "Program#");
ok &= ValidateByte(offFavorites) || AddWarning(warnings, "Favorites");
ok &= ValidateWord(offPcrPid) || AddWarning(warnings, "PCR-PID");
ok &= ValidateWord(offAudioPid) || AddWarning(warnings, "Audio-PID");
ok &= ValidateWord(offVideoPid) || AddWarning(warnings, "Video-PID");
ok &= ValidateString(offName, 40) || AddWarning(warnings, "Channel name");
ok &= ValidateByte(offNameLength) || AddWarning(warnings, "Channel name length");
ok &= ValidateWord(offServiceId) || AddWarning(warnings, "Service-ID");
ok &= ValidateString(offFrequencyLong, 4) || AddWarning(warnings, "Frequency");
ok &= ValidateWord(offOriginalNetworkId) || AddWarning(warnings, "Original Network-ID");
ok &= ValidateWord(offTransportStreamId) || AddWarning(warnings, "Transport Stream ID");
ok &= ValidateByte(offFavorites2) || AddWarning(warnings, "Favorites #2");
ok &= ValidateByte(offServiceType) || AddWarning(warnings, "Service Type");
if (ok)
return null;
StringBuilder sb = new StringBuilder();
foreach (var warning in warnings)
{
if (sb.Length > 0)
sb.Append(", ");
sb.Append(warning);
}
return sb.ToString();
}
#endregion
#region AddWarning()
private bool AddWarning(List<string> warnings, string p)
{
warnings.Add(p);
return false;
}
#endregion
#region ValidateByte()
private bool ValidateByte(string key)
{
var offsets = this.GetOffsets(key);
if (offsets == null || offsets.Length < 1)
return true;
byte value = *(this.DataPtr + offsets[0]);
bool ok = true;
foreach(int offset in offsets)
{
if (this.DataPtr[offset] != value)
ok = false;
}
return ok;
}
#endregion
#region ValidateWord()
private bool ValidateWord(string key)
{
var offsets = this.GetOffsets(key);
if (offsets == null || offsets.Length < 1)
return true;
ushort value = *(ushort*)(this.DataPtr + offsets[0]);
bool ok = true;
foreach (int offset in offsets)
{
if (*(ushort*) (this.DataPtr + offset) != value)
ok = false;
}
return ok;
}
#endregion
#region ValidateString()
private bool ValidateString(string key, int len)
{
var offsets = this.GetOffsets(key);
if (offsets == null || offsets.Length < 1)
return true;
bool ok = true;
int off0 = offsets[0];
for (int i = 1; i < offsets.Length; i++)
{
int offI = offsets[i];
for (int j = 0; j < len; j++)
{
byte b = this.DataPtr[off0 + j];
if (this.DataPtr[offI + j] != b)
ok = false;
if (b == 0)
break;
}
}
return ok;
}
#endregion
}
#endregion
}

View File

@@ -0,0 +1,19 @@
using ChanSort.Api;
namespace ChanSort.Loader.TllFile
{
public class AnalogChannel : TllChannelBase
{
private const string _Freqency = "offPcrPid";
private const string _FreqBand = "offVideoPid";
public AnalogChannel(int slot, DataMapping data) : base(data)
{
this.InitCommonData(slot, SignalSource.AnalogCT, data);
this.FreqInMhz = (decimal)data.GetWord(_Freqency) / 20;
int channelAndBand = data.GetWord(_FreqBand);
this.ChannelOrTransponder = ((channelAndBand>>8) == 0 ? "E" : "S") + (channelAndBand&0xFF).ToString("d2");
}
}
}

View File

@@ -8,8 +8,8 @@
<ProjectGuid>{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Plugin.TllFile</RootNamespace>
<AssemblyName>ChanSort.Plugin.TllFile</AssemblyName>
<RootNamespace>ChanSort.Loader.TllFile</RootNamespace>
<AssemblyName>ChanSort.Loader.TllFile</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
@@ -36,7 +36,7 @@
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -68,11 +68,10 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ActChannelDataMapping.cs" />
<Compile Include="ChannelDataMapping.cs" />
<Compile Include="DvbsChannelDataMapping.cs" />
<Compile Include="FirmwareDataMapping.cs" />
<Compile Include="ModelConstants.cs" />
<Compile Include="AnalogChannel.cs" />
<Compile Include="DtvChannel.cs" />
<Compile Include="DvbsDataLayout.cs" />
<Compile Include="FirmwareData.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.de.Designer.cs">
<AutoGen>True</AutoGen>
@@ -84,10 +83,13 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="SatChannel.cs" />
<Compile Include="SatChannelListHeader.cs" />
<Compile Include="SatTransponder.cs" />
<Compile Include="TllChannelBase.cs" />
<Compile Include="TllFileSerializer.cs" />
<Compile Include="TllFileSerializer.sql.cs" />
<Compile Include="TllFileSerializerPlugin.cs" />
<Compile Include="TllStructures.cs" />
<Compile Include="TvSettingsForm.cs">
<SubType>Form</SubType>
</Compile>

View File

@@ -1,35 +1,6 @@
; FileConfigurationX: overall file and DVB-S data layout
; ACTChannelDataMappingX: analog, DVB-C and DVB-T channel data mapping for data length X
[FileConfiguration1]
; LM and PM series except LM611S and LM340S
magicBytes = 90, 90, 90, 90
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 72
lnbCount = 40
lnbLength = 44
[FileConfiguration2]
; LV and LW series (some LW don't have DVB-S though), some LM models
magicBytes = 90, 90, 90, 90
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 68
lnbCount = 40
lnbLength = 44
[FileConfiguration3]
; DM and LH series
magicBytes =
satCount = 0
[ACTChannelDataMapping:192]
; LM series with Firmware 4.x (all except LM611S and LM340S)
@@ -48,6 +19,8 @@
offOriginalNetworkId = 102
offTransportStreamId = 104
offFavorites2 = 134
offDeleted = 134
maskDeleted = 0x42
offLock = 135
maskLock = 0x01
offSkip = 135
@@ -74,6 +47,8 @@
offOriginalNetworkId = 102
offTransportStreamId = 104
offFavorites2 = 134
offDeleted = 134
maskDeleted = 0x42
offLock = 135
maskLock = 0x01
offSkip = 135
@@ -101,6 +76,8 @@
offOriginalNetworkId = 98
offTransportStreamId = 100
offFavorites2 = 130
offDeleted = 130
maskDeleted = 0x42
offLock = 131
maskLock = 0x01
offSkip = 131
@@ -128,6 +105,8 @@
offTransportStreamId = 100
offProgramNr2 = 120
offFavorites2 = 126
offDeleted = 126
maskDeleted = 0x42
offLock = 127
maskLock = 0x01
offSkip = 127
@@ -155,6 +134,8 @@
offTransportStreamId = 96
offProgramNr2 = 116
offFavorites2 = 122
offDeleted = 122
maskDeleted = 0x42
offLock = 123
maskLock = 0x01
offSkip = 123
@@ -182,6 +163,8 @@
offFrequencyLong = 96
offProgramNr2 = 108
offFavorites2 = 113
offDeleted = 113
maskDeleted = 0x42
offLock = 113
maskLock =
offSkip = 113
@@ -191,6 +174,28 @@
offServiceType = 115
offAudioPid2 = 158
[DvbsBlock:687880]
; everything before LM series (but including LM611S and LM340S)
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 68
lnbCount = 40
lnbLength = 44
[DvbsBlock:717960]
; LM and PM series except LM611S and LM340S
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 72
lnbCount = 40
lnbLength = 44
[SatChannelDataMapping:68]
lenName = 40
offSatelliteNr = 0
@@ -198,8 +203,7 @@
offTransponderIndex = 5, 12
offProgramNr = 8
offProgramNrPreset = 10
offFavorites = 14
maskFavorites = 0x3C
offFavorites2 = 14
offDeleted = 14
maskDeleted = 0x42
offEncrypted = 14
@@ -226,8 +230,7 @@
offTransponderIndex = 6, 12
offProgramNr = 8
offProgramNrPreset = 10
offFavorites = 14
maskFavorites = 0x3C
offFavorites2 = 14
offDeleted = 14
maskDeleted = 0x42
offEncrypted = 14

View File

@@ -1,23 +0,0 @@
using System;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
internal static class ChannelDataMapping
{
public static unsafe void SetChannelName(ChannelMappingBase mapping, string channelName, Encoding defaultEncoding)
{
byte[] codePagePrefix = new byte[0]; // DvbStringDecoder.GetCodepageBytes(defaultEncoding);
byte[] name = defaultEncoding.GetBytes(channelName);
byte[] newName = new byte[codePagePrefix.Length + name.Length + 1];
Array.Copy(codePagePrefix, 0, newName, 0, codePagePrefix.Length);
Array.Copy(name, 0, newName, codePagePrefix.Length, name.Length);
fixed (byte* ptrNewName = newName)
{
mapping.NamePtr = ptrNewName;
}
mapping.NameLength = newName.Length;
}
}
}

View File

@@ -0,0 +1,24 @@
using ChanSort.Api;
namespace ChanSort.Loader.TllFile
{
public class DtvChannel : TllChannelBase
{
private const string _ChannelOrTransponder = "offChannelTransponder";
private const string _FrequencyLong = "offFrequencyLong";
/*
offFavorites2 = 134
offAudioPid2 = 182
*/
public DtvChannel(int slot, DataMapping data) : base(data)
{
this.InitCommonData(slot, SignalSource.DvbCT, data);
this.InitDvbData(data);
this.ChannelOrTransponder = data.GetByte(_ChannelOrTransponder).ToString("d2");
this.FreqInMhz = (decimal)data.GetDword(_FrequencyLong) / 1000;
}
}
}

View File

@@ -1,197 +0,0 @@
using System.Collections.Generic;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
public unsafe class DvbsChannelDataMapping : DvbChannelMappingBase
{
private const string offSatelliteNr = "offSatelliteNr";
private const string offTransponderIndex = "offTransponderIndex";
private const string offProgramNrPreset = "offProgramNrPreset";
private const string offProgNrCustomized = "offProgNrCustomized";
private const string maskProgNrCustomized = "maskProgNrCustomized";
private readonly DvbStringDecoder dvbsStringDecoder;
public DvbsChannelDataMapping(IniFile.Section settings, int dataLength, DvbStringDecoder dvbsStringDecoder) :
base(settings, dataLength, null)
{
this.dvbsStringDecoder = dvbsStringDecoder;
}
#region Encoding
public Encoding Encoding
{
get { return this.dvbsStringDecoder.DefaultEncoding; }
set { this.dvbsStringDecoder.DefaultEncoding = value; }
}
#endregion
#region InUse
public override bool InUse
{
get { return this.SatelliteNr != 0xFFFF; }
}
#endregion
#region IsDeleted
public override bool IsDeleted
{
get { return base.IsDeleted; }
set
{
base.IsDeleted = value;
if (value)
this.SatelliteNr = 0xFFFF;
}
}
#endregion
#region SatelliteNr
public int SatelliteNr
{
get { return this.GetWord(offSatelliteNr); }
set { this.SetWord(offSatelliteNr, value); }
}
#endregion
#region ProgramNr
public override ushort ProgramNr
{
get { return base.ProgramNr; }
set
{
base.ProgramNr = value;
this.IsProgNrCustomized = true;
}
}
#endregion
#region ProgramNrPreset
public int ProgramNrPreset
{
get { return this.GetWord(offProgramNrPreset); }
set { this.SetWord(offProgramNrPreset, (ushort)value); }
}
#endregion
#region IsProgNrCustomized
public bool IsProgNrCustomized
{
get { return GetFlag(offProgNrCustomized, maskProgNrCustomized); }
set { SetFlag(offProgNrCustomized, maskProgNrCustomized, value); }
}
#endregion
#region Name
public override string Name
{
get
{
string longName, shortName;
this.dvbsStringDecoder.GetChannelNames(this.NamePtr, this.NameLength, out longName, out shortName);
return longName;
}
set { ChannelDataMapping.SetChannelName(this, value, this.dvbsStringDecoder.DefaultEncoding); }
}
#endregion
#region ShortName
public override string ShortName
{
get
{
string longName, shortName;
this.dvbsStringDecoder.GetChannelNames(this.NamePtr, this.NameLength, out longName, out shortName);
return shortName;
}
}
#endregion
#region Favorites
public override Favorites Favorites
{
get { return (Favorites)((GetByte(offFavorites)>>2) & 0x0F); }
set
{
var newVal = (GetByte(offFavorites) & 0xC3) | (byte)((byte)value << 2);
SetByte(offFavorites, (byte)newVal);
}
}
#endregion
#region TransponderIndex
public ushort TransponderIndex
{
get { return GetWord(offTransponderIndex); }
set { SetWord(offTransponderIndex, value); }
}
#endregion
#region Validate()
public string Validate()
{
bool ok = true;
List<string> warnings = new List<string>();
ok &= ValidateByte(offTransponderIndex) || AddWarning(warnings, "Transponder index");
ok &= ValidateWord(offProgramNr) || AddWarning(warnings, "Program#");
if (ok)
return null;
StringBuilder sb = new StringBuilder();
foreach (var warning in warnings)
{
if (sb.Length > 0)
sb.Append(", ");
sb.Append(warning);
}
return sb.ToString();
}
#endregion
#region AddWarning()
private bool AddWarning(List<string> warnings, string p)
{
warnings.Add(p);
return false;
}
#endregion
#region ValidateByte()
private bool ValidateByte(string key)
{
var offsets = this.GetOffsets(key);
if (offsets == null || offsets.Length < 1)
return true;
byte value = *(this.DataPtr + offsets[0]);
bool ok = true;
foreach (int offset in offsets)
{
if (this.DataPtr[offset] != value)
ok = false;
}
return ok;
}
#endregion
#region ValidateWord()
private bool ValidateWord(string key)
{
var offsets = this.GetOffsets(key);
if (offsets == null || offsets.Length < 1)
return true;
ushort value = *(ushort*)(this.DataPtr + offsets[0]);
bool ok = true;
foreach (int offset in offsets)
{
if (*(ushort*)(this.DataPtr + offset) != value)
ok = false;
}
return ok;
}
#endregion
}
}

View File

@@ -0,0 +1,65 @@
namespace ChanSort.Loader.TllFile
{
public class DvbsDataLayout
{
public readonly int satCount;
public readonly int satLength;
public readonly int sizeOfTransponderBlockHeader;
public readonly int transponderCount;
public readonly int transponderLength;
public readonly int sizeOfChannelLinkedListEntry = 8;
public readonly int dvbsMaxChannelCount;
public readonly int dvbsChannelLength;
public readonly int lnbCount;
public readonly int lnbLength;
public readonly int[] dvbsSubblockLength;
public int LnbBlockHeaderSize = 12;
public DvbsDataLayout(Api.IniFile.Section iniSection)
{
this.satCount = iniSection.GetInt("satCount");
this.satLength = iniSection.GetInt("satLength");
this.transponderCount = iniSection.GetInt("transponderCount");
this.transponderLength = iniSection.GetInt("transponderLength");
this.sizeOfTransponderBlockHeader = 14 + transponderCount/8 + transponderCount*6 + 2;
this.dvbsMaxChannelCount = iniSection.GetInt("dvbsChannelCount");
this.dvbsChannelLength = iniSection.GetInt("dvbsChannelLength");
this.lnbCount = iniSection.GetInt("lnbCount");
this.lnbLength = iniSection.GetInt("lnbLength");
this.dvbsSubblockLength = new[]
{
12, // header
14 + 2 + this.satCount + this.satCount*this.satLength, // satellites
sizeOfTransponderBlockHeader - 4 + transponderCount * transponderLength, // transponder
12 + dvbsMaxChannelCount/8 + dvbsMaxChannelCount*sizeOfChannelLinkedListEntry + dvbsMaxChannelCount * dvbsChannelLength, // channels
LnbBlockHeaderSize - 4 + lnbCount * lnbLength // sat/LNB-Config
};
}
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int ChannelListHeaderOffset
{
get { return 4 + this.dvbsSubblockLength[0] + this.dvbsSubblockLength[1] + this.dvbsSubblockLength[2]; }
}
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int SequenceTableOffset
{
get { return ChannelListHeaderOffset + 12 + dvbsMaxChannelCount/8; }
}
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int ChannelListOffset
{
get { return SequenceTableOffset + dvbsMaxChannelCount*sizeOfChannelLinkedListEntry; }
}
}
}

View File

@@ -0,0 +1,60 @@
using ChanSort.Api;
namespace ChanSort.Loader.TllFile
{
public class FirmwareData : DataMapping
{
private const string offSize = "offSize";
private const string offSystemLock = "offSystemLock";
private const string offTvPassword = "offTvPassword";
private const string offHbbTvEnabled = "offHbbTvEnabled";
private const string offHotelModeEnabled = "offHotelModeEnabled";
private const string offHotelModeDtvUpdate = "offHotelModeDtvUpdate";
private const string offSettingsChannelUpdate = "offSettingsChannelUpdate";
public FirmwareData(IniFile.Section settings) :
base(settings)
{
}
public long Size { get { return this.GetDword(offSize); } }
public bool SystemLocked { get { return this.GetByte(offSystemLock) != 0; } }
public string TvPassword { get { return CodeToString((uint)this.GetDword(offTvPassword)); } }
public bool SettingsAutomaticChannelUpdate
{
get { return this.GetByte(offSettingsChannelUpdate) != 0; }
set { this.SetByte(offSettingsChannelUpdate, (byte) (value ? 1 : 0)); }
}
public bool HbbTvEnabled
{
get { return this.GetByte(offHbbTvEnabled) != 0; }
set { this.SetByte(offHbbTvEnabled, (byte)(value ? 1 : 0)); }
}
public bool HotelModeEnabled
{
get { return this.GetByte(offHotelModeEnabled) != 0; }
set { this.SetByte(offHotelModeEnabled, (byte) (value ? 1 : 0)); }
}
public bool HotelModeDtvUpdate
{
get { return this.GetByte(offHotelModeDtvUpdate) != 0; }
set { this.SetByte(offHotelModeDtvUpdate, (byte)(value ? 1 : 0)); }
}
private string CodeToString(uint val)
{
var code = "";
for (int i = 0; i < 4; i++)
{
code += (char)(33 + (val & 0x0f));
val >>= 8;
}
return code;
}
}
}

View File

@@ -2,16 +2,16 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Test.Plugin.TllFile")]
[assembly: InternalsVisibleTo("Test.Loader.TllFile")]
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ChanSort.Plugin.TllFile")]
[assembly: AssemblyTitle("ChanSort.Loader.TllFile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Plugin.TllFile")]
[assembly: AssemblyProduct("ChanSort.Loader.TllFile")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChanSort.Plugin.TllFile {
namespace ChanSort.Loader.TllFile {
using System;
@@ -39,7 +39,7 @@ namespace ChanSort.Plugin.TllFile {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChanSort.Plugin.TllFile.Resource", typeof(Resource).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChanSort.Loader.TllFile.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -60,15 +60,6 @@ namespace ChanSort.Plugin.TllFile {
}
}
/// <summary>
/// Looks up a localized string similar to File format is not supported: bad header.
/// </summary>
internal static string TllFileSerializer_ERR_badFileHeader {
get {
return ResourceManager.GetString("TllFileSerializer_ERR_badFileHeader", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Channel #{0} (Pr# {1}) was erased because it is a duplicate of channel #{2} (Pr# {3}): {4}.
/// </summary>

View File

@@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TllFileSerializer_ERR_badFileHeader" xml:space="preserve">
<value>Ungültiges Dateiformat: Dateikopf unbekannt</value>
</data>
<data name="TllFileSerializer_ERR_wrongChecksum" xml:space="preserve">
<value>Prüfsummenfehler: berechnet wurde {1:x8} aber Datei enthält {0:x8}</value>
</data>

View File

@@ -98,9 +98,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TllFileSerializer_ERR_badFileHeader" xml:space="preserve">
<value>File format is not supported: bad header</value>
</data>
<data name="TllFileSerializer_ERR_wrongChecksum" xml:space="preserve">
<value>Wrong checksum: calculated {1:x8} but file has {0:x8}</value>
</data>

View File

@@ -0,0 +1,44 @@
using ChanSort.Api;
namespace ChanSort.Loader.TllFile
{
class SatChannel : TllChannelBase
{
private const string _SatConfigIndex = "offSatelliteNr";
private const string _TransponderIndex = "offTransponderIndex";
public bool InUse { get; private set; }
public SatChannel(int order, int slot, DataMapping data, DataRoot dataRoot) : base(data)
{
this.InUse = data.GetWord(_SatConfigIndex) != 0xFFFF;
if (!InUse)
return;
this.InitCommonData(slot, SignalSource.DvbS, data);
this.InitDvbData(data);
int transponderIndex = data.GetWord(_TransponderIndex);
Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex);
Satellite sat = transponder.Satellite;
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
this.RecordOrder = order;
this.TransportStreamId = transponder.TransportStreamId;
this.OriginalNetworkId = transponder.OriginalNetworkId;
this.SymbolRate = transponder.SymbolRate;
this.Polarity = transponder.Polarity;
this.FreqInMhz = transponder.FrequencyInMhz;
}
public override void UpdateRawData()
{
base.UpdateRawData();
// bool deleted = this.NewProgramNr == 0;
// if (deleted)
// mapping.SetWord(_SatConfigIndex, 0xFFFF);
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace ChanSort.Loader.TllFile
{
internal class SatChannelListHeader
{
private readonly byte[] data;
private readonly int baseOffset;
public SatChannelListHeader(byte[] data, int offset) { this.data = data; this.baseOffset = offset; }
public uint Checksum { get { return BitConverter.ToUInt32(data, baseOffset + 0); } }
public int LinkedListStartIndex { get { return BitConverter.ToInt16(data, baseOffset + 8); }}
public int LinkedListEndIndex1 { get { return BitConverter.ToInt16(data, baseOffset + 10); } }
public int LinkedListEndIndex2 { get { return BitConverter.ToInt16(data, baseOffset + 12); } }
public int ChannelCount { get { return BitConverter.ToInt16(data, baseOffset + 14); } }
public int Size { get { return 16; } }
}
}

View File

@@ -0,0 +1,31 @@
using System;
namespace ChanSort.Loader.TllFile
{
internal class SatTransponder
{
private readonly byte[] data;
public int BaseOffset { get; set; }
public SatTransponder(byte[] data)
{
this.data = data;
}
public int Frequency { get { return BitConverter.ToInt16(data, BaseOffset + 12); } }
public int OriginalNetworkId { get { return BitConverter.ToInt16(data, BaseOffset + 18); } }
public int TransportStreamId { get { return BitConverter.ToInt16(data, BaseOffset + 20); } }
public int SymbolRate
{
get { return BitConverter.ToInt16(data, BaseOffset + 25); }
set
{
data[BaseOffset + 25] = (byte)value;
data[BaseOffset + 26] = (byte)(value >> 8);
}
}
public int SatIndex { get { return data[BaseOffset + 36]; } }
}
}

View File

@@ -0,0 +1,132 @@
using ChanSort.Api;
namespace ChanSort.Loader.TllFile
{
public class TllChannelBase : ChannelInfo
{
// common
private const string _ProgramNr = "offProgramNr";
private const string _ProgramNr2 = "offProgramNr2"; // not for DVB-S
private const string _Name = "offName";
private const string _NameLength = "offNameLength";
private const string _Favorites = "offFavorites"; // not for DVB-S (which only uses Favorite2)
private const string _Deleted = "Deleted";
private const string _Favorites2 = "offFavorites2";
private const string _Encrypted = "Encrypted";
private const string _Lock = "Lock";
private const string _Skip = "Skip";
private const string _Hide = "Hide";
private const string _Moved = "ProgNrCustomized";
// DVB
private const string _ServiceId = "offServiceId";
private const string _VideoPid = "offVideoPid";
private const string _AudioPid = "offAudioPid";
private const string _OriginalNetworkId = "offOriginalNetworkId";
private const string _TransportStreamId = "offTransportStreamId";
private const string _ServiceType = "offServiceType";
protected readonly DataMapping mapping;
protected readonly byte[] rawData;
internal readonly int baseOffset;
protected TllChannelBase(DataMapping data)
{
this.mapping = data;
this.rawData = data.Data;
this.baseOffset = data.BaseOffset;
}
#region InitCommonData()
protected void InitCommonData(int slot, SignalSource signalSource, DataMapping data)
{
this.RecordIndex = slot;
this.SignalSource = signalSource;
var nr = data.GetWord(_ProgramNr);
this.SignalType = this.GetSignalType(nr);
this.OldProgramNr = (nr & 0x3FFF);
this.ParseNames();
this.Favorites = (Favorites)((data.GetByte(_Favorites2) & 0x3C) >> 2);
this.Lock = data.GetFlag(_Lock);
this.Skip = data.GetFlag(_Skip);
this.Hidden = data.GetFlag(_Hide);
this.Encrypted = data.GetFlag(_Encrypted);
this.IsDeleted = data.GetFlag(_Deleted);
}
#endregion
#region InitDvbData()
protected void InitDvbData(DataMapping data)
{
this.ServiceId = data.GetWord(_ServiceId);
//this.PcrPid = data.GetWord(_PcrPid);
this.VideoPid = data.GetWord(_VideoPid);
this.AudioPid = data.GetWord(_AudioPid);
this.OriginalNetworkId = data.GetWord(_OriginalNetworkId);
this.TransportStreamId = data.GetWord(_TransportStreamId);
this.ServiceType = data.GetByte(_ServiceType);
}
#endregion
#region GetSignalType()
protected SignalType GetSignalType(uint programNr)
{
if ((programNr & 0x4000) != 0)
return SignalType.Radio;
return SignalType.Tv;
}
#endregion
#region ParseNames()
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;
}
#endregion
#region UpdateRawData()
public override void UpdateRawData()
{
mapping.SetDataPtr(this.rawData, this.baseOffset);
mapping.SetWord(_ProgramNr, this.NewProgramNr + (this.SignalType == SignalType.Radio ? 0x4000 : 0));
mapping.SetWord(_ProgramNr2, (mapping.GetWord(_ProgramNr2) & 0x0003) | (this.NewProgramNr << 2));
if (this.IsNameModified)
{
mapping.SetString(_Name, this.Name, 40);
mapping.SetByte(_NameLength, this.Name.Length);
this.IsNameModified = false;
}
mapping.SetByte(_Favorites2, (mapping.GetByte(_Favorites2)) & 0xC3 | ((byte) this.Favorites << 2));
mapping.SetByte(_Favorites, (mapping.GetByte(_Favorites) & 0xF0) | (byte)this.Favorites);
mapping.SetFlag(_Skip, this.Skip);
mapping.SetFlag(_Lock, this.Lock);
mapping.SetFlag(_Hide, this.Hidden);
if (this.NewProgramNr == 0)
{
mapping.SetFlag(_Deleted, true);
mapping.SetByte("off"+_Moved, 0); //skip,lock,hide,moved
}
else
mapping.SetFlag(_Moved, true);
}
#endregion
#region ChangeEncoding()
public override void ChangeEncoding(System.Text.Encoding encoding)
{
this.mapping.DefaultEncoding = encoding;
this.ParseNames();
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,11 +5,15 @@ using System.Data.SqlClient;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
namespace ChanSort.Loader.TllFile
{
/// <summary>
/// For research purposes this class writes DVB-S channel information into a database
/// It is not used for production.
/// </summary>
public partial class TllFileSerializer
{
#region SQL
#region SQL (create table)
/*
@@ -53,9 +57,12 @@ from channel c inner join chanseq s on s.listid=c.listid and s.slot=c.slot
*/
#endregion
private unsafe void StoreToDatabase()
#region StoreToDatabase()
private void StoreToDatabase()
{
return;
if (this.dvbsBlockSize == 0)
return;
var list = this.DataRoot.GetChannelList(SignalSource.DvbS, SignalType.Tv, false);
if (list == null)
return;
@@ -69,45 +76,12 @@ from channel c inner join chanseq s on s.listid=c.listid and s.slot=c.slot
{
var listId = InsertListData(cmd);
fixed (byte* ptr = this.fileContent)
{
InsertSequenceData(ptr, cmd, listId);
InsertChannelData(ptr, cmd, listId);
}
InsertChannelLinkedList(cmd, listId);
InsertChannelData(cmd, listId);
}
}
}
private unsafe void InsertSequenceData(byte* ptr, DbCommand cmd, int listId)
{
cmd.Parameters.Clear();
cmd.CommandText = "insert into chanseq(listid,seq,slot) values (" + listId + ",@seq,@slot)";
var pSeq = cmd.CreateParameter();
pSeq.ParameterName = "@seq";
pSeq.DbType = DbType.Int32;
cmd.Parameters.Add(pSeq);
var pSlot = cmd.CreateParameter();
pSlot.ParameterName = "@slot";
pSlot.DbType = DbType.Int32;
cmd.Parameters.Add(pSlot);
SatChannelListHeader* header = (SatChannelListHeader*) (ptr + this.dvbsChannelHeaderOffset);
int seq = 0;
ushort tableIndex = header->LinkedListStartIndex;
while(tableIndex != 0xFFFF)
{
ushort* entry = (ushort*)(ptr + this.dvbsChannelLinkedListOffset + tableIndex*c.sizeOfZappingTableEntry);
pSeq.Value = seq;
if (entry[2] != tableIndex)
break;
pSlot.Value = (int)tableIndex;
cmd.ExecuteNonQuery();
tableIndex = entry[1];
++seq;
}
}
#endregion
#region InsertListData()
private int InsertListData(DbCommand cmd)
@@ -127,36 +101,75 @@ from channel c inner join chanseq s on s.listid=c.listid and s.slot=c.slot
}
#endregion
#region InsertChannelLinkedList()
private void InsertChannelLinkedList(DbCommand cmd, int listId)
{
cmd.Parameters.Clear();
cmd.CommandText = "insert into chanseq(listid,seq,slot) values (" + listId + ",@seq,@slot)";
var pSeq = cmd.CreateParameter();
pSeq.ParameterName = "@seq";
pSeq.DbType = DbType.Int32;
cmd.Parameters.Add(pSeq);
var pSlot = cmd.CreateParameter();
pSlot.ParameterName = "@slot";
pSlot.DbType = DbType.Int32;
cmd.Parameters.Add(pSlot);
SatChannelListHeader header = new SatChannelListHeader(this.fileContent,
this.dvbsBlockOffset + this.satConfig.ChannelListHeaderOffset);
int seq = 0;
int tableIndex = header.LinkedListStartIndex;
int linkedListOffset = this.satConfig.SequenceTableOffset;
while (tableIndex != 0xFFFF)
{
int entryOffset = linkedListOffset + tableIndex * satConfig.sizeOfChannelLinkedListEntry;
pSeq.Value = seq;
if (BitConverter.ToInt16(this.fileContent, entryOffset + 4) != tableIndex)
break;
pSlot.Value = tableIndex;
cmd.ExecuteNonQuery();
tableIndex = BitConverter.ToInt16(this.fileContent, entryOffset + 2);
++seq;
}
}
#endregion
#region InsertChannelData()
private unsafe void InsertChannelData(byte* ptr, DbCommand cmd, int listId)
private void InsertChannelData(DbCommand cmd, int listId)
{
PrepareChannelInsert(cmd);
dvbsMapping.DataPtr = ptr + this.dvbsChannelListOffset;
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.InUse ? 0 : 1;
cmd.Parameters["@progmask"].Value = dvbsMapping.ProgramNr;
cmd.Parameters["@prognr"].Value = (dvbsMapping.ProgramNr & 0x3FFF);
cmd.Parameters["@progfix"].Value = dvbsMapping.ProgramNrPreset;
cmd.Parameters["@name"].Value = dvbsMapping.Name;
cmd.Parameters["@tpnr"].Value = dvbsMapping.TransponderIndex;
var transp = this.DataRoot.Transponder.TryGet(dvbsMapping.TransponderIndex);
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.ServiceId;
cmd.Parameters["@ssid"].Value = (int)dvbsMapping.GetWord("offServiceId");
cmd.Parameters["@uid"].Value = transp == null
? (object) DBNull.Value
: transp.TransportStreamId + "-" + transp.OriginalNetworkId + "-" +
dvbsMapping.ServiceId;
dvbsMapping.GetWord("offServiceId");
cmd.Parameters["@favcrypt"].Value = (int)dvbsMapping.GetByte("offFavorites");
cmd.Parameters["@lockskiphide"].Value = (int)dvbsMapping.GetByte("offLock");
cmd.ExecuteNonQuery();
dvbsMapping.Next();
dvbsMapping.BaseOffset += this.satConfig.dvbsChannelLength;
}
}
#endregion

View File

@@ -1,185 +1,27 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.IO;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
namespace ChanSort.Loader.TllFile
{
public class TllFileSerializerPlugin : ISerializerPlugin
{
private const int MAX_FILE_SIZE = 16*1000*1000;
private readonly string ERR_modelUnknown = Resource.TllFileSerializerPlugin_ERR_modelUnknown;
private readonly string ERR_fileTooBig = Resource.TllFileSerializerPlugin_ERR_fileTooBig;
private static readonly byte[] DVBS_S2 = Encoding.ASCII.GetBytes("DVBS-S2");
private readonly MappingPool<ActChannelDataMapping> actMappings = new MappingPool<ActChannelDataMapping>("Analog and DVB-C/T");
private readonly MappingPool<DvbsChannelDataMapping> dvbsMappings = new MappingPool<DvbsChannelDataMapping>("DVB-S");
private readonly MappingPool<FirmwareDataMapping> firmwareMappings = new MappingPool<FirmwareDataMapping>("Firmware");
private readonly List<ModelConstants> modelConstants = new List<ModelConstants>();
private string series = "";
public string PluginName { get { return Resource.TllFileSerializerPlugin_PluginName; } }
public string FileFilter { get { return "*.TLL"; } }
public TllFileSerializerPlugin()
{
this.ReadConfigurationFromIniFile();
}
#region ReadConfigurationFromIniFile()
private void ReadConfigurationFromIniFile()
{
DvbStringDecoder dvbsStringDecoder = new DvbStringDecoder(null);
string iniFile = Assembly.GetExecutingAssembly().Location.Replace(".dll", ".ini");
IniFile ini = new IniFile(iniFile);
foreach (var section in ini.Sections)
{
int idx = section.Name.IndexOf(":");
int recordLength = idx < 0 ? 0 : int.Parse(section.Name.Substring(idx + 1));
if (section.Name.StartsWith("FileConfiguration"))
this.ReadModelConstants(section);
else if (section.Name.StartsWith("ACTChannelDataMapping"))
actMappings.AddMapping(new ActChannelDataMapping(section, recordLength, dvbsStringDecoder));
else if (section.Name.StartsWith("SatChannelDataMapping"))
dvbsMappings.AddMapping(new DvbsChannelDataMapping(section, recordLength, dvbsStringDecoder));
else if (section.Name.StartsWith("FirmwareData"))
firmwareMappings.AddMapping(new FirmwareDataMapping(section, recordLength));
}
}
private void ReadModelConstants(IniFile.Section section)
{
if (this.series.Length > 0)
this.series += ",";
this.series += section.Name;
ModelConstants c = new ModelConstants(section);
this.modelConstants.Add(c);
}
#endregion
#region CreateSerializer()
public SerializerBase CreateSerializer(string inputFile)
{
long fileSize = new FileInfo(inputFile).Length;
if (fileSize > MAX_FILE_SIZE)
throw new IOException(string.Format(ERR_fileTooBig, fileSize, MAX_FILE_SIZE));
byte[] fileContent = File.ReadAllBytes(inputFile);
ModelConstants model = this.DetermineModel(fileContent);
if (model == null)
throw new IOException(ERR_modelUnknown);
return new TllFileSerializer(inputFile, model,
this.actMappings.GetMapping(model.actChannelLength),
this.dvbsMappings.GetMapping(model.dvbsChannelLength),
this.firmwareMappings.GetMapping(model.firmwareBlockLength, false),
fileContent);
return new TllFileSerializer(inputFile);
}
#endregion
#region DetermineModel()
private ModelConstants DetermineModel(byte[] fileContent)
{
foreach (var model in this.modelConstants)
{
if (this.IsModel(fileContent, model))
return model;
}
return null;
}
#endregion
#region IsModel()
private unsafe bool IsModel(byte[] fileContent, ModelConstants c)
{
c.hasDvbSBlock = false;
fixed (byte* p = fileContent)
{
long fileSize = fileContent.Length;
// check magic file header
uint offset = 0;
if (fileSize < c.magicBytes.Length)
return false;
if (!ByteCompare(p, c.magicBytes))
return false;
offset += (uint)c.magicBytes.Length;
// analog channel block
if (offset + 8 > fileSize) return false;
uint blockSize = *(uint*)(p + offset);
uint channelCount = *(uint*) (p + offset + 4);
if (blockSize < 4 + channelCount)
return false;
if (blockSize > 4 && channelCount > 0)
c.actChannelLength = (int)((blockSize - 4)/channelCount);
offset += 4 + blockSize;
// firmware data block
if (offset + 4 > fileSize) return false;
blockSize = *(uint*) (p + offset);
c.firmwareBlockLength = (int)blockSize;
offset += 4 + blockSize;
// DVB-C/T channel block
if (offset + 8 > fileSize) return false;
blockSize = *(uint*) (p + offset);
channelCount = *(uint*) (p + offset + 4);
if (blockSize < 4 + channelCount)
return false;
if (blockSize > 4 && channelCount > 0)
c.actChannelLength = (int)((blockSize - 4) / channelCount);
offset += 4 + blockSize;
// optional blocks
while (offset != fileSize)
{
if (offset + 4 > fileSize)
return false;
blockSize = *(uint*) (p + offset);
// check for DVBS-S2 block
if (blockSize >= sizeof(DvbSBlockHeader))
{
DvbSBlockHeader* header = (DvbSBlockHeader*) (p + offset);
if (ByteCompare(header->DvbS_S2, DVBS_S2))
{
c.hasDvbSBlock = true;
int length = sizeof(DvbSBlockHeader) +
c.satCount*c.satLength +
c.sizeOfTransponderBlockHeader +
c.transponderCount*c.transponderLength +
sizeof(SatChannelListHeader) +
c.dvbsMaxChannelCount/8 +
c.dvbsMaxChannelCount*c.sizeOfZappingTableEntry +
c.dvbsMaxChannelCount*c.dvbsChannelLength +
sizeof(LnbBlockHeader) + c.lnbCount*c.lnbLength;
if (length != 4 + blockSize)
return false;
}
}
offset += 4 + blockSize;
}
return true;
}
}
#endregion
#region ByteCompare()
private static unsafe bool ByteCompare(byte* buffer, byte[] expected)
{
for (int i = 0; i < expected.Length; i++)
{
if (buffer[i] != expected[i])
return false;
}
return true;
}
#endregion
}
}

View File

@@ -1,169 +0,0 @@
using System.Runtime.InteropServices;
namespace ChanSort.Plugin.TllFile
{
/*
TllFileHeader? ("ZZZZ" or nothing)
ChannelBlock
AnalogChannel[]
FirmwareBlock
ChannelBlock
DvbCtChannel[]
DvbSBlockHeader
TllSatellite[64]
TransponderBlockHeader
TllTransponder[2400]
SatChannelListHeader
DvbSChannel[7520]
LnbBlockHeader
Lnb[40]
SettingsBlock?
*/
#region struct ChannelBlock
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ChannelBlock
{
public uint BlockSize; // = 4 + ChannelCount * ChannelLength
public uint ChannelCount;
public uint ChannelLength { get { return ChannelCount == 0 ? 0 : (BlockSize - 4) / ChannelCount; } }
public byte StartOfChannelList;
}
#endregion
#region struct FirmwareBlock
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct FirmwareBlock
{
public uint BlockSize;
public fixed byte Unknown_0x0000[35631];
public fixed byte HotelMenu[29];
public fixed byte Unknown_0x8B4C[1204]; // or more
}
#endregion
#region struct DvbSBlockHeader
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct DvbSBlockHeader
{
public uint BlockSize;
public uint Crc32ForSubblock1;
public fixed byte DvbS_S2 [8]; // "DVBS-S2\0"
public ushort Unknown_0x10; // 0x0007
public ushort Unknown_0x12; // 0x0004 // 0x0000
public uint Crc32ForSubblock2;
public const int Unknown0x18_Length = 12;
public fixed byte Unknown_0x18[Unknown0x18_Length];
public ushort SatOrderLength;
public fixed byte SatOrder[64];
public fixed byte Unknown [2];
//public fixed TllSatellite Satellites[64]
}
#endregion
#region struct TllSatellite
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct TllSatellite
{
public const int SatNameLength =32;
public fixed byte Name [SatNameLength];
public byte PosDeg;
public byte PosCDeg;
public byte Unknown_34; // typically 0
public byte Unknown_35; // typically 2
public ushort Unknown_36; // 0xFFFF if sat is not used
public ushort Unknown_38; // 0xFFFF if sat is not used
public ushort TransponderCount;
public ushort Unknown_42; // typically 0
}
#endregion
#region struct TransponderLinkedList
public struct TransponderLinkedList
{
public ushort Prev;
public ushort Next;
public ushort Current;
}
#endregion
#region struct TransponderBlockHeader
public unsafe struct TransponderBlockHeader
{
public uint Crc32;
public ushort Unknown1;
public ushort HeadIndex;
public ushort TailIndex1;
public ushort TailIndex2;
public ushort TransponderCount;
public fixed byte AllocationBitmap [2400/8];
public fixed ushort TransponderLinkedList [2400*3];
public ushort Unknown3;
// public fixed TllTransponder Transponders[2400]
}
#endregion
#region struct TllTransponder
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct TllTransponder
{
public fixed byte Unknown_0x00 [10];
public ushort Index;
public ushort Frequency;
public fixed byte Unknown_0x0E [4];
public ushort NetworkId;
public ushort TransportStreamId;
public fixed byte Unknown_0x16 [3];
public ushort SymbolRateAndPolarity;
public fixed byte Unknown_0x1B [9];
public byte SatIndex;
public fixed byte Unknown_0x25 [3];
//public int SymbolRate { get { return this.SymbolRateAndPolarity & 0x7FFFF; } }
public ushort SymbolRate { get { return this.SymbolRateAndPolarity; } set { this.SymbolRateAndPolarity = value; } }
public char Polarity { get { return '\0'; } }
}
#endregion
#region struct SatChannelListHeader
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct SatChannelListHeader
{
public uint Checksum;
public fixed byte Unknown_0x04[4];
public ushort LinkedListStartIndex;
public ushort LinkedListEndIndex1;
public ushort LinkedListEndIndex2;
public ushort ChannelCount;
}
#endregion
#region struct LnbBlockHeader
public unsafe struct LnbBlockHeader
{
public uint crc32;
public ushort lastUsedIndex;
public fixed byte lnbAllocationBitmap[6];
// public Lnb lnbs[40];
}
#endregion
#region struct Lnb
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct Lnb
{
public byte SettingsID;
public fixed byte Unknown_0x0D[3];
public byte SatelliteID;
public fixed byte Unknown_0x11[3];
public fixed byte FrequencyName[12];
public ushort LOF1;
public fixed byte Unknown_0x22 [2];
public ushort LOF2;
public fixed byte Unknown_0x26 [18];
}
#endregion
}

View File

@@ -1,4 +1,4 @@
namespace ChanSort.Plugin.TllFile
namespace ChanSort.Loader.TllFile
{
partial class TvSettingsForm
{

View File

@@ -2,7 +2,7 @@
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
namespace ChanSort.Plugin.TllFile
namespace ChanSort.Loader.TllFile
{
public partial class TvSettingsForm : XtraForm
{
@@ -14,52 +14,44 @@ namespace ChanSort.Plugin.TllFile
InitializeComponent();
}
private unsafe void TvSettingsForm_Load(object sender, EventArgs e)
private void TvSettingsForm_Load(object sender, EventArgs e)
{
var items = tvSerializer.SupportedTvCountryCodes;
foreach(var item in items)
this.comboBoxEdit1.Properties.Items.Add(item);
this.comboBoxEdit1.Text = this.tvSerializer.TvCountryCode;
byte[] fileContent = this.tvSerializer.FileContent;
fixed (byte* ptr = fileContent)
var mapping = this.tvSerializer.GetFirmwareMapping();
if (mapping != null)
{
var mapping = this.tvSerializer.GetFirmwareMapping(ptr);
if (mapping != null)
{
this.cbAutoChannelUpdate.Checked = mapping.SettingsAutomaticChannelUpdate;
this.cbHbbTv.Checked = mapping.HbbTvEnabled;
this.cbHotelMode.Checked = mapping.HotelModeEnabled;
this.cbDtvUpdate.Checked = mapping.HotelModeDtvUpdate;
this.cbAutoChannelUpdate.Checked = mapping.SettingsAutomaticChannelUpdate;
this.cbHbbTv.Checked = mapping.HbbTvEnabled;
this.cbHotelMode.Checked = mapping.HotelModeEnabled;
this.cbDtvUpdate.Checked = mapping.HotelModeDtvUpdate;
this.grpFirmwareNote.Visible = false;
this.Height -= this.grpFirmwareNote.Height;
}
else
{
this.cbAutoChannelUpdate.Enabled = false;
this.cbHbbTv.Enabled = false;
this.cbHotelMode.Enabled = false;
this.cbDtvUpdate.Enabled = false;
}
this.grpFirmwareNote.Visible = false;
this.Height -= this.grpFirmwareNote.Height;
}
else
{
this.cbAutoChannelUpdate.Enabled = false;
this.cbHbbTv.Enabled = false;
this.cbHotelMode.Enabled = false;
this.cbDtvUpdate.Enabled = false;
}
}
private unsafe void btnOk_Click(object sender, EventArgs e)
private void btnOk_Click(object sender, EventArgs e)
{
this.tvSerializer.TvCountryCode = this.comboBoxEdit1.Text;
byte[] fileContent = this.tvSerializer.FileContent;
fixed (byte* ptr = fileContent)
var mapping = this.tvSerializer.GetFirmwareMapping();
if (mapping != null)
{
var mapping = this.tvSerializer.GetFirmwareMapping(ptr);
if (mapping != null)
{
mapping.SettingsAutomaticChannelUpdate = this.cbAutoChannelUpdate.Checked;
mapping.HbbTvEnabled = this.cbHbbTv.Checked;
mapping.HotelModeEnabled = this.cbHotelMode.Checked;
mapping.HotelModeDtvUpdate = this.cbDtvUpdate.Checked;
}
mapping.SettingsAutomaticChannelUpdate = this.cbAutoChannelUpdate.Checked;
mapping.HbbTvEnabled = this.cbHbbTv.Checked;
mapping.HotelModeEnabled = this.cbHotelMode.Checked;
mapping.HotelModeDtvUpdate = this.cbDtvUpdate.Checked;
}
}

View File

@@ -0,0 +1,19 @@
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
public class AnalogChannel : TllChannelBase
{
private const string _Freqency = "offPcrPid";
private const string _FreqBand = "offVideoPid";
public AnalogChannel(int slot, DataMapping data) : base(data)
{
this.InitCommonData(slot, SignalSource.AnalogCT, data);
this.FreqInMhz = (decimal)data.GetWord(_Freqency) / 20;
int channelAndBand = data.GetWord(_FreqBand);
this.ChannelOrTransponder = ((channelAndBand>>8) == 0 ? "E" : "S") + (channelAndBand&0xFF).ToString("d2");
}
}
}

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B1ECA01E-48A8-44C4-8237-F7B87E68C76E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Plugin.TllFile</RootNamespace>
<AssemblyName>ChanSort.Plugin.TllFile2</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AnalogChannel.cs" />
<Compile Include="DtvChannel.cs" />
<Compile Include="SatChannelListHeader.cs" />
<Compile Include="DvbsDataLayout.cs" />
<Compile Include="FirmwareData.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.de.Designer.cs">
<DependentUpon>Resource.de.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resource.Designer.cs">
<DependentUpon>Resource.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="SatChannel.cs" />
<Compile Include="TllChannelBase.cs" />
<Compile Include="TllFileSerializer.cs" />
<Compile Include="TllFileSerializerPlugin.cs" />
<Compile Include="SatTransponder.cs" />
<Compile Include="TvSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TvSettingsForm.Designer.cs">
<DependentUpon>TvSettingsForm.cs</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
<Project>{DCCFFA08-472B-4D17-BB90-8F513FC01392}</Project>
<Name>ChanSort.Api</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resource.de.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.de.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="TvSettingsForm.de.resx">
<DependentUpon>TvSettingsForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="TvSettingsForm.resx">
<DependentUpon>TvSettingsForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="ChanSort.Plugin.TllFile2.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,334 @@
; FileConfigurationX: overall file and DVB-S data layout
; ACTChannelDataMappingX: analog, DVB-C and DVB-T channel data mapping for data length X
[ACTChannelDataMapping:192]
; LM series with Firmware 4.x (all except LM611S and LM340S)
reorderChannelData = 0
lenName = 40
offChannelTransponder = 10, 94, 126, 132
offProgramNr = 12, 128
offFavorites = 20
offPcrPid = 22, 180
offAudioPid = 24
offVideoPid = 26
offName = 30, 140
offNameLength = 70, 139
offServiceId = 72, 136
offFrequencyLong = 96
offOriginalNetworkId = 102
offTransportStreamId = 104
offFavorites2 = 134
offDeleted = 134
maskDeleted = 0x42
offLock = 135
maskLock = 0x01
offSkip = 135
maskSkip = 0x02
offHide = 135
maskHide = 0x04
offServiceType = 138
offAudioPid2 = 182
[ACTChannelDataMapping:188]
; LM series with Firmware 3.x (LM611S with exceptions, LM340S)
reorderChannelData = 0
lenName = 40
offChannelTransponder = 10, 94, 125, 132
offProgramNr = 12, 128
offFavorites = 20
offPcrPid = 22, 180
offAudioPid = 24
offVideoPid = 26
offName = 30, 140
offNameLength = 70, 139
offServiceId = 72, 136
offFrequencyLong = 96
offOriginalNetworkId = 102
offTransportStreamId = 104
offFavorites2 = 134
offDeleted = 134
maskDeleted = 0x42
offLock = 135
maskLock = 0x01
offSkip = 135
maskSkip = 0x02
offHide = 135
maskHide = 0x04
offServiceType = 138
offAudioPid2 = 182
[ACTChannelDataMapping:184]
; LV470S,LV570S,LV579S(with exceptions), LW5500,LW5590,LW570S,LW579S,LW650S,LW659S(with exceptions)
; LK950S, CS460S, PM670S, LM611S(with exceptions)
reorderChannelData = 0
lenName = 40
offChannelTransponder = 10, 90, 121, 128
offProgramNr = 12, 124
offFavorites = 20
offPcrPid = 22, 176
offAudioPid = 24
offVideoPid = 26
offName = 30, 136
offNameLength = 70, 135
offServiceId = 72, 132
offFrequencyLong = 92
offOriginalNetworkId = 98
offTransportStreamId = 100
offFavorites2 = 130
offDeleted = 130
maskDeleted = 0x42
offLock = 131
maskLock = 0x01
offSkip = 131
maskSkip = 0x02
offHide = 131
maskHide = 0x04
offServiceType = 134
offAudioPid2 = 178
[ACTChannelDataMapping:180]
; PT
reorderChannelData = 0
lenName = 40
offChannelTransponder = 10, 90, 124
offProgramNr = 12
offFavorites = 20
offPcrPid = 22, 172
offAudioPid = 24
offVideoPid = 26
offName = 30, 132
offNameLength = 70, 131
offServiceId = 72, 128
offFrequencyLong = 92
offOriginalNetworkId = 98
offTransportStreamId = 100
offProgramNr2 = 120
offFavorites2 = 126
offDeleted = 126
maskDeleted = 0x42
offLock = 127
maskLock = 0x01
offSkip = 127
maskSkip = 0x02
offHide = 127
maskHide = 0x04
offServiceType = 130
offAudioPid2 = 172
[ACTChannelDataMapping:176]
; LD, LE series, LK450, LW4500, LW5400
reorderChannelData = 0
lenName = 40
offChannelTransponder = 10, 86, 120
offProgramNr = 12
offFavorites = 20
offPcrPid = 22, 168
offAudioPid = 24
offVideoPid = 26
offName = 30, 128
offNameLength = 70, 127
offServiceId = 72, 124
offFrequencyLong = 88
offOriginalNetworkId = 94
offTransportStreamId = 96
offProgramNr2 = 116
offFavorites2 = 122
offDeleted = 122
maskDeleted = 0x42
offLock = 123
maskLock = 0x01
offSkip = 123
maskSkip = 0x02
offHide = 123
maskHide = 0x04
offServiceType = 126
offAudioPid2 = 170
[ACTChannelDataMapping:164]
; DM and LH series
reorderChannelData = 1
lenName = 40
offChannelTransponder = 9, 112
offProgramNr = 10
offFavorites = 18
offPcrPid = 20, 156
offAudioPid = 22
offVideoPid = 24
offName = 28, 116
offNameLength = 68
offServiceId = 70
offOriginalNetworkId = 86
offTransportStreamId = 88
offFrequencyLong = 96
offProgramNr2 = 108
offFavorites2 = 113
offDeleted = 113
maskDeleted = 0x42
offLock = 113
maskLock =
offSkip = 113
maskSkip = 0x20
offHide = 113
maskHide =
offServiceType = 115
offAudioPid2 = 158
[DvbsBlock:687880]
; everything before LM series (but including LM611S and LM340S)
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 68
lnbCount = 40
lnbLength = 44
[DvbsBlock:717960]
; LM and PM series except LM611S and LM340S
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 72
lnbCount = 40
lnbLength = 44
[SatChannelDataMapping:68]
lenName = 40
offSatelliteNr = 0
offSourceType = 4
offTransponderIndex = 5, 12
offProgramNr = 8
offProgramNrPreset = 10
offFavorites2 = 14
offDeleted = 14
maskDeleted = 0x42
offEncrypted = 14
maskEncrypted = 0x80
offLock = 15
maskLock = 0x01
offSkip = 15
maskSkip = 0x02
offHide = 15
maskHide = 0x04
offProgNrCustomized = 15
maskProgNrCustomized = 0x40
offServiceId = 16
offServiceType = 18
offNameLength = 19
offName = 20
offVideoPid = 60
offAudioPid = 62
[SatChannelDataMapping:72]
lenName = 40
offSatelliteNr = 0
offSourceType = 4
offTransponderIndex = 6, 12
offProgramNr = 8
offProgramNrPreset = 10
offFavorites2 = 14
offDeleted = 14
maskDeleted = 0x42
offEncrypted = 14
maskEncrypted = 0x80
offLock = 15
maskLock = 0x01
offSkip = 15
maskSkip = 0x02
offHide = 15
maskHide = 0x04
offProgNrCustomized = 15
maskProgNrCustomized = 0x40
offServiceId = 16
offServiceType = 18
offNameLength = 19
offName = 20
offVideoPid = 60
offAudioPid = 62
[FirmwareData:6944]
; LH series
offSize = 0
offHotelModeEnabled=6543
offHotelModeDtvUpdate=6553
[FirmwareData:11008]
; DM (2350D)
offSize = 0
offHotelModeEnabled=10563
offHotelModeDtvUpdate=10573
[FirmwareData:15936]
; PT
offSize = 0
offHotelModeEnabled=12601
offHotelModeDtvUpdate=12611
[FirmwareData:15960]
; LW4500, LW5400
offSize = 0
offHotelModeEnabled=12603
offHotelModeDtvUpdate=12613
[FirmwareData:16024]
; LM611S, LM340S, CS460S
offSize = 0
offHotelModeEnabled=12639
offHotelModeDtvUpdate=12649
[FirmwareData:23072]
; LD420, LD450, LD550
offSize = 0
offHotelModeEnabled=19721
offHotelModeDtvUpdate=19731
[FirmwareData:23088]
; LK450
offSize = 0
offHotelModeEnabled=19723
offHotelModeDtvUpdate=19733
[FirmwareData:23096]
; LE5500, LD750
offSize = 0
offHotelModeEnabled=19721
offHotelModeDtvUpdate=19731
[FirmwareData:35504]
; LV,LW,LK950S
offSize = 0
offSystemLock =
offTvPassword =
offHbbTvEnabled =
offHotelModeEnabled=34643
offHotelModeDtvUpdate=34653
offHotelMenuAccessCode = 34668
offHotelMenuPin = 34714
[FirmwareData:36856]
; LM860V
offSize = 0
offSystemLock = 171
offTvPassword = 173
offHbbTvEnabled = 35096
offHotelModeEnabled=35635
offHotelModeDtvUpdate=35645
offHotelMenuAccessCode = 35660
offHotelMenuPin = 35706
offSettingsChannelUpdate=36544
[FirmwareData:36864]
; LM (except LM611S,LM340S and LM860V),PM,LS
offSize = 0
offSystemLock = 171
offTvPassword = 173
offHbbTvEnabled = 35096
offHotelModeEnabled=35635
offHotelModeDtvUpdate=35645
offHotelMenuAccessCode = 35660
offHotelMenuPin = 35706
offSettingsChannelUpdate=36544

View File

@@ -0,0 +1,24 @@
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
public class DtvChannel : TllChannelBase
{
private const string _ChannelOrTransponder = "offChannelTransponder";
private const string _FrequencyLong = "offFrequencyLong";
/*
offFavorites2 = 134
offAudioPid2 = 182
*/
public DtvChannel(int slot, DataMapping data) : base(data)
{
this.InitCommonData(slot, SignalSource.DvbCT, data);
this.InitDvbData(data);
this.ChannelOrTransponder = data.GetByte(_ChannelOrTransponder).ToString("d2");
this.FreqInMhz = (decimal)data.GetDword(_FrequencyLong) / 1000;
}
}
}

View File

@@ -1,31 +1,23 @@
namespace ChanSort.Plugin.TllFile
{
public class ModelConstants
public class DvbsDataLayout
{
public readonly string series;
public readonly byte[] magicBytes;
public int actChannelLength; // auto-detect
public readonly int satCount;
public readonly int satLength;
public readonly int sizeOfTransponderBlockHeader;
public readonly int transponderCount;
public readonly int transponderLength;
public readonly int sizeOfZappingTableEntry = 8;
public readonly int sizeOfChannelIndexTableEntry = 8;
public readonly int dvbsMaxChannelCount;
public readonly int dvbsChannelLength;
public readonly int lnbCount;
public readonly int lnbLength;
public readonly int[] dvbsSubblockLength;
public bool hasDvbSBlock;
public int firmwareBlockLength; // auto-detect
public int LnbBlockHeaderSize = 12;
public ModelConstants(Api.IniFile.Section iniSection)
public DvbsDataLayout(Api.IniFile.Section iniSection)
{
this.series = iniSection.Name;
this.magicBytes = iniSection.GetBytes("magicBytes");
this.satCount = iniSection.GetInt("satCount");
this.satLength = iniSection.GetInt("satLength");
this.transponderCount = iniSection.GetInt("transponderCount");
@@ -38,11 +30,11 @@
this.dvbsSubblockLength = new[]
{
12,
14 + 2 + this.satCount + this.satCount*this.satLength, // 2896
sizeOfTransponderBlockHeader - 4 + transponderCount * transponderLength, // 110712
12 + dvbsMaxChannelCount/8 + dvbsMaxChannelCount*sizeOfZappingTableEntry + dvbsMaxChannelCount * dvbsChannelLength, // 602552
8 + lnbCount * lnbLength // 1768
12, // header
14 + 2 + this.satCount + this.satCount*this.satLength, // satellites
sizeOfTransponderBlockHeader - 4 + transponderCount * transponderLength, // transponder
12 + dvbsMaxChannelCount/8 + dvbsMaxChannelCount*sizeOfChannelIndexTableEntry + dvbsMaxChannelCount * dvbsChannelLength, // channels
LnbBlockHeaderSize - 4 + lnbCount * lnbLength // sat/LNB-Config
};
}
}

View File

@@ -2,7 +2,7 @@
namespace ChanSort.Plugin.TllFile
{
public class FirmwareDataMapping : DataMapping
public class FirmwareData : DataMapping
{
private const string offSize = "offSize";
private const string offSystemLock = "offSystemLock";
@@ -10,20 +10,16 @@ namespace ChanSort.Plugin.TllFile
private const string offHbbTvEnabled = "offHbbTvEnabled";
private const string offHotelModeEnabled = "offHotelModeEnabled";
private const string offHotelModeDtvUpdate = "offHotelModeDtvUpdate";
private const string offHotelMenuAccessCode = "offHotelMenuAccessCode";
private const string offHotelMenuPin = "offHotelMenuPin";
private const string offSettingsChannelUpdate = "offSettingsChannelUpdate";
public FirmwareDataMapping(IniFile.Section settings, int structureLength) :
base(settings, structureLength, null)
public FirmwareData(IniFile.Section settings) :
base(settings)
{
}
public uint Size { get { return this.GetDword(offSize); } }
public long Size { get { return this.GetDword(offSize); } }
public bool SystemLocked { get { return this.GetByte(offSystemLock) != 0; } }
public string TvPassword { get { return CodeToString(this.GetDword(offTvPassword)); } }
public string HotelMenuAccessCode { get { return CodeToString(this.GetDword(offHotelMenuAccessCode)); } }
public string HotelMenuPin { get { return CodeToString(this.GetDword(offHotelMenuPin)); } }
public string TvPassword { get { return CodeToString((uint)this.GetDword(offTvPassword)); } }
public bool SettingsAutomaticChannelUpdate

View File

@@ -0,0 +1,38 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Test.Plugin.TllFile")]
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ChanSort.Plugin.TllFile2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Plugin.TllFile2")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f4702e0e-8277-44c6-b709-4d1c78654837")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,108 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.586
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChanSort.Plugin.TllFile {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChanSort.Plugin.TllFile.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Channel #{0} (Pr# {1}) was erased because it is a duplicate of channel #{2} (Pr# {3}): {4}.
/// </summary>
internal static string TllFileSerializer_ERR_dupeChannel {
get {
return ResourceManager.GetString("TllFileSerializer_ERR_dupeChannel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Wrong checksum: calculated {1:x8} but file has {0:x8}.
/// </summary>
internal static string TllFileSerializer_ERR_wrongChecksum {
get {
return ResourceManager.GetString("TllFileSerializer_ERR_wrongChecksum", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File size {0} is larger than allowed maxiumum of {1}.
/// </summary>
internal static string TllFileSerializerPlugin_ERR_fileTooBig {
get {
return ResourceManager.GetString("TllFileSerializerPlugin_ERR_fileTooBig", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The file content doesn&apos;t match any supported model.
/// </summary>
internal static string TllFileSerializerPlugin_ERR_modelUnknown {
get {
return ResourceManager.GetString("TllFileSerializerPlugin_ERR_modelUnknown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to LG-Electronics *.tll Loader.
/// </summary>
internal static string TllFileSerializerPlugin_PluginName {
get {
return ResourceManager.GetString("TllFileSerializerPlugin_PluginName", resourceCulture);
}
}
}
}

View File

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TllFileSerializer_ERR_wrongChecksum" xml:space="preserve">
<value>Prüfsummenfehler: berechnet wurde {1:x8} aber Datei enthält {0:x8}</value>
</data>
<data name="TllFileSerializerPlugin_ERR_modelUnknown" xml:space="preserve">
<value>Der Dateiinhalt entstpricht keinem bekannten Modell</value>
</data>
<data name="TllFileSerializerPlugin_ERR_fileTooBig" xml:space="preserve">
<value>Dateigröße {0} überschreitet das erlaubte Maximum von {1}</value>
</data>
<data name="TllFileSerializerPlugin_PluginName" xml:space="preserve">
<value>LG-Electronics *.tll Loader</value>
</data>
<data name="TllFileSerializer_ERR_dupeChannel" xml:space="preserve">
<value>Sender #{0} (Pr# {1}) wurde gelöscht da er ein Duplikat von Sender #{2} (Pr# {3}) ist: {4}</value>
</data>
</root>

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TllFileSerializer_ERR_wrongChecksum" xml:space="preserve">
<value>Wrong checksum: calculated {1:x8} but file has {0:x8}</value>
</data>
<data name="TllFileSerializerPlugin_ERR_modelUnknown" xml:space="preserve">
<value>The file content doesn't match any supported model</value>
</data>
<data name="TllFileSerializerPlugin_ERR_fileTooBig" xml:space="preserve">
<value>File size {0} is larger than allowed maxiumum of {1}</value>
</data>
<data name="TllFileSerializerPlugin_PluginName" xml:space="preserve">
<value>LG-Electronics *.tll Loader</value>
</data>
<data name="TllFileSerializer_ERR_dupeChannel" xml:space="preserve">
<value>Channel #{0} (Pr# {1}) was erased because it is a duplicate of channel #{2} (Pr# {3}): {4}</value>
</data>
</root>

View File

@@ -0,0 +1,44 @@
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
class SatChannel : TllChannelBase
{
private const string _SatConfigIndex = "offSatelliteNr";
private const string _TransponderIndex = "offTransponderIndex";
public bool InUse { get; private set; }
public SatChannel(int order, int slot, DataMapping data, DataRoot dataRoot) : base(data)
{
this.InUse = data.GetWord(_SatConfigIndex) != 0xFFFF;
if (!InUse)
return;
this.InitCommonData(slot, SignalSource.DvbS, data);
this.InitDvbData(data);
int transponderIndex = data.GetWord(_TransponderIndex);
Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex);
Satellite sat = transponder.Satellite;
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
this.RecordOrder = order;
this.TransportStreamId = transponder.TransportStreamId;
this.OriginalNetworkId = transponder.OriginalNetworkId;
this.SymbolRate = transponder.SymbolRate;
this.Polarity = transponder.Polarity;
this.FreqInMhz = transponder.FrequencyInMhz;
}
public override void UpdateRawData()
{
base.UpdateRawData();
// bool deleted = this.NewProgramNr == 0;
// if (deleted)
// mapping.SetWord(_SatConfigIndex, 0xFFFF);
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace ChanSort.Plugin.TllFile
{
internal class SatChannelListHeader
{
private readonly byte[] data;
private readonly int baseOffset;
public SatChannelListHeader(byte[] data, int offset) { this.data = data; this.baseOffset = offset; }
public uint Checksum { get { return BitConverter.ToUInt32(data, baseOffset + 0); } }
public int LinkedListStartIndex { get { return BitConverter.ToInt16(data, baseOffset + 8); }}
public int LinkedListEndIndex1 { get { return BitConverter.ToInt16(data, baseOffset + 10); } }
public int LinkedListEndIndex2 { get { return BitConverter.ToInt16(data, baseOffset + 12); } }
public int ChannelCount { get { return BitConverter.ToInt16(data, baseOffset + 14); } }
public int Size { get { return 16; } }
}
}

View File

@@ -0,0 +1,31 @@
using System;
namespace ChanSort.Plugin.TllFile
{
internal class SatTransponder
{
private readonly byte[] data;
public int BaseOffset { get; set; }
public SatTransponder(byte[] data)
{
this.data = data;
}
public int Frequency { get { return BitConverter.ToInt16(data, BaseOffset + 12); } }
public int OriginalNetworkId { get { return BitConverter.ToInt16(data, BaseOffset + 18); } }
public int TransportStreamId { get { return BitConverter.ToInt16(data, BaseOffset + 20); } }
public int SymbolRate
{
get { return BitConverter.ToInt16(data, BaseOffset + 25); }
set
{
data[BaseOffset + 25] = (byte)value;
data[BaseOffset + 26] = (byte)(value >> 8);
}
}
public int SatIndex { get { return data[BaseOffset + 36]; } }
}
}

View File

@@ -0,0 +1,134 @@
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
public class TllChannelBase : ChannelInfo
{
// common
private const string _ProgramNr = "offProgramNr";
private const string _ProgramNr2 = "offProgramNr2"; // not for DVB-S
private const string _Name = "offName";
private const string _NameLength = "offNameLength";
private const string _Favorites = "offFavorites"; // not for DVB-S
private const string _Deleted = "Deleted"; // hack
private const string _Favorites2 = "offFavorites2";
private const string _Encrypted = "Encrypted";
private const string _Lock = "Lock";
private const string _Skip = "Skip";
private const string _Hide = "Hide";
private const string _Moved = "ProgNrCustomized";
// DVB
private const string _ServiceId = "offServiceId";
private const string _VideoPid = "offVideoPid";
private const string _AudioPid = "offAudioPid";
private const string _OriginalNetworkId = "offOriginalNetworkId";
private const string _TransportStreamId = "offTransportStreamId";
private const string _ServiceType = "offServiceType";
protected readonly DataMapping mapping;
protected readonly byte[] rawData;
internal readonly int baseOffset;
public bool IsDeleted { get; set; }
protected TllChannelBase(DataMapping data)
{
this.mapping = data;
this.rawData = data.Data;
this.baseOffset = data.BaseOffset;
}
#region InitCommonData()
protected void InitCommonData(int slot, SignalSource signalSource, DataMapping data)
{
this.RecordIndex = slot;
this.SignalSource = signalSource;
var nr = data.GetWord(_ProgramNr);
this.SignalType = this.GetSignalType(nr);
this.OldProgramNr = (nr & 0x3FFF);
this.ParseNames();
this.Favorites = (Favorites)((data.GetByte(_Favorites2) & 0x3C) >> 2);
this.Lock = data.GetFlag(_Lock);
this.Skip = data.GetFlag(_Skip);
this.Hidden = data.GetFlag(_Hide);
this.Encrypted = data.GetFlag(_Encrypted);
this.IsDeleted = data.GetFlag(_Deleted);
}
#endregion
#region InitDvbData()
protected void InitDvbData(DataMapping data)
{
this.ServiceId = data.GetWord(_ServiceId);
//this.PcrPid = data.GetWord(_PcrPid);
this.VideoPid = data.GetWord(_VideoPid);
this.AudioPid = data.GetWord(_AudioPid);
this.OriginalNetworkId = data.GetWord(_OriginalNetworkId);
this.TransportStreamId = data.GetWord(_TransportStreamId);
this.ServiceType = data.GetByte(_ServiceType);
}
#endregion
#region GetSignalType()
protected SignalType GetSignalType(uint programNr)
{
if ((programNr & 0x4000) != 0)
return SignalType.Radio;
return SignalType.Tv;
}
#endregion
#region ParseNames()
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;
}
#endregion
#region UpdateRawData()
public override void UpdateRawData()
{
mapping.SetDataPtr(this.rawData, this.baseOffset);
mapping.SetWord(_ProgramNr, this.NewProgramNr + (this.SignalType == SignalType.Radio ? 0x4000 : 0));
mapping.SetWord(_ProgramNr2, (mapping.GetWord(_ProgramNr2) & 0x0003) | (this.NewProgramNr << 2));
if (this.IsNameModified)
{
mapping.SetString(_Name, this.Name, 40);
mapping.SetByte(_NameLength, this.Name.Length);
this.IsNameModified = false;
}
mapping.SetByte(_Favorites2, (mapping.GetByte(_Favorites2)) & 0xC3 | ((byte) this.Favorites << 2));
mapping.SetByte(_Favorites, (mapping.GetByte(_Favorites) & 0xF0) | (byte)this.Favorites);
mapping.SetFlag(_Skip, this.Skip);
mapping.SetFlag(_Lock, this.Lock);
mapping.SetFlag(_Hide, this.Hidden);
if (this.NewProgramNr == 0)
{
mapping.SetFlag(_Deleted, true);
mapping.SetByte("off"+_Moved, 0); //skip,lock,hide,moved
}
else
mapping.SetFlag(_Moved, true);
}
#endregion
#region ChangeEncoding()
public override void ChangeEncoding(System.Text.Encoding encoding)
{
this.mapping.DefaultEncoding = encoding;
this.ParseNames();
}
#endregion
}
}

View File

@@ -0,0 +1,722 @@
#define FIX_SYMBOL_RATE
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
public class TllFileSerializer : SerializerBase
{
private const long MaxFileSize = 2000000;
private readonly string ERR_fileTooBig = Resource.TllFileSerializerPlugin_ERR_fileTooBig;
private readonly string ERR_modelUnknown = Resource.TllFileSerializerPlugin_ERR_modelUnknown;
private readonly string ERR_wrongChecksum = Resource.TllFileSerializer_ERR_wrongChecksum;
private readonly string ERR_dupeChannel = Resource.TllFileSerializer_ERR_dupeChannel;
private readonly MappingPool<DataMapping> actMappings = new MappingPool<DataMapping>("Analog and DVB-C/T");
private readonly MappingPool<DataMapping> dvbsMappings = new MappingPool<DataMapping>("DVB-S");
private readonly MappingPool<FirmwareData> firmwareMappings = new MappingPool<FirmwareData>("Firmware");
private readonly Dictionary<int, DvbsDataLayout> satConfigs = new Dictionary<int, DvbsDataLayout>();
private byte[] fileContent;
private int analogBlockOffset;
private int firmwareBlockOffset;
private int dvbctBlockOffset;
private int dvbsBlockOffset;
private int[] dvbsSubblockCrcOffset;
private int settingsBlockOffset;
private int actChannelSize;
private bool reorderPhysically;
private int analogChannelCount;
private int dvbctChannelCount;
private int dvbsChannelCount;
private DvbsDataLayout satConfig;
private bool isDvbsSymbolRateDiv2;
private Dictionary<int, int> nextChannelIndex;
private int firmwareBlockSize;
private int dvbsBlockSize;
private int settingsBlockSize;
private string countryCode;
private int duplicateChannels;
private int deletedChannelsHard;
private int deletedChannelsSoft;
private int dvbsChannelsAtPr0;
private bool removeDeletedActChannels;
#region ctor()
public TllFileSerializer(string inputFile) : base(inputFile)
{
this.Features.ChannelNameEdit = true;
this.Features.EraseChannelData = true;
this.Features.FileInformation = true;
this.Features.DeviceSettings = true;
this.SupportedTvCountryCodes = new List<string>
{
"___ (None)", "AUT (Austria)", "BEL (Belgium)", "CHE (Switzerland)",
"DEU (Germany)", "ESP (Spain)", "FRA (France)", "GBR (Great Britain)",
"GRC (Greece)", "IRL (Ireland)", "ITA (Italy)", "LUX (Luxembourg)",
"NLD (Netherlands)", "PRT (Portugal)", "SVN (Slovenia)"
};
this.ReadConfigurationFromIniFile();
}
#endregion
public IList<string> SupportedTvCountryCodes { get; private set; }
#region ReadConfigurationFromIniFile()
private void ReadConfigurationFromIniFile()
{
string iniFile = Assembly.GetExecutingAssembly().Location.Replace(".dll", ".ini");
IniFile ini = new IniFile(iniFile);
foreach (var section in ini.Sections)
{
int idx = section.Name.IndexOf(":");
int recordLength = idx < 0 ? 0 : int.Parse(section.Name.Substring(idx + 1));
if (section.Name.StartsWith("DvbsBlock"))
this.satConfigs.Add(recordLength, new DvbsDataLayout(section));
else if (section.Name.StartsWith("ACTChannelDataMapping"))
actMappings.AddMapping(recordLength, new DataMapping(section));
else if (section.Name.StartsWith("SatChannelDataMapping"))
dvbsMappings.AddMapping(recordLength, new DataMapping(section));
else if (section.Name.StartsWith("FirmwareData"))
firmwareMappings.AddMapping(recordLength, new FirmwareData(section));
}
}
#endregion
#region DisplayName
public override string DisplayName { get { return "TLL loader"; } }
#endregion
#region Load()
public override void Load()
{
long fileSize = new FileInfo(this.FileName).Length;
if (fileSize > MaxFileSize)
throw new InvalidOperationException(string.Format(ERR_fileTooBig, fileSize, MaxFileSize));
this.fileContent = File.ReadAllBytes(this.FileName);
int off = 0;
this.ReadFileHeader(ref off);
this.ReadAnalogChannelBlock(ref off);
this.ReadFirmwareDataBlock(ref off);
this.ReadDvbCtChannels(ref off);
this.ReadDvbSBlock(ref off);
this.ReadSettingsBlock(ref off);
}
#endregion
#region ReadFileHeader()
private void ReadFileHeader(ref int off)
{
if (fileContent.Length < 4)
throw new InvalidOperationException(ERR_modelUnknown);
if (BitConverter.ToUInt32(fileContent, off) == 0x5A5A5A5A)
off += 4;
}
#endregion
#region ReadAnalogChannelBlock()
private void ReadAnalogChannelBlock(ref int off)
{
this.analogBlockOffset = off;
this.ReadActChannelBlock(ref off, out analogChannelCount, out actChannelSize,
(slot, data) => new AnalogChannel(slot, data));
}
#endregion
#region ReadFirmwareDataBlock()
private void ReadFirmwareDataBlock(ref int off)
{
this.firmwareBlockOffset = off;
this.firmwareBlockSize = this.GetBlockSize(off);
off += 4 + this.firmwareBlockSize;
}
#endregion
#region ReadDvbCtChannels()
private void ReadDvbCtChannels(ref int off)
{
this.dvbctBlockOffset = off;
this.ReadActChannelBlock(ref off, out dvbctChannelCount, out actChannelSize,
(slot, data) => new DtvChannel(slot, data));
}
#endregion
#region ReadDvbSBlock()
private void ReadDvbSBlock(ref int off)
{
int blockSize;
if (!IsDvbsBlock(off, out blockSize))
return;
this.dvbsBlockSize = blockSize;
this.dvbsBlockOffset = off;
off += 4;
this.satConfig = this.satConfigs.TryGet(blockSize);
if (satConfig != null)
this.ReadDvbsSubblocks(ref off);
else
{
this.DataRoot.Warnings.AppendFormat("DVB-S data format is not supported (size={0})\n", blockSize);
off += blockSize;
}
}
#endregion
#region ReadSettingsBlock()
private void ReadSettingsBlock(ref int off)
{
this.settingsBlockOffset = off;
if (this.settingsBlockOffset >= fileContent.Length)
{
this.settingsBlockOffset = 0;
return;
}
this.settingsBlockSize = this.GetBlockSize(off);
off += 4;
if (settingsBlockSize >= 8)
{
StringBuilder code = new StringBuilder();
for (int i = 6; i >= 4; i--)
code.Append((char)fileContent[off + i]);
this.countryCode = code.ToString();
}
off += settingsBlockSize;
}
#endregion
#region ReadActChannelBlock()
private void ReadActChannelBlock(ref int off, out int channelCount, out int recordSize,
Func<int, DataMapping, ChannelInfo> channelFactory)
{
recordSize = 0;
int blockSize = this.GetBlockSize(off, minSize: 2);
off += 4;
channelCount = BitConverter.ToInt32(fileContent, off);
off += 4;
if (channelCount == 0) return;
recordSize = GetActChannelRecordSize(off, blockSize, channelCount);
var actMapping = this.actMappings.GetMapping(recordSize);
this.reorderPhysically = actMapping.Settings.GetInt("reorderChannelData") != 0;
for (int i = 0; i < channelCount; i++)
{
actMapping.SetDataPtr(fileContent, off);
ChannelInfo ci = channelFactory(i, actMapping);
var list = this.DataRoot.GetChannelList(ci.SignalSource, ci.SignalType, true);
this.DataRoot.AddChannel(list, ci);
off += recordSize;
}
}
#endregion
#region GetBlockSize()
private int GetBlockSize(int off, int minSize = 0)
{
long len = BitConverter.ToUInt32(fileContent, off);
if (len < minSize || off + 4 + len > fileContent.Length)
throw new InvalidOperationException(ERR_modelUnknown);
return (int)len;
}
#endregion
#region GetActChannelRecordSize()
private int GetActChannelRecordSize(int off, int blockSize, int channelCount)
{
if ((blockSize - 4) % channelCount != 0)
throw new InvalidOperationException(ERR_modelUnknown);
int recordSize = (blockSize - 4) / channelCount;
if (off + channelCount * recordSize > fileContent.Length)
throw new InvalidOperationException(ERR_modelUnknown);
return recordSize;
}
#endregion
#region IsDvbsBlock()
private bool IsDvbsBlock(int off, out int blockSize)
{
blockSize = 0;
if (off >= fileContent.Length)
return false;
blockSize = this.GetBlockSize(off);
if (blockSize < 12)
return false;
ulong blockId = BitConverter.ToUInt64(fileContent, off + 8);
if (blockId != 0x0032532D53425644) // reverse "DVBS-S2\0"
return false;
return true;
}
#endregion
#region ReadDvbsSubblocks()
private void ReadDvbsSubblocks(ref int off)
{
this.ScanDvbSSubBlockChecksums(off);
// subblock 1 (DVBS header)
off += 16;
// subblock 2 (satellites)
off += 84; // irrelevant data
this.ReadSatellites(ref off);
// subblock 3 (transponder)
off += satConfig.sizeOfTransponderBlockHeader;
this.ReadTransponderData(ref off);
// subblock 4 (channels)
SatChannelListHeader header = new SatChannelListHeader(fileContent, off);
this.dvbsChannelCount = header.ChannelCount;
off += header.Size;
off += satConfig.dvbsMaxChannelCount/8; // skip allocation bitmap
this.ReadDvbsChannelLinkedList(ref off);
this.ReadDvbSChannels(ref off, header.LinkedListStartIndex);
// subblock 5 (satellite/LNB config)
off += satConfig.LnbBlockHeaderSize + satConfig.lnbCount*satConfig.lnbLength;
}
#endregion
#region ScanDvbSSubBlockChecksums()
private void ScanDvbSSubBlockChecksums(int off)
{
this.dvbsSubblockCrcOffset = new int[satConfig.dvbsSubblockLength.Length];
for (int i = 0; i < dvbsSubblockCrcOffset.Length; i++)
{
this.dvbsSubblockCrcOffset[i] = off;
int subblockLength = satConfig.dvbsSubblockLength[i];
uint fileCrc = BitConverter.ToUInt32(fileContent, off);
uint calcCrc = Crc32.CalcCrc32(fileContent, off + 4, subblockLength);
if (fileCrc != calcCrc)
throw new IOException(string.Format(ERR_wrongChecksum, calcCrc, fileCrc));
off += 4 + subblockLength;
}
}
#endregion
#region ReadSatellites()
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;
}
}
#endregion
#region ReadTransponderData()
private void ReadTransponderData(ref int off)
{
var data = new SatTransponder(fileContent);
data.BaseOffset = off;
for (int i=0; i<satConfig.transponderCount; i++)
{
if (data.SatIndex == 0xFF)
continue;
#if FIX_SYMBOL_RATE
ushort sr = (ushort)(data.SymbolRate & 0x7FFF);
if (sr % 100 >= 95)
data.SymbolRate = (ushort)((data.SymbolRate & 0x8000) | ((sr / 100 + 1) * 100));
#endif
Transponder transponder = new Transponder(i);
transponder.FrequencyInMhz = data.Frequency;
transponder.OriginalNetworkId = data.OriginalNetworkId;
transponder.TransportStreamId = data.TransportStreamId;
transponder.SymbolRate = data.SymbolRate & 0x7FFF;
if (data.SymbolRate == 11000)
this.isDvbsSymbolRateDiv2 = true;
var sat = this.DataRoot.Satellites.TryGet(data.SatIndex/2);
this.DataRoot.AddTransponder(sat, transponder);
data.BaseOffset += satConfig.transponderLength;
}
if (this.isDvbsSymbolRateDiv2)
{
foreach (var transponder in this.DataRoot.Transponder.Values)
transponder.SymbolRate *= 2;
}
off += this.satConfig.transponderCount * this.satConfig.transponderLength;
}
#endregion
#region ReadDvbsChannelLinkedList()
private void ReadDvbsChannelLinkedList(ref int off)
{
this.nextChannelIndex = new Dictionary<int, int>();
for (int i = 0; i < satConfig.dvbsMaxChannelCount; i++)
{
int offEntry = off + i*satConfig.sizeOfChannelIndexTableEntry;
int cur = BitConverter.ToUInt16(fileContent, offEntry + 4);
if (cur != i)
break;
this.nextChannelIndex.Add(cur, BitConverter.ToUInt16(fileContent, offEntry + 2));
}
off += satConfig.dvbsMaxChannelCount*satConfig.sizeOfChannelIndexTableEntry;
}
#endregion
#region ReadDvbSChannels()
private void ReadDvbSChannels(ref int off, int startIndex)
{
var mapping = this.dvbsMappings.GetMapping(satConfig.dvbsChannelLength);
int 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)
++this.deletedChannelsSoft;
else
{
var list = this.DataRoot.GetChannelList(ci.SignalSource, ci.SignalType, true);
var dupes = list.GetChannelByUid(ci.Uid);
if (dupes.Count == 0)
{
if (ci.OldProgramNr == 0)
++this.dvbsChannelsAtPr0;
this.DataRoot.AddChannel(list, ci);
}
else
{
// duplicate channels (ONID,TSID,SSID) cause the TV to randomly reorder channels and show wrong ones in the
// program list, so we erase all dupes here
this.DataRoot.Warnings.AppendFormat(ERR_dupeChannel, ci.RecordIndex, ci.OldProgramNr, dupes[0].RecordIndex,
dupes[0].OldProgramNr, dupes[0].Name).AppendLine();
this.EraseDuplicateDvbsChannel(recordOffset, satConfig);
++this.duplicateChannels;
}
}
if (!this.nextChannelIndex.TryGetValue(index, out index) || index == -1)
break;
}
off += satConfig.dvbsMaxChannelCount * satConfig.dvbsChannelLength;
}
#endregion
#region EraseDuplicateDvbsChannel()
private void EraseDuplicateDvbsChannel(int off, DvbsDataLayout c)
{
for (int i = 0; i < c.dvbsChannelLength; i++)
fileContent[off++] = 0xFF;
}
#endregion
#region GetSatLocation()
private string GetSatLocation(byte degree, byte fractionAndOrientation)
{
return string.Format("{0}.{1}{2}", degree, fractionAndOrientation & 0x0f, fractionAndOrientation < 16 ? "W" : "E");
}
#endregion
#region Save()
public override void Save(string tvOutputFile, string csvOutputFile)
{
int newAnalogChannelCount;
int newDvbctChannelCount;
this.UpdateRawChannelData(out newAnalogChannelCount, out newDvbctChannelCount);
if (!removeDeletedActChannels)
{
newAnalogChannelCount = this.analogChannelCount;
newDvbctChannelCount = this.dvbctChannelCount;
}
if (this.reorderPhysically || this.removeDeletedActChannels)
this.ReorderActChannelsPhysically();
if (satConfig != null)
this.UpdateDvbsChecksums();
using (var file = new BinaryWriter(new FileStream(tvOutputFile, FileMode.Create, FileAccess.Write)))
{
// header
file.Write(this.fileContent, 0, this.analogBlockOffset);
// analog
file.Write(newAnalogChannelCount*this.actChannelSize + 4);
file.Write(newAnalogChannelCount);
file.Write(fileContent, this.analogBlockOffset + 8, newAnalogChannelCount*this.actChannelSize);
// firmware
file.Write(fileContent, this.firmwareBlockOffset, this.firmwareBlockSize + 4);
// DVB-CT
file.Write(newDvbctChannelCount*this.actChannelSize + 4);
file.Write(newDvbctChannelCount);
file.Write(fileContent, this.dvbctBlockOffset + 8, newDvbctChannelCount * this.actChannelSize);
// DVB-S
if (this.dvbsBlockOffset != 0)
file.Write(fileContent, this.dvbsBlockOffset, this.dvbsBlockSize + 4);
// rest (including settings)
file.Write(fileContent, this.settingsBlockOffset, fileContent.Length - this.settingsBlockOffset);
}
}
#endregion
#region UpdateRawChannelData()
private void UpdateRawChannelData(out int newAnalogChannelCount, out int newDvbctChannelCount)
{
newAnalogChannelCount = 0;
newDvbctChannelCount = 0;
foreach (var list in this.DataRoot.ChannelLists)
{
foreach (TllChannelBase channel in list.Channels)
{
if (channel.NewProgramNr != 0)
{
if ((channel.SignalSource & SignalSource.Digital) == 0)
++newAnalogChannelCount;
else if (channel.SignalSource != SignalSource.DvbS)
++newDvbctChannelCount;
}
channel.OldProgramNr = channel.NewProgramNr;
channel.UpdateRawData();
}
}
}
#endregion
#region ReorderActChannelsPhysically()
private void ReorderActChannelsPhysically()
{
var analogTv = this.DataRoot.GetChannelList(SignalSource.AnalogCT, SignalType.Tv, false);
var analogRadio = this.DataRoot.GetChannelList(SignalSource.AnalogCT, SignalType.Radio, false);
var analog = analogTv.Channels.Union(analogRadio.Channels).ToList();
this.ReorderChannelData(this.analogBlockOffset + 8, this.actChannelSize, this.analogChannelCount, analog);
var dvbCtTv = this.DataRoot.GetChannelList(SignalSource.DvbCT, SignalType.Tv, false);
var dvbCtRadio = this.DataRoot.GetChannelList(SignalSource.DvbCT, SignalType.Radio, false);
var dvbCt = dvbCtTv.Channels.Union(dvbCtRadio.Channels).ToList();
this.ReorderChannelData(this.dvbctBlockOffset + 8, this.actChannelSize, this.dvbctChannelCount, dvbCt);
}
#endregion
#region ReorderChannelData()
private void ReorderChannelData(int channelDataOffset, int channelDataLength, int recordCount, IList<ChannelInfo> sortedList)
{
if (sortedList.Count == 0) return;
byte[] copy = new byte[recordCount * channelDataLength];
Array.Copy(fileContent, channelDataOffset, copy, 0, copy.Length);
int pTarget = channelDataOffset;
int slot = 0;
foreach (ChannelInfo appChannel in sortedList)
{
if (appChannel.NewProgramNr <= 0 && this.removeDeletedActChannels)
continue;
if (appChannel.RecordIndex != slot)
{
Array.Copy(copy, appChannel.RecordIndex*channelDataLength, fileContent, pTarget, channelDataLength);
appChannel.RecordIndex = slot;
}
++slot;
pTarget += channelDataLength;
}
}
#endregion
#region UpdateDvbsChecksums()
private void UpdateDvbsChecksums()
{
for (int i = 0; i < this.dvbsSubblockCrcOffset.Length; i++)
{
uint crc32 = Crc32.CalcCrc32(fileContent, this.dvbsSubblockCrcOffset[i] + 4, satConfig.dvbsSubblockLength[i]);
var bytes = BitConverter.GetBytes(crc32);
for (int j = 0; j < bytes.Length; j++)
fileContent[this.dvbsSubblockCrcOffset[i] + j] = bytes[j];
}
}
#endregion
#region DefaultEncoding
public override Encoding DefaultEncoding
{
get { return base.DefaultEncoding; }
set
{
if (Equals(value, this.DefaultEncoding))
return;
base.DefaultEncoding = value;
if (this.DataRoot.IsEmpty)
return;
ChangeEncoding();
}
}
#endregion
#region ChangeEncoding()
private void ChangeEncoding()
{
foreach (var list in DataRoot.ChannelLists)
{
foreach (var channel in list.Channels)
channel.ChangeEncoding(this.DefaultEncoding);
}
}
#endregion
// TvSettingsForm
#region GetFileInformation()
public override string GetFileInformation()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("ANALOG");
sb.Append("Number of data records: ").Append(this.analogChannelCount).AppendLine();
sb.Append("Length of data record: ").Append(this.actChannelSize).AppendLine();
sb.AppendLine();
sb.AppendLine();
sb.AppendLine("DVB-C/T");
sb.Append("Number of data records: ").Append(this.dvbctChannelCount).AppendLine();
sb.Append("Length of data record: ").Append(this.actChannelSize).AppendLine();
sb.AppendLine();
sb.AppendLine();
sb.AppendLine("DVB-S");
if (satConfig != null)
{
int numberOfDupePrNr;
CountDuplicateRecords(out numberOfDupePrNr);
sb.Append("Max number of data records: ").Append(satConfig.dvbsMaxChannelCount).AppendLine();
sb.Append("Length of data record: ").Append(satConfig.dvbsChannelLength).AppendLine();
sb.Append("Channel records in use: ").Append(dvbsChannelCount).AppendLine();
sb.Append("Channel records marked hard-deleted: ").Append(this.deletedChannelsHard).AppendLine();
sb.Append("Channel records marked soft-deleted: ").Append(this.deletedChannelsSoft).AppendLine();
sb.Append("Channel records erased (duplicates): ").Append(this.duplicateChannels).AppendLine();
sb.Append("Channel records with Pr# 0: ").Append(dvbsChannelsAtPr0).AppendLine();
sb.Append("Channel records with duplicate Pr#: ").Append(numberOfDupePrNr).AppendLine();
}
else
sb.AppendLine("not present");
return sb.ToString();
}
private void CountDuplicateRecords(out int numberOfDupePrNr)
{
numberOfDupePrNr = 0;
foreach (var list in this.DataRoot.ChannelLists)
{
if ((list.SignalSource & SignalSource.Sat) != 0)
numberOfDupePrNr += list.DuplicateProgNrCount;
}
}
#endregion
#region TvCountryCode
public string TvCountryCode
{
get { return this.countryCode; }
set
{
if (value.Length < 3 || this.settingsBlockOffset == 0 || this.settingsBlockSize < 8) return;
value = value.ToUpper();
int off = this.settingsBlockOffset + 4 + 4 + 2;
for (int i = 0; i < 3; i++)
this.fileContent[off--] = (byte)value[i];
this.countryCode = value;
}
}
#endregion
#region ShowDeviceSettingsForm()
public override void ShowDeviceSettingsForm(object parentWindow)
{
using (var dlg = new TvSettingsForm(this))
{
dlg.ShowDialog((Form)parentWindow);
}
}
#endregion
#region GetFirmwareMapping()
public FirmwareData GetFirmwareMapping()
{
var mapping = this.firmwareMappings.GetMapping(this.firmwareBlockSize, false);
if (mapping == null) return null;
mapping.SetDataPtr(this.fileContent, this.firmwareBlockOffset);
return mapping;
}
#endregion
// Testing
#region GetHotelMenuOffset()
public int GetHotelMenuOffset()
{
int off = this.firmwareBlockOffset;
for (int i = 6500; i < this.FirmwareBlockSize - 3; i++)
{
if (BitConverter.ToUInt32(this.fileContent, off + i) == 0x05000101) // 1,1,0,5
{
for (int j = 5; j < 20; j++) // backtrack to find Volume/MaxVolue pattern
{
if (fileContent[off + i - j] == 101 && fileContent[off + i - j - 6] == 100)
// check for Volume/MaxVolue to be 101/100
return this.firmwareBlockOffset + i - j - 15;
}
return -1;
}
}
return -1;
}
#endregion
internal int ACTChannelLength { get { return this.actChannelSize; } }
internal bool HasDvbs { get { return dvbsBlockOffset != 0; } }
internal int SatChannelLength { get { return satConfig != null ? satConfig.dvbsChannelLength : 0; } }
internal bool SatSymbolRateDiv2 { get { return this.isDvbsSymbolRateDiv2; } }
internal int FirmwareBlockSize { get { return this.firmwareBlockSize; } }
}
}

View File

@@ -0,0 +1,27 @@
using System.IO;
using ChanSort.Api;
namespace ChanSort.Plugin.TllFile
{
public class TllFileSerializerPlugin : ISerializerPlugin
{
private const int MAX_FILE_SIZE = 16*1000*1000;
private readonly string ERR_fileTooBig = Resource.TllFileSerializerPlugin_ERR_fileTooBig;
public string PluginName { get { return Resource.TllFileSerializerPlugin_PluginName; } }
public string FileFilter { get { return "*.TLL"; } }
#region CreateSerializer()
public SerializerBase CreateSerializer(string inputFile)
{
long fileSize = new FileInfo(inputFile).Length;
if (fileSize > MAX_FILE_SIZE)
throw new IOException(string.Format(ERR_fileTooBig, fileSize, MAX_FILE_SIZE));
return new TllFileSerializer(inputFile);
}
#endregion
}
}

View File

@@ -0,0 +1,223 @@
namespace ChanSort.Plugin.TllFile
{
partial class TvSettingsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TvSettingsForm));
this.grpSettings = new DevExpress.XtraEditors.GroupControl();
this.cbHbbTv = new DevExpress.XtraEditors.CheckEdit();
this.cbCustomCountry = new DevExpress.XtraEditors.CheckEdit();
this.comboBoxEdit1 = new DevExpress.XtraEditors.ComboBoxEdit();
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.btnOk = new DevExpress.XtraEditors.SimpleButton();
this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
this.grpHotelMode = new DevExpress.XtraEditors.GroupControl();
this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.cbDtvUpdate = new DevExpress.XtraEditors.CheckEdit();
this.cbHotelMode = new DevExpress.XtraEditors.CheckEdit();
this.cbAutoChannelUpdate = new DevExpress.XtraEditors.CheckEdit();
this.groupControl1 = new DevExpress.XtraEditors.GroupControl();
this.grpFirmwareNote = new DevExpress.XtraEditors.GroupControl();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
((System.ComponentModel.ISupportInitialize)(this.grpSettings)).BeginInit();
this.grpSettings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cbHbbTv.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cbCustomCountry.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit1.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.grpHotelMode)).BeginInit();
this.grpHotelMode.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cbDtvUpdate.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cbHotelMode.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cbAutoChannelUpdate.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
this.groupControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grpFirmwareNote)).BeginInit();
this.grpFirmwareNote.SuspendLayout();
this.SuspendLayout();
//
// grpSettings
//
this.grpSettings.Controls.Add(this.cbHbbTv);
this.grpSettings.Controls.Add(this.cbCustomCountry);
this.grpSettings.Controls.Add(this.comboBoxEdit1);
this.grpSettings.Controls.Add(this.labelControl1);
resources.ApplyResources(this.grpSettings, "grpSettings");
this.grpSettings.Name = "grpSettings";
//
// cbHbbTv
//
resources.ApplyResources(this.cbHbbTv, "cbHbbTv");
this.cbHbbTv.Name = "cbHbbTv";
this.cbHbbTv.Properties.Caption = resources.GetString("cbHbbTv.Properties.Caption");
//
// cbCustomCountry
//
resources.ApplyResources(this.cbCustomCountry, "cbCustomCountry");
this.cbCustomCountry.Name = "cbCustomCountry";
this.cbCustomCountry.Properties.Caption = resources.GetString("cbCustomCountry.Properties.Caption");
this.cbCustomCountry.CheckedChanged += new System.EventHandler(this.cbCustomCountry_CheckedChanged);
//
// comboBoxEdit1
//
resources.ApplyResources(this.comboBoxEdit1, "comboBoxEdit1");
this.comboBoxEdit1.Name = "comboBoxEdit1";
this.comboBoxEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(((DevExpress.XtraEditors.Controls.ButtonPredefines)(resources.GetObject("comboBoxEdit1.Properties.Buttons"))))});
this.comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
//
// labelControl1
//
resources.ApplyResources(this.labelControl1, "labelControl1");
this.labelControl1.Name = "labelControl1";
//
// btnOk
//
resources.ApplyResources(this.btnOk, "btnOk");
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Name = "btnOk";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
resources.ApplyResources(this.btnCancel, "btnCancel");
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Name = "btnCancel";
//
// grpHotelMode
//
this.grpHotelMode.Controls.Add(this.labelControl3);
this.grpHotelMode.Controls.Add(this.labelControl2);
this.grpHotelMode.Controls.Add(this.cbDtvUpdate);
this.grpHotelMode.Controls.Add(this.cbHotelMode);
resources.ApplyResources(this.grpHotelMode, "grpHotelMode");
this.grpHotelMode.Name = "grpHotelMode";
//
// labelControl3
//
resources.ApplyResources(this.labelControl3, "labelControl3");
this.labelControl3.Name = "labelControl3";
//
// labelControl2
//
resources.ApplyResources(this.labelControl2, "labelControl2");
this.labelControl2.Name = "labelControl2";
//
// cbDtvUpdate
//
resources.ApplyResources(this.cbDtvUpdate, "cbDtvUpdate");
this.cbDtvUpdate.Name = "cbDtvUpdate";
this.cbDtvUpdate.Properties.Caption = resources.GetString("cbDtvUpdate.Properties.Caption");
//
// cbHotelMode
//
resources.ApplyResources(this.cbHotelMode, "cbHotelMode");
this.cbHotelMode.Name = "cbHotelMode";
this.cbHotelMode.Properties.Caption = resources.GetString("cbHotelMode.Properties.Caption");
//
// cbAutoChannelUpdate
//
resources.ApplyResources(this.cbAutoChannelUpdate, "cbAutoChannelUpdate");
this.cbAutoChannelUpdate.Name = "cbAutoChannelUpdate";
this.cbAutoChannelUpdate.Properties.Caption = resources.GetString("cbAutoChannelUpdate.Properties.Caption");
//
// groupControl1
//
this.groupControl1.Controls.Add(this.cbAutoChannelUpdate);
resources.ApplyResources(this.groupControl1, "groupControl1");
this.groupControl1.Name = "groupControl1";
//
// grpFirmwareNote
//
this.grpFirmwareNote.Controls.Add(this.labelControl4);
resources.ApplyResources(this.grpFirmwareNote, "grpFirmwareNote");
this.grpFirmwareNote.Name = "grpFirmwareNote";
//
// labelControl4
//
resources.ApplyResources(this.labelControl4, "labelControl4");
this.labelControl4.Name = "labelControl4";
//
// TvSettingsForm
//
this.AcceptButton = this.btnOk;
this.Appearance.Options.UseBackColor = true;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.Controls.Add(this.grpHotelMode);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.grpSettings);
this.Controls.Add(this.groupControl1);
this.Controls.Add(this.grpFirmwareNote);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TvSettingsForm";
this.Load += new System.EventHandler(this.TvSettingsForm_Load);
((System.ComponentModel.ISupportInitialize)(this.grpSettings)).EndInit();
this.grpSettings.ResumeLayout(false);
this.grpSettings.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cbHbbTv.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbCustomCountry.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grpHotelMode)).EndInit();
this.grpHotelMode.ResumeLayout(false);
this.grpHotelMode.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cbDtvUpdate.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbHotelMode.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbAutoChannelUpdate.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
this.groupControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.grpFirmwareNote)).EndInit();
this.grpFirmwareNote.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.GroupControl grpSettings;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit1;
private DevExpress.XtraEditors.LabelControl labelControl1;
private DevExpress.XtraEditors.SimpleButton btnOk;
private DevExpress.XtraEditors.SimpleButton btnCancel;
private DevExpress.XtraEditors.CheckEdit cbCustomCountry;
private DevExpress.XtraEditors.GroupControl grpHotelMode;
private DevExpress.XtraEditors.CheckEdit cbHbbTv;
private DevExpress.XtraEditors.CheckEdit cbDtvUpdate;
private DevExpress.XtraEditors.CheckEdit cbHotelMode;
private DevExpress.XtraEditors.CheckEdit cbAutoChannelUpdate;
private DevExpress.XtraEditors.GroupControl groupControl1;
private DevExpress.XtraEditors.LabelControl labelControl3;
private DevExpress.XtraEditors.LabelControl labelControl2;
private DevExpress.XtraEditors.GroupControl grpFirmwareNote;
private DevExpress.XtraEditors.LabelControl labelControl4;
}
}

View File

@@ -0,0 +1,65 @@
using System;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
namespace ChanSort.Plugin.TllFile
{
public partial class TvSettingsForm : XtraForm
{
private readonly TllFileSerializer tvSerializer;
public TvSettingsForm(TllFileSerializer tvSerializer)
{
this.tvSerializer = tvSerializer;
InitializeComponent();
}
private void TvSettingsForm_Load(object sender, EventArgs e)
{
var items = tvSerializer.SupportedTvCountryCodes;
foreach(var item in items)
this.comboBoxEdit1.Properties.Items.Add(item);
this.comboBoxEdit1.Text = this.tvSerializer.TvCountryCode;
var mapping = this.tvSerializer.GetFirmwareMapping();
if (mapping != null)
{
this.cbAutoChannelUpdate.Checked = mapping.SettingsAutomaticChannelUpdate;
this.cbHbbTv.Checked = mapping.HbbTvEnabled;
this.cbHotelMode.Checked = mapping.HotelModeEnabled;
this.cbDtvUpdate.Checked = mapping.HotelModeDtvUpdate;
this.grpFirmwareNote.Visible = false;
this.Height -= this.grpFirmwareNote.Height;
}
else
{
this.cbAutoChannelUpdate.Enabled = false;
this.cbHbbTv.Enabled = false;
this.cbHotelMode.Enabled = false;
this.cbDtvUpdate.Enabled = false;
}
}
private void btnOk_Click(object sender, EventArgs e)
{
this.tvSerializer.TvCountryCode = this.comboBoxEdit1.Text;
var mapping = this.tvSerializer.GetFirmwareMapping();
if (mapping != null)
{
mapping.SettingsAutomaticChannelUpdate = this.cbAutoChannelUpdate.Checked;
mapping.HbbTvEnabled = this.cbHbbTv.Checked;
mapping.HotelModeEnabled = this.cbHotelMode.Checked;
mapping.HotelModeDtvUpdate = this.cbDtvUpdate.Checked;
}
}
private void cbCustomCountry_CheckedChanged(object sender, EventArgs e)
{
this.comboBoxEdit1.Properties.TextEditStyle = this.cbCustomCountry.Checked
? TextEditStyles.Standard
: TextEditStyles.DisableTextEditor;
}
}
}

View File

@@ -0,0 +1,325 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cbHbbTv.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbHbbTv.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cbHbbTv.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbHbbTv.Properties.Caption" xml:space="preserve">
<value>HbbTV aktivieren (funktioniert nur mit den Ländereinstellungen DEU, FRA, NED und ESP)</value>
</data>
<data name="cbHbbTv.Properties.DisplayValueChecked" xml:space="preserve">
<value />
</data>
<data name="cbHbbTv.Properties.DisplayValueGrayed" xml:space="preserve">
<value />
</data>
<data name="cbHbbTv.Properties.DisplayValueUnchecked" xml:space="preserve">
<value />
</data>
<data name="cbCustomCountry.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbCustomCountry.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbCustomCountry.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbCustomCountry.Properties.Caption" xml:space="preserve">
<value>Eigene Werte erlauben (auf eigene Gefahr!)</value>
</data>
<data name="cbCustomCountry.Properties.DisplayValueChecked" xml:space="preserve">
<value />
</data>
<data name="cbCustomCountry.Properties.DisplayValueGrayed" xml:space="preserve">
<value />
</data>
<data name="cbCustomCountry.Properties.DisplayValueUnchecked" xml:space="preserve">
<value />
</data>
<data name="comboBoxEdit1.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="comboBoxEdit1.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="comboBoxEdit1.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="comboBoxEdit1.Properties.NullValuePrompt" xml:space="preserve">
<value />
</data>
<data name="comboBoxEdit1.Properties.NullValuePromptShowForEmptyValue" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="labelControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>27, 13</value>
</data>
<data name="labelControl1.Text" xml:space="preserve">
<value>Land:</value>
</data>
<data name="grpSettings.Text" xml:space="preserve">
<value>OPTION Menü</value>
</data>
<data name="btnCancel.Text" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="labelControl3.Text" xml:space="preserve">
<value>HINWEIS: Bei aktivem Hotel-Modus kann man in der EPG nicht zum gewählten Sender wechseln und die Funktion "Werkseinstellungen" ist gesperrt.</value>
</data>
<data name="labelControl2.Size" type="System.Drawing.Size, System.Drawing">
<value>341, 13</value>
</data>
<data name="labelControl2.Text" xml:space="preserve">
<value>Die folgenden Einstellungen funktionieren nur bei aktivem Hotel-Modus:</value>
</data>
<data name="cbDtvUpdate.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbDtvUpdate.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbDtvUpdate.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbDtvUpdate.Properties.Caption" xml:space="preserve">
<value>D-TV Senderliste automatisch aktualisieren (empfohlen: AUS)</value>
</data>
<data name="cbDtvUpdate.Properties.DisplayValueChecked" xml:space="preserve">
<value />
</data>
<data name="cbDtvUpdate.Properties.DisplayValueGrayed" xml:space="preserve">
<value />
</data>
<data name="cbDtvUpdate.Properties.DisplayValueUnchecked" xml:space="preserve">
<value />
</data>
<data name="cbHotelMode.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbHotelMode.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbHotelMode.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbHotelMode.Properties.Caption" xml:space="preserve">
<value>Hotel Modus aktivieren (empfohlen: EIN)</value>
</data>
<data name="cbHotelMode.Properties.DisplayValueChecked" xml:space="preserve">
<value />
</data>
<data name="cbHotelMode.Properties.DisplayValueGrayed" xml:space="preserve">
<value />
</data>
<data name="cbHotelMode.Properties.DisplayValueUnchecked" xml:space="preserve">
<value />
</data>
<data name="grpHotelMode.Text" xml:space="preserve">
<value>Hotel Modus</value>
</data>
<data name="cbAutoChannelUpdate.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbAutoChannelUpdate.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="cbAutoChannelUpdate.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbAutoChannelUpdate.Properties.Caption" xml:space="preserve">
<value>Senderliste automatisch aktualisieren (empfohlen: AUS)</value>
</data>
<data name="cbAutoChannelUpdate.Properties.DisplayValueChecked" xml:space="preserve">
<value />
</data>
<data name="cbAutoChannelUpdate.Properties.DisplayValueGrayed" xml:space="preserve">
<value />
</data>
<data name="cbAutoChannelUpdate.Properties.DisplayValueUnchecked" xml:space="preserve">
<value />
</data>
<data name="groupControl1.Text" xml:space="preserve">
<value>EINST. Menü</value>
</data>
<data name="labelControl4.Text" xml:space="preserve">
<value>Das Dateiformat Ihres TV-Modells wird nicht vollständig unterstützt. Deshalb sind viele Einstellungen in diesem Dialog gesperrt.</value>
</data>
<data name="textEdit1.Properties.AccessibleDescription" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="textEdit1.Properties.AccessibleName" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="textEdit1.Properties.AutoHeight" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="DevExpress.XtraEditors.v12.2" name="DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="textEdit1.Properties.Mask.AutoComplete" type="DevExpress.XtraEditors.Mask.AutoCompleteType, DevExpress.XtraEditors.v12.2">
<value>Default</value>
</data>
<data name="textEdit1.Properties.Mask.BeepOnError" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="textEdit1.Properties.Mask.EditMask" xml:space="preserve">
<value />
</data>
<data name="textEdit1.Properties.Mask.IgnoreMaskBlank" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="textEdit1.Properties.Mask.MaskType" type="DevExpress.XtraEditors.Mask.MaskType, DevExpress.XtraEditors.v12.2">
<value>None</value>
</data>
<data name="textEdit1.Properties.Mask.PlaceHolder" type="System.Char, mscorlib" xml:space="preserve">
<value>_</value>
</data>
<data name="textEdit1.Properties.Mask.SaveLiteral" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="textEdit1.Properties.Mask.ShowPlaceHolders" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="textEdit1.Properties.Mask.UseMaskAsDisplayFormat" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="textEdit1.Properties.NullValuePrompt" xml:space="preserve">
<value />
</data>
<data name="textEdit1.Properties.NullValuePromptShowForEmptyValue" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="TvSettingsForm.Appearance.GradientMode" type="System.Drawing.Drawing2D.LinearGradientMode, System.Drawing">
<value>Horizontal</value>
</data>
<data name="TvSettingsForm.Appearance.Image" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="$this.Text" xml:space="preserve">
<value>TV Einstellungen</value>
</data>
</root>

View File

@@ -0,0 +1,569 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cbHbbTv.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cbHbbTv.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 64</value>
</data>
<data name="cbHbbTv.Properties.Caption" xml:space="preserve">
<value>Enable HbbTV (only works with country settings DEU, FRA, NED and ESP)</value>
</data>
<data name="cbHbbTv.Size" type="System.Drawing.Size, System.Drawing">
<value>456, 19</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cbHbbTv.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;cbHbbTv.Name" xml:space="preserve">
<value>cbHbbTv</value>
</data>
<data name="&gt;&gt;cbHbbTv.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbHbbTv.Parent" xml:space="preserve">
<value>grpSettings</value>
</data>
<data name="&gt;&gt;cbHbbTv.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="cbCustomCountry.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="cbCustomCountry.Location" type="System.Drawing.Point, System.Drawing">
<value>150, 30</value>
</data>
<data name="cbCustomCountry.Properties.Caption" xml:space="preserve">
<value>allow custom value (at your own risk!)</value>
</data>
<data name="cbCustomCountry.Size" type="System.Drawing.Size, System.Drawing">
<value>320, 19</value>
</data>
<data name="cbCustomCountry.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;cbCustomCountry.Name" xml:space="preserve">
<value>cbCustomCountry</value>
</data>
<data name="&gt;&gt;cbCustomCountry.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbCustomCountry.Parent" xml:space="preserve">
<value>grpSettings</value>
</data>
<data name="&gt;&gt;cbCustomCountry.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="comboBoxEdit1.Location" type="System.Drawing.Point, System.Drawing">
<value>72, 29</value>
</data>
<assembly alias="DevExpress.Utils.v12.2" name="DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="comboBoxEdit1.Properties.Buttons" type="DevExpress.XtraEditors.Controls.ButtonPredefines, DevExpress.Utils.v12.2">
<value>Combo</value>
</data>
<data name="comboBoxEdit1.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 20</value>
</data>
<data name="comboBoxEdit1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;comboBoxEdit1.Name" xml:space="preserve">
<value>comboBoxEdit1</value>
</data>
<data name="&gt;&gt;comboBoxEdit1.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;comboBoxEdit1.Parent" xml:space="preserve">
<value>grpSettings</value>
</data>
<data name="&gt;&gt;comboBoxEdit1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="labelControl1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 32</value>
</data>
<data name="labelControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>43, 13</value>
</data>
<data name="labelControl1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="labelControl1.Text" xml:space="preserve">
<value>Country:</value>
</data>
<data name="&gt;&gt;labelControl1.Name" xml:space="preserve">
<value>labelControl1</value>
</data>
<data name="&gt;&gt;labelControl1.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl1.Parent" xml:space="preserve">
<value>grpSettings</value>
</data>
<data name="&gt;&gt;labelControl1.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="grpSettings.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="grpSettings.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 142</value>
</data>
<data name="grpSettings.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 106</value>
</data>
<data name="grpSettings.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="grpSettings.Text" xml:space="preserve">
<value>OPTION Menu</value>
</data>
<data name="&gt;&gt;grpSettings.Name" xml:space="preserve">
<value>grpSettings</value>
</data>
<data name="&gt;&gt;grpSettings.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;grpSettings.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;grpSettings.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="btnOk.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="btnOk.Location" type="System.Drawing.Point, System.Drawing">
<value>310, 413</value>
</data>
<data name="btnOk.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="btnOk.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="btnOk.Text" xml:space="preserve">
<value>Ok</value>
</data>
<data name="&gt;&gt;btnOk.Name" xml:space="preserve">
<value>btnOk</value>
</data>
<data name="&gt;&gt;btnOk.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.SimpleButton, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;btnOk.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;btnOk.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>395, 413</value>
</data>
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="btnCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="&gt;&gt;btnCancel.Name" xml:space="preserve">
<value>btnCancel</value>
</data>
<data name="&gt;&gt;btnCancel.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.SimpleButton, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;btnCancel.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;btnCancel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<assembly alias="DevExpress.XtraEditors.v12.2" name="DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="labelControl3.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v12.2">
<value>Vertical</value>
</data>
<data name="labelControl3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 26</value>
</data>
<data name="labelControl3.Size" type="System.Drawing.Size, System.Drawing">
<value>458, 26</value>
</data>
<data name="labelControl3.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="labelControl3.Text" xml:space="preserve">
<value>NOTE: When Hotel Mode is active, you can no longer activate a channel from inside the EPG and the "Factory Reset" function becomes disabled.</value>
</data>
<data name="&gt;&gt;labelControl3.Name" xml:space="preserve">
<value>labelControl3</value>
</data>
<data name="&gt;&gt;labelControl3.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl3.Parent" xml:space="preserve">
<value>grpHotelMode</value>
</data>
<data name="&gt;&gt;labelControl3.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="labelControl2.Location" type="System.Drawing.Point, System.Drawing">
<value>41, 93</value>
</data>
<data name="labelControl2.Size" type="System.Drawing.Size, System.Drawing">
<value>315, 13</value>
</data>
<data name="labelControl2.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="labelControl2.Text" xml:space="preserve">
<value>The settings below are only effective when Hotel Mode is enabled</value>
</data>
<data name="&gt;&gt;labelControl2.Name" xml:space="preserve">
<value>labelControl2</value>
</data>
<data name="&gt;&gt;labelControl2.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl2.Parent" xml:space="preserve">
<value>grpHotelMode</value>
</data>
<data name="&gt;&gt;labelControl2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="cbDtvUpdate.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="cbDtvUpdate.Location" type="System.Drawing.Point, System.Drawing">
<value>39, 112</value>
</data>
<data name="cbDtvUpdate.Properties.Caption" xml:space="preserve">
<value>Automatic D-TV channel update (recommended: OFF)</value>
</data>
<data name="cbDtvUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>431, 19</value>
</data>
<data name="cbDtvUpdate.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="&gt;&gt;cbDtvUpdate.Name" xml:space="preserve">
<value>cbDtvUpdate</value>
</data>
<data name="&gt;&gt;cbDtvUpdate.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbDtvUpdate.Parent" xml:space="preserve">
<value>grpHotelMode</value>
</data>
<data name="&gt;&gt;cbDtvUpdate.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="cbHotelMode.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="cbHotelMode.Location" type="System.Drawing.Point, System.Drawing">
<value>10, 58</value>
</data>
<data name="cbHotelMode.Properties.Caption" xml:space="preserve">
<value>Enable Hotel Mode (recommended: ON)</value>
</data>
<data name="cbHotelMode.Size" type="System.Drawing.Size, System.Drawing">
<value>456, 19</value>
</data>
<data name="cbHotelMode.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="&gt;&gt;cbHotelMode.Name" xml:space="preserve">
<value>cbHotelMode</value>
</data>
<data name="&gt;&gt;cbHotelMode.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbHotelMode.Parent" xml:space="preserve">
<value>grpHotelMode</value>
</data>
<data name="&gt;&gt;cbHotelMode.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="grpHotelMode.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="grpHotelMode.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 248</value>
</data>
<data name="grpHotelMode.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 151</value>
</data>
<data name="grpHotelMode.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="grpHotelMode.Text" xml:space="preserve">
<value>Hotel Mode</value>
</data>
<data name="&gt;&gt;grpHotelMode.Name" xml:space="preserve">
<value>grpHotelMode</value>
</data>
<data name="&gt;&gt;grpHotelMode.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;grpHotelMode.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;grpHotelMode.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="cbAutoChannelUpdate.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="cbAutoChannelUpdate.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 35</value>
</data>
<data name="cbAutoChannelUpdate.Properties.Caption" xml:space="preserve">
<value>Automatic Channel Update (recommended: OFF)</value>
</data>
<data name="cbAutoChannelUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>456, 19</value>
</data>
<data name="cbAutoChannelUpdate.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;cbAutoChannelUpdate.Name" xml:space="preserve">
<value>cbAutoChannelUpdate</value>
</data>
<data name="&gt;&gt;cbAutoChannelUpdate.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbAutoChannelUpdate.Parent" xml:space="preserve">
<value>groupControl1</value>
</data>
<data name="&gt;&gt;cbAutoChannelUpdate.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="groupControl1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="groupControl1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 71</value>
</data>
<data name="groupControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 71</value>
</data>
<data name="groupControl1.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="groupControl1.Text" xml:space="preserve">
<value>SETUP Menu</value>
</data>
<data name="&gt;&gt;groupControl1.Name" xml:space="preserve">
<value>groupControl1</value>
</data>
<data name="&gt;&gt;groupControl1.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;groupControl1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;groupControl1.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="labelControl4.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v12.2">
<value>Vertical</value>
</data>
<data name="labelControl4.Location" type="System.Drawing.Point, System.Drawing">
<value>11, 29</value>
</data>
<data name="labelControl4.Size" type="System.Drawing.Size, System.Drawing">
<value>458, 26</value>
</data>
<data name="labelControl4.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="labelControl4.Text" xml:space="preserve">
<value>Your TV model's TLL file format is not fully supported. Therefore many features in this dialog are disabled.</value>
</data>
<data name="&gt;&gt;labelControl4.Name" xml:space="preserve">
<value>labelControl4</value>
</data>
<data name="&gt;&gt;labelControl4.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl4.Parent" xml:space="preserve">
<value>grpFirmwareNote</value>
</data>
<data name="&gt;&gt;labelControl4.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="grpFirmwareNote.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="grpFirmwareNote.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="grpFirmwareNote.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 71</value>
</data>
<data name="grpFirmwareNote.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="grpFirmwareNote.Text" xml:space="preserve">
<value>Information</value>
</data>
<data name="&gt;&gt;grpFirmwareNote.Name" xml:space="preserve">
<value>grpFirmwareNote</value>
</data>
<data name="&gt;&gt;grpFirmwareNote.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;grpFirmwareNote.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;grpFirmwareNote.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>480, 448</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>TV Settings</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>TvSettingsForm</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
</root>

View File

@@ -29,7 +29,7 @@ For providing example TLL files, error feedback and other helpful information";
private void gvPlugins_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
{
if (e.Column == this.colPlugin)
e.Value = (Path.GetFileName(e.Row.GetType().Assembly.Location) ?? "").Replace("ChanSort.Plugin.", "");
e.Value = (Path.GetFileName(e.Row.GetType().Assembly.Location) ?? "").Replace("ChanSort.Loader.", "");
}
private void picDonate_Click(object sender, System.EventArgs e)

View File

@@ -68,6 +68,7 @@ namespace ChanSort.Ui
this.grpOutputList.BindingContext = bcLeft;
this.lastFocusedGrid = this.gviewInput;
this.comboEditMode.SelectedIndex = (int) this.curEditMode;
this.comboUnsortedAction.SelectedIndex = (int)UnsortedChannelMode.Hide;
this.ActiveControl = this.gridInput;
}
#endregion
@@ -94,7 +95,7 @@ namespace ChanSort.Ui
{
var list = new List<ISerializerPlugin>();
string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
foreach (var file in Directory.GetFiles(exeDir, "ChanSort.Plugin.*.dll"))
foreach (var file in Directory.GetFiles(exeDir, "ChanSort.Loader.*.dll"))
{
try
{
@@ -185,7 +186,7 @@ namespace ChanSort.Ui
this.currentPlugin = plugin;
this.currentTvSerializer = newSerializer;
this.currentTvSerializer.DefaultEncoding = this.defaultEncoding;
this.btnResetChannelData.Visible = newSerializer.SupportsEraseChannelData;
this.btnResetChannelData.Visible = newSerializer.Features.EraseChannelData;
if (!this.LoadTvDataFile())
return;
this.LoadCsvFile();
@@ -204,8 +205,8 @@ namespace ChanSort.Ui
this.SetControlsEnabled(!this.dataRoot.IsEmpty);
this.UpdateFavoritesEditor(this.dataRoot.SupportedFavorites);
this.colName.OptionsColumn.AllowEdit = this.currentTvSerializer.SupportsChannelNameEdit;
this.colOutName.OptionsColumn.AllowEdit = this.currentTvSerializer.SupportsChannelNameEdit;
this.colName.OptionsColumn.AllowEdit = this.currentTvSerializer.Features.ChannelNameEdit;
this.colOutName.OptionsColumn.AllowEdit = this.currentTvSerializer.Features.ChannelNameEdit;
if (this.dataRoot.Warnings.Length > 0)
{
@@ -432,6 +433,7 @@ namespace ChanSort.Ui
{
this.gviewInput.BeginDataUpdate();
this.gviewOutput.BeginDataUpdate();
this.editor.AutoNumberingForUnassignedChannels((UnsortedChannelMode)this.comboUnsortedAction.SelectedIndex);
this.SaveReferenceFile();
this.SaveTvDataFile();
this.dataRoot.NeedsSaving = false;
@@ -476,7 +478,7 @@ namespace ChanSort.Ui
if (!File.Exists(bakFile))
File.Copy(currentTvFile, bakFile);
}
this.currentTvSerializer.Save(this.currentTvFile, this.currentCsvFile, (UnsortedChannelMode)this.comboUnsortedAction.SelectedIndex);
this.currentTvSerializer.Save(this.currentTvFile, this.currentCsvFile);
}
finally
{

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Ui", "ChanSort.Ui\ChanSort.Ui.csproj", "{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort", "ChanSort.Ui\ChanSort.csproj", "{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}"
ProjectSection(ProjectDependencies) = postProject
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5} = {A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE} = {E972D8A1-2F5F-421C-AC91-CFF45E5191BE}
@@ -9,42 +9,63 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Ui", "ChanSort.Ui\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Api", "ChanSort.Api\ChanSort.Api.csproj", "{DCCFFA08-472B-4D17-BB90-8F513FC01392}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Plugin.TllFile", "ChanSort.Plugin.TllFile\ChanSort.Plugin.TllFile.csproj", "{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.TllFile", "ChanSort.Plugin.TllFile\ChanSort.Loader.TllFile.csproj", "{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{67AED502-8AEB-45F2-9B95-AC42B6A5D2C4}"
ProjectSection(SolutionItems) = preProject
FileFormat.docx = FileFormat.docx
readme.txt = readme.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Plugin.TllFile", "Test.Plugin.TllFile\Test.Plugin.TllFile.csproj", "{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Loader.TllFile", "Test.Plugin.TllFile\Test.Loader.TllFile.csproj", "{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Plugin.ScmFile", "ChanSort.Plugin.ScmFile\ChanSort.Plugin.ScmFile.csproj", "{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.ScmFile", "ChanSort.Plugin.ScmFile\ChanSort.Loader.ScmFile.csproj", "{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}"
EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = ChanSort1.vsmdi
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Debug|x86.ActiveCfg = Debug|x86
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Debug|x86.Build.0 = Debug|x86
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Release|Any CPU.Build.0 = Release|Any CPU
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Release|x86.ActiveCfg = Release|x86
{5FAFDABC-A52F-498C-BD2F-AFFC4119797A}.Release|x86.Build.0 = Release|x86
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Debug|x86.ActiveCfg = Debug|x86
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Debug|x86.Build.0 = Debug|x86
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Release|Any CPU.Build.0 = Release|Any CPU
{DCCFFA08-472B-4D17-BB90-8F513FC01392}.Release|x86.ActiveCfg = Release|Any CPU
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Debug|x86.ActiveCfg = Debug|x86
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Debug|x86.Build.0 = Debug|x86
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Release|Any CPU.Build.0 = Release|Any CPU
{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}.Release|x86.ActiveCfg = Release|Any CPU
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Debug|x86.ActiveCfg = Debug|x86
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Debug|x86.Build.0 = Debug|x86
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Release|Any CPU.Build.0 = Release|Any CPU
{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}.Release|x86.ActiveCfg = Release|Any CPU
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Debug|x86.ActiveCfg = Debug|x86
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Debug|x86.Build.0 = Debug|x86
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Release|Any CPU.Build.0 = Release|Any CPU
{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution

BIN
Source.7z Normal file

Binary file not shown.

View File

@@ -9,8 +9,8 @@
<ProjectGuid>{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Test.Plugin.TllFile</RootNamespace>
<AssemblyName>Test.Plugin.TllFile</AssemblyName>
<RootNamespace>Test.Loader.TllFile</RootNamespace>
<AssemblyName>Test.Loader.TllFile</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -76,10 +76,9 @@
<Name>ChanSort.Api</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\ChanSort.Plugin.TllFile\ChanSort.Plugin.TllFile.csproj">
<ProjectReference Include="..\ChanSort.Plugin.TllFile\ChanSort.Loader.TllFile.csproj">
<Project>{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}</Project>
<Name>ChanSort.Plugin.TllFile</Name>
<Private>True</Private>
<Name>ChanSort.Loader.TllFile</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

View File

@@ -5,10 +5,10 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using ChanSort.Plugin.TllFile;
using ChanSort.Loader.TllFile;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Test.Plugin.TllFile
namespace Test.Loader.TllFile
{
[TestClass]
public class UnitTest1
@@ -52,10 +52,10 @@ namespace Test.Plugin.TllFile
new ExpectedData(@"FranzSteinert\xxCS460S-ZA00001.TLL", 0, 0, 1261, 0, 200), // ?/68
new ExpectedData(@"Klausi1\xxLK950S-ZA00001.TLL", 37, 390, 2695, 150, 491), // 184/68
new ExpectedData(@"MP3Chris2712\xxLV570S-ZB00001.TLL", 0, 12, 2895, 0, 669), // 184/68
new ExpectedData(@"decklen\xxLW570S-ZD00001.TLL", 0, 30, 1587, 0, 339), // 184/68
new ExpectedData(@"decklen\xxLW570S-ZD00001.TLL", 0, 30, 1598, 0, 339), // 184/68
new ExpectedData(@"NeuerScan\xxLM340S-ZA00001.TLL", 34, 317, 1698, 129, 264), // 188/68
new ExpectedData(@"wagnale\xxLM611S-ZA00001.TLL", 0, 13, 1094, 0, 191), // 188/68
new ExpectedData(@"_Pred\xxLM620S-ZE00021.TLL", 0, 11, 1302, 0, 191), // 192/72
new ExpectedData(@"_Pred\xxLM620S-ZE00021.TLL", 0, 11, 1303, 0, 191), // 192/72
};
foreach (var entry in expected)
@@ -70,7 +70,8 @@ namespace Test.Plugin.TllFile
#region TestLoadingAllTllFilesInTestFilesDirectory()
[TestMethod]
[DeploymentItem("ChanSort.Plugin.TllFile\\ChanSort.Plugin.TllFile.ini")]
[DeploymentItem("ChanSort.Loader.TllFile\\ChanSort.Loader.TllFile.ini")]
[DeploymentItem("ChanSort.Loader.TllFile2\\ChanSort.Loader.TllFile2.ini")]
public void TestLoadingAllTllFilesInTestFilesDirectory()
{
TllFileSerializerPlugin plugin = new TllFileSerializerPlugin();
@@ -78,10 +79,10 @@ namespace Test.Plugin.TllFile
StringBuilder errors = new StringBuilder();
var list = this.FindAllTllFiles();
var models = new Dictionary<string,string>();
var firmwareSize = new Dictionary<uint, string>();
var firmwareSize = new Dictionary<int, string>();
foreach(var file in list)
{
if (file.Contains("GlobalClone"))
if (file.Contains("GlobalClone") || file.Contains("CountrySettings"))
continue;
Debug.Print("Testing " + file);
try
@@ -103,14 +104,14 @@ namespace Test.Plugin.TllFile
models[key] = relPath;
var model = this.GetModel(file);
if (firmwareSize.ContainsKey(serializer.FirmwareDataLength))
if (firmwareSize.ContainsKey(serializer.FirmwareBlockSize))
{
string x = firmwareSize[serializer.FirmwareDataLength];
string x = firmwareSize[serializer.FirmwareBlockSize];
if (!x.Contains(model))
firmwareSize[serializer.FirmwareDataLength] = x + ", " + model;
firmwareSize[serializer.FirmwareBlockSize] = x + ", " + model;
}
else
firmwareSize[serializer.FirmwareDataLength] = model;
firmwareSize[serializer.FirmwareBlockSize] = model;