From 55cab8202d865272fc059465aea5336fc7ebab25 Mon Sep 17 00:00:00 2001 From: Deterous <138427222+Deterous@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:01:25 +0900 Subject: [PATCH] Subsume used DiscUtils libraries --- IRDKit/IRDKit.csproj | 7 ++++--- IRDKit/Program.cs | 22 ++++++++++------------ LibIRD.sln | 20 ++------------------ LibIRD/DiscUtils | 2 +- LibIRD/IRD.cs | 18 +++++++++--------- LibIRD/LibIRD.csproj | 14 +------------- LibIRD/ReIRD.cs | 5 ++--- 7 files changed, 29 insertions(+), 59 deletions(-) diff --git a/IRDKit/IRDKit.csproj b/IRDKit/IRDKit.csproj index 5d4626c..910c6ef 100644 --- a/IRDKit/IRDKit.csproj +++ b/IRDKit/IRDKit.csproj @@ -27,11 +27,12 @@ - - - + + + + diff --git a/IRDKit/Program.cs b/IRDKit/Program.cs index d13ab15..8a44100 100644 --- a/IRDKit/Program.cs +++ b/IRDKit/Program.cs @@ -1,9 +1,4 @@ -using CommandLine; -using DiscUtils; -using DiscUtils.Iso9660; -using LibIRD; -using SabreTools.RedumpLib.Web; -using System; +using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; @@ -12,6 +7,9 @@ using System.Linq; using System.Security.Cryptography; using System.Text; using System.Xml.Linq; +using CommandLine; +using LibIRD; +using SabreTools.RedumpLib.Web; namespace IRDKit { @@ -295,7 +293,7 @@ namespace IRDKit { PrintISO(file, opt.Json, file.Equals(lastISO), opt.OutPath); } - catch (InvalidFileSystemException) + catch (LibIRD.DiscUtils.InvalidFileSystemException) { // Not a valid ISO file despite extension, assume file is an IRD if (!opt.Json) @@ -476,7 +474,7 @@ namespace IRDKit PrintISO(inPath, json, single, outPath); return; } - catch (InvalidFileSystemException) + catch (LibIRD.DiscUtils.InvalidFileSystemException) { // Not a valid ISO file despite extension, try open as IRD } @@ -526,18 +524,18 @@ namespace IRDKit // Open ISO file for reading using FileStream fs = new(isoPath, FileMode.Open, FileAccess.Read); // Validate ISO file stream - if (fs == null || !CDReader.Detect(fs)) + if (fs == null || !LibIRD.DiscUtils.Iso9660.CDReader.Detect(fs)) { Console.Error.WriteLine($"{isoPath} is not a valid ISO file"); return; } // Create new ISO reader - using CDReader reader = new(fs, true, true); + using LibIRD.DiscUtils.Iso9660.CDReader reader = new(fs, true, true); // Write PS3_DISC.SFB info try { - using DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_DISC.SFB", FileMode.Open, FileAccess.Read); + using LibIRD.DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_DISC.SFB", FileMode.Open, FileAccess.Read); PS3_DiscSFB ps3_DiscSFB = new(s); if (json) { @@ -574,7 +572,7 @@ namespace IRDKit // Write PARAM.SFO info try { - using DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_GAME\\PARAM.SFO", FileMode.Open, FileAccess.Read); + using LibIRD.DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_GAME\\PARAM.SFO", FileMode.Open, FileAccess.Read); ParamSFO paramSFO = new(s); if (json) { diff --git a/LibIRD.sln b/LibIRD.sln index d51a12e..bd489bd 100644 --- a/LibIRD.sln +++ b/LibIRD.sln @@ -11,16 +11,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore + .gitmodules = .gitmodules LICENSE.txt = LICENSE.txt + publish-irdkit.ps1 = publish-irdkit.ps1 README.md = README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Core", "LibIRD\DiscUtils\Library\DiscUtils.Core\DiscUtils.Core.csproj", "{9E71F5CD-887D-4A61-8460-9F7E8F110B46}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Iso9660", "LibIRD\DiscUtils\Library\DiscUtils.Iso9660\DiscUtils.Iso9660.csproj", "{9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Streams", "LibIRD\DiscUtils\Library\DiscUtils.Streams\DiscUtils.Streams.csproj", "{E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -35,18 +31,6 @@ Global {9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Debug|Any CPU.Build.0 = Debug|Any CPU {9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Release|Any CPU.ActiveCfg = Release|Any CPU {9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Release|Any CPU.Build.0 = Release|Any CPU - {9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Release|Any CPU.Build.0 = Release|Any CPU - {9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Release|Any CPU.Build.0 = Release|Any CPU - {E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/LibIRD/DiscUtils b/LibIRD/DiscUtils index 299030c..bd00436 160000 --- a/LibIRD/DiscUtils +++ b/LibIRD/DiscUtils @@ -1 +1 @@ -Subproject commit 299030c20bfd9ae55997429b3a6487e68df967fc +Subproject commit bd00436598e2687004b4fb19c2968db046f0321c diff --git a/LibIRD/IRD.cs b/LibIRD/IRD.cs index 980ea80..5c1aa52 100644 --- a/LibIRD/IRD.cs +++ b/LibIRD/IRD.cs @@ -1,13 +1,13 @@ -using DiscUtils; -using DiscUtils.Iso9660; -using DiscUtils.Streams; -using System; +using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.IO.Hashing; using System.Security.Cryptography; using System.Text; +using LibIRD.DiscUtils; +using LibIRD.DiscUtils.Iso9660; +using LibIRD.DiscUtils.Streams; namespace LibIRD { @@ -540,11 +540,11 @@ namespace LibIRD private protected void ParseGetKeyLog(string getKeyLog) { // Validate .getkey.log file path - if (!File.Exists(getKeyLog)) + if (!System.IO.File.Exists(getKeyLog)) throw new FileNotFoundException(nameof(getKeyLog)); // Read from .getkey.log file - using StreamReader sr = File.OpenText(getKeyLog); + using StreamReader sr = System.IO.File.OpenText(getKeyLog); // Determine whether GetKey was successful string line; @@ -1363,7 +1363,7 @@ namespace LibIRD // Validate irdPath if (irdPath == null || irdPath.Length <= 0) throw new ArgumentNullException(nameof(irdPath)); - if (!File.Exists(irdPath)) + if (!System.IO.File.Exists(irdPath)) throw new FileNotFoundException(nameof(irdPath)); // Open IRD for reading @@ -1507,7 +1507,7 @@ namespace LibIRD } else { - File.AppendAllText(printPath, printText.ToString()); + System.IO.File.AppendAllText(printPath, printText.ToString()); } } @@ -1557,7 +1557,7 @@ namespace LibIRD else { // Write to path - File.AppendAllText(jsonPath, json.ToString()); + System.IO.File.AppendAllText(jsonPath, json.ToString()); } } diff --git a/LibIRD/LibIRD.csproj b/LibIRD/LibIRD.csproj index 17ec565..1f9f828 100644 --- a/LibIRD/LibIRD.csproj +++ b/LibIRD/LibIRD.csproj @@ -6,7 +6,7 @@ win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 latest true - 0.6.0 + 0.6.1 ../nupkg @@ -26,19 +26,7 @@ - - - - - $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage - - - - - - - diff --git a/LibIRD/ReIRD.cs b/LibIRD/ReIRD.cs index 8d36195..af279ae 100644 --- a/LibIRD/ReIRD.cs +++ b/LibIRD/ReIRD.cs @@ -1,5 +1,4 @@ -using DiscUtils.Iso9660; -using System; +using System; using System.IO; using System.IO.Hashing; @@ -135,7 +134,7 @@ namespace LibIRD { // If no layerbreak provided, ensure ISO is not BD-Video hybrid using FileStream fs = new FileStream(isoPath, FileMode.Open, FileAccess.Read) ?? throw new FileNotFoundException(isoPath); - CDReader reader = new(fs, true, true); + DiscUtils.Iso9660.CDReader reader = new(fs, true, true); if (reader.DirectoryExists("\\BDMV")) throw new ArgumentException("Layerbreak must be provided for BD-Video hybrid discs"); // Assume disc has default layerbreak