templates/windows/installer: Formatting

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-09-17 09:48:26 +02:00
parent c9239405e2
commit 63540faf3d
1 changed files with 167 additions and 157 deletions

View File

@ -87,23 +87,54 @@ var
oPortablePageStaticChoice: TNewRadioButton; oPortablePageStaticChoice: TNewRadioButton;
oPortablePagePortableChoice: TNewRadioButton; oPortablePagePortableChoice: TNewRadioButton;
function FindRegistryKey(): String; forward; // InnoSetup
function GetDefaultDirectory(Value: String): String; forward;
function GetUninstallerPath(): String; forward;
function IsUpgrade(): Boolean; forward;
function IsPortablePagePortableChoiceChecked(): Boolean; forward;
function UninstallOldVersion(): Integer; forward;
procedure OnPortablePagePortableChoiceClick(Sender: TObject); forward;
procedure OnPortablePageStaticChoiceClick(Sender: TObject); forward;
function CreatePortablePage: TWizardPage; forward;
procedure InitializeWizard; forward; procedure InitializeWizard; forward;
function ShouldSkipPage(PageID: Integer): Boolean; forward; function ShouldSkipPage(PageID: Integer): Boolean; forward;
function PrepareToInstall(var NeedsRestart: Boolean): String; forward; function PrepareToInstall(var NeedsRestart: Boolean): String; forward;
function GetDefaultDirectory(Value: String): String; forward;
// Which installation mode is selected?
function IsPortablePagePortableChoiceChecked(): Boolean; forward;
// Other Metadata
function FindRegistryKey(): String; forward;
function GetUninstallerPath(): String; forward;
function IsUpgrade(): Boolean; forward;
function UninstallOldVersion(): Integer; forward;
// Mode Page
function CreatePortablePage: TWizardPage; forward;
procedure OnPortablePagePortableChoiceClick(Sender: TObject); forward;
procedure OnPortablePageStaticChoiceClick(Sender: TObject); forward;
// ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ //
function FindRegistryKey(): String; procedure InitializeWizard;
var
oPortablePage: TWizardPage;
begin begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1'); oPortablePage := CreatePortablePage();
end;
// ------------------------------------------------------------------------------------------------------------------ //
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
end;
// ------------------------------------------------------------------------------------------------------------------ //
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
iResultCode: Integer;
begin
// Attempt to remove old version if it exists.
if (IsUpgrade()) then begin
UninstallOldVersion();
end;
// Also ensure that we have the necessary prerequisites installed to run the program.
ExtractTemporaryFile('msvc-redist-helper.exe');
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, iResultCode);
end; end;
// ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ //
@ -133,6 +164,12 @@ begin
Result := sInstallPath Result := sInstallPath
end; end;
// ------------------------------------------------------------------------------------------------------------------ //
function FindRegistryKey(): String;
begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
end;
// ------------------------------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------------------------------ //
function GetUninstallerPath(): String; function GetUninstallerPath(): String;
var var
@ -325,30 +362,3 @@ begin
Result := oPage; Result := oPage;
end; end;
procedure InitializeWizard;
var
oPortablePage: TWizardPage;
begin
oPortablePage := CreatePortablePage();
end;
// ------------------------------------------------------------------------------------------------------------------ //
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
end;
// ------------------------------------------------------------------------------------------------------------------ //
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
iResultCode: Integer;
begin
// Attempt to remove old version if it exists.
if (IsUpgrade()) then begin
UninstallOldVersion();
end;
// Also ensure that we have the necessary prerequisites installed to run the program.
ExtractTemporaryFile('msvc-redist-helper.exe');
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, iResultCode);
end;