diff --git a/OpenRA.Game/FileFormats/Png.cs b/OpenRA.Game/FileFormats/Png.cs index d35e013e28..5f980ae33a 100644 --- a/OpenRA.Game/FileFormats/Png.cs +++ b/OpenRA.Game/FileFormats/Png.cs @@ -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; diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs index a34e8c8a3e..e21214e833 100644 --- a/OpenRA.Game/FileSystem/ZipFile.cs +++ b/OpenRA.Game/FileSystem/ZipFile.cs @@ -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; } diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 1dfc7e5bd4..ebe19e6bd2 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -160,7 +160,6 @@ - diff --git a/OpenRA.Game/Primitives/ZipFileHelper.cs b/OpenRA.Game/Primitives/ZipFileHelper.cs deleted file mode 100644 index 925da06d97..0000000000 --- a/OpenRA.Game/Primitives/ZipFileHelper.cs +++ /dev/null @@ -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 - { - /// - /// Creates a with UTF8 encoding. Avoid using as you - /// cannot be sure of the encoding that will be used. - /// - 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); - } - - /// - /// Creates a with UTF8 encoding. Avoid using as you - /// cannot be sure of the encoding that will be used. - /// - public static ZipFile Create(FileStream stream) - { - ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage; - return new ZipFile(stream); - } - } -} diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs index 9c80099f83..6dea1a00a9 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs @@ -15,6 +15,7 @@ using System.ComponentModel; using System.IO; using System.Net; using System.Text; +using ICSharpCode.SharpZipLib.Zip; using OpenRA.Primitives; using OpenRA.Support; using OpenRA.Widgets; @@ -144,7 +145,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic try { using (var stream = File.OpenRead(file)) - using (var z = ZipFileHelper.Create(stream)) + using (var z = new ZipFile(stream)) { foreach (var kv in download.Extract) { diff --git a/thirdparty/fetch-thirdparty-deps.ps1 b/thirdparty/fetch-thirdparty-deps.ps1 index b00eec957b..fac79da9ea 100644 --- a/thirdparty/fetch-thirdparty-deps.ps1 +++ b/thirdparty/fetch-thirdparty-deps.ps1 @@ -30,8 +30,8 @@ if (!(Test-Path "StyleCop.dll")) if (!(Test-Path "ICSharpCode.SharpZipLib.dll")) { echo "Fetching ICSharpCode.SharpZipLib from NuGet." - ./nuget.exe install SharpZipLib -Version 0.86.0 -ExcludeVersion -Verbosity quiet -Source nuget.org - cp SharpZipLib/lib/20/ICSharpCode.SharpZipLib.dll . + ./nuget.exe install SharpZipLib -Version 1.1.0 -ExcludeVersion -Verbosity quiet -Source nuget.org + cp SharpZipLib/lib/net45/ICSharpCode.SharpZipLib.dll . rmdir SharpZipLib -Recurse } diff --git a/thirdparty/fetch-thirdparty-deps.sh b/thirdparty/fetch-thirdparty-deps.sh index d97214439d..4e93e03ac1 100755 --- a/thirdparty/fetch-thirdparty-deps.sh +++ b/thirdparty/fetch-thirdparty-deps.sh @@ -29,8 +29,8 @@ fi if [ ! -f ICSharpCode.SharpZipLib.dll ]; then echo "Fetching ICSharpCode.SharpZipLib from NuGet" - ../noget.sh SharpZipLib 0.86.0 - cp ./SharpZipLib/lib/20/ICSharpCode.SharpZipLib.dll . + ../noget.sh SharpZipLib 1.1.0 + cp ./SharpZipLib/lib/net45/ICSharpCode.SharpZipLib.dll . rm -rf SharpZipLib fi