Merge pull request #1359 from mhartvig/Codepage

Add support to override default Codepage
This commit is contained in:
Paul Betts
2018-09-18 21:56:35 -07:00
committed by GitHub
4 changed files with 15 additions and 7 deletions

1
.gitignore vendored
View File

@@ -181,3 +181,4 @@ tests/Test.xml
## CPP db crap ## CPP db crap
*.db *.db
*.opendb *.opendb
.vs/

View File

@@ -12,7 +12,9 @@ Squirrel uses information from your app's EXE as well as the NuGet package Metad
* **Version** - version specified in `Properties\Assembly.cs`. * **Version** - version specified in `Properties\Assembly.cs`.
* Name of the release package (e.g., MyApp-**1.0.0**-full.nupkg). * Name of the release package (e.g., MyApp-**1.0.0**-full.nupkg).
* Version number in the Windows Uninstaller (see screenshot below). * Version number in the Windows Uninstaller (see screenshot below).
* **Icon Url** - url to an icon to be used for the application. Used for the shortcuts and Windows Uninstaller icons. This must be an icon file (*.ICO) to work correctly. Note that the icon is fetched at installation time rather than packaging (source: [issue #745](https://github.com/Squirrel/Squirrel.Windows/issues/745)) * **Icon Url** - url to an icon to be used for the application. Used for the shortcuts and Windows Uninstaller icons. This must be an icon file (*.ICO) to work correctly. Note that the icon is fetched at installation time rather than
packaging (source: [issue #745](https://github.com/Squirrel/Squirrel.Windows/issues/745))
* **Language** Changes the codepage in to support non english characters. Defaults to 1252 if not present.
![](images/uninstall-app.png) ![](images/uninstall-app.png)

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
@@ -725,6 +726,9 @@ namespace Squirrel.Update
var setupExeDir = Path.GetDirectoryName(setupExe); var setupExeDir = Path.GetDirectoryName(setupExe);
var company = String.Join(",", package.Authors); var company = String.Join(",", package.Authors);
var culture = CultureInfo.GetCultureInfo(package.Language ?? "").TextInfo.ANSICodePage;
var templateText = File.ReadAllText(Path.Combine(pathToWix, "template.wxs")); var templateText = File.ReadAllText(Path.Combine(pathToWix, "template.wxs"));
var templateData = new Dictionary<string, string> { var templateData = new Dictionary<string, string> {
{ "Id", package.Id }, { "Id", package.Id },
@@ -732,6 +736,7 @@ namespace Squirrel.Update
{ "Author", company }, { "Author", company },
{ "Version", Regex.Replace(package.Version.ToString(), @"-.*$", "") }, { "Version", Regex.Replace(package.Version.ToString(), @"-.*$", "") },
{ "Summary", package.Summary ?? package.Description ?? package.Id }, { "Summary", package.Summary ?? package.Description ?? package.Id },
{ "Codepage", $"{culture}" }
}; };
// NB: We need some GUIDs that are based on the package ID, but unique (i.e. // NB: We need some GUIDs that are based on the package ID, but unique (i.e.

View File

@@ -1,5 +1,5 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="{{Title}} Machine-Wide Installer" Language="1033" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}"> <Product Id="*" Name="{{Title}} Machine-Wide Installer" Language="1033" Codepage="{{Codepage}}" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}">
<Package Description="#Description" Comments="Comments" InstallerVersion="200" Compressed="yes"/> <Package Description="#Description" Comments="Comments" InstallerVersion="200" Compressed="yes"/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/> <Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>