|
bmasterc@126
|
1 |
unit UnitfrmMain; |
|
bmasterc@126
|
2 |
|
|
bmasterc@126
|
3 |
interface |
|
bmasterc@126
|
4 |
|
|
bmasterc@126
|
5 |
uses |
|
bmasterc@126
|
6 |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
|
bmasterc@126
|
7 |
Dialogs, TFlatRadioButtonUnit, StdCtrls, ComCtrls, mxFlatControls, JvPageList, |
|
bmasterc@126
|
8 |
ExtCtrls, JvExControls, JvComponent, TFlatButtonUnit, jpeg, TFlatEditUnit, |
|
bmasterc@126
|
9 |
TFlatGaugeUnit, ImgList, FileCtrl, Registry, CheckLst, TFlatComboBoxUnit, |
|
bmasterc@126
|
10 |
TFlatCheckBoxUnit, IdBaseComponent, IdComponent, IdTCPConnection, |
|
bmasterc@126
|
11 |
IdTCPClient, IdFTP, IdException, IdAntiFreezeBase, IdAntiFreeze, |
|
bmasterc@126
|
12 |
IdIntercept, IdLogBase, IdLogFile; |
|
bmasterc@126
|
13 |
|
|
bmasterc@126
|
14 |
type |
|
bmasterc@126
|
15 |
TfrmMain = class(TForm) |
|
bmasterc@126
|
16 |
jplWizard: TJvPageList; |
|
bmasterc@126
|
17 |
jspWelcome: TJvStandardPage; |
|
bmasterc@126
|
18 |
pnlButtons: TPanel; |
|
bmasterc@126
|
19 |
bvlSpace: TBevel; |
|
bmasterc@126
|
20 |
cmdNext: TFlatButton; |
|
bmasterc@126
|
21 |
cmdCancel: TFlatButton; |
|
bmasterc@126
|
22 |
imgInstall: TImage; |
|
bmasterc@126
|
23 |
lblWelcome: TLabel; |
|
bmasterc@126
|
24 |
lblInfo1: TLabel; |
|
bmasterc@126
|
25 |
lblInfo2: TLabel; |
|
bmasterc@126
|
26 |
lblInfo3: TLabel; |
|
bmasterc@126
|
27 |
jspLicense: TJvStandardPage; |
|
bmasterc@126
|
28 |
pnlLicense: TPanel; |
|
bmasterc@126
|
29 |
imgIcon1: TImage; |
|
bmasterc@126
|
30 |
lblTitle1: TLabel; |
|
bmasterc@126
|
31 |
lblSubTitle1: TLabel; |
|
bmasterc@126
|
32 |
freLicense: TmxFlatRichEdit; |
|
bmasterc@126
|
33 |
frbAgree: TFlatRadioButton; |
|
bmasterc@126
|
34 |
ftbDontAgree: TFlatRadioButton; |
|
bmasterc@126
|
35 |
jspInstallMethod: TJvStandardPage; |
|
bmasterc@126
|
36 |
pnlHeader2: TPanel; |
|
bmasterc@126
|
37 |
imgIcon2: TImage; |
|
bmasterc@126
|
38 |
lblTitle2: TLabel; |
|
bmasterc@126
|
39 |
lblSubTitle2: TLabel; |
|
bmasterc@126
|
40 |
lblInstallMethod: TLabel; |
|
bmasterc@126
|
41 |
pnlInstallMethod: TPanel; |
|
bmasterc@126
|
42 |
frbDedicatedServer: TFlatRadioButton; |
|
bmasterc@126
|
43 |
frbListenServer: TFlatRadioButton; |
|
bmasterc@126
|
44 |
frbSelectMod: TFlatRadioButton; |
|
bmasterc@126
|
45 |
frbFTP: TFlatRadioButton; |
|
bmasterc@126
|
46 |
cmdBack: TFlatButton; |
|
bmasterc@126
|
47 |
jspFTP: TJvStandardPage; |
|
bmasterc@126
|
48 |
pnlHeader3: TPanel; |
|
bmasterc@126
|
49 |
imgIcon3: TImage; |
|
bmasterc@126
|
50 |
lblTitle3: TLabel; |
|
bmasterc@126
|
51 |
lblSubTitle3: TLabel; |
|
bmasterc@126
|
52 |
lblStep1: TLabel; |
|
bmasterc@126
|
53 |
pnlFTPData: TPanel; |
|
bmasterc@126
|
54 |
lblHost: TLabel; |
|
bmasterc@126
|
55 |
txtHost: TFlatEdit; |
|
bmasterc@126
|
56 |
lblUserName: TLabel; |
|
bmasterc@126
|
57 |
txtUserName: TFlatEdit; |
|
bmasterc@126
|
58 |
txtPassword: TFlatEdit; |
|
bmasterc@126
|
59 |
lblPassword: TLabel; |
|
bmasterc@126
|
60 |
txtPort: TFlatEdit; |
|
bmasterc@126
|
61 |
lblPort: TLabel; |
|
bmasterc@126
|
62 |
lblStep2: TLabel; |
|
bmasterc@126
|
63 |
cmdConnect: TFlatButton; |
|
bmasterc@126
|
64 |
pnlDirectory: TPanel; |
|
bmasterc@126
|
65 |
trvDirectories: TTreeView; |
|
bmasterc@126
|
66 |
lblStep4: TLabel; |
|
bmasterc@126
|
67 |
jspInstallProgress: TJvStandardPage; |
|
bmasterc@126
|
68 |
pnlHeader5: TPanel; |
|
bmasterc@126
|
69 |
imgIcon5: TImage; |
|
bmasterc@126
|
70 |
lblTitle5: TLabel; |
|
bmasterc@126
|
71 |
lblSubTitle5: TLabel; |
|
bmasterc@126
|
72 |
ggeAll: TFlatGauge; |
|
bmasterc@126
|
73 |
lblProgress: TLabel; |
|
bmasterc@126
|
74 |
ggeItem: TFlatGauge; |
|
bmasterc@126
|
75 |
rtfDetails: TmxFlatRichEdit; |
|
bmasterc@126
|
76 |
lblDetails: TLabel; |
|
bmasterc@126
|
77 |
bvlSpace2: TBevel; |
|
bmasterc@126
|
78 |
ilImages: TImageList; |
|
bmasterc@126
|
79 |
bvlSpacer1: TBevel; |
|
bmasterc@126
|
80 |
bvlSpacer2: TBevel; |
|
bmasterc@126
|
81 |
bvlSpacer3: TBevel; |
|
bmasterc@126
|
82 |
bvlSpacer5: TBevel; |
|
bmasterc@126
|
83 |
jspSelectMod: TJvStandardPage; |
|
bmasterc@126
|
84 |
pnlSelectMod: TPanel; |
|
bmasterc@126
|
85 |
imgIcon6: TImage; |
|
bmasterc@126
|
86 |
lblSelectMod: TLabel; |
|
bmasterc@126
|
87 |
lblSelectModInfo: TLabel; |
|
bmasterc@126
|
88 |
bvlSelectMod: TBevel; |
|
bmasterc@126
|
89 |
lblInfo: TLabel; |
|
bmasterc@126
|
90 |
lstMods: TmxFlatListBox; |
|
bmasterc@126
|
91 |
chkPassive: TFlatCheckBox; |
|
bmasterc@126
|
92 |
lblStep3: TLabel; |
|
bmasterc@126
|
93 |
pnlOS: TPanel; |
|
bmasterc@126
|
94 |
optWindows: TFlatRadioButton; |
|
bmasterc@126
|
95 |
optLinux: TFlatRadioButton; |
|
bmasterc@126
|
96 |
IdFTP: TIdFTP; |
|
bmasterc@126
|
97 |
cmdProxySettings: TFlatButton; |
|
bmasterc@126
|
98 |
IdAntiFreeze: TIdAntiFreeze; |
|
bmasterc@126
|
99 |
frbStandaloneServer: TFlatRadioButton; |
|
bmasterc@126
|
100 |
tmrSpeed: TTimer; |
|
bmasterc@126
|
101 |
IdLogFile: TIdLogFile; |
|
bmasterc@126
|
102 |
procedure jvwStepsCancelButtonClick(Sender: TObject); |
|
bmasterc@126
|
103 |
procedure cmdCancelClick(Sender: TObject); |
|
bmasterc@126
|
104 |
procedure cmdNextClick(Sender: TObject); |
|
bmasterc@126
|
105 |
procedure CheckNext(Sender: TObject); |
|
bmasterc@126
|
106 |
procedure cmdBackClick(Sender: TObject); |
|
bmasterc@126
|
107 |
procedure cmdConnectClick(Sender: TObject); |
|
bmasterc@126
|
108 |
procedure jplWizardChange(Sender: TObject); |
|
bmasterc@126
|
109 |
procedure FormCreate(Sender: TObject); |
|
bmasterc@126
|
110 |
procedure lstModsClick(Sender: TObject); |
|
bmasterc@126
|
111 |
procedure cmdProxySettingsClick(Sender: TObject); |
|
bmasterc@126
|
112 |
procedure txtPortChange(Sender: TObject); |
|
bmasterc@126
|
113 |
procedure trvDirectoriesExpanded(Sender: TObject; Node: TTreeNode); |
|
bmasterc@126
|
114 |
procedure trvDirectoriesChange(Sender: TObject; Node: TTreeNode); |
|
bmasterc@126
|
115 |
procedure IdFTPWork(Sender: TObject; AWorkMode: TWorkMode; |
|
bmasterc@126
|
116 |
const AWorkCount: Integer); |
|
bmasterc@126
|
117 |
procedure FormClose(Sender: TObject; var Action: TCloseAction); |
|
bmasterc@126
|
118 |
procedure tmrSpeedTimer(Sender: TObject); |
|
bmasterc@126
|
119 |
procedure trvDirectoriesExpanding(Sender: TObject; Node: TTreeNode; |
|
bmasterc@126
|
120 |
var AllowExpansion: Boolean); |
|
bmasterc@126
|
121 |
procedure trvDirectoriesCollapsing(Sender: TObject; Node: TTreeNode; |
|
bmasterc@126
|
122 |
var AllowCollapse: Boolean); |
|
bmasterc@126
|
123 |
private |
|
bmasterc@126
|
124 |
OldProgress: Integer; |
|
bmasterc@126
|
125 |
CurrProgress: Integer; |
|
bmasterc@126
|
126 |
public |
|
bmasterc@126
|
127 |
procedure ExceptionHandler(Sender: TObject; E: Exception); |
|
bmasterc@126
|
128 |
end; |
|
bmasterc@126
|
129 |
|
|
bmasterc@126
|
130 |
var |
|
bmasterc@126
|
131 |
frmMain: TfrmMain; |
|
bmasterc@126
|
132 |
|
|
bmasterc@210
|
133 |
var VERSION: String = '1.2.2'; |
|
bmasterc@126
|
134 |
|
|
bmasterc@126
|
135 |
implementation |
|
bmasterc@126
|
136 |
|
|
bmasterc@126
|
137 |
uses UnitFunctions, UnitfrmProxy, UnitInstall, UnitSelectModPath; |
|
bmasterc@126
|
138 |
|
|
bmasterc@126
|
139 |
{$R *.dfm} |
|
bmasterc@126
|
140 |
|
|
bmasterc@126
|
141 |
procedure TfrmMain.jvwStepsCancelButtonClick(Sender: TObject); |
|
bmasterc@126
|
142 |
begin |
|
bmasterc@126
|
143 |
Close; |
|
bmasterc@126
|
144 |
end; |
|
bmasterc@126
|
145 |
|
|
bmasterc@126
|
146 |
procedure TfrmMain.cmdCancelClick(Sender: TObject); |
|
bmasterc@126
|
147 |
begin |
|
bmasterc@126
|
148 |
Close; |
|
bmasterc@126
|
149 |
end; |
|
bmasterc@126
|
150 |
|
|
bmasterc@126
|
151 |
procedure TfrmMain.cmdNextClick(Sender: TObject); |
|
bmasterc@126
|
152 |
var ePath: String; |
|
bmasterc@126
|
153 |
eRegistry: TRegistry; |
|
bmasterc@126
|
154 |
eStr: TStringList; |
|
bmasterc@126
|
155 |
CurNode: TTreeNode; |
|
bmasterc@126
|
156 |
eOS: TOS; |
|
bmasterc@126
|
157 |
begin |
|
bmasterc@126
|
158 |
{ FTP } |
|
bmasterc@126
|
159 |
if jplWizard.ActivePage = jspFTP then begin |
|
bmasterc@126
|
160 |
if not IdFTP.Connected then |
|
bmasterc@126
|
161 |
IdFTP.Connect; |
|
bmasterc@126
|
162 |
eStr := TStringList.Create; |
|
bmasterc@126
|
163 |
ePath := '/'; |
|
bmasterc@126
|
164 |
CurNode := trvDirectories.Selected; |
|
bmasterc@126
|
165 |
repeat |
|
bmasterc@126
|
166 |
ePath := '/' + CurNode.Text + ePath; |
|
bmasterc@126
|
167 |
CurNode := CurNode.Parent; |
|
bmasterc@126
|
168 |
until (not Assigned(CurNode)); |
|
bmasterc@126
|
169 |
IdFTP.ChangeDir(ePath); |
|
bmasterc@126
|
170 |
IdFTP.List(eStr, '', False); |
|
bmasterc@126
|
171 |
if eStr.IndexOf('gameinfo.txt') = -1 then begin |
|
bmasterc@126
|
172 |
MessageBox(Handle, 'Invalid directory. Please select your mod directory and try again.', PChar(Application.Title), MB_ICONWARNING); |
|
bmasterc@126
|
173 |
eStr.Free; |
|
bmasterc@126
|
174 |
exit; |
|
bmasterc@126
|
175 |
end |
|
bmasterc@126
|
176 |
else |
|
bmasterc@126
|
177 |
eStr.Free; |
|
bmasterc@126
|
178 |
|
|
bmasterc@126
|
179 |
// design stuff |
|
bmasterc@126
|
180 |
trvDirectories.Enabled := False; |
|
bmasterc@126
|
181 |
cmdConnect.Enabled := False; |
|
bmasterc@126
|
182 |
optWindows.Enabled := False; |
|
bmasterc@126
|
183 |
optLinux.Enabled := False; |
|
bmasterc@126
|
184 |
Screen.Cursor := crHourGlass; |
|
bmasterc@126
|
185 |
|
|
bmasterc@126
|
186 |
if optWindows.Checked then |
|
bmasterc@126
|
187 |
eOS := osWindows |
|
bmasterc@209
|
188 |
else |
|
bmasterc@126
|
189 |
eOS := osLinux; |
|
bmasterc@126
|
190 |
|
|
bmasterc@126
|
191 |
jspInstallProgress.Show; |
|
bmasterc@126
|
192 |
// installation |
|
bmasterc@126
|
193 |
Screen.Cursor := crAppStart; |
|
bmasterc@126
|
194 |
InstallFTP(eOS); |
|
bmasterc@126
|
195 |
end |
|
bmasterc@126
|
196 |
else if jplWizard.ActivePage = jspInstallProgress then |
|
bmasterc@126
|
197 |
Close |
|
bmasterc@126
|
198 |
else if jplWizard.ActivePage = jspSelectMod then begin |
|
bmasterc@126
|
199 |
{ Dedicated Server } |
|
bmasterc@126
|
200 |
if (frbDedicatedServer.Checked) or (frbStandaloneServer.Checked) then begin |
|
bmasterc@126
|
201 |
jspInstallProgress.Show; |
|
bmasterc@126
|
202 |
ePath := lstMods.Items[lstMods.ItemIndex]; |
|
bmasterc@126
|
203 |
if ePath = 'Counter-Strike:Source' then |
|
bmasterc@126
|
204 |
ePath := 'cstrike' |
|
bmasterc@126
|
205 |
else if ePath = 'Day of Defeat:Source' then |
|
bmasterc@126
|
206 |
ePath := 'dod' |
|
bmasterc@126
|
207 |
else |
|
bmasterc@126
|
208 |
ePath := 'hl2mp'; |
|
bmasterc@126
|
209 |
// install it |
|
bmasterc@126
|
210 |
if frbDedicatedServer.Checked then begin |
|
bmasterc@126
|
211 |
if DirectoryExists(SteamPath + ePath) then |
|
bmasterc@126
|
212 |
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True) |
|
bmasterc@126
|
213 |
else begin |
|
bmasterc@126
|
214 |
MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist any more. Run Dedicated Server with the chosen mod and try again.', PChar(Application.Title), MB_ICONERROR); |
|
bmasterc@126
|
215 |
Application.Terminate; |
|
bmasterc@126
|
216 |
exit; |
|
bmasterc@126
|
217 |
end; |
|
bmasterc@126
|
218 |
end |
|
bmasterc@126
|
219 |
else begin |
|
bmasterc@126
|
220 |
if DirectoryExists(StandaloneServer + ePath) then |
|
bmasterc@126
|
221 |
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False) |
|
bmasterc@126
|
222 |
else begin |
|
bmasterc@126
|
223 |
MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist (any more). Run Half-Life Dedicated Server with the chosen mod again and restart.', PChar(Application.Title), MB_ICONERROR); |
|
bmasterc@126
|
224 |
Application.Terminate; |
|
bmasterc@126
|
225 |
exit; |
|
bmasterc@126
|
226 |
end; |
|
bmasterc@126
|
227 |
end; |
|
bmasterc@126
|
228 |
end; |
|
bmasterc@126
|
229 |
{ Listen Server } |
|
bmasterc@126
|
230 |
if frbListenServer.Checked then begin |
|
bmasterc@126
|
231 |
ePath := lstMods.Items[lstMods.ItemIndex]; |
|
bmasterc@126
|
232 |
if ePath = 'Counter-Strike:Source' then |
|
bmasterc@126
|
233 |
ePath := SteamPath + 'counter-strike source\cstrike' |
|
bmasterc@126
|
234 |
else if ePath = 'Half-Life 2 Deathmatch' then |
|
bmasterc@126
|
235 |
ePath := SteamPath + 'half-life 2 deathmatch\hl2mp' |
|
bmasterc@126
|
236 |
else |
|
bmasterc@126
|
237 |
ePath := SteamPath + 'Day Of Defeat source\dod'; |
|
bmasterc@126
|
238 |
|
|
bmasterc@126
|
239 |
if Pos(SteamPath, ePath) = 0 then |
|
bmasterc@126
|
240 |
MessageBox(Handle, 'An error occured. Please report this bug to the Metamod:Source team and post a new thread on the forums of www.amxmodx.org.', PChar(Application.Title), MB_ICONSTOP) |
|
bmasterc@126
|
241 |
else begin |
|
bmasterc@126
|
242 |
if not FileExists(ePath + '\gameinfo.txt') then begin |
|
bmasterc@126
|
243 |
MessageBox(Handle, 'You have to play this game once before installing Metamod:Source. Do this and try again.', PChar(Application.Title), MB_ICONWARNING); |
|
bmasterc@126
|
244 |
exit; |
|
bmasterc@126
|
245 |
end; |
|
bmasterc@126
|
246 |
|
|
bmasterc@126
|
247 |
jspInstallProgress.Show; |
|
bmasterc@126
|
248 |
ePath := IncludeTrailingPathDelimiter(ePath); |
|
bmasterc@126
|
249 |
InstallListen(ePath); |
|
bmasterc@126
|
250 |
end; |
|
bmasterc@126
|
251 |
end; |
|
bmasterc@126
|
252 |
{ Custom mod below } |
|
bmasterc@126
|
253 |
end |
|
bmasterc@126
|
254 |
else if jplWizard.ActivePage <> jspInstallMethod then |
|
bmasterc@126
|
255 |
jplWizard.NextPage |
|
bmasterc@126
|
256 |
else begin |
|
bmasterc@126
|
257 |
if frbDedicatedServer.Checked then begin // Dedicated Server |
|
bmasterc@126
|
258 |
eRegistry := TRegistry.Create(KEY_READ); |
|
bmasterc@126
|
259 |
try |
|
bmasterc@126
|
260 |
eRegistry.RootKey := HKEY_CURRENT_USER; |
|
bmasterc@126
|
261 |
if eRegistry.OpenKey('Software\Valve\Steam', False) then begin |
|
bmasterc@126
|
262 |
ePath := eRegistry.ReadString('ModInstallPath'); |
|
bmasterc@126
|
263 |
ePath := Copy(ePath, 1, Length(ePath) -10) + '\source dedicated server\'; |
|
bmasterc@126
|
264 |
if DirectoryExists(ePath) then begin |
|
bmasterc@126
|
265 |
SteamPath := ePath; |
|
bmasterc@126
|
266 |
lstMods.Clear; |
|
bmasterc@126
|
267 |
// Check Mods |
|
bmasterc@126
|
268 |
if DirectoryExists(SteamPath + 'cstrike') then |
|
bmasterc@126
|
269 |
lstMods.Items.Add('Counter-Strike:Source'); |
|
bmasterc@126
|
270 |
if DirectoryExists(SteamPath + 'dod') then |
|
bmasterc@126
|
271 |
lstMods.Items.Add('Day of Defeat:Source'); |
|
bmasterc@126
|
272 |
if DirectoryExists(SteamPath + 'hl2mp') then |
|
bmasterc@126
|
273 |
lstMods.Items.Add('Half-Life 2 Deatmatch'); |
|
bmasterc@126
|
274 |
// Misc |
|
bmasterc@126
|
275 |
jspSelectMod.Show; |
|
bmasterc@126
|
276 |
lstMods.ItemIndex := -1; |
|
bmasterc@126
|
277 |
cmdNext.Enabled := False; |
|
bmasterc@126
|
278 |
end |
|
bmasterc@126
|
279 |
else |
|
bmasterc@126
|
280 |
MessageBox(Handle, 'You have to run Dedicated Server once before installing Metamod:Source!', 'Error', MB_ICONWARNING); |
|
bmasterc@126
|
281 |
end |
|
bmasterc@126
|
282 |
else |
|
bmasterc@126
|
283 |
MessageBox(Handle, 'You haven''t installed Steam yet! Download it at www.steampowered.com, install Dedicated Server and try again.', 'Error', MB_ICONWARNING); |
|
bmasterc@126
|
284 |
finally |
|
bmasterc@126
|
285 |
eRegistry.Free; |
|
bmasterc@126
|
286 |
end; |
|
bmasterc@126
|
287 |
end |
|
bmasterc@126
|
288 |
else if frbListenServer.Checked then begin // Listen Server |
|
bmasterc@126
|
289 |
eRegistry := TRegistry.Create(KEY_READ); |
|
bmasterc@126
|
290 |
try |
|
bmasterc@126
|
291 |
eRegistry.RootKey := HKEY_CURRENT_USER; |
|
bmasterc@126
|
292 |
if eRegistry.OpenKey('Software\Valve\Steam', False) then begin |
|
bmasterc@126
|
293 |
ePath := eRegistry.ReadString('ModInstallPath') + '\'; |
|
bmasterc@126
|
294 |
lstMods.Clear; |
|
bmasterc@126
|
295 |
ePath := Copy(ePath, 1, Length(ePath) -10); |
|
bmasterc@126
|
296 |
if DirectoryExists(ePath) then begin |
|
bmasterc@126
|
297 |
SteamPath := ePath; |
|
bmasterc@126
|
298 |
// Check Mods |
|
bmasterc@126
|
299 |
if DirectoryExists(SteamPath + 'counter-strike source') then |
|
bmasterc@126
|
300 |
lstMods.Items.Add('Counter-Strike:Source'); |
|
bmasterc@126
|
301 |
if DirectoryExists(SteamPath + 'half-life 2 deathmatch') then |
|
bmasterc@126
|
302 |
lstMods.Items.Add('Half-Life 2 Deathmatch'); |
|
bmasterc@126
|
303 |
if DirectoryExists(SteamPath + 'Day Of Defeat source') then |
|
bmasterc@126
|
304 |
lstMods.Items.Add('Day of Defeat: Source'); |
|
bmasterc@126
|
305 |
// Misc |
|
bmasterc@126
|
306 |
jspSelectMod.Show; |
|
bmasterc@126
|
307 |
lstMods.ItemIndex := -1; |
|
bmasterc@126
|
308 |
cmdNext.Enabled := False; |
|
bmasterc@126
|
309 |
end |
|
bmasterc@126
|
310 |
else |
|
bmasterc@126
|
311 |
MessageBox(Handle, 'You haven''t installed Steam yet! Download it at www.steampowered.com, install Dedicated Server and try again.', 'Error', MB_ICONWARNING); |
|
bmasterc@126
|
312 |
end |
|
bmasterc@126
|
313 |
else |
|
bmasterc@126
|
314 |
MessageBox(Handle, 'You haven''t installed Steam yet! Download it at www.steampowered.com, install Dedicated Server and try again.', 'Error', MB_ICONWARNING); |
|
bmasterc@126
|
315 |
finally |
|
bmasterc@126
|
316 |
eRegistry.Free; |
|
bmasterc@126
|
317 |
end; |
|
bmasterc@126
|
318 |
end |
|
bmasterc@126
|
319 |
else if frbStandaloneServer.Checked then begin // Standalone Server |
|
bmasterc@126
|
320 |
eRegistry := TRegistry.Create; |
|
bmasterc@126
|
321 |
try |
|
bmasterc@126
|
322 |
eRegistry.RootKey := HKEY_CURRENT_USER; |
|
bmasterc@126
|
323 |
if eRegistry.OpenKey('Software\Valve\HLServer', False) then begin |
|
bmasterc@126
|
324 |
StandaloneServer := IncludeTrailingPathDelimiter(eRegistry.ReadString('InstallPath')); |
|
bmasterc@126
|
325 |
if DirectoryExists(StandaloneServer + 'cstrike') then |
|
bmasterc@126
|
326 |
lstMods.Items.Add('Counter-Strike:Source'); |
|
bmasterc@126
|
327 |
if DirectoryExists(StandaloneServer + 'dod') then |
|
bmasterc@126
|
328 |
lstMods.Items.Add('Day of Defeat:Source'); |
|
bmasterc@126
|
329 |
if DirectoryExists(StandaloneServer + 'hl2mp') then |
|
bmasterc@126
|
330 |
lstMods.Items.Add('Half-Life 2 Deatmatch'); |
|
bmasterc@126
|
331 |
jspSelectMod.Show; |
|
bmasterc@126
|
332 |
end |
|
bmasterc@126
|
333 |
else |
|
bmasterc@126
|
334 |
MessageBox(Handle, 'You haven''t installed Half-Life Dedicated Server yet!', 'Error', MB_ICONWARNING); |
|
bmasterc@126
|
335 |
finally |
|
bmasterc@126
|
336 |
eRegistry.Free; |
|
bmasterc@126
|
337 |
end; |
|
bmasterc@126
|
338 |
end |
|
bmasterc@126
|
339 |
else if frbSelectMod.Checked then begin |
|
bmasterc@126
|
340 |
{ Custom mod } |
|
bmasterc@126
|
341 |
if frmSelectModPath.ShowModal = mrOk then begin |
|
bmasterc@126
|
342 |
jspInstallProgress.Show; |
|
bmasterc@126
|
343 |
InstallCustom(IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName), osWindows); |
|
bmasterc@126
|
344 |
end; |
|
bmasterc@126
|
345 |
end |
|
bmasterc@126
|
346 |
else if frbFTP.Checked then // FTP |
|
bmasterc@126
|
347 |
jspFTP.Show; |
|
bmasterc@126
|
348 |
end; |
|
bmasterc@126
|
349 |
end; |
|
bmasterc@126
|
350 |
|
|
bmasterc@126
|
351 |
procedure TfrmMain.CheckNext(Sender: TObject); |
|
bmasterc@126
|
352 |
begin |
|
bmasterc@126
|
353 |
cmdNext.Enabled := frbAgree.Checked; |
|
bmasterc@126
|
354 |
end; |
|
bmasterc@126
|
355 |
|
|
bmasterc@126
|
356 |
procedure TfrmMain.cmdBackClick(Sender: TObject); |
|
bmasterc@126
|
357 |
begin |
|
bmasterc@126
|
358 |
if jplWizard.ActivePage = jspFTP then |
|
bmasterc@126
|
359 |
jspInstallMethod.Show |
|
bmasterc@126
|
360 |
else begin |
|
bmasterc@126
|
361 |
jplWizard.PrevPage; |
|
bmasterc@126
|
362 |
cmdBack.Visible := jplWizard.ActivePageIndex <> 0; |
|
bmasterc@126
|
363 |
end; |
|
bmasterc@126
|
364 |
end; |
|
bmasterc@126
|
365 |
|
|
bmasterc@126
|
366 |
procedure TfrmMain.cmdConnectClick(Sender: TObject); |
|
bmasterc@126
|
367 |
var i: integer; |
|
bmasterc@126
|
368 |
eStr: TStringList; |
|
bmasterc@126
|
369 |
CurNode: TTreeNode; |
|
bmasterc@126
|
370 |
begin |
|
bmasterc@126
|
371 |
if (Trim(txtHost.Text) = '') or (Trim(txtUsername.Text) = '') then |
|
bmasterc@126
|
372 |
MessageBox(Handle, 'Please fill in each field!', PChar(Application.Title), MB_ICONWARNING) |
|
bmasterc@126
|
373 |
else if cmdConnect.Caption = 'Connect' then begin |
|
bmasterc@126
|
374 |
// ... design stuff ... |
|
bmasterc@126
|
375 |
Screen.Cursor := crHourGlass; |
|
bmasterc@126
|
376 |
cmdConnect.Enabled := False; |
|
bmasterc@126
|
377 |
cmdProxySettings.Enabled := False; |
|
bmasterc@126
|
378 |
txtHost.Enabled := False; |
|
bmasterc@126
|
379 |
txtPort.Enabled := False; |
|
bmasterc@126
|
380 |
txtUsername.Enabled := False; |
|
bmasterc@126
|
381 |
txtPassword.Enabled := False; |
|
bmasterc@126
|
382 |
chkPassive.Enabled := False; |
|
bmasterc@126
|
383 |
cmdConnect.Caption := 'Connecting...'; |
|
bmasterc@126
|
384 |
// ... set values ... |
|
bmasterc@126
|
385 |
IdFTP.Host := txtHost.Text; |
|
bmasterc@126
|
386 |
IdFTP.Port := StrToInt(txtPort.Text); |
|
bmasterc@126
|
387 |
IdFTP.Username := txtUsername.Text; |
|
bmasterc@126
|
388 |
IdFTP.Passive := chkPassive.Checked; |
|
bmasterc@126
|
389 |
IdFTP.Password := txtPassword.Text; |
|
bmasterc@126
|
390 |
// ... connect and check values etc ... |
|
bmasterc@126
|
391 |
try |
|
bmasterc@126
|
392 |
IdFTP.Connect(True, 15000); |
|
bmasterc@126
|
393 |
// ... scan for initial directory ... |
|
bmasterc@126
|
394 |
eStr := TStringList.Create; |
|
bmasterc@126
|
395 |
eStr.Text := StringReplace(IdFTP.RetrieveCurrentDir, '/', #13, [rfReplaceAll]); |
|
bmasterc@126
|
396 |
for i := eStr.Count -1 downto 0 do begin |
|
bmasterc@126
|
397 |
if eStr[i] = '' then |
|
bmasterc@126
|
398 |
eStr.Delete(i); |
|
bmasterc@126
|
399 |
end; |
|
bmasterc@126
|
400 |
// ... connect successful, change captions ... |
|
bmasterc@126
|
401 |
trvDirectories.Enabled := True; |
|
bmasterc@126
|
402 |
cmdConnect.Enabled := True; |
|
bmasterc@126
|
403 |
cmdConnect.Caption := 'Disconnect'; |
|
bmasterc@126
|
404 |
|
|
bmasterc@126
|
405 |
CurNode := nil; |
|
bmasterc@126
|
406 |
if eStr.Count <> 0 then begin |
|
bmasterc@126
|
407 |
for i := 0 to eStr.Count -1 do |
|
bmasterc@126
|
408 |
CurNode := trvDirectories.Items.AddChild(CurNode, eStr[i]); |
|
bmasterc@126
|
409 |
end; |
|
bmasterc@126
|
410 |
if trvDirectories.Items.Count <> 0 then |
|
bmasterc@126
|
411 |
trvDirectories.Items.Item[0].Expand(True); |
|
bmasterc@126
|
412 |
eStr.Free; |
|
bmasterc@126
|
413 |
|
|
bmasterc@126
|
414 |
// ... scan for directories ... |
|
bmasterc@126
|
415 |
with GetAllDirs do begin |
|
bmasterc@126
|
416 |
for i := 0 to Count -1 do |
|
bmasterc@126
|
417 |
trvDirectories.Items.AddChild(trvDirectories.Items.AddChild(CurNode, Strings[i]), 'Scanning...'); |
|
bmasterc@126
|
418 |
Free; |
|
bmasterc@126
|
419 |
end; |
|
bmasterc@126
|
420 |
|
|
bmasterc@126
|
421 |
if Assigned(CurNode) then |
|
bmasterc@126
|
422 |
CurNode.Expand(False); |
|
bmasterc@126
|
423 |
except |
|
bmasterc@126
|
424 |
on E: Exception do begin |
|
bmasterc@126
|
425 |
// reset button properties |
|
bmasterc@126
|
426 |
cmdConnect.Enabled := True; |
|
bmasterc@126
|
427 |
txtHost.Enabled := True; |
|
bmasterc@126
|
428 |
txtPort.Enabled := True; |
|
bmasterc@126
|
429 |
txtUsername.Enabled := True; |
|
bmasterc@126
|
430 |
txtPassword.Enabled := True; |
|
bmasterc@126
|
431 |
chkPassive.Enabled := True; |
|
bmasterc@126
|
432 |
cmdProxySettings.Enabled := True; |
|
bmasterc@126
|
433 |
cmdNext.Enabled := False; |
|
bmasterc@126
|
434 |
cmdConnect.Caption := 'Connect'; |
|
bmasterc@126
|
435 |
// analyze messages |
|
bmasterc@126
|
436 |
if Pos('Login incorrect.', E.Message) <> 0 then begin // login failed |
|
bmasterc@126
|
437 |
MessageBox(Handle, 'Login incorrect. Check your FTP settings and try again.', PChar(Application.Title), MB_ICONWARNING); |
|
bmasterc@126
|
438 |
txtUsername.SetFocus; |
|
bmasterc@126
|
439 |
txtUsername.SelectAll; |
|
bmasterc@126
|
440 |
end |
|
bmasterc@126
|
441 |
else if Pos('Host not found.', E.Message) <> 0 then begin // host not found |
|
bmasterc@126
|
442 |
MessageBox(Handle, 'The entered host couldn''t be found. Check your settings and try again.', PChar(Application.Title), MB_ICONWARNING); |
|
bmasterc@126
|
443 |
txtHost.SetFocus; |
|
bmasterc@126
|
444 |
txtHost.SelectAll; |
|
bmasterc@126
|
445 |
end |
|
bmasterc@126
|
446 |
else if Pos('Connection refused.', E.Message) <> 0 then begin // wrong port (?) |
|
bmasterc@126
|
447 |
MessageBox(Handle, 'The host refused the connection. Check your port and try again.', PChar(Application.Title), MB_ICONWARNING); |
|
bmasterc@126
|
448 |
txtPort.SetFocus; |
|
bmasterc@126
|
449 |
txtPort.SelectAll; |
|
bmasterc@126
|
450 |
end |
|
bmasterc@126
|
451 |
else if E is EIdProtocolReplyError then begin // wrong port |
|
bmasterc@126
|
452 |
MessageBox(Handle, 'The port you entered is definitely wrong. Check it and try again.', PChar(Application.Title), MB_ICONWARNING); |
|
bmasterc@126
|
453 |
txtPort.SetFocus; |
|
bmasterc@126
|
454 |
txtPort.SelectAll; |
|
bmasterc@126
|
455 |
end |
|
bmasterc@126
|
456 |
else |
|
bmasterc@126
|
457 |
MessageBox(Handle, PChar(E.Message), PChar(Application.Title), MB_ICONWARNING); // unknown error |
|
bmasterc@126
|
458 |
// ... connect failed, leave procedure ... |
|
bmasterc@126
|
459 |
Screen.Cursor := crDefault; |
|
bmasterc@126
|
460 |
exit; |
|
bmasterc@126
|
461 |
end; |
|
bmasterc@126
|
462 |
end; |
|
bmasterc@126
|
463 |
|
|
bmasterc@126
|
464 |
Screen.Cursor := crDefault; |
|
bmasterc@126
|
465 |
end |
|
bmasterc@126
|
466 |
else begin |
|
bmasterc@126
|
467 |
Screen.Cursor := crHourGlass; |
|
bmasterc@126
|
468 |
IdFTP.Quit; |
|
bmasterc@126
|
469 |
trvDirectories.Items.Clear; |
|
bmasterc@126
|
470 |
trvDirectories.Enabled := False; |
|
bmasterc@126
|
471 |
cmdConnect.Enabled := True; |
|
bmasterc@126
|
472 |
cmdProxySettings.Enabled := True; |
|
bmasterc@126
|
473 |
txtHost.Enabled := True; |
|
bmasterc@126
|
474 |
txtPort.Enabled := True; |
|
bmasterc@126
|
475 |
txtUsername.Enabled := True; |
|
bmasterc@126
|
476 |
txtPassword.Enabled := True; |
|
bmasterc@126
|
477 |
chkPassive.Enabled := True; |
|
bmasterc@126
|
478 |
cmdConnect.Caption := 'Connect'; |
|
bmasterc@126
|
479 |
cmdNext.Enabled := False; |
|
bmasterc@126
|
480 |
Screen.Cursor := crDefault; |
|
bmasterc@126
|
481 |
end; |
|
bmasterc@126
|
482 |
end; |
|
bmasterc@126
|
483 |
|
|
bmasterc@126
|
484 |
procedure TfrmMain.jplWizardChange(Sender: TObject); |
|
bmasterc@126
|
485 |
begin |
|
bmasterc@126
|
486 |
if (jplWizard.ActivePage = jspInstallProgress) then begin |
|
bmasterc@126
|
487 |
cmdNext.Caption := '&Finish'; |
|
bmasterc@126
|
488 |
cmdNext.Enabled := False; |
|
bmasterc@126
|
489 |
cmdBack.Visible := False; |
|
bmasterc@126
|
490 |
end |
|
bmasterc@126
|
491 |
else begin |
|
bmasterc@126
|
492 |
cmdNext.Caption := '&Next >'; |
|
bmasterc@126
|
493 |
cmdNext.Enabled := True; |
|
bmasterc@126
|
494 |
cmdBack.Visible := jplWizard.ActivePageIndex <> 0; |
|
bmasterc@126
|
495 |
end; |
|
bmasterc@126
|
496 |
|
|
bmasterc@126
|
497 |
if (jplWizard.ActivePage = jspLicense) then |
|
bmasterc@126
|
498 |
cmdNext.Enabled := frbAgree.Checked; |
|
bmasterc@126
|
499 |
|
|
bmasterc@126
|
500 |
if (jplWizard.ActivePage = jspFTP) then |
|
bmasterc@126
|
501 |
cmdNext.Enabled := False; |
|
bmasterc@126
|
502 |
end; |
|
bmasterc@126
|
503 |
|
|
bmasterc@126
|
504 |
procedure TfrmMain.FormCreate(Sender: TObject); |
|
bmasterc@126
|
505 |
begin |
|
bmasterc@126
|
506 |
if LowerCase(ParamStr(1)) = '-logftp' then begin |
|
bmasterc@126
|
507 |
MessageBox(Handle, 'FTP installation will be logged to FTP.log!', PChar(Application.Title), MB_ICONINFORMATION); |
|
bmasterc@126
|
508 |
IdLogFile.Filename := ExtractFilePath(ParamStr(0)) + 'FTP.log'; |
|
bmasterc@126
|
509 |
IdLogFile.Active := True; |
|
bmasterc@126
|
510 |
end; |
|
bmasterc@126
|
511 |
|
|
bmasterc@126
|
512 |
rtfDetails.Clear; |
|
bmasterc@126
|
513 |
end; |
|
bmasterc@126
|
514 |
|
|
bmasterc@126
|
515 |
procedure TfrmMain.lstModsClick(Sender: TObject); |
|
bmasterc@126
|
516 |
begin |
|
bmasterc@126
|
517 |
cmdNext.Enabled := lstMods.ItemIndex <> -1; |
|
bmasterc@126
|
518 |
end; |
|
bmasterc@126
|
519 |
|
|
bmasterc@126
|
520 |
procedure TfrmMain.cmdProxySettingsClick(Sender: TObject); |
|
bmasterc@126
|
521 |
begin |
|
bmasterc@126
|
522 |
frmProxy.ShowModal; |
|
bmasterc@126
|
523 |
// Apply Proxy Settings |
|
bmasterc@126
|
524 |
case frmProxy.cboProxy.ItemIndex of |
|
bmasterc@126
|
525 |
0: IdFTP.ProxySettings.ProxyType := fpcmNone; // none |
|
bmasterc@126
|
526 |
1: IdFTP.ProxySettings.ProxyType := fpcmHttpProxyWithFtp; // HTTP Proxy with FTP |
|
bmasterc@126
|
527 |
2: IdFTP.ProxySettings.ProxyType := fpcmOpen; // Open |
|
bmasterc@126
|
528 |
3: IdFTP.ProxySettings.ProxyType := fpcmSite; // Site |
|
bmasterc@126
|
529 |
4: IdFTP.ProxySettings.ProxyType := fpcmTransparent; // Transparent |
|
bmasterc@126
|
530 |
5: IdFTP.ProxySettings.ProxyType := fpcmUserPass; // User (Password) |
|
bmasterc@126
|
531 |
6: IdFTP.ProxySettings.ProxyType := fpcmUserSite; // User (Site) |
|
bmasterc@126
|
532 |
end; |
|
bmasterc@126
|
533 |
|
|
bmasterc@126
|
534 |
IdFTP.ProxySettings.Host := frmProxy.txtHost.Text; |
|
bmasterc@126
|
535 |
IdFTP.ProxySettings.UserName := frmProxy.txtPort.Text; |
|
bmasterc@126
|
536 |
IdFTP.ProxySettings.Password := frmProxy.txtPassword.Text; |
|
bmasterc@126
|
537 |
IdFTP.ProxySettings.Port := StrToInt(frmProxy.txtPort.Text); |
|
bmasterc@126
|
538 |
end; |
|
bmasterc@126
|
539 |
|
|
bmasterc@126
|
540 |
procedure TfrmMain.txtPortChange(Sender: TObject); |
|
bmasterc@126
|
541 |
var i: integer; |
|
bmasterc@126
|
542 |
begin |
|
bmasterc@126
|
543 |
if txtPort.Text = '' then |
|
bmasterc@126
|
544 |
txtPort.Text := '21' |
|
bmasterc@126
|
545 |
else begin |
|
bmasterc@126
|
546 |
// check if value is numeric... |
|
bmasterc@126
|
547 |
for i := Length(txtPort.Text) downto 1 do begin |
|
bmasterc@126
|
548 |
if Pos(txtPort.Text[i], '0123456789') = 0 then begin |
|
bmasterc@126
|
549 |
txtPort.Text := '21'; |
|
bmasterc@126
|
550 |
txtPort.SelStart := 4; |
|
bmasterc@126
|
551 |
exit; |
|
bmasterc@126
|
552 |
end; |
|
bmasterc@126
|
553 |
end; |
|
bmasterc@126
|
554 |
end; |
|
bmasterc@126
|
555 |
end; |
|
bmasterc@126
|
556 |
|
|
bmasterc@126
|
557 |
procedure TfrmMain.trvDirectoriesExpanded(Sender: TObject; |
|
bmasterc@126
|
558 |
Node: TTreeNode); |
|
bmasterc@126
|
559 |
var ePath: String; |
|
bmasterc@126
|
560 |
CurNode: TTreeNode; |
|
bmasterc@126
|
561 |
i: integer; |
|
bmasterc@126
|
562 |
begin |
|
bmasterc@126
|
563 |
if Node.Item[0].Text = 'Scanning...' then begin // no directories added yet |
|
bmasterc@126
|
564 |
Screen.Cursor := crHourGlass; |
|
bmasterc@126
|
565 |
// get complete path |
|
bmasterc@126
|
566 |
ePath := '/'; |
|
bmasterc@126
|
567 |
CurNode := Node; |
|
bmasterc@126
|
568 |
repeat |
|
bmasterc@126
|
569 |
ePath := '/' + CurNode.Text + ePath; |
|
bmasterc@126
|
570 |
CurNode := CurNode.Parent; |
|
bmasterc@126
|
571 |
until (not Assigned(CurNode)); |
|
bmasterc@126
|
572 |
// change dir and add directories in it |
|
bmasterc@126
|
573 |
try |
|
bmasterc@126
|
574 |
Repaint; |
|
bmasterc@126
|
575 |
IdFTP.ChangeDir(ePath); |
|
bmasterc@126
|
576 |
with GetAllDirs do begin |
|
bmasterc@126
|
577 |
Node.Item[0].Free; |
|
bmasterc@126
|
578 |
for i := 0 to Count -1 do begin |
|
bmasterc@126
|
579 |
trvDirectories.Items.AddChild(trvDirectories.Items.AddChild(Node, Strings[i]), 'Scanning...'); |
|
bmasterc@126
|
580 |
end; |
|
bmasterc@126
|
581 |
Free; |
|
bmasterc@126
|
582 |
end; |
|
bmasterc@126
|
583 |
finally |
|
bmasterc@126
|
584 |
Application.ProcessMessages; |
|
bmasterc@126
|
585 |
end; |
|
bmasterc@126
|
586 |
Screen.Cursor := crDefault; |
|
bmasterc@126
|
587 |
end; |
|
bmasterc@126
|
588 |
end; |
|
bmasterc@126
|
589 |
|
|
bmasterc@126
|
590 |
procedure TfrmMain.trvDirectoriesChange(Sender: TObject; Node: TTreeNode); |
|
bmasterc@126
|
591 |
begin |
|
bmasterc@126
|
592 |
cmdNext.Enabled := Assigned(trvDirectories.Selected); |
|
bmasterc@126
|
593 |
end; |
|
bmasterc@126
|
594 |
|
|
bmasterc@126
|
595 |
procedure TfrmMain.IdFTPWork(Sender: TObject; AWorkMode: TWorkMode; |
|
bmasterc@126
|
596 |
const AWorkCount: Integer); |
|
bmasterc@126
|
597 |
begin |
|
bmasterc@126
|
598 |
if AWorkCount > 15 then begin |
|
bmasterc@126
|
599 |
ggeItem.Progress := AWorkCount; |
|
bmasterc@126
|
600 |
CurrProgress := AWorkCount; |
|
bmasterc@126
|
601 |
end; |
|
bmasterc@126
|
602 |
|
|
bmasterc@126
|
603 |
if Cancel then |
|
bmasterc@126
|
604 |
IdFTP.Abort; |
|
bmasterc@126
|
605 |
|
|
bmasterc@126
|
606 |
Application.ProcessMessages; |
|
bmasterc@126
|
607 |
end; |
|
bmasterc@126
|
608 |
|
|
bmasterc@126
|
609 |
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); |
|
bmasterc@126
|
610 |
begin |
|
bmasterc@126
|
611 |
if (jplWizard.ActivePage = jspFTP) and (IdFTP.Connected) then |
|
bmasterc@126
|
612 |
IdFTP.Quit; |
|
bmasterc@126
|
613 |
if (jplWizard.ActivePage = jspInstallProgress) and (ggeAll.Progress <> ggeAll.MaxValue) and (not Cancel) then begin |
|
bmasterc@126
|
614 |
if MessageBox(Handle, 'Do you really want to cancel the installation?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNO) = mrYes then begin |
|
bmasterc@126
|
615 |
Screen.Cursor := crDefault; |
|
bmasterc@126
|
616 |
Application.OnException := ExceptionHandler; |
|
bmasterc@126
|
617 |
Cancel := True; |
|
bmasterc@126
|
618 |
if IdFTP.Connected then |
|
bmasterc@126
|
619 |
IdFTP.Quit; |
|
bmasterc@126
|
620 |
end |
|
bmasterc@126
|
621 |
else |
|
bmasterc@126
|
622 |
Action := caNone; |
|
bmasterc@126
|
623 |
end; |
|
bmasterc@126
|
624 |
end; |
|
bmasterc@126
|
625 |
|
|
bmasterc@126
|
626 |
procedure TfrmMain.ExceptionHandler(Sender: TObject; E: Exception); |
|
bmasterc@126
|
627 |
begin |
|
bmasterc@126
|
628 |
// IF any exceptions were raised after close, nobody would want them so leave this empty |
|
bmasterc@126
|
629 |
end; |
|
bmasterc@126
|
630 |
|
|
bmasterc@126
|
631 |
procedure TfrmMain.tmrSpeedTimer(Sender: TObject); |
|
bmasterc@126
|
632 |
begin |
|
bmasterc@126
|
633 |
Caption := CalcSpeed(OldProgress, CurrProgress); |
|
bmasterc@126
|
634 |
OldProgress := CurrProgress; |
|
bmasterc@126
|
635 |
end; |
|
bmasterc@126
|
636 |
|
|
bmasterc@126
|
637 |
procedure TfrmMain.trvDirectoriesExpanding(Sender: TObject; |
|
bmasterc@126
|
638 |
Node: TTreeNode; var AllowExpansion: Boolean); |
|
bmasterc@126
|
639 |
begin |
|
bmasterc@126
|
640 |
Node.ImageIndex := 1; |
|
bmasterc@126
|
641 |
Node.SelectedIndex := 1; |
|
bmasterc@126
|
642 |
end; |
|
bmasterc@126
|
643 |
|
|
bmasterc@126
|
644 |
procedure TfrmMain.trvDirectoriesCollapsing(Sender: TObject; |
|
bmasterc@126
|
645 |
Node: TTreeNode; var AllowCollapse: Boolean); |
|
bmasterc@126
|
646 |
begin |
|
bmasterc@126
|
647 |
Node.ImageIndex := 0; |
|
bmasterc@126
|
648 |
Node.SelectedIndex := 0; |
|
bmasterc@126
|
649 |
end; |
|
bmasterc@126
|
650 |
|
|
bmasterc@126
|
651 |
end. |