mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-02-21 05:46:47 +01:00
- Philips: support for FLASH/*.bin DVB-T/C and preset DVB-S lists (mgr_chan_s_pkg.db) - Toshiba: lists with chmgt_type001\\chmgt.bin can now be opened without zipping them - Toshiba: selecting the hotelopt_type001.bin will now also load the list (if the type is supported) - Alden: added support for "Alden" Android SmartTV channel list format (dvr_rtk_tv.db)
69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using System.IO;
|
|
using ChanSort.Api;
|
|
|
|
namespace ChanSort.Loader.Toshiba
|
|
{
|
|
public class ToshibaPlugin : ISerializerPlugin
|
|
{
|
|
public string DllName { get; set; }
|
|
public string PluginName => "Toshiba";
|
|
public string FileFilter => "*.db;*.bin;*.zip";
|
|
|
|
public SerializerBase CreateSerializer(string inputFile)
|
|
{
|
|
var dir = Path.GetDirectoryName(inputFile);
|
|
var name = Path.GetFileName(inputFile).ToLowerInvariant();
|
|
var ext = Path.GetExtension(name);
|
|
const string FILE_hotelopt = "hotelopt_type001.bin";
|
|
|
|
// CLONE00001\settingsDB.db
|
|
if (name == "settingsdb.db")
|
|
return new SettingsDbSerializer(inputFile);
|
|
|
|
// selecting a chmgt.db, dvbMainData.db or dvbSysData.db directly -> use hotelopt_type001.bin instead
|
|
if (ext == ".db")
|
|
{
|
|
var hotelopt = Path.Combine(Path.GetDirectoryName(dir), FILE_hotelopt);
|
|
if (File.Exists(hotelopt))
|
|
return new ChmgtDbSerializer(hotelopt);
|
|
}
|
|
|
|
// hotelopt_type001.bin can belong to different formats
|
|
if (name == FILE_hotelopt)
|
|
{
|
|
if (File.Exists(Path.Combine(dir, "chmgt_type001", "chmgt.db")))
|
|
return new ChmgtDbSerializer(inputFile);
|
|
|
|
// atv_cmdb.bin is handledby the CmdbBin loader
|
|
if (File.Exists(Path.Combine(dir, "atv_cmdb.bin")))
|
|
return null;
|
|
|
|
// "Acropolis" format with chmgt_type001\*.txt is not supported
|
|
throw new FileLoadException(string.Format(SerializerBase.ERR_UnsupportedFormat, "Euro*.txt"));
|
|
}
|
|
|
|
// chmgt.db folder structure in a .zip file (for backward-compatibility with older ChanSort versions)
|
|
if (ext == ".zip")
|
|
return new ChmgtDbSerializer(inputFile);
|
|
|
|
// *.sdx is handled by the SatcoDX loader
|
|
if (ext == ".sdx")
|
|
return null;
|
|
|
|
// atv_cmdb.bin is handled by the CmdbBin loader
|
|
if ((name.StartsWith("atv_") || name.StartsWith("dtv_")) && ext == ".bin")
|
|
return null;
|
|
|
|
// Hotel\tcl_clone_user.bin
|
|
if (name.StartsWith("tcl_clone_") && name.EndsWith(".bin"))
|
|
throw new FileLoadException(string.Format(SerializerBase.ERR_UnsupportedFormat, "tcl_clone_user.bin"));
|
|
|
|
// HOTEL_*.bin
|
|
if (name.StartsWith("hotel_") && name.EndsWith(".bin"))
|
|
throw new FileLoadException(string.Format(SerializerBase.ERR_UnsupportedFormat, "HOTEL_*.bin"));
|
|
|
|
throw new FileLoadException(SerializerBase.ERR_UnknownFormat);
|
|
}
|
|
}
|
|
}
|