diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d6326c5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build + +on: + push: {} + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + project: [IRDKit] + runtime: [win-x86, win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64] + framework: [net8.0] + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c Release -p:DebugType=None -p:DebugSymbols=false + + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }} + path: ${{ matrix.project }}/bin/Release/${{ matrix.framework }}/${{ matrix.runtime }}/publish/* diff --git a/IRDKit/IRDKit.csproj b/IRDKit/IRDKit.csproj index 3ac14b6..3c11923 100644 --- a/IRDKit/IRDKit.csproj +++ b/IRDKit/IRDKit.csproj @@ -5,13 +5,16 @@ Exe irdkit irdkit - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0 win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 false latest true + true + true + false true - 0.9.3 + 0.9.4 Deterous @@ -30,6 +33,7 @@ + diff --git a/IRDKit/Program.cs b/IRDKit/Program.cs index 89ffed9..9d53ea1 100644 --- a/IRDKit/Program.cs +++ b/IRDKit/Program.cs @@ -7,6 +7,7 @@ using System.Xml.Linq; using CommandLine; using LibIRD; +using Nanook.GrindCore; using SabreTools.Hashing; using SabreTools.RedumpLib.Web; @@ -1061,7 +1062,7 @@ public static void RenameIRD(string irdPath, XDocument datfile, bool serial = fa } } -#endregion + #endregion #region Helper Functions @@ -1073,7 +1074,7 @@ public static void RenameIRD(string irdPath, XDocument datfile, bool serial = fa static byte[] Decompress(byte[] data) { using var compressedStream = new MemoryStream(data); - using var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress); + using var zipStream = new Nanook.GrindCore.GZip.GZipStream(compressedStream, Nanook.GrindCore.CompressionMode.Decompress); using var resultStream = new MemoryStream(); zipStream.CopyTo(resultStream); return resultStream.ToArray(); diff --git a/LibIRD/IRD.cs b/LibIRD/IRD.cs index 86713ec..c293be6 100644 --- a/LibIRD/IRD.cs +++ b/LibIRD/IRD.cs @@ -7,6 +7,7 @@ using LibIRD.DiscUtils; using LibIRD.DiscUtils.Iso9660; using LibIRD.DiscUtils.Streams; +using Nanook.GrindCore; using SabreTools.Hashing; namespace LibIRD @@ -788,7 +789,7 @@ private protected void GenerateIRD(string isoPath, bool redump = false) HashISO(fs, redump && UID == 0x00000000); } -#endregion + #endregion #region Reading ISO @@ -854,13 +855,7 @@ private void GetHeader(FileStream fs, CDReader reader) // Begin a GZip stream to write header to using MemoryStream headerStream = new(); -#if NET6_0_OR_GREATER - using (GZipStream gzStream = new(headerStream, CompressionLevel.SmallestSize)) -#elif NETCOREAPP || NET45_OR_GREATER - using (GZipStream gzStream = new(headerStream, CompressionLevel.Optimal)) -#else - using (GZipStream gzStream = new(headerStream, CompressionMode.Compress)) -#endif + using (Nanook.GrindCore.GZip.GZipStream gzStream = new(headerStream, Nanook.GrindCore.CompressionLevel.SmallestSize)) { // Start reading data from the beginning of the ISO file fs.Seek(0, SeekOrigin.Begin); @@ -888,13 +883,7 @@ private void GetFooter(FileStream fs) { // Begin a GZip stream to write footer to using MemoryStream footerStream = new(); -#if NET6_0_OR_GREATER - using (GZipStream gzStream = new(footerStream, CompressionLevel.SmallestSize)) -#elif NETCOREAPP || NET45_OR_GREATER - using (GZipStream gzStream = new(footerStream, CompressionLevel.Optimal)) -#else - using (GZipStream gzStream = new(footerStream, CompressionMode.Compress)) -#endif + using (Nanook.GrindCore.GZip.GZipStream gzStream = new(footerStream, Nanook.GrindCore.CompressionLevel.SmallestSize)) { // Start reading data from after last file (PS3UPDAT.PUP) fs.Seek(UpdateEnd, SeekOrigin.Begin); @@ -1427,13 +1416,7 @@ public void Write(string irdPath) // Create the IRD file stream using FileStream fs = new(irdPath, FileMode.Create, FileAccess.Write); // Create a GZipped IRD file stream -#if NET6_0_OR_GREATER - using GZipStream gzStream = new(fs, CompressionLevel.SmallestSize); -#elif NETCOREAPP || NET45_OR_GREATER - using GZipStream gzStream = new(fs, CompressionLevel.Optimal); -#else - using GZipStream gzStream = new(fs, CompressionMode.Compress); -#endif + using Nanook.GrindCore.GZip.GZipStream gzStream = new(fs, Nanook.GrindCore.CompressionLevel.SmallestSize); // Write entire gzipped IRD stream to file stream.Position = 0; #if NET40_OR_GREATER || NETCOREAPP @@ -1462,7 +1445,7 @@ public static IRD Read(string irdPath) // Open IRD for reading using FileStream fs = new(irdPath, FileMode.Open, FileAccess.Read); - using GZipStream gzs = new(fs, CompressionMode.Decompress); + using Nanook.GrindCore.GZip.GZipStream gzs = new(fs, Nanook.GrindCore.CompressionMode.Decompress); using BinaryReader br = new(gzs); // Check for IRD file signature @@ -1655,7 +1638,7 @@ public void PrintJson(string jsonPath = null, bool single = true) } } -#endregion + #endregion #region Helper Functions diff --git a/LibIRD/LibIRD.csproj b/LibIRD/LibIRD.csproj index 8a2ff15..24d0355 100644 --- a/LibIRD/LibIRD.csproj +++ b/LibIRD/LibIRD.csproj @@ -6,8 +6,9 @@ false latest true + true true - 0.9.3 + 0.9.4 ../nupkg @@ -30,19 +31,15 @@ - net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 + netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 - - - - - +