Update SharpZipLib to 1.1.0.

The default code page has been changed to UTF8
so our workarounds are no longer needed.
This commit is contained in:
Paul Chote
2019-03-30 15:46:05 +00:00
committed by Oliver Brakmann
parent 9cbf08201f
commit f69c6ab3fb
7 changed files with 9 additions and 55 deletions

View File

@@ -15,7 +15,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Checksum;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using OpenRA.Primitives;

View File

@@ -33,7 +33,7 @@ namespace OpenRA.FileSystem
public ReadOnlyZipFile(Stream s, string filename)
{
Name = filename;
pkg = ZipFileHelper.Create(s);
pkg = new ZipFile(s);
}
public Stream GetStream(string filename)
@@ -113,7 +113,7 @@ namespace OpenRA.FileSystem
}
pkgStream.Position = 0;
pkg = ZipFileHelper.Create(pkgStream);
pkg = new ZipFile(pkgStream);
Name = filename;
}

View File

@@ -160,7 +160,6 @@
<Compile Include="Primitives\Size.cs" />
<Compile Include="Primitives\SpatiallyPartitioned.cs" />
<Compile Include="Primitives\ConcurrentCache.cs" />
<Compile Include="Primitives\ZipFileHelper.cs" />
<Compile Include="SelectableExts.cs" />
<Compile Include="Selection.cs" />
<Compile Include="Server\Connection.cs" />

View File

@@ -1,46 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.IO;
using System.Text;
using ICSharpCode.SharpZipLib.Zip;
namespace OpenRA.Primitives
{
public static class ZipFileHelper
{
/// <summary>
/// Creates a <see cref="ZipFile"/> with UTF8 encoding. Avoid using <see cref="ZipFile(Stream)"/> as you
/// cannot be sure of the encoding that will be used.
/// </summary>
public static ZipFile Create(Stream stream)
{
// SharpZipLib uses this global as the encoding to use for all ZipFiles.
// The initial value is the system code page, which causes several problems.
// 1) On some systems, the code page for a certain encoding might not even be installed.
// 2) The code page is different on every system, resulting in unpredictability.
// 3) The code page might not work for decoding some archives.
// We set the default to UTF8 instead which fixes all these problems.
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
return new ZipFile(stream);
}
/// <summary>
/// Creates a <see cref="ZipFile"/> with UTF8 encoding. Avoid using <see cref="ZipFile(FileStream)"/> as you
/// cannot be sure of the encoding that will be used.
/// </summary>
public static ZipFile Create(FileStream stream)
{
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
return new ZipFile(stream);
}
}
}