From de68993721e46125e790d25a831c0120508487e1 Mon Sep 17 00:00:00 2001 From: hbeham Date: Sun, 10 Feb 2019 16:59:20 +0100 Subject: [PATCH] - fixed saving VDR lists after applying a reference list which contained no longer existing channels (cast exception for the proxy ChannelInfo record) - no longer load samsung .zip lists with invalid internal folder structure (all files must be in the root folder of the .zip) --- source/ChanSort.Loader.SamsungJ/DbSerializer.cs | 9 +++++++-- source/ChanSort.Loader.VDR/Serializer.cs | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/ChanSort.Loader.SamsungJ/DbSerializer.cs b/source/ChanSort.Loader.SamsungJ/DbSerializer.cs index b87c5e8..7f7b795 100644 --- a/source/ChanSort.Loader.SamsungJ/DbSerializer.cs +++ b/source/ChanSort.Loader.SamsungJ/DbSerializer.cs @@ -107,8 +107,13 @@ namespace ChanSort.Loader.SamsungJ using (ZipFile zip = new ZipFile(this.FileName)) { - foreach(ZipEntry entry in zip) - this.Expand(zip, entry.Name); + foreach (ZipEntry entry in zip) + { + // only expand files from the root folder to avoid pit-falls with incorrectly rezipped lists + // that contain the data files in a subfolder + if (Path.GetDirectoryName(entry.Name) == "") + this.Expand(zip, entry.Name); + } } } #endregion diff --git a/source/ChanSort.Loader.VDR/Serializer.cs b/source/ChanSort.Loader.VDR/Serializer.cs index 5c32733..8a94e84 100644 --- a/source/ChanSort.Loader.VDR/Serializer.cs +++ b/source/ChanSort.Loader.VDR/Serializer.cs @@ -59,9 +59,11 @@ namespace ChanSort.Loader.VDR using (StreamWriter file = new StreamWriter(tvOutputFile)) { - foreach (Channels channelInfo in this.allChannels.GetChannelsByNewOrder()) + foreach (ChannelInfo channel in this.allChannels.GetChannelsByNewOrder()) { - file.WriteLine(channelInfo.confLine); + // when a reference list was applied, the list may contain proxy entries for deleted channels, which must be ignored + if (channel is Channels vdrChannel) + file.WriteLine(vdrChannel.confLine); } } }