Skip to content
Closed
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
124 changes: 124 additions & 0 deletions installer/Wisp-zh-CN.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#define MyAppName "Wisp"
#define MyAppVersion "2.7.8"
#define MyAppDisplayVersion MyAppVersion
#define MyAppOutputVersion MyAppVersion
#define MyAppPublisher "Wisp (Simplified Chinese build)"
#define MyAppExeName "Wisp.exe"

[Setup]
AppId={{A8FC0D58-11E3-4B25-B78D-3B98E9855473}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppDisplayVersion}
AppPublisher={#MyAppPublisher}
AppMutex=Local\Wisp.SingleInstance
DefaultDirName={localappdata}\Programs\Wisp
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
PrivilegesRequired=lowest
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
OutputDir=..\outputs
OutputBaseFilename=Wisp-Setup-{#MyAppOutputVersion}-zh-CN
SetupIconFile=..\src\Wisp.App\Assets\Wisp.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern
CloseApplications=yes
RestartApplications=no
VersionInfoVersion={#MyAppVersion}.0
VersionInfoDescription=Wisp installer
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}.0

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "Create a desktop shortcut"; GroupDescription: "Additional shortcuts:"; Flags: unchecked

[Files]
Source: "..\artifacts\publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "Launch {#MyAppName}"; Flags: nowait postinstall skipifsilent

[Code]
const
WispUninstallKey = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{A8FC0D58-11E3-4B25-B78D-3B98E9855473}_is1';

var
UpdatingExistingInstallation: Boolean;

function SetupRequiredMarkerPath(): String;
begin
Result := ExpandConstant('{localappdata}\Wisp\setup-required');
end;

function UpdateSwitchPresent(): Boolean;
var
Index: Integer;
begin
Result := False;
for Index := 1 to ParamCount do
begin
if CompareText(ParamStr(Index), '/WISPUPDATE') = 0 then
begin
Result := True;
Exit;
end;
end;
end;

function ExistingInstallationPresent(): Boolean;
var
UninstallCommand: String;
begin
Result := RegQueryStringValue(
HKCU,
WispUninstallKey,
'UninstallString',
UninstallCommand) and (UninstallCommand <> '');
end;

function InitializeSetup(): Boolean;
begin
{ Capture this before Setup creates or refreshes its uninstall entry. Any install over a
registered installation keeps the completed setup, whether the update helper or the user
runs it; the helper's switch only marks its runs in the log. }
UpdatingExistingInstallation := ExistingInstallationPresent();
if UpdateSwitchPresent() then
Log('Started by the Wisp update helper.');
Result := True;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
SettingsDirectory: String;
begin
if CurStep <> ssPostInstall then
Exit;

{ An install over a registered installation preserves the completed setup
record. A fresh install, including one given /WISPUPDATE without an existing
registration, still has to pass through the setup wizard. }
if UpdatingExistingInstallation then
Exit;

SettingsDirectory := ExpandConstant('{localappdata}\Wisp');
if not ForceDirectories(SettingsDirectory) then
RaiseException('Wisp could not create its local settings directory.');
if not SaveStringToFile(SetupRequiredMarkerPath(), 'setup-required', False) then
RaiseException('Wisp could not create its setup requirement marker.');
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
RegDeleteValue(HKCU, 'Software\Microsoft\Windows\CurrentVersion\Run', 'Wisp');
end;
6 changes: 4 additions & 2 deletions src/Wisp.App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.ComponentModel;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Threading;
Expand Down Expand Up @@ -118,7 +118,9 @@ protected override async void OnStartup(StartupEventArgs e)
_activationCancellation = new CancellationTokenSource();

var settingsService = new SettingsService();
var settings = settingsService.Load();
var settings = settingsService.Load();
AppLocalization.SetLanguage(settings.Language);
AppLocalization.Install();
_controller = new AppController(settings, settingsService);
if (SoftwareRenderingActive) _controller.LocalNotices.Raise(LocalDashboardNotices.SoftwareRendering);
_uiStallWatchdog = DebugLogging.UiStallWatchdog.Start(Dispatcher);
Expand Down
Loading