- moved all files to a "source" subdirectory to tidy up the GitHub project page

- started to write a readme.md
This commit is contained in:
hbeham
2015-06-04 13:31:43 +02:00
parent 664235b1ed
commit d4318b13a5
397 changed files with 602 additions and 0 deletions

31
source/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
DLL/SQLite.Designer.dll
DLL/SQLite.Designer.xml

View File

@@ -0,0 +1,127 @@
<?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>{DCCFFA08-472B-4D17-BB90-8F513FC01392}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Api</RootNamespace>
<AssemblyName>ChanSort.Api</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</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>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</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>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controller\ChlFileSerializer.cs" />
<Compile Include="Controller\CsvFileSerializer.cs" />
<Compile Include="Controller\Editor.cs" />
<Compile Include="Controller\ISerializerPlugin.cs" />
<Compile Include="Model\ChannelList.cs" />
<Compile Include="Model\Enums.cs" />
<Compile Include="Model\LnbConfig.cs" />
<Compile Include="Model\LookupData.cs" />
<Compile Include="Model\NetworkInfo.cs" />
<Compile Include="Model\Satellite.cs" />
<Compile Include="Model\Transponder.cs" />
<Compile Include="Resources.de.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.de.resx</DependentUpon>
</Compile>
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Utils\DependencyChecker.cs" />
<None Include="Utils\ChannelMappingBase.cs" />
<Compile Include="Utils\BrowserHelper.cs" />
<Compile Include="Utils\DataMapping.cs" />
<Compile Include="Utils\Crc32.cs" />
<Compile Include="Utils\CsvFile.cs" />
<Compile Include="Utils\DvbStringDecoder.cs" />
<Compile Include="Utils\IniFile.cs" />
<Compile Include="Model\ChannelInfo.cs" />
<Compile Include="Controller\SerializerBase.cs" />
<Compile Include="Model\DataRoot.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\MappingPool.cs" />
<Compile Include="Utils\Tools.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Lookup.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.de.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.de.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</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,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Model/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,120 @@
using System.IO;
using System.Linq;
using System.Text;
namespace ChanSort.Api
{
/// <summary>
/// Reader for SamToolBox reference lists (*.chl)
/// The file has no header, each line represents a channel and fields are separated by semi-colon:
/// Number;Channel Name[;Transponder Index]
/// </summary>
public class ChlFileSerializer
{
private static readonly char[] Separators = new[] { ';' };
private readonly StringBuilder warnings = new StringBuilder();
private int lineNumber;
private DataRoot dataRoot;
private ChannelList channelList;
#region Load()
public string Load(string fileName, DataRoot root, ChannelList list)
{
if (list.ReadOnly)
return "The current channel list is read-only";
this.lineNumber = 0;
this.dataRoot = root;
this.channelList = list;
this.warnings.Remove(0, this.warnings.Length);
foreach (var channel in this.channelList.Channels)
channel.NewProgramNr = -1;
using (var stream = new StreamReader(fileName, Encoding.Default))
{
ReadChannelsFromStream(stream);
}
return this.warnings.ToString();
}
#endregion
#region ReadChannelsFromStream()
private void ReadChannelsFromStream(TextReader stream)
{
string line;
while ((line = stream.ReadLine()) != null)
{
++lineNumber;
ParseChannel(line);
}
}
#endregion
#region ParseChannel()
private void ParseChannel(string line)
{
var parts = line.Split(Separators);
if (parts.Length < 2) return;
int progNr;
Transponder transponder = null;
if (!int.TryParse(parts[0], out progNr)) return;
if (parts.Length >= 3)
{
int transponderIndex;
if (int.TryParse(parts[2], out transponderIndex))
{
transponder = this.dataRoot.Transponder.TryGet(transponderIndex);
if (transponder == null)
warnings.AppendFormat("Line #{0,4}: invalid transponder index {1}\r\n", this.lineNumber, transponderIndex);
}
}
string name = parts[1].Replace("\"", "");
if (name.Trim().Length == 0)
return;
int found = 0;
var channels = channelList.GetChannelByName(name);
if (transponder != null)
channels = channels.Where(chan => chan.Transponder == transponder);
foreach(var channel in channels)
{
if (channel.NewProgramNr != -1)
continue;
++found;
if (found > 1)
break;
channel.NewProgramNr = progNr;
}
if (found == 0)
this.warnings.AppendFormat("Line {0,4}: Pr# {1,4}, channel '{2}' could not be found\r\n", this.lineNumber, progNr, name);
if (found > 1)
this.warnings.AppendFormat("Line {0,4}: Pr# {1,4}, channel '{2}' found multiple times\r\n", this.lineNumber, progNr, name);
}
#endregion
#region Save()
public void Save(string fileName, ChannelList list)
{
using (var writer = new StreamWriter(fileName, false, Encoding.UTF8))
{
foreach (var channel in list.Channels.OrderBy(c => c.NewProgramNr))
{
if (channel.NewProgramNr == -1) continue;
writer.Write(channel.NewProgramNr);
writer.Write(';');
writer.Write(channel.Name);
writer.WriteLine();
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ChanSort.Api
{
/// <summary>
/// Reads a reference list from a .csv file with the format
/// [dummy1],ProgramNr,[dummy2],UID,ChannelName[,SignalSource,FavAndFlags]
/// </summary>
public class CsvFileSerializer
{
private readonly HashSet<ChannelList> clearedLists = new HashSet<ChannelList>();
private readonly DataRoot dataRoot;
private readonly string fileName;
private readonly bool addChannels;
#region ctor()
public CsvFileSerializer(string fileName, DataRoot dataRoot, bool addChannels)
{
this.fileName = fileName;
this.dataRoot = dataRoot;
this.addChannels = addChannels;
}
#endregion
#region Load()
public void Load()
{
this.clearedLists.Clear();
using (var stream = new StreamReader(fileName))
this.ReadChannelsFromStream(stream);
}
#endregion
#region ReadChannelsFromStream()
public void ReadChannelsFromStream(TextReader stream)
{
int lineNr = 0;
string line = "";
try
{
while ((line = stream.ReadLine()) != null)
{
++lineNr;
this.ReadChannel(line);
}
}
catch (Exception ex)
{
throw new FileLoadException(string.Format("Error in reference file line #{0}: {1}", lineNr, line), ex);
}
}
#endregion
#region ReadChannel()
private void ReadChannel(string line)
{
var parts = CsvFile.Parse(line, ',');
if (parts.Count < 5) return;
int programNr;
if (!int.TryParse(parts[1], out programNr)) return;
string uid = parts[3];
SignalSource signalSource = GetSignalSource(ref programNr, uid, parts);
if (signalSource == 0)
return;
string name = parts[4];
ChannelList channelList = this.GetInitiallyClearedChannelList(signalSource);
if (channelList == null)
return;
IEnumerable<ChannelInfo> channels = FindChannels(channelList, name, uid);
var channel = channels == null ? null : channels.FirstOrDefault(c => c.NewProgramNr == -1);
if (channel != null)
{
if (!this.addChannels)
{
channel.NewProgramNr = programNr;
if ((channel.SignalSource & SignalSource.Analog) != 0)
{
channel.Name = name;
channel.IsNameModified = true;
}
if (parts.Count >= 7)
ApplyFlags(channel, parts[6]);
}
}
else if (parts.Count >= 6) // create proxy channel when using the new ref-list format
{
channel = new ChannelInfo(signalSource, uid, programNr, name);
if (addChannels)
{
channel.NewProgramNr = -1;
channel.OldProgramNr = programNr;
}
channelList.AddChannel(channel);
}
}
#endregion
#region GetSignalSource()
private static SignalSource GetSignalSource(ref int slot, string uid, IList<string> parts)
{
// new lists store a bitmask which defines the type of channel and list it came from
if (parts.Count >= 6 && parts[5].Length >= 4)
{
SignalSource s = 0;
string code = parts[5];
if (code[0] == 'A') s |= SignalSource.Analog;
else if (code[0] == 'D') s |= SignalSource.Digital;
if (code[1] == 'A') s |= SignalSource.Antenna;
else if (code[1] == 'C') s |= SignalSource.Cable;
else if (code[1] == 'S') s |= SignalSource.Sat;
if (code[2] == 'T') s |= SignalSource.Tv;
else if (code[2] == 'R') s |= SignalSource.Radio;
s |= (SignalSource) (int.Parse(code.Substring(3)) << 12);
return s;
}
// compatibility for older lists
bool isTv = slot < 0x4000;
slot &= 0x3FFFF;
SignalSource signalSource;
switch (uid[0])
{
case 'S': signalSource = SignalSource.DvbS; break;
case 'C': signalSource = SignalSource.DvbCT; break;
case 'A': signalSource = SignalSource.AnalogCT; break;
case 'H': signalSource = SignalSource.HdPlusD; break;
default: return 0;
}
signalSource |= isTv ? SignalSource.Tv : SignalSource.Radio;
return signalSource;
}
#endregion
#region GetInitiallyClearedChannelList()
private ChannelList GetInitiallyClearedChannelList(SignalSource signalSource)
{
var channelList = dataRoot.GetChannelList(signalSource);
if (channelList == null || channelList.ReadOnly)
return null;
if (!this.addChannels && !this.clearedLists.Contains(channelList))
{
foreach (var channel in channelList.Channels)
channel.NewProgramNr = -1;
this.clearedLists.Add(channelList);
}
return channelList;
}
#endregion
#region FindChannels()
private IEnumerable<ChannelInfo> FindChannels(ChannelList channelList, string name, string uid)
{
// if there's only a single channel with the given name, use it regardless of UID (allows for a changed freq/tranpsonder)
IList<ChannelInfo> list = channelList.GetChannelByName(name).ToList();
if (list.Count == 1)
return list;
string[] uidParts;
if (uid.StartsWith("C") && (uidParts = uid.Split('-')).Length <= 4)
{
// older CSV files didn't use the Transponder as part of the UID, which is necessary
// to distinguish between DVB-T channels with identical (onid,tsid,sid), which may be received
// from multiple regional transmitters on different transponders
int onid = int.Parse(uidParts[1]);
int tsid = int.Parse(uidParts[2]);
int sid = int.Parse(uidParts[3]);
return channelList.Channels.Where(c =>
c.OriginalNetworkId == onid &&
c.TransportStreamId == tsid &&
c.ServiceId == sid
).ToList();
}
var byUidList = channelList.GetChannelByUid(uid);
return byUidList;
}
#endregion
#region ApplyFlags()
private void ApplyFlags(ChannelInfo channel, string flags)
{
channel.Lock = false;
channel.Skip = false;
channel.Hidden = false;
foreach (char c in flags)
{
switch (c)
{
case '1': channel.Favorites |= Favorites.A; break;
case '2': channel.Favorites |= Favorites.B; break;
case '3': channel.Favorites |= Favorites.C; break;
case '4': channel.Favorites |= Favorites.D; break;
case '5': channel.Favorites |= Favorites.E; break;
case 'L': channel.Lock = true; break;
case 'S': channel.Skip = true; break;
case 'H': channel.Hidden = true; break;
case 'D': channel.IsDeleted = true; break;
}
}
}
#endregion
#region Save()
public void Save()
{
using (StreamWriter stream = new StreamWriter(fileName))
{
Save(stream);
}
}
public void Save(StreamWriter stream)
{
foreach (var channelList in dataRoot.ChannelLists)
{
foreach (var channel in channelList.Channels.Where(ch => ch.NewProgramNr != -1).OrderBy(ch => ch.NewProgramNr))
{
string line = string.Format("{0},{1},{2},{3},\"{4}\",{5},{6}",
"", // past: channel.RecordIndex,
channel.NewProgramNr,
"", // past: channel.TransportStreamId,
channel.Uid,
channel.Name,
this.EncodeSignalSource(channel.SignalSource),
this.EncodeFavoritesAndFlags(channel));
stream.WriteLine(line);
}
}
}
#endregion
#region EncodeSignalSource()
private object EncodeSignalSource(SignalSource signalSource)
{
StringBuilder sb = new StringBuilder();
if ((signalSource & SignalSource.Analog) != 0) sb.Append('A');
else sb.Append('D');
if ((signalSource & SignalSource.Antenna) != 0) sb.Append('A');
else if ((signalSource & SignalSource.Cable) != 0) sb.Append('C');
else sb.Append('S');
if ((signalSource & SignalSource.Radio) != 0) sb.Append('R');
else sb.Append('T');
sb.Append((int)signalSource >> 12);
return sb.ToString();
}
#endregion
#region EncodeFavoritesAndFlags()
private string EncodeFavoritesAndFlags(ChannelInfo channel)
{
StringBuilder sb = new StringBuilder();
if ((channel.Favorites & Favorites.A) != 0) sb.Append('1');
if ((channel.Favorites & Favorites.B) != 0) sb.Append('2');
if ((channel.Favorites & Favorites.C) != 0) sb.Append('3');
if ((channel.Favorites & Favorites.D) != 0) sb.Append('4');
if ((channel.Favorites & Favorites.E) != 0) sb.Append('5');
if (channel.Lock) sb.Append('L');
if (channel.Skip) sb.Append('S');
if (channel.Hidden) sb.Append('H');
if (channel.IsDeleted) sb.Append('D');
return sb.ToString();
}
#endregion
}
}

View File

@@ -0,0 +1,401 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChanSort.Api
{
public class Editor
{
public DataRoot DataRoot;
public ChannelList ChannelList;
public int SubListIndex;
private UnsortedChannelMode unsortedChannelMode;
#region AddChannels()
public ChannelInfo AddChannels(IList<ChannelInfo> channels)
{
int count = channels.Count(channel => channel.GetPosition(this.SubListIndex) == -1);
if (count == 0) return null;
ChannelInfo lastInsertedChannel = null;
int progNr = this.ChannelList.InsertProgramNumber;
int relativeChannelNumber = 0;
int progNrCopy = progNr; // prevent "access to modified closure" warning
foreach (
var channel in
this.ChannelList.Channels.Where(c => c.GetPosition(this.SubListIndex) >= progNrCopy)
.OrderBy(c => c.GetPosition(this.SubListIndex)))
{
var curPos = channel.GetPosition(this.SubListIndex);
int gap = count - (curPos - progNr - relativeChannelNumber);
if (gap > 0)
{
channel.SetPosition(this.SubListIndex, curPos + gap);
++relativeChannelNumber;
}
}
foreach (var channel in channels)
{
if (channel.GetPosition(this.SubListIndex) != -1)
{
// TODO notify user
continue;
}
channel.SetPosition(this.SubListIndex, progNr++);
lastInsertedChannel = channel;
}
this.ChannelList.InsertProgramNumber += count;
this.DataRoot.NeedsSaving |= lastInsertedChannel != null;
return lastInsertedChannel;
}
#endregion
#region RemoveChannels()
public void RemoveChannels(IList<ChannelInfo> channels, bool closeGap)
{
if (channels.Count == 0) return;
this.ChannelList.InsertProgramNumber = channels[0].GetPosition(this.SubListIndex);
var orderedChannelList =
this.ChannelList.Channels.Where(c => c.GetPosition(this.SubListIndex) != -1)
.OrderBy(c => c.GetPosition(this.SubListIndex));
foreach (var channel in channels)
{
if (channel.GetPosition(this.SubListIndex) == -1)
continue;
if (closeGap)
{
int prevNr = channel.GetPosition(this.SubListIndex);
foreach (var channel2 in orderedChannelList)
{
if (channel2.GetPosition(this.SubListIndex) > channel.GetPosition(this.SubListIndex))
{
// ignore deleted and proxy channels (prevNr<0), broken channels (==0) and channels after a gap
if (prevNr <= 0 || channel2.GetPosition(this.SubListIndex) != prevNr + 1)
break;
prevNr = channel2.GetPosition(this.SubListIndex);
channel2.ChangePosition(this.SubListIndex, -1);
}
}
}
channel.SetPosition(this.SubListIndex, -1);
}
this.DataRoot.NeedsSaving = true;
}
#endregion
#region MoveChannels()
public void MoveChannels(IList<ChannelInfo> channels, bool up)
{
if (channels.Count == 0)
return;
if (up && channels[0].GetPosition(this.SubListIndex) <= this.ChannelList.FirstProgramNumber)
return;
int delta = (up ? -1 : +1);
foreach (var channel in (up ? channels : channels.Reverse()))
{
int newProgramNr = channel.GetPosition(this.SubListIndex) + delta;
ChannelInfo channelAtNewPos =
this.ChannelList.Channels.FirstOrDefault(ch => ch.GetPosition(this.SubListIndex) == newProgramNr);
if (channelAtNewPos != null)
channelAtNewPos.ChangePosition(this.SubListIndex, -delta);
channel.ChangePosition(this.SubListIndex, delta);
}
this.DataRoot.NeedsSaving = true;
}
#endregion
#region SortSelectedChannels(), ChannelComparerForSortingByName()
public void SortSelectedChannels(List<ChannelInfo> selectedChannels)
{
if (selectedChannels.Count == 0) return;
var sortedChannels = new List<ChannelInfo>(selectedChannels);
sortedChannels.Sort(this.ChannelComparerForSortingByName);
var programNumbers = selectedChannels.Select(ch => ch.GetPosition(this.SubListIndex)).ToList();
for (int i = 0; i < sortedChannels.Count; i++)
sortedChannels[i].SetPosition(this.SubListIndex, programNumbers[i]);
this.DataRoot.NeedsSaving = true;
}
private int ChannelComparerForSortingByName(ChannelInfo channel1, ChannelInfo channel2)
{
return channel1.Name.CompareTo(channel2.Name);
}
#endregion
#region SetSlotNumber()
public void SetSlotNumber(IList<ChannelInfo> channels, int slot, bool swap, bool closeGap)
{
if (channels.Count == 0) return;
if (swap)
{
foreach (var channel in channels)
{
if (slot != -1)
{
var others = this.ChannelList.GetChannelByNewProgNr(slot);
foreach (var other in others)
other.SetPosition(this.SubListIndex, channel.GetPosition(this.SubListIndex));
}
channel.SetPosition(this.SubListIndex, slot++);
}
}
else
{
this.RemoveChannels(channels, closeGap);
this.ChannelList.InsertProgramNumber = slot;
this.AddChannels(channels);
}
this.DataRoot.NeedsSaving = true;
}
#endregion
#region RenumberChannels()
public void RenumberChannels(List<ChannelInfo> channels)
{
if (channels.Count == 0) return;
int progNr = channels.Min(ch => ch.GetPosition(this.SubListIndex));
foreach (var channel in channels)
{
if (channel.GetPosition(this.SubListIndex) == progNr)
{
++progNr;
continue;
}
var list = new List<ChannelInfo>();
list.Add(channel);
this.RemoveChannels(list, false);
this.ChannelList.InsertProgramNumber = progNr++;
this.AddChannels(list);
this.DataRoot.NeedsSaving = true;
}
}
#endregion
#region ApplyReferenceList()
public void ApplyReferenceList(DataRoot refDataRoot)
{
foreach (var channelList in this.DataRoot.ChannelLists)
{
foreach (var channel in channelList.Channels)
channel.SetPosition(this.SubListIndex, -1);
}
StringBuilder log = new StringBuilder();
foreach (var refList in refDataRoot.ChannelLists)
{
var tvList = this.DataRoot.GetChannelList(refList.SignalSource);
if (tvList == null)
{
log.AppendFormat("Skipped reference list {0}\r\n", refList.ShortCaption);
continue;
}
foreach (var refChannel in refList.Channels)
{
var tvChannels = tvList.GetChannelByUid(refChannel.Uid);
ChannelInfo tvChannel = tvChannels.FirstOrDefault(c => c.GetPosition(this.SubListIndex) == -1);
if (tvChannel != null)
{
tvChannel.SetPosition(this.SubListIndex, refChannel.OldProgramNr);
tvChannel.Favorites = refChannel.Favorites & DataRoot.SupportedFavorites;
tvChannel.Skip = refChannel.Skip;
tvChannel.Lock = refChannel.Lock;
tvChannel.Hidden = refChannel.Hidden;
tvChannel.IsDeleted = refChannel.IsDeleted;
if ((tvChannel.SignalSource & SignalSource.Analog) != 0)
{
tvChannel.Name = refChannel.Name;
tvChannel.IsNameModified = true;
}
if (this.DataRoot.SortedFavorites)
{
if (refDataRoot.SortedFavorites)
{
var c = Math.Min(refChannel.FavIndex.Count, tvChannel.FavIndex.Count);
for (int i = 0; i < c; i++)
tvChannel.FavIndex[i] = refChannel.FavIndex[i];
}
else
{
this.ApplyPrNrToFavLists(tvChannel);
}
}
}
else
{
tvChannel = new ChannelInfo(refChannel.SignalSource, refChannel.Uid, refChannel.OldProgramNr,
refChannel.Name);
tvList.AddChannel(tvChannel);
}
}
}
}
#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 == -1 && mode == UnsortedChannelMode.MarkDeleted)
continue;
int progNr = GetNewPogramNr(appChannel, ref maxProgNr);
appChannel.NewProgramNr = progNr;
}
}
}
#region ChanSortCriteria()
private string ChanSortCriteria(ChannelInfo channel)
{
// explicitly sorted
if (channel.GetPosition(this.SubListIndex) != -1)
return channel.GetPosition(this.SubListIndex).ToString("d4");
// eventually hide unsorted channels
if (this.unsortedChannelMode == UnsortedChannelMode.MarkDeleted)
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 GetNewPogramNr()
private int GetNewPogramNr(ChannelInfo appChannel, ref int maxPrNr)
{
int prNr = appChannel.NewProgramNr;
if (prNr > maxPrNr)
maxPrNr = prNr;
if (prNr == -1)
{
if (appChannel.OldProgramNr != -1 && this.unsortedChannelMode != UnsortedChannelMode.MarkDeleted)
prNr = ++maxPrNr;
}
return prNr;
}
#endregion
#endregion
#region SetFavorites()
public void SetFavorites(List<ChannelInfo> list, Favorites favorites, bool set)
{
bool sortedFav = this.DataRoot.SortedFavorites;
int favIndex = 0;
if (sortedFav)
{
for (int mask = (int) favorites; (mask & 1) == 0; mask >>= 1)
++favIndex;
}
if (set)
{
int maxPosition = 0;
if (sortedFav)
{
foreach (var channel in this.ChannelList.Channels)
maxPosition = Math.Max(maxPosition, channel.FavIndex[favIndex]);
}
foreach (var channel in list)
{
if (sortedFav && channel.FavIndex[favIndex] == -1)
channel.FavIndex[favIndex] = ++maxPosition;
channel.Favorites |= favorites;
}
}
else
{
foreach (var channel in list)
{
if (sortedFav && channel.FavIndex[favIndex] != -1)
{
channel.FavIndex[favIndex] = -1;
// TODO close gap by pulling down higher numbers
}
channel.Favorites &= ~favorites;
}
}
}
#endregion
#region ApplyPrNrToFavLists()
public void ApplyPrNrToFavLists()
{
if (!this.DataRoot.SortedFavorites)
return;
foreach (var list in this.DataRoot.ChannelLists)
{
foreach(var channel in list.Channels)
this.ApplyPrNrToFavLists(channel);
}
}
/// <summary>
/// Set the number inside the favorites list to the same number as Pr#
/// </summary>
/// <param name="tvChannel"></param>
private void ApplyPrNrToFavLists(ChannelInfo tvChannel)
{
var supMask = (int)this.DataRoot.SupportedFavorites;
var refMask = (int)tvChannel.Favorites;
for (int i = 0; supMask != 0; i++)
{
tvChannel.FavIndex[i] = (refMask & 0x01) == 0 ? -1 : tvChannel.OldProgramNr;
supMask >>= 1;
refMask >>= 1;
}
}
#endregion
}
}

View File

@@ -0,0 +1,21 @@
namespace ChanSort.Api
{
public interface ISerializerPlugin
{
/// <summary>
/// Name of the plugin, as displayed in the OpenFileDialog file-type selection combo box
/// </summary>
string PluginName { get; }
/// <summary>
/// Semicolon separated list of supported file types (e.g. "xxLM*.TTL;xxLV*.TTL")
/// </summary>
string FileFilter { get; }
/// <summary>
/// Create an object that can read/write the file
/// </summary>
/// <exception cref="System.IO.IOException">file is not of any supported type</exception>
SerializerBase CreateSerializer(string inputFile);
}
}

View File

@@ -0,0 +1,84 @@
using System.Text;
namespace ChanSort.Api
{
public abstract class SerializerBase
{
public class SupportedFeatures
{
public bool ChannelNameEdit { get; set; }
public bool CleanUpChannelData { get; set; }
public bool DeviceSettings { get; set; }
public bool CanDeleteChannels { get; set; }
public bool CanHaveGaps { get; set; }
public SupportedFeatures()
{
this.CanDeleteChannels = true;
this.CanHaveGaps = true;
}
}
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");
}
public abstract string DisplayName { get; }
public abstract void Load();
public abstract void Save(string tvOutputFile);
public virtual Encoding DefaultEncoding
{
get { return this.defaultEncoding; }
set { this.defaultEncoding = value; }
}
public virtual void EraseChannelData() { }
public virtual string GetFileInformation()
{
StringBuilder sb = new StringBuilder();
sb.Append("File name: ").AppendLine(this.FileName);
sb.AppendLine();
foreach (var list in this.DataRoot.ChannelLists)
{
sb.Append(list.ShortCaption).AppendLine("-----");
sb.Append("number of channels: ").AppendLine(list.Count.ToString());
sb.Append("number of predefined channel numbers: ").AppendLine(list.PresetProgramNrCount.ToString());
sb.Append("number of duplicate program numbers: ").AppendLine(list.DuplicateProgNrCount.ToString());
sb.Append("number of duplicate channel identifiers: ").AppendLine(list.DuplicateUidCount.ToString());
int deleted = 0;
int hidden = 0;
int skipped = 0;
foreach (var channel in list.Channels)
{
if (channel.IsDeleted)
++deleted;
if (channel.Hidden)
++hidden;
if (channel.Skip)
++skipped;
}
sb.Append("number of deleted channels: ").AppendLine(deleted.ToString());
sb.Append("number of hidden channels: ").AppendLine(hidden.ToString());
sb.Append("number of skipped channels: ").AppendLine(skipped.ToString());
sb.AppendLine();
}
return sb.ToString();
}
public virtual void ShowDeviceSettingsForm(object parentWindow) { }
public virtual string CleanUpChannelData() { return ""; }
}
}

View File

@@ -0,0 +1,427 @@
ONID;Start;End;Name;Operator
ONID;0x0000;0x0000;(Reserved);(Reserved)
ONID;0x0001;0x0001;Société Européenne des Satellites;Société Européenne des Satellites
ONID;0x0002;0x0002;Société Européenne des Satellites;Société Européenne des Satellites
ONID;0x0003;0x0019;Société Européenne des Satellites;Société Européenne des Satellites
ONID;0x001A;0x001A;Quiero Televisión  ;Quiero Televisión  
ONID;0x001B;0x001B;RAI;RAI
ONID;0x001C;0x001C;Hellas-Sat S.A.;Hellas-Sat S.A.
ONID;0x001D;0x001D;TELECOM ITALIA MEDIA BROADCASTING SRL;TELECOM ITALIA MEDIA BROADCASTING SRL
ONID;0x001F;0x001F;Europe Online Networks S.A  ;Europe Online Networks S.A  
ONID;0x0020;0x0020;Société Européenne des Satellites;Société Européenne des Satellites
ONID;0x0021;0x0021;Hispasat S.A .;Hispasat S.A .
ONID;0x0022;0x0022;Hispasat S.A .;Hispasat S.A .
ONID;0x0023;0x0023;Hispasat S.A .;Hispasat S.A .
ONID;0x0024;0x0024;Hispasat S.A .;Hispasat S.A .
ONID;0x0025;0x0025;Hispasat S.A .;Hispasat S.A .
ONID;0x0026;0x0026;Hispasat S.A .;Hispasat S.A .
ONID;0x0027;0x0027;Hispasat FSS;Hispasat FSS
ONID;0x0028;0x0028;Hispasat DBS;Hispasat DBS
ONID;0x0029;0x0029;Hispasat America;Hispasat America
ONID;0x002A;0x002A;Päijät-Hämeen Puhelin Oyj;Päijät-Hämeen Puhelin Oyj
ONID;0x002B;0x002B;Digita Oy;Digita Oy
ONID;0x002E;0x002E;Xantic BU Broadband;Xantic BU Broadband
ONID;0x002F;0x002F;TVNZ  ;TVNZ  
ONID;0x0030;0x0030;Canal+ SA (for Intelsat 601-325°E);Canal+ SA (for Intelsat 601-325°E)
ONID;0x0031;0x0031;Hispasat S.A.;Hispasat S.A.
ONID;0x0032;0x0032;Hispasat S.A.;Hispasat S.A.
ONID;0x0033;0x0033;Hispasat S.A.;Hispasat S.A.
ONID;0x0034;0x0034;Hispasat S.A.;Hispasat S.A.
ONID;0x0035;0x0035;NetHold IMS;NetHold IMS
ONID;0x0036;0x0036;TV Cabo Portugal  ;TV Cabo Portugal  
ONID;0x0037;0x0037;France Telecom, CNES and DGA;France Telecom, CNES and DGA
ONID;0x0038;0x0038;Hellenic Telecommunications Organization S.A .;Hellenic Telecommunications Organization S.A .
ONID;0x0039;0x0039;Broadcast Australia Pty.;Broadcast Australia Pty.
ONID;0x003A;0x003A;GeoTelecom Satellite Services;GeoTelecom Satellite Services
ONID;0x003B;0x003B;BBC;BBC
ONID;0x003C;0x003C;KPN Broadcast Services;KPN Broadcast Services
ONID;0x003D;0x003D;Skylogic Italia S.A.;Skylogic Italia S.A.
ONID;0x003E;0x003E;Eutelsat S.A.;Eutelsat S.A.
ONID;0x003F;0x003F;Eutelsat S.A.;Eutelsat S.A.
ONID;0x0040;0x0040;Hrvatski Telekom d.d;Hrvatski Telekom d.d
ONID;0x0041;0x0041;Mindport  ;Mindport  
ONID;0x0042;0x0042;DTV haber ve Gorsel yayýncilik;DTV haber ve Gorsel yayýncilik
ONID;0x0043;0x0043;arena Sport Rechte und Marketing GmbH;arena Sport Rechte und Marketing GmbH
ONID;0x0044;0x0044;VisionTV LLC;VisionTV LLC
ONID;0x0045;0x0045;SES-Sirius;SES-Sirius
ONID;0x0046;0x0046;Telenor ;Telenor 
ONID;0x0047;0x0047;Telenor;Telenor
ONID;0x0048;0x0048;STAR DIGITAL A.S .;STAR DIGITAL A.S .
ONID;0x0049;0x0049;Sentech  ;Sentech  
ONID;0x004A;0x004B;Rambouillet ES;Rambouillet ES
ONID;0x004C;0x004C;Skylogic S.A.;Skylogic S.A.
ONID;0x004D;0x004D;Skylogic S.A.;Skylogic S.A.
ONID;0x004E;0x004F;Eutelsat S.A.;Eutelsat S.A.
ONID;0x0050;0x0050;HRT Croatian Radio and Television;HRT Croatian Radio and Television
ONID;0x0051;0x0051;Havas ;Havas 
ONID;0x0052;0x0052;StarGuide Digital Networks ;StarGuide Digital Networks 
ONID;0x0053;0x0053;PT Comunicações;PT Comunicações
ONID;0x0054;0x0054;Teracom AB Satellite Services;Teracom AB Satellite Services
ONID;0x0055;0x0055;NSAB (Teracom);NSAB (Teracom)
ONID;0x0056;0x0056;Viasat Satellite Services AB;Viasat Satellite Services AB
ONID;0x0058;0x0058;UBC Thailand ;UBC Thailand 
ONID;0x0059;0x0059;Bharat Business Channel Limited;Bharat Business Channel Limited
ONID;0x005A;0x005A;ICO Satellite Services G.P.;ICO Satellite Services G.P.
ONID;0x005B;0x005B;ZON;ZON
ONID;0x005E;0x005E;NSAB ;NSAB 
ONID;0x005F;0x005F;NSAB ;NSAB 
ONID;0x0060;0x0060;Kabel Deutschland ;Kabel Deutschland 
ONID;0x0064;0x0064;T-Kábel;T-Kábel Magyarország Kft.
ONID;0x0065;0x0065;France Telecom Orange;France Telecom Orange
ONID;0x0066;0x0066;Zweites Deutsches Fernsehen - ZDF (cable contribution);Zweites Deutsches Fernsehen - ZDF
ONID;0x0069;0x0069;Optus B3 156°E;Optus Communications
ONID;0x0070;0x0070;BONUM1 36 Degrees East;NTV+
ONID;0x0073;0x0073;PanAmSat 4 68.5°E;Pan American Satellite System
ONID;0x007D;0x007D;Skylogic;Skylogic Italia
ONID;0x007E;0x007F;Eutelsat Satellite System at 7°E;EUTELSAT European Telecommunications Satellite Organization 
ONID;0x0085;0x0085;BetaTechnik;BetaTechnik
ONID;0x0090;0x0090;National network;TDF
ONID;0x009A;0x009B;Eutelsat satellite system at 9°East;Rambouillet ES
ONID;0x009C;0x009D;Eutelsat satellite system at 9°East;Skylogic S.A.
ONID;0x009E;0x009F;Eutelsat satellite system at 9°East;Eutelsat S.A.
ONID;0x00A0;0x00A0;National Cable Network;News Datacom
ONID;0x00A1;0x00A1;DigiSTAR;STAR Television Productions Ltd (HK) (NDS)
ONID;0x00A2;0x00A2;Sky Entertainment Services;NetSat Serviços Ltda (Brazil), Innova S. de R. L. (Mexico) and Multicountry Partnership L. P. (NDS)
ONID;0x00A3;0x00A3;NDS Director systems;Various (product only sold by Tandberg TV) (NDS)
ONID;0x00A4;0x00A4;ISkyB;STAR Television Productions Ltd (HK) (NDS)
ONID;0x00A5;0x00A5;Indovision;PT. Matahari Lintas Cakrawala (MLC) (NDS)
ONID;0x00A6;0x00A6;ART;ART (NDS)
ONID;0x00A7;0x00A7;Globecast;France Telecom (NDS)
ONID;0x00A8;0x00A8;Foxtel;Foxtel (Australia) (NDS)
ONID;0x00A9;0x00A9;Sky New Zealand;Sky Network Television Ltd (NDS)
ONID;0x00AA;0x00AA;OTE;OTE (Greece) (NDS)
ONID;0x00AB;0x00AB;Yes Satellite Services;DBS (Israel) (NDS)
ONID;0x00AC;0x00AC;(NDS satellite services);(NDS to be allocated)
ONID;0x00AD;0x00AD;SkyLife;Korea Digital Broadcasting
ONID;0x00AE;0x00AF;(NDS satellite services);(NDS to be allocated)
ONID;0x00B0;0x00B3;TPS;La Télévision Par Satellite
ONID;0x00B4;0x00B4;Telesat 107.3°W;Telesat Canada
ONID;0x00B5;0x00B5;Telesat 111.1°W;Telesat Canada
ONID;0x00B6;0x00B6;Telstra Saturn;TelstraSaturn Limited  
ONID;0x00BA;0x00BA;Satellite Express 6 (80°E);Satellite Express 
ONID;0x00C0;0x00CD;Canal +;Canal+
ONID;0x00D0;0x00D0;CCTV;China Central Television (NDS)
ONID;0x00D1;0x00D1;Galaxy;Galaxy Satellite Broadcasting, Hong Kong (NDS)
ONID;0x00D2;0x00DF;(NDS satellite services);(NDS to be allocated)
ONID;0x00EB;0x00EB;Eurovision Network;European Broadcasting Union  
ONID;0x0100;0x0100;ExpressVu;ExpressVu Inc.
ONID;0x0101;0x0101;Bulsatcom AD;Bulsatcom AD
ONID;0x0104;0x0104;MagtiSat;Magticom Ltd.
ONID;0x010D;0x010D;Skylogic;Skylogic Italia
ONID;0x010E;0x010F;Eutelsat Satellite System at 10°E;European Telecommunications Satellite Organization
ONID;0x0110;0x0110;Mediaset;Mediaset 
ONID;0x011F;0x011F;visAvision Network;European Telecommunications Satellite Organization
ONID;0x013D;0x013D;Skylogic;Skylogic Italia
ONID;0x013E;0x013F;Eutelsat Satellite System 13°E;European Telecommunications Satellite Organization
ONID;0x016D;0x016D;Skylogic;Skylogic Italia
ONID;0x016E;0x016F;Eutelsat Satellite System at 16°E;European Telecommunications Satellite Organization
ONID;0x0170;0x0170;Audio Visual Global Joint Stock Company;Audio Visual Global Joint Stock Company
ONID;0x01F4;0x01F4;MediaKabel B.V;
ONID;0x022D;0x022D;Skylogic;Skylogic Italia
ONID;0x022E;0x022F;Eutelsat Satellite System at 21.5°E;EUTELSAT European Telecommunications Satellite Organization 
ONID;0x026D;0x026D;Skylogic;Skylogic Italia
ONID;0x026E;0x026F;Eutelsat Satellite System at 25.5°E;EUTELSAT European Telecommunications Satellite Organization 
ONID;0x029D;0x029D;Skylogic;Skylogic Italia
ONID;0x029E;0x029F;Eutelsat Satellite System at 29°E;European Telecommunications Satellite Organization
ONID;0x02BE;0x02BE;ARABSAT;ARABSAT - Arab Satellite Communications Organization
ONID;0x02C0;0x02C0;MTV Networks Europe;MTV Networks Europe
ONID;0x033D;0x033D;Skylogic at 33°E;Skylogic Italia
ONID;0x033E;0x033F;Eutelsat Satellite System at 33°E;Eutelsat
ONID;0x034E;0x034E;IRIB;IRIB
ONID;0x036D;0x036D;Skylogic;Skylogic Italia
ONID;0x036E;0x036F;Eutelsat Satellite System at 36°E;European Telecommunications Satellite Organization
ONID;0x03E8;0x03E8;Telia;Telia, Sweden
ONID;0x045D;0x045F;Eutelsat satellite system at 15°West;Eutelsat S.A.
ONID;0x047D;0x047D;Skylogic;Skylogic Italia
ONID;0x047E;0x047F;Eutelsat Satellite System at 12.5°W;EUTELSAT European Telecommunications Satellite Organization 
ONID;0x048D;0x048D;Skylogic;Skylogic Italia
ONID;0x048E;0x048F;Eutelsat Satellite System at 48°E;European Telecommunications Satellite Organization
ONID;0x049D;0x049F;Eutelsat satellite system at 11°West;Eutelsat S.A.
ONID;0x0500;0x0500;Vinasat Center;Vinasat Center
ONID;0x0510;0x0510;Almajd;Almajd Satellite Broadcasting FZ LLC
ONID;0x052D;0x052D;Skylogic;Skylogic Italia
ONID;0x052E;0x052F;Eutelsat Satellite System at 8°W;EUTELSAT European Telecommunications Satellite Organization 
ONID;0x053D;0x053F;Eutelsat satellite system at 53°East;Eutelsat S.A.
ONID;0x055D;0x055D;Skylogic at 5°W;Skylogic Italia
ONID;0x055E;0x055F;Eutelsat Satellite System at 5°W;Eutelsat
ONID;0x0600;0x0600;UPC Satellite;UPC  
ONID;0x0601;0x0601;UPC Cable;UPC  
ONID;0x0602;0x0602;Tevel;Tevel Cable (Israel )
ONID;0x071D;0x071D;Skylogic at 70.5°E;Skylogic Italia
ONID;0x071E;0x071F;Eutelsat Satellite System at 70.5°E;Eutelsat S.A.
ONID;0x077D;0x077D;Skylogic Satellite System at 7°W;Skylogic Italia
ONID;0x077E;0x077F;Eutelsat Satellite System at 7°W;Eutelsat S.A.
ONID;0x0800;0x0801;Nilesat 101;Nilesat
ONID;0x0880;0x0880;MEASAT 1, 91.5°E;MEASAT Broadcast Network Systems SDN. BHD. (Kuala Lumpur, Malaysia)
ONID;0x0882;0x0882;MEASAT 2, 91.5°E;MEASAT Broadcast Network Systems SDN. BHD. (Kuala Lumpur, Malaysia)
ONID;0x0883;0x0883;MEASAT 2, 148.0°E;Hsin Chi Broadcast Company Ltd .
ONID;0x088F;0x088F;MEASAT 3;MEASAT Broadcast Network Systems SDN. BHD. (Kuala Lumpur, Malaysia)
ONID;0x08A0;0x08A0;Mainland Television Limited;Mainland Television Limited
ONID;0x0E26;0x0E26;IRIB;IRIB
ONID;0x0FFF;0x0FFF;Optus Networks;Optus Networks
ONID;0x1000;0x1000;Optus B3 156°E;Optus Communications
ONID;0x1001;0x1001;DISH Network;Echostar Communications
ONID;0x1002;0x1002;Dish Network 61.5 W;Echostar Communications
ONID;0x1003;0x1003;Dish Network 83 W;Echostar Communications
ONID;0x1004;0x1004;Dish Network 119 W;Echostar Communications
ONID;0x1005;0x1005;Dish Network 121 W;Echostar Communications
ONID;0x1006;0x1006;Dish Network 148 W;Echostar Communications
ONID;0x1007;0x1007;Dish Network 175 W;Echostar Communications
ONID;0x1008;0x100B;Dish Network W - Z;Echostar Communications
ONID;0x1010;0x1010;ABC TV;Australian Broadcasting Corporation  
ONID;0x1011;0x1011;SBS;SBS Australia  
ONID;0x1012;0x1012;Nine Network Australia;Nine Network Australia  
ONID;0x1013;0x1013;Seven Network Australia;Seven Network Limited  
ONID;0x1014;0x1014;Network TEN Australia;Network TEN Limited  
ONID;0x1015;0x1015;WIN Television Australia;WIN Television Pty Ltd  
ONID;0x1016;0x1016;Prime Television Australia;Prime Television Limited  
ONID;0x1017;0x1017;Southern Cross Broadcasting Australia;Southern Cross Broadcasting (Australia) Limited  
ONID;0x1018;0x1018;Telecasters Australia;Telecasters Australia Limited  
ONID;0x1019;0x1019;NBN Australia;NBN Limited  
ONID;0x101A;0x101A;Imparja Television Australia;Imparja Television Australia 
ONID;0x101B;0x101F;(Reserved for Australian broadcaster);(Reserved for Australian broadcasters)
ONID;0x1100;0x1100;GE Americom;GE American Communications
ONID;0x1101;0x1101;MiTV Networks Broadcast Terrestrial Network - DVB-H;MiTV Networks Sdn Bhd Malaysia
ONID;0x1102;0x1102;Dream Mobile TV;Philippines Multimedia System, Inc.
ONID;0x1103;0x1103;PT MAC;PT. Mediatama Anugrah Citra
ONID;0x1104;0x1104;Levira Mobile TV;Levira AS
ONID;0x1105;0x1105;Mobision;Alsumaria TV
ONID;0x1106;0x1106;Trenmobile;PT. Citra Karya Investasi
ONID;0x1107;0x1107;VTC Mobile TV;VTC Mobile TV
ONID;0x1700;0x1700;Echostar 2A;EchoStar Communications
ONID;0x1701;0x1701;Echostar 2B;EchoStar Communications
ONID;0x1702;0x1702;Echostar 2C;EchoStar Communications
ONID;0x1703;0x1703;Echostar 2D;EchoStar Communications
ONID;0x1704;0x1704;Echostar 2E;EchoStar Communications
ONID;0x1705;0x1705;Echostar 2F;EchoStar Communications
ONID;0x1706;0x1706;Echostar 2G;EchoStar Communications
ONID;0x1707;0x1707;Echostar 2H;EchoStar Communications
ONID;0x1708;0x1708;Echostar 2I;EchoStar Communications
ONID;0x1709;0x1709;Echostar 2J;EchoStar Communications
ONID;0x170A;0x170A;Echostar 2K;EchoStar Communications
ONID;0x170B;0x170B;Echostar 2L;EchoStar Communications
ONID;0x170C;0x170C;Echostar 2M;EchoStar Communications
ONID;0x170D;0x170D;Echostar 2N;EchoStar Communications
ONID;0x170E;0x170E;Echostar 2O;EchoStar Communications
ONID;0x170F;0x170F;Echostar 2P;EchoStar Communications
ONID;0x1710;0x1710;Echostar 2Q;EchoStar Communications
ONID;0x1711;0x1711;Echostar 2R;EchoStar Communications
ONID;0x1712;0x1712;Echostar 2S;EchoStar Communications
ONID;0x1713;0x1713;Echostar 2T;EchoStar Communications
ONID;0x1714;0x1714;Platforma HD;Platforma HD Ltd.
ONID;0x1715;0x1715;Profit Group Terrestrial;Profit Group SpA
ONID;0x1716;0x1716;JSC Mostelekom;JSC Mostelekom
ONID;0x2000;0x2000;Thiacom 1 & 2 co-located 78.5°E;Shinawatra Satellite
ONID;0x2014;0x2014;DTT - Andorran Digital Terrestrial Television;STA
ONID;0x2024;0x2024;Australian Digital Terrestrial Television;Australian Broadcasting Authority 
ONID;0x2028;0x2028;Austrian Digital Terrestrial Television;ORS - Austrian Broadcasting Services
ONID;0x2038;0x2038;Belgian Digital Terrestrial Television;BIPT
ONID;0x209E;0x209E;Taiwanese Digital Terrestrial Television;Directorate General of Telecommunications
ONID;0x20AA;0x20AA;Comision Nacional de Television de Colombia;Comision Nacional de Television de Colombia
ONID;0x20BF;0x20BF;Croatian Post and Electronic Communications Agency (HAKOM);Croatian Post and Electronic Communications Agency (HAKOM)
ONID;0x20C4;0x20C4;Office Of the Commissioner of Electronic Communications and Postal Regulation;Office Of the Commissioner of Electronic Communications and Postal Regulation
ONID;0x20CB;0x20CB;Czech Republic Digital Terrestrial Television;Czech Digital Group  
ONID;0x20D0;0x20D0;Danish Digital Terrestrial Television;National Telecom Agency Denmark  
ONID;0x20E9;0x20E9;Estonian Digital Terrestrial Television;Estonian National Communications Board
ONID;0x20F6;0x20F6;Finnish Digital Terrestrial Television;Telecommunicatoins Administratoin Centre, Finland  
ONID;0x20FA;0x20FA;French Digital Terrestrial Television;Conseil Superieur de l'AudioVisuel
ONID;0x2114;0x2114;German Digital Terrestrial Television;IRT on behalf of the German DVB-T broadcasts 
ONID;0x2124;0x2124;Gibraltar Regulatory Authority;Gibraltar Regulatory Authority
ONID;0x2168;0x2168;Digital Terrestrial Network of Indonesia;Ministry of Communication and Information Technology of the Republic of Indonesia
ONID;0x2174;0x2174;Irish Digital Terrestrial Television;Irish Telecommunications Regulator  
ONID;0x2178;0x2178;Israeli Digital Terrestrial Television;BEZEQ (The Israel Telecommunication Corp Ltd .)
ONID;0x217C;0x217C;Italian Digital Terrestrial Television;
ONID;0x21AC;0x21AC;DTT - Latvian Digital Terrestrial Television;Electronic Communications Office
ONID;0x21B8;0x21B8;DTT Lithuania;Communications Regulatory Authority
ONID;0x21CA;0x21CA;Malaysian Technical Standards Forum Bhd (MTFSB);Malaysian Technical Standards Forum Bhd (MTFSB)
ONID;0x2210;0x2210;Netherlands Digital Terrestrial Television;Nozema  
ONID;0x2213;0x2213;DTT for Country of Curacao;Bureau Telecommunicatie en Post
ONID;0x222A;0x222A;DTT - New Zealand Digial Terrestrial Television;TVNZ on behalf of Freeview New Zealand
ONID;0x2242;0x2242;Norwegian Digital Terrestrial Television;Norwegian Regulator
ONID;0x224F;0x224F;Autoridad Nacional de los Servicios Públicos;Autoridad Nacional de los Servicios Públicos
ONID;0x2260;0x2260;DTT - Philippines Digital Terrestrial Television;NTA (porivionally ABS-CBN)
ONID;0x2268;0x2268;DTT Poland;Office of Electronic Communications
ONID;0x2283;0x2283;DTT - Russian Federation;RTRN
ONID;0x22B0;0x22B0;DTT - Serbia JP Emisiona Tehnika i Veze;JP Emisiona Tehnika i Veze
ONID;0x22BE;0x22BE;Singapore Digital Terrestrial Television;Singapore Broadcasting Authority  
ONID;0x22BF;0x22BF;Telecommunications office of the Slovak republic;Telecommunications office of the Slovak republic
ONID;0x22C1;0x22C1;DTT - Slovenian Digital Terrestrial Television;APEK
ONID;0x22C6;0x22C6;DTT - South African Digital Terrestrial Television;South African Broadcasting Corporation Ltd. (SABC), pending formation of DZONGA
ONID;0x22C7;0x22C7;DTT- Hungarian Digital Terrestrial Television;National Communications Authority, Hungary
ONID;0x22C8;0x22C8;DTT- Portugal Digital Terrestrial Television;ANACOM- National Communications Authority
ONID;0x22D4;0x22D4;Spanish Digital Terrestrial Television;“Spanish Broadcasting Regulator 
ONID;0x22F1;0x22F1;Swedish Digital Terrestrial Television;“Swedish Broadcasting Regulator 
ONID;0x22F4;0x22F4;Swiss Digital Terrestrial Television;OFCOM
ONID;0x233A;0x233A;UK Digital Terrestrial Television;Independent Television Commission 
ONID;0x2B00;0x2B00;DTT Sky New Zealand;Sky Network Television Limited
ONID;0x3000;0x3000;PanAmSat 4 68.5°E;Pan American Satellite System
ONID;0x5000;0x5000;Irdeto Mux System;Irdeto Test Laboratories
ONID;0x616D;0x616D;BellSouth Entertainment;BellSouth Entertainment, Atlanta, GA, USA  
ONID;0x6600;0x6600;UPC Satellite;UPC  
ONID;0x6601;0x6601;UPC Cable;UPC  
ONID;0x6602;0x6602;Comcast Media Center;Comcast Media Center
ONID;0xA011;0xA011;Sichuan Cable TV Network;Sichuan Cable TV Network (PRC)
ONID;0xA012;0xA012;China Network Systems;STAR Koos Finance Company (Taiwan)
ONID;0xA013;0xA013;Versatel;Versatel (Russia)
ONID;0xA014;0xA014;Chongqing Cable;Chongqing Municipality, PRC
ONID;0XA015;0XA015;Guizhou Cable;Guizhou Province, PRC
ONID;0xA016;0xA016;Hathway Cable;Hathway Cable and Datacom, India
ONID;0xA017;0xA017;RCN;Rogers Cable Network, USA
ONID;0xA018;0xA040;(NDS satellite services);(NDS to be allocated)
ONID;0xA401;0xA401;ARD;ARD-Sternpunkte
ONID;0xA509;0xA509;Welho Cable Network Helsinki;Welho
ONID;0xA600;0xA600;Madritel;Madritel (Spain)
ONID;0xA602;0xA602;Tevel;Tevel (Israel) (NDS)
ONID;0xA603;0xA603;Globo Cabo (to be recycled);Globo Cabo (Brazil) (NDS)
ONID;0xA604;0xA604;Cablemas (to be recycled);Cablemas (Mexico) (NDS)
ONID;0xA605;0xA605;INC National Cable Network;Information Network Centre of SARFT (PRC) (NDS)
ONID;0xA606;0xA607;Pepcom GmbH;Pepcom GmbH
ONID;0xA900;0xA900;M-net Telekommunikations GmbH;M-net Telekommunikations GmbH
ONID;0xF000;0xF000;SMALL CABLE NETWORKS;(Small cable network network operators)
ONID;0xF001;0xF001;Deutsche Telekom;Deutsche Telekom AG
ONID;0xF010;0xF010;Telefónica Cable;Telefónica Cable SA
ONID;0xF020;0xF020;Cable and Wireless Communication;Cable and Wireless Communications
ONID;0xF100;0xF100;Casema;Casema N.V .
ONID;0xF750;0xF750;Telewest Communications Cable Network;Telewest Communications Plc  
ONID;0xF751;0xF751;OMNE Communications;OMNE Communications Ltd.
ONID;0xFBFC;0xFBFC;MATAV;MATAV (Israel ) (NDS)
ONID;0xFBFD;0xFBFD;Com Hem ab;Com Hem ab
ONID;0xFBFE;0xFBFE;TPS;La Télévision Par Satellite
ONID;0xFBFF;0xFBFF;Sky Italia;Sky Italia Spa.
ONID;0xFC10;0xFC10;Rhône Vision Cable;Rhône Vision Cable
ONID;0xFC41;0xFC41;France Telecom Cable;France Telecom  
ONID;0xFD00;0xFD00;National Cable Network;Lyonnaise Communications
ONID;0xFE00;0xFE00;TeleDenmark Cable TV;TeleDenmark
ONID;0xFEC0;0xFEFF;Network Interface Modules;Common Interface  
ONID;0xFF00;0xFFFA;Private_temporary_use;ETSI
TRANSP;Number;MHz
TRANSP;49;10714
TRANSP;50;10729
TRANSP;51;10744
TRANSP;52;10758
TRANSP;53;10773
TRANSP;54;10788
TRANSP;55;10803
TRANSP;56;10818
TRANSP;57;10832
TRANSP;58;10847
TRANSP;59;10862
TRANSP;60;10876
TRANSP;61;10891
TRANSP;62;10906
TRANSP;63;10921
TRANSP;64;10936
TRANSP;33;10964
TRANSP;34;10979
TRANSP;35;10994
TRANSP;36;11009
TRANSP;37;11023
TRANSP;38;11038
TRANSP;39;11053
TRANSP;40;11067
TRANSP;41;11082
TRANSP;42;11097
TRANSP;43;11112
TRANSP;44;11127
TRANSP;45;11141
TRANSP;46;11156
TRANSP;47;11171
TRANSP;48;11186
TRANSP;1;11214
TRANSP;2;11229
TRANSP;3;11244
TRANSP;4;11258
TRANSP;5;11273
TRANSP;6;11288
TRANSP;7;11303
TRANSP;8;11318
TRANSP;9;11332
TRANSP;10;11347
TRANSP;11;11362
TRANSP;12;11376
TRANSP;13;11391
TRANSP;14;11406
TRANSP;15;11421
TRANSP;16;11436
TRANSP;17;11464
TRANSP;18;11479
TRANSP;19;11494
TRANSP;20;11509
TRANSP;21;11523
TRANSP;22;11538
TRANSP;23;11553
TRANSP;24;11568
TRANSP;25;11582
TRANSP;26;11597
TRANSP;27;11612
TRANSP;28;11627
TRANSP;29;11641
TRANSP;30;11656
TRANSP;31;11671
TRANSP;32;11686
TRANSP;65;11720
TRANSP;66;11739
TRANSP;67;11758
TRANSP;68;11778
TRANSP;69;11798
TRANSP;70;11817
TRANSP;71;11836
TRANSP;72;11856
TRANSP;73;11876
TRANSP;74;11895
TRANSP;75;11914
TRANSP;76;11934
TRANSP;77;11954
TRANSP;78;11973
TRANSP;79;11992
TRANSP;80;12012
TRANSP;81;12032
TRANSP;82;12051
TRANSP;83;12070
TRANSP;84;12090
TRANSP;85;12110
TRANSP;86;12129
TRANSP;87;12148
TRANSP;88;12168
TRANSP;89;12188
TRANSP;90;12207
TRANSP;91;12226
TRANSP;92;12246
TRANSP;93;12266
TRANSP;94;12285
TRANSP;95;12304
TRANSP;96;12324
TRANSP;97;12344
TRANSP;98;12363
TRANSP;99;12382
TRANSP;100;12402
TRANSP;101;12422
TRANSP;102;12441
TRANSP;103;12460
TRANSP;104;12480
TRANSP;105;12515
TRANSP;106;12522
TRANSP;107;12545
TRANSP;108;12552
TRANSP;109;12574
TRANSP;110;12581
TRANSP;111;12604
TRANSP;112;12610
TRANSP;113;12633
TRANSP;114;12640
TRANSP;115;12663
TRANSP;116;12670
TRANSP;117;12692
TRANSP;118;12699
TRANSP;119;12722
TRANSP;120;12728
SERVICETYPE;Number;Description
SERVICETYPE;01;SD-TV
SERVICETYPE;02;Radio
SERVICETYPE;12;Data/Test
SERVICETYPE;22;SD-TV
SERVICETYPE;25;HD-TV
SERVICETYPE;31;4K-TV
SERVICETYPE;211;Option
1 ONID Start End Name Operator
2 ONID 0x0000 0x0000 (Reserved) (Reserved)
3 ONID 0x0001 0x0001 Société Européenne des Satellites Société Européenne des Satellites
4 ONID 0x0002 0x0002 Société Européenne des Satellites Société Européenne des Satellites
5 ONID 0x0003 0x0019 Société Européenne des Satellites Société Européenne des Satellites
6 ONID 0x001A 0x001A Quiero Televisión   Quiero Televisión  
7 ONID 0x001B 0x001B RAI RAI
8 ONID 0x001C 0x001C Hellas-Sat S.A. Hellas-Sat S.A.
9 ONID 0x001D 0x001D TELECOM ITALIA MEDIA BROADCASTING SRL TELECOM ITALIA MEDIA BROADCASTING SRL
10 ONID 0x001F 0x001F Europe Online Networks S.A   Europe Online Networks S.A  
11 ONID 0x0020 0x0020 Société Européenne des Satellites Société Européenne des Satellites
12 ONID 0x0021 0x0021 Hispasat S.A . Hispasat S.A .
13 ONID 0x0022 0x0022 Hispasat S.A . Hispasat S.A .
14 ONID 0x0023 0x0023 Hispasat S.A . Hispasat S.A .
15 ONID 0x0024 0x0024 Hispasat S.A . Hispasat S.A .
16 ONID 0x0025 0x0025 Hispasat S.A . Hispasat S.A .
17 ONID 0x0026 0x0026 Hispasat S.A . Hispasat S.A .
18 ONID 0x0027 0x0027 Hispasat FSS Hispasat FSS
19 ONID 0x0028 0x0028 Hispasat DBS Hispasat DBS
20 ONID 0x0029 0x0029 Hispasat America Hispasat America
21 ONID 0x002A 0x002A Päijät-Hämeen Puhelin Oyj Päijät-Hämeen Puhelin Oyj
22 ONID 0x002B 0x002B Digita Oy Digita Oy
23 ONID 0x002E 0x002E Xantic BU Broadband Xantic BU Broadband
24 ONID 0x002F 0x002F TVNZ   TVNZ  
25 ONID 0x0030 0x0030 Canal+ SA (for Intelsat 601-325°E) Canal+ SA (for Intelsat 601-325°E)
26 ONID 0x0031 0x0031 Hispasat S.A. Hispasat S.A.
27 ONID 0x0032 0x0032 Hispasat S.A. Hispasat S.A.
28 ONID 0x0033 0x0033 Hispasat S.A. Hispasat S.A.
29 ONID 0x0034 0x0034 Hispasat S.A. Hispasat S.A.
30 ONID 0x0035 0x0035 NetHold IMS NetHold IMS
31 ONID 0x0036 0x0036 TV Cabo Portugal   TV Cabo Portugal  
32 ONID 0x0037 0x0037 France Telecom, CNES and DGA France Telecom, CNES and DGA
33 ONID 0x0038 0x0038 Hellenic Telecommunications Organization S.A . Hellenic Telecommunications Organization S.A .
34 ONID 0x0039 0x0039 Broadcast Australia Pty. Broadcast Australia Pty.
35 ONID 0x003A 0x003A GeoTelecom Satellite Services GeoTelecom Satellite Services
36 ONID 0x003B 0x003B BBC BBC
37 ONID 0x003C 0x003C KPN Broadcast Services KPN Broadcast Services
38 ONID 0x003D 0x003D Skylogic Italia S.A. Skylogic Italia S.A.
39 ONID 0x003E 0x003E Eutelsat S.A. Eutelsat S.A.
40 ONID 0x003F 0x003F Eutelsat S.A. Eutelsat S.A.
41 ONID 0x0040 0x0040 Hrvatski Telekom d.d Hrvatski Telekom d.d
42 ONID 0x0041 0x0041 Mindport   Mindport  
43 ONID 0x0042 0x0042 DTV haber ve Gorsel yayýncilik DTV haber ve Gorsel yayýncilik
44 ONID 0x0043 0x0043 arena Sport Rechte und Marketing GmbH arena Sport Rechte und Marketing GmbH
45 ONID 0x0044 0x0044 VisionTV LLC VisionTV LLC
46 ONID 0x0045 0x0045 SES-Sirius SES-Sirius
47 ONID 0x0046 0x0046 Telenor  Telenor 
48 ONID 0x0047 0x0047 Telenor Telenor
49 ONID 0x0048 0x0048 STAR DIGITAL A.S . STAR DIGITAL A.S .
50 ONID 0x0049 0x0049 Sentech   Sentech  
51 ONID 0x004A 0x004B Rambouillet ES Rambouillet ES
52 ONID 0x004C 0x004C Skylogic S.A. Skylogic S.A.
53 ONID 0x004D 0x004D Skylogic S.A. Skylogic S.A.
54 ONID 0x004E 0x004F Eutelsat S.A. Eutelsat S.A.
55 ONID 0x0050 0x0050 HRT – Croatian Radio and Television HRT – Croatian Radio and Television
56 ONID 0x0051 0x0051 Havas  Havas 
57 ONID 0x0052 0x0052 StarGuide Digital Networks  StarGuide Digital Networks 
58 ONID 0x0053 0x0053 PT Comunicações PT Comunicações
59 ONID 0x0054 0x0054 Teracom AB Satellite Services Teracom AB Satellite Services
60 ONID 0x0055 0x0055 NSAB (Teracom) NSAB (Teracom)
61 ONID 0x0056 0x0056 Viasat Satellite Services AB Viasat Satellite Services AB
62 ONID 0x0058 0x0058 UBC Thailand  UBC Thailand 
63 ONID 0x0059 0x0059 Bharat Business Channel Limited Bharat Business Channel Limited
64 ONID 0x005A 0x005A ICO Satellite Services G.P. ICO Satellite Services G.P.
65 ONID 0x005B 0x005B ZON ZON
66 ONID 0x005E 0x005E NSAB  NSAB 
67 ONID 0x005F 0x005F NSAB  NSAB 
68 ONID 0x0060 0x0060 Kabel Deutschland  Kabel Deutschland 
69 ONID 0x0064 0x0064 T-Kábel T-Kábel Magyarország Kft.
70 ONID 0x0065 0x0065 France Telecom Orange France Telecom Orange
71 ONID 0x0066 0x0066 Zweites Deutsches Fernsehen - ZDF (cable contribution) Zweites Deutsches Fernsehen - ZDF
72 ONID 0x0069 0x0069 Optus B3 156°E Optus Communications
73 ONID 0x0070 0x0070 BONUM1 36 Degrees East NTV+
74 ONID 0x0073 0x0073 PanAmSat 4 68.5°E Pan American Satellite System
75 ONID 0x007D 0x007D Skylogic Skylogic Italia
76 ONID 0x007E 0x007F Eutelsat Satellite System at 7°E EUTELSAT – European Telecommunications Satellite Organization 
77 ONID 0x0085 0x0085 BetaTechnik BetaTechnik
78 ONID 0x0090 0x0090 National network TDF
79 ONID 0x009A 0x009B Eutelsat satellite system at 9°East Rambouillet ES
80 ONID 0x009C 0x009D Eutelsat satellite system at 9°East Skylogic S.A.
81 ONID 0x009E 0x009F Eutelsat satellite system at 9°East Eutelsat S.A.
82 ONID 0x00A0 0x00A0 National Cable Network News Datacom
83 ONID 0x00A1 0x00A1 DigiSTAR STAR Television Productions Ltd (HK) (NDS)
84 ONID 0x00A2 0x00A2 Sky Entertainment Services NetSat Serviços Ltda (Brazil), Innova S. de R. L. (Mexico) and Multicountry Partnership L. P. (NDS)
85 ONID 0x00A3 0x00A3 NDS Director systems Various (product only sold by Tandberg TV) (NDS)
86 ONID 0x00A4 0x00A4 ISkyB STAR Television Productions Ltd (HK) (NDS)
87 ONID 0x00A5 0x00A5 Indovision PT. Matahari Lintas Cakrawala (MLC) (NDS)
88 ONID 0x00A6 0x00A6 ART ART (NDS)
89 ONID 0x00A7 0x00A7 Globecast France Telecom (NDS)
90 ONID 0x00A8 0x00A8 Foxtel Foxtel (Australia) (NDS)
91 ONID 0x00A9 0x00A9 Sky New Zealand Sky Network Television Ltd (NDS)
92 ONID 0x00AA 0x00AA OTE OTE (Greece) (NDS)
93 ONID 0x00AB 0x00AB Yes Satellite Services DBS (Israel) (NDS)
94 ONID 0x00AC 0x00AC (NDS satellite services) (NDS to be allocated)
95 ONID 0x00AD 0x00AD SkyLife Korea Digital Broadcasting
96 ONID 0x00AE 0x00AF (NDS satellite services) (NDS to be allocated)
97 ONID 0x00B0 0x00B3 TPS La Télévision Par Satellite
98 ONID 0x00B4 0x00B4 Telesat 107.3°W Telesat Canada
99 ONID 0x00B5 0x00B5 Telesat 111.1°W Telesat Canada
100 ONID 0x00B6 0x00B6 Telstra Saturn TelstraSaturn Limited  
101 ONID 0x00BA 0x00BA Satellite Express – 6 (80°E) Satellite Express 
102 ONID 0x00C0 0x00CD Canal + Canal+
103 ONID 0x00D0 0x00D0 CCTV China Central Television (NDS)
104 ONID 0x00D1 0x00D1 Galaxy Galaxy Satellite Broadcasting, Hong Kong (NDS)
105 ONID 0x00D2 0x00DF (NDS satellite services) (NDS to be allocated)
106 ONID 0x00EB 0x00EB Eurovision Network European Broadcasting Union  
107 ONID 0x0100 0x0100 ExpressVu ExpressVu Inc.
108 ONID 0x0101 0x0101 Bulsatcom AD Bulsatcom AD
109 ONID 0x0104 0x0104 MagtiSat Magticom Ltd.
110 ONID 0x010D 0x010D Skylogic Skylogic Italia
111 ONID 0x010E 0x010F Eutelsat Satellite System at 10°E European Telecommunications Satellite Organization
112 ONID 0x0110 0x0110 Mediaset Mediaset 
113 ONID 0x011F 0x011F visAvision Network European Telecommunications Satellite Organization
114 ONID 0x013D 0x013D Skylogic Skylogic Italia
115 ONID 0x013E 0x013F Eutelsat Satellite System 13°E European Telecommunications Satellite Organization
116 ONID 0x016D 0x016D Skylogic Skylogic Italia
117 ONID 0x016E 0x016F Eutelsat Satellite System at 16°E European Telecommunications Satellite Organization
118 ONID 0x0170 0x0170 Audio Visual Global Joint Stock Company Audio Visual Global Joint Stock Company
119 ONID 0x01F4 0x01F4 MediaKabel B.V
120 ONID 0x022D 0x022D Skylogic Skylogic Italia
121 ONID 0x022E 0x022F Eutelsat Satellite System at 21.5°E EUTELSAT – European Telecommunications Satellite Organization 
122 ONID 0x026D 0x026D Skylogic Skylogic Italia
123 ONID 0x026E 0x026F Eutelsat Satellite System at 25.5°E EUTELSAT – European Telecommunications Satellite Organization 
124 ONID 0x029D 0x029D Skylogic Skylogic Italia
125 ONID 0x029E 0x029F Eutelsat Satellite System at 29°E European Telecommunications Satellite Organization
126 ONID 0x02BE 0x02BE ARABSAT ARABSAT - Arab Satellite Communications Organization
127 ONID 0x02C0 0x02C0 MTV Networks Europe MTV Networks Europe
128 ONID 0x033D 0x033D Skylogic at 33°E Skylogic Italia
129 ONID 0x033E 0x033F Eutelsat Satellite System at 33°E Eutelsat
130 ONID 0x034E 0x034E IRIB IRIB
131 ONID 0x036D 0x036D Skylogic Skylogic Italia
132 ONID 0x036E 0x036F Eutelsat Satellite System at 36°E European Telecommunications Satellite Organization
133 ONID 0x03E8 0x03E8 Telia Telia, Sweden
134 ONID 0x045D 0x045F Eutelsat satellite system at 15°West Eutelsat S.A.
135 ONID 0x047D 0x047D Skylogic Skylogic Italia
136 ONID 0x047E 0x047F Eutelsat Satellite System at 12.5°W EUTELSAT – European Telecommunications Satellite Organization 
137 ONID 0x048D 0x048D Skylogic Skylogic Italia
138 ONID 0x048E 0x048F Eutelsat Satellite System at 48°E European Telecommunications Satellite Organization
139 ONID 0x049D 0x049F Eutelsat satellite system at 11°West Eutelsat S.A.
140 ONID 0x0500 0x0500 Vinasat Center Vinasat Center
141 ONID 0x0510 0x0510 Almajd Almajd Satellite Broadcasting FZ LLC
142 ONID 0x052D 0x052D Skylogic Skylogic Italia
143 ONID 0x052E 0x052F Eutelsat Satellite System at 8°W EUTELSAT – European Telecommunications Satellite Organization 
144 ONID 0x053D 0x053F Eutelsat satellite system at 53°East Eutelsat S.A.
145 ONID 0x055D 0x055D Skylogic at 5°W Skylogic Italia
146 ONID 0x055E 0x055F Eutelsat Satellite System at 5°W Eutelsat
147 ONID 0x0600 0x0600 UPC Satellite UPC  
148 ONID 0x0601 0x0601 UPC Cable UPC  
149 ONID 0x0602 0x0602 Tevel Tevel Cable (Israel )
150 ONID 0x071D 0x071D Skylogic at 70.5°E Skylogic Italia
151 ONID 0x071E 0x071F Eutelsat Satellite System at 70.5°E Eutelsat S.A.
152 ONID 0x077D 0x077D Skylogic Satellite System at 7°W Skylogic Italia
153 ONID 0x077E 0x077F Eutelsat Satellite System at 7°W Eutelsat S.A.
154 ONID 0x0800 0x0801 Nilesat 101 Nilesat
155 ONID 0x0880 0x0880 MEASAT 1, 91.5°E MEASAT Broadcast Network Systems SDN. BHD. (Kuala Lumpur, Malaysia)
156 ONID 0x0882 0x0882 MEASAT 2, 91.5°E MEASAT Broadcast Network Systems SDN. BHD. (Kuala Lumpur, Malaysia)
157 ONID 0x0883 0x0883 MEASAT 2, 148.0°E Hsin Chi Broadcast Company Ltd .
158 ONID 0x088F 0x088F MEASAT 3 MEASAT Broadcast Network Systems SDN. BHD. (Kuala Lumpur, Malaysia)
159 ONID 0x08A0 0x08A0 Mainland Television Limited Mainland Television Limited
160 ONID 0x0E26 0x0E26 IRIB IRIB
161 ONID 0x0FFF 0x0FFF Optus Networks Optus Networks
162 ONID 0x1000 0x1000 Optus B3 156°E Optus Communications
163 ONID 0x1001 0x1001 DISH Network Echostar Communications
164 ONID 0x1002 0x1002 Dish Network 61.5 W Echostar Communications
165 ONID 0x1003 0x1003 Dish Network 83 W Echostar Communications
166 ONID 0x1004 0x1004 Dish Network 119 W Echostar Communications
167 ONID 0x1005 0x1005 Dish Network 121 W Echostar Communications
168 ONID 0x1006 0x1006 Dish Network 148 W Echostar Communications
169 ONID 0x1007 0x1007 Dish Network 175 W Echostar Communications
170 ONID 0x1008 0x100B Dish Network W - Z Echostar Communications
171 ONID 0x1010 0x1010 ABC TV Australian Broadcasting Corporation  
172 ONID 0x1011 0x1011 SBS SBS Australia  
173 ONID 0x1012 0x1012 Nine Network Australia Nine Network Australia  
174 ONID 0x1013 0x1013 Seven Network Australia Seven Network Limited  
175 ONID 0x1014 0x1014 Network TEN Australia Network TEN Limited  
176 ONID 0x1015 0x1015 WIN Television Australia WIN Television Pty Ltd  
177 ONID 0x1016 0x1016 Prime Television Australia Prime Television Limited  
178 ONID 0x1017 0x1017 Southern Cross Broadcasting Australia Southern Cross Broadcasting (Australia) Limited  
179 ONID 0x1018 0x1018 Telecasters Australia Telecasters Australia Limited  
180 ONID 0x1019 0x1019 NBN Australia NBN Limited  
181 ONID 0x101A 0x101A Imparja Television Australia Imparja Television Australia 
182 ONID 0x101B 0x101F (Reserved for Australian broadcaster) (Reserved for Australian broadcasters)
183 ONID 0x1100 0x1100 GE Americom GE American Communications
184 ONID 0x1101 0x1101 MiTV Networks Broadcast Terrestrial Network - DVB-H MiTV Networks Sdn Bhd Malaysia
185 ONID 0x1102 0x1102 Dream Mobile TV Philippines Multimedia System, Inc.
186 ONID 0x1103 0x1103 PT MAC PT. Mediatama Anugrah Citra
187 ONID 0x1104 0x1104 Levira Mobile TV Levira AS
188 ONID 0x1105 0x1105 Mobision Alsumaria TV
189 ONID 0x1106 0x1106 Trenmobile PT. Citra Karya Investasi
190 ONID 0x1107 0x1107 VTC Mobile TV VTC Mobile TV
191 ONID 0x1700 0x1700 Echostar 2A EchoStar Communications
192 ONID 0x1701 0x1701 Echostar 2B EchoStar Communications
193 ONID 0x1702 0x1702 Echostar 2C EchoStar Communications
194 ONID 0x1703 0x1703 Echostar 2D EchoStar Communications
195 ONID 0x1704 0x1704 Echostar 2E EchoStar Communications
196 ONID 0x1705 0x1705 Echostar 2F EchoStar Communications
197 ONID 0x1706 0x1706 Echostar 2G EchoStar Communications
198 ONID 0x1707 0x1707 Echostar 2H EchoStar Communications
199 ONID 0x1708 0x1708 Echostar 2I EchoStar Communications
200 ONID 0x1709 0x1709 Echostar 2J EchoStar Communications
201 ONID 0x170A 0x170A Echostar 2K EchoStar Communications
202 ONID 0x170B 0x170B Echostar 2L EchoStar Communications
203 ONID 0x170C 0x170C Echostar 2M EchoStar Communications
204 ONID 0x170D 0x170D Echostar 2N EchoStar Communications
205 ONID 0x170E 0x170E Echostar 2O EchoStar Communications
206 ONID 0x170F 0x170F Echostar 2P EchoStar Communications
207 ONID 0x1710 0x1710 Echostar 2Q EchoStar Communications
208 ONID 0x1711 0x1711 Echostar 2R EchoStar Communications
209 ONID 0x1712 0x1712 Echostar 2S EchoStar Communications
210 ONID 0x1713 0x1713 Echostar 2T EchoStar Communications
211 ONID 0x1714 0x1714 Platforma HD Platforma HD Ltd.
212 ONID 0x1715 0x1715 Profit Group Terrestrial Profit Group SpA
213 ONID 0x1716 0x1716 JSC Mostelekom JSC Mostelekom
214 ONID 0x2000 0x2000 Thiacom 1 & 2 co-located 78.5°E Shinawatra Satellite
215 ONID 0x2014 0x2014 DTT - Andorran Digital Terrestrial Television STA
216 ONID 0x2024 0x2024 Australian Digital Terrestrial Television Australian Broadcasting Authority 
217 ONID 0x2028 0x2028 Austrian Digital Terrestrial Television ORS - Austrian Broadcasting Services
218 ONID 0x2038 0x2038 Belgian Digital Terrestrial Television BIPT
219 ONID 0x209E 0x209E Taiwanese Digital Terrestrial Television Directorate General of Telecommunications
220 ONID 0x20AA 0x20AA Comision Nacional de Television de Colombia Comision Nacional de Television de Colombia
221 ONID 0x20BF 0x20BF Croatian Post and Electronic Communications Agency (HAKOM) Croatian Post and Electronic Communications Agency (HAKOM)
222 ONID 0x20C4 0x20C4 Office Of the Commissioner of Electronic Communications and Postal Regulation Office Of the Commissioner of Electronic Communications and Postal Regulation
223 ONID 0x20CB 0x20CB Czech Republic Digital Terrestrial Television Czech Digital Group  
224 ONID 0x20D0 0x20D0 Danish Digital Terrestrial Television National Telecom Agency Denmark  
225 ONID 0x20E9 0x20E9 Estonian Digital Terrestrial Television Estonian National Communications Board
226 ONID 0x20F6 0x20F6 Finnish Digital Terrestrial Television Telecommunicatoins Administratoin Centre, Finland  
227 ONID 0x20FA 0x20FA French Digital Terrestrial Television Conseil Superieur de l'AudioVisuel
228 ONID 0x2114 0x2114 German Digital Terrestrial Television IRT on behalf of the German DVB-T broadcasts 
229 ONID 0x2124 0x2124 Gibraltar Regulatory Authority Gibraltar Regulatory Authority
230 ONID 0x2168 0x2168 Digital Terrestrial Network of Indonesia Ministry of Communication and Information Technology of the Republic of Indonesia
231 ONID 0x2174 0x2174 Irish Digital Terrestrial Television Irish Telecommunications Regulator  
232 ONID 0x2178 0x2178 Israeli Digital Terrestrial Television BEZEQ (The Israel Telecommunication Corp Ltd .)
233 ONID 0x217C 0x217C Italian Digital Terrestrial Television
234 ONID 0x21AC 0x21AC DTT - Latvian Digital Terrestrial Television Electronic Communications Office
235 ONID 0x21B8 0x21B8 DTT Lithuania Communications Regulatory Authority
236 ONID 0x21CA 0x21CA Malaysian Technical Standards Forum Bhd (MTFSB) Malaysian Technical Standards Forum Bhd (MTFSB)
237 ONID 0x2210 0x2210 Netherlands Digital Terrestrial Television Nozema  
238 ONID 0x2213 0x2213 DTT for Country of Curacao Bureau Telecommunicatie en Post
239 ONID 0x222A 0x222A DTT - New Zealand Digial Terrestrial Television TVNZ on behalf of Freeview New Zealand
240 ONID 0x2242 0x2242 Norwegian Digital Terrestrial Television Norwegian Regulator
241 ONID 0x224F 0x224F Autoridad Nacional de los Servicios Públicos Autoridad Nacional de los Servicios Públicos
242 ONID 0x2260 0x2260 DTT - Philippines Digital Terrestrial Television NTA (porivionally ABS-CBN)
243 ONID 0x2268 0x2268 DTT Poland Office of Electronic Communications
244 ONID 0x2283 0x2283 DTT - Russian Federation RTRN
245 ONID 0x22B0 0x22B0 DTT - Serbia JP Emisiona Tehnika i Veze JP Emisiona Tehnika i Veze
246 ONID 0x22BE 0x22BE Singapore Digital Terrestrial Television Singapore Broadcasting Authority  
247 ONID 0x22BF 0x22BF Telecommunications office of the Slovak republic Telecommunications office of the Slovak republic
248 ONID 0x22C1 0x22C1 DTT - Slovenian Digital Terrestrial Television APEK
249 ONID 0x22C6 0x22C6 DTT - South African Digital Terrestrial Television South African Broadcasting Corporation Ltd. (SABC), pending formation of DZONGA
250 ONID 0x22C7 0x22C7 DTT- Hungarian Digital Terrestrial Television National Communications Authority, Hungary
251 ONID 0x22C8 0x22C8 DTT- Portugal Digital Terrestrial Television ANACOM- National Communications Authority
252 ONID 0x22D4 0x22D4 Spanish Digital Terrestrial Television “Spanish Broadcasting Regulator 
253 ONID 0x22F1 0x22F1 Swedish Digital Terrestrial Television “Swedish Broadcasting Regulator ”
254 ONID 0x22F4 0x22F4 Swiss Digital Terrestrial Television OFCOM
255 ONID 0x233A 0x233A UK Digital Terrestrial Television Independent Television Commission 
256 ONID 0x2B00 0x2B00 DTT – Sky New Zealand Sky Network Television Limited
257 ONID 0x3000 0x3000 PanAmSat 4 68.5°E Pan American Satellite System
258 ONID 0x5000 0x5000 Irdeto Mux System Irdeto Test Laboratories
259 ONID 0x616D 0x616D BellSouth Entertainment BellSouth Entertainment, Atlanta, GA, USA  
260 ONID 0x6600 0x6600 UPC Satellite UPC  
261 ONID 0x6601 0x6601 UPC Cable UPC  
262 ONID 0x6602 0x6602 Comcast Media Center Comcast Media Center
263 ONID 0xA011 0xA011 Sichuan Cable TV Network Sichuan Cable TV Network (PRC)
264 ONID 0xA012 0xA012 China Network Systems STAR Koos Finance Company (Taiwan)
265 ONID 0xA013 0xA013 Versatel Versatel (Russia)
266 ONID 0xA014 0xA014 Chongqing Cable Chongqing Municipality, PRC
267 ONID 0XA015 0XA015 Guizhou Cable Guizhou Province, PRC
268 ONID 0xA016 0xA016 Hathway Cable Hathway Cable and Datacom, India
269 ONID 0xA017 0xA017 RCN Rogers Cable Network, USA
270 ONID 0xA018 0xA040 (NDS satellite services) (NDS to be allocated)
271 ONID 0xA401 0xA401 ARD ARD-Sternpunkte
272 ONID 0xA509 0xA509 Welho Cable Network Helsinki Welho
273 ONID 0xA600 0xA600 Madritel Madritel (Spain)
274 ONID 0xA602 0xA602 Tevel Tevel (Israel) (NDS)
275 ONID 0xA603 0xA603 Globo Cabo (to be recycled) Globo Cabo (Brazil) (NDS)
276 ONID 0xA604 0xA604 Cablemas (to be recycled) Cablemas (Mexico) (NDS)
277 ONID 0xA605 0xA605 INC National Cable Network Information Network Centre of SARFT (PRC) (NDS)
278 ONID 0xA606 0xA607 Pepcom GmbH Pepcom GmbH
279 ONID 0xA900 0xA900 M-net Telekommunikations GmbH M-net Telekommunikations GmbH
280 ONID 0xF000 0xF000 SMALL CABLE NETWORKS (Small cable network network operators)
281 ONID 0xF001 0xF001 Deutsche Telekom Deutsche Telekom AG
282 ONID 0xF010 0xF010 Telefónica Cable Telefónica Cable SA
283 ONID 0xF020 0xF020 Cable and Wireless Communication Cable and Wireless Communications
284 ONID 0xF100 0xF100 Casema Casema N.V .
285 ONID 0xF750 0xF750 Telewest Communications Cable Network Telewest Communications Plc  
286 ONID 0xF751 0xF751 OMNE Communications OMNE Communications Ltd.
287 ONID 0xFBFC 0xFBFC MATAV MATAV (Israel ) (NDS)
288 ONID 0xFBFD 0xFBFD Com Hem ab Com Hem ab
289 ONID 0xFBFE 0xFBFE TPS La Télévision Par Satellite
290 ONID 0xFBFF 0xFBFF Sky Italia Sky Italia Spa.
291 ONID 0xFC10 0xFC10 Rhône Vision Cable Rhône Vision Cable
292 ONID 0xFC41 0xFC41 France Telecom Cable France Telecom  
293 ONID 0xFD00 0xFD00 National Cable Network Lyonnaise Communications
294 ONID 0xFE00 0xFE00 TeleDenmark Cable TV TeleDenmark
295 ONID 0xFEC0 0xFEFF Network Interface Modules Common Interface  
296 ONID 0xFF00 0xFFFA Private_temporary_use ETSI
297 TRANSP Number MHz
298 TRANSP 49 10714
299 TRANSP 50 10729
300 TRANSP 51 10744
301 TRANSP 52 10758
302 TRANSP 53 10773
303 TRANSP 54 10788
304 TRANSP 55 10803
305 TRANSP 56 10818
306 TRANSP 57 10832
307 TRANSP 58 10847
308 TRANSP 59 10862
309 TRANSP 60 10876
310 TRANSP 61 10891
311 TRANSP 62 10906
312 TRANSP 63 10921
313 TRANSP 64 10936
314 TRANSP 33 10964
315 TRANSP 34 10979
316 TRANSP 35 10994
317 TRANSP 36 11009
318 TRANSP 37 11023
319 TRANSP 38 11038
320 TRANSP 39 11053
321 TRANSP 40 11067
322 TRANSP 41 11082
323 TRANSP 42 11097
324 TRANSP 43 11112
325 TRANSP 44 11127
326 TRANSP 45 11141
327 TRANSP 46 11156
328 TRANSP 47 11171
329 TRANSP 48 11186
330 TRANSP 1 11214
331 TRANSP 2 11229
332 TRANSP 3 11244
333 TRANSP 4 11258
334 TRANSP 5 11273
335 TRANSP 6 11288
336 TRANSP 7 11303
337 TRANSP 8 11318
338 TRANSP 9 11332
339 TRANSP 10 11347
340 TRANSP 11 11362
341 TRANSP 12 11376
342 TRANSP 13 11391
343 TRANSP 14 11406
344 TRANSP 15 11421
345 TRANSP 16 11436
346 TRANSP 17 11464
347 TRANSP 18 11479
348 TRANSP 19 11494
349 TRANSP 20 11509
350 TRANSP 21 11523
351 TRANSP 22 11538
352 TRANSP 23 11553
353 TRANSP 24 11568
354 TRANSP 25 11582
355 TRANSP 26 11597
356 TRANSP 27 11612
357 TRANSP 28 11627
358 TRANSP 29 11641
359 TRANSP 30 11656
360 TRANSP 31 11671
361 TRANSP 32 11686
362 TRANSP 65 11720
363 TRANSP 66 11739
364 TRANSP 67 11758
365 TRANSP 68 11778
366 TRANSP 69 11798
367 TRANSP 70 11817
368 TRANSP 71 11836
369 TRANSP 72 11856
370 TRANSP 73 11876
371 TRANSP 74 11895
372 TRANSP 75 11914
373 TRANSP 76 11934
374 TRANSP 77 11954
375 TRANSP 78 11973
376 TRANSP 79 11992
377 TRANSP 80 12012
378 TRANSP 81 12032
379 TRANSP 82 12051
380 TRANSP 83 12070
381 TRANSP 84 12090
382 TRANSP 85 12110
383 TRANSP 86 12129
384 TRANSP 87 12148
385 TRANSP 88 12168
386 TRANSP 89 12188
387 TRANSP 90 12207
388 TRANSP 91 12226
389 TRANSP 92 12246
390 TRANSP 93 12266
391 TRANSP 94 12285
392 TRANSP 95 12304
393 TRANSP 96 12324
394 TRANSP 97 12344
395 TRANSP 98 12363
396 TRANSP 99 12382
397 TRANSP 100 12402
398 TRANSP 101 12422
399 TRANSP 102 12441
400 TRANSP 103 12460
401 TRANSP 104 12480
402 TRANSP 105 12515
403 TRANSP 106 12522
404 TRANSP 107 12545
405 TRANSP 108 12552
406 TRANSP 109 12574
407 TRANSP 110 12581
408 TRANSP 111 12604
409 TRANSP 112 12610
410 TRANSP 113 12633
411 TRANSP 114 12640
412 TRANSP 115 12663
413 TRANSP 116 12670
414 TRANSP 117 12692
415 TRANSP 118 12699
416 TRANSP 119 12722
417 TRANSP 120 12728
418 SERVICETYPE Number Description
419 SERVICETYPE 01 SD-TV
420 SERVICETYPE 02 Radio
421 SERVICETYPE 12 Data/Test
422 SERVICETYPE 22 SD-TV
423 SERVICETYPE 25 HD-TV
424 SERVICETYPE 31 4K-TV
425 SERVICETYPE 211 Option

View File

@@ -0,0 +1,260 @@
using System;
using System.Collections.Generic;
namespace ChanSort.Api
{
public class ChannelInfo
{
private const int MAX_FAV_LISTS = 5;
private string uid;
/// <summary>
/// List of channels that have the same UID as this channel and were not added to the channel list directly
/// </summary>
public readonly List<ChannelInfo> Duplicates = new List<ChannelInfo>();
public virtual bool IsDeleted { get; set; }
public SignalSource SignalSource { get; set; }
public long RecordIndex { get; set; }
public int RecordOrder { get; set; }
public int OldProgramNr { get; set; }
public int NewProgramNr { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }
public Favorites Favorites { get; set; }
public bool Skip { get; set; }
public bool Lock { get; set; }
public bool Hidden { get; set; }
public bool? Encrypted { get; set; }
public string ChannelOrTransponder { get; set; }
public string Satellite { get; set; }
public decimal FreqInMhz { get; set; }
public char Polarity { get; set; }
public int ServiceId { get; set; }
public int VideoPid { get; set; }
public int AudioPid { get; set; }
public int OriginalNetworkId { get; set; }
public int TransportStreamId { get; set; }
public int Bouquet { get; set; }
public string Provider { get; set; }
public int SymbolRate { get; set; }
public int ServiceType { get; set; }
public string Debug { get; private set; }
public string SatPosition { get; set; }
public Transponder Transponder { get; set; }
public IList<int> FavIndex { get; private set; }
public int ProgramNrPreset { get; set; }
public bool IsNameModified { get; set; }
#region ctor()
protected ChannelInfo()
{
this.NewProgramNr = -1;
this.FavIndex = new List<int>(MAX_FAV_LISTS);
for (int i = 0; i < MAX_FAV_LISTS; i++)
this.FavIndex.Add(-1);
this.Name = "";
this.ShortName = "";
}
/// <summary>
/// Constructor for exiting TV channel
/// </summary>
public ChannelInfo(SignalSource source, int index, int oldProgNr, string name) : this()
{
this.SignalSource = source;
this.RecordIndex = index;
this.RecordOrder = index;
this.NewProgramNr = -1;
this.OldProgramNr = oldProgNr;
this.Name = name;
this.Encrypted = null;
}
/// <summary>
/// Constructor for reference list channels which no longer exist in TV list
/// </summary>
public ChannelInfo(SignalSource source, string uid, int newProgNr, string name) : this()
{
this.SignalSource = source;
this.Uid = uid;
this.RecordIndex = -1;
this.RecordOrder = -1;
this.OldProgramNr = -1;
this.NewProgramNr = newProgNr;
this.Name = name;
this.Encrypted = null;
}
#endregion
#region Uid
public string Uid
{
get
{
if (this.uid == null)
{
if ((this.SignalSource & SignalSource.Digital) == 0)
this.uid = "A-0-" + (int)(this.FreqInMhz*20) + "-0";
else if ((this.SignalSource & SignalSource.Sat) != 0)
this.uid = "S" + this.SatPosition + "-" + this.OriginalNetworkId + "-" + this.TransportStreamId + "-" + this.ServiceId;
else
this.uid = "C-" + this.OriginalNetworkId + "-" + this.TransportStreamId + "-" + this.ServiceId + "-" + this.ChannelOrTransponder;
}
return this.uid;
}
set { this.uid = value; }
}
#endregion
#region ToString(), Equals(), GetHashCode()
public override string ToString()
{
string nr = this.NewProgramNr != -1 ? this.NewProgramNr.ToString() : "@" + this.RecordIndex;
return nr + ": " + this.Name;
}
public override bool Equals(object obj)
{
//ChannelInfo that = obj as ChannelInfo;
//return that != null && this.Uid == that.Uid && this.OldProgramNr == that.OldProgramNr;
return ReferenceEquals(this, obj);
}
public override int GetHashCode()
{
return this.Uid.GetHashCode() + this.OldProgramNr;
}
#endregion
#region NetworkName, NetworkOperator
public string NetworkName
{
get
{
var network = LookupData.Instance.GetNetwork(this.OriginalNetworkId);
return network == null ? null : network.Name;
}
}
public string NetworkOperator
{
get
{
var network = LookupData.Instance.GetNetwork(this.OriginalNetworkId);
return network == null ? null : network.Operator;
}
}
#endregion
#region ServiceTypeName
public string ServiceTypeName { get { return LookupData.Instance.GetServiceTypeDescription(this.ServiceType); } }
#endregion
#region GetFavString()
public static string GetFavString(Favorites favorites)
{
string sep = "";
string text = "";
foreach (Favorites favMask in Enum.GetValues(typeof(Favorites)))
{
if ((favorites & favMask) != 0)
{
text += sep + favMask.ToString();
sep = ",";
}
}
return text;
}
#endregion
#region ParseFavString()
public static Favorites ParseFavString(string value)
{
Favorites favMask = 0;
foreach (Favorites fav in Enum.GetValues(typeof (Favorites)))
{
foreach (char c in value)
{
if (c == fav.ToString()[0])
{
favMask |= fav;
break;
}
}
}
return favMask;
}
#endregion
#region AddDebug()
public void AddDebug(byte val)
{
if (this.Debug == null)
this.Debug = val.ToString("x2");
else
this.Debug += " " + val.ToString("x2");
}
public void AddDebug(ushort val)
{
if (this.Debug == null)
this.Debug = val.ToString("x2");
else
this.Debug += " " + val.ToString("x4");
}
public void AddDebug(byte[] data, int offset, int len)
{
for (int i = 0; i < len; i++)
this.AddDebug(data[offset + i]);
}
#endregion
#region UpdateRawData()
public virtual void UpdateRawData()
{
}
#endregion
#region ChangeEncoding()
public virtual void ChangeEncoding(System.Text.Encoding encoding)
{
}
#endregion
#region GetPosition(), SetPosition(), ChangePosition()
public int GetPosition(int subListIndex)
{
return subListIndex == 0 ? this.NewProgramNr : this.FavIndex[subListIndex - 1];
}
public void SetPosition(int subListIndex, int newPos)
{
if (subListIndex == 0)
this.NewProgramNr = newPos;
else
{
this.FavIndex[subListIndex - 1] = newPos;
int mask = 1 << (subListIndex - 1);
if (newPos == -1)
this.Favorites &= (Favorites)~mask;
else
this.Favorites |= (Favorites)mask;
}
}
internal void ChangePosition(int subListIndex, int delta)
{
if (subListIndex == 0)
this.NewProgramNr += delta;
else
this.FavIndex[subListIndex - 1] += delta;
}
#endregion
}
}

View File

@@ -0,0 +1,160 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace ChanSort.Api
{
public class ChannelList
{
private readonly SignalSource source;
private readonly IList<ChannelInfo> channels = new List<ChannelInfo>();
private readonly Dictionary<string, IList<ChannelInfo>> channelByUid = new Dictionary<string, IList<ChannelInfo>>();
private readonly Dictionary<int, ChannelInfo> channelByProgNr = new Dictionary<int, ChannelInfo>();
private readonly Dictionary<string, IList<ChannelInfo>> channelByName = new Dictionary<string, IList<ChannelInfo>>();
private int insertProgramNr = 1;
private int duplicateUidCount;
private int duplicateProgNrCount;
public ChannelList(SignalSource source, string caption)
{
this.source = source;
this.ShortCaption = caption;
this.FirstProgramNumber = (source & SignalSource.Digital) != 0 ? 1 : 0;
}
public string ShortCaption { get; private set; }
public SignalSource SignalSource { get { return this.source; } }
public IList<ChannelInfo> Channels { get { return this.channels; } }
public int Count { get { return channels.Count; } }
public int DuplicateUidCount { get { return duplicateUidCount; } }
public int DuplicateProgNrCount { get { return duplicateProgNrCount; } }
public bool ReadOnly { get; set; }
public int MaxChannelNameLength { get; set; }
public int PresetProgramNrCount { get; private set; }
#region Caption
public string Caption
{
get
{
string cap = this.ShortCaption;
int validChannelCount = this.Channels.Count(ch => ch.OldProgramNr != -1);
return cap + " (" + validChannelCount + ")";
}
}
#endregion
#region InsertProgramNumber
public int InsertProgramNumber
{
get { return this.Count == 0 ? 1 : this.insertProgramNr; }
set { this.insertProgramNr = Math.Max(this.FirstProgramNumber, value); }
}
#endregion
public int FirstProgramNumber { get; set; }
#region AddChannel()
public string AddChannel(ChannelInfo ci)
{
IList<ChannelInfo> others;
if (this.channelByUid.TryGetValue(ci.Uid, out others))
++duplicateUidCount;
else
{
others = new List<ChannelInfo>();
this.channelByUid.Add(ci.Uid, others);
}
others.Add(ci);
string warning2 = null;
bool isDupeProgNr = false;
if (ci.OldProgramNr != -1)
{
ChannelInfo other;
this.channelByProgNr.TryGetValue(ci.OldProgramNr, out other);
if (other != null)
{
warning2 = string.Format(Resources.ChannelList_ProgramNrAssignedToMultipleChannels,
this.ShortCaption, ci.OldProgramNr, other.RecordIndex, other.Name, ci.RecordIndex, ci.Name);
++duplicateProgNrCount;
isDupeProgNr = true;
}
}
if (!isDupeProgNr)
this.channelByProgNr[ci.OldProgramNr] = ci;
var lowerName = (ci.Name ?? "").ToLower().Trim();
var byNameList = this.channelByName.TryGet(lowerName);
if (byNameList == null)
{
byNameList = new List<ChannelInfo>();
this.channelByName[lowerName] = byNameList;
}
byNameList.Add(ci);
if (ci.ProgramNrPreset != 0)
++this.PresetProgramNrCount;
this.channels.Add(ci);
return warning2;
}
#endregion
#region GetChannelByUid()
public IList<ChannelInfo> GetChannelByUid(string uid)
{
IList<ChannelInfo> channel;
this.channelByUid.TryGetValue(uid, out channel);
return channel ?? new List<ChannelInfo>(0);
}
#endregion
#region ToString()
public override string ToString()
{
return this.Caption;
}
#endregion
#region GetChannelByName()
public IEnumerable<ChannelInfo> GetChannelByName(string name)
{
var hits = this.channelByName.TryGet(name.ToLower().Trim());
return hits ?? new List<ChannelInfo>();
}
#endregion
#region GetChannelByNewProgNr()
public IList<ChannelInfo> GetChannelByNewProgNr(int newProgNr)
{
return this.channels.Where(c => c.NewProgramNr == newProgNr).ToList();
}
#endregion
#region GetChannelsByNewOrder()
public IList<ChannelInfo> GetChannelsByNewOrder()
{
return this.channels.OrderBy(c => c.NewProgramNr).ToList();
}
#endregion
#region RemoveChannel()
public void RemoveChannel(ChannelInfo channel)
{
this.channels.Remove(channel);
var list = this.channelByUid.TryGet(channel.Uid);
if (list != null && list.Contains(channel))
list.Remove(channel);
list = this.channelByName.TryGet(channel.Name);
if (list != null && list.Contains(channel))
list.Remove(channel);
var chan = this.channelByProgNr.TryGet(channel.OldProgramNr);
if (ReferenceEquals(chan, channel))
this.channelByProgNr.Remove(channel.OldProgramNr);
}
#endregion
}
}

View File

@@ -0,0 +1,112 @@
using System.Collections.Generic;
using System.Text;
namespace ChanSort.Api
{
public class DataRoot
{
private readonly IDictionary<int, Satellite> satellites = new Dictionary<int, Satellite>();
private readonly IDictionary<int, Transponder> transponder = new Dictionary<int, Transponder>();
private readonly IDictionary<int, LnbConfig> lnbConfig = new Dictionary<int, LnbConfig>();
private readonly IList<ChannelList> channelLists = new List<ChannelList>();
private readonly StringBuilder warnings = new StringBuilder();
public StringBuilder Warnings { get { return this.warnings; } }
public IDictionary<int, Satellite> Satellites { get { return this.satellites; } }
public IDictionary<int, Transponder> Transponder { get { return this.transponder; } }
public IDictionary<int, LnbConfig> LnbConfig { get { return this.lnbConfig; } }
public ICollection<ChannelList> ChannelLists { get { return this.channelLists; } }
public bool IsEmpty { get { return this.channelLists.Count == 0; } }
public bool NeedsSaving { get; set; }
public Favorites SupportedFavorites { get; set; }
public bool SortedFavorites { get; set; }
public DataRoot()
{
this.SupportedFavorites = Favorites.A | Favorites.B | Favorites.C | Favorites.D;
}
#region AddSatellite()
public virtual void AddSatellite(Satellite satellite)
{
this.satellites.Add(satellite.Id, satellite);
}
#endregion
#region AddTransponder()
public virtual void AddTransponder(Satellite sat, Transponder trans)
{
trans.Satellite = sat;
if (this.transponder.ContainsKey(trans.Id))
{
this.warnings.AppendFormat("Duplicate transponder data record for satellite #{0} with id {1}\r\n", sat.Id, trans.Id);
return;
}
sat.Transponder.Add(trans.Id, trans);
this.transponder.Add(trans.Id, trans);
}
#endregion
#region AddLnbConfig()
public void AddLnbConfig(LnbConfig lnb)
{
this.lnbConfig.Add(lnb.Id, lnb);
}
#endregion
#region AddChannelList()
public virtual void AddChannelList(ChannelList list)
{
this.channelLists.Add(list);
}
#endregion
#region AddChannel()
public virtual void AddChannel(ChannelList list, ChannelInfo channel)
{
if (list == null)
{
warnings.AppendFormat("No list found to add channel '{0}'\r\n", channel);
return;
}
string warning = list.AddChannel(channel);
if (warning != null)
this.Warnings.AppendLine(warning);
}
#endregion
#region GetChannelList()
public ChannelList GetChannelList(SignalSource criteriaMask)
{
foreach (var list in this.channelLists)
{
uint searchMask = (uint)criteriaMask;
uint listMask = (uint) list.SignalSource;
if ((listMask & 0x000F & searchMask) != (searchMask & 0x000F)) // digital/analog
continue;
if ((listMask & 0x00F0 & searchMask) != (searchMask & 0x00F0)) // air/cable/sat/ip
continue;
if ((listMask & 0x0F00 & searchMask) != (searchMask & 0x0F00)) // tv/radio
continue;
if ((listMask & 0xF000) != (searchMask & 0xF000)) // preset list
continue;
return list;
}
return null;
}
#endregion
#region ApplyCurrentProgramNumbers()
public void ApplyCurrentProgramNumbers()
{
foreach (var list in this.ChannelLists)
{
foreach (var channel in list.Channels)
channel.NewProgramNr = channel.OldProgramNr;
}
}
#endregion
}
}

View File

@@ -0,0 +1,73 @@
using System;
namespace ChanSort.Api
{
#region enum SignalSource
/// <summary>
/// Bitmask for channel and list classification.
/// An individual channel can only have one bit of each group set.
/// A ChannelList can have multiple bits set to indicate which type of channels it can hold.
/// </summary>
[Flags]
public enum SignalSource
{
// bit 1+2: analog/digital
MaskAnalogDigital = 0x0003,
Analog = 0x0001,
Digital = 0x0002,
// bit 5+6+7+8: Antenna/Cable/Sat/IP
MaskAntennaCableSat = 0x00F0,
Antenna = 0x0010,
Cable = 0x0020,
Sat = 0x0040,
IP = 0x0080,
// bit 9+10: TV/Radio
MaskTvRadio = 0x0300,
Tv = 0x0100,
Radio = 0x0200,
TvAndRadio = Tv | Radio,
// bit 13-16: Preset list selector (AstraHD+, Freesat, TivuSat, CanalDigitalSat, ... for Samsung)
MaskProvider = 0xFC00,
StandardSat = 0 << 12,
AstraHdPlus = 1 << 12,
Freesat = 2 << 12,
TivuSat = 3 << 12,
CanalDigital = 4 << 12,
DigitalPlus = 5 << 12,
CyfraPlus = 6 << 12,
StandardCable = 0 << 12,
CablePrime = 1 << 12,
AnalogC = Analog + Cable,
AnalogT = Analog + Antenna,
AnalogCT = Analog + Cable + Antenna,
DvbC = Digital + Cable,
DvbT = Digital + Antenna,
DvbCT = Digital + Cable + Antenna,
DvbS = Digital + Sat,
SatIP = Digital + Sat + IP,
CablePrimeD = Digital + Cable + CablePrime,
HdPlusD = Digital + Sat + AstraHdPlus,
FreesatD = Digital + Sat + Freesat,
TivuSatD = Digital + Sat + TivuSat,
CanalDigitalSatD = Digital + Sat + CanalDigital,
DigitalPlusD = Digital + Sat + DigitalPlus,
CyfraPlusD = Digital + Sat + CyfraPlus
}
#endregion
[Flags]
public enum Favorites : byte { A = 0x01, B = 0x02, C = 0x04, D = 0x08, E = 0x10 }
public enum UnsortedChannelMode
{
AppendInOrder=0,
AppendAlphabetically=1,
MarkDeleted=2
}
}

View File

@@ -0,0 +1,7 @@
namespace ChanSort.Api
{
public class LnbConfig
{
public int Id { get; protected set; }
}
}

View File

@@ -0,0 +1,231 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
namespace ChanSort.Api
{
public class LookupData
{
private readonly IDictionary<int, NetworkInfo> networks = new Dictionary<int, NetworkInfo>();
private readonly IDictionary<int, int> transponderNrByFreqInMhz = new Dictionary<int, int>();
private readonly IDictionary<int, int> transponderFreqInMhzByNr = new Dictionary<int, int>();
private readonly IDictionary<int, string> serviceTypeDescriptions = new Dictionary<int, string>();
private readonly IDictionary<int, int> dvbtFreqInMhzByTransponder = new Dictionary<int, int>();
public static readonly LookupData Instance = new LookupData();
private LookupData()
{
this.LoadDataFromCsvFile();
}
#region GetNetwork()
public NetworkInfo GetNetwork(int networkId)
{
NetworkInfo network;
this.networks.TryGetValue((ushort)networkId, out network);
return network;
}
#endregion
#region GetTransponderNumber(), GetTransponderFrequency()
public int GetTransponderNumber(int frequencyInMhz)
{
int number;
bool found = this.transponderNrByFreqInMhz.TryGetValue(frequencyInMhz, out number) ||
this.transponderNrByFreqInMhz.TryGetValue(frequencyInMhz - 1, out number) ||
this.transponderNrByFreqInMhz.TryGetValue(frequencyInMhz + 1, out number) ||
this.transponderNrByFreqInMhz.TryGetValue(frequencyInMhz - 2, out number) ||
this.transponderNrByFreqInMhz.TryGetValue(frequencyInMhz + 2, out number);
return found ? number : 0;
}
public int GetTransponderFrequency(int transponderNr)
{
return this.transponderNrByFreqInMhz.TryGet(transponderNr);
}
#endregion
#region GetServiceTypeDescription()
public string GetServiceTypeDescription(int serviceType)
{
string descr;
this.serviceTypeDescriptions.TryGetValue(serviceType, out descr);
return descr;
}
#endregion
#region LoadDataFromCsvFile()
public void LoadDataFromCsvFile()
{
this.networks.Clear();
this.transponderFreqInMhzByNr.Clear();
this.transponderNrByFreqInMhz.Clear();
this.serviceTypeDescriptions.Clear();
this.dvbtFreqInMhzByTransponder.Clear();
string file = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lookup.csv");
if (!File.Exists(file))
return;
using (var reader = new StreamReader(file, System.Text.Encoding.UTF8))
{
string line;
while ((line = reader.ReadLine()) != null)
{
var fields = CsvFile.Parse(line, ';');
if (fields.Count == 0)
continue;
switch (fields[0].ToLower())
{
case "onid": this.ParseNetwork(fields); break;
case "dvbt": this.ParseDvbtTransponder(fields); break;
case "transp": this.ParseTransponder(fields); break;
case "servicetype": this.ParseServiceType(fields); break;
}
}
}
}
#endregion
#region AddNetwork()
private void AddNetwork(NetworkInfo network)
{
this.networks[network.OriginalNetworkId] = network;
}
#endregion
#region AddTransponderMapping()
private void AddTransponderMapping(int transponderNr, int frequencyInMhz)
{
this.transponderNrByFreqInMhz[frequencyInMhz] = transponderNr;
this.transponderFreqInMhzByNr[transponderNr] = frequencyInMhz;
}
#endregion
#region AddDvbtTransponderMapping()
private void AddDvbtTransponderMapping(int transponderNr, int frequencyInMhz)
{
this.dvbtFreqInMhzByTransponder[transponderNr] = frequencyInMhz;
}
#endregion
#region AddServiceType()
public void AddServiceType(int serviceType, string description)
{
this.serviceTypeDescriptions[serviceType] = description;
}
#endregion
#region ParseNetwork()
private void ParseNetwork(IList<string> fields)
{
if (fields.Count < 3)
return;
int start = ParseNumber(fields[1]);
int end = ParseNumber(fields[2]);
if (start == 0 || end == 0 || start > end)
return;
for (int onid = start; onid <= end; onid++)
{
var network = new NetworkInfo();
network.OriginalNetworkId = onid;
if (fields.Count >= 4)
network.Name = fields[3];
if (fields.Count >= 5)
network.Operator = fields[4];
this.AddNetwork(network);
}
}
#endregion
#region ParseNumber()
private int ParseNumber(string nr)
{
int number;
if (nr.StartsWith("0x"))
int.TryParse(nr.Substring(2), System.Globalization.NumberStyles.HexNumber, System.Globalization.NumberFormatInfo.InvariantInfo, out number);
else
int.TryParse(nr, System.Globalization.NumberStyles.Integer, System.Globalization.NumberFormatInfo.InvariantInfo, out number);
return number;
}
#endregion
#region ParseTransponder()
private void ParseTransponder(IList<string> fields)
{
if (fields.Count < 3)
return;
int nr, freq;
int.TryParse(fields[1], out nr);
int.TryParse(fields[2], out freq);
if (nr == 0 || freq == 0)
return;
this.AddTransponderMapping(nr, freq);
}
#endregion
#region ParseTransponder()
private void ParseDvbtTransponder(IList<string> fields)
{
if (fields.Count < 3)
return;
int nr, freq;
int.TryParse(fields[1], out nr);
int.TryParse(fields[2], out freq);
if (nr == 0 || freq == 0)
return;
this.AddDvbtTransponderMapping(nr, freq);
}
#endregion
#region ParseServiceType()
private void ParseServiceType(IList<string> fields)
{
if (fields.Count < 3) return;
int serviceType = this.ParseNumber(fields[1]);
if (serviceType <= 0) return;
this.AddServiceType(serviceType, fields[2]);
}
#endregion
#region IsRadioOrTv()
public SignalSource IsRadioOrTv(int dvbServiceType)
{
switch (dvbServiceType)
{
case 0x01: // SD MPEG1
case 0x11: // MPEG2-HD
case 0x16: // H264/AVC-SD
case 0x19: // H264/AVC-HD
case 0x1F: // UHD
return SignalSource.Tv;
case 0x02:
case 0x0A:
return SignalSource.Radio;
}
return 0;
}
#endregion
#region GetDvbtTransponder()
public int GetDvbtTransponder(decimal freq)
{
return (int)(freq - 106)/8;
}
#endregion
#region GetDvbtFrequencyForTransponder()
public decimal GetDvbtFrequenyForTransponder(int transponder)
{
return transponder * 8 + 106;
}
#endregion
#region GetDvbtFrequencyForChannel()
public decimal GetDvbtFrequenyForChannel(int channel)
{
return channel * 8 + 306;
}
#endregion
}
}

View File

@@ -0,0 +1,9 @@
namespace ChanSort.Api
{
public class NetworkInfo
{
public int OriginalNetworkId { get; set; }
public string Name { get; set; }
public string Operator { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
namespace ChanSort.Api
{
public class Satellite
{
private readonly int id;
private readonly IDictionary<int, Transponder> transponder = new Dictionary<int, Transponder>();
public int Id { get { return this.id; } }
public string Name { get; set; }
public string OrbitalPosition { get; set; }
public IDictionary<int, Transponder> Transponder { get { return this.transponder; } }
public Satellite(int id)
{
this.id = id;
}
public LnbConfig LnbConfig { get; set; }
public override string ToString()
{
return Name;
}
}
}

View File

@@ -0,0 +1,22 @@
namespace ChanSort.Api
{
public class Transponder
{
private readonly int id;
public int Id { get { return id; } }
public Satellite Satellite { get; set; }
public decimal FrequencyInMhz { get; set; }
public int Number { get; set; }
public virtual int SymbolRate { get; set; }
public char Polarity { get; set; }
public int OriginalNetworkId { get; set; }
public int TransportStreamId { get; set; }
public Transponder(int id)
{
this.id = id;
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("API")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("API")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[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("5cd52683-ba04-4610-8435-ba409a37e08f")]
// 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,81 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChanSort.Api {
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 Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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.Api.Resources", typeof(Resources).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 {0}: Channel &apos;{1}&apos; has multiple data records: index {2}=Pr#{3} and index {4}=Pr#{5}.
/// </summary>
internal static string ChannelList_AddChannel__DuplicateUid {
get {
return ResourceManager.GetString("ChannelList_AddChannel__DuplicateUid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} Program #{1} is assigned to multiple channels: index {2}=&apos;{3}&apos; and index {4}=&apos;{5}&apos;.
/// </summary>
internal static string ChannelList_ProgramNrAssignedToMultipleChannels {
get {
return ResourceManager.GetString("ChannelList_ProgramNrAssignedToMultipleChannels", resourceCulture);
}
}
}
}

View File

View File

@@ -0,0 +1,126 @@
<?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="ChannelList_ProgramNrAssignedToMultipleChannels" xml:space="preserve">
<value>{0} Program #{1} ist mehreren Sendern zugeordnet: Index {2}='{3}' und Index {4}='{5}'</value>
</data>
<data name="ChannelList_AddChannel__DuplicateUid" xml:space="preserve">
<value>{0}: Sender '{1}' ist in mehreren Datensätzen enthalten: Index {2}=Pr#{3} und Index {4}=Pr#{5}</value>
</data>
</root>

View File

@@ -0,0 +1,126 @@
<?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="ChannelList_ProgramNrAssignedToMultipleChannels" xml:space="preserve">
<value>{0} Program #{1} is assigned to multiple channels: index {2}='{3}' and index {4}='{5}'</value>
</data>
<data name="ChannelList_AddChannel__DuplicateUid" xml:space="preserve">
<value>{0}: Channel '{1}' has multiple data records: index {2}=Pr#{3} and index {4}=Pr#{5}</value>
</data>
</root>

View File

@@ -0,0 +1,43 @@
using System.IO;
namespace ChanSort
{
public static class BrowserHelper
{
public static void OpenUrl(string url)
{
OpenHtml(@"
<html>
<head>
<meta http-equiv='Refresh' content='0;" + url + @"'/>
</head>
</html>");
}
public static void OpenMail(string url)
{
OpenHtml(@"
<html>
<head>
<script language=""javascript"">
window.open(""" + url + @""");
window.close();
</script>
</head>
</html>");
}
public static void OpenHtml(string html)
{
try
{
string fileName = Path.GetTempFileName() + ".html";
File.WriteAllText(fileName, html);
System.Diagnostics.Process.Start(fileName);
}
catch
{
}
}
}
}

View File

@@ -0,0 +1,151 @@
using System.Text;
namespace ChanSort.Api
{
public unsafe class ChannelMappingBase : DataMapping
{
protected const string offInUse = "offInUse";
protected const string maskInUse = "maskInUse";
protected const string offProgramNr = "offProgramNr";
protected const string offName = "offName";
protected const string offNameLength = "offNameLength";
protected const string lenName = "lenName";
protected const string offSkip = "offSkip";
protected const string maskSkip = "maskSkip";
protected const string offLock = "offLock";
protected const string maskLock = "maskLock";
protected const string offLockSkipHide = "offHide";
protected const string maskHide = "maskHide";
protected const string offFavorites = "offFavorites";
private const string offDeleted = "offDeleted";
private const string maskDeleted = "maskDeleted";
#region ctor()
public ChannelMappingBase(IniFile.Section settings, int length, Encoding stringEncoding) :
base(settings, length, stringEncoding)
{
}
#endregion
#region InUse
public virtual bool InUse
{
get
{
var val = this.GetOffsets(offInUse);
return val.Length == 0 || this.GetFlag(offInUse, maskInUse);
}
}
#endregion
#region ProgramNr
public virtual ushort ProgramNr
{
get { return this.GetWord(offProgramNr); }
set { this.SetWord(offProgramNr, value); }
}
#endregion
#region NameLength
public virtual int NameLength
{
get
{
var off = this.GetOffsets(offNameLength);
if (off.Length > 0)
return this.GetWord(off[0]);
return MaxNameLength;
}
set { this.SetByte(offNameLength, (byte) value); }
}
#endregion
#region MaxNameLength
public virtual int MaxNameLength
{
get
{
var off = this.GetOffsets(lenName); // not an offset!
return off.Length > 0 ? off[0] : 0;
}
}
#endregion
#region Name
public virtual string Name
{
get { return this.GetString(offName, this.NameLength); }
// ReSharper disable ValueParameterNotUsed
set { }
// ReSharper restore ValueParameterNotUsed
}
#endregion
#region NamePtr
public virtual byte* NamePtr
{
get { return this.DataPtr + this.GetOffsets(offName)[0]; }
set
{
int maxLen = this.MaxNameLength - 1;
if (maxLen == 0)
maxLen = this.NameLength;
foreach (int off in this.GetOffsets(offName))
{
int i;
for (i = 0; i < maxLen && value[i] != 0; i++)
this.DataPtr[off + i] = value[i];
for (; i <= maxLen; i++)
this.DataPtr[off + i] = 0;
}
}
}
#endregion
#region ShortName
public virtual string ShortName { get; set; }
#endregion
#region Skip
public virtual bool Skip
{
get { return this.GetFlag(offSkip, maskSkip); }
set { this.SetFlag(offSkip, maskSkip, value); }
}
#endregion
#region Lock
public virtual bool Lock
{
get { return this.GetFlag(offLock, maskLock); }
set { this.SetFlag(offLock, maskLock, value); }
}
#endregion
#region Hide
public virtual bool Hide
{
get { return this.GetFlag(offLockSkipHide, maskHide); }
set { this.SetFlag(offLockSkipHide, maskHide, value); }
}
#endregion
#region Favorites
public virtual Favorites Favorites
{
get { return (Favorites) this.GetByte(offFavorites); }
set { this.SetByte(offFavorites, (byte) value); }
}
#endregion
#region IsDeleted
public virtual bool IsDeleted
{
get { return this.GetFlag(offDeleted, maskDeleted); }
set { this.SetFlag(offDeleted, maskDeleted, value); }
}
#endregion
}
}

View File

@@ -0,0 +1,62 @@
namespace ChanSort.Api
{
public static class Crc32
{
private const uint CrcMask = 0xFFFFFFFF;
private const uint CrcPoly = 0xEDB88320;
private static readonly uint[] crc32Table;
static Crc32()
{
crc32Table = InitCrc32Table();
}
#region InitCrc32Table()
private static uint[] InitCrc32Table()
{
var crcTable = new uint[256];
for (uint i = 0; i < 256; i++)
{
uint r = i;
for (uint j = 8; j > 0; j--)
{
if ((r & 1) == 1)
r = ((r >> 1) ^ CrcPoly);
else
r >>= 1;
}
crcTable[i] = r;
}
return crcTable;
}
#endregion
#region CalcCrc32()
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[start + i]] ^ (crc32 >> 8);
return crc32;
}
#endregion
#region Crack()
#if false
public static unsafe int Crack(byte* block, int maxLen, uint checksum)
{
uint crc32 = CrcMask;
for (int i = 0; i < maxLen; i++)
{
if (crc32 == checksum)
return i;
crc32 = crc32Table[(crc32 & 0xff) ^ block[i]] ^ (crc32 >> 8);
}
return 0;
}
#endif
#endregion
}
}

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using System.Text;
namespace ChanSort.Api
{
public static class CsvFile
{
public static IList<string> Parse(string line, char separator)
{
if (line.EndsWith("\n")) line = line.Substring(0, line.Length - 1);
if (line.EndsWith("\r")) line = line.Substring(0, line.Length - 1);
List<string> tokens = new List<string>();
if (line.Length == 0)
return tokens;
bool inQuote = false;
StringBuilder token = new StringBuilder();
for(int i = 0, len=line.Length; i<len; i++)
{
char ch = line[i];
if (ch == separator && !inQuote)
{
tokens.Add(token.ToString());
token.Remove(0, token.Length);
continue;
}
if (ch == '"')
{
if (inQuote && i+1 < len && line[i+1] == '"')
{
token.Append('"');
++i;
continue;
}
inQuote = !inQuote;
continue;
}
token.Append(ch);
}
tokens.Add(token.ToString());
return tokens;
}
}
}

View File

@@ -0,0 +1,197 @@
using System;
using System.Text;
namespace ChanSort.Api
{
public class DataMapping
{
protected readonly IniFile.Section settings;
private int baseOffset;
private byte[] data { get; set; }
public Encoding DefaultEncoding { get; set; }
#region ctor()
public DataMapping(IniFile.Section settings)
{
this.settings = settings;
this.DefaultEncoding = Encoding.Default;
}
#endregion
#region SetDataPtr(), Data, BaseOffset
public void SetDataPtr(byte[] data, int baseOffset)
{
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()
public int[] GetOffsets(string key)
{
return settings.GetIntList(key);
}
#endregion
public IniFile.Section Settings { get { return this.settings; } }
#region Byte
public byte GetByte(string key)
{
var offsets = settings.GetIntList(key);
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 Word
public ushort GetWord(string key)
{
var offsets = settings.GetIntList(key);
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.data[baseOffset + offset + 0] = (byte)value;
this.data[baseOffset + offset + 1] = (byte)(value>>8);
}
}
#endregion
#region DWord
public long GetDword(string key)
{
var offsets = settings.GetIntList(key);
if (offsets.Length == 0) return 0;
return BitConverter.ToUInt32(this.data, baseOffset + offsets[0]);
}
public void SetDword(string key, long value)
{
var offsets = settings.GetIntList(key);
foreach (int offset in offsets)
{
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 Float
public float GetFloat(string key)
{
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)
{
for (int i = 0; i < 4; i++)
this.data[baseOffset + offset + i] = bytes[i];
}
}
#endregion
#region GetFlag
public bool GetFlag(string key, bool defaultValue = false)
{
return GetFlag("off" + key, "mask" + key, defaultValue);
}
public bool GetFlag(string valueKey, string maskKey, bool defaultValue = false)
{
int mask = settings.GetInt(maskKey);
return GetFlag(valueKey, mask, defaultValue);
}
public bool GetFlag(string valueKey, int mask, bool defaultValue = false)
{
if (mask == 0) return defaultValue;
var offsets = settings.GetIntList(valueKey);
if (offsets.Length == 0) return defaultValue;
return (this.data[baseOffset + offsets[0]] & mask) == mask;
}
#endregion
#region SetFlag()
public void SetFlag(string key, bool value)
{
this.SetFlag("off" + key, "mask" + key, value);
}
public void SetFlag(string valueKey, string maskKey, bool value)
{
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 (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 int 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;
}
return len;
}
#endregion
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.IO;
namespace ChanSort.Api
{
public static class DepencencyChecker
{
public static bool IsVc2010RedistPackageX86Installed()
{
object value = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86",
"Installed", null);
return value != null && Convert.ToInt32(value) == 1;
}
public static void AssertVc2010RedistPackageX86Installed()
{
if (!IsVc2010RedistPackageX86Installed())
throw new FileLoadException("Please download and install the Microsoft Visual C++ 2010 Redistributable Package (x86)");
}
}
}

View File

@@ -0,0 +1,237 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ChanSort.Api
{
#region Documentation
/*
ETSI EN 300 468
For one-byte character tables, the codes in the range 0x80 to 0x9F are assigned to control functions
as shown in Table A.1: Single byte control codes
Control code - Control code Description
0x80 to 0x85 reserved for future use
0x86 character emphasis on
0x87 character emphasis off
0x88 to 0x89 reserved for future use
0x8A CR/LF
0x8B to 0x9F user defined
A.2 Selection of character table
First byte value - Character code table - Table description - Reproduced in figure
0x01 ISO/IEC 8859-5 [27] Latin/Cyrillic alphabet A.2
0x02 ISO/IEC 8859-6 [28] Latin/Arabic alphabet A.3
0x03 ISO/IEC 8859-7 [29] Latin/Greek alphabet A.4
0x04 ISO/IEC 8859-8 [30] Latin/Hebrew alphabet A.5
0x05 ISO/IEC 8859-9 [31] Latin alphabet No. 5 A.6
0x06 ISO/IEC 8859-10 [32] Latin alphabet No. 6 A.7
0x07 ISO/IEC 8859-11 [33] Latin/Thai (draft only) A.8
0x08 reserved for future use (see note)
0x09 ISO/IEC 8859-13 [34] Latin alphabet No. 7 A.9
0x0A ISO/IEC 8859-14 [35] Latin alphabet No. 8 (Celtic) A.10
0x0B ISO/IEC 8859-15 [36] Latin alphabet No. 9 A.11
0x0C to 0x0F reserved for future use
0x10 ISO/IEC 8859 See table A.4
0x11 ISO/IEC 10646 [16] Basic Multilingual Plane (BMP)
0x12 KSX1001-2004 [44] Korean Character Set
0x13 GB-2312-1980 Simplified Chinese Character
0x14 Big5 subset of ISO/IEC 10646 [16] Traditional Chinese
0x15 UTF-8 encoding of ISO/IEC 10646 [16] Basic Multilingual Plane (BMP)
0x16 to 0x1E reserved for future use
0x1F Described by encoding_type_id Described by 8 bit
Table A.4: Character Coding Tables for first byte 0x10
First byte value - Second byte value - Third Byte Value - Selected character code - table - Table Description
0x10 0x00 0x00 reserved for future use
0x10 0x00 0x01 ISO/IEC 8859-1 [23] West European
0x10 0x00 0x02 ISO/IEC 8859-2 [24] East European
0x10 0x00 0x03 ISO/IEC 8859-3 [25] South European
0x10 0x00 0x04 ISO/IEC 8859-4 [26] North and North-East European
0x10 0x00 0x05 ISO/IEC 8859-5 [27] Latin/Cyrillic A.2
0x10 0x00 0x06 ISO/IEC 8859-6 [28] Latin/Arabic A.3
0x10 0x00 0x07 ISO/IEC 8859-7 [29] Latin/Greek A.4
0x10 0x00 0x08 ISO/IEC 8859-8 [30] Latin/Hebrew A.5
0x10 0x00 0x09 ISO/IEC 8859-9 [31] West European & Turkish A.6
0x10 0x00 0x0A ISO/IEC 8859-10 [32] North European A.7
0x10 0x00 0x0B ISO/IEC 8859-11 [33] Thai A.8
0x10 0x00 0x0C Reserved for future use
0x10 0x00 0x0D ISO/IEC 8859-13 [34] Baltic A.9
0x10 0x00 0x0E ISO/IEC 8859-14 [35] Celtic A.10
0x10 0x00 0x0F ISO/IEC 8859-15 [36] West European A.11
*/
#endregion
public class DvbStringDecoder
{
static readonly string[] codePages1 =
{
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-8", null, null, null, "utf-8"
};
static readonly string[] codePages2 =
{
null, "iso-8859-1", "iso-8859-2", "iso-8859-3", "iso-8859-4", "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"
};
private readonly Dictionary<string, Decoder> decoderCache = new Dictionary<string, Decoder>();
public DvbStringDecoder(Encoding defaultEncoding)
{
this.DefaultEncoding = defaultEncoding;
}
public Encoding DefaultEncoding { get; set; }
#region GetChannelNames()
public void GetChannelNames(byte[] name, int off, int len, out string longName, out string shortName)
{
longName = "";
shortName = "";
if (len == 0)
return;
byte b = name[off];
if (b == 0)
return;
Decoder decoder = this.DefaultEncoding.GetDecoder();
bool singleByteChar = true;
if (b < 0x20)
{
if (b == 0x10) // prefix for 2-byte code page
{
int cpIndex = name[off + 1] * 256 + name[off + 2];
off += 2;
len -= 2;
SetDecoder(codePages2, cpIndex, ref decoder);
}
if (b <= 0x1F)
SetDecoder(codePages1, b, ref decoder);
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)
{
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;
sbLong.Append(ch);
if (inShortMode)
sbShort.Append(ch);
}
longName = sbLong.ToString();
shortName = sbShort.ToString();
}
#endregion
#region SetDecoder()
private void SetDecoder(string[] codePages, int cpIndex, ref Decoder defaultDecoder)
{
if (cpIndex >= codePages.Length)
return;
Decoder decoder;
string cp = codePages[cpIndex];
if (cp == null)
return;
if (this.decoderCache.TryGetValue(cp, out decoder))
{
defaultDecoder = decoder;
return;
}
try
{
var encoding = Encoding.GetEncoding(cp);
defaultDecoder = encoding.GetDecoder();
}
catch (ArgumentException)
{
}
decoderCache[cp] = defaultDecoder;
}
#endregion
#region GetCodepageBytes()
public static byte[] GetCodepageBytes(Encoding encoding)
{
var encName = encoding.WebName;
for (int i = 0; i < codePages1.Length; i++)
{
if (codePages1[i] == encName)
return new [] {(byte)i};
}
for (int i = 0; i < codePages2.Length; i++)
{
if (codePages2[i] == encName)
return new[] { (byte)0x10, (byte)i };
}
return new byte[0];
}
#endregion
#region GetEncoding()
/// <summary>
/// Pass in either a value &lt;=0x1F excluding 0x10 or 0x10xxyy
/// </summary>
public static Encoding GetEncoding(int encodingMarker)
{
string enc = null;
if (encodingMarker < 0x20)
enc = codePages1[encodingMarker];
else
{
encodingMarker &= 0xFFFF;
if (encodingMarker < codePages2.Length)
enc = codePages2[encodingMarker];
}
return enc == null ? null : Encoding.GetEncoding(enc);
}
#endregion
}
}

View File

@@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace ChanSort.Api
{
public class IniFile
{
#region class Section
public class Section
{
private readonly Dictionary<string, string> data = new Dictionary<string, string>(StringComparer.CurrentCultureIgnoreCase);
public Section(string name)
{
this.Name = name;
}
#region Name
public string Name { get; private set; }
#endregion
#region Set()
internal void Set(string key, string value)
{
data[key] = value;
}
#endregion
#region Keys
public IEnumerable<string> Keys { get { return data.Keys; } }
#endregion
#region GetString()
public string GetString(string key)
{
string value;
if (!data.TryGetValue(key, out value))
return null;
return value;
}
#endregion
#region GetInt()
public int GetInt(string key, int defaultValue = 0)
{
string value;
if (!data.TryGetValue(key, out value))
return defaultValue;
return this.ParseNumber(value);
}
#endregion
#region GetBytes()
public byte[] GetBytes(string key)
{
string value;
if (!data.TryGetValue(key, out value))
return null;
if (string.IsNullOrEmpty(value))
return new byte[0];
string[] parts = value.Split(',');
byte[] bytes = new byte[parts.Length];
int i = 0;
foreach (var part in parts)
bytes[i++] = (byte)this.ParseNumber(part);
return bytes;
}
#endregion
#region GetIntList()
public int[] GetIntList(string key)
{
string value = this.GetString(key);
if (string.IsNullOrEmpty(value))
return new int[0];
string[] numbers = value.Split(',');
int[] ret = new int[numbers.Length];
for (int i = 0; i < numbers.Length; i++)
ret[i] = this.ParseNumber(numbers[i]);
return ret;
}
#endregion
#region ParseNumber()
private int ParseNumber(string value)
{
if (value.ToLower().StartsWith("0x"))
{
try { return Convert.ToInt32(value, 16); }
catch { return 0; }
}
int intValue;
int.TryParse(value, out intValue);
return intValue;
}
#endregion
}
#endregion
private readonly Dictionary<string, Section> sectionDict;
private readonly List<Section> sectionList;
public IniFile(string fileName)
{
this.sectionDict = new Dictionary<string, Section>();
this.sectionList = new List<Section>();
this.ReadIniFile(fileName);
}
public IEnumerable<Section> Sections
{
get { return this.sectionList; }
}
public Section GetSection(string sectionName)
{
return sectionDict.TryGet(sectionName);
}
#region ReadIniFile()
private void ReadIniFile(string fileName)
{
using (StreamReader rdr = new StreamReader(fileName))
{
Section currentSection = null;
string line;
string key = null;
string val = null;
while ((line = rdr.ReadLine()) != null)
{
string trimmedLine = line.Trim();
if (trimmedLine.StartsWith(";"))
continue;
if (trimmedLine.StartsWith("["))
{
string sectionName = trimmedLine.EndsWith("]")
? trimmedLine.Substring(1, trimmedLine.Length - 2)
: trimmedLine.Substring(1);
currentSection = new Section(sectionName);
this.sectionList.Add(currentSection);
this.sectionDict[sectionName] = currentSection;
continue;
}
if (currentSection == null)
continue;
if (val == null)
{
int idx = trimmedLine.IndexOf("=");
if (idx < 0)
continue;
key = trimmedLine.Substring(0, idx).Trim();
val = trimmedLine.Substring(idx + 1).Trim();
}
else
val += line;
if (val.EndsWith("\\"))
val = val.Substring(val.Length - 1).Trim();
else
{
currentSection.Set(key, val);
val = null;
}
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,47 @@
using System.Collections.Generic;
using System.IO;
namespace ChanSort.Api
{
public class MappingPool<T> where T : DataMapping
{
private const string ERR_unknownACTChannelDataLength = "Configuration doesn't contain a {0} data mapping for length {1}";
private readonly Dictionary<string, T> mappings = new Dictionary<string, T>();
private readonly string caption;
public System.Text.Encoding DefaultEncoding { get; set; }
public MappingPool(string caption)
{
this.caption = caption;
}
public void AddMapping(int dataLength, T mapping)
{
this.AddMapping(dataLength.ToString(), mapping);
}
public void AddMapping(string id, T mapping)
{
this.mappings.Add(id, mapping);
}
public T GetMapping(int dataLength, bool throwException = true)
{
return this.GetMapping(dataLength.ToString(), throwException);
}
public T GetMapping(string id, bool throwException = true)
{
if (id == "0" || string.IsNullOrEmpty(id))
return null;
T mapping;
if (!mappings.TryGetValue(id, out mapping) && throwException)
throw new FileLoadException(string.Format(ERR_unknownACTChannelDataLength, this.caption, id));
if (mapping != null && this.DefaultEncoding != null)
mapping.DefaultEncoding = this.DefaultEncoding;
return mapping;
}
}
}

View File

@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
namespace ChanSort.Api
{
public static class Tools
{
public static V TryGet<K, V>(this IDictionary<K, V> dict, K key)
{
V val;
dict.TryGetValue(key, out val);
return val;
}
#region GetAnalogChannelNumber()
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 "";
}
#endregion
#region GetInt16/32()
public static int GetInt16(byte[] data, int offset, bool littleEndian)
{
return littleEndian ? BitConverter.ToInt16(data, offset) : (data[offset] << 8) + data[offset + 1];
}
public static int GetInt32(byte[] data, int offset, bool littleEndian)
{
return littleEndian ? BitConverter.ToInt32(data, offset) :
(data[offset] << 24) + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
}
#endregion
#region SetInt16/32()
public static void SetInt16(byte[] data, int offset, int value, bool littleEndian = true)
{
if (littleEndian)
{
data[offset + 0] = (byte) value;
data[offset + 1] = (byte) (value >> 8);
}
else
{
data[offset + 0] = (byte)(value >> 8);
data[offset + 1] = (byte) value;
}
}
public static void SetInt32(byte[] data, int offset, int value, bool littleEndian = true)
{
if (littleEndian)
{
data[offset + 0] = (byte) value;
data[offset + 1] = (byte) (value >> 8);
data[offset + 2] = (byte) (value >> 16);
data[offset + 3] = (byte) (value >> 24);
}
else
{
data[offset + 0] = (byte)(value >> 24);
data[offset + 1] = (byte)(value >> 16);
data[offset + 2] = (byte)(value >> 8);
data[offset + 3] = (byte)value;
}
}
#endregion
#region MemCopy(), MemSet()
public static void MemCopy(byte[] source, int sourceIndex, byte[] dest, int destIndex, int count)
{
for (int i = 0; i < count; i++)
dest[destIndex + i] = source[sourceIndex + i];
}
public static void MemSet(byte[] data, int offset, byte value, int count)
{
for (int i = 0; i < count; i++)
data[offset++] = value;
}
#endregion
#region ReverseByteOrder()
public static ushort ReverseByteOrder(ushort input)
{
return (ushort)(((input & 0x00FF) << 8) | (input >> 8));
}
public static uint ReverseByteOrder(uint input)
{
return ((input & 0x000000FF) << 24) | ((input & 0x0000FF00) << 8) | ((input & 0x00FF0000) >> 8) | ((input & 0xFF000000) >> 24);
}
#endregion
#region HexDecode()
public static byte[] HexDecode(string input)
{
var bytes = new byte[input.Length/2];
for (int i = 0, c = input.Length/2; i < c; i++)
{
char ch = Char.ToUpper(input[i*2]);
var high = Char.IsDigit(ch) ? ch - '0' : ch - 'A' + 10;
ch = Char.ToUpper(input[i*2 + 1]);
var low = Char.IsDigit(ch) ? ch - '0' : ch - 'A' + 10;
bytes[i] = (byte)((high << 4) | low);
}
return bytes;
}
#endregion
}
}

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5361C8CB-F737-4709-AF8C-E1F0456F3C5B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Loader.GlobalClone</RootNamespace>
<AssemblyName>ChanSort.Loader.GlobalClone</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</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>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GcChannel.cs" />
<Compile Include="GcSerializer.cs" />
<Compile Include="GcSerializerPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources.de.Designer.cs">
<DependentUpon>Resources.de.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
<Project>{dccffa08-472b-4d17-bb90-8f513fc01392}</Project>
<Name>ChanSort.Api</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="readme.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.de.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.de.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</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,21 @@
using System.Xml;
using ChanSort.Api;
namespace ChanSort.Loader.GlobalClone
{
internal class GcChannel : ChannelInfo
{
internal int Index;
internal XmlNode XmlNode;
#region ctor()
internal GcChannel(SignalSource source, int index, XmlNode node)
{
this.SignalSource = source;
this.Index = index;
this.XmlNode = node;
}
#endregion
}
}

View File

@@ -0,0 +1,436 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using ChanSort.Api;
namespace ChanSort.Loader.GlobalClone
{
class GcSerializer : SerializerBase
{
private readonly ChannelList atvChannels = new ChannelList(SignalSource.AnalogCT | SignalSource.TvAndRadio, "Analog");
private readonly ChannelList dtvTvChannels = new ChannelList(SignalSource.DvbCT | SignalSource.Tv, "DTV");
private readonly ChannelList dtvRadioChannels = new ChannelList(SignalSource.DvbCT | SignalSource.Radio, "Radio");
private readonly ChannelList satTvChannels = new ChannelList(SignalSource.DvbS | SignalSource.Tv, "Sat-TV");
private readonly ChannelList satRadioChannels = new ChannelList(SignalSource.DvbS | SignalSource.Radio, "Sat-Radio");
private XmlDocument doc;
private readonly DvbStringDecoder dvbStringDecoder = new DvbStringDecoder(Encoding.Default);
private string modelName;
private readonly Dictionary<int, string> satPositionByIndex = new Dictionary<int, string>();
#region ctor()
public GcSerializer(string inputFile) : base(inputFile)
{
this.Features.ChannelNameEdit = false;
//this.Features.CanDeleteChannels = false;
this.DataRoot.AddChannelList(this.atvChannels);
this.DataRoot.AddChannelList(this.dtvTvChannels);
this.DataRoot.AddChannelList(this.dtvRadioChannels);
this.DataRoot.AddChannelList(this.satTvChannels);
this.DataRoot.AddChannelList(this.satRadioChannels);
}
#endregion
#region DisplayName
public override string DisplayName { get { return "LG GlobalClone loader"; } }
#endregion
#region Load()
public override void Load()
{
bool fail = false;
try
{
this.doc = new XmlDocument();
using (var reader = new StreamReader(new FileStream(this.FileName, FileMode.Open), Encoding.UTF8))
doc.Load(reader);
}
catch
{
fail = true;
}
var root = doc.FirstChild;
if (root is XmlDeclaration)
root = root.NextSibling;
if (fail || root == null || root.LocalName != "TLLDATA")
throw new FileLoadException("\"" + this.FileName + "\" is not a supported GlobalClone XML file");
foreach (XmlNode child in root.ChildNodes)
{
switch (child.LocalName)
{
case "ModelInfo":
this.ReadModelInfo(child);
break;
case "SatelliteDB":
this.ReadSatelliteDB(child);
break;
case "CHANNEL":
this.ReadChannelLists(child);
break;
}
}
}
#endregion
#region ReadModelInfo()
private void ReadModelInfo(XmlNode modelInfoNode)
{
var txt = Resources.GcSerializer_ReadModelInfo_ModelWarning;
var regex = new System.Text.RegularExpressions.Regex(@"\d{2}([A-Z]{2})(\d{2})\d[0-9A-Z].*");
foreach (XmlNode child in modelInfoNode.ChildNodes)
{
switch (child.LocalName)
{
case "ModelName":
this.modelName = child.InnerText;
var match = regex.Match(this.modelName);
if (match.Success)
{
var series = match.Groups[1].Value;
if ((series == "LB" || series == "UB") && StringComparer.InvariantCulture.Compare(match.Groups[2].Value, "60") >= 0)
txt = Resources.GcSerializer_webOsFirmwareWarning;
}
break;
}
}
MessageBox.Show(txt, "LG GlobalClone editor", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion
#region ReadSatelliteDB()
private void ReadSatelliteDB(XmlNode node)
{
foreach (XmlNode child in node.ChildNodes)
{
switch (child.LocalName)
{
case "SATDBInfo":
this.ReadSatDbInfo(child);
break;
}
}
}
private void ReadSatDbInfo(XmlNode node)
{
foreach (XmlNode child in node.ChildNodes)
{
switch (child.LocalName)
{
case "SatRecordInfo":
int i = 0;
foreach (XmlNode satNode in child.ChildNodes)
this.ReadSatRecordInfo(i++, satNode);
break;
}
}
}
private void ReadSatRecordInfo(int i, XmlNode satRecordInfoNode)
{
string orbitalPos = "";
foreach (XmlNode child in satRecordInfoNode.ChildNodes)
{
switch (child.LocalName)
{
case "Angle":
orbitalPos += child.InnerText;
break;
case "AnglePrec":
orbitalPos += "." + child.InnerText;
break;
case "DirEastWest":
orbitalPos += child.InnerText == "0" ? "W" : "E";
break;
}
}
this.satPositionByIndex[i] = orbitalPos;
}
#endregion
#region ReadChannelLists()
private void ReadChannelLists(XmlNode channelNode)
{
foreach (XmlNode chanListNode in channelNode.ChildNodes)
{
switch (chanListNode.LocalName)
{
case "ATV":
this.ReadChannelList(chanListNode, true);
break;
case "DTV":
this.ReadChannelList(chanListNode, false);
break;
case "DTVATV":
// TODO: US DTV_ATSC files contain such lists
break;
}
}
}
#endregion
#region ReadChannelList()
private void ReadChannelList(XmlNode node, bool analog)
{
int i = -1;
foreach (XmlNode itemNode in node.ChildNodes)
{
if (itemNode.LocalName != "ITEM")
continue;
++i;
GcChannel ch = new GcChannel(analog ? SignalSource.AnalogCT | SignalSource.Tv : SignalSource.Digital, i, itemNode);
this.ParseChannelInfoNodes(itemNode, ch);
var list = this.DataRoot.GetChannelList(ch.SignalSource);
this.DataRoot.AddChannel(list, ch);
}
}
#endregion
#region ParseChannelInfoNode()
private void ParseChannelInfoNodes(XmlNode itemNode, ChannelInfo ch, bool onlyNames = false)
{
bool hasHexName = false;
int mapType = 0;
foreach (XmlNode info in itemNode.ChildNodes)
{
if (onlyNames && info.LocalName != "vchName" && info.LocalName != "hexVchName")
continue;
switch (info.LocalName)
{
// common to ATV and DTV
case "prNum":
ch.OldProgramNr = int.Parse(info.InnerText) & 0x3FFF;
break;
case "vchName":
// In old file format versions, this field contains binary data stuffed into UTF8 envelopes. that data is correct
// In newer file formats, this field contains plain text but fails to hold localized characters. The hexVchName field, if present, contains the correct data then.
if (!hasHexName)
ch.Name = ParseName(info.InnerText);
break;
case "sourceIndex":
var source = int.Parse(info.InnerText);
if (source == 2)
ch.SignalSource |= SignalSource.Cable;
else if (source == 7)
ch.SignalSource |= SignalSource.Sat;
else
ch.SignalSource |= SignalSource.Antenna;
break;
case "mapType":
mapType = int.Parse(info.InnerText);
break;
case "mapAttr":
if (mapType == 1)
ch.Favorites = (Favorites) int.Parse(info.InnerText);
break;
case "isBlocked":
ch.Lock = int.Parse(info.InnerText) == 1;
break;
case "isSkipped":
ch.Skip = int.Parse(info.InnerText) == 1;
break;
// ATV
case "pllData":
ch.FreqInMhz = (decimal) int.Parse(info.InnerText)/20;
break;
// DTV
case "original_network_id":
ch.OriginalNetworkId = int.Parse(info.InnerText);
break;
case "transport_id":
ch.TransportStreamId = int.Parse(info.InnerText);
break;
case "service_id":
ch.ServiceId = int.Parse(info.InnerText);
break;
case "serviceType":
ch.ServiceType = int.Parse(info.InnerText);
ch.SignalSource |= LookupData.Instance.IsRadioOrTv(ch.ServiceType);
break;
case "frequency":
ch.FreqInMhz = int.Parse(info.InnerText);
if ((ch.SignalSource & SignalSource.Sat) == 0)
ch.FreqInMhz /= 1000;
break;
case "isInvisable": // that spelling error is part of the XML
ch.Hidden = int.Parse(info.InnerText) == 1;
break;
case "isNumUnSel":
// ?
break;
case "isDisabled":
ch.IsDeleted = int.Parse(info.InnerText) != 0;
break;
case "usSatelliteHandle":
int satIndex = int.Parse(info.InnerText);
string satPos = this.satPositionByIndex.TryGet(satIndex);
ch.SatPosition = satPos ?? satIndex.ToString(); // fallback to ensure unique UIDs
ch.Satellite = satPos;
break;
// not present in all XML files. if present, the <vchName> might be empty or corrupted
case "hexVchName":
var bytes = Tools.HexDecode(info.InnerText);
string longName, shortName;
dvbStringDecoder.GetChannelNames(bytes, 0, bytes.Length, out longName, out shortName);
ch.Name = longName;
ch.ShortName = shortName;
hasHexName = true;
break;
}
}
}
#endregion
#region ParseName()
private string ParseName(string input)
{
var bytes = Encoding.UTF8.GetBytes(input);
if (bytes.Length == 0 || bytes[0] < 0xC0)
return input;
// older GlobalClone files look like as if the <vchName> is Chinese, but it's a weired "binary inside UTF8 envelope" encoding:
// A 3 byte UTF-8 envelope is used to encode 2 input bytes: 1110aaaa 10bbbbcc 10ccdddd represents the 16bit little endian integer aaaabbbbccccdddd, which represents bytes ccccdddd, aaaabbbb
// If a remaining byte is >= 0x80, it is encoded in a 2 byte UTF-8 envelope: 110000aa 10aabbbb represents the byte aaaabbbb
// If a remaining byte is < 0x80, it is encoded directly into a 1 byte UTF-8 char
using (MemoryStream ms = new MemoryStream(40))
{
for (int i = 0, c = bytes.Length; i < c; i++)
{
int b0 = bytes[i + 0];
if (b0 >= 0xE0) // 3-byte UTF envelope for 2 input bytes
{
int b1 = bytes[i + 1];
int b2 = bytes[i + 2];
int ch1 = ((b1 & 0x03) << 6) | (b2 & 0x3F);
int ch2 = ((b0 & 0x0F) << 4) | ((b1 & 0x3C) >> 2);
ms.WriteByte((byte) ch1);
ms.WriteByte((byte) ch2);
i += 2;
}
else if (b0 >= 0xC0) // 2-byte UTF envelope for 1 input byte >= 0x80
{
int b1 = bytes[i + 1];
int ch = ((b0 & 0x03) << 6) | (b1 & 0x3F);
ms.WriteByte((byte)ch);
i++;
}
else if (b0 < 0x80) // 1-byte UTF envelope for 1 input byte < 0x80
ms.WriteByte(bytes[i]);
}
string longName, shortName;
this.dvbStringDecoder.GetChannelNames(ms.GetBuffer(), 0, (int)ms.Length, out longName, out shortName);
return longName;
}
}
#endregion
#region Save()
public override void Save(string tvOutputFile)
{
foreach (var list in this.DataRoot.ChannelLists)
{
foreach (var channel in list.Channels)
{
var ch = channel as GcChannel;
if (ch == null) continue; // ignore proxy channels from reference lists
foreach (XmlNode node in ch.XmlNode.ChildNodes)
{
switch (node.LocalName)
{
case "prNum":
var nr = ch.NewProgramNr;
if ((ch.SignalSource & SignalSource.Radio) != 0)
nr |= 0x4000;
node.InnerText = nr.ToString();
break;
case "isInvisable":
node.InnerText = ch.Hidden ? "1" : "0";
break;
case "isBlocked":
node.InnerText = ch.Lock ? "1" : "0";
break;
case "isSkipped":
node.InnerText = ch.Skip ? "1" : "0";
break;
case "isNumUnSel":
// ?
break;
case "isDisabled":
case "isDeleted":
node.InnerText = ch.IsDeleted ? "1" : "0";
break;
case "isUserSelCHNo":
node.InnerText = "1";
break;
}
}
}
}
// by default .NET reformats the whole XML. These settings produce the same format as the TV xml files use
var settings = new XmlWriterSettings();
settings.Encoding = new UTF8Encoding(false);
settings.Indent = true;
settings.NewLineChars = "\r\n";
settings.NewLineHandling = NewLineHandling.Replace;
settings.OmitXmlDeclaration = true;
settings.IndentChars = "";
using (StringWriter sw = new StringWriter())
using (XmlWriter xw = XmlWriter.Create(sw, settings))
{
doc.Save(xw);
var xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n" + sw;
File.WriteAllText(tvOutputFile, xml, settings.Encoding);
}
}
#endregion
#region DefaultEncoding
public override Encoding DefaultEncoding
{
get { return base.DefaultEncoding; }
set
{
if (ReferenceEquals(value, this.DefaultEncoding))
return;
base.DefaultEncoding = value;
this.dvbStringDecoder.DefaultEncoding = value;
this.ChangeEncoding();
}
}
#endregion
#region ChangeEncoding()
private void ChangeEncoding()
{
foreach (var list in this.DataRoot.ChannelLists)
{
foreach (var channel in list.Channels)
{
var gcChannel = channel as GcChannel;
if (gcChannel != null)
this.ParseChannelInfoNodes(gcChannel.XmlNode, channel, true);
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,15 @@
using ChanSort.Api;
namespace ChanSort.Loader.GlobalClone
{
public class GcSerializerPlugin : ISerializerPlugin
{
public string PluginName { get { return "LG GlobalClone"; } }
public string FileFilter { get { return "*Clone*.tll;xx*.xml"; } }
public SerializerBase CreateSerializer(string inputFile)
{
return new GcSerializer(inputFile);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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.Loader.GlobalClone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Loader.GlobalClone")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("7c411d93-c493-49e0-af8a-520d759af994")]
// 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,91 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChanSort.Loader.GlobalClone {
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 Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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.Loader.GlobalClone.Resources", typeof(Resources).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 Before you waste your time...
///
///...make sure that your LG TV can load this file (without modifications).
///Some LG TVs export 2 files, a GlobalClone00001.TLL and file like xxLB550U-ZA00001.TLL.
///
///If you have both file types, it&apos;s likely that the TV can only load the xxLB550U-ZA00001.TLL and you should edit that file instead.
///
///If your TV only exports a single &quot;Clone&quot; TLL, you&apos;re good to continue!.
/// </summary>
internal static string GcSerializer_ReadModelInfo_ModelWarning {
get {
return ResourceManager.GetString("GcSerializer_ReadModelInfo_ModelWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ATTENTION:
///Please make sure that your webOS based TV is using a recent firmware version (LB600 and higher: 4.41.32, UB: 4.51.44).
///Older LG firmware for webOS based TV models does not handle the import of channel lists properly and randomly reorders channels.
///.
/// </summary>
internal static string GcSerializer_webOsFirmwareWarning {
get {
return ResourceManager.GetString("GcSerializer_webOsFirmwareWarning", resourceCulture);
}
}
}
}

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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="GcSerializer_ReadModelInfo_ModelWarning" xml:space="preserve">
<value>Bevor Sie Ihre Zeit verschwenden...
...überprüfen Sie, ob Ihr LG Gerät diese Datei (unmodifiziert) einlesen kann.
Einige LG Geräte exportieren 2 Dateien: eine "Clone" TLL und eine Datei ähnlich wie xxLB550U-ZA00001.TLL.
Wenn Ihr Gerät 2 Dateien erzeugt, kann es vermutlich nur die xxLB550U-ZA00001.TLL einlesen und Sie sollten deshalb jene Datei bearbeiten.
Wenn Ihr Gerät nur diese "Clone" Datei erstellt, können Sie mit der Bearbeitung fortfahren.</value>
</data>
<data name="GcSerializer_webOsFirmwareWarning" xml:space="preserve">
<value>HINWEIS:
Bitte stellen Sie sicher, dass auf Ihrem webOS basierenden Gerät eine aktuelle Firmware installiert ist (LB600 und höher: 4.41.32, UB: 4.51.44).
Ältere Versionen können Senderlisten nicht korrekt einlesen und verändern diese willkürlich im laufenden Betrieb.</value>
</data>
</root>

View File

@@ -0,0 +1,117 @@
<?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="GcSerializer_ReadModelInfo_ModelWarning" xml:space="preserve">
<value>Before you waste your time...
...make sure that your LG TV can load this file (without modifications).
Some LG TVs export 2 files, a GlobalClone00001.TLL and file like xxLB550U-ZA00001.TLL.
If you have both file types, it's likely that the TV can only load the xxLB550U-ZA00001.TLL and you should edit that file instead.
If your TV only exports a single "Clone" TLL, you're good to continue!</value>
</data>
<data name="GcSerializer_webOsFirmwareWarning" xml:space="preserve">
<value>ATTENTION:
Please make sure that your webOS based TV is using a recent firmware version (LB600 and higher: 4.41.32, UB: 4.51.44).
Older LG firmware for webOS based TV models does not handle the import of channel lists properly and randomly reorders channels.
</value>
</data>
</root>

View File

@@ -0,0 +1,13 @@
This module allows loading of LG's GlobalClone*.TLL files.
There seem to be different versions of this XML file format, depending on Series, Model and/or firmware version.
2013 LA-Series, 2014 LB55xx and LB56xx:
<vchName> is binary data inside an UTF8 envelope. Once decoded, this data is correct.
Some higher numbered models seem to exclusively support the GlobalClone and no longer have a binary TLL file,
while lower numbered models export both files and can only load the binary file.
<hexVchName> is not included in these models
2014 LB6xxx and higher:
<vchName> is a readable text, but sometimes left empty and misses all local characters
<hexVchName> may be present, depending on firmware. It contains a hex-encoded DVB encoded channel name with correct data.

View File

@@ -0,0 +1,19 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
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,154 @@
<?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>{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Loader.LG</RootNamespace>
<AssemblyName>ChanSort.Loader.LG</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</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>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
</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>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AnalogChannel.cs" />
<Compile Include="DtvChannel.cs" />
<Compile Include="DvbsDataLayout.cs" />
<Compile Include="FirmwareData.cs" />
<Compile Include="LnbConfig.cs" />
<Compile Include="PresetProgramNrDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PresetProgramNrDialog.Designer.cs">
<DependentUpon>PresetProgramNrDialog.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.de.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.de.resx</DependentUpon>
</Compile>
<Compile Include="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<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="TvSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TvSettingsForm.Designer.cs">
<DependentUpon>TvSettingsForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
<Project>{DCCFFA08-472B-4D17-BB90-8F513FC01392}</Project>
<Name>ChanSort.Api</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="ChanSort.Loader.LG.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="PresetProgramNrDialog.de.resx">
<DependentUpon>PresetProgramNrDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PresetProgramNrDialog.resx">
<DependentUpon>PresetProgramNrDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<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>
<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,988 @@
; FileConfigurationX: overall file and DVB-S data layout
; ACTChannelDataMappingX: analog, DVB-C and DVB-T channel data mapping for data length X
[ACTChannelDataMapping:280]
; LB580V
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 136, 186, 192
offProgramNr = 12, 188
offProgramNrPreset = 14, 190
offFavorites = 20
offPcrPid = 24, 252
offAudioPid = 26
offVideoPid = 28
offName = 44, 200
offNameLength = 84, 199
offServiceId = 86, 196
offFrequencyLong = 140
offOriginalNetworkId = 150
offTransportStreamId = 152
offFavorites2 = 194
offDeleted = 194
maskDeleted = 0x42
offLock = 195
maskLock = 0x01
offSkip = 195
maskSkip = 0x02
offHide = 195
maskHide = 0x04
offProgNrCustomized = 195
maskProgNrCustomized = 0x40
offServiceType = 198
offAudioPid2 = 254
[ACTChannelDataMapping:244]
; LB550U, LB561V
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 136, 173, 180
offProgramNr = 12, 176
offProgramNrPreset = 14, 178
offFavorites = 20
offPcrPid = 24, 228
offAudioPid = 26
offVideoPid = 36
offName = 44, 188
offNameLength = 84, 187
offServiceId = 86, 184
offFrequencyLong = 140
offOriginalNetworkId = 150
offTransportStreamId = 152
offFavorites2 = 182
offDeleted = 182
maskDeleted = 0x42
offLock = 183
maskLock = 0x01
offSkip = 183
maskSkip = 0x02
offHide = 183
maskHide = 0x04
offProgNrCustomized = 183
maskProgNrCustomized = 0x40
offServiceType = 186
offAudioPid2 = 230
[ACTChannelDataMapping:260]
; LA 2013 series firmware 04.20.29 and later
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 126, 174, 180
offProgramNr = 12, 176
offProgramNrPreset = 14, 178
offFavorites = 20
offPcrPid = 24, 240
offAudioPid = 26
offVideoPid = 36
offName = 40, 188
offNameLength = 80, 187
offServiceId = 82, 184
offFrequencyLong = 128
offOriginalNetworkId = 138
offTransportStreamId = 140
offFavorites2 = 182
offDeleted = 182
maskDeleted = 0x42
offLock = 183
maskLock = 0x01
offSkip = 183
maskSkip = 0x02
offHide = 183
maskHide = 0x04
offProgNrCustomized = 183
maskProgNrCustomized = 0x40
offServiceType = 186
offAudioPid2 = 242
[ACTChannelDataMapping:256]
; LA 2013 series firmware prior to 04.20.29
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 122, 170, 176
offProgramNr = 12, 172
offProgramNrPreset = 14, 174
offFavorites = 20
offPcrPid = 24, 236
offAudioPid = 26
offVideoPid = 36
offName = 40, 184
offNameLength = 80, 183
offServiceId = 82, 180
offFrequencyLong = 124
offOriginalNetworkId = 134
offTransportStreamId = 136
offFavorites2 = 178
offDeleted = 178
maskDeleted = 0x42
offLock = 179
maskLock = 0x01
offSkip = 179
maskSkip = 0x02
offHide = 179
maskHide = 0x04
offProgNrCustomized = 179
maskProgNrCustomized = 0x40
offServiceType = 182
offAudioPid2 = 238
[ACTChannelDataMapping:256LY]
; LY hospitality TVs
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 136, 177, 184
offProgramNr = 12, 180
offProgramNrPreset = 14, 182
offFavorites = 20
offPcrPid = 24, 236
offAudioPid = 26
offVideoPid = 36
offName = 44, 196
offNameLength = 84, 195
offServiceId = 86, 192
offFrequencyLong = 140
offOriginalNetworkId = 150
offTransportStreamId = 152
offFavorites2 = 188
offDeleted = 188
maskDeleted = 0x42
offLock = 189
maskLock = 0x01
offSkip = 189
maskSkip = 0x02
offHide = 189
maskHide = 0x04
offProgNrCustomized = 189
maskProgNrCustomized = 0x40
offServiceType = 194
offAudioPid2 = 238
[ACTChannelDataMapping:224]
; LN series
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 118, 153, 160
offProgramNr = 12, 156
offProgramNrPreset = 14, 158
offFavorites = 20
offPcrPid = 24, 208
offAudioPid = 26
offVideoPid = 36
offName = 44, 168
offNameLength = 84, 167
offServiceId = 86, 164
offFrequencyLong = 120
offOriginalNetworkId = 130
offTransportStreamId = 132
offFavorites2 = 162
offDeleted = 162
maskDeleted = 0x42
offLock = 163
maskLock = 0x01
offSkip = 163
maskSkip = 0x02
offHide = 163
maskHide = 0x04
offProgNrCustomized = 163
maskProgNrCustomized = 0x40
offServiceType = 166
offAudioPid2 = 238
[ACTChannelDataMapping:212]
; LT series
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 106, 141, 148
offProgramNr = 12, 144
offProgramNrPreset = 14, 146
offFavorites = 20
offPcrPid = 22, 200
offAudioPid = 24
offVideoPid = 26
offName = 32, 160
offNameLength = 72, 159
offServiceId = 74, 156
offFrequencyLong = 108
offOriginalNetworkId = 114
offTransportStreamId = 116
offFavorites2 = 154
offDeleted = 154
maskDeleted = 0x42
offLock = 155
maskLock = 0x01
offSkip = 155
maskSkip = 0x02
offHide = 155
maskHide = 0x04
offProgNrCustomized = 155
maskProgNrCustomized = 0x40
offServiceType = 158
offAudioPid2 = 202
[ACTChannelDataMapping:212PN]
; PN series
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 110, 141, 148
offProgramNr = 12, 144
offProgramNrPreset = 14, 146
offFavorites = 22
offPcrPid = 24, 196
offAudioPid = 26
offVideoPid =
offName = 44, 156
offNameLength = 84, 155
offServiceId = 86, 152
offFrequencyLong = 112
offOriginalNetworkId = 118
offTransportStreamId = 120
offFavorites2 = 150
offDeleted = 150
maskDeleted = 0x42
offLock = 151
maskLock = 0x01
offSkip = 151
maskSkip = 0x02
offHide = 151
maskHide = 0x04
offProgNrCustomized = 151
maskProgNrCustomized = 0x40
offServiceType = 154
offAudioPid2 = 198
[ACTChannelDataMapping:192]
; LM, LS, PM series with Firmware 4.x (all except LM611S and LM340S)
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 94, 126, 132
offProgramNr = 12, 128
offProgramNrPreset = 14, 130
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
offProgNrCustomized = 135
maskProgNrCustomized = 0x40
offServiceType = 138
offAudioPid2 = 182
[ACTChannelDataMapping:188]
; CS and LM series with Firmware 3.x (CS460s, LM611S with exceptions, LM340S)
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 94, 125, 132
offProgramNr = 12, 128
offProgramNrPreset = 14, 130
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
offProgNrCustomized = 135
maskProgNrCustomized = 0x40
offServiceType = 138
offAudioPid2 = 182
[ACTChannelDataMapping:184]
; LV, LW (except LW4500, LW5400), LK950S, PM670S
reorderChannelData = 0
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 90, 121, 128
offProgramNr = 12, 124
offProgramNrPreset = 14, 126
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
offProgNrCustomized = 131
maskProgNrCustomized = 0x40
offServiceType = 134
offAudioPid2 = 178
[ACTChannelDataMapping:184LH250]
; LH250C
reorderChannelData = 1
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 90, 128
offProgramNr = 12
offProgramNrPreset = 14, 126
offFavorites = 20
offPcrPid = 22, 176
offAudioPid = 24
offVideoPid = 26
offName = 32, 136
offNameLength = 72, 135
offServiceId = 74, 132
offFrequencyLong = 92
offOriginalNetworkId = 98
offTransportStreamId = 100
offProgramNr2 = 126
offFavorites2 = 130
offDeleted = 130
maskDeleted = 0x42
offLock = 131
maskLock = 0x01
offSkip = 131
maskSkip = 0x02
offHide = 131
maskHide = 0x04
offProgNrCustomized = 131
maskProgNrCustomized = 0x40
offServiceType = 134
offAudioPid2 = 178
[ACTChannelDataMapping:180]
; PT
reorderChannelData = 1
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 90, 124
offProgramNr = 12
offProgramNrPreset = 14
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
offProgNrCustomized = 127
maskProgNrCustomized = 0x40
offServiceType = 130
offAudioPid2 = 172
[ACTChannelDataMapping:176]
; LD, LE, LX series, LK450, LW4500, LW5400
reorderChannelData = 1
lenName = 40
offSignalSource = 8
offChannelTransponder = 10, 86, 120
offProgramNr = 12
offProgramNrPreset = 14
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
offProgNrCustomized = 123
maskProgNrCustomized = 0x40
offServiceType = 126
offAudioPid2 = 170
[ACTChannelDataMapping:164]
; DM, LF, LH, LU (except LH3000)
reorderChannelData = 1
lenName = 40
offChannelTransponder = 9, 112
offProgramNr = 10
offProgramNrPreset = 12
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
[ACTChannelDataMapping:164LH3000]
; LH3000
reorderChannelData = 1
lenName = 40
offChannelTransponder = 9, 108
offProgramNr = 10
offProgramNrPreset = 12
offFavorites = 18
offPcrPid = 20, 152
offAudioPid = 22
offVideoPid = 24
offName = 28, 112
offNameLength = 68,111
offServiceId = 70,158
offOriginalNetworkId = 86
offTransportStreamId = 88
offFrequencyLong = 96
offProgramNr2 = 104
offFavorites2 = 109
offDeleted = 109
maskDeleted = 0x42
offLock =
maskLock =
offSkip =
maskSkip =
offHide =
maskHide =
offServiceType = 160
offAudioPid2 = 154
[DvbsBlock:620332]
; PN
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
linkedListExtraDataLength = 2
dvbsChannelCount = 6000
dvbsChannelLength = 76
lnbCount = 40
lnbLength = 48
[DvbsBlock:629932]
; LN
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 44
linkedListExtraDataLength = 2
dvbsChannelCount = 6000
dvbsChannelLength = 76
lnbCount = 40
lnbLength = 48
[DvbsBlock:639532]
; LB550U, LB561V
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 48
linkedListExtraDataLength = 2
dvbsChannelCount = 6000
dvbsChannelLength = 76
lnbCount = 40
lnbLength = 48
[DvbsBlock:687880]
; everything before LM series + LM340S, LM611S, LS560S
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 68
lnbCount = 40
lnbLength = 44
[DvbsBlock:717960]
; LM, LS and PM series except LM611S, LM340S LS560S
satCount = 64
satLength = 44
transponderCount = 2400
transponderLength = 40
dvbsChannelCount = 7520
dvbsChannelLength = 72
lnbCount = 40
lnbLength = 44
[DvbsBlock:757800]
; LP series
satCount = 64
satLength = 44
satIndexFactor = 1
transponderCount = 2400
transponderLength = 44
dvbsChannelCount = 7520
dvbsChannelLength = 76
lnbCount = 40
lnbLength = 48
[DvbsBlock:907336]
; LA series
satCount = 64
satLength = 48
transponderCount = 2400
transponderLength = 56
dvbsChannelCount = 7520
dvbsChannelLength = 92
lnbCount = 40
lnbLength = 52
[DvbsBlock:967496]
; LB580V
satCount = 64
satLength = 48
transponderCount = 2400
transponderLength = 56
dvbsChannelCount = 7520
dvbsChannelLength = 100
lnbCount = 40
lnbLength = 52
[TransponderDataMapping:40]
; everything up to LM
offFirstChannelIndex = 0
offLastChannelIndex = 2
offChannelCount = 4
offTransponderIndex = 10
offFrequency = 12
offOriginalNetworkId = 18
offTransportStreamId = 20
offSymbolRate = 25
offSatIndex = 36
[TransponderDataMapping:44LP]
; LP
offFirstChannelIndex = 0
offLastChannelIndex = 2
offChannelCount = 4
offTransponderIndex = 10
offFrequency = 12
offOriginalNetworkId = 18
offTransportStreamId = 20
offSymbolRate = 25
offSatIndex = 38
[TransponderDataMapping:44]
; LN, LA6136
offFirstChannelIndex = 0
offLastChannelIndex = 2
offChannelCount = 4
offTransponderIndex = 10
offFrequency = 12
offOriginalNetworkId = 22
offTransportStreamId = 24
offSymbolRate = 29
offSatIndex = 40
[TransponderDataMapping:48]
; LB550U, LB561V
offFirstChannelIndex = 0
offLastChannelIndex = 2
offChannelCount = 4
offTransponderIndex = 12
offFrequency = 16
offOriginalNetworkId = 26
offTransportStreamId = 28
offSymbolRate = 33
offSatIndex = 44
[TransponderDataMapping:56]
; LA, LB580V
offFirstChannelIndex = 0
offLastChannelIndex = 2
offChannelCount = 4
offTransponderIndex = 10
offFrequency = 12
offOriginalNetworkId = 22
offTransportStreamId = 24
offSymbolRate = 29
offSatIndex = 40
[SatChannelDataMapping:68]
; everything before LM + LM340S and LM611S
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]
; LM series
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
newRecordTemplate = \
0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 31, 255, 31
252, 127, 0, 0, 0, 0, 0, 0
[SatChannelDataMapping:76]
; LN series, LA6136, LB550U, LB561V
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:76LP]
; LP series
lenName = 40
offSatelliteNr = 0
offSourceType = 4
offTransponderIndex = 5, 12
offProgramNr = 8
offProgramNrPreset = 10
offFavorites2 = 16
offDeleted = 16
maskDeleted = 0x42
offEncrypted = 16
maskEncrypted = 0x80
offLock = 17
maskLock = 0x01
offSkip = 17
maskSkip = 0x02
offHide = 17
maskHide = 0x04
offProgNrCustomized = 17
maskProgNrCustomized = 0x40
offServiceId = 20
offServiceType = 22
offNameLength = 23
offName = 24
offVideoPid = 64
offAudioPid = 66
[SatChannelDataMapping:92]
; LA series
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 = 72
offAudioPid = 74
[SatChannelDataMapping:100]
; LB580V
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 = 72
offAudioPid = 74
[LnbMapping:44]
; all except LA
offSettingId = 0
offSatIndex = 4
[LnbMapping:48]
; LA
offSettingId = 0
offSatIndex = 4
[LnbMapping:52]
; LN
offSettingId = 0
offSatIndex = 4
[FirmwareData:6936]
; LH3000
offSize = 0
offHotelModeEnabled=6539
offHotelModeDtvUpdate=6549
[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]
; CS460S, LM611S, LM340S, LS560S
offSize = 0
offHotelModeEnabled=12639
offHotelModeDtvUpdate=12649
[FirmwareData:16232]
; LT
offSize = 0
offHotelModeEnabled=12639
offHotelModeDtvUpdate=12649
[FirmwareData:16376]
; LP
offSize = 0
offHotelModeEnabled=12639
offHotelModeDtvUpdate=12649
[FirmwareData:17136]
; LN
offSize = 0
offHotelModeEnabled=13627
offHotelModeDtvUpdate=13637
[FirmwareData:17240]
; PN
offSize = 0
offHotelModeEnabled=13873
offHotelModeDtvUpdate=13883
[FirmwareData:17808]
; LB550U, LB561V
offSize = 0
[FirmwareData:23072]
; LE3300, 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:23144]
; LX9500
offSize = 0
offHotelModeEnabled=19721
offHotelModeDtvUpdate=19731
[FirmwareData:35504]
; LV,LW,LK950S
offSize = 0
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
[FirmwareData:39592]
; LA7408
offSize = 0
offHotelModeEnabled=38255
offHotelModeDtvUpdate=38266
offHotelMenuAccessCode = 38282
[FirmwareData:39680]
; LB580V
offSize = 0

View File

@@ -0,0 +1,32 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
public class DtvChannel : TllChannelBase
{
private const string _SignalSource = "offSignalSource";
private const string _ChannelOrTransponder = "offChannelTransponder";
private const string _FrequencyLong = "offFrequencyLong";
/*
offFavorites2 = 134
offAudioPid2 = 182
*/
public DtvChannel(int slot, DataMapping data) : base(data)
{
var signalSource = SignalSource.Digital;
signalSource |= data.GetByte(_SignalSource) == 1 ? SignalSource.Antenna : SignalSource.Cable;
this.InitCommonData(slot, signalSource, data);
this.InitDvbData(data);
int channel = data.GetByte(_ChannelOrTransponder);
this.ChannelOrTransponder = channel.ToString("d2");
// ReSharper disable PossibleLossOfFraction
this.FreqInMhz = (data.GetDword(_FrequencyLong)+10) / 1000;
// ReSharper restore PossibleLossOfFraction
if (this.FreqInMhz == 0)
this.FreqInMhz = LookupData.Instance.GetDvbtFrequenyForChannel(channel);
}
}
}

View File

@@ -0,0 +1,87 @@
namespace ChanSort.Loader.LG
{
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 linkedListExtraDataLength;
public readonly int dvbsMaxChannelCount;
public readonly int dvbsChannelLength;
public readonly int lnbCount;
public readonly int lnbLength;
public readonly int[] dvbsSubblockLength;
public readonly int dvbsBlockTotalLength;
public readonly int satIndexFactor;
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.linkedListExtraDataLength = iniSection.GetInt("linkedListExtraDataLength");
this.dvbsMaxChannelCount = iniSection.GetInt("dvbsChannelCount");
this.dvbsChannelLength = iniSection.GetInt("dvbsChannelLength");
this.lnbCount = iniSection.GetInt("lnbCount");
this.lnbLength = iniSection.GetInt("lnbLength");
this.satIndexFactor = iniSection.GetInt("satIndexFactor");
if (satIndexFactor == 0)
satIndexFactor = 2;
this.dvbsSubblockLength = new[]
{
12, // header
14 + 2 + this.satCount + this.satCount*this.satLength, // satellites
sizeOfTransponderBlockHeader - 4 + transponderCount * transponderLength, // transponder
12 + dvbsMaxChannelCount/8 + dvbsMaxChannelCount*sizeOfChannelLinkedListEntry + linkedListExtraDataLength + dvbsMaxChannelCount * dvbsChannelLength, // channels
LnbBlockHeaderSize - 4 + lnbCount * lnbLength // sat/LNB-Config
};
foreach (int len in this.dvbsSubblockLength)
this.dvbsBlockTotalLength += len + 4;
}
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int TransponderTableOffset
{
get { return 4 + 4 + dvbsSubblockLength[0] + 4 + dvbsSubblockLength[1] + sizeOfTransponderBlockHeader; }
}
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int ChannelListHeaderOffset
{
get { return 4 + 4 + this.dvbsSubblockLength[0] + 4 + this.dvbsSubblockLength[1] + 4 + this.dvbsSubblockLength[2]; }
}
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int AllocationBitmapOffset { get { return ChannelListHeaderOffset + 16; } }
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int SequenceTableOffset { get { return this.AllocationBitmapOffset + dvbsMaxChannelCount/8; } }
/// <summary>
/// relative to start of DVBS-Block (including the intial 4 length bytes)
/// </summary>
public int ChannelListOffset
{
get { return SequenceTableOffset + dvbsMaxChannelCount*sizeOfChannelLinkedListEntry + linkedListExtraDataLength; }
}
}
}

View File

@@ -0,0 +1,65 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
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 bool SupportsHbbTv { get { return this.GetOffsets(offHbbTvEnabled).Length > 0; } }
public bool SupportsHotelMenu { get { return this.GetOffsets(offHotelModeEnabled).Length > 0; } }
public bool SupportsAutoChannelUpdate { get { return this.GetOffsets(offSettingsChannelUpdate).Length > 0; } }
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

@@ -0,0 +1,18 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
internal class LnbConfig : Api.LnbConfig
{
public Satellite Satellite { get; private set; }
public LnbConfig(DataMapping mapping, DataRoot dataRoot)
{
this.Id = mapping.GetByte("SettingId");
if (this.Id == 0)
return;
int satIndex = mapping.GetByte("SatIndex");
this.Satellite = dataRoot.Satellites[satIndex];
}
}
}

View File

@@ -0,0 +1,136 @@
namespace ChanSort.Loader.LG
{
partial class PresetProgramNrDialog
{
/// <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(PresetProgramNrDialog));
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
this.linkDetails = new System.Windows.Forms.LinkLabel();
this.btnOk = new DevExpress.XtraEditors.SimpleButton();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.SuspendLayout();
//
// labelControl1
//
resources.ApplyResources(this.labelControl1, "labelControl1");
this.labelControl1.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl1.Name = "labelControl1";
//
// labelControl3
//
resources.ApplyResources(this.labelControl3, "labelControl3");
this.labelControl3.Appearance.Font = ((System.Drawing.Font)(resources.GetObject("labelControl3.Appearance.Font")));
this.labelControl3.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl3.Name = "labelControl3";
//
// labelControl4
//
resources.ApplyResources(this.labelControl4, "labelControl4");
this.labelControl4.Appearance.Font = ((System.Drawing.Font)(resources.GetObject("labelControl4.Appearance.Font")));
this.labelControl4.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl4.Name = "labelControl4";
//
// labelControl5
//
resources.ApplyResources(this.labelControl5, "labelControl5");
this.labelControl5.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl5.Name = "labelControl5";
//
// labelControl6
//
resources.ApplyResources(this.labelControl6, "labelControl6");
this.labelControl6.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl6.Name = "labelControl6";
//
// labelControl7
//
resources.ApplyResources(this.labelControl7, "labelControl7");
this.labelControl7.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl7.Name = "labelControl7";
//
// linkDetails
//
resources.ApplyResources(this.linkDetails, "linkDetails");
this.linkDetails.Name = "linkDetails";
this.linkDetails.TabStop = true;
this.linkDetails.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkDetails_LinkClicked);
//
// 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);
//
// labelControl2
//
resources.ApplyResources(this.labelControl2, "labelControl2");
this.labelControl2.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
this.labelControl2.Name = "labelControl2";
//
// PresetProgramNrDialog
//
this.AcceptButton = this.btnOk;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnOk;
this.ControlBox = false;
this.Controls.Add(this.labelControl2);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.linkDetails);
this.Controls.Add(this.labelControl7);
this.Controls.Add(this.labelControl6);
this.Controls.Add(this.labelControl5);
this.Controls.Add(this.labelControl4);
this.Controls.Add(this.labelControl3);
this.Controls.Add(this.labelControl1);
this.Name = "PresetProgramNrDialog";
this.ShowInTaskbar = false;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevExpress.XtraEditors.LabelControl labelControl1;
private DevExpress.XtraEditors.LabelControl labelControl3;
private DevExpress.XtraEditors.LabelControl labelControl4;
private DevExpress.XtraEditors.LabelControl labelControl5;
private DevExpress.XtraEditors.LabelControl labelControl6;
private DevExpress.XtraEditors.LabelControl labelControl7;
private System.Windows.Forms.LinkLabel linkDetails;
private DevExpress.XtraEditors.SimpleButton btnOk;
private DevExpress.XtraEditors.LabelControl labelControl2;
}
}

View File

@@ -0,0 +1,29 @@
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace ChanSort.Loader.LG
{
public partial class PresetProgramNrDialog : XtraForm
{
public PresetProgramNrDialog()
{
InitializeComponent();
}
private void linkDetails_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
BrowserHelper.OpenUrl(
"http://sourceforge.net/p/chansort/wiki/Channels%20disappear%20or%20change%20program%20numbers%20randomly/");
}
catch { }
}
private void btnOk_Click(object sender, System.EventArgs e)
{
if (ModifierKeys == (Keys.Alt|Keys.Control))
this.DialogResult = DialogResult.Yes;
}
}
}

View File

@@ -0,0 +1,151 @@
<?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="labelControl1.Text" xml:space="preserve">
<value>Diese Datei enthält vordefinierte Programmnummern für Satellitenkanäle. Aufgrund von Eigenheiten der aktuellen LG Firmware können solche Listen nicht zuverlässig verändert werden.</value>
</data>
<data name="labelControl3.Text" xml:space="preserve">
<value>Die Bearbeitung der Satelliten-Senderliste wurde gesperrt!</value>
</data>
<data name="labelControl4.Text" xml:space="preserve">
<value>Um die Liste zu bearbeiten, muss ein sauberer Vollsuchlauf ausgeführt werden:</value>
</data>
<data name="labelControl5.Text" xml:space="preserve">
<value>- Behalten Sie eine Kopie dieser TLL-Datei, um sie eventuell später als Referenzdatei zu verwenden</value>
</data>
<data name="labelControl6.Text" xml:space="preserve">
<value>- Führen Sie einen automatischen Suchlauf mit den Optionen "Voll", "Keiner", "Blindsuche" aus</value>
</data>
<data name="labelControl7.Text" xml:space="preserve">
<value>- Führen Sie am TV die Funktion "Werkseinstellung" aus</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="linkDetails.Size" type="System.Drawing.Size, System.Drawing">
<value>214, 13</value>
</data>
<data name="linkDetails.Text" xml:space="preserve">
<value>Details hierzu gibt es auf der ChanSort Wiki</value>
</data>
<data name="labelControl2.Text" xml:space="preserve">
<value>- Speichern Sie die neue Liste auf USB und öffnen Sie sie mit ChanSort</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Wichtiger Hinweis</value>
</data>
</root>

View File

@@ -0,0 +1,415 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="labelControl1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<assembly alias="DevExpress.XtraEditors.v14.2" name="DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="labelControl1.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="labelControl1.Location" type="System.Drawing.Point, System.Drawing">
<value>10, 49</value>
</data>
<data name="labelControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>560, 26</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="labelControl1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="labelControl1.Text" xml:space="preserve">
<value>This file contains preset program numbers for satellite channels. Due to issues with most recent LG firmwares such lists can no longer be modified reliably.</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl1.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="labelControl3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="labelControl3.Appearance.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8.25pt, style=Bold</value>
</data>
<data name="labelControl3.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<data name="labelControl3.Location" type="System.Drawing.Point, System.Drawing">
<value>11, 21</value>
</data>
<data name="labelControl3.Size" type="System.Drawing.Size, System.Drawing">
<value>559, 13</value>
</data>
<data name="labelControl3.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="labelControl3.Text" xml:space="preserve">
<value>Editing of the satellite channel list is 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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl3.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="labelControl4.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="labelControl4.Appearance.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8.25pt, style=Bold</value>
</data>
<data name="labelControl4.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<data name="labelControl4.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 88</value>
</data>
<data name="labelControl4.Size" type="System.Drawing.Size, System.Drawing">
<value>559, 13</value>
</data>
<data name="labelControl4.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="labelControl4.Text" xml:space="preserve">
<value>To enable editing you must first run a clean full channel search:</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl4.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="labelControl5.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="labelControl5.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<data name="labelControl5.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 105</value>
</data>
<data name="labelControl5.Size" type="System.Drawing.Size, System.Drawing">
<value>541, 13</value>
</data>
<data name="labelControl5.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="labelControl5.Text" xml:space="preserve">
<value>- Keep a copy of the current TLL file if you want to use it as a reference list later</value>
</data>
<data name="&gt;&gt;labelControl5.Name" xml:space="preserve">
<value>labelControl5</value>
</data>
<data name="&gt;&gt;labelControl5.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl5.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl5.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="labelControl6.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="labelControl6.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<data name="labelControl6.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 140</value>
</data>
<data name="labelControl6.Size" type="System.Drawing.Size, System.Drawing">
<value>541, 13</value>
</data>
<data name="labelControl6.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="labelControl6.Text" xml:space="preserve">
<value>- Execute an automatic channel search with options "Full", "None" and "Blind search"</value>
</data>
<data name="&gt;&gt;labelControl6.Name" xml:space="preserve">
<value>labelControl6</value>
</data>
<data name="&gt;&gt;labelControl6.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl6.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl6.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="labelControl7.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="labelControl7.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<data name="labelControl7.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 122</value>
</data>
<data name="labelControl7.Size" type="System.Drawing.Size, System.Drawing">
<value>541, 13</value>
</data>
<data name="labelControl7.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="labelControl7.Text" xml:space="preserve">
<value>- Execute a Factory Reset on your TV</value>
</data>
<data name="&gt;&gt;labelControl7.Name" xml:space="preserve">
<value>labelControl7</value>
</data>
<data name="&gt;&gt;labelControl7.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl7.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl7.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="linkDetails.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="linkDetails.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 199</value>
</data>
<data name="linkDetails.Size" type="System.Drawing.Size, System.Drawing">
<value>165, 13</value>
</data>
<data name="linkDetails.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="linkDetails.Text" xml:space="preserve">
<value>See the ChanSort Wiki for details</value>
</data>
<data name="&gt;&gt;linkDetails.Name" xml:space="preserve">
<value>linkDetails</value>
</data>
<data name="&gt;&gt;linkDetails.Type" xml:space="preserve">
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;linkDetails.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;linkDetails.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="btnOk.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="btnOk.Location" type="System.Drawing.Point, System.Drawing">
<value>254, 224</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>8</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.v14.2, Version=14.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>1</value>
</data>
<data name="labelControl2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="labelControl2.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.2">
<value>Vertical</value>
</data>
<data name="labelControl2.Location" type="System.Drawing.Point, System.Drawing">
<value>29, 159</value>
</data>
<data name="labelControl2.Size" type="System.Drawing.Size, System.Drawing">
<value>541, 13</value>
</data>
<data name="labelControl2.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="labelControl2.Text" xml:space="preserve">
<value>- Save the new list to USB and open it with ChanSort</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelControl2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.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>584, 262</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Important Notice</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>PresetProgramNrDialog</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
</root>

View File

@@ -0,0 +1,39 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Test.Loader")]
[assembly: InternalsVisibleTo("Test.Loader.LG")]
// 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.Loader.LG")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Loader.LG")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[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("387d8661-ecb3-4957-afca-9a156a90f384")]
// 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,99 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChanSort.Loader.LG {
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.Loader.LG.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);
}
}
}
}

View File

View File

@@ -0,0 +1,132 @@
<?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="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,113 @@
<?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="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,54 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
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.Transponder = transponder;
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;
}
internal static SatChannel CreateFromProxy(ChannelInfo proxy, DataRoot dataRoot, DataMapping mapping, int rawSize)
{
if (proxy.Transponder == null || proxy.Transponder.Satellite == null || proxy.Transponder.Satellite.LnbConfig == null)
return null;
byte[] rawData = mapping.Settings.GetBytes("newRecordTemplate");
if (rawData == null)
return null;
mapping.SetDataPtr(rawData, 0);
mapping.SetWord(_SatConfigIndex, proxy.Transponder.Satellite.LnbConfig.Id);
mapping.SetWord(_TransponderIndex, proxy.Transponder.Id);
mapping.SetWord(_ServiceId, proxy.ServiceId);
var channel = new SatChannel(0, proxy.NewProgramNr, mapping, dataRoot);
channel.Name = proxy.Name;
return channel;
}
}
}

View File

@@ -0,0 +1,41 @@
using System;
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
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 ushort LinkedListStartIndex
{
get { return BitConverter.ToUInt16(data, baseOffset + 8); }
set { Tools.SetInt16(data, baseOffset + 8, value); }
}
public int LinkedListEndIndex1
{
get { return BitConverter.ToInt16(data, baseOffset + 10); }
set { Tools.SetInt16(data, baseOffset + 10, value); }
}
public int LinkedListEndIndex2
{
get { return BitConverter.ToInt16(data, baseOffset + 12); }
set { Tools.SetInt16(data, baseOffset + 12, value); }
}
public int ChannelCount
{
get { return BitConverter.ToInt16(data, baseOffset + 14); }
set { Tools.SetInt16(data, baseOffset + 14, value); }
}
public int Size { get { return 16; } }
}
}

View File

@@ -0,0 +1,81 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
internal class SatTransponder : Transponder
{
private const string _FirstChannelIndex = "offFirstChannelIndex";
private const string _LastChannelIndex = "offLastChannelIndex";
private const string _ChannelCount = "offChannelCount";
private const string _Frequency = "offFrequency";
private const string _OriginalNetworkId = "offOriginalNetworkId";
private const string _TransportStreamId = "offTransportStreamId";
private const string _SymbolRate = "offSymbolRate";
private const string _SatIndex = "offSatIndex";
private readonly DataMapping mapping;
private readonly byte[] data;
private readonly int offset;
private int symbolRate;
private int firstChannelIndex;
private int lastChannelIndex;
public SatTransponder(int index, DataMapping mapping, DataRoot dataRoot, int satIndexFactor) : base(index)
{
this.mapping = mapping;
this.data = mapping.Data;
this.offset = mapping.BaseOffset;
this.firstChannelIndex = mapping.GetWord(_FirstChannelIndex);
this.lastChannelIndex = mapping.GetWord(_LastChannelIndex);
this.FrequencyInMhz = mapping.GetWord(_Frequency);
this.OriginalNetworkId = mapping.GetWord(_OriginalNetworkId);
this.TransportStreamId = mapping.GetWord(_TransportStreamId);
this.symbolRate = mapping.GetWord(_SymbolRate);
if (this.symbolRate%100 >= 95)
this.symbolRate = (this.symbolRate/100 + 1)*100;
// note: a correction factor is applied later after all transponders were loaded (*0.5, *1, *2)
this.Satellite = dataRoot.Satellites.TryGet(mapping.GetByte(_SatIndex)/satIndexFactor);
}
public int FirstChannelIndex
{
get { return this.firstChannelIndex; }
set
{
mapping.SetDataPtr(this.data, this.offset);
mapping.SetWord(_FirstChannelIndex, value);
this.firstChannelIndex = value;
}
}
public int LastChannelIndex
{
get { return lastChannelIndex; }
set
{
mapping.SetDataPtr(this.data, this.offset);
mapping.SetWord(_LastChannelIndex, value);
this.lastChannelIndex = value;
}
}
public int ChannelCount
{
set
{
mapping.SetDataPtr(this.data, this.offset);
mapping.SetWord(_ChannelCount, value);
}
}
public override int SymbolRate
{
get { return symbolRate; }
set { this.symbolRate = value; }
}
}
}

View File

@@ -0,0 +1,133 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
public class TllChannelBase : ChannelInfo
{
// common
protected const string _ProgramNr = "offProgramNr";
protected const string _ProgramNr2 = "offProgramNr2"; // not for DVB-S
protected const string _ProgramNrPreset = "offProgramNrPreset";
protected const string _Name = "offName";
protected const string _NameLength = "offNameLength";
protected const string _Favorites = "offFavorites"; // not for DVB-S (which only uses Favorite2)
protected const string _Deleted = "Deleted";
protected const string _Favorites2 = "offFavorites2";
protected const string _Encrypted = "Encrypted";
protected const string _Lock = "Lock";
protected const string _Skip = "Skip";
protected const string _Hide = "Hide";
protected const string _Moved = "ProgNrCustomized";
// DVB
protected const string _ServiceId = "offServiceId";
protected const string _VideoPid = "offVideoPid";
protected const string _AudioPid = "offAudioPid";
protected const string _OriginalNetworkId = "offOriginalNetworkId";
protected const string _TransportStreamId = "offTransportStreamId";
protected const string _ServiceType = "offServiceType";
protected readonly DataMapping mapping;
protected readonly byte[] rawData;
internal 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;
var nr = data.GetWord(_ProgramNr);
this.SignalSource = signalSource | ((nr & 0x4000) == 0 ? SignalSource.Tv : SignalSource.Radio);
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);
this.ProgramNrPreset = data.GetWord(_ProgramNrPreset);
}
#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);
int progNr = this.NewProgramNr == -1 ? 0 : this.NewProgramNr;
mapping.SetWord(_ProgramNr, progNr | ((this.SignalSource & SignalSource.Radio) != 0 ? 0x4000 : 0));
mapping.SetWord(_ProgramNr2, (mapping.GetWord(_ProgramNr2) & 0x0003) | (progNr << 2));
mapping.SetWord(_ProgramNrPreset, 0);
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 == -1)
{
mapping.SetFlag(_Deleted, true);
mapping.SetByte("off" + _Moved, 0); //skip,lock,hide,moved
}
else if ((this.SignalSource&SignalSource.Digital) != 0)
{
mapping.SetFlag(_Moved, true);
}
this.OldProgramNr = this.NewProgramNr;
}
#endregion
#region ChangeEncoding()
public override void ChangeEncoding(System.Text.Encoding encoding)
{
this.mapping.DefaultEncoding = encoding;
this.ParseNames();
}
#endregion
internal byte[] RawDataBuffer { get { return this.rawData; } }
internal int RawDataOffset { get { return this.baseOffset; } }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,221 @@
using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
/// <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 (create table)
/*
create table list (
listid int not null,
filename varchar(100),
created datetime,
primary key (listid))
create table channel (
listid int not null,
slot int not null,
isdel bit not null,
seq int,
progmask int not null,
prognr int not null,
name varchar(40) not null,
tpnr int not null,
satnr int,
onid int not null,
tsid int not null,
ssid int not null,
uid varchar(25),
favcrypt int,
lockskiphide int,
progfix int,
primary key (listid, slot))
create table chanseq(
listid int not null,
seq int not null,
slot int not null,
primary key (listid, seq))
update channel
set seq=s.seq
from channel c inner join chanseq s on s.listid=c.listid and s.slot=c.slot
*/
#endregion
#region StoreToDatabase()
private void StoreToDatabase()
{
if (this.dvbsBlockSize == 0)
return;
var list = this.DataRoot.GetChannelList(SignalSource.DvbS|SignalSource.Tv);
if (list == null || list.Count == 0)
return;
using (var conn = SqlClientFactory.Instance.CreateConnection())
{
conn.ConnectionString = "server=(local);database=ChanSort;Integrated Security=true";
conn.Open();
using (var cmd = conn.CreateCommand())
{
var listId = InsertListData(cmd);
InsertChannelLinkedList(cmd, listId);
InsertChannelData(cmd, listId);
}
}
}
#endregion
#region InsertListData()
private int InsertListData(DbCommand cmd)
{
cmd.CommandText = "select max(listid) from list";
var maxObj = cmd.ExecuteScalar();
int listId = maxObj == DBNull.Value ? 1 : (int) maxObj + 1;
cmd.CommandText = "insert into list(listid, filename, created) values (" + listId + ", @filename, getdate())";
var parm = cmd.CreateParameter();
parm.ParameterName = "@filename";
parm.DbType = DbType.String;
parm.Value = this.FileName;
cmd.Parameters.Add(parm);
cmd.ExecuteNonQuery();
return listId;
}
#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 void InsertChannelData(DbCommand cmd, int listId)
{
PrepareChannelInsert(cmd);
DvbStringDecoder decoder = new DvbStringDecoder(this.DefaultEncoding);
DataMapping dvbsMapping = this.dvbsMappings.GetMapping(this.dvbsBlockSize);
dvbsMapping.SetDataPtr(this.fileContent, this.dvbsBlockOffset + this.satConfig.ChannelListOffset);
for (int slot = 0; slot < this.dvbsChannelCount; slot++)
{
cmd.Parameters["@listid"].Value = listId;
cmd.Parameters["@slot"].Value = slot;
cmd.Parameters["@seq"].Value = DBNull.Value;
cmd.Parameters["@isdel"].Value = dvbsMapping.GetFlag("InUse") ? 0 : 1;
cmd.Parameters["@progmask"].Value = dvbsMapping.GetWord("offProgramNr");
cmd.Parameters["@prognr"].Value = dvbsMapping.GetWord("offProgramNr") & 0x3FFF;
cmd.Parameters["@progfix"].Value = dvbsMapping.GetWord("offProgramNrPreset");
int absNameOffset = dvbsMapping.BaseOffset + dvbsMapping.GetOffsets("offName")[0];
string longName, shortName;
decoder.GetChannelNames(fileContent, absNameOffset, dvbsMapping.GetByte("offNameLength"), out longName, out shortName);
cmd.Parameters["@name"].Value = longName;
cmd.Parameters["@tpnr"].Value = dvbsMapping.GetWord("offTransponderIndex");
var transp = this.DataRoot.Transponder.TryGet(dvbsMapping.GetWord("offTransponderIndex"));
cmd.Parameters["@satnr"].Value = transp == null ? (object)DBNull.Value : transp.Satellite.Id;
cmd.Parameters["@onid"].Value = transp == null ? (object)DBNull.Value : transp.OriginalNetworkId;
cmd.Parameters["@tsid"].Value = transp == null ? (object)DBNull.Value : transp.TransportStreamId;
cmd.Parameters["@ssid"].Value = (int)dvbsMapping.GetWord("offServiceId");
cmd.Parameters["@uid"].Value = transp == null
? (object) DBNull.Value
: transp.TransportStreamId + "-" + transp.OriginalNetworkId + "-" +
dvbsMapping.GetWord("offServiceId");
cmd.Parameters["@favcrypt"].Value = (int)dvbsMapping.GetByte("offFavorites");
cmd.Parameters["@lockskiphide"].Value = (int)dvbsMapping.GetByte("offLock");
cmd.ExecuteNonQuery();
dvbsMapping.BaseOffset += this.satConfig.dvbsChannelLength;
}
}
#endregion
#region PrepareChannelInsert()
private static void PrepareChannelInsert(DbCommand cmd)
{
var cols = new[] { "listid", "slot", "seq", "isdel", "progmask", "prognr", "progfix", "name", "tpnr", "satnr", "onid", "tsid", "ssid", "uid", "favcrypt", "lockskiphide" };
cmd.Parameters.Clear();
var sb = new StringBuilder();
sb.Append("insert into channel (");
var comma = "";
foreach (var col in cols)
{
sb.Append(comma).Append(col);
comma = ",";
}
sb.Append(") values (");
comma = "";
foreach (var col in cols)
{
sb.Append(comma).Append('@').Append(col);
comma = ",";
}
sb.Append(")");
cmd.CommandText = sb.ToString();
foreach (var col in cols)
{
DbParameter parm = cmd.CreateParameter();
parm.ParameterName = "@" + col;
if (col == "name" || col == "uid")
{
parm.DbType = DbType.String;
parm.Size = 40;
}
else
parm.DbType = DbType.Int32;
cmd.Parameters.Add(parm);
}
cmd.Prepare();
}
#endregion
}
}

View File

@@ -0,0 +1,17 @@
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
public class TllFileSerializerPlugin : ISerializerPlugin
{
public string PluginName { get { return "LG-Electronics xx*.tll"; } }
public string FileFilter { get { return "xx*.TLL"; } }
#region CreateSerializer()
public SerializerBase CreateSerializer(string inputFile)
{
return new TllFileSerializer(inputFile);
}
#endregion
}
}

View File

@@ -0,0 +1,235 @@
namespace ChanSort.Loader.LG
{
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.grpOption = 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.grpSetup = new DevExpress.XtraEditors.GroupControl();
this.grpInformation = new DevExpress.XtraEditors.GroupControl();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
this.lblHotelMenuAutoDetect = new DevExpress.XtraEditors.LabelControl();
((System.ComponentModel.ISupportInitialize)(this.grpOption)).BeginInit();
this.grpOption.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.grpSetup)).BeginInit();
this.grpSetup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grpInformation)).BeginInit();
this.grpInformation.SuspendLayout();
this.SuspendLayout();
//
// grpOption
//
this.grpOption.Controls.Add(this.cbHbbTv);
this.grpOption.Controls.Add(this.cbCustomCountry);
this.grpOption.Controls.Add(this.comboBoxEdit1);
this.grpOption.Controls.Add(this.labelControl1);
resources.ApplyResources(this.grpOption, "grpOption");
this.grpOption.Name = "grpOption";
//
// 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");
//
// grpSetup
//
this.grpSetup.Controls.Add(this.cbAutoChannelUpdate);
resources.ApplyResources(this.grpSetup, "grpSetup");
this.grpSetup.Name = "grpSetup";
//
// grpInformation
//
this.grpInformation.Controls.Add(this.labelControl4);
resources.ApplyResources(this.grpInformation, "grpInformation");
this.grpInformation.Name = "grpInformation";
//
// labelControl4
//
resources.ApplyResources(this.labelControl4, "labelControl4");
this.labelControl4.Name = "labelControl4";
//
// lblHotelMenuAutoDetect
//
resources.ApplyResources(this.lblHotelMenuAutoDetect, "lblHotelMenuAutoDetect");
this.lblHotelMenuAutoDetect.Appearance.ForeColor = ((System.Drawing.Color)(resources.GetObject("lblHotelMenuAutoDetect.Appearance.ForeColor")));
this.lblHotelMenuAutoDetect.Name = "lblHotelMenuAutoDetect";
this.lblHotelMenuAutoDetect.Click += new System.EventHandler(this.lblHotelMenuAutoDetect_Click);
//
// 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.lblHotelMenuAutoDetect);
this.Controls.Add(this.grpHotelMode);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.grpOption);
this.Controls.Add(this.grpSetup);
this.Controls.Add(this.grpInformation);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TvSettingsForm";
this.ShowInTaskbar = false;
this.Load += new System.EventHandler(this.TvSettingsForm_Load);
((System.ComponentModel.ISupportInitialize)(this.grpOption)).EndInit();
this.grpOption.ResumeLayout(false);
this.grpOption.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.grpSetup)).EndInit();
this.grpSetup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.grpInformation)).EndInit();
this.grpInformation.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevExpress.XtraEditors.GroupControl grpOption;
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 grpSetup;
private DevExpress.XtraEditors.LabelControl labelControl3;
private DevExpress.XtraEditors.LabelControl labelControl2;
private DevExpress.XtraEditors.GroupControl grpInformation;
private DevExpress.XtraEditors.LabelControl labelControl4;
private DevExpress.XtraEditors.LabelControl lblHotelMenuAutoDetect;
}
}

View File

@@ -0,0 +1,84 @@
using System;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
namespace ChanSort.Loader.LG
{
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.grpInformation.Visible = false;
this.Height -= this.grpInformation.Height;
}
if (mapping == null || !mapping.SupportsAutoChannelUpdate)
{
this.grpSetup.Visible = false;
this.Height -= this.grpSetup.Height;
}
else
{
this.cbAutoChannelUpdate.Checked = mapping.SettingsAutomaticChannelUpdate;
}
if (mapping == null || !mapping.SupportsHbbTv)
this.cbHbbTv.Enabled = false;
else
this.cbHbbTv.Checked = mapping.HbbTvEnabled;
if (mapping == null || !mapping.SupportsHotelMenu)
{
this.grpHotelMode.Visible = false;
this.Height -= this.grpHotelMode.Height;
}
else
{
this.cbHotelMode.Checked = mapping.HotelModeEnabled;
this.cbDtvUpdate.Checked = mapping.HotelModeDtvUpdate;
}
}
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;
}
private void lblHotelMenuAutoDetect_Click(object sender, EventArgs e)
{
this.lblHotelMenuAutoDetect.Text = this.tvSerializer.GetHotelMenuOffset().ToString();
}
}
}

View File

@@ -0,0 +1,166 @@
<?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="cbHbbTv.Properties.Caption" xml:space="preserve">
<value>HbbTV aktivieren (funktioniert nur mit den Ländereinstellungen DEU, FRA, NED und ESP)</value>
</data>
<data name="cbCustomCountry.Properties.Caption" xml:space="preserve">
<value>Eigene Werte erlauben (auf eigene Gefahr!)</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="btnCancel.Text" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="grpHotelMode.Text" xml:space="preserve">
<value>Hotel Modus</value>
</data>
<data name="labelControl3.Text" xml:space="preserve">
<value>HINWEIS: Bei aktivem Hotel-Modus kann man im 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.Caption" xml:space="preserve">
<value>D-TV Senderliste automatisch aktualisieren (empfohlen: AUS)</value>
</data>
<data name="cbHotelMode.Properties.Caption" xml:space="preserve">
<value>Hotel Modus aktivieren (empfohlen: EIN)</value>
</data>
<data name="cbAutoChannelUpdate.Properties.Caption" xml:space="preserve">
<value>Senderliste automatisch aktualisieren (empfohlen: AUS)</value>
</data>
<data name="grpSetup.Text" xml:space="preserve">
<value>EINST. Menu</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="$this.Text" xml:space="preserve">
<value>TV Einstellungen</value>
</data>
</root>

View File

@@ -0,0 +1,599 @@
<?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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbHbbTv.Parent" xml:space="preserve">
<value>grpOption</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbCustomCountry.Parent" xml:space="preserve">
<value>grpOption</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.v14.2" name="DevExpress.Utils.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="comboBoxEdit1.Properties.Buttons" type="DevExpress.XtraEditors.Controls.ButtonPredefines, DevExpress.Utils.v14.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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;comboBoxEdit1.Parent" xml:space="preserve">
<value>grpOption</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl1.Parent" xml:space="preserve">
<value>grpOption</value>
</data>
<data name="&gt;&gt;labelControl1.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="grpOption.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="grpOption.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 142</value>
</data>
<data name="grpOption.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 106</value>
</data>
<data name="grpOption.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="grpOption.Text" xml:space="preserve">
<value>OPTION Menu</value>
</data>
<data name="&gt;&gt;grpOption.Name" xml:space="preserve">
<value>grpOption</value>
</data>
<data name="&gt;&gt;grpOption.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;grpOption.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;grpOption.ZOrder" xml:space="preserve">
<value>4</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.v14.2, Version=14.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>3</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.v14.2, Version=14.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>2</value>
</data>
<assembly alias="DevExpress.XtraEditors.v14.2" name="DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="labelControl3.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.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.v14.2, Version=14.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.v14.2, Version=14.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.v14.2, Version=14.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.v14.2, Version=14.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.v14.2, Version=14.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>1</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;cbAutoChannelUpdate.Parent" xml:space="preserve">
<value>grpSetup</value>
</data>
<data name="&gt;&gt;cbAutoChannelUpdate.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="grpSetup.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="grpSetup.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 71</value>
</data>
<data name="grpSetup.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 71</value>
</data>
<data name="grpSetup.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="grpSetup.Text" xml:space="preserve">
<value>SETUP Menu</value>
</data>
<data name="&gt;&gt;grpSetup.Name" xml:space="preserve">
<value>grpSetup</value>
</data>
<data name="&gt;&gt;grpSetup.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;grpSetup.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;grpSetup.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="labelControl4.AutoSizeMode" type="DevExpress.XtraEditors.LabelAutoSizeMode, DevExpress.XtraEditors.v14.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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;labelControl4.Parent" xml:space="preserve">
<value>grpInformation</value>
</data>
<data name="&gt;&gt;labelControl4.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="grpInformation.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="grpInformation.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="grpInformation.Size" type="System.Drawing.Size, System.Drawing">
<value>480, 71</value>
</data>
<data name="grpInformation.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="grpInformation.Text" xml:space="preserve">
<value>Information</value>
</data>
<data name="&gt;&gt;grpInformation.Name" xml:space="preserve">
<value>grpInformation</value>
</data>
<data name="&gt;&gt;grpInformation.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.GroupControl, DevExpress.Utils.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;grpInformation.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;grpInformation.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="lblHotelMenuAutoDetect.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="lblHotelMenuAutoDetect.Appearance.ForeColor" type="System.Drawing.Color, System.Drawing">
<value>LightGray</value>
</data>
<data name="lblHotelMenuAutoDetect.Location" type="System.Drawing.Point, System.Drawing">
<value>11, 422</value>
</data>
<data name="lblHotelMenuAutoDetect.Size" type="System.Drawing.Size, System.Drawing">
<value>117, 13</value>
</data>
<data name="lblHotelMenuAutoDetect.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="lblHotelMenuAutoDetect.Text" xml:space="preserve">
<value>Auto-Detect Hotel-Menu</value>
</data>
<data name="&gt;&gt;lblHotelMenuAutoDetect.Name" xml:space="preserve">
<value>lblHotelMenuAutoDetect</value>
</data>
<data name="&gt;&gt;lblHotelMenuAutoDetect.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.LabelControl, DevExpress.XtraEditors.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;lblHotelMenuAutoDetect.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;lblHotelMenuAutoDetect.ZOrder" xml:space="preserve">
<value>0</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.v14.2, Version=14.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
</root>

View File

@@ -0,0 +1,91 @@
<?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>{68DA8072-3A29-4076-9F64-D66F38349585}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Loader.Panasonic</RootNamespace>
<AssemblyName>ChanSort.Loader.Panasonic</AssemblyName>
<TargetFrameworkVersion>v4.0</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>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</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>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.84.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\System.Data.SQLite.dll</HintPath>
</Reference>
<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="DbChannel.cs" />
<Compile Include="Serializer.cs" />
<Compile Include="SerializerPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<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>
<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,238 @@
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.Panasonic
{
internal class DbChannel : ChannelInfo
{
internal int Bits;
internal byte[] RawName;
#region ctor()
internal DbChannel(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, Encoding encoding)
{
this.RecordIndex = r.GetInt32(field["rowid"]);
this.RecordOrder = r.GetInt32(field["major_channel"]);
this.OldProgramNr = r.GetInt32(field["major_channel"]);
int ntype = r.GetInt32(field["ntype"]);
if (ntype == 1)
{
this.SignalSource |= SignalSource.DvbS;
if (r.GetInt32(field["ya_svcid"]) >= 0)
this.SignalSource |= SignalSource.Freesat;
}
else if (ntype == 2)
this.SignalSource |= SignalSource.DvbT;
else if (ntype == 3)
this.SignalSource |= SignalSource.DvbC;
else if (ntype == 10)
this.SignalSource |= SignalSource.AnalogT | SignalSource.Tv;
else if (ntype == 14)
this.SignalSource |= SignalSource.AnalogC | SignalSource.Tv;
else if (ntype == 15)
this.SignalSource |= SignalSource.SatIP;
byte[] buffer = new byte[1000];
var len = r.GetBytes(field["delivery"], 0, buffer, 0, 1000);
this.AddDebug(buffer, 0, (int) len);
this.Skip = r.GetInt32(field["skip"]) != 0;
this.Encrypted = r.GetInt32(field["free_CA_mode"]) != 0;
this.Lock = r.GetInt32(field["child_lock"]) != 0;
this.ParseFavorites(r, field);
this.ReadNamesWithEncodingDetection(r, field, encoding);
if (ntype == 10 || ntype == 14)
this.ReadAnalogData(r, field);
else
this.ReadDvbData(r, field, dataRoot, buffer);
}
#endregion
#region ParseFavorites
private void ParseFavorites(SQLiteDataReader r, IDictionary<string, int> field)
{
for (int i = 0; i < 4; i++)
{
int favIndex = r.GetInt32(field["profile" + (i + 1) + "index"]);
if (favIndex > 0)
{
this.Favorites |= (Favorites) (1 << i);
this.FavIndex[i] = favIndex;
}
}
}
#endregion
#region ReadAnalogData()
private void ReadAnalogData(SQLiteDataReader r, IDictionary<string, int> field)
{
this.FreqInMhz = r.IsDBNull(field["freq"]) ? 0 : (decimal)r.GetInt32(field["freq"]) / 1000;
this.ChannelOrTransponder = Tools.GetAnalogChannelNumber((int)this.FreqInMhz);
}
#endregion
#region ReadDvbData()
protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, byte[] delivery)
{
int stype = r.GetInt32(field["stype"]);
this.SignalSource |= LookupData.Instance.IsRadioOrTv(stype);
this.ServiceType = stype;
int freq = r.GetInt32(field["freq"]);
if ((this.SignalSource & SignalSource.Sat) != 0)
{
// ReSharper disable PossibleLossOfFraction
this.FreqInMhz = freq/10;
// ReSharper restore PossibleLossOfFraction
int satId = r.GetInt32(field["physical_ch"]) >> 12;
var sat = dataRoot.Satellites.TryGet(satId);
if (sat != null)
{
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
}
if (delivery.Length >= 7)
{
this.SymbolRate = (delivery[5] >> 4)*10000 + (delivery[5] & 0x0F)*1000 +
(delivery[6] >> 4)*100 + (delivery[6] & 0x0F)*10;
}
}
else
{
freq /= 1000;
this.FreqInMhz = freq;
this.ChannelOrTransponder = LookupData.Instance.GetDvbtTransponder(freq).ToString();
this.Satellite = (this.SignalSource & SignalSource.Antenna) != 0 ? "DVB-T" : "DVB-C";
}
this.OriginalNetworkId = r.GetInt32(field["onid"]);
this.TransportStreamId = r.GetInt32(field["tsid"]);
this.ServiceId = r.GetInt32(field["sid"]);
}
#endregion
#region ReadNamesWithEncodingDetection()
/// <summary>
/// Character encoding is a mess here. Code pages mixed with UTF-8 and raw data
/// </summary>
private void ReadNamesWithEncodingDetection(SQLiteDataReader r, IDictionary<string, int> field, Encoding encoding)
{
byte[] buffer = new byte[100];
int len = (int)r.GetBytes(field["sname"], 0, buffer, 0, buffer.Length);
int end = Array.IndexOf<byte>(buffer, 0, 0, len);
if (end >= 0)
len = end;
this.RawName = new byte[len];
Array.Copy(buffer, 0, this.RawName, 0, len);
this.ChangeEncoding(encoding);
}
#endregion
#region ChangeEncoding()
public override void ChangeEncoding(Encoding encoding)
{
// the encoding of channel names is a complete mess:
// it can be UTF-8
// it can be as specified by the DVB-encoding with a valid code page selector byte
// it can have a DVB-encoded code page selector, but ignores the CP and use UTF-8 regardless
// it can be code page encoded without any clue to what the code page is
// it can have DVB-control characters inside an UTF-8 stream
if (RawName.Length == 0)
return;
int startOffset;
int bytesPerChar;
if (!GetRecommendedEncoding(ref encoding, out startOffset, out bytesPerChar))
return;
// single byte code pages might have UTF-8 code mixed in, so we have to parse it manually
StringBuilder sb = new StringBuilder();
for (int i = startOffset; i < this.RawName.Length; i+=bytesPerChar)
{
byte c = this.RawName[i];
byte c2 = i + 1 < this.RawName.Length ? this.RawName[i + 1] : (byte)0;
if (c < 0xA0)
sb.Append((char)c);
else if (bytesPerChar == 1 && c >= 0xC0 && c <= 0xDF && c2 >= 0x80 && c2 <= 0xBF) // 2 byte UTF-8
{
sb.Append((char)(((c & 0x1F) << 6) | (c2 & 0x3F)));
++i;
}
else
sb.Append(encoding.GetString(this.RawName, i, bytesPerChar));
}
string longName, shortName;
this.GetChannelNames(sb.ToString(), out longName, out shortName);
this.Name = longName;
this.ShortName = shortName;
}
#endregion
#region GetRecommendedEncoding()
private bool GetRecommendedEncoding(ref Encoding encoding, out int startOffset, out int bytesPerChar)
{
startOffset = 0;
bytesPerChar = 1;
if (RawName[0] < 0x10) // single byte character sets
{
encoding = DvbStringDecoder.GetEncoding(RawName[0]);
startOffset = 1;
}
else if (RawName[0] == 0x10) // prefix for 16 bit code page ID with single byte character sets
{
if (RawName.Length < 3) return false;
encoding = DvbStringDecoder.GetEncoding(0x100000 + RawName[1]*256 + RawName[2]);
startOffset = 3;
}
else if (RawName[0] == 0x15) // UTF-8
{
encoding = Encoding.UTF8;
startOffset = 1;
}
else if (RawName[0] < 0x20) // various 2-byte character sets
{
encoding = DvbStringDecoder.GetEncoding(RawName[0]);
startOffset = 1;
bytesPerChar = 2;
}
return true;
}
#endregion
#region GetChannelNames()
private void GetChannelNames(string name, out string longName, out string shortName)
{
StringBuilder sbLong = new StringBuilder();
StringBuilder sbShort = new StringBuilder();
bool inShort = false;
foreach (char c in name)
{
if (c < 0x20)
continue;
if (c == 0x86 || c == '\uE086')
inShort = true;
else if (c == 0x87 || c == '\uE087')
inShort = false;
if (c >= 0x80 && c <= 0x9F || c>='\uE080' && c<='\uE09F')
continue;
if (inShort)
sbShort.Append(c);
sbLong.Append(c);
}
longName = sbLong.ToString();
shortName = sbShort.ToString();
}
#endregion
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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.Loader.Panasonic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Loader.Panasonic")]
[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("bcd581a8-8959-404c-b7a8-e43f512eec03")]
// 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,705 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Text;
using System.Windows.Forms;
using ChanSort.Api;
namespace ChanSort.Loader.Panasonic
{
class Serializer : SerializerBase
{
private const string ERR_FileFormatOrEncryption = "File uses an unknown format or encryption";
private static readonly int[] headerCypherTable;
private readonly ChannelList avbtChannels = new ChannelList(SignalSource.AnalogT | SignalSource.Tv | SignalSource.Radio, "Analog Antenna");
private readonly ChannelList avbcChannels = new ChannelList(SignalSource.AnalogC | SignalSource.Tv | SignalSource.Radio, "Analog Cable");
private readonly ChannelList dvbtChannels = new ChannelList(SignalSource.DvbT | SignalSource.Tv | SignalSource.Radio, "DVB-T");
private readonly ChannelList dvbcChannels = new ChannelList(SignalSource.DvbC | SignalSource.Tv | SignalSource.Radio, "DVB-C");
private readonly ChannelList dvbsChannels = new ChannelList(SignalSource.DvbS | SignalSource.Tv | SignalSource.Radio, "DVB-S");
private readonly ChannelList satipChannels = new ChannelList(SignalSource.SatIP | SignalSource.Tv | SignalSource.Radio, "SAT>IP");
private readonly ChannelList freesatChannels = new ChannelList(SignalSource.DvbS | SignalSource.Freesat | SignalSource.Tv | SignalSource.Radio, "Freesat");
private string workFile;
private CypherMode cypherMode;
private byte[] fileHeader = new byte[0];
private int dbSizeOffset;
private bool littleEndianByteOrder;
private string charEncoding;
enum CypherMode
{
None,
HeaderAndChecksum,
Encryption,
Unknown
}
#region static ctor / headerCypherTable
static Serializer()
{
headerCypherTable = new[]
{
0,
79764919,
159529838,
222504665,
319059676,
398814059,
445009330,
507990021,
638119352,
583659535,
797628118,
726387553,
890018660,
835552979,
1015980042,
944750013,
1276238704,
1221641927,
1167319070,
1095957929,
1595256236,
1540665371,
1452775106,
1381403509,
1780037320,
1859660671,
1671105958,
1733955601,
2031960084,
2111593891,
1889500026,
1952343757,
-1742489888,
-1662866601,
-1851683442,
-1788833735,
-1960329156,
-1880695413,
-2103051438,
-2040207643,
-1104454824,
-1159051537,
-1213636554,
-1284997759,
-1389417084,
-1444007885,
-1532160278,
-1603531939,
-734892656,
-789352409,
-575645954,
-646886583,
-952755380,
-1007220997,
-827056094,
-898286187,
-231047128,
-151282273,
-71779514,
-8804623,
-515967244,
-436212925,
-390279782,
-327299027,
881225847,
809987520,
1023691545,
969234094,
662832811,
591600412,
771767749,
717299826,
311336399,
374308984,
453813921,
533576470,
25881363,
88864420,
134795389,
214552010,
2023205639,
2086057648,
1897238633,
1976864222,
1804852699,
1867694188,
1645340341,
1724971778,
1587496639,
1516133128,
1461550545,
1406951526,
1302016099,
1230646740,
1142491917,
1087903418,
-1398421865,
-1469785312,
-1524105735,
-1578704818,
-1079922613,
-1151291908,
-1239184603,
-1293773166,
-1968362705,
-1905510760,
-2094067647,
-2014441994,
-1716953613,
-1654112188,
-1876203875,
-1796572374,
-525066777,
-462094256,
-382327159,
-302564546,
-206542021,
-143559028,
-97365931,
-17609246,
-960696225,
-1031934488,
-817968335,
-872425850,
-709327229,
-780559564,
-600130067,
-654598054,
1762451694,
1842216281,
1619975040,
1682949687,
2047383090,
2127137669,
1938468188,
2001449195,
1325665622,
1271206113,
1183200824,
1111960463,
1543535498,
1489069629,
1434599652,
1363369299,
622672798,
568075817,
748617968,
677256519,
907627842,
853037301,
1067152940,
995781531,
51762726,
131386257,
177728840,
240578815,
269590778,
349224269,
429104020,
491947555,
-248556018,
-168932423,
-122852000,
-60002089,
-500490030,
-420856475,
-341238852,
-278395381,
-685261898,
-739858943,
-559578920,
-630940305,
-1004286614,
-1058877219,
-845023740,
-916395085,
-1119974018,
-1174433591,
-1262701040,
-1333941337,
-1371866206,
-1426332139,
-1481064244,
-1552294533,
-1690935098,
-1611170447,
-1833673816,
-1770699233,
-2009983462,
-1930228819,
-2119160460,
-2056179517,
1569362073,
1498123566,
1409854455,
1355396672,
1317987909,
1246755826,
1192025387,
1137557660,
2072149281,
2135122070,
1912620623,
1992383480,
1753615357,
1816598090,
1627664531,
1707420964,
295390185,
358241886,
404320391,
483945776,
43990325,
106832002,
186451547,
266083308,
932423249,
861060070,
1041341759,
986742920,
613929101,
542559546,
756411363,
701822548,
-978770311,
-1050133554,
-869589737,
-924188512,
-693284699,
-764654318,
-550540341,
-605129092,
-475935807,
-413084042,
-366743377,
-287118056,
-257573603,
-194731862,
-114850189,
-35218492,
-1984365303,
-1921392450,
-2143631769,
-2063868976,
-1698919467,
-1635936670,
-1824608069,
-1744851700,
-1347415887,
-1418654458,
-1506661409,
-1561119128,
-1129027987,
-1200260134,
-1254728445,
-1309196108
};
}
#endregion
#region ctor()
public Serializer(string inputFile) : base(inputFile)
{
DepencencyChecker.AssertVc2010RedistPackageX86Installed();
this.Features.ChannelNameEdit = false; // due to the chaos with binary data inside the "sname" string column, writing back a name has undesired side effects
this.Features.CanHaveGaps = false;
this.DataRoot.SortedFavorites = true;
this.DataRoot.AddChannelList(this.avbtChannels);
this.DataRoot.AddChannelList(this.avbcChannels);
this.DataRoot.AddChannelList(this.dvbtChannels);
this.DataRoot.AddChannelList(this.dvbcChannels);
this.DataRoot.AddChannelList(this.dvbsChannels);
this.DataRoot.AddChannelList(this.satipChannels);
this.DataRoot.AddChannelList(this.freesatChannels);
}
#endregion
public override string DisplayName { get { return "Panasonic .db/.bin Loader"; } }
#region Load()
public override void Load()
{
this.workFile = this.GetUncypheredWorkFile();
this.CreateDummySatellites();
string channelConnString = "Data Source=" + this.workFile;
using (var conn = new SQLiteConnection(channelConnString))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
RepairCorruptedDatabaseImage(cmd);
InitCharacterEncoding(cmd);
this.ReadChannels(cmd);
}
}
}
#endregion
#region GetUncypheredWorkFile()
private string GetUncypheredWorkFile()
{
this.cypherMode = this.GetCypherMode(this.FileName);
if (cypherMode == CypherMode.Unknown)
throw new FileLoadException(ERR_FileFormatOrEncryption);
if (cypherMode == CypherMode.None)
return this.FileName;
var tempFile = this.FileName + ".tmp";
File.Delete(tempFile);
Application.ApplicationExit += CleanTempFile;
if (cypherMode == CypherMode.Encryption)
this.CypherFile(this.FileName, tempFile, false);
else
this.RemoveHeader(this.FileName, tempFile);
return tempFile;
}
#endregion
#region GetCypherMode()
private CypherMode GetCypherMode(string file)
{
using (var stream = File.OpenRead(file))
using (var rdr = new BinaryReader(stream))
{
uint value = (uint)rdr.ReadInt32();
if (value == 0x694C5153) return CypherMode.None; // "SQLi"
if (value == 0x42445350) return CypherMode.HeaderAndChecksum; // "PSDB"
if (value == 0xA07DCB50) return CypherMode.Encryption;
return CypherMode.Unknown;
}
}
#endregion
#region CypherFile()
/// <summary>
/// XOR-based cypher which can be used to alternately crypt/decrypt data
/// </summary>
private void CypherFile(string input, string output, bool encrypt)
{
byte[] fileContent = File.ReadAllBytes(input);
if (!encrypt && this.CalcChecksum(fileContent, fileContent.Length) != 0)
throw new FileLoadException("Checksum validation failed");
int chiffre = 0x0388;
int step = 0;
for (int i = 0; i < fileContent.Length - 4; i++)
{
byte b = fileContent[i];
byte n = (byte) (b ^ (chiffre >> 8));
fileContent[i] = n;
if (++step < 256)
chiffre += (encrypt ? n : b) + 0x96A3;
else
{
chiffre = 0x0388;
step = 0;
}
}
if (encrypt)
this.UpdateChecksum(fileContent);
File.WriteAllBytes(output, fileContent);
}
#endregion
#region RemoveHeader()
private void RemoveHeader(string inputFile, string outputFile)
{
var data = File.ReadAllBytes(inputFile);
if (this.CalcChecksum(data, data.Length) != 0)
throw new FileLoadException("Checksum validation failed");
int offset;
if (!this.ValidateFileSize(data, false, out offset)
&& !this.ValidateFileSize(data, true, out offset))
throw new FileLoadException("File size validation failed");
using (var stream = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
stream.Write(data, offset, data.Length - offset - 4);
this.fileHeader = new byte[offset];
Array.Copy(data, 0, this.fileHeader, 0, offset);
}
#endregion
#region ValidateFileSize()
private bool ValidateFileSize(byte[] data, bool littleEndian, out int offset)
{
this.littleEndianByteOrder = littleEndian;
offset = 30 + Tools.GetInt16(data, 28, littleEndian);
if (offset >= data.Length) return false;
this.dbSizeOffset = offset;
int dbSize = Tools.GetInt32(data, offset, littleEndian);
offset += 4;
return data.Length == offset + dbSize + 4;
}
#endregion
#region CalcChecksum()
private uint CalcChecksum(byte[] data, int length)
{
uint v = 0xffffffff;
for (int i = 0; i < length; i++)
{
byte b = data[i];
v = (v << 8) ^ (uint)headerCypherTable[((v >> 24) ^ b) & 0xFF];
}
return v;
}
#endregion
#region CleanTempFile()
private void CleanTempFile(object sender, EventArgs e)
{
try
{
if (this.workFile != null)
File.Delete(this.workFile);
}
catch { }
}
#endregion
#region CreateDummySatellites()
private void CreateDummySatellites()
{
for (int i = 1; i <= 4; i++)
{
var sat = new Satellite(i);
sat.Name = "LNB "+i;
sat.OrbitalPosition = i.ToString();
this.DataRoot.Satellites.Add(i, sat);
}
}
#endregion
#region InitCharacterEncoding()
private void InitCharacterEncoding(SQLiteCommand cmd)
{
cmd.CommandText = "PRAGMA encoding";
this.charEncoding = cmd.ExecuteScalar() as string;
}
#endregion
#region RepairCorruptedDatabaseImage()
private void RepairCorruptedDatabaseImage(SQLiteCommand cmd)
{
cmd.CommandText = "REINDEX";
cmd.ExecuteNonQuery();
}
#endregion
#region ReadChannels()
private void ReadChannels(SQLiteCommand cmd)
{
string[] fieldNames = { "rowid", "major_channel", "physical_ch","sname", "freq", "skip", "running_status","free_CA_mode","child_lock",
"profile1index","profile2index","profile3index","profile4index","stype", "onid", "tsid", "sid", "ntype", "ya_svcid", "delivery" };
const string sql = @"
select s.rowid,s.major_channel,s.physical_ch,cast(s.sname as blob),t.freq,s.skip,s.running_status,s.free_CA_mode,s.child_lock,
profile1index,profile2index,profile3index,profile4index,s.stype,s.onid,s.tsid,s.svcid,s.ntype,s.ya_svcid,delivery
from SVL s
left outer join TSL t on s.ntype=t.ntype and s.physical_ch=t.physical_ch and s.tsid=t.tsid
order by s.ntype,major_channel
";
var fields = this.GetFieldMap(fieldNames);
cmd.CommandText = sql;
using (var r = cmd.ExecuteReader())
{
while (r.Read())
{
ChannelInfo channel = new DbChannel(r, fields, this.DataRoot, this.DefaultEncoding);
if (!channel.IsDeleted)
{
var channelList = this.DataRoot.GetChannelList(channel.SignalSource);
if (channelList != null)
this.DataRoot.AddChannel(channelList, channel);
}
}
}
}
#endregion
#region GetFieldMap()
private IDictionary<string, int> GetFieldMap(string[] fieldNames)
{
Dictionary<string, int> field = new Dictionary<string, int>();
for (int i = 0; i < fieldNames.Length; i++)
field[fieldNames[i]] = i;
return field;
}
#endregion
#region DefaultEncoding
public override Encoding DefaultEncoding
{
get { return base.DefaultEncoding; }
set
{
base.DefaultEncoding = value;
foreach (var list in this.DataRoot.ChannelLists)
{
foreach(var channel in list.Channels)
channel.ChangeEncoding(value);
}
}
}
#endregion
#region Save()
public override void Save(string tvOutputFile)
{
this.FileName = tvOutputFile;
string channelConnString = "Data Source=" + this.workFile;
using (var conn = new SQLiteConnection(channelConnString))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
using (var trans = conn.BeginTransaction())
{
this.WriteChannels(cmd, this.avbtChannels);
this.WriteChannels(cmd, this.avbcChannels);
this.WriteChannels(cmd, this.dvbtChannels);
this.WriteChannels(cmd, this.dvbcChannels);
this.WriteChannels(cmd, this.dvbsChannels);
this.WriteChannels(cmd, this.satipChannels);
this.WriteChannels(cmd, this.freesatChannels);
trans.Commit();
}
this.RepairCorruptedDatabaseImage(cmd);
}
}
this.WriteCypheredFile();
}
#endregion
#region WriteChannels()
private void WriteChannels(SQLiteCommand cmd, ChannelList channelList)
{
cmd.CommandText = "update SVL set major_channel=@progNr, profile1index=@fav1, profile2index=@fav2, profile3index=@fav3, profile4index=@fav4, child_lock=@lock, skip=@skip where rowid=@rowid";
cmd.Parameters.Clear();
cmd.Parameters.Add(new SQLiteParameter("@rowid", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@progNr", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@fav1", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@fav2", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@fav3", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@fav4", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@lock", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@skip", DbType.Int32));
cmd.Prepare();
foreach (ChannelInfo channelInfo in channelList.Channels)
{
var channel = channelInfo as DbChannel;
if (channel == null) // skip reference list proxy channels
continue;
if (channel.NewProgramNr < 0 || channel.OldProgramNr < 0)
continue;
cmd.Parameters["@rowid"].Value = channel.RecordIndex;
cmd.Parameters["@progNr"].Value = channel.NewProgramNr;
for (int fav = 0; fav < 4; fav++)
cmd.Parameters["@fav" + (fav + 1)].Value = Math.Max(0, channel.FavIndex[fav]);
cmd.Parameters["@lock"].Value = channel.Lock;
cmd.Parameters["@skip"].Value = channel.Skip;
cmd.ExecuteNonQuery();
}
// delete unassigned channels
cmd.CommandText = "delete from SVL where rowid=@rowid";
cmd.Parameters.Clear();
cmd.Parameters.Add(new SQLiteParameter("@rowid", DbType.Int32));
foreach (ChannelInfo channel in channelList.Channels)
{
if (channel.NewProgramNr == -1 && channel.OldProgramNr >= 0)
{
cmd.Parameters["@rowid"].Value = channel.RecordIndex;
cmd.ExecuteNonQuery();
}
}
}
#endregion
#region WriteCypheredFile()
private void WriteCypheredFile()
{
switch (this.cypherMode)
{
case CypherMode.None:
break;
case CypherMode.Encryption:
this.CypherFile(this.workFile, this.FileName, true);
break;
case CypherMode.HeaderAndChecksum:
this.WriteFileWithHeaderAndChecksum();
break;
}
}
#endregion
#region WriteFileWithHeaderAndChecksum()
private void WriteFileWithHeaderAndChecksum()
{
long workFileSize = new FileInfo(this.workFile).Length;
byte[] data = new byte[this.fileHeader.Length + workFileSize + 4];
Array.Copy(fileHeader, data, fileHeader.Length);
using (var stream = new FileStream(this.workFile, FileMode.Open, FileAccess.Read))
stream.Read(data, fileHeader.Length, (int)workFileSize);
Tools.SetInt32(data, this.dbSizeOffset, (int)workFileSize, this.littleEndianByteOrder);
this.UpdateChecksum(data);
using (var stream = new FileStream(this.FileName, FileMode.Create, FileAccess.Write))
stream.Write(data, 0, data.Length);
}
#endregion
#region UpdateChecksum()
private void UpdateChecksum(byte[] data)
{
uint checksum = this.CalcChecksum(data, data.Length - 4);
data[data.Length - 1] = (byte)(checksum & 0xFF);
data[data.Length - 2] = (byte)((checksum >> 8) & 0xFF);
data[data.Length - 3] = (byte)((checksum >> 16) & 0xFF);
data[data.Length - 4] = (byte)((checksum >> 24) & 0xFF);
}
#endregion
#region GetFileInformation()
public override string GetFileInformation()
{
StringBuilder sb = new StringBuilder();
sb.Append(base.GetFileInformation());
sb.Append("Content type: ");
switch (this.GetCypherMode(this.FileName))
{
case CypherMode.None: sb.AppendLine("unencrypted SQLite database"); break;
case CypherMode.Encryption: sb.AppendLine("encrypted SQLite database"); break;
case CypherMode.HeaderAndChecksum:
sb.AppendLine("embedded SQLite database");
sb.Append("Byte order: ").AppendLine(this.littleEndianByteOrder ?
"little-endian (least significant byte first)" : "big-endian (most significant byte first)");
break;
}
sb.Append("Character encoding: ").AppendLine(this.charEncoding);
return sb.ToString();
}
#endregion
}
}

View File

@@ -0,0 +1,15 @@
using ChanSort.Api;
namespace ChanSort.Loader.Panasonic
{
public class SerializerPlugin : ISerializerPlugin
{
public string PluginName { get { return "Panasonic *.db,*.bin"; } }
public string FileFilter { get { return "*.db;*.bin"; } }
public SerializerBase CreateSerializer(string inputFile)
{
return new Serializer(inputFile);
}
}
}

View File

@@ -0,0 +1,31 @@
using ChanSort.Api;
namespace ChanSort.Loader.Samsung
{
internal class AnalogChannel : ScmChannelBase
{
private const string _Frequency = "offFrequency";
#region ctor()
public AnalogChannel(int slot, bool isCable, DataMapping mapping, decimal freq, FavoritesIndexMode sortedFavorites) :
base(mapping, sortedFavorites)
{
var signalSource = SignalSource.Analog | SignalSource.Tv;
signalSource |= isCable ? SignalSource.Cable : SignalSource.Antenna;
this.InitCommonData(slot, signalSource, mapping);
var floatFreq = mapping.GetFloat(_Frequency);
if (!float.IsNaN(floatFreq))
this.FreqInMhz = (decimal)floatFreq; // 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.ChannelOrTransponder = "";
}
#endregion
}
}

View File

@@ -0,0 +1,123 @@
<?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>{A1C9A98D-368A-44E8-9B7F-7EACA46C9EC5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Loader.Samsung</RootNamespace>
<AssemblyName>ChanSort.Loader.Samsung</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</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>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</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>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AnalogChannel.cs" />
<Compile Include="DigitalChannel.cs" />
<Compile Include="FavMode.cs" />
<Compile Include="ModelConstants.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">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="SatChannel.cs" />
<Compile Include="SatelliteMapping.cs" />
<Compile Include="ScmChannelBase.cs" />
<Compile Include="ScmSerializer.cs" />
<Compile Include="ScmSerializerPlugin.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
<Project>{DCCFFA08-472B-4D17-BB90-8F513FC01392}</Project>
<Name>ChanSort.Api</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="ChanSort.Loader.Samsung.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</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>
</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,359 @@
[Series:B]
SatDataBase.dat = 145
TransponderDataBase.dat = 49
FineTune = 20
FineTune_Digital = 28
PTC = 12
map-AirA = 28
map-AirD = 248
map-CableD = 248
map-SateD = 144
Favorites = 4
[Series:C]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
PTC = 12
map-AirA = 40
map-AirD = 292
map-CableD = 292
map-SateD = 144
Favorites = 4
[Series:D]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
PTC = 12
map-AirA = 64
map-AirD = 320
map-CableD = 320
map-SateD = 172
map-AstraHDPlusD = 212
Favorites = 5
SortedFavorites = 0
[Series:E]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
PTC = 12
map-AirA = 64
map-AirD = 320
map-CableD = 320
map-SateD = 168
map-AstraHDPlusD = 212
Favorites = 5
SortedFavorites = 1
[Series:F]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
PTC = 12
map-AirA = 64
map-AirD = 320
map-CableD = 320
map-SateD = 168
map-AstraHDPlusD = 212
Favorites = 5
SortedFavorites = 2
[Series:H]
SatDataBase.dat = 145
TransponderDataBase.dat = 45
PTC = 12
map-AirA = 64
map-AirD = 320
map-CableD = 320
map-SateD = 168
map-AstraHDPlusD = 212
map-CyfraPlusD = 172
Favorites = 5
SortedFavorites = 2
[Analog:28]
; map-AirA and map-CableA for B series
offInUse = 0
maskInUse = 0x02
offProgramNr = 4
offNameLength =
offName = 12
lenName = 10
offFavorites = 26
offChecksum = 27
[Analog:40]
; map-AirA and map-CableA for C series
offInUse = 1
maskInUse = 0x01
offDeleted = 2
maskDeleted = 0x01
offLock = 6
maskLock = 0x01
offTuned = 8
maskTuned = 0x01
offProgramNr = 9
offSlotNr = 16
offNameLength = 18
offName = 20
lenName = 10
offFrequency = 32
offFavorites = 38
offChecksum = 39
[Analog:64]
; map-AirA and map-CableA for D,E and F series
offInUse = 1
maskInUse = 0x01
offDeleted = 2
maskDeleted = 0x01
offLock = 6
maskLock = 0x01
offTuned = 8
maskTuned = 0x01
offProgramNr = 9
offSlotNr = 16
offNameLength = 18
offName = 20
lenName = 10
offFrequency = 32
offFavorites = 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
[PTC:12]
offFrequency = 4
offChannelTransponder = 8
[ServiceProvider:108]
offSignalSource = 0
offIndex = 2
offLenName = 6
offName = 8
[DvbCT:248]
; map-AirD and map-CableD for B series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
; "Deleted"-flag is implemented in reverse by IsActive
offIsActive = 6
maskIsActive = 0x02
offQam = 7
offInUse = 8
maskInUse = 0x80
offServiceType = 9
offServiceId = 10
offOriginalNetworkId = 12
offNetworkId = 14
offEncrypted = 23
maskEncrypted = 0x20
offChannelTransponder = 26
offLogicalProgramNr = 28
offSymbolRate = 32
offBouquet = 34
offTransportStreamId = 36
offName = 44
lenName = 100
offLock = 245
maskLock = 0x01
offFavorites = 246
offChecksum = 247
[DvbCT:292]
; map-AirD and map-CableD for C series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offServiceId = 6
offDeleted = 8
maskDeleted = 0x01
offSignalSource = 10
offQam = 12
offBandwidth = 14
offServiceType = 15
offCodec = 16
offHRes = 20
offVRes = 22
offEncrypted = 24
maskEncrypted = 0x01
offFrameRate = 25
offSymbolRate = 28
offLock = 31
maskLock = 0x01
offOriginalNetworkId = 32
offNetworkId = 34
offServiceProviderId = 40
offChannelTransponder = 42
offLogicalProgramNr = 44
offTransportStreamId = 48
offName = 64
lenName = 100
offShortName = 264
lenShortName = 18
offVideoFormat = 282
offFavorites = 290
offChecksum = 291
[DvbCT:320]
; map-AirD, map-CableD, Freesat for D,E and F series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offServiceId = 6
offDeleted = 8
maskDeleted = 0x01
offSignalSource = 10
offQam = 12
offBandwidth = 14
offServiceType = 15
offCodec = 16
offHRes = 20
offVRes = 22
offEncrypted = 24
maskEncrypted = 0x01
offFrameRate = 25
offSymbolRate = 28
offLock = 31
maskLock = 0x01
offOriginalNetworkId = 32
offNetworkId = 34
offServiceProviderId = 40
offChannelTransponder = 42
offLogicalProgramNr = 44
offTransportStreamId = 48
offName = 64
lenName = 100
offShortName = 264
lenShortName = 18
offVideoFormat = 282
offFavorites = 292,296,300,304,308
offChecksum = 319
[TransponderDataBase.dat:49]
; B Series
offMagicByte = 0
offTransponderIndex = 1
offSatelliteIndex = 5
offFrequency = 9
offSymbolRate = 17
[TransponderDataBase.dat:45]
; C,D,E Series
offMagicByte = 0
offTransponderIndex = 1
offSatelliteIndex = 5
offFrequency = 9
offSymbolRate = 13
[DvbS:144]
; map-SateD for B and C Series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offInUse = 7
maskInUse = 0x01
offSignalSource = 10
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderIndex = 18
offSatelliteIndex = 20
offTransportStreamId = 24
offOriginalNetworkId = 28
offHRes = 32
offVRes = 34
offName = 36
lenName = 100
offEncrypted = 136
maskEncrypted = 0x01
offServiceProviderId = 138
offFavorites = 142
offChecksum = 143
[DvbS:172]
; map-SateD for D Series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offInUse = 7
maskInUse = 0x01
offSignalSource = 10
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderIndex = 18
offSatelliteIndex = 20
offTransportStreamId = 24
offOriginalNetworkId = 28
offHRes = 32
offVRes = 34
offName = 36
lenName = 100
offEncrypted = 136
maskEncrypted = 0x01
offServiceProviderId = 138
offFavorites = 140,144,148,152,156
offChecksum = 171
[DvbS:168]
; map-SateD for E and F Series
offProgramNr = 0
offVideoPid = 2
offPcrPid = 4
offInUse = 7
maskInUse = 0x01
offSignalSource = 10
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderIndex = 18
offSatelliteIndex = 20
offTransportStreamId = 24
offOriginalNetworkId = 28
offHRes = 32
offVRes = 34
offName = 36
offEncrypted = 136
maskEncrypted = 0x01
lenName = 100
offServiceProviderId = 138
offFavorites = 140,144,148,152,156
offChecksum = 167
[AstraHDPlusD:212]
; map-AstraHDPlusD for D, E and F Series
offProgramNr = 0,20
offVideoPid=2
offPcrId=4
offInUse = 7
maskInUse = 0x01
offSignalSource = 10
offLock = 13
maskLock = 0x01
offServiceType = 14
offServiceId = 16
offTransponderIndex = 18
; satindex is just a guess-pick of a field thats always 0001
offSatelliteIndex = 40
offTransportStreamId = 36
offOriginalNetworkId = 32
offName = 48
lenName = 100
offEncrypted = 180
maskEncrypted = 0x01
offFavorites = 184,188,192,196,200
offChecksum = 211

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using ChanSort.Api;
namespace ChanSort.Loader.Samsung
{
public class DigitalChannel : ScmChannelBase
{
private const string _ChannelOrTransponder = "offChannelTransponder";
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data,
IDictionary<int, decimal> transpFreq, FavoritesIndexMode sortedFavorites, IDictionary<int, string> providerNames) :
base(data, sortedFavorites)
{
this.InitCommonData(slot, (SignalSource)((int)signalSource & ~(int)(SignalSource.TvAndRadio)), data);
if (!this.InUse || this.OldProgramNr == 0)
return;
this.InitDvbData(data, providerNames);
int transp = data.GetByte(_ChannelOrTransponder);
decimal freq = transpFreq.TryGet(transp);
if (freq == 0)
freq = transp*8 + 106; // (106 = DVB-C; DVB-T=306?)
this.ChannelOrTransponder = LookupData.Instance.GetDvbtTransponder(freq).ToString();
this.FreqInMhz = freq;
}
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChanSort.Loader.Samsung
{
class FavMode
{
}
}

View File

@@ -0,0 +1,60 @@
using ChanSort.Api;
namespace ChanSort.Loader.Samsung
{
public enum FavoritesIndexMode
{
/// <summary>
/// D model uses values 0 and 1
/// </summary>
Flag = 0,
/// <summary>
/// E model uses -1 for not-a-fav and 1-x for a fav program number
/// </summary>
IndividuallySorted = 1,
/// <summary>
/// some F models and H series uses -1 for not-a-fav, but expects 1-x to match the main program number
/// </summary>
MainProgramnrIndex = 2
}
internal class ModelConstants
{
public readonly string series;
public readonly int dvbsSatelliteLength;
public readonly int dvbsTransponderLength;
public readonly int dvbsChannelLength;
public readonly int dvbtChannelLength;
public readonly int avbtChannelLength;
public readonly int hdplusChannelLength;
public readonly int avbtFineTuneLength;
public readonly int dvbtFineTuneLength;
public readonly Favorites supportedFavorites;
public readonly int ptcLength;
public readonly int serviceProviderLength;
public readonly FavoritesIndexMode SortedFavorites;
public readonly int cyfraPlusChannelSize;
public ModelConstants(IniFile.Section iniSection)
{
this.series = iniSection.Name.Substring(iniSection.Name.Length - 1);
this.avbtChannelLength = iniSection.GetInt("map-AirA");
this.dvbtChannelLength = iniSection.GetInt("map-AirD");
this.dvbsChannelLength = iniSection.GetInt("map-SateD");
this.hdplusChannelLength = iniSection.GetInt("map-AstraHDPlusD");
this.cyfraPlusChannelSize = iniSection.GetInt("map-CyfraPlusD");
this.ptcLength = iniSection.GetInt("PTC");
this.dvbsSatelliteLength = iniSection.GetInt("SatDataBase.dat");
this.dvbsTransponderLength = iniSection.GetInt("TransponderDataBase.dat");
this.avbtFineTuneLength = iniSection.GetInt("FineTune");
this.dvbtFineTuneLength = iniSection.GetInt("FineTune_Digital");
this.serviceProviderLength = iniSection.GetInt("ServiceProvider", 108);
int numFavorites = iniSection.GetInt("Favorites");
int mask = 0;
for (int i = 0; i < numFavorites; i++)
mask = (mask << 1) | 1;
this.supportedFavorites = (Favorites)mask;
this.SortedFavorites = (FavoritesIndexMode)iniSection.GetInt("SortedFavorites");
}
}
}

View File

@@ -0,0 +1,38 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly:InternalsVisibleTo("Test.Loader")]
// 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.Loader.Samsung")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChanSort.Loader.Samsung")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[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("6f59ac5a-afba-42e3-a63e-c74793c15980")]
// 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,76 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChanSort.Loader.Samsung {
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.Loader.Samsung.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 This file contains no data, all bytes in it are set to 0.
///
///Please make sure your USB stick is formatted as FAT32 and preferrably not larger than 4GB.
///If that still does not work, try to reset your TV to factory defaults and run a new channel search.
///(This might be necessary after a firmware update.).
/// </summary>
internal static string ScmSerializer_AllBytesInFileAreZero {
get {
return ResourceManager.GetString("ScmSerializer_AllBytesInFileAreZero", resourceCulture);
}
}
}
}

View File

View File

@@ -0,0 +1,108 @@
<?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="ScmSerializer_AllBytesInFileAreZero" xml:space="preserve">
<value>Diese Datei enthält keine Daten, alle Bytes darin haben den Wert 0.
Bitte stellen Sie sicher, dass der USB Stick mit FAT32 formatiert ist und wenn möglich nicht größer als 4GB ist.
Sollte es danach weiterhin nicht funktionieren, versuchen Sie bitte das Gerät auf Werkseinstellungen zurückzusetzen und einen Suchlauf durchzuführen.
(Dies kann nach machen Firmwareupdates nötig sein, damit Export/Import wieder funktionieren.)</value>
</data>
</root>

View File

@@ -0,0 +1,108 @@
<?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="ScmSerializer_AllBytesInFileAreZero" xml:space="preserve">
<value>This file contains no data, all bytes in it are set to 0.
Please make sure your USB stick is formatted as FAT32 and preferrably not larger than 4GB.
If that still does not work, try to reset your TV to factory defaults and run a new channel search.
(This might be necessary after a firmware update.)</value>
</data>
</root>

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using ChanSort.Api;
namespace ChanSort.Loader.Samsung
{
class SatChannel : ScmChannelBase
{
private const string _TransponderIndex = "offTransponderIndex";
public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, FavoritesIndexMode sortedFavorites, IDictionary<int,string> providerNames) :
base(data, sortedFavorites)
{
this.InitCommonData(slot, SignalSource.DvbS | presetList, data);
if (!this.InUse)
return;
this.InitDvbData(data, providerNames);
int transponderIndex = data.GetWord(_TransponderIndex);
Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex);
if (transponder == null)
{
var list = dataRoot.GetChannelList(this.SignalSource|SignalSource.Tv);
dataRoot.Warnings.AppendFormat("{0} channel record #{1} (Pr# {2} \"{3}\") contains invalid transponder index {4}\r\n",
list.ShortCaption, slot, this.OldProgramNr, this.Name, 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 = "";
}
public override void UpdateRawData()
{
if (this.NewProgramNr < 0) // "deleted" flag is currently unknown for sat channels
this.InUse = false;
base.UpdateRawData();
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Text;
namespace ChanSort.Loader.Samsung
{
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).TrimEnd('\0'); } }
public bool IsEast { get { return BitConverter.ToInt32(data, BaseOffset + 137) != 0; } }
public int Longitude { get { return BitConverter.ToInt32(data, BaseOffset + 141); } }
}
}

View File

@@ -0,0 +1,201 @@
using System;
using System.Collections.Generic;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.Samsung
{
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 _IsActive = "IsActive";
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 const string _ServiceProviderId = "offServiceProviderId";
private static readonly Encoding Utf16BigEndian = new UnicodeEncoding(true, false);
private readonly FavoritesIndexMode sortedFavorites;
protected readonly DataMapping mapping;
protected readonly byte[] rawData;
internal readonly int baseOffset;
internal bool InUse { get; set; }
protected ScmChannelBase(DataMapping data, FavoritesIndexMode sortedFavorites)
{
this.mapping = data;
this.rawData = data.Data;
this.baseOffset = data.BaseOffset;
this.mapping.DefaultEncoding = Utf16BigEndian;
this.sortedFavorites = sortedFavorites;
}
#region InitCommonData()
protected void InitCommonData(int slot, SignalSource signalSource, DataMapping data)
{
this.InUse = data.GetFlag(_InUse, true);
this.RecordIndex = slot;
this.RecordOrder = slot;
this.SignalSource = signalSource;
this.OldProgramNr = (short)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, false) || !data.GetFlag(_IsActive, true);
if (this.IsDeleted)
this.OldProgramNr = -1;
}
#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,F
byte fav = 0;
byte mask = 0x01;
int favIndex = 0;
foreach (int off in offsets)
{
int favValue = BitConverter.ToInt32(this.rawData, baseOffset + off);
if (sortedFavorites == FavoritesIndexMode.Flag && favValue != 0)
fav |= mask;
else if (sortedFavorites != FavoritesIndexMode.Flag && favValue != -1)
fav |= mask;
if (sortedFavorites == FavoritesIndexMode.IndividuallySorted)
this.FavIndex[favIndex] = favValue;
mask <<= 1;
++favIndex;
}
return (Favorites) fav;
}
#endregion
#region InitDvbData()
protected void InitDvbData(DataMapping data, IDictionary<int, string> providerNames)
{
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);
if (data.Settings.GetInt(_ServiceProviderId, -1) != -1)
{
int source = -1;
if ((this.SignalSource & SignalSource.MaskProvider) == SignalSource.Freesat)
source = 4;
else if ((this.SignalSource & SignalSource.MaskProvider) == SignalSource.TivuSat)
source = 6;
else if ((this.SignalSource & SignalSource.Antenna) != 0)
source = 0;
else if ((this.SignalSource & SignalSource.Cable) != 0)
source = 1;
else if ((this.SignalSource & SignalSource.Sat) != 0)
source = 3;
int providerId = data.GetWord(_ServiceProviderId);
this.Provider = providerNames.TryGet((source << 16) + providerId);
}
this.SignalSource |= LookupData.Instance.IsRadioOrTv(this.ServiceType);
}
#endregion
#region UpdateRawData()
public override void UpdateRawData()
{
mapping.SetDataPtr(this.rawData, this.baseOffset);
mapping.SetFlag(_InUse, this.InUse);
if (this.NewProgramNr >= 0)
mapping.SetWord(_ProgramNr, this.NewProgramNr);
if (this.IsNameModified)
{
int bytes = mapping.SetString(_Name, this.Name, mapping.Settings.GetInt("lenName"));
mapping.SetByte(_NameLength, bytes);
this.IsNameModified = false;
}
this.UpdateRawFavorites();
mapping.SetFlag(_Lock, this.Lock);
mapping.SetFlag(_Deleted, this.NewProgramNr < 0);
mapping.SetFlag(_IsActive, this.NewProgramNr >= 0);
this.UpdateChecksum();
}
#endregion
#region EraseRawData()
internal virtual void EraseRawData()
{
int len = this.mapping.Settings.GetInt("offChecksum") + 1;
Tools.MemSet(this.rawData, this.baseOffset, 0, len);
}
#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);
return;
}
// series D,E,F
byte fav = (byte)this.Favorites;
byte mask = 0x01;
int favIndex = 0;
foreach (int off in offsets)
{
int favValue;
if (this.sortedFavorites == FavoritesIndexMode.Flag) // D series
favValue = (fav & mask) != 0 ? 1 : 0; // D series
else if (this.sortedFavorites == FavoritesIndexMode.IndividuallySorted) // E series (and some F models with early firmware)
favValue = (fav & mask) != 0 ? this.FavIndex[favIndex] : -1;
else
favValue = (fav & mask) != 0 ? this.NewProgramNr : -1; // F series (newer models/firmware), H series
Array.Copy(BitConverter.GetBytes(favValue), 0, this.rawData, baseOffset + off, 4);
mask <<= 1;
++favIndex;
}
}
#endregion
#region UpdateChecksum()
private void UpdateChecksum()
{
var offChecksum = this.baseOffset + 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

@@ -0,0 +1,723 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ChanSort.Api;
using ICSharpCode.SharpZipLib.Zip;
namespace ChanSort.Loader.Samsung
{
class ScmSerializer : SerializerBase
{
private readonly Dictionary<string, ModelConstants> modelConstants = new Dictionary<string, ModelConstants>();
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>("AstraHD+");
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 MappingPool<DataMapping> serviceProviderMappings = new MappingPool<DataMapping>("ServiceProvider");
private readonly ChannelList avbtChannels = new ChannelList(SignalSource.AnalogT|SignalSource.TvAndRadio, "Analog Air");
private readonly ChannelList avbcChannels = new ChannelList(SignalSource.AnalogC|SignalSource.TvAndRadio, "Analog Cable");
private readonly ChannelList avbxChannels = new ChannelList(SignalSource.AnalogCT | SignalSource.TvAndRadio, "Analog Air/Cable");
private readonly ChannelList dvbtChannels = new ChannelList(SignalSource.DvbT | SignalSource.Tv, "Digital Air");
private readonly ChannelList dvbcChannels = new ChannelList(SignalSource.DvbC | SignalSource.TvAndRadio, "Digital Cable");
private readonly ChannelList dvbxChannels = new ChannelList(SignalSource.DvbCT | SignalSource.TvAndRadio, "Digital Air/Cable");
private readonly ChannelList dvbsChannels = new ChannelList(SignalSource.DvbS | SignalSource.TvAndRadio, "Satellite");
private readonly ChannelList primeChannels = new ChannelList(SignalSource.CablePrimeD | SignalSource.TvAndRadio, "Cable Prime");
private readonly ChannelList hdplusChannels = new ChannelList(SignalSource.HdPlusD | SignalSource.TvAndRadio, "Astra HD+");
private readonly ChannelList freesatChannels = new ChannelList(SignalSource.FreesatD | SignalSource.TvAndRadio, "Freesat");
private readonly ChannelList tivusatChannels = new ChannelList(SignalSource.TivuSatD | SignalSource.TvAndRadio, "TivuSat");
private readonly ChannelList canalDigitalChannels = new ChannelList(SignalSource.CanalDigitalSatD | SignalSource.TvAndRadio, "Canal Digital Sat");
private readonly ChannelList digitalPlusChannels = new ChannelList(SignalSource.DigitalPlusD | SignalSource.TvAndRadio, "Canal+ Digital");
private readonly ChannelList cyfraPlusChannels = new ChannelList(SignalSource.CyfraPlusD | SignalSource.TvAndRadio, "Cyfra+ Digital");
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[] avbxFileContent;
private byte[] dvbtFileContent;
private byte[] dvbcFileContent;
private byte[] dvbxFileContent;
private byte[] dvbsFileContent;
private byte[] hdplusFileContent;
private byte[] primeFileContent;
private byte[] freesatFileContent;
private byte[] tivusatFileContent;
private byte[] canalDigitalFileContent;
private byte[] digitalPlusFileContent;
private byte[] cyfraPlusFileContent;
private ModelConstants c;
private Dictionary<int, string> serviceProviderNames;
#region ctor()
public ScmSerializer(string inputFile) : base(inputFile)
{
this.ReadConfigurationFromIniFile();
this.Features.ChannelNameEdit = true;
this.Features.CleanUpChannelData = true;
}
#endregion
#region DisplayName
public override string DisplayName { get { return "Samsung *.scm Loader"; } }
#endregion
#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 len=0;
if (idx >= 0)
int.TryParse(section.Name.Substring(idx + 1), out len);
if (section.Name.StartsWith("Series:"))
modelConstants.Add(section.Name, new ModelConstants(section));
else if (section.Name.StartsWith("Analog:"))
analogMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("DvbCT:"))
dvbctMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("DvbS:"))
dvbsMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("FineTune:"))
analogFineTuneMappings.AddMapping(len, new DataMapping(section));
else if (section.Name.StartsWith("AstraHDPlusD:"))
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));
else if (section.Name.StartsWith("ServiceProvider"))
serviceProviderMappings.AddMapping(len, new DataMapping(section));
}
}
#endregion
#region Load()
public override void Load()
{
if (AllBytesInFileAreZero())
return;
using (ZipFile zip = new ZipFile(this.FileName))
{
DetectModelConstants(zip);
DataRoot.SupportedFavorites = c.supportedFavorites;
DataRoot.SortedFavorites = c.SortedFavorites == FavoritesIndexMode.IndividuallySorted;
ReadAnalogFineTuning(zip);
ReadAnalogChannels(zip, "map-AirA", this.avbtChannels, out this.avbtFileContent, this.avbtFrequency);
ReadAnalogChannels(zip, "map-CableA", this.avbcChannels, out this.avbcFileContent, this.avbcFrequency);
ReadAnalogChannels(zip, "map-AirCableMixedA", this.avbxChannels, out this.avbxFileContent, this.avbcFrequency);
ReadDvbTransponderFrequenciesFromPtc(zip, "PTCAIR", this.dvbtFrequency);
ReadDvbServiceProviders(zip);
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);
ReadDvbctChannels(zip, "map-AirCableMixedD", this.dvbxChannels, out this.dvbxFileContent, this.dvbcFrequency);
ReadDvbctChannels(zip, "map-CablePrime_D", this.primeChannels, out this.primeFileContent, this.dvbcFrequency);
ReadDvbctChannels(zip, "map-FreesatD", this.freesatChannels, out this.freesatFileContent, this.dvbcFrequency);
ReadDvbctChannels(zip, "map-TivusatD", this.tivusatChannels, out this.tivusatFileContent, this.dvbcFrequency);
ReadDvbctChannels(zip, "map-CanalDigitalSatD", this.canalDigitalChannels, out this.canalDigitalFileContent, this.dvbcFrequency);
ReadDvbctChannels(zip, "map-DigitalPlusD", this.digitalPlusChannels, out this.digitalPlusFileContent, this.dvbcFrequency);
ReadSatellites(zip);
ReadTransponder(zip, "TransponderDataBase.dat");
ReadTransponder(zip, "UserTransponderDataBase.dat");
ReadDvbsChannels(zip, "map-SateD", this.dvbsChannels, out this.dvbsFileContent, c.dvbsChannelLength);
ReadDvbsChannels(zip, "map-CyfraPlusD", this.cyfraPlusChannels, out this.cyfraPlusFileContent, c.cyfraPlusChannelSize);
ReadAstraHdPlusChannels(zip);
}
}
#endregion
#region AllBytesInFileAreZero()
private bool AllBytesInFileAreZero()
{
byte[] content = File.ReadAllBytes(this.FileName);
foreach (var b in content)
{
if (b != 0)
return false;
}
throw new FileLoadException(Resource.ScmSerializer_AllBytesInFileAreZero);
}
#endregion
#region DetectModelConstants()
private void DetectModelConstants(ZipFile zip)
{
if (DetectModelFromFileName()) return;
if (DetectModelFromCloneInfoFile(zip)) return;
if (DetectModelFromContentFileLengths(zip)) return;
throw new FileLoadException("Unable to determine TV model from file content or name");
}
#endregion
#region DetectModelFromFileName()
private bool DetectModelFromFileName()
{
string file = Path.GetFileName(this.FileName)??"";
System.Text.RegularExpressions.Regex regex =
new System.Text.RegularExpressions.Regex("channel_list_([A-Z]{2}[0-9]{2}|BD-)([A-Z])[0-9A-Z]+_([0-9]{4}).*\\.scm");
var match = regex.Match(file);
if (match.Success)
{
string series;
switch (match.Groups[3].Value)
{
case "1001": series = "C"; break;
case "1101": series = "D"; break;
case "1201":
var letter = match.Groups[2].Value;
series = match.Groups[1].Value.StartsWith("LT") ? "F" : // LTxxCxxx is actually an F-series model
StringComparer.OrdinalIgnoreCase.Compare(letter, "E") < 0 ? "E" : // at least E sereis
letter; // E, F, H
break;
default:
return false;
}
if (this.modelConstants.TryGetValue("Series:" + series, out this.c))
return true;
}
return false;
}
#endregion
#region DetectModelFromCloneInfoFile()
private bool DetectModelFromCloneInfoFile(ZipFile zip)
{
byte[] cloneInfo = ReadFileContent(zip, "CloneInfo");
if (cloneInfo == null)
{
this.c = this.modelConstants["Series:B"];
return true;
}
if (cloneInfo.Length >= 9)
{
char series = (char) cloneInfo[8];
if (series == 'B') // 2013 B-series uses E/F-series format
series = 'F';
if (this.modelConstants.TryGetValue("Series:" + series, out this.c))
return true;
}
return false;
}
#endregion
#region DetectModelFromContentFileLengths()
private bool DetectModelFromContentFileLengths(ZipFile zip)
{
string[] candidates = {
DetectModelFromAirAOrCableA(zip),
DetectModelFromAirDOrCableD(zip),
DetectModelFromSateD(zip),
DetectModelFromTranspoderDatabase(zip),
DetectModelFromAstraHdPlusD(zip)
};
// note: E, F and B(2013) series use an identical format, so we only care about E here
string validCandidates = "BCDE";
foreach (var candidateList in candidates)
{
if (candidateList == null)
continue;
string newValidCandidats = "";
foreach (var candidate in candidateList)
{
if (validCandidates.Contains(candidate))
newValidCandidats += candidate;
}
validCandidates = newValidCandidats;
}
if (validCandidates.Length == 0)
return false;
this.modelConstants.TryGetValue("Series:" + validCandidates[0], out this.c);
return true;
}
#endregion
#region DetectModelFromAirAOrCableA()
private string DetectModelFromAirAOrCableA(ZipFile zip)
{
var entry = zip.GetEntry("map-AirA") ?? zip.GetEntry("map-CableA");
if (entry == null)
return null;
var candidates = "";
if (entry.Size % 28000 == 0)
candidates += "B";
if (entry.Size % 40000 == 0)
candidates += "C";
if (entry.Size % 64000 == 0)
candidates += "DE";
return candidates;
}
#endregion
#region DetectModelFromAirDOrCableD()
private string DetectModelFromAirDOrCableD(ZipFile zip)
{
var entry = zip.GetEntry("map-AirD") ?? zip.GetEntry("map-CableD") ?? zip.GetEntry("map-CablePrime_D") ?? zip.GetEntry("map-FreesatD")
?? zip.GetEntry("map-TivusatD") ?? zip.GetEntry("map-CanalDigitalSatD") ?? zip.GetEntry("map-DigitalPlusD");
if (entry == null)
return null;
var candidates = "";
if (entry.Size % 248 == 0)
candidates += "B";
if (entry.Size % 292 == 0)
candidates += "C";
if (entry.Size % 320 == 0)
candidates += "DE";
return candidates;
}
#endregion
#region DetectModelFromSateD()
private string DetectModelFromSateD(ZipFile zip)
{
var entry = zip.GetEntry("map-SateD");
if (entry == null)
return null;
var candidates = "";
if (entry.Size % 144 == 0)
candidates += "BC";
if (entry.Size % 172 == 0)
candidates += "D";
if (entry.Size % 168 == 0)
candidates += "E";
return candidates;
}
#endregion
#region DetectModelFromTranspoderDatabase()
private string DetectModelFromTranspoderDatabase(ZipFile zip)
{
var entry = zip.GetEntry("TransponderDatabase.dat");
if (entry == null)
return null;
var size = entry.Size - 4;
var candidates = "";
if (size%49 == 0)
candidates += "B";
if (size%45 == 0)
candidates += "CDE";
return candidates;
}
#endregion
#region DetectModelFromAstraHdPlusD()
private string DetectModelFromAstraHdPlusD(ZipFile zip)
{
var entry = zip.GetEntry("map-AstraHDPlusD");
if (entry == null)
return null;
var size = entry.Size;
string candidates = null;
if (size % 212 == 0)
candidates += "DE";
return candidates;
}
#endregion
#region ReadAnalogFineTuning()
private void ReadAnalogFineTuning(ZipFile zip)
{
int entrySize = c.avbtFineTuneLength;
if (entrySize == 0)
return;
byte[] data = ReadFileContent(zip, "FineTune");
if (data == null)
return;
var mapping = analogFineTuneMappings.GetMapping(c.avbtFineTuneLength);
mapping.SetDataPtr(data, 0);
int count = data.Length / c.avbtFineTuneLength;
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.BaseOffset += c.avbtFineTuneLength;
}
}
#endregion
#region ReadAnalogChannels()
private void ReadAnalogChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data, Dictionary<int,decimal> freq)
{
data = null;
int entrySize = c.avbtChannelLength;
if (entrySize == 0)
return;
data = ReadFileContent(zip, fileName);
if (data == null)
return;
this.DataRoot.AddChannelList(list);
var rawChannel = analogMappings.GetMapping(entrySize);
list.MaxChannelNameLength = rawChannel.Settings.GetInt("lenName")/2;
rawChannel.SetDataPtr(data, 0);
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
MapAnalogChannel(rawChannel, slotIndex, list, freq.TryGet(slotIndex));
rawChannel.BaseOffset += entrySize;
}
}
#endregion
#region MapAnalogChannel()
private void MapAnalogChannel(DataMapping rawChannel, int slotIndex, ChannelList list, decimal freq)
{
bool isCable = (list.SignalSource & SignalSource.Cable) != 0;
AnalogChannel ci = new AnalogChannel(slotIndex, isCable, rawChannel, freq, c.SortedFavorites);
if (!ci.InUse)
return;
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 ReadDvbServiceProviders()
private void ReadDvbServiceProviders(ZipFile zip)
{
this.serviceProviderNames = new Dictionary<int, string>();
var data = ReadFileContent(zip, "ServiceProviders");
if (data == null) return;
if (data.Length % c.serviceProviderLength != 0) return;
var mapping = serviceProviderMappings.GetMapping(c.serviceProviderLength, false);
if (mapping == null) return;
int count = data.Length/c.serviceProviderLength;
var enc = new UnicodeEncoding(true, false);
var offName = mapping.Settings.GetInt("offName");
for (int i = 0; i < count; i++)
{
mapping.SetDataPtr(data, i*c.serviceProviderLength);
int source = mapping.GetWord("offSignalSource");
int index = mapping.GetWord("offIndex");
int len = System.Math.Min(mapping.GetWord("offLenName"), c.serviceProviderLength - offName);
var name = len < 2 ? "" : enc.GetString(data, mapping.BaseOffset + offName, len);
this.serviceProviderNames[(source << 16) + index] = name;
}
}
#endregion
#region ReadDvbctChannels()
private void ReadDvbctChannels(ZipFile zip, string fileName, ChannelList list, out byte[] data, Dictionary<int, decimal> frequency)
{
data = null;
int entrySize = c.dvbtChannelLength;
if (entrySize == 0)
return;
data = ReadFileContent(zip, fileName);
if (data == null)
return;
this.DataRoot.AddChannelList(list);
var source = list.SignalSource;
DataMapping rawChannel = dvbctMappings.GetMapping(entrySize);
list.MaxChannelNameLength = rawChannel.Settings.GetInt("lenName") / 2;
rawChannel.SetDataPtr(data, 0);
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
DigitalChannel ci = new DigitalChannel(slotIndex, source, rawChannel, frequency, c.SortedFavorites, this.serviceProviderNames);
if (ci.InUse && !ci.IsDeleted && ci.OldProgramNr > 0)
this.DataRoot.AddChannel(list, ci);
rawChannel.BaseOffset += entrySize;
}
}
#endregion
#region ReadSatellites()
private void ReadSatellites(ZipFile zip)
{
byte[] data = ReadFileContent(zip, "SatDataBase.dat");
if (data == null || data.Length < 4)
return;
this.SatDatabaseVersion = System.BitConverter.ToInt32(data, 0);
SatelliteMapping satMapping = new SatelliteMapping(data, 4);
int count = data.Length/this.c.dvbsSatelliteLength;
for (int i = 0; i < count; i++)
{
if (satMapping.MagicMarker == 'U')
{
string location = string.Format("{0}.{1}{2}",
satMapping.Longitude / 10, satMapping.Longitude % 10, satMapping.IsEast ? "E" : "W");
Satellite satellite = new Satellite(satMapping.SatelliteNr);
satellite.Name = satMapping.Name;
satellite.OrbitalPosition = location;
this.DataRoot.Satellites.Add(satMapping.SatelliteNr, satellite);
}
else if (satMapping.MagicMarker != 'E')
throw new FileLoadException("Unknown SatDataBase.dat format");
satMapping.BaseOffset += this.c.dvbsSatelliteLength;
}
}
#endregion
#region ReadTransponder()
private void ReadTransponder(ZipFile zip, string fileName)
{
byte[] data = ReadFileContent(zip, fileName);
if (data == null)
return;
int count = (data.Length-4)/c.dvbsTransponderLength;
var mapping = this.transponderMappings.GetMapping(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)
{
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 void ReadDvbsChannels(ZipFile zip, string filename, ChannelList channels, out byte[] fileContent, int entrySize)
{
fileContent = ReadFileContent(zip, filename);
if (fileContent == null)
return;
this.DataRoot.AddChannelList(channels);
int count = fileContent.Length/entrySize;
DataMapping mapping = dvbsMappings.GetMapping(entrySize);
channels.MaxChannelNameLength = mapping.Settings.GetInt("lenName") / 2;
mapping.SetDataPtr(fileContent, 0);
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{
SatChannel ci = new SatChannel(slotIndex, channels.SignalSource, mapping, this.DataRoot, c.SortedFavorites, this.serviceProviderNames);
if (ci.InUse)
this.DataRoot.AddChannel(channels, ci);
mapping.BaseOffset += entrySize;
}
}
#endregion
#region ReadAstraHdPlusChannels()
private void ReadAstraHdPlusChannels(ZipFile zip)
{
this.hdplusFileContent = ReadFileContent(zip, "map-AstraHDPlusD");
if (hdplusFileContent == null || c.hdplusChannelLength == 0)
return;
this.DataRoot.AddChannelList(this.hdplusChannels);
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++)
{
SatChannel ci = new SatChannel(slotIndex, SignalSource.AstraHdPlus, mapping, this.DataRoot, c.SortedFavorites, this.serviceProviderNames);
if (ci.InUse)
this.DataRoot.AddChannel(this.hdplusChannels, ci);
mapping.BaseOffset += entrySize;
}
}
#endregion
#region ReadFileContent()
private static byte[] ReadFileContent(ZipFile zip, string fileName)
{
var entry = zip.GetEntry(fileName);
if (entry == null)
return null;
byte[] data = new byte[entry.Size];
using (var stream = zip.GetInputStream(entry))
{
stream.Read(data, 0, data.Length);
}
return data;
}
#endregion
#region Save()
public override void Save(string tvOutputFile)
{
if (tvOutputFile != this.FileName)
{
File.Copy(this.FileName, tvOutputFile, true);
this.FileName = tvOutputFile;
}
using (ZipFile zip = new ZipFile(tvOutputFile))
{
zip.BeginUpdate();
this.SaveChannels(zip, "map-AirA", this.avbtChannels, this.avbtFileContent);
this.SaveChannels(zip, "map-CableA", this.avbcChannels, this.avbcFileContent);
this.SaveChannels(zip, "map-AirCableMixedA", this.avbxChannels, this.avbxFileContent);
this.SaveChannels(zip, "map-AirD", this.dvbtChannels, this.dvbtFileContent);
this.SaveChannels(zip, "map-CableD", this.dvbcChannels, this.dvbcFileContent);
this.SaveChannels(zip, "map-AirCableMixedD", this.dvbxChannels, this.dvbxFileContent);
this.SaveChannels(zip, "map-SateD", this.dvbsChannels, this.dvbsFileContent);
this.SaveChannels(zip, "map-AstraHDPlusD", this.hdplusChannels, this.hdplusFileContent);
this.SaveChannels(zip, "map-CablePrime_D", this.primeChannels, this.primeFileContent);
this.SaveChannels(zip, "map-FreesatD", this.freesatChannels, this.freesatFileContent);
this.SaveChannels(zip, "map-TivusatD", this.tivusatChannels, this.tivusatFileContent);
this.SaveChannels(zip, "map-CanalDigitalSatD", this.canalDigitalChannels, this.canalDigitalFileContent);
this.SaveChannels(zip, "map-DigitalPlusD", this.digitalPlusChannels, this.digitalPlusFileContent);
this.SaveChannels(zip, "map-CyfraPlusD", this.cyfraPlusChannels, this.cyfraPlusFileContent);
zip.CommitUpdate();
}
}
#endregion
#region SaveChannels()
private void SaveChannels(ZipFile zip, string fileName, ChannelList channels, byte[] fileContent)
{
if (fileContent == null)
return;
zip.Delete(fileName);
string tempFilePath = Path.GetTempFileName();
using (var stream = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
this.WriteChannels(channels, fileContent, stream);
}
zip.Add(tempFilePath, fileName);
}
#endregion
#region WriteChannels()
private void WriteChannels(ChannelList list, byte[] fileContent, FileStream stream)
{
foreach (var channel in list.Channels)
{
channel.UpdateRawData();
channel.OldProgramNr = channel.NewProgramNr;
}
stream.Write(fileContent, 0, fileContent.Length);
}
#endregion
// -------- cleanup --------
#region CleanUpChannelData()
public override string CleanUpChannelData()
{
StringBuilder log = new StringBuilder();
RemoveChannelsWithServiceType0(log);
RemoveDuplicateAnalogList(log);
return log.ToString();
}
private void RemoveChannelsWithServiceType0(StringBuilder log)
{
foreach (var list in this.DataRoot.ChannelLists)
{
if ((list.SignalSource & SignalSource.Digital) == 0)
continue;
var listOfChannels = new List<ChannelInfo>(list.Channels);
foreach (var chan in listOfChannels)
{
ScmChannelBase channel = chan as ScmChannelBase;
if (channel == null) // ignore proxy channels (which only exist in loaded reference list)
continue;
if (channel.ServiceType == 0)
{
channel.EraseRawData();
list.Channels.Remove(channel);
log.AppendFormat("{0} channel at index {1} (Pr# {2} \"{3}\") was erased due to invalid service type 0\r\n",
list.ShortCaption, channel.RecordIndex, channel.OldProgramNr, channel.Name);
}
}
}
}
private void RemoveDuplicateAnalogList(StringBuilder log)
{
if (this.avbtChannels.Count == 0 || this.avbcChannels.Count == 0)
return;
// TODO
}
#endregion
// ------- testing -----------
internal string Series { get { return c.series; } }
internal int AnalogChannelLength { get { return c.avbtChannelLength; } }
internal int DigitalChannelLength { get { return c.dvbtChannelLength; } }
internal int SatChannelLength { get { return c.dvbsChannelLength; } }
internal int HdPlusChannelLength { get { return c.hdplusChannelLength; } }
internal int SatDatabaseVersion { get; private set; }
}
}

View File

@@ -0,0 +1,15 @@
using ChanSort.Api;
namespace ChanSort.Loader.Samsung
{
public class ScmSerializerPlugin : ISerializerPlugin
{
public string PluginName { get { return "Samsung *.scm"; } }
public string FileFilter { get { return "*.scm"; } }
public SerializerBase CreateSerializer(string inputFile)
{
return new ScmSerializer(inputFile);
}
}
}

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{33897002-0537-49A4-B963-A18D17311B3D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Loader.SamsungJ</RootNamespace>
<AssemblyName>ChanSort.Loader.SamsungJ</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<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>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</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>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\DLL\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\DLL\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DbChannel.cs" />
<Compile Include="DbSerializer.cs" />
<Compile Include="DbSerializerPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
<Project>{dccffa08-472b-4d17-bb90-8f513fc01392}</Project>
<Name>ChanSort.Api</Name>
</ProjectReference>
</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,89 @@
using System.Collections.Generic;
using System.Data.SQLite;
using ChanSort.Api;
namespace ChanSort.Loader.Toshiba
{
internal class DbChannel : ChannelInfo
{
internal Dictionary<int,int> OriginalFavIndex = new Dictionary<int, int>();
#region ctor()
internal DbChannel(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, Dictionary<long, string> providers)
{
var chType = r.GetInt32(field["chType"]);
if (chType == 7)
this.SignalSource = SignalSource.DvbS;
else if (chType == 4)
this.SignalSource = SignalSource.DvbC;
this.RecordIndex = r.GetInt64(field["SRV.srvId"]);
this.OldProgramNr = r.GetInt32(field["major"]);
this.FreqInMhz = (decimal)r.GetInt32(field["freq"]) / 1000;
this.ChannelOrTransponder =
(this.SignalSource & SignalSource.Cable) != 0 ? LookupData.Instance.GetDvbtTransponder(this.FreqInMhz).ToString() :
(this.SignalSource & SignalSource.Sat) != 0 ? LookupData.Instance.GetTransponderNumber((int)this.FreqInMhz).ToString() :
"";
this.Name = DbSerializer.ReadUtf16(r, 2);
this.Hidden = r.GetBoolean(field["hidden"]);
this.Encrypted = r.GetBoolean(field["scrambled"]);
this.Lock = r.GetBoolean(field["lockMode"]);
this.Skip = !r.GetBoolean(field["numSel"]);
//if (isAnalog)
// this.ReadAnalogData(r, field);
//else
this.ReadDvbData(r, field, dataRoot, providers);
}
#endregion
#region ReadAnalogData()
private void ReadAnalogData(SQLiteDataReader r, IDictionary<string, int> field)
{
this.Name = r.GetString(field["channel_label"]);
this.FreqInMhz = (decimal)r.GetInt32(field["frequency"]) / 1000000;
}
#endregion
#region ReadDvbData()
protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, Dictionary<long, string> providers)
{
this.ShortName = DbSerializer.ReadUtf16(r, 3);
this.RecordOrder = r.GetInt32(field["major"]);
int serviceType = r.GetInt32(field["srvType"]);
this.ServiceType = serviceType;
this.SignalSource |= LookupData.Instance.IsRadioOrTv(serviceType);
this.OriginalNetworkId = r.GetInt32(field["onid"]);
this.TransportStreamId = r.GetInt32(field["tsid"]);
this.ServiceId = r.GetInt32(field["progNum"]);
this.VideoPid = r.GetInt32(field["vidPid"]);
if (!r.IsDBNull(field["provId"]))
this.Provider = providers.TryGet(r.GetInt64(field["provId"]));
if ((this.SignalSource & SignalSource.Sat) != 0)
{
//int satId = r.GetInt32(field["sat_id"]);
//var sat = dataRoot.Satellites.TryGet(satId);
//if (sat != null)
//{
// this.Satellite = sat.Name;
// this.SatPosition = sat.OrbitalPosition;
// int tpId = satId * 1000000 + (int)this.FreqInMhz;
// var tp = dataRoot.Transponder.TryGet(tpId);
// if (tp != null)
// {
// this.SymbolRate = tp.SymbolRate;
// }
//}
}
//this.Encrypted = encryptionInfo.TryGet(this.Uid);
}
#endregion
#region UpdateRawData()
public override void UpdateRawData()
{
}
#endregion
}
}

View File

@@ -0,0 +1,469 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Text;
using System.Windows.Forms;
using ChanSort.Api;
using ICSharpCode.SharpZipLib.Zip;
namespace ChanSort.Loader.Toshiba
{
class DbSerializer : SerializerBase
{
private readonly Dictionary<long, DbChannel> channelById = new Dictionary<long, DbChannel>();
private readonly Dictionary<ChannelList, string> dbPathByChannelList = new Dictionary<ChannelList, string>();
private string tempDir;
private enum FileType { Unknown, SatDb, ChannelDb }
#region ctor()
public DbSerializer(string inputFile) : base(inputFile)
{
DepencencyChecker.AssertVc2010RedistPackageX86Installed();
this.Features.ChannelNameEdit = false;
this.DataRoot.SortedFavorites = true;
}
#endregion
#region DisplayName
public override string DisplayName { get { return "Samsung J-Series .zip Loader"; } }
#endregion
#region Load()
public override void Load()
{
this.UnzipDataFile();
foreach (var filePath in Directory.GetFiles(tempDir, "*."))
{
try
{
using (var conn = new SQLiteConnection("Data Source=" + filePath))
{
FileType type;
conn.Open();
using (var cmd = conn.CreateCommand())
{
this.RepairCorruptedDatabaseImage(cmd);
type = this.DetectFileType(cmd);
}
switch (type)
{
case FileType.SatDb:
//ReadSatDatabase(conn);
break;
case FileType.ChannelDb:
ReadChannelDatabase(conn, filePath);
break;
}
}
}
catch
{
}
}
}
#endregion
#region UnzipDataFile()
private void UnzipDataFile()
{
this.tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()) + "\\";
Directory.CreateDirectory(tempDir);
Application.ApplicationExit += this.CleanTempFolder;
using (ZipFile zip = new ZipFile(this.FileName))
{
foreach(ZipEntry entry in zip)
this.Expand(zip, entry.Name);
}
}
#endregion
#region CleanTempFolder()
private void CleanTempFolder(object sender, EventArgs e)
{
try
{
foreach(var file in Directory.GetFiles(this.tempDir))
File.Delete(file);
Directory.Delete(this.tempDir);
}
catch { }
}
#endregion
#region Expand()
private void Expand(ZipFile zip, string path)
{
var entry = zip.GetEntry(path);
if (entry == null)
throw new FileLoadException("File not found inside .zip: " + path);
byte[] buffer = new byte[65536];
using (var input = zip.GetInputStream(entry))
using (var output = new FileStream(this.tempDir + Path.GetFileName(path), FileMode.Create))
{
int len;
while ((len = input.Read(buffer, 0, buffer.Length)) != 0)
output.Write(buffer, 0, len);
}
}
#endregion
#region RepairCorruptedDatabaseImage()
private void RepairCorruptedDatabaseImage(SQLiteCommand cmd)
{
cmd.CommandText = "REINDEX";
cmd.ExecuteNonQuery();
}
#endregion
#region DetectFileType()
private FileType DetectFileType(SQLiteCommand cmd)
{
cmd.CommandText = "select count(1) from sqlite_master where type='table' and name in ('SAT','SAT_TP')";
if ((long)cmd.ExecuteScalar() == 2)
return FileType.SatDb;
cmd.CommandText = "select count(1) from sqlite_master where type='table' and name in ('CHNL','SRV','SRV_DVB')";
if ((long) cmd.ExecuteScalar() == 3)
return FileType.ChannelDb;
return FileType.Unknown;
}
#endregion
#region ReadSatDatabase()
private void ReadSatDatabase(SQLiteConnection conn)
{
using (var cmd = conn.CreateCommand())
{
this.RepairCorruptedDatabaseImage(cmd);
this.ReadSatellites(cmd);
this.ReadTransponders(cmd);
}
}
#endregion
#region ReadSatellites()
private void ReadSatellites(SQLiteCommand cmd)
{
cmd.CommandText = "select distinct satId, satName, satPos, satDir from SAT";
using (var r = cmd.ExecuteReader())
{
while (r.Read())
{
Satellite sat = new Satellite(r.GetInt32(0));
int pos = Math.Abs(r.GetInt32(2));
sat.OrbitalPosition = string.Format("{0}.{1}{2}", pos / 10, pos % 10, r.GetInt32(3) == 1 ? "E" : "W");
sat.Name = r.GetString(1) + " " + sat.OrbitalPosition;
this.DataRoot.AddSatellite(sat);
}
}
}
#endregion
#region ReadTransponders()
private void ReadTransponders(SQLiteCommand cmd)
{
cmd.CommandText = "select satId, tpFreq, tpPol, tpSr, tpId from SAT_TP";
using (var r = cmd.ExecuteReader())
{
while (r.Read())
{
int satId = r.GetInt32(0);
int freq = r.GetInt32(1);
int id = satId * 1000000 + freq / 1000;
if (this.DataRoot.Transponder.TryGet(id) != null)
continue;
Transponder tp = new Transponder(id);
tp.FrequencyInMhz = (decimal)freq / 1000;
tp.Number = r.GetInt32(4);
tp.Polarity = r.GetInt32(2) == 0 ? 'H' : 'V';
tp.Satellite = this.DataRoot.Satellites.TryGet(satId);
tp.SymbolRate = r.GetInt32(3) / 1000;
this.DataRoot.AddTransponder(tp.Satellite, tp);
}
}
}
#endregion
#region ReadChannelDatabase()
private void ReadChannelDatabase(SQLiteConnection conn, string dbPath)
{
this.channelById.Clear();
using (var cmd = conn.CreateCommand())
{
this.RepairCorruptedDatabaseImage(cmd);
var providers = this.ReadProviders(cmd);
//this.ReadAnalogChannels(cmd);
var channelList = this.ReadDtvChannels(cmd, dbPath, providers);
this.ReadFavorites(cmd);
this.dbPathByChannelList.Add(channelList, dbPath);
}
}
#endregion
#region ReadProviders()
private Dictionary<long, string> ReadProviders(SQLiteCommand cmd)
{
var dict = new Dictionary<long, string>();
try
{
cmd.CommandText = "select provId, cast(provName as blob) from PROV";
using (var r = cmd.ExecuteReader())
{
while (r.Read())
dict.Add(r.GetInt64(0), ReadUtf16(r, 1));
}
}
catch
{
}
return dict;
}
#endregion
#region ReadAnalogChannels()
private void ReadAnalogChannels(SQLiteCommand cmd)
{
//string[] fieldNames = {"channel_handle", "channel_number", "list_bits", "channel_label", "frequency"};
//var sql = this.GetQuery("EuroATVChanList", fieldNames);
//var fields = this.GetFieldMap(fieldNames);
//cmd.CommandText = sql;
//using (var r = cmd.ExecuteReader())
//{
// while (r.Read())
// {
// ChannelInfo channel = new DbChannel(SignalSource.Analog, r, fields, this.DataRoot);
// if (!channel.IsDeleted)
// this.DataRoot.AddChannel(this.atvChannels, channel);
// }
//}
}
#endregion
#region ReadDtvChannels()
private ChannelList ReadDtvChannels(SQLiteCommand cmd, string dbPath, Dictionary<long, string> providers)
{
string name = Path.GetFileName(dbPath);
ChannelList channelList = new ChannelList(SignalSource.Digital, name);
this.ReadDigitalChannels(cmd, "SRV_DVB", channelList, providers);
this.DataRoot.AddChannelList(channelList);
return channelList;
}
#endregion
#region ReadDigitalChannels()
private void ReadDigitalChannels(SQLiteCommand cmd, string table, ChannelList channelList, Dictionary<long, string> providers)
{
string[] fieldNames = { "SRV.srvId", "major", "cast(srvName as blob)", "cast(shrtSrvName as blob)", "chType", "chNum",
"srvType", "onid", "tsid", "vidPid", "progNum", "freq", "hidden", "scrambled", "lockMode", "numSel", "provId" };
var sql = this.GetQuery(table, fieldNames);
var fields = this.GetFieldMap(fieldNames);
cmd.CommandText = sql;
using (var r = cmd.ExecuteReader())
{
while (r.Read())
{
var channel = new DbChannel(r, fields, this.DataRoot, providers);
if (!channel.IsDeleted)
{
this.DataRoot.AddChannel(channelList, channel);
this.channelById.Add(channel.RecordIndex, channel);
}
}
}
}
#endregion
#region GetQuery()
private string GetQuery(string table, string[] fieldNames)
{
string sql = "select ";
for (int i = 0; i < fieldNames.Length; i++)
{
if (i > 0)
sql += ",";
sql += fieldNames[i];
}
sql += " from " + table + " inner join SRV on SRV.srvId="+table+".srvId inner join CHNL on CHNL.chId=SRV.chId";
return sql;
}
#endregion
#region GetFieldMap()
private IDictionary<string, int> GetFieldMap(string[] fieldNames)
{
Dictionary<string, int> field = new Dictionary<string, int>();
for (int i = 0; i < fieldNames.Length; i++)
field[fieldNames[i]] = i;
return field;
}
#endregion
#region ReadFavorites()
private void ReadFavorites(SQLiteCommand cmd)
{
cmd.CommandText = "select srvId, fav, pos from SRV_FAV";
var r = cmd.ExecuteReader();
while (r.Read())
{
var channel = this.channelById.TryGet(r.GetInt64(0));
if (channel == null)
continue;
int fav = r.GetInt32(1) - 1;
int pos = r.GetInt32(2);
channel.FavIndex[fav] = channel.OriginalFavIndex[fav] = pos;
if (pos >= 0)
channel.Favorites |= (Favorites) (1 << fav);
}
}
#endregion
#region ReadUtf16()
internal static string ReadUtf16(SQLiteDataReader r, int fieldIndex)
{
if (r.IsDBNull(fieldIndex))
return null;
byte[] nameBytes = new byte[200];
int nameLen = (int)r.GetBytes(fieldIndex, 0, nameBytes, 0, nameBytes.Length);
return Encoding.BigEndianUnicode.GetString(nameBytes, 0, nameLen);
}
#endregion
#region Save()
public override void Save(string tvOutputFile)
{
if (tvOutputFile != this.FileName)
{
File.Copy(this.FileName, tvOutputFile);
this.FileName = tvOutputFile;
}
using (var zip = new ZipFile(this.FileName))
{
zip.BeginUpdate();
foreach (var channelList in this.DataRoot.ChannelLists)
{
var dbPath = this.dbPathByChannelList[channelList];
SaveChannelList(channelList, dbPath);
var entryName = Path.GetFileName(dbPath);
zip.Delete(entryName);
zip.Add(dbPath, entryName);
}
zip.CommitUpdate();
}
}
#endregion
#region SaveChannelList()
private void SaveChannelList(ChannelList channelList, string dbPath)
{
using (var conn = new SQLiteConnection("Data Source=" + dbPath))
{
conn.Open();
using (var cmd = conn.CreateCommand())
using (var cmd2 = conn.CreateCommand())
using (var cmd3 = conn.CreateCommand())
using (var cmd4 = conn.CreateCommand())
{
using (var trans = conn.BeginTransaction())
{
this.PrepareCommands(cmd, cmd2, cmd3, cmd4);
this.WriteChannels(cmd, cmd2, cmd3, cmd4, channelList);
trans.Commit();
}
this.RepairCorruptedDatabaseImage(cmd);
}
}
}
#endregion
#region PrepareCommands()
private void PrepareCommands(SQLiteCommand cmd, SQLiteCommand cmd2, SQLiteCommand cmd3, SQLiteCommand cmd4)
{
cmd.CommandText = "update SRV set major=@nr, lockMode=@lock, hidden=@hidden, numSel=@numsel where srvId=@id";
cmd.Parameters.Add(new SQLiteParameter("@id", DbType.Int64));
cmd.Parameters.Add(new SQLiteParameter("@nr", DbType.Int32));
cmd.Parameters.Add(new SQLiteParameter("@lock", DbType.Boolean));
cmd.Parameters.Add(new SQLiteParameter("@hidden", DbType.Boolean));
cmd.Parameters.Add(new SQLiteParameter("@numsel", DbType.Boolean));
cmd.Prepare();
cmd2.CommandText = "insert into SRV_FAV (srvId, fav, pos) values (@id, @fav, @pos)";
cmd2.Parameters.Add(new SQLiteParameter("@id", DbType.Int64));
cmd2.Parameters.Add(new SQLiteParameter("@fav", DbType.Int32));
cmd2.Parameters.Add(new SQLiteParameter("@pos", DbType.Int32));
cmd2.Prepare();
cmd3.CommandText = "update SRV_FAV set pos=@pos where srvId=@id and fav=@fav";
cmd3.Parameters.Add(new SQLiteParameter("@id", DbType.Int64));
cmd3.Parameters.Add(new SQLiteParameter("@fav", DbType.Int32));
cmd3.Parameters.Add(new SQLiteParameter("@pos", DbType.Int32));
cmd3.Prepare();
cmd4.CommandText = "delete from SRV_FAV where srvId=@id and fav=@fav";
cmd4.Parameters.Add(new SQLiteParameter("@id", DbType.Int64));
cmd4.Parameters.Add(new SQLiteParameter("@fav", DbType.Int32));
cmd4.Prepare();
}
#endregion
#region WriteChannels()
private void WriteChannels(SQLiteCommand cmd, SQLiteCommand cmd2, SQLiteCommand cmd3, SQLiteCommand cmd4, ChannelList channelList, bool analog = false)
{
foreach (ChannelInfo channelInfo in channelList.Channels)
{
var channel = channelInfo as DbChannel;
if (channel == null) // ignore reference list proxy channels
continue;
channel.UpdateRawData();
cmd.Parameters["@id"].Value = channel.RecordIndex;
cmd.Parameters["@nr"].Value = channel.NewProgramNr;
cmd.Parameters["@lock"].Value = channel.Lock;
cmd.Parameters["@hidden"].Value = channel.Hidden;
cmd.Parameters["@numsel"].Value = !channel.Skip;
cmd.ExecuteNonQuery();
for (int i=0; i<channel.FavIndex.Count; i++)
{
int oldPos;
if (!channel.OriginalFavIndex.TryGetValue(i, out oldPos))
oldPos = -1;
int newPos = channel.FavIndex[i];
if (newPos == oldPos)
continue;
if (newPos > 0)
{
var c = oldPos < 0 ? cmd2 : cmd3;
c.Parameters["@id"].Value = channel.RecordIndex;
c.Parameters["@fav"].Value = i + 1;
c.Parameters["@pos"].Value = newPos;
c.ExecuteNonQuery();
}
else
{
cmd4.Parameters["@id"].Value = channel.RecordIndex;
cmd4.Parameters["@fav"].Value = i + 1;
cmd4.ExecuteNonQuery();
}
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,15 @@
using ChanSort.Api;
namespace ChanSort.Loader.Toshiba
{
public class DbSerializerPlugin : ISerializerPlugin
{
public string PluginName { get { return "Samsung J-Series"; } }
public string FileFilter { get { return "channel_list_t*.zip"; } }
public SerializerBase CreateSerializer(string inputFile)
{
return new DbSerializer(inputFile);
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("CahSort.Loader.SamsungJ")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CahSort.Loader.SamsungJ")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[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("2e9d8977-acba-492f-92d9-d070d4e43a87")]
// 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,94 @@
<?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>{F6F02792-07F1-48D5-9AF3-F945CA5E3931}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChanSort.Loader.Toshiba</RootNamespace>
<AssemblyName>ChanSort.Loader.Toshiba</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</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>..\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>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\DLL\System.Data.SQLite.dll</HintPath>
</Reference>
<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="DbChannel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DbSerializer.cs" />
<Compile Include="DbSerializerPlugin.cs" />
<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>
<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,145 @@
using System.Collections.Generic;
using System.Data.SQLite;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.Toshiba
{
internal class DbChannel : ChannelInfo
{
private const int BITS_Tv = 0x10000;
private const int BITS_Radio = 0x20000;
private const int BITS_FavA = 0x100000;
private const int BITS_FavB = 0x200000;
private const int BITS_FavC = 0x400000;
private const int BITS_FavD = 0x800000;
private const int BITS_Locked = 0x20000000;
internal int Bits;
#region ctor()
internal DbChannel(SignalSource source, SQLiteDataReader r, IDictionary<string, int> field,
DataRoot dataRoot, IDictionary<string,bool> encryptionInfo)
{
this.SignalSource = source;
this.RecordIndex = r.GetInt32(field["channel_handle"]);
this.Bits = r.GetInt32(field["list_bits"]);
bool isTv = (Bits & BITS_Tv) != 0;
bool isRadio = (Bits & BITS_Radio) != 0;
bool isAnalog = (source & SignalSource.Analog) != 0;
if (isAnalog && !isTv)
{
this.IsDeleted = true;
return;
}
if (isTv) this.SignalSource |= SignalSource.Tv;
if (isRadio) this.SignalSource |= SignalSource.Radio;
this.Lock = (Bits & BITS_Locked) != 0;
this.OldProgramNr = r.GetInt32(field["channel_number"]);
this.Favorites = this.ParseFavorites(Bits);
if (isAnalog)
this.ReadAnalogData(r, field);
else
this.ReadDvbData(r, field, dataRoot, encryptionInfo);
}
#endregion
#region ReadAnalogData()
private void ReadAnalogData(SQLiteDataReader r, IDictionary<string, int> field)
{
this.Name = r.GetString(field["channel_label"]);
this.FreqInMhz = (decimal)r.GetInt32(field["frequency"]) / 1000000;
}
#endregion
#region ReadDvbData()
protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot,
IDictionary<string, bool> encryptionInfo)
{
string longName, shortName;
this.GetChannelNames(r.GetString(field["channel_label"]), out longName, out shortName);
this.Name = longName;
this.ShortName = shortName;
this.RecordOrder = r.GetInt32(field["channel_order"]);
this.FreqInMhz = (decimal)r.GetInt32(field["frequency"]) / 1000;
int serviceType = r.GetInt32(field["dvb_service_type"]);
this.ServiceType = serviceType;
this.OriginalNetworkId = r.GetInt32(field["onid"]);
this.TransportStreamId = r.GetInt32(field["tsid"]);
this.ServiceId = r.GetInt32(field["sid"]);
int bits = r.GetInt32(field["list_bits"]);
this.Favorites = this.ParseFavorites(bits);
if ((this.SignalSource & SignalSource.Sat) != 0)
{
int satId = r.GetInt32(field["sat_id"]);
var sat = dataRoot.Satellites.TryGet(satId);
if (sat != null)
{
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
int tpId = satId * 1000000 + (int)this.FreqInMhz;
var tp = dataRoot.Transponder.TryGet(tpId);
if (tp != null)
{
this.SymbolRate = tp.SymbolRate;
}
}
}
this.Encrypted = encryptionInfo.TryGet(this.Uid);
}
#endregion
#region GetChannelNames()
private void GetChannelNames(string name, out string longName, out string shortName)
{
StringBuilder sbLong = new StringBuilder();
StringBuilder sbShort = new StringBuilder();
bool inShort = false;
foreach (char c in name)
{
if (c == 0x86)
inShort = true;
else if (c == 0x87)
inShort = false;
if (c >= 0x80 && c <= 0x9F)
continue;
if (inShort)
sbShort.Append(c);
sbLong.Append(c);
}
longName = sbLong.ToString();
shortName = sbShort.ToString();
}
#endregion
#region ParseFavorites()
private Favorites ParseFavorites(int bits)
{
Favorites fav = 0;
if ((bits & BITS_FavA) != 0) fav |= Favorites.A;
if ((bits & BITS_FavB) != 0) fav |= Favorites.B;
if ((bits & BITS_FavC) != 0) fav |= Favorites.C;
if ((bits & BITS_FavD) != 0) fav |= Favorites.D;
return fav;
}
#endregion
#region UpdateRawData()
public override void UpdateRawData()
{
Bits &= ~(BITS_FavA | BITS_FavB | BITS_FavC | BITS_FavC | BITS_FavD | BITS_Locked);
if ((this.Favorites & Favorites.A) != 0) Bits |= BITS_FavA;
if ((this.Favorites & Favorites.B) != 0) Bits |= BITS_FavB;
if ((this.Favorites & Favorites.C) != 0) Bits |= BITS_FavC;
if ((this.Favorites & Favorites.D) != 0) Bits |= BITS_FavD;
if (this.Lock) Bits |= BITS_Locked;
}
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More