From bbe9c94545ce8934025e59d6788c27103f37b0c3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 9 Mar 2023 10:07:06 -0500 Subject: [PATCH] Update to DIC 20230309 --- CHANGELIST.md | 1 + MPF.Modules/DiscImageCreator/Parameters.cs | 51 ++++++++++++++++++++++ appveyor.yml | 12 ++--- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 207c83b3..44f44cbd 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -83,6 +83,7 @@ - Remove unsupported identifiers - Add identifiers in more places - Move drive finding inside of the try/catch +- Update to DIC 20230309 ### 2.4 (2022-10-26) diff --git a/MPF.Modules/DiscImageCreator/Parameters.cs b/MPF.Modules/DiscImageCreator/Parameters.cs index 84e62e74..cc4ea490 100644 --- a/MPF.Modules/DiscImageCreator/Parameters.cs +++ b/MPF.Modules/DiscImageCreator/Parameters.cs @@ -224,6 +224,7 @@ namespace MPF.Modules.DiscImageCreator - subInfo - Subchannel informational messages - subIntention - Subchannel intentional error information - subReadable - Human-readable version of `sub` + - toc - Binary representation of the table of contents - volDesc - Volume descriptor information */ @@ -257,6 +258,8 @@ namespace MPF.Modules.DiscImageCreator missingFiles.Add($"{basePath}.dat"); if (!File.Exists($"{basePath}.sub") && !File.Exists($"{basePath}.subtmp")) missingFiles.Add($"{basePath}.sub"); + if (!File.Exists($"{basePath}.toc")) + missingFiles.Add($"{basePath}.toc"); if (!File.Exists($"{basePath}_disc.txt")) missingFiles.Add($"{basePath}_disc.txt"); if (!File.Exists($"{basePath}_drive.txt")) @@ -430,6 +433,11 @@ namespace MPF.Modules.DiscImageCreator if (!string.IsNullOrWhiteSpace(cdMultiSessionInfo)) info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Multisession] = cdMultiSessionInfo; + + // Attempt to get the universal hash + string universalHash = GetUniversalHash($"{basePath}_disc.txt") ?? ""; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash] = universalHash; + break; case MediaType.DVD: @@ -1564,6 +1572,8 @@ namespace MPF.Modules.DiscImageCreator logFiles.Add($"{basePath}.sub"); if (File.Exists($"{basePath}.subtmp")) logFiles.Add($"{basePath}.subtmp"); + if (File.Exists($"{basePath}.toc")) + logFiles.Add($"{basePath}.toc"); if (File.Exists($"{basePath}_disc.txt")) logFiles.Add($"{basePath}_disc.txt"); if (File.Exists($"{basePath}_drive.txt")) @@ -3494,6 +3504,47 @@ namespace MPF.Modules.DiscImageCreator } } + /// + /// Get the universal hash from the input file, if possible + /// + /// _disc.txt file location + /// Universal hash if possible, null on error + private static string GetUniversalHash(string disc) + { + // If the file doesn't exist, we can't get info from it + if (!File.Exists(disc)) + return null; + + using (StreamReader sr = File.OpenText(disc)) + { + try + { + // Fast forward to the universal hash information + while (!sr.ReadLine().Trim().StartsWith("========== Hash(Universal Whole image) ==========")) ; + + // If we find the universal hash line, return the SHA-1 hash only + string line; + while (!sr.EndOfStream) + { + line = sr.ReadLine().TrimStart(); + if (line.StartsWith(" /// Get the write offset from the input file, if possible /// diff --git a/appveyor.yml b/appveyor.yml index 8d096752..f4cd1096 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -58,12 +58,12 @@ after_build: #- 7z e dd-0.6beta3.zip -oMPF\bin\Debug\net6.0-windows\osx-x64\publish\Programs\DD * # DiscImageCreator -- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/10555765/DiscImageCreator_20230201.zip -- 7z e DiscImageCreator_20230201.zip -oMPF\bin\Debug\net48\publish\Programs\Creator Release_ANSI\* -- 7z e DiscImageCreator_20230201.zip -oMPF\bin\Debug\net6.0-windows\win-x64\publish\Programs\Creator Release_ANSI\* -- 7z e DiscImageCreator_20230201.zip -oMPF\bin\Debug\net6.0-windows\win-x86\publish\Programs\Creator Release_ANSI\* -#- 7z e DiscImageCreator_20230201.zip -oMPF\bin\Debug\net6.0-windows\linux-x64\publish\Programs\Creator Release_ANSI\* -#- 7z e DiscImageCreator_20230201.zip -oMPF\bin\Debug\net6.0-windows\osx-x64\publish\Programs\Creator Release_ANSI\* +- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/10931241/DiscImageCreator_20230309.zip +- 7z e /DiscImageCreator_20230309.zip -oMPF\bin\Debug\net48\publish\Programs\Creator Release_ANSI\* +- 7z e /DiscImageCreator_20230309.zip -oMPF\bin\Debug\net6.0-windows\win-x64\publish\Programs\Creator Release_ANSI\* +- 7z e /DiscImageCreator_20230309.zip -oMPF\bin\Debug\net6.0-windows\win-x86\publish\Programs\Creator Release_ANSI\* +#- 7z e /DiscImageCreator_20230309.zip -oMPF\bin\Debug\net6.0-windows\linux-x64\publish\Programs\Creator Release_ANSI\* +#- 7z e /DiscImageCreator_20230309.zip -oMPF\bin\Debug\net6.0-windows\osx-x64\publish\Programs\Creator Release_ANSI\* # Redumper - ps: appveyor DownloadFile https://github.com/superg/redumper/releases/download/build_106/redumper-2023.02.19_build106-win64.zip