mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Apply Zip encoding patch from GordonJ
This commit is contained in:
@@ -33,6 +33,11 @@ namespace Compress.ZipFile
|
||||
|
||||
public ZipStatus ZipStatus { get; set; }
|
||||
|
||||
public Zip()
|
||||
{
|
||||
ZipUtils.EncodeSetup();
|
||||
}
|
||||
|
||||
public int LocalFilesCount()
|
||||
{
|
||||
return _localFiles.Count;
|
||||
|
||||
@@ -7,7 +7,15 @@ namespace Compress.ZipFile
|
||||
{
|
||||
// according to the zip documents, zip filesname are stored as MS-DOS Code Page 437.
|
||||
// (Unless the uncode flag is set, in which case they are stored as UTF-8.
|
||||
private static Encoding enc = Encoding.GetEncoding(437);
|
||||
private static Encoding enc = null;
|
||||
|
||||
public static void EncodeSetup()
|
||||
{
|
||||
if (enc != null)
|
||||
return;
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
enc = Encoding.GetEncoding(437);
|
||||
}
|
||||
|
||||
public static string GetString(byte[] byteArr)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -20,8 +20,16 @@ namespace SabreTools.IO
|
||||
|
||||
// If the input is not seekable, just return the current position
|
||||
if (!input.CanSeek)
|
||||
{
|
||||
try
|
||||
{
|
||||
return input.Position;
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Attempt to seek to the offset
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user