- correctly detecting LG hospitality TV files named "xx....TLL" as GlobalClone/XML text files

This commit is contained in:
hbeham
2019-11-11 16:06:11 +01:00
parent 5cdf9d0995
commit 44f2c77c8d
4 changed files with 14 additions and 5 deletions

View File

@@ -45,6 +45,8 @@ namespace ChanSort.Loader.GlobalClone
{
this.doc = new XmlDocument();
string textContent = File.ReadAllText(this.FileName, Encoding.UTF8);
if (textContent[0] != '<')
throw new FileLoadException("Invalid GlobalClone/XML file format. Maybe a binary xx*.TLL file?", this.FileName);
textContent = ReplaceInvalidXmlCharacters(textContent);
var settings = new XmlReaderSettings { CheckCharacters = false };
using (var reader = XmlReader.Create(new StringReader(textContent), settings))
@@ -109,7 +111,7 @@ namespace ChanSort.Loader.GlobalClone
// ask whether binary TLL file should be deleted
var dir = Path.GetDirectoryName(this.FileName) ?? ".";
var binTlls = Directory.GetFiles(dir, "xx" + series + "*.tll");
if (binTlls.Length > 0)
if (binTlls.Length > 0 && !(binTlls.Length == 1 && Path.GetFileName(binTlls[0]).ToLower() == Path.GetFileName(this.FileName).ToLower()))
{
var txt = Resources.GcSerializer_ReadModelInfo_ModelWarning;
if (MessageBox.Show(txt, "LG GlobalClone", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)

View File

@@ -5,9 +5,9 @@ namespace ChanSort.Loader.GlobalClone
public class GcSerializerPlugin : ISerializerPlugin
{
public string DllName { get; set; }
public string PluginName { get { return "LG GlobalClone"; } }
public string FileFilter { get { return "*Clone*.tll;xx*.xml"; } }
public string PluginName => "LG GlobalClone";
public string FileFilter => "*Clone*.tll;xx*.xml;xx*.tll";
public SerializerBase CreateSerializer(string inputFile)
{
return new GcSerializer(inputFile);

View File

@@ -149,9 +149,12 @@ namespace ChanSort.Loader.LG
long fileSize = new FileInfo(this.FileName).Length;
if (fileSize > MaxFileSize)
throw new FileLoadException(string.Format(ERR_fileTooBig, fileSize, MaxFileSize));
throw new FileLoadException(string.Format(ERR_fileTooBig, fileSize, MaxFileSize), this.FileName);
this.fileContent = File.ReadAllBytes(this.FileName);
if (this.fileContent[0] == '<')
throw new FileLoadException("Invalid binary TLL file format. Maybe a GlobalClone/XML file?", this.FileName);
int off = 0;
this.ReadFileHeader(ref off);

View File

@@ -1,6 +1,10 @@
ChanSort Change Log
===================
2019-11-11
- LG hospitality TVs using files names like xx[modelname].TLL can now be loaded
(They use the naming pattern of binary TLL files, but contain GlobalClone/XML text data)
2019-11-10
- Sony: added support for independent favorite list ordering for Android channel lists (n)
- fixed: failed to save Sony lists which contain channel numbers above 8000