- added experimental support for Loewe / Hisense 2017 servicelist.db

file format
- show error message when trying to open a .zip file that doen't contain
  the expected files of a Samsung J series or Toshiba .zip channel list
- show error message when trying to open a broken .zip file, which is
  most likely caused by exporting to a USB stick formatted with NTFS
- allow changing the "crypt" flag for Samsung .scm lists
- iterating through loaders supporting a file extension till one can read the file
This commit is contained in:
hbeham
2017-06-08 20:01:42 +02:00
parent 16b3f3fbc0
commit 6cf02f4f90
38 changed files with 560 additions and 427 deletions

View File

@@ -1,4 +1,5 @@
using System.Text;
using System;
using System.IO;
using ChanSort.Loader.Samsung;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -7,14 +8,41 @@ namespace Test.Loader.Samsung
[TestClass]
public class FileFormatDetectionTest
{
private readonly StringBuilder errors = new StringBuilder();
private const string RootPath = @"d:\sources\ChanSort\TestFiles_Samsung\";
private static readonly string RootPath;
static FileFormatDetectionTest()
{
RootPath = GetSolutionBaseDir() + @"\Test.Loader.Samsung\TestFiles\";
}
#region GetSolutionBaseDir()
protected static string GetSolutionBaseDir()
{
var dir = Path.GetDirectoryName(typeof(FileFormatDetectionTest).Assembly.Location);
do
{
if (File.Exists(dir + "\\ChanSort.sln"))
return dir;
dir = Path.GetDirectoryName(dir);
} while (!string.IsNullOrEmpty(dir));
dir = Environment.CurrentDirectory;
do
{
if (File.Exists(dir + "\\ChanSort.sln"))
return dir;
dir = Path.GetDirectoryName(dir);
} while (!string.IsNullOrEmpty(dir));
throw new InvalidOperationException("Cannot determine base directory of ChanSort solution");
}
#endregion
[TestMethod]
public void LoadFileWithExcessiveHighFrequency_1()
{
// this seems to be a corrupt file caused by a buffer-overflow from analog channel names into the frequency data bytes
var s = new ScmSerializer(RootPath + @"ThomasSaur_DH\channel_list_UE55H6470_1201-Suchlauf-2015-04-26.scm");
var s = new ScmSerializer(RootPath + @"channel_list_UE55H6470_1201-Suchlauf-2015-04-26.scm");
s.Load();
}
@@ -22,7 +50,7 @@ namespace Test.Loader.Samsung
public void LoadFileWithExcessiveHighFrequency_2()
{
// this seems to be a corrupt file caused by a buffer-overflow from analog channel names into the frequency data bytes
var s = new ScmSerializer(RootPath + @"ThomasSaur_DH\channel_list_UE55H6470_1201.scm");
var s = new ScmSerializer(RootPath + @"channel_list_UE55H6470_1201.scm");
s.Load();
}
@@ -30,7 +58,7 @@ namespace Test.Loader.Samsung
public void LoadRenamedFile_HE40Cxxx_1201()
{
// This file uses the 1201 format (E,F,H,J), but has a "C" in its model name
var s = new ScmSerializer(RootPath + @"__C=F\Kinig\Reier Monika.scm");
var s = new ScmSerializer(RootPath + @"E_format_with_C_model_name.scm");
s.Load();
Assert.AreEqual("E", s.Series);
}
@@ -39,7 +67,7 @@ namespace Test.Loader.Samsung
public void LoadRenamedFile_LT24B_1201()
{
// This file uses the 1201 format (E,F,H,J), but has a "B" in its model name
var s = new ScmSerializer(RootPath + @"__B=F\DieterHerzberg_B\renamed.scm");
var s = new ScmSerializer(RootPath + @"E_format_with_C_model_name.scm");
s.Load();
Assert.AreEqual("E", s.Series);
}
@@ -47,8 +75,8 @@ namespace Test.Loader.Samsung
[TestMethod]
public void LoadJSeriesWithScm1201Format()
{
// J-series model with SCM format
var s = new ScmSerializer(RootPath + @"__J\HenryLoenwind_SCM\channel_list_UE32J5170_1201_orig.scm");
// J-series model with E-J series SCM format
var s = new ScmSerializer(RootPath + @"channel_list_UE32J5170_1201_orig.scm");
s.Load();
Assert.AreEqual("E", s.Series);
}