Skip to content

Commit

Permalink
Revert "Fix Installer .NET check logic"
Browse files Browse the repository at this point in the history
This reverts commit 4396096.
  • Loading branch information
iodes committed Aug 15, 2022
1 parent 4396096 commit 2b894bd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 96 deletions.
100 changes: 5 additions & 95 deletions Installer/Dependencies.iss → Installer/CodeDependencies.iss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; -- Dependencies.iss --
; -- CodeDependencies.iss --
;
; This script shows how to download and install any dependency such as .NET,
; Visual C++ or SQL Server during your application's installation process.
Expand Down Expand Up @@ -28,74 +28,6 @@ var
Dependency_NeedRestart, Dependency_ForceX86: Boolean;
Dependency_DownloadPage: TDownloadWizardPage;
function StrSplit(Text: String; Separator: String): TArrayOfString;
var
i, p: Integer;
Dest: TArrayOfString;
begin
i := 0;
repeat
SetArrayLength(Dest, i+1);
p := Pos(Separator,Text);
if p > 0 then begin
Dest[i] := Copy(Text, 1, p-1);
Text := Copy(Text, p + Length(Separator), Length(Text));
i := i + 1;
end else begin
Dest[i] := Text;
Text := '';
end;
until Length(Text)=0;
Result := Dest
end;
function CompareVersion(V1, V2: string): Integer;
var
P, N1, N2: Integer;
begin
Result := 0;
while (Result = 0) and ((V1 <> '') or (V2 <> '')) do
begin
P := Pos('.', V1);
if P > 0 then
begin
N1 := StrToInt(Copy(V1, 1, P - 1));
Delete(V1, 1, P);
end
else
if V1 <> '' then
begin
N1 := StrToInt(V1);
V1 := '';
end
else
begin
N1 := 0;
end;
P := Pos('.', V2);
if P > 0 then
begin
N2 := StrToInt(Copy(V2, 1, P - 1));
Delete(V2, 1, P);
end
else
if V2 <> '' then
begin
N2 := StrToInt(V2);
V2 := '';
end
else
begin
N2 := 0;
end;
if N1 < N2 then Result := -1
else
if N1 > N2 then Result := 1;
end;
end;
procedure Dependency_Add(const Filename, Parameters, Title, URL, Checksum: String; const ForceSuccess, RestartAfter: Boolean);
var
Dependency: TDependency_Entry;
Expand Down Expand Up @@ -291,35 +223,13 @@ end;
function Dependency_IsNetCoreInstalled(const Version: String): Boolean;
var
I: Integer;
ResultCode: Integer;
VersionCompare: Integer;
RequiredVersionArray: TArrayOfString;
InstalledVersionArray: TArrayOfString;
NetCoreRegistryKey: String;
begin
RequiredVersionArray := StrSplit(Version, ' ');
NetCoreRegistryKey := 'SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\' + RequiredVersionArray[0];
if not IsWin64 then
NetCoreRegistryKey := 'SOFTWARE\dotnet\Setup\InstalledVersions\x86\sharedfx\Microsoft.NETCore.App' + RequiredVersionArray[0];
if not RegGetValueNames(HKLM, NetCoreRegistryKey, InstalledVersionArray) then begin
Result := False;
Exit;
// source code: https://github.com/dotnet/deployment-tools/tree/master/src/clickonce/native/projects/NetCoreCheck
if not FileExists(ExpandConstant('{tmp}{\}') + 'netcorecheck' + Dependency_ArchSuffix + '.exe') then begin
ExtractTemporaryFile('netcorecheck' + Dependency_ArchSuffix + '.exe');
end;
for I := 0 to GetArrayLength(InstalledVersionArray) - 1 do
begin
VersionCompare := CompareVersion(InstalledVersionArray[I], RequiredVersionArray[1]);
if not (VersionCompare = -1) then begin
Result := True;
Exit;
end;
end;
Result := False;
Result := ShellExec('', ExpandConstant('{tmp}{\}') + 'netcorecheck' + Dependency_ArchSuffix + '.exe', Version, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0);
end;
procedure Dependency_AddDotNet35;
Expand Down
3 changes: 2 additions & 1 deletion Installer/Setup.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define public Dependency_NoExampleSetup
#include "Dependencies.iss"
#include "CodeDependencies.iss"

#define MyAppName "GestureWheel"
#define MyAppVersion "1.1.0.0"
Expand Down Expand Up @@ -58,6 +58,7 @@ begin
end;
[Files]
Source: "Utilities\*"; Flags: dontcopy noencryption
Source: "..\GestureWheel\bin\Release\net6.0-windows\publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; BeforeInstall: TaskKill('{#MyAppExeName}')

[UninstallDelete]
Expand Down
Binary file added Installer/Utilities/netcorecheck.exe
Binary file not shown.
Binary file added Installer/Utilities/netcorecheck_x64.exe
Binary file not shown.

0 comments on commit 2b894bd

Please sign in to comment.