From df22336ba0da0fba822dfd1546d74586015d4621 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 5 May 2025 12:45:02 -0400 Subject: [PATCH] Support checking Redumper DAT from zip; add tests --- CHANGELIST.md | 1 + MPF.Processors.Test/AaruTests.cs | 10 +++ MPF.Processors.Test/CleanRipTests.cs | 10 +++ MPF.Processors.Test/DiscImageCreatorTests.cs | 10 +++ MPF.Processors.Test/PS3CFWTests.cs | 10 +++ MPF.Processors.Test/RedumperTests.cs | 16 ++++- .../TestData/Aaru/CDROM-zip/test.aaruf | 1 + .../TestData/Aaru/CDROM-zip/test_logs.zip | Bin 0 -> 1041 bytes .../TestData/CleanRip/DVD-zip/test.iso | 1 + .../TestData/CleanRip/DVD-zip/test_logs.zip | Bin 0 -> 467 bytes .../DiscImageCreator/CDROM-zip/test.bin | 1 + .../DiscImageCreator/CDROM-zip/test.cue | 1 + .../DiscImageCreator/CDROM-zip/test.img | 1 + .../DiscImageCreator/CDROM-zip/test.scm | 1 + .../CDROM-zip/test_CSSKey.txt | 3 + .../DiscImageCreator/CDROM-zip/test_logs.zip | Bin 0 -> 4609 bytes .../TestData/PS3CFW/BluRay-zip/test.iso | 1 + .../TestData/PS3CFW/BluRay-zip/test_logs.zip | Bin 0 -> 320 bytes .../TestData/Redumper/CDROM-zip/test.cue | 1 + .../TestData/Redumper/CDROM-zip/test.scram | 1 + .../TestData/Redumper/CDROM-zip/test_logs.zip | Bin 0 -> 2921 bytes .../TestData/UmdImageCreator/UMD-zip/test.iso | 1 + .../UmdImageCreator/UMD-zip/test_logs.zip | Bin 0 -> 1167 bytes .../XboxBackupCreator/DVD-zip/test.iso | 1 + .../XboxBackupCreator/DVD-zip/test_logs.zip | Bin 0 -> 1232 bytes MPF.Processors.Test/UmdImageCreatorTests.cs | 10 +++ MPF.Processors.Test/XboxBackupCreatorTests.cs | 10 +++ MPF.Processors/Redumper.cs | 68 +++++++++++++++++- 28 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 MPF.Processors.Test/TestData/Aaru/CDROM-zip/test.aaruf create mode 100644 MPF.Processors.Test/TestData/Aaru/CDROM-zip/test_logs.zip create mode 100644 MPF.Processors.Test/TestData/CleanRip/DVD-zip/test.iso create mode 100644 MPF.Processors.Test/TestData/CleanRip/DVD-zip/test_logs.zip create mode 100644 MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test.bin create mode 100644 MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test.cue create mode 100644 MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test.img create mode 100644 MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test.scm create mode 100644 MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test_CSSKey.txt create mode 100644 MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test_logs.zip create mode 100644 MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test.iso create mode 100644 MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test_logs.zip create mode 100644 MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.cue create mode 100644 MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.scram create mode 100644 MPF.Processors.Test/TestData/Redumper/CDROM-zip/test_logs.zip create mode 100644 MPF.Processors.Test/TestData/UmdImageCreator/UMD-zip/test.iso create mode 100644 MPF.Processors.Test/TestData/UmdImageCreator/UMD-zip/test_logs.zip create mode 100644 MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test.iso create mode 100644 MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test_logs.zip diff --git a/CHANGELIST.md b/CHANGELIST.md index f2fab581..9520bd82 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -43,6 +43,7 @@ - Fix lines wiped before displayed - Update redumper to build 565 - Close the log archive, if it exists +- Support checking Redumper DAT from zip; add tests ### 3.3.0 (2025-01-03) diff --git a/MPF.Processors.Test/AaruTests.cs b/MPF.Processors.Test/AaruTests.cs index d6b01ca9..fa4a42db 100644 --- a/MPF.Processors.Test/AaruTests.cs +++ b/MPF.Processors.Test/AaruTests.cs @@ -127,6 +127,16 @@ namespace MPF.Processors.Test Assert.True(actual); } + [Fact] + public void FoundAnyFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "Aaru", "CDROM-zip"); + string outputFilename = "test.aaruf"; + var processor = new Aaru(RedumpSystem.IBMPCcompatible, MediaType.CDROM); + var actual = processor.FoundAnyFiles(outputDirectory, outputFilename); + Assert.True(actual); + } + #endregion #region GenerateArtifacts diff --git a/MPF.Processors.Test/CleanRipTests.cs b/MPF.Processors.Test/CleanRipTests.cs index 721fa1dd..76ade6a6 100644 --- a/MPF.Processors.Test/CleanRipTests.cs +++ b/MPF.Processors.Test/CleanRipTests.cs @@ -112,6 +112,16 @@ namespace MPF.Processors.Test Assert.True(actual); } + [Fact] + public void FoundAnyFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "CleanRip", "DVD-zip"); + string outputFilename = "test.iso"; + var processor = new CleanRip(RedumpSystem.NintendoGameCube, MediaType.DVD); + var actual = processor.FoundAnyFiles(outputDirectory, outputFilename); + Assert.True(actual); + } + #endregion #region GenerateArtifacts diff --git a/MPF.Processors.Test/DiscImageCreatorTests.cs b/MPF.Processors.Test/DiscImageCreatorTests.cs index 3cdc33c0..3b2327ca 100644 --- a/MPF.Processors.Test/DiscImageCreatorTests.cs +++ b/MPF.Processors.Test/DiscImageCreatorTests.cs @@ -181,6 +181,16 @@ namespace MPF.Processors.Test Assert.True(actual); } + [Fact] + public void FoundAnyFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "DiscImageCreator", "CDROM-zip"); + string outputFilename = "test.cue"; + var processor = new DiscImageCreator(RedumpSystem.IBMPCcompatible, MediaType.CDROM); + var actual = processor.FoundAnyFiles(outputDirectory, outputFilename); + Assert.True(actual); + } + #endregion #region GenerateArtifacts diff --git a/MPF.Processors.Test/PS3CFWTests.cs b/MPF.Processors.Test/PS3CFWTests.cs index e11b6e82..e37f58c9 100644 --- a/MPF.Processors.Test/PS3CFWTests.cs +++ b/MPF.Processors.Test/PS3CFWTests.cs @@ -91,6 +91,16 @@ namespace MPF.Processors.Test Assert.True(actual); } + [Fact] + public void FoundAnyFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "PS3CFW", "BluRay-zip"); + string outputFilename = "test.iso"; + var processor = new PS3CFW(RedumpSystem.SonyPlayStation3, MediaType.BluRay); + var actual = processor.FoundAnyFiles(outputDirectory, outputFilename); + Assert.True(actual); + } + #endregion #region GenerateArtifacts diff --git a/MPF.Processors.Test/RedumperTests.cs b/MPF.Processors.Test/RedumperTests.cs index 19982bb0..007824a8 100644 --- a/MPF.Processors.Test/RedumperTests.cs +++ b/MPF.Processors.Test/RedumperTests.cs @@ -29,7 +29,7 @@ namespace MPF.Processors.Test var processor = new Redumper(RedumpSystem.IBMPCcompatible, MediaType.CDROM); var actual = processor.GetOutputFiles(outputDirectory, outputFilename); - Assert.Equal(15, actual.Count); + Assert.Equal(16, actual.Count); } [Fact] @@ -100,6 +100,16 @@ namespace MPF.Processors.Test Assert.Empty(actual); } + [Fact] + public void FoundAllFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "Redumper", "CDROM-zip"); + string outputFilename = "test.cue"; + var processor = new Redumper(RedumpSystem.IBMPCcompatible, MediaType.CDROM); + var actual = processor.FoundAllFiles(outputDirectory, outputFilename); + Assert.Empty(actual); + } + #endregion #region FoundAnyFiles @@ -145,7 +155,7 @@ namespace MPF.Processors.Test string outputFilename = "test.cue"; var processor = new Redumper(RedumpSystem.IBMPCcompatible, MediaType.CDROM); var actual = processor.GenerateArtifacts(outputDirectory, outputFilename); - Assert.Equal(9, actual.Count); + Assert.Equal(10, actual.Count); } #endregion @@ -193,7 +203,7 @@ namespace MPF.Processors.Test string outputFilename = "test.cue"; var processor = new Redumper(RedumpSystem.IBMPCcompatible, MediaType.CDROM); var actual = processor.GetZippableFilePaths(outputDirectory, outputFilename); - Assert.Equal(9, actual.Count); + Assert.Equal(10, actual.Count); } #endregion diff --git a/MPF.Processors.Test/TestData/Aaru/CDROM-zip/test.aaruf b/MPF.Processors.Test/TestData/Aaru/CDROM-zip/test.aaruf new file mode 100644 index 00000000..1aa4b5d8 --- /dev/null +++ b/MPF.Processors.Test/TestData/Aaru/CDROM-zip/test.aaruf @@ -0,0 +1 @@ +TEST DATA \ No newline at end of file diff --git a/MPF.Processors.Test/TestData/Aaru/CDROM-zip/test_logs.zip b/MPF.Processors.Test/TestData/Aaru/CDROM-zip/test_logs.zip new file mode 100644 index 0000000000000000000000000000000000000000..7667316ed2890b6f5653e6292779fc32f479182f GIT binary patch literal 1041 zcmWIWW@h1H0D;9-&5@Dwxx+Xa7#Kj9mw|zyB(=CiFF7+gSFa*BC&V>4M8U-|#1Xe1 zKA4`=qN4mFy`21XA~bQpG-W1XQ@#YvU2x^tO-ENQ05d%|BPAs#KV2^=GY^ZS(6#Zy zv=yZmm*%G8@ISgP9+u1lz!@7k7U><;r}-{Cu_{FvjF)Gf6tvjv)6&ZY=<>U=+$6}fqb-0Vd$HtSDl zryUNxz_@tQv6ds9KCMetzi39SnRujk`SlMc`0mvUEVubQ__;bx3@WRYrVWa$WIHv{(|^IFDW@OIUyw}EipCu`GY5qo;`f}SU#tQA;6oF$(|Xc z8e0gcFhGDp!> +DecryptedDiscKey[020]: No Key +LBA: 0, Filename: FILE, No TitleKey \ No newline at end of file diff --git a/MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test_logs.zip b/MPF.Processors.Test/TestData/DiscImageCreator/CDROM-zip/test_logs.zip new file mode 100644 index 0000000000000000000000000000000000000000..50622e580e89ebc6708495f0c0d33940b7bc0ecd GIT binary patch literal 4609 zcmWIWW@h1H00Ewc=E%tT++myy3=AMF#K6E%l3HA%pb=7(n4GO(ps80}niS$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n5o~T{`3CcyZP#;$5#*T_+A;k zf9>vx|K7c}ss3PA%9J17pFZQ(u9tF~d>>ES-TcT=+hA3454h*9R|di%XMWL5>o~kf?eVF(q=H=G{hq1_lOk1_lOESX60!OhNyPM&;qPVo6 zAV&{-<$FD=C33C2>>+ms28Lh;1_roC%kpzvQXvICBr|cIKCgM!_p7Im*ICUlP-fCN zb;eg`RY*gJ_KqcD>f)(lQ=W)x{+RkqZK+tKrbL0`Q=8zR&t68CjU1aS6_|H01b8zt z*)wBzs}O?Vyr zNq9ViJ-GN#Y-vN-0&TJ&n;(DREgthBfrZ(gK@P0lF!PaGH^??TV1KDth&4^IvVmF| P;tb*pATta=qdW`%-FDBU literal 0 HcmV?d00001 diff --git a/MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test.iso b/MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test.iso new file mode 100644 index 00000000..1aa4b5d8 --- /dev/null +++ b/MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test.iso @@ -0,0 +1 @@ +TEST DATA \ No newline at end of file diff --git a/MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test_logs.zip b/MPF.Processors.Test/TestData/PS3CFW/BluRay-zip/test_logs.zip new file mode 100644 index 0000000000000000000000000000000000000000..4f801f4c40e4542a2bbd814dc71aea6f234c1229 GIT binary patch literal 320 zcmWIWW@h1H00I4`=E%tT++myy3=AO5%fP@;l3HA%my%hWtXGhk9O4=rqTu2f;)u|r zji!emrYAkMBs;ZIFDE}8Nf#rNJu@!5R6tH(U|>*a*wP4MqS(yEpa2qMU}TVBxZs$O xaKQC8BUk{52=GQ2kLfIA<4rIfiEKf9uyQnZ3s~7e_AxOqF&toEV8{Y-7yt;sH#h(Q literal 0 HcmV?d00001 diff --git a/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.cue b/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.cue new file mode 100644 index 00000000..1aa4b5d8 --- /dev/null +++ b/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.cue @@ -0,0 +1 @@ +TEST DATA \ No newline at end of file diff --git a/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.scram b/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.scram new file mode 100644 index 00000000..1aa4b5d8 --- /dev/null +++ b/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test.scram @@ -0,0 +1 @@ +TEST DATA \ No newline at end of file diff --git a/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test_logs.zip b/MPF.Processors.Test/TestData/Redumper/CDROM-zip/test_logs.zip new file mode 100644 index 0000000000000000000000000000000000000000..35e29eccb64f7ab9d0b56c354d38009ed706e78d GIT binary patch literal 2921 zcmWIWW@h1H00FC(=E%tT++myy3=A+_l3HA%msng{9O4=rqTu2f;)qahjZ=L|W&sxU zUtK0fA)61f6>NTTVsb_*77geYa5FG4Ks2P3q*jz*(SdFS$QxiCX*pP(gl+>5%!ahm zoSc&UWGq(L;_`JyVsQqFdJzT&1`Y<0lXi>gc9^p;Ff8N&i9kJ(lb`-}T5kU(2Z4tD zpS9I$9xa-an^~E8g(Z5AvYh(PdCM7T# zZ~W5JKHgt@?euN!56{1IOZ-@Jta{eNr@0^BE;??Iw@FCy&6%55c9{75YuvCf^UqO( zo_n947qot5-qa;#$>S06<^xmQzBig@XBkXNJo}YNXj`Vynb)UUHQF8)wCm_-<@D}l zTdkX<>$A6<`^OdLI@hjkVKud!zJU@)my|6%TO5`$;j@SSuhX~Nf1bVc-r2Rj;Nljy zZI|0ST=jpo?fNz0=(+B?oY@~uy3#KnF>pG)VPgJ;8E2PCs0QDjrBJ?6Rc*WSVo6Cw zD+|827dqUhJ#OJtGfvN$ae1cWq>3z`o=Ew5vftlc*4lM{dePLt!xHyRrmPX*E2?sfH3KDpPXPk0R+Gq2lt6DsdyP~<8GdpUzM#fR*)vv#PN?Yi(@~NJL z_Ka|opAStV^-hR=XIj=V^ zKAvnl@5RTE{`4vv`{P>AueTh%&v96Fz35Hvo_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>l(U6$T8(yh&?CYJ`nHi_9?=`ur)VSVZ8} zPM#iKUJ<95W@nKY8E2Ws80C<4hFaHIre=4YGIf4BOSza4Zf3Pau9cTPX7DoSjeKCgM!_p7Im*ICUlP<&{dI^(OeDx{%9d&d$nb@5cODNn>T ze@uO*wp1)qQ=-7}sZDUuXD_46MvhIE3d}ng0=yZS?3u9#8V`dCC@nECFeo%^X#_Em zlMok!0!WB~kwJptI!nr{1Fp9j!2(DG#B_+KFw+;Z>BcZG!crTu@!3hK-`?Of9^!b+ zWP)t`X}IyQM1ySp8L7`NaXTMkK4ywSHlKkJn!ixe7qT6DJVXfw5oY2;w!;$H4p>q| zw&KAyKAYD#g9#D~m`MxSihVFEkP;fQ4aMK~s}#Cni)U6gP_(l#uratXF)$c2fp`Gg CFCuXO literal 0 HcmV?d00001 diff --git a/MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test.iso b/MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test.iso new file mode 100644 index 00000000..1aa4b5d8 --- /dev/null +++ b/MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test.iso @@ -0,0 +1 @@ +TEST DATA \ No newline at end of file diff --git a/MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test_logs.zip b/MPF.Processors.Test/TestData/XboxBackupCreator/DVD-zip/test_logs.zip new file mode 100644 index 0000000000000000000000000000000000000000..9bb6b3c7dc3e3c66f5b8f7774c70fa79108adea0 GIT binary patch literal 1232 zcmWIWW@h1H00Fn==E%tT++myy3=AO5&cMLn;_IoGl$jUe8XThF;uzwHUv+>Rv8qAl z2PKvV2jei^0?jRK3=9ld6pJu0FmNz@U)dZf-%|B&DkB5KbY=zyki&EG)AdR!O4bJY z_TMrP+4DQR=i40@&XUin4qj#(To(mhT@ku;6}zzgimi%n+a~M%{p#z(nCUO`?Ie5s znKRYK^Y%M$l#l+})pT9|uAu*{9idXS57;%VZg%KMa2@50_cYnG)FkzDxyG?H<2All zubN73em$%AR`SM#0~b2Due>VAIWegrN04P^bl(@BZC5re7pyJcE@`uV(XPvv<{9L; z^{YneNgMCciCAhCD?F#5?bYP)wu?(r?#(Tg%sK48Wc#cir!D4Mi$2bjTlUbTPdV-D zgw6WByA0emd#{~prhNFQ{%zY;$;xlbH87yZLz zkK@w6wR3-*+B@r`erBDT;?G?&i}w6~EyMnL($m6_C7DLLhbiIEI0N0iF+# zjV|5nOwee|OoD854?N2tn|tt3cPH+!z?Gkn&E3hszyQr%$Ofy2t>=D4AdoSm8`qxhDA)ExCH<^iBwAf literal 0 HcmV?d00001 diff --git a/MPF.Processors.Test/UmdImageCreatorTests.cs b/MPF.Processors.Test/UmdImageCreatorTests.cs index 5928a8fa..36bc31dc 100644 --- a/MPF.Processors.Test/UmdImageCreatorTests.cs +++ b/MPF.Processors.Test/UmdImageCreatorTests.cs @@ -67,6 +67,16 @@ namespace MPF.Processors.Test Assert.Empty(actual); } + [Fact] + public void FoundAllFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "UmdImageCreator", "UMD-zip"); + string outputFilename = "test.iso"; + var processor = new UmdImageCreator(RedumpSystem.SonyPlayStationPortable, MediaType.UMD); + var actual = processor.FoundAllFiles(outputDirectory, outputFilename); + Assert.Empty(actual); + } + #endregion #region FoundAnyFiles diff --git a/MPF.Processors.Test/XboxBackupCreatorTests.cs b/MPF.Processors.Test/XboxBackupCreatorTests.cs index fc407d7c..e75c8bd4 100644 --- a/MPF.Processors.Test/XboxBackupCreatorTests.cs +++ b/MPF.Processors.Test/XboxBackupCreatorTests.cs @@ -67,6 +67,16 @@ namespace MPF.Processors.Test Assert.Empty(actual); } + [Fact] + public void FoundAllFiles_ValidZip_Empty() + { + string? outputDirectory = Path.Combine(Environment.CurrentDirectory, "TestData", "XboxBackupCreator", "DVD-zip"); + string outputFilename = "test.iso"; + var processor = new XboxBackupCreator(RedumpSystem.MicrosoftXbox, MediaType.DVD); + var actual = processor.FoundAllFiles(outputDirectory, outputFilename); + Assert.Empty(actual); + } + #endregion #region FoundAnyFiles diff --git a/MPF.Processors/Redumper.cs b/MPF.Processors/Redumper.cs index 9d18b6d1..1145a0a0 100644 --- a/MPF.Processors/Redumper.cs +++ b/MPF.Processors/Redumper.cs @@ -1,6 +1,10 @@ using System; using System.Collections.Generic; using System.IO; +#if NET452_OR_GREATER || NETCOREAPP +using System.IO.Compression; +using System.Linq; +#endif using System.Text; using System.Text.RegularExpressions; using SabreTools.Hashing; @@ -427,16 +431,21 @@ namespace MPF.Processors case MediaType.CDROM: case MediaType.GDROM: List cdrom = [ + // .asus is obsolete: newer redumper produces .cache instead new($"{outputFilename}.asus", OutputFileFlags.Binary | OutputFileFlags.Zippable, "asus"), new($"{outputFilename}.atip", OutputFileFlags.Binary | OutputFileFlags.Zippable, "atip"), + new($"{outputFilename}.cache", OutputFileFlags.Binary + | OutputFileFlags.Zippable, + "cache"), new($"{outputFilename}.cdtext", OutputFileFlags.Binary | OutputFileFlags.Zippable, "cdtext"), new($"{outputFilename}.cue", OutputFileFlags.Required), + new($"{outputFilename}.flip", OutputFileFlags.None), new($"{outputFilename}.fulltoc", OutputFileFlags.Required | OutputFileFlags.Binary | OutputFileFlags.Zippable, @@ -450,7 +459,6 @@ namespace MPF.Processors new($"{outputFilename}.pma", OutputFileFlags.Binary | OutputFileFlags.Zippable, "pma"), - new([$"{outputFilename}.flip"], OutputFileFlags.None), new([$"{outputFilename}.scram", $"{outputFilename}.scrap"], OutputFileFlags.Required | OutputFileFlags.Deleteable), new($"{outputFilename}.state", OutputFileFlags.Required @@ -625,7 +633,45 @@ namespace MPF.Processors /// /// Log file location private static bool DatfileExists(string log) - => GetDatfile(log) != null; + { + // Uncompressed outputs + if (GetDatfile(log) != null) + return true; + + // Check for the log file + string outputFilename = Path.GetFileName(log); + string? outputDirectory = Path.GetDirectoryName(log); + string basePath = Path.GetFileNameWithoutExtension(outputFilename); + if (!string.IsNullOrEmpty(outputDirectory)) + basePath = Path.Combine(outputDirectory, basePath); + +#if NET20 || NET35 || NET40 + // Assume the zipfile has the file in it + return File.Exists($"{basePath}_logs.zip"); +#else + // If the zipfile doesn't exist + if (!File.Exists($"{basePath}_logs.zip")) + return false; + + try + { + // Try to open the archive + using ZipArchive archive = ZipFile.OpenRead($"{basePath}_logs.zip"); + + // Get the log entry and check it, if possible + var entry = archive.GetEntry(outputFilename); + if (entry == null) + return false; + + using var sr = new StreamReader(entry.Open()); + return GetDatfile(sr) != null; + } + catch + { + return false; + } +#endif + } /// /// Copies a file with the header removed @@ -769,6 +815,24 @@ namespace MPF.Processors try { using var sr = File.OpenText(log); + return GetDatfile(sr); + } + catch + { + // We don't care what the exception is right now + return null; + } + } + + /// + /// Get the datfile from the input file, if possible + /// + /// StreamReader representing the input file + /// Newline-delimited datfile if possible, null on error + internal static string? GetDatfile(StreamReader sr) + { + try + { string? datString = null; // Find all occurrences of the hash information