Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force codepage to 437, even in international (non-US) Windows installations #4

Merged
merged 1 commit into from
Jan 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions CustomActionFastMsi/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 0 additions & 3 deletions CustomActionFastMsi/CustomActionFastMsi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
<HintPath>ext\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
Expand Down