diff --git a/source/ChanSort.Loader.SatcoDX/SatcoDxPlugin.cs b/source/ChanSort.Loader.SatcoDX/SatcoDxPlugin.cs index 78d34bc..2079250 100644 --- a/source/ChanSort.Loader.SatcoDX/SatcoDxPlugin.cs +++ b/source/ChanSort.Loader.SatcoDX/SatcoDxPlugin.cs @@ -1,4 +1,6 @@ -using ChanSort.Api; +using System.IO; +using System.Text; +using ChanSort.Api; namespace ChanSort.Loader.SatcoDX { @@ -10,6 +12,14 @@ public class SatcoDxPlugin : ISerializerPlugin public SerializerBase CreateSerializer(string inputFile) { + var buffer = new byte[7]; + using (var strm = new FileStream(inputFile, FileMode.Open)) + { + var len = strm.Read(buffer, 0, buffer.Length); + if (len != buffer.Length || Encoding.ASCII.GetString(buffer, 0, len) != "SATCODX") + return null; + } + return new Serializer(inputFile); } } diff --git a/source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs b/source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs index 5283003..5cfa576 100644 --- a/source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs +++ b/source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs @@ -1,5 +1,7 @@ -using System.IO; +using System.CodeDom; +using System.IO; using System.Linq; +using System.Text; using ChanSort.Api; namespace ChanSort.Loader.Unsupported @@ -12,18 +14,21 @@ public class UnsupportedPlugin : ISerializerPlugin public string PluginName => "Unsupported"; public string FileFilter => "*"; + private string path; private string dir; private string name; private string ext; public SerializerBase CreateSerializer(string inputFile) { + path = inputFile; dir = Path.GetDirectoryName(inputFile); name = Path.GetFileName(inputFile).ToLowerInvariant(); ext = Path.GetExtension(name); CheckForMediaTekAndroidBin(); CheckForVestelEncryptedDb(); + CheckForSdxEncrypted(); throw LoaderException.TryNext("File is not on the list of explicitly unsupported formats"); } @@ -68,5 +73,22 @@ private void CheckForVestelEncryptedDb() } #endregion + #region CheckForSdxEncrypted() + /// + /// Not sure if these .sdx files are also from SatcoDX, but they seem to have a 64 byte file header and then either encrypted or + /// compressed data that can't be analyzed. One such file came from a Xoro + /// + private void CheckForSdxEncrypted() + { + using var strm = new FileStream(this.path, FileMode.Open); + var buffer = new byte[24]; + var len = strm.Read(buffer, 0, buffer.Length); + if (len < buffer.Length) + return; + var str = Encoding.ASCII.GetString(buffer, 0, buffer.Length); + if (str.StartsWith("CDX\0MSTDatabaseV")) + throw LoaderException.Fail("Encrypted SDX channel lists (used by Xoro and others) can't be read/modified with ChanSort."); + } + #endregion } } diff --git a/source/changelog.md b/source/changelog.md index 812996b..d952dac 100644 --- a/source/changelog.md +++ b/source/changelog.md @@ -1,10 +1,11 @@ ChanSort Change Log =================== -2023-01-14 +2023-01-15 - added support for Vision EDGE 4K set-top-box (DVB-S only) - TCL: separate lists for DVB-C/T/S, each starting at 1 - TCL: cleaned up "Hide" vs "Skip" +- SDX: showing message when an unsupported, encrypted .sdx file is opened (e.g. from Xoro STB) 2023-01-12 - TCL: fixed upload failure due to incorrect checksum when DtvData.db was larger than 307200 bytes