From bddbf67dd58f4452905992e8adef63d853c7c545 Mon Sep 17 00:00:00 2001 From: hbeham Date: Fri, 30 May 2014 00:24:29 +0200 Subject: [PATCH] fixed problem with LG GlobalClone XML file writer: no more UTF BOM, use UTF8 for encoding, specify UTF8 in XML declaration --- ChanSort.Loader.GlobalClone/GcSerializer.cs | 18 ++++++++++++++++-- ChanSort/MainForm.cs | 2 +- readme.txt | 6 +++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChanSort.Loader.GlobalClone/GcSerializer.cs b/ChanSort.Loader.GlobalClone/GcSerializer.cs index 67cb7d1..74233d8 100644 --- a/ChanSort.Loader.GlobalClone/GcSerializer.cs +++ b/ChanSort.Loader.GlobalClone/GcSerializer.cs @@ -297,8 +297,22 @@ namespace ChanSort.Loader.GlobalClone } } } - - doc.Save(tvOutputFile); + + // by default .NET reformats the whole XML. These settings produce the same format as the TV xml files use + var settings = new XmlWriterSettings(); + settings.Encoding = new UTF8Encoding(false); + settings.Indent = true; + settings.NewLineChars = "\r\n"; + settings.NewLineHandling = NewLineHandling.Replace; + settings.OmitXmlDeclaration = true; + settings.IndentChars = ""; + using (StringWriter sw = new StringWriter()) + using (XmlWriter xw = XmlWriter.Create(sw, settings)) + { + doc.Save(xw); + var xml = "\r\n\r\n" + sw; + File.WriteAllText(tvOutputFile, xml, settings.Encoding); + } } #endregion diff --git a/ChanSort/MainForm.cs b/ChanSort/MainForm.cs index 39ce593..ddc93c3 100644 --- a/ChanSort/MainForm.cs +++ b/ChanSort/MainForm.cs @@ -25,7 +25,7 @@ namespace ChanSort.Ui { public partial class MainForm : XtraForm { - public const string AppVersion = "v2014-05-29"; + public const string AppVersion = "v2014-05-30"; private const int MaxMruEntries = 10; diff --git a/readme.txt b/readme.txt index 8a1b9ed..ea3b5f9 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,7 @@ -Version v2014-05-29 ======================================================= +Version v2014-05-30 ======================================================= Changes: +- fixed issues with LG "GlobalClone" XML file format - supports LG LB55xx and LB56xx xxLB*.TLL channel lists - supports LG LB58xx*.TLL channel lists (satellite channels ONLY due to lack of DVB-C/T test files) @@ -119,6 +120,9 @@ OTHER DEALINGS IN THE SOFTWARE. Change log ================================================================ +2014-05-30 +- fixed issues with LG "GlobalClone" XML file format + 2014-05-29 - supports LG LB55xx and LB56xx xxLB*.TLL channel lists - supports LG LB58xx*.TLL channel lists