mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-23 07:42:05 +01:00
- added code to read Toshiba channel list (*.db)
- code cleanup
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
|
||||
@@ -421,5 +421,6 @@ SERVICETYPE;Number;Description
|
||||
SERVICETYPE;01;SD-TV
|
||||
SERVICETYPE;02;Radio
|
||||
SERVICETYPE;12;Data/Test
|
||||
SERVICETYPE;22;SD-TV
|
||||
SERVICETYPE;25;HD-TV
|
||||
SERVICETYPE;211;Option
|
||||
SERVICETYPE;211;Option
|
||||
|
@@ -99,7 +99,8 @@ namespace ChanSort.Api
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.NewProgramNr + ": " + this.Name;
|
||||
string nr = this.NewProgramNr != -1 ? this.NewProgramNr.ToString() : "@" + this.RecordIndex;
|
||||
return nr + ": " + this.Name;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -193,10 +194,10 @@ namespace ChanSort.Api
|
||||
this.Debug += " " + val.ToString("x4");
|
||||
}
|
||||
|
||||
public unsafe void AddDebug(byte* ptr, int len)
|
||||
public void AddDebug(byte[] data, int offset, int len)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
this.AddDebug(ptr[i]);
|
||||
this.AddDebug(data[offset + i]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -54,6 +54,11 @@ namespace ChanSort.Api
|
||||
#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);
|
||||
|
||||
@@ -52,13 +52,4 @@ namespace ChanSort.Api
|
||||
AppendAlphabetically=1,
|
||||
MarkDeleted=2
|
||||
}
|
||||
|
||||
public enum DvbServiceType
|
||||
{
|
||||
SdTv = 1,
|
||||
Radio = 2,
|
||||
Data = 12,
|
||||
HdTv = 25,
|
||||
Option = 211
|
||||
};
|
||||
}
|
||||
|
||||
@@ -187,5 +187,30 @@ namespace ChanSort.Api
|
||||
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
|
||||
return SignalSource.Tv;
|
||||
case 0x02:
|
||||
case 0x0A:
|
||||
return SignalSource.Radio;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetDvbtChannel()
|
||||
public object GetDvbtChannel(decimal freq)
|
||||
{
|
||||
return ((int) (freq - 106)/8);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#endregion
|
||||
|
||||
#region Crack()
|
||||
#if false
|
||||
public static unsafe int Crack(byte* block, int maxLen, uint checksum)
|
||||
{
|
||||
uint crc32 = CrcMask;
|
||||
@@ -55,6 +56,7 @@
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,18 +136,15 @@ namespace ChanSort.Api
|
||||
break;
|
||||
|
||||
char ch = '\0';
|
||||
if (singleByteChar)
|
||||
switch (b)
|
||||
{
|
||||
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;
|
||||
}
|
||||
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')
|
||||
{
|
||||
@@ -217,5 +214,24 @@ namespace ChanSort.Api
|
||||
return new byte[0];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetEncoding()
|
||||
/// <summary>
|
||||
/// Pass in either a value <=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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,18 +12,6 @@ namespace ChanSort.Api
|
||||
return val;
|
||||
}
|
||||
|
||||
public static unsafe string GetString(this Encoding encoding, byte* str, int len)
|
||||
{
|
||||
byte[] copy = new byte[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
copy[i] = *str++;
|
||||
string name = encoding.GetString(copy, 0, len);
|
||||
int idx = name.IndexOf('\0');
|
||||
if (idx >= 0)
|
||||
name = name.Substring(0, idx);
|
||||
return name;
|
||||
}
|
||||
|
||||
public static string GetAnalogChannelNumber(int freq)
|
||||
{
|
||||
if (freq < 41) return "";
|
||||
|
||||
91
ChanSort.Loader.Panasonic/ChanSort.Loader.Panasonic.csproj
Normal file
91
ChanSort.Loader.Panasonic/ChanSort.Loader.Panasonic.csproj
Normal 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>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\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>
|
||||
156
ChanSort.Loader.Panasonic/DbChannel.cs
Normal file
156
ChanSort.Loader.Panasonic/DbChannel.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
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;
|
||||
|
||||
#region ctor()
|
||||
internal DbChannel(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot)
|
||||
{
|
||||
this.RecordIndex = r.GetInt32(field["rowid"]);
|
||||
this.RecordOrder = r.GetInt32(field["major_channel"]);
|
||||
int ntype = r.GetInt32(field["ntype"]);
|
||||
if (ntype == 1)
|
||||
this.SignalSource |= SignalSource.DvbS;
|
||||
else if (ntype == 2)
|
||||
this.SignalSource |= SignalSource.DvbT;
|
||||
else if (ntype == 3)
|
||||
this.SignalSource |= SignalSource.DvbC;
|
||||
else if (ntype == 10)
|
||||
this.SignalSource |= SignalSource.AnalogC | SignalSource.Tv;
|
||||
|
||||
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);
|
||||
|
||||
if (ntype == 10)
|
||||
this.ReadAnalogData(r, field);
|
||||
else
|
||||
this.ReadDvbData(r, field, dataRoot, buffer);
|
||||
|
||||
var list = dataRoot.GetChannelList(this.SignalSource);
|
||||
if (list != null)
|
||||
this.OldProgramNr = ntype == 10 ? list.Count : list.Count + 1;
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void ReadAnalogData(SQLiteDataReader r, IDictionary<string, int> field)
|
||||
{
|
||||
this.Name = r.GetString(field["sname"]);
|
||||
this.FreqInMhz = r.IsDBNull(field["freq"]) ? 0 : (decimal)r.GetInt32(field["freq"]) / 1000;
|
||||
this.ChannelOrTransponder = Tools.GetAnalogChannelNumber((int)this.FreqInMhz);
|
||||
}
|
||||
|
||||
#region ReadDvbData()
|
||||
protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, byte[] delivery)
|
||||
{
|
||||
string longName, shortName;
|
||||
this.GetChannelNames(r.GetString(field["sname"]), out longName, out shortName);
|
||||
this.Name = longName;
|
||||
this.ShortName = shortName;
|
||||
|
||||
int stype = r.GetInt32(field["stype"]);
|
||||
if (stype == 1 || stype == 22 || stype == 25)
|
||||
this.SignalSource |= SignalSource.Tv;
|
||||
else if (stype == 2)
|
||||
this.SignalSource |= SignalSource.Radio;
|
||||
this.ServiceType = stype;
|
||||
|
||||
int freq = r.GetInt32(field["freq"]);
|
||||
if ((this.SignalSource & SignalSource.Sat) != 0)
|
||||
{
|
||||
this.FreqInMhz = freq/10;
|
||||
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.GetDvbtChannel(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 GetChannelNames()
|
||||
private void GetChannelNames(string name, out string longName, out string shortName)
|
||||
{
|
||||
StringBuilder sbLong = new StringBuilder();
|
||||
StringBuilder sbShort = new StringBuilder();
|
||||
|
||||
#if false
|
||||
//Encoding encoding = Encoding.Default;
|
||||
if (name.Length > 0 && name[0] < 0x20)
|
||||
{
|
||||
if (name.Length >= 3 && name[0] == 0x10)
|
||||
encoding = DvbStringDecoder.GetEncoding(name[0]);
|
||||
}
|
||||
#endif
|
||||
bool inShort = false;
|
||||
foreach (char c in name)
|
||||
{
|
||||
if (c < 0x20)
|
||||
continue;
|
||||
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 UpdateRawData()
|
||||
public override void UpdateRawData()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
36
ChanSort.Loader.Panasonic/Properties/AssemblyInfo.cs
Normal file
36
ChanSort.Loader.Panasonic/Properties/AssemblyInfo.cs
Normal 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")]
|
||||
154
ChanSort.Loader.Panasonic/Serializer.cs
Normal file
154
ChanSort.Loader.Panasonic/Serializer.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SQLite;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using ChanSort.Api;
|
||||
|
||||
namespace ChanSort.Loader.Panasonic
|
||||
{
|
||||
class Serializer : SerializerBase
|
||||
{
|
||||
private readonly ChannelList atvChannels = new ChannelList(SignalSource.AnalogCT | SignalSource.Tv, "Analog");
|
||||
private readonly ChannelList dtvTvChannels = new ChannelList(SignalSource.DvbCT | SignalSource.DvbS | SignalSource.Tv, "DTV");
|
||||
private readonly ChannelList dtvRadioChannels = new ChannelList(SignalSource.DvbCT | SignalSource.DvbS | SignalSource.Radio, "Radio");
|
||||
|
||||
private string tempFile;
|
||||
|
||||
public Serializer(string inputFile) : base(inputFile)
|
||||
{
|
||||
this.DataRoot.AddChannelList(this.atvChannels);
|
||||
this.DataRoot.AddChannelList(this.dtvTvChannels);
|
||||
this.DataRoot.AddChannelList(this.dtvRadioChannels);
|
||||
}
|
||||
|
||||
public override string DisplayName { get { return "Panasonic .db Loader"; } }
|
||||
|
||||
#region Load()
|
||||
public override void Load()
|
||||
{
|
||||
this.tempFile = Path.GetTempFileName();
|
||||
Application.ApplicationExit += CleanTempFile;
|
||||
this.CypherFile(this.FileName, this.tempFile);
|
||||
|
||||
this.CreateDummySatellites();
|
||||
|
||||
string channelConnString = "Data Source=" + this.tempFile;
|
||||
using (var conn = new SQLiteConnection(channelConnString))
|
||||
{
|
||||
conn.Open();
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
this.ReadChannels(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CypherFile()
|
||||
/// <summary>
|
||||
/// XOR-based cypher which can be used to alternately crypt/decrypt data
|
||||
/// </summary>
|
||||
private void CypherFile(string input, string output)
|
||||
{
|
||||
byte[] fileContent = File.ReadAllBytes(input);
|
||||
int chiffre = 0x0388;
|
||||
int step = 0;
|
||||
for (int i = 0; i < fileContent.Length /*- 41*/; i++)
|
||||
{
|
||||
byte b = fileContent[i];
|
||||
fileContent[i] = (byte)(b ^ (chiffre >> 8));
|
||||
if (++step < 256)
|
||||
chiffre += b + 0x96A3;
|
||||
else
|
||||
{
|
||||
chiffre = 0x0388;
|
||||
step = 0;
|
||||
}
|
||||
}
|
||||
File.WriteAllBytes(output, fileContent);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CleanTempFile()
|
||||
private void CleanTempFile(object sender, EventArgs e)
|
||||
{
|
||||
try { File.Delete(this.tempFile);}
|
||||
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 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", "delivery" };
|
||||
|
||||
const string sql = "select s.rowid,s.major_channel,s.physical_ch,s.sname,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,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);
|
||||
if (!channel.IsDeleted)
|
||||
{
|
||||
var channelList = this.DataRoot.GetChannelList(channel.SignalSource);
|
||||
if (channelList != null)
|
||||
this.DataRoot.AddChannel(channelList, 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;
|
||||
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
|
||||
|
||||
|
||||
public override void Save(string tvOutputFile)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
15
ChanSort.Loader.Panasonic/SerializerPlugin.cs
Normal file
15
ChanSort.Loader.Panasonic/SerializerPlugin.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using ChanSort.Api;
|
||||
|
||||
namespace ChanSort.Loader.Panasonic
|
||||
{
|
||||
public class SerializerPlugin : ISerializerPlugin
|
||||
{
|
||||
public string PluginName { get { return "Panasonic *.db"; } }
|
||||
public string FileFilter { get { return "*.db"; } }
|
||||
|
||||
public SerializerBase CreateSerializer(string inputFile)
|
||||
{
|
||||
return new Serializer(inputFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace ChanSort.Loader.ScmFile
|
||||
if (freq == 0)
|
||||
freq = transp*8 + 106;
|
||||
|
||||
this.ChannelOrTransponder = ((int)(freq-106)/8).ToString();
|
||||
this.ChannelOrTransponder = LookupData.Instance.GetDvbtChannel(freq).ToString();
|
||||
this.FreqInMhz = freq;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,10 +96,7 @@ namespace ChanSort.Loader.ScmFile
|
||||
this.ServiceType = data.GetByte(_ServiceType);
|
||||
this.SymbolRate = data.GetWord(_SymbolRate);
|
||||
|
||||
if (this.ServiceType == (int)DvbServiceType.Radio)
|
||||
this.SignalSource |= SignalSource.Radio;
|
||||
else
|
||||
this.SignalSource |= SignalSource.Tv;
|
||||
this.SignalSource |= LookupData.Instance.IsRadioOrTv(this.ServiceType);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.ScmFile", "
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.DbFile", "ChanSort.Loader.DbFile\ChanSort.Loader.DbFile.csproj", "{F6F02792-07F1-48D5-9AF3-F945CA5E3931}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.Panasonic", "ChanSort.Loader.Panasonic\ChanSort.Loader.Panasonic.csproj", "{68DA8072-3A29-4076-9F64-D66F38349585}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = ChanSort1.vsmdi
|
||||
@@ -76,6 +78,13 @@ Global
|
||||
{F6F02792-07F1-48D5-9AF3-F945CA5E3931}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6F02792-07F1-48D5-9AF3-F945CA5E3931}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F6F02792-07F1-48D5-9AF3-F945CA5E3931}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Debug|x86.Build.0 = Debug|x86
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{68DA8072-3A29-4076-9F64-D66F38349585}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
26
ChanSort/MainForm.Designer.cs
generated
26
ChanSort/MainForm.Designer.cs
generated
@@ -36,6 +36,7 @@
|
||||
this.dsChannels = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.gviewLeft = new DevExpress.XtraGrid.Views.Grid.GridView();
|
||||
this.colIndex1 = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
this.colOutServiceType = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
this.colOutSlot = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
this.colOutName = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
this.colOutFav = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
@@ -153,7 +154,7 @@
|
||||
this.tabChannelList = new DevExpress.XtraTab.XtraTabControl();
|
||||
this.pageEmpty = new DevExpress.XtraTab.XtraTabPage();
|
||||
this.mnuContext = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.colOutServiceType = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
this.colSignalSource = new DevExpress.XtraGrid.Columns.GridColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit();
|
||||
this.splitContainerControl1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.grpOutputList)).BeginInit();
|
||||
@@ -194,7 +195,7 @@
|
||||
resources.ApplyResources(this.splitContainerControl1.Panel1, "splitContainerControl1.Panel1");
|
||||
this.splitContainerControl1.Panel2.Controls.Add(this.grpInputList);
|
||||
resources.ApplyResources(this.splitContainerControl1.Panel2, "splitContainerControl1.Panel2");
|
||||
this.splitContainerControl1.SplitterPosition = 343;
|
||||
this.splitContainerControl1.SplitterPosition = 386;
|
||||
//
|
||||
// grpOutputList
|
||||
//
|
||||
@@ -265,6 +266,13 @@
|
||||
this.colIndex1.FieldName = "RecordIndex";
|
||||
this.colIndex1.Name = "colIndex1";
|
||||
//
|
||||
// colOutServiceType
|
||||
//
|
||||
resources.ApplyResources(this.colOutServiceType, "colOutServiceType");
|
||||
this.colOutServiceType.FieldName = "ServiceTypeName";
|
||||
this.colOutServiceType.Name = "colOutServiceType";
|
||||
this.colOutServiceType.OptionsColumn.AllowEdit = false;
|
||||
//
|
||||
// colOutSlot
|
||||
//
|
||||
resources.ApplyResources(this.colOutSlot, "colOutSlot");
|
||||
@@ -477,7 +485,8 @@
|
||||
this.colNetworkName,
|
||||
this.colNetworkOperator,
|
||||
this.colDebug,
|
||||
this.colLogicalIndex});
|
||||
this.colLogicalIndex,
|
||||
this.colSignalSource});
|
||||
this.gviewRight.GridControl = this.gridRight;
|
||||
this.gviewRight.Name = "gviewRight";
|
||||
this.gviewRight.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown;
|
||||
@@ -1394,12 +1403,12 @@
|
||||
this.mnuContext.Manager = this.barManager1;
|
||||
this.mnuContext.Name = "mnuContext";
|
||||
//
|
||||
// colOutServiceType
|
||||
// colSignalSource
|
||||
//
|
||||
resources.ApplyResources(this.colOutServiceType, "colOutServiceType");
|
||||
this.colOutServiceType.FieldName = "ServiceTypeName";
|
||||
this.colOutServiceType.Name = "colOutServiceType";
|
||||
this.colOutServiceType.OptionsColumn.AllowEdit = false;
|
||||
resources.ApplyResources(this.colSignalSource, "colSignalSource");
|
||||
this.colSignalSource.FieldName = "SignalSource";
|
||||
this.colSignalSource.Name = "colSignalSource";
|
||||
this.colSignalSource.OptionsColumn.AllowEdit = false;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -1577,6 +1586,7 @@
|
||||
private DevExpress.XtraEditors.SimpleButton btnToggleFavA;
|
||||
private DevExpress.XtraGrid.Columns.GridColumn colOutLock;
|
||||
private DevExpress.XtraGrid.Columns.GridColumn colOutServiceType;
|
||||
private DevExpress.XtraGrid.Columns.GridColumn colSignalSource;
|
||||
private DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
<value>35</value>
|
||||
</data>
|
||||
<data name="gridLeft.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>339, 417</value>
|
||||
<value>382, 417</value>
|
||||
</data>
|
||||
<data name="gridLeft.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@@ -872,6 +872,12 @@
|
||||
<data name=">>colIndex1.Type" xml:space="preserve">
|
||||
<value>DevExpress.XtraGrid.Columns.GridColumn, DevExpress.XtraGrid.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name=">>colOutServiceType.Name" xml:space="preserve">
|
||||
<value>colOutServiceType</value>
|
||||
</data>
|
||||
<data name=">>colOutServiceType.Type" xml:space="preserve">
|
||||
<value>DevExpress.XtraGrid.Columns.GridColumn, DevExpress.XtraGrid.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name=">>colOutSlot.Name" xml:space="preserve">
|
||||
<value>colOutSlot</value>
|
||||
</data>
|
||||
@@ -1358,10 +1364,10 @@
|
||||
<data name=">>mnuContext.Type" xml:space="preserve">
|
||||
<value>DevExpress.XtraBars.PopupMenu, DevExpress.XtraBars.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name=">>colOutServiceType.Name" xml:space="preserve">
|
||||
<value>colOutServiceType</value>
|
||||
<data name=">>colSignalSource.Name" xml:space="preserve">
|
||||
<value>colSignalSource</value>
|
||||
</data>
|
||||
<data name=">>colOutServiceType.Type" xml:space="preserve">
|
||||
<data name=">>colSignalSource.Type" xml:space="preserve">
|
||||
<value>DevExpress.XtraGrid.Columns.GridColumn, DevExpress.XtraGrid.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
@@ -1371,7 +1377,7 @@
|
||||
<value>DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name="SharedImageCollection.Timestamp" type="System.DateTime, mscorlib">
|
||||
<value>04/08/2013 10:45:01</value>
|
||||
<value>04/11/2013 21:59:42</value>
|
||||
</data>
|
||||
<data name="SharedImageCollection.ImageSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>16, 16</value>
|
||||
@@ -1659,7 +1665,7 @@
|
||||
<value>2, 21</value>
|
||||
</data>
|
||||
<data name="pnlEditControls.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>339, 33</value>
|
||||
<value>382, 33</value>
|
||||
</data>
|
||||
<data name="pnlEditControls.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -1683,7 +1689,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="grpOutputList.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>343, 490</value>
|
||||
<value>386, 490</value>
|
||||
</data>
|
||||
<data name="grpOutputList.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -2009,8 +2015,11 @@
|
||||
<data name="colLogicalIndex.Caption" xml:space="preserve">
|
||||
<value>Order</value>
|
||||
</data>
|
||||
<data name="colSignalSource.Caption" xml:space="preserve">
|
||||
<value>Signal source</value>
|
||||
</data>
|
||||
<data name="gridRight.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1122, 417</value>
|
||||
<value>1079, 417</value>
|
||||
</data>
|
||||
<data name="gridRight.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@@ -2148,7 +2157,7 @@
|
||||
<value>2, 21</value>
|
||||
</data>
|
||||
<data name="panelControl3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1122, 33</value>
|
||||
<value>1079, 33</value>
|
||||
</data>
|
||||
<data name="panelControl3.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -2172,7 +2181,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="grpInputList.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1126, 490</value>
|
||||
<value>1083, 490</value>
|
||||
</data>
|
||||
<data name="grpInputList.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
|
||||
Reference in New Issue
Block a user