mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-12 10:22:04 +01:00
- Reference list dialog is now resizable - Grundig dvb\*_config.xml lists are now separated into TV and Radio lists with individual ordering - ability to load Grundig dvb\*\_config.xml files containing invalid XML characters (e.g. 0x10)
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System.IO;
|
|
using System.IO.Compression;
|
|
using ChanSort.Api;
|
|
using ChanSort.Loader.Samsung.Scm;
|
|
using ChanSort.Loader.Samsung.Zip;
|
|
|
|
namespace ChanSort.Loader.Samsung
|
|
{
|
|
public class SamsungPlugin : ISerializerPlugin
|
|
{
|
|
public string DllName { get; set; }
|
|
public string PluginName => "Samsung (*.scm, *.zip)";
|
|
public string FileFilter => "*.scm;*.zip";
|
|
|
|
public SerializerBase CreateSerializer(string inputFile)
|
|
{
|
|
var ext = Path.GetExtension(inputFile).ToLowerInvariant();
|
|
if (ext == ".scm")
|
|
return new ScmSerializer(inputFile);
|
|
if (ext == ".zip")
|
|
{
|
|
// some Orsay TVs export a .zip file containing a Clone folder, which holds the same files as an .scm archive has in its root folder
|
|
ZipArchiveEntry zipArchiveEntry = null;
|
|
using (var stream = new FileStream(inputFile, FileMode.Open))
|
|
{
|
|
var zip = new ZipArchive(stream);
|
|
zipArchiveEntry = zip.GetEntry("Clone/map-AirD");
|
|
}
|
|
if (zipArchiveEntry != null)
|
|
return new ScmSerializer(inputFile, "Clone");
|
|
|
|
return new DbSerializer(inputFile);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|