Update packages

This commit is contained in:
Matt Nadareski
2026-03-05 11:27:45 -05:00
parent e9eb3eb4be
commit ebe4ff7426
8 changed files with 60 additions and 79 deletions

View File

@@ -49,8 +49,8 @@
<ItemGroup>
<PackageReference Include="SabreTools.CommandLine" Version="[1.4.0]" />
<PackageReference Include="SabreTools.IO" Version="[1.9.0]" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="SabreTools.IO" Version="[1.9.1]" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.3" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
</ItemGroup>
</Project>

View File

@@ -33,8 +33,8 @@
<ItemGroup>
<PackageReference Include="SabreTools.CommandLine" Version="[1.4.0]" />
<PackageReference Include="SabreTools.Hashing" Version="[1.6.0]" />
<PackageReference Include="SabreTools.IO" Version="[1.9.0]" />
<PackageReference Include="SabreTools.Hashing" Version="[1.6.1]" />
<PackageReference Include="SabreTools.IO" Version="[1.9.1]" />
</ItemGroup>
</Project>

View File

@@ -22,12 +22,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="coverlet.collector" Version="8.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="SabreTools.Hashing" Version="[1.6.0]" />
<PackageReference Include="SabreTools.Hashing" Version="[1.6.1]" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -905,7 +905,7 @@ namespace SabreTools.Serialization.Readers
obj.ClassResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
}
#endregion
@@ -931,7 +931,7 @@ namespace SabreTools.Serialization.Readers
obj.TitleResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
}
#endregion
@@ -945,7 +945,7 @@ namespace SabreTools.Serialization.Readers
#endregion
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
return obj;
}
@@ -995,7 +995,7 @@ namespace SabreTools.Serialization.Readers
obj.ClassResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
}
#endregion
@@ -1021,7 +1021,7 @@ namespace SabreTools.Serialization.Readers
obj.TitleResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
}
#endregion
@@ -1035,7 +1035,7 @@ namespace SabreTools.Serialization.Readers
#endregion
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
return obj;
}
@@ -1081,7 +1081,7 @@ namespace SabreTools.Serialization.Readers
obj.MenuResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
// Read the ordinal if we have the flag set
if (menuResourceHasOrdinal)
@@ -1117,7 +1117,7 @@ namespace SabreTools.Serialization.Readers
obj.ClassResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
// Read the ordinal if we have the flag set
if (classResourcehasOrdinal)
@@ -1148,7 +1148,7 @@ namespace SabreTools.Serialization.Readers
obj.TitleResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
}
#endregion
@@ -1169,7 +1169,7 @@ namespace SabreTools.Serialization.Readers
}
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
#endregion
@@ -1220,7 +1220,7 @@ namespace SabreTools.Serialization.Readers
obj.MenuResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
// Read the ordinal if we have the flag set
if (menuResourceHasOrdinal)
@@ -1252,7 +1252,7 @@ namespace SabreTools.Serialization.Readers
obj.ClassResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
// Read the ordinal if we have the flag set
if (classResourcehasOrdinal)
@@ -1279,7 +1279,7 @@ namespace SabreTools.Serialization.Readers
obj.TitleResource = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the WORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 2);
data.AlignToBoundary(ref offset, 2);
}
#endregion
@@ -1301,7 +1301,7 @@ namespace SabreTools.Serialization.Readers
}
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
#endregion
@@ -2079,7 +2079,7 @@ namespace SabreTools.Serialization.Readers
extendedMenuItems.Add(extendedMenuItem);
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
}
}
@@ -2110,7 +2110,7 @@ namespace SabreTools.Serialization.Readers
menuItem = ParseNormalMenuItem(data, ref offset);
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
if (menuItem is null)
return null;
@@ -2817,7 +2817,7 @@ namespace SabreTools.Serialization.Readers
}
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
var stringFileInfoChildren = new List<Data.Models.PortableExecutable.Resource.Entries.StringTable>();
while ((offset - currentOffset) < obj.Length)
@@ -2848,7 +2848,7 @@ namespace SabreTools.Serialization.Readers
obj.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
if (obj.ValueLength > 0)
{
@@ -2858,7 +2858,7 @@ namespace SabreTools.Serialization.Readers
}
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
return obj;
}
@@ -2908,7 +2908,7 @@ namespace SabreTools.Serialization.Readers
obj.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty;
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
var stringTableChildren = new List<Data.Models.PortableExecutable.Resource.Entries.StringData>();
while ((offset - initialOffset) < obj.Length)
@@ -3053,7 +3053,7 @@ namespace SabreTools.Serialization.Readers
return null;
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
var varFileInfoChildren = new List<Data.Models.PortableExecutable.Resource.Entries.VarData>();
while ((offset - initialOffset) < obj.Length)
@@ -3071,7 +3071,7 @@ namespace SabreTools.Serialization.Readers
}
// Align to the DWORD boundary if we're not at the end
AlignToBoundary(data, ref offset, 4);
data.AlignToBoundary(ref offset, 4);
// Cache the current offset
int currentOffset = offset;
@@ -3152,37 +3152,5 @@ namespace SabreTools.Serialization.Readers
return obj;
}
#region Helpers
/// <summary>
/// Align the array position to a byte-size boundary
/// </summary>
/// <param name="input">Input array to try aligning</param>
/// <param name="offset">Offset into the byte array</param>
/// <param name="alignment">Number of bytes to align on</param>
/// <returns>True if the array could be aligned, false otherwise</returns>
/// TODO: Remove when IO is updated
private static bool AlignToBoundary(byte[]? input, ref int offset, byte alignment)
{
// If the array is invalid
if (input is null || input.Length == 0)
return false;
// If already at the end of the array
if (offset >= input.Length)
return false;
// Align the stream position
while (offset % alignment != 0 && offset < input.Length)
{
_ = input.ReadByteValue(ref offset);
}
// Return if the alignment completed
return offset % alignment == 0;
}
#endregion
}
}

View File

@@ -43,12 +43,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="GrindCore" Version="0.6.5" />
<PackageReference Include="GrindCore.SharpCompress" Version="0.41.3" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="GrindCore" Version="0.7.0" />
<PackageReference Include="GrindCore.SharpCompress" Version="0.46.2" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="NetLegacySupport.Numerics" Version="1.0.1" Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`))" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="SabreTools.Hashing" Version="[1.6.0]" />
<PackageReference Include="SabreTools.IO" Version="[1.9.0]" />
<PackageReference Include="SabreTools.Hashing" Version="[1.6.1]" />
<PackageReference Include="SabreTools.IO" Version="[1.9.1]" />
</ItemGroup>
</Project>

View File

@@ -27,7 +27,9 @@ namespace SabreTools.Serialization.Wrappers
try
{
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
var zipFile = ZipArchive.Open(_dataSource, readerOptions);
var zipFile = ZipArchive.OpenArchive(_dataSource, readerOptions) as ZipArchive;
if (zipFile is null)
return false;
// If the file exists
if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!))
@@ -37,11 +39,15 @@ namespace SabreTools.Serialization.Wrappers
// If there are multiple parts
if (parts.Length > 1)
zipFile = ZipArchive.Open(parts, readerOptions);
zipFile = ZipArchive.OpenArchive(parts, readerOptions) as ZipArchive;
// Try to read the file path if no entries are found
else if (zipFile.Entries.Count == 0)
zipFile = ZipArchive.Open(parts, readerOptions);
zipFile = ZipArchive.OpenArchive(parts, readerOptions) as ZipArchive;
// If the archive is somehow null
if (zipFile is null)
return false;
}
foreach (var entry in zipFile.Entries)

View File

@@ -5,7 +5,6 @@ using System.Text.RegularExpressions;
#if NET462_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
using SharpCompress.Archives;
using SharpCompress.Archives.Rar;
using SharpCompress.Common;
using SharpCompress.Readers;
#endif
@@ -33,7 +32,9 @@ namespace SabreTools.Serialization.Wrappers
try
{
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
RarArchive rarFile = RarArchive.Open(_dataSource, readerOptions);
var rarFile = RarArchive.OpenArchive(_dataSource, readerOptions) as RarArchive;
if (rarFile is null)
return false;
// If the file exists
if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!))
@@ -43,11 +44,15 @@ namespace SabreTools.Serialization.Wrappers
// If there are multiple parts
if (parts.Length > 1)
rarFile = RarArchive.Open(parts, readerOptions);
rarFile = RarArchive.OpenArchive(parts, readerOptions) as RarArchive;
// Try to read the file path if no entries are found
else if (rarFile.Entries.Count == 0)
rarFile = RarArchive.Open(parts, readerOptions);
rarFile = RarArchive.OpenArchive(parts, readerOptions) as RarArchive;
// If the archive is somehow null
if (rarFile is null)
return false;
}
// Explained in https://github.com/adamhathcock/sharpcompress/pull/661. in order to determine whether
@@ -273,11 +278,7 @@ namespace SabreTools.Serialization.Wrappers
if (!Directory.Exists(outDir))
Directory.CreateDirectory(outDir);
rarFile.WriteToDirectory(outDir, new ExtractionOptions()
{
ExtractFullPath = true,
Overwrite = true,
});
rarFile.WriteToDirectory(outDir);
}
catch (Exception ex)

View File

@@ -32,7 +32,9 @@ namespace SabreTools.Serialization.Wrappers
try
{
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
var sevenZip = SevenZipArchive.Open(_dataSource, readerOptions);
var sevenZip = SevenZipArchive.OpenArchive(_dataSource, readerOptions) as SevenZipArchive;
if (sevenZip is null)
return false;
// If the file exists
if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!))
@@ -42,11 +44,15 @@ namespace SabreTools.Serialization.Wrappers
// If there are multiple parts
if (parts.Length > 1)
sevenZip = SevenZipArchive.Open(parts, readerOptions);
sevenZip = SevenZipArchive.OpenArchive(parts, readerOptions) as SevenZipArchive;
// Try to read the file path if no entries are found
else if (sevenZip.Entries.Count == 0)
sevenZip = SevenZipArchive.Open(parts, readerOptions);
sevenZip = SevenZipArchive.OpenArchive(parts, readerOptions) as SevenZipArchive;
// If the archive is somehow null
if (sevenZip is null)
return false;
}
// Explained in https://github.com/adamhathcock/sharpcompress/pull/661. in order to determine whether