- cleanup (renamed directories to match project structure)

- tested and fixed Samsung favorites and locks for C,D,AstraHD
This commit is contained in:
hbeham
2013-04-03 15:01:53 +02:00
parent c0e0268fdf
commit 8d22767ec2
100 changed files with 23 additions and 3233 deletions

View File

@@ -0,0 +1,35 @@
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("Test.Plugin.TllFile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test.Plugin.TllFile")]
[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("d07e10d4-86d9-47c5-adee-b03032f1213d")]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,92 @@
<?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>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{68CFCB2F-B52A-43A1-AA5C-5D64A1D655D2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Test.Loader.TllFile</RootNamespace>
<AssemblyName>Test.Loader.TllFile</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<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>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<AllowUnsafeBlocks>true</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>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnitTest1.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
<Project>{DCCFFA08-472B-4D17-BB90-8F513FC01392}</Project>
<Name>ChanSort.Api</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\ChanSort.Loader.TllFile\ChanSort.Loader.TllFile.csproj">
<Project>{E972D8A1-2F5F-421C-AC91-CFF45E5191BE}</Project>
<Name>ChanSort.Loader.TllFile</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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,197 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using ChanSort.Loader.TllFile;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Test.Loader.TllFile
{
[TestClass]
public class UnitTest1
{
#region class ExpectedData
public class ExpectedData
{
public readonly string File;
public readonly int AnalogChannels;
public readonly int DtvChannels;
public readonly int SatChannels;
public readonly int DtvRadio;
public readonly int SatRadio;
public ExpectedData(string file, int analog, int dtv, int sat, int dtvRadio, int satRadio)
{
this.File = file;
this.AnalogChannels = analog;
this.DtvChannels = dtv;
this.SatChannels = sat;
this.DtvRadio = dtvRadio;
this.SatRadio = satRadio;
}
}
#endregion
private readonly Dictionary<string, ExpectedData> expectedData = new Dictionary<string, ExpectedData>();
#region ctor()
public UnitTest1()
{
var expected = new [] {
new ExpectedData(@"opel\xx2350D-PZM00001.TLL", 31, 345, 0, 89, 0), // 164/-
new ExpectedData(@"defycgn\xxLH4010-ZD99970.TLL", 34, 280, 0, 129, 0), // 164/-
new ExpectedData(@"karlv\xxLD750-ZA00001.TLL", 30, 248, 0, 104, 0), // 176/-
new ExpectedData(@"JLevi\xxLE5500-ZA00002.TLL", 36, 0, 0,0, 0), // 176/-
new ExpectedData(@"chlabnet\xxLK450-ZB00001.TLL", 34, 310, 0, 128, 0), // 176/-
new ExpectedData(@"Stabilo\xxLW4500-ZB00001.TLL", 31 ,338, 0, 34, 0), // 176/-
new ExpectedData(@"MarioAntonioLiptaj\xxPT353-ZA00001.TLL", 50, 123, 0, 13, 0), // 180/-
new ExpectedData(@"Muffix\xxLW5500-ZE00001.TLL", 34, 290, 0, 125, 0), // 184/-
new ExpectedData(@"FranzSteinert\xxCS460S-ZA00001.TLL", 0, 0, 1261, 0, 200), // ?/68
new ExpectedData(@"Klausi1\xxLK950S-ZA00001.TLL", 37, 390, 2695, 150, 491), // 184/68
new ExpectedData(@"MP3Chris2712\xxLV570S-ZB00001.TLL", 0, 12, 2895, 0, 669), // 184/68
new ExpectedData(@"decklen\xxLW570S-ZD00001.TLL", 0, 30, 1598, 0, 339), // 184/68
new ExpectedData(@"NeuerScan\xxLM340S-ZA00001.TLL", 34, 317, 1698, 129, 264), // 188/68
new ExpectedData(@"wagnale\xxLM611S-ZA00001.TLL", 0, 13, 1094, 0, 191), // 188/68
new ExpectedData(@"_Pred\xxLM620S-ZE00021.TLL", 0, 11, 1303, 0, 191) // 192/72
};
foreach (var entry in expected)
this.expectedData[entry.File] = entry;
}
#endregion
[TestMethod]
public void MetaTest()
{
}
#region TestLoadingAllTllFilesInTestFilesDirectory()
[TestMethod]
[DeploymentItem("ChanSort.Loader.TllFile\\ChanSort.Loader.TllFile.ini")]
public void TestLoadingAllTllFilesInTestFilesDirectory()
{
TllFileSerializerPlugin plugin = new TllFileSerializerPlugin();
StringBuilder errors = new StringBuilder();
var list = this.FindAllTllFiles();
var models = new Dictionary<string,string>();
var firmwareSize = new Dictionary<int, string>();
foreach(var file in list)
{
if (file.Contains("GlobalClone") || file.Contains("CountrySettings"))
continue;
Debug.Print("Testing " + file);
try
{
var serializer = plugin.CreateSerializer(file) as TllFileSerializer;
Assert.IsNotNull(serializer, "No Serializer for " + file);
serializer.Load();
var fileName = Path.GetFileName(file) ?? "";
int idx = fileName.IndexOf("-");
string key = idx < 0 ? fileName : fileName.Substring(0, idx);
var satChannelList = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.DvbS, ChanSort.Api.SignalType.Tv, false);
key += "\t" + serializer.ACTChannelLength+
"\t"+serializer.HasDvbs+
"\t"+serializer.SatChannelLength+
"\t" + (satChannelList == null ? "n/a" : satChannelList.Count.ToString());
string relPath = Path.GetFileName(Path.GetDirectoryName(file))+"\\"+fileName;
models[key] = relPath;
var model = this.GetModel(file);
if (firmwareSize.ContainsKey(serializer.FirmwareBlockSize))
{
string x = firmwareSize[serializer.FirmwareBlockSize];
if (!x.Contains(model))
firmwareSize[serializer.FirmwareBlockSize] = x + ", " + model;
}
else
firmwareSize[serializer.FirmwareBlockSize] = model;
Assert.IsFalse(serializer.DataRoot.IsEmpty, "No channels loaded from " + file);
ExpectedData exp;
key = Path.GetFileName(Path.GetDirectoryName(file)) + "\\" + Path.GetFileName(file);
this.expectedData.TryGetValue(key, out exp);
var analogTv = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.AnalogCT, ChanSort.Api.SignalType.Tv, false);
var dtvTv = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.DvbCT, ChanSort.Api.SignalType.Tv, false);
var satTv = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.DvbS, ChanSort.Api.SignalType.Tv, false);
if (exp != null)
{
this.expectedData.Remove(key);
Assert.AreEqual(exp.AnalogChannels, analogTv.Channels.Count, file + ": analog");
Assert.AreEqual(exp.DtvChannels, dtvTv.Channels.Count, file + ": DTV");
Assert.AreEqual(exp.SatChannels, satTv.Channels.Count, file + ": Sat");
}
}
catch(Exception ex)
{
errors.AppendLine();
errors.AppendLine();
errors.AppendLine(file);
errors.AppendLine(ex.ToString());
}
}
foreach(var model in models.OrderBy(e => e.Key))
Debug.WriteLine(model.Key + "\t"+model.Value);
foreach (var size in firmwareSize.OrderBy(e => e.Key))
Debug.WriteLine(size.Key + "\t" + size.Value);
if (this.expectedData.Count > 0)
Assert.Fail("Some files were not tested: " + this.expectedData.Keys.Aggregate((prev,cur) => prev+","+cur));
Assert.AreEqual("", errors.ToString());
}
#endregion
private string GetModel(string filePath)
{
string name = Path.GetFileName(filePath)??"";
if (name.StartsWith("xx"))
{
int idx = name.IndexOf("-");
if (idx > 0)
return name.Substring(2, idx - 2);
}
return filePath;
}
#region Helper Methods
private IEnumerable<string> FindAllTllFiles()
{
string path = this.GetTestFileDirectory();
List<string> files = new List<string>();
this.FindAllTllFilesRecursively(path, files);
return files;
}
private string GetTestFileDirectory()
{
string exeDir = Assembly.GetExecutingAssembly().Location;
while (!string.IsNullOrEmpty(exeDir))
{
string testFileDir = Path.Combine(exeDir, "TestFiles");
if (Directory.Exists(testFileDir))
return testFileDir;
exeDir = Path.GetDirectoryName(exeDir);
}
throw new FileNotFoundException("No 'TestFiles' directory found");
}
private void FindAllTllFilesRecursively(string path, List<string> files)
{
files.AddRange(Directory.GetFiles(path, "*.TLL"));
foreach (var dir in Directory.GetDirectories(path))
this.FindAllTllFilesRecursively(dir, files);
}
#endregion
}
}