-
Notifications
You must be signed in to change notification settings - Fork 0
/
potplayer_czech.iss
131 lines (116 loc) · 3.99 KB
/
potplayer_czech.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[Setup]
AppVersion=2.5
VersionInfoVersion=2.5
AppName=PotPlayer CZ
AppId=PotPlayerCZ
DefaultDirName={code:GetDirName}
DefaultGroupName=Daum\PotPlayer
UninstallDisplayIcon={app}\uninstall.exe
Compression=lzma2
SolidCompression=yes
DirExistsWarning=no
UninstallFilesDir={app}\CZ
OutputBaseFilename=potplayer_czech
OutputDir=.
ArchitecturesInstallIn64BitMode=x64 ia64
AppPublisher=Robert Pösel (Robyer)
AppPublisherURL=http://www.robyer.cz/cestiny/pot-player
InfoBeforeFile=èti mì.txt
InfoAfterFile=nastavení.txt
[Languages]
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
[Files]
Source: "Czech.dsf"; DestDir: "{app}\Skins"
Source: "Czech_old.dsf"; DestDir: "{app}\Skins"
Source: "Language\Czech.ini"; DestDir: "{app}\Language"
Source: "èti mì.txt"; DestDir: "{app}\CZ"; Flags: isreadme
[Run]
Filename: {code:GetFileName}; Description: Spustit PotPlayer; Flags: postinstall shellexec skipifsilent
[Code]
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\PotPlayerCZ_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;
/////////////////////////////////////////////////////////////////////
function NextButtonClick(PageId: Integer): Boolean;
begin
Result := True;
if (PageId = wpSelectDir) then
begin
if (not FileExists(ExpandConstant('{app}\PotPlayerMini64.exe')) and not FileExists(ExpandConstant('{app}\PotPlayerMini.exe'))) then begin
MsgBox('Prosím zvolte složku, ve které máte nainstalovaný PotPlayer. Její umístìní se mùže lišit v závislosti na nainstalované verzi (32-bit nebo 64-bit).', mbError, MB_OK);
Result := False;
exit;
end;
end;
end;
/////////////////////////////////////////////////////////////////////
function GetDirName(Value: string): string;
var
InstallPath: string;
begin
// initialize default path, which will be returned when the following registry
// key queries fail due to missing keys or for some different reason
Result := ExpandConstant('{pf}\Daum\PotPlayer');
// query the registry values; if this succeeds, return the obtained value
if RegQueryStringValue(HKCU, 'Software\Daum\PotPlayer', 'ProgramFolder', InstallPath) then
Result := InstallPath
else if RegQueryStringValue(HKLM, 'Software\Daum\PotPlayer', 'ProgramFolder', InstallPath) then
Result := InstallPath;
end;
function GetFileName(Value: string): string;
var
InstallPath: string;
begin
if FileExists(ExpandConstant('{app}\PotPlayerMini64.exe')) then
Result := ExpandConstant('{app}\PotPlayerMini64.exe')
else
Result := ExpandConstant('{app}\PotPlayerMini.exe');
end;