Ensure we set ZipConstants.DefaultCodePage by using a helper method.
We were currently dealing with this terrible global variable in FileSystem/ZipFile.cs previously, but other parts of the code such as DownloadPackageLogic were creating these files too, and may not have executed the static ctors that fixed the encoding yet.
This commit is contained in:
committed by
Paul Chote
parent
1f436ad0cb
commit
297f4ad9ed
@@ -13,9 +13,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using SZipFile = ICSharpCode.SharpZipLib.Zip.ZipFile;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.FileSystem
|
||||
{
|
||||
@@ -26,12 +25,7 @@ namespace OpenRA.FileSystem
|
||||
class ReadOnlyZipFile : IReadOnlyPackage
|
||||
{
|
||||
public string Name { get; protected set; }
|
||||
protected SZipFile pkg;
|
||||
|
||||
static ReadOnlyZipFile()
|
||||
{
|
||||
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
|
||||
}
|
||||
protected ZipFile pkg;
|
||||
|
||||
// Dummy constructor for use with ReadWriteZipFile
|
||||
protected ReadOnlyZipFile() { }
|
||||
@@ -39,7 +33,7 @@ namespace OpenRA.FileSystem
|
||||
public ReadOnlyZipFile(Stream s, string filename)
|
||||
{
|
||||
Name = filename;
|
||||
pkg = new SZipFile(s);
|
||||
pkg = ZipFileHelper.Create(s);
|
||||
}
|
||||
|
||||
public Stream GetStream(string filename)
|
||||
@@ -117,7 +111,7 @@ namespace OpenRA.FileSystem
|
||||
}
|
||||
|
||||
pkgStream.Position = 0;
|
||||
pkg = new SZipFile(pkgStream);
|
||||
pkg = ZipFileHelper.Create(pkgStream);
|
||||
Name = filename;
|
||||
}
|
||||
|
||||
@@ -152,11 +146,6 @@ namespace OpenRA.FileSystem
|
||||
public ReadOnlyZipFile Parent { get; private set; }
|
||||
readonly string path;
|
||||
|
||||
static ZipFolder()
|
||||
{
|
||||
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
|
||||
}
|
||||
|
||||
public ZipFolder(ReadOnlyZipFile parent, string path)
|
||||
{
|
||||
if (path.EndsWith("/", StringComparison.Ordinal))
|
||||
|
||||
Reference in New Issue
Block a user