From dcbe41f30aaad1da0d7445cabaf3e2f31f6cc46e Mon Sep 17 00:00:00 2001 From: Stuart Preston Date: Fri, 26 Jan 2018 12:28:39 +0000 Subject: [PATCH] Force codepage to 437, even in internernational (non-US) Windows installations Signed-off-by: Stuart Preston --- CustomActionFastMsi/CustomAction.cs | 19 ++++++++++++------- .../CustomActionFastMsi.csproj | 3 --- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CustomActionFastMsi/CustomAction.cs b/CustomActionFastMsi/CustomAction.cs index c423d57..3b0f885 100644 --- a/CustomActionFastMsi/CustomAction.cs +++ b/CustomActionFastMsi/CustomAction.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; +using ICSharpCode.SharpZipLib.Zip; using Microsoft.Deployment.WindowsInstaller; -using ICSharpCode.SharpZipLib.Zip; -using ICSharpCode.SharpZipLib.Core; +using System.Diagnostics; +using System.IO; namespace CustomActionFastMsi { @@ -36,11 +33,19 @@ public static ActionResult FastUnzip(Session session) var fastzip = new FastZip(); + // Force zip library to use codepage 437 (IBM PC US) rather than autodetecting the system codepage. + // ref: http://community.sharpdevelop.net/forums/t/19065.aspx + // ref: https://stackoverflow.com/questions/46950386/sharpziplib-1-is-not-a-supported-code-page + ZipConstants.DefaultCodePage = 437; + session.Log("Starting extraction"); + var stopWatch = new Stopwatch(); + stopWatch.Start(); fastzip.ExtractZip(zipFile, Path.Combine(targetDir, appName), null); + stopWatch.Stop(); - session.Log("Finished extraction"); + session.Log(string.Format("Finished extraction (time taken: {0} ms)", stopWatch.ElapsedMilliseconds)); File.Delete(zipFile); diff --git a/CustomActionFastMsi/CustomActionFastMsi.csproj b/CustomActionFastMsi/CustomActionFastMsi.csproj index f73bcdb..581d622 100644 --- a/CustomActionFastMsi/CustomActionFastMsi.csproj +++ b/CustomActionFastMsi/CustomActionFastMsi.csproj @@ -37,9 +37,6 @@ ext\ICSharpCode.SharpZipLib.dll - - - True