mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-31 17:34:14 +02:00
Refactor installation files (move .NET Framework check to a function)
This commit is contained in:
parent
82beb1f5a7
commit
7e3014c52d
@ -56,22 +56,12 @@ Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Cache"
|
|||||||
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
function InitializeSetup: Boolean;
|
function TDGetNetFrameworkVersion: Cardinal; forward;
|
||||||
var FrameworkVersion: Cardinal;
|
|
||||||
var HasCorrectVersion: Boolean;
|
|
||||||
|
|
||||||
|
{ Check .NET Framework version on startup, ask user if they want to proceed if older than 4.5.1. }
|
||||||
|
function InitializeSetup: Boolean;
|
||||||
begin
|
begin
|
||||||
HasCorrectVersion := False;
|
if TDGetNetFrameworkVersion() >= 379893 then
|
||||||
|
|
||||||
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then
|
|
||||||
begin
|
|
||||||
if FrameworkVersion >= 379893 then
|
|
||||||
begin
|
|
||||||
HasCorrectVersion := True;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if HasCorrectVersion then
|
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
Exit;
|
Exit;
|
||||||
@ -86,6 +76,7 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Ask user if they want to delete 'AppData\TweetDuck' and 'plugins' folders after uninstallation. }
|
||||||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||||
var ProfileDataFolder: String;
|
var ProfileDataFolder: String;
|
||||||
var PluginDataFolder: String;
|
var PluginDataFolder: String;
|
||||||
@ -103,4 +94,18 @@ begin
|
|||||||
DelTree(ExpandConstant('{app}'), True, False, False);
|
DelTree(ExpandConstant('{app}'), True, False, False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Return DWORD value containing the build version of .NET Framework. }
|
||||||
|
function TDGetNetFrameworkVersion: Cardinal;
|
||||||
|
var FrameworkVersion: Cardinal;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then
|
||||||
|
begin
|
||||||
|
Result := FrameworkVersion;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
@ -59,22 +59,12 @@ Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Cache"
|
|||||||
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
function InitializeSetup: Boolean;
|
function TDGetNetFrameworkVersion: Cardinal; forward;
|
||||||
var FrameworkVersion: Cardinal;
|
|
||||||
var HasCorrectVersion: Boolean;
|
|
||||||
|
|
||||||
|
{ Check .NET Framework version on startup, ask user if they want to proceed if older than 4.5.1. }
|
||||||
|
function InitializeSetup: Boolean;
|
||||||
begin
|
begin
|
||||||
HasCorrectVersion := False;
|
if TDGetNetFrameworkVersion() >= 379893 then
|
||||||
|
|
||||||
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then
|
|
||||||
begin
|
|
||||||
if FrameworkVersion >= 379893 then
|
|
||||||
begin
|
|
||||||
HasCorrectVersion := True;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if HasCorrectVersion then
|
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
Exit;
|
Exit;
|
||||||
@ -89,15 +79,7 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CurStepChanged(CurStep: TSetupStep);
|
{ Ask user if they want to delete 'AppData\TweetDuck' and 'plugins' folders after uninstallation. }
|
||||||
begin
|
|
||||||
if CurStep = ssInstall then
|
|
||||||
begin
|
|
||||||
DeleteFile(ExpandConstant('{app}\unins000.dat'))
|
|
||||||
DeleteFile(ExpandConstant('{app}\unins000.exe'))
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||||
var ProfileDataFolder: String;
|
var ProfileDataFolder: String;
|
||||||
var PluginDataFolder: String;
|
var PluginDataFolder: String;
|
||||||
@ -105,8 +87,8 @@ var PluginDataFolder: String;
|
|||||||
begin
|
begin
|
||||||
if CurUninstallStep = usPostUninstall then
|
if CurUninstallStep = usPostUninstall then
|
||||||
begin
|
begin
|
||||||
ProfileDataFolder := ExpandConstant('{localappdata}\{#MyAppName}')
|
ProfileDataFolder := ExpandConstant('{localappdata}\{#MyAppName}');
|
||||||
PluginDataFolder := ExpandConstant('{app}\plugins')
|
PluginDataFolder := ExpandConstant('{app}\plugins');
|
||||||
|
|
||||||
if (DirExists(ProfileDataFolder) or DirExists(PluginDataFolder)) and (MsgBox('Do you also want to delete your {#MyAppName} profile and plugins?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES) then
|
if (DirExists(ProfileDataFolder) or DirExists(PluginDataFolder)) and (MsgBox('Do you also want to delete your {#MyAppName} profile and plugins?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES) then
|
||||||
begin
|
begin
|
||||||
@ -115,4 +97,28 @@ begin
|
|||||||
DelTree(ExpandConstant('{app}'), True, False, False);
|
DelTree(ExpandConstant('{app}'), True, False, False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Remove uninstallation data and application to force them to be replaced with updated ones. }
|
||||||
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
|
begin
|
||||||
|
if CurStep = ssInstall then
|
||||||
|
begin
|
||||||
|
DeleteFile(ExpandConstant('{app}\unins000.dat'));
|
||||||
|
DeleteFile(ExpandConstant('{app}\unins000.exe'));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Return DWORD value containing the build version of .NET Framework. }
|
||||||
|
function TDGetNetFrameworkVersion: Cardinal;
|
||||||
|
var FrameworkVersion: Cardinal;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then
|
||||||
|
begin
|
||||||
|
Result := FrameworkVersion;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user