diff --git a/source/ChanSort.Loader.Philips/XmlSerializer.cs b/source/ChanSort.Loader.Philips/XmlSerializer.cs index d3c9fa9..fcb18c1 100644 --- a/source/ChanSort.Loader.Philips/XmlSerializer.cs +++ b/source/ChanSort.Loader.Philips/XmlSerializer.cs @@ -556,7 +556,7 @@ namespace ChanSort.Loader.Philips if (ch.IsNameModified) { - ch.SetupNode.Attributes["ChannelName"].InnerText = EncodeName(ch.Name, (ch.SetupNode.Attributes["ChannelName"].InnerText.Length + 1) / 5); + ch.SetupNode.Attributes["ChannelName"].InnerText = EncodeName(ch.Name, (ch.SetupNode.Attributes["ChannelName"].InnerText.Length + 1) / 5, true); attr = ch.SetupNode.Attributes["UserModifiedName"]; if (attr != null) attr.InnerText = "1"; @@ -587,7 +587,7 @@ namespace ChanSort.Loader.Philips favListNode.InnerXml = ""; // clear all child elements but keep the attributes of the current node var attr = favListNode.Attributes?["Name"]; if (attr != null) - attr.InnerText = EncodeName(this.DataRoot.GetFavListCaption(index - 1), (attr.InnerText.Length + 1)/5); + attr.InnerText = EncodeName(this.DataRoot.GetFavListCaption(index - 1), (attr.InnerText.Length + 1)/5, false); attr = favListNode.Attributes?["Version"]; if (attr != null && int.TryParse(attr.Value, out var version)) @@ -612,17 +612,18 @@ namespace ChanSort.Loader.Philips #endregion #region EncodeName - private string EncodeName(string name, int numBytes) + private string EncodeName(string name, int numBytes, bool upperCaseHexDigits) { var bytes = Encoding.Unicode.GetBytes(name); var sb = new StringBuilder(); + var pattern = upperCaseHexDigits ? "0x{0:X2} " : "0x{0:x2} "; for (int i = 0; i < numBytes - 2; i++) { var b = i < bytes.Length ? bytes[i] : 0; - sb.Append($"0x{b:X2} "); + sb.AppendFormat(pattern, b); } - sb.AppendLine("0x00 0x00"); // always add an end-of-string + sb.Append("0x00 0x00"); // always add an end-of-string return sb.ToString(); } #endregion diff --git a/source/changelog.md b/source/changelog.md index 8b4a881..7a074a6 100644 --- a/source/changelog.md +++ b/source/changelog.md @@ -1,6 +1,9 @@ ChanSort Change Log =================== +2021-02-17_2 +- Philips ChannelMap\_105 and 110: fixed broken favorites.xml file and DVB\*.xml when channels were renamed + 2021-02-17 - Panasonic: fixed error reading lists with channels that refer to non-existing transponders - Philips ChannelMap\_45: incrementing fav list version number when saving and setting the last\_watched\_channel\_id to