Files
ChanSort/source/ChanSort.Loader.LG/LgPlugin.cs
Horst Beham 68d3fc4963 - Panasonic LS 500 / LX 700 series: support for new firmware which doesn't export a hotel.bin file.
- Loewe servicelist.xml (and maybe some other .xml files) larger than 2 000 000 bytes were
  not loaded.
- Enigma/Linux lists can now also be opened by selecting a .tv or .radio file (not just lamedb)
2023-06-01 11:11:33 +02:00

33 lines
1.2 KiB
C#

using System.IO;
using System.Text;
using ChanSort.Api;
namespace ChanSort.Loader.LG
{
public class LgPlugin : ISerializerPlugin
{
public string DllName { get; set; }
public string PluginName => "LG (*.tll, xx*.xml)";
public string FileFilter => "*.tll;*.xml"; // can be GlobalClone00001.tll, xx*.tll with GlobalClone XML content, xx*.dll with binary data content, xx*.xml with GlobalClone XML content
public SerializerBase CreateSerializer(string inputFile)
{
// webOS 5 files with <TLLDATA><ModelInfo><CloneVersion><MajorVersion>200</MajorVersion> .... contain all the actual channel data in JSON format inside a <legacybroadcast> element
var content = File.ReadAllText(inputFile, Encoding.UTF8);
if (content.Contains("<legacybroadcast>"))
return new GlobalClone.GcJsonSerializer(inputFile, content);
if (content.Contains("<TLLDATA>"))
return new GlobalClone.GcXmlSerializer(inputFile);
if (content.StartsWith("<"))
throw LoaderException.TryNext("File is not a binary LG .TLL file");
return new Binary.TllFileSerializer(inputFile) { IsTesting = this.IsTesting };
}
internal bool IsTesting { get; set; }
}
}