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

View file

@ -87,23 +87,54 @@ var
oPortablePageStaticChoice: TNewRadioButton;
oPortablePagePortableChoice: TNewRadioButton;
function FindRegistryKey(): String; forward;
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;
// InnoSetup
procedure InitializeWizard; forward;
function ShouldSkipPage(PageID: Integer): Boolean; 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
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;
// ------------------------------------------------------------------------------------------------------------------ //
@ -133,6 +164,12 @@ begin
Result := sInstallPath
end;
// ------------------------------------------------------------------------------------------------------------------ //
function FindRegistryKey(): String;
begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
end;
// ------------------------------------------------------------------------------------------------------------------ //
function GetUninstallerPath(): String;
var
@ -325,30 +362,3 @@ begin
Result := oPage;
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;