Changed license in sourcehook_hookmangen_x86.h (agreed to by BAILOPAN and faluco)
Updated MSVC7 proj file
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, TFlatRadioButtonUnit, StdCtrls, ComCtrls, mxFlatControls, JvPageList,
8 ExtCtrls, JvExControls, JvComponent, TFlatButtonUnit, jpeg, TFlatEditUnit,
9 TFlatGaugeUnit, ImgList, FileCtrl, Registry, CheckLst, TFlatComboBoxUnit,
10 TFlatCheckBoxUnit, IdBaseComponent, IdComponent, IdTCPConnection,
11 IdTCPClient, IdFTP, IdException, IdAntiFreezeBase, IdAntiFreeze,
12 IdIntercept, IdLogBase, IdLogFile, pngimage;
15 TfrmMain = class(TForm)
16 jplWizard: TJvPageList;
17 jspWelcome: TJvStandardPage;
21 cmdCancel: TFlatButton;
27 jspLicense: TJvStandardPage;
32 freLicense: TmxFlatRichEdit;
33 frbAgree: TFlatRadioButton;
34 ftbDontAgree: TFlatRadioButton;
35 jspInstallMethod: TJvStandardPage;
40 lblInstallMethod: TLabel;
41 pnlInstallMethod: TPanel;
42 frbDedicatedServer: TFlatRadioButton;
43 frbListenServer: TFlatRadioButton;
44 frbSelectMod: TFlatRadioButton;
45 frbFTP: TFlatRadioButton;
47 jspFTP: TJvStandardPage;
57 txtUserName: TFlatEdit;
58 txtPassword: TFlatEdit;
63 cmdConnect: TFlatButton;
65 trvDirectories: TTreeView;
67 jspInstallProgress: TJvStandardPage;
75 rtfDetails: TmxFlatRichEdit;
83 jspSelectMod: TJvStandardPage;
87 lblSelectModInfo: TLabel;
90 chkPassive: TFlatCheckBox;
93 optWindows: TFlatRadioButton;
94 optLinux: TFlatRadioButton;
96 cmdProxySettings: TFlatButton;
97 IdAntiFreeze: TIdAntiFreeze;
98 frbStandaloneServer: TFlatRadioButton;
100 IdLogFile: TIdLogFile;
103 FlatRadioButton1: TFlatRadioButton;
104 procedure jvwStepsCancelButtonClick(Sender: TObject);
105 procedure cmdCancelClick(Sender: TObject);
106 procedure cmdNextClick(Sender: TObject);
107 procedure CheckNext(Sender: TObject);
108 procedure cmdBackClick(Sender: TObject);
109 procedure cmdConnectClick(Sender: TObject);
110 procedure jplWizardChange(Sender: TObject);
111 procedure FormCreate(Sender: TObject);
112 procedure cmdProxySettingsClick(Sender: TObject);
113 procedure txtPortChange(Sender: TObject);
114 procedure trvDirectoriesExpanded(Sender: TObject; Node: TTreeNode);
115 procedure trvDirectoriesChange(Sender: TObject; Node: TTreeNode);
116 procedure IdFTPWork(Sender: TObject; AWorkMode: TWorkMode;
117 const AWorkCount: Integer);
118 procedure FormClose(Sender: TObject; var Action: TCloseAction);
119 procedure tmrSpeedTimer(Sender: TObject);
120 procedure trvDirectoriesExpanding(Sender: TObject; Node: TTreeNode;
121 var AllowExpansion: Boolean);
122 procedure trvDirectoriesCollapsing(Sender: TObject; Node: TTreeNode;
123 var AllowCollapse: Boolean);
124 procedure trvModsClick(Sender: TObject);
125 procedure trvDirectoriesMouseDown(Sender: TObject;
126 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
128 OldProgress: Integer;
129 CurrProgress: Integer;
131 procedure ExceptionHandler(Sender: TObject; E: Exception);
137 var VERSION: String = '<none>';
141 uses UnitFunctions, UnitfrmProxy, UnitInstall, UnitSelectModPath;
145 procedure TfrmMain.jvwStepsCancelButtonClick(Sender: TObject);
150 procedure TfrmMain.cmdCancelClick(Sender: TObject);
155 procedure TfrmMain.cmdNextClick(Sender: TObject);
157 eRegistry: TRegistry;
165 if jplWizard.ActivePage = jspFTP then begin
166 if not IdFTP.Connected then
168 eStr := TStringList.Create;
170 CurNode := trvDirectories.Selected;
171 if (Assigned(CurNode)) then begin
173 ePath := '/' + CurNode.Text + ePath;
174 CurNode := CurNode.Parent;
175 until (not Assigned(CurNode));
177 IdFTP.ChangeDir(ePath);
178 IdFTP.List(eStr, '', False);
179 eStr.CaseSensitive := False;
180 // check if gameinfo.txt is in the directory -> valid installation
181 if (eStr.IndexOf('gameinfo.txt') = -1) then begin
182 MessageBox(Handle, 'Invalid directory. Please select your mod directory and try again.', PChar(Application.Title), MB_ICONWARNING);
188 // check for orangebox directory
190 if (AnsiSameText(ExtractFileName(trvDirectories.Selected.Text), 'tf')) then begin
191 case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
192 mrYes: Source := False;
193 mrNo: Source := True;
201 trvDirectories.Enabled := False;
202 cmdConnect.Enabled := False;
203 optWindows.Enabled := False;
204 optLinux.Enabled := False;
205 Screen.Cursor := crHourGlass;
207 if optWindows.Checked then
212 jspInstallProgress.Show;
214 Screen.Cursor := crAppStart;
215 InstallFTP(eOS, Source);
217 else if jplWizard.ActivePage = jspInstallProgress then
219 else if jplWizard.ActivePage = jspSelectMod then begin
221 if frbDedicatedServer.Checked then begin
223 ePath := trvMods.Selected.Text;
224 if ePath = 'Counter-Strike:Source' then
225 ePath := trvMods.Selected.Parent.Text + '\source dedicated server\cstrike'
226 else if ePath = 'Day of Defeat:Source' then
227 ePath := trvMods.Selected.Parent.Text + '\source dedicated server\dod'
228 else if ePath = 'Half-Life 2 Deathmatch' then
229 ePath := trvMods.Selected.Parent.Text + '\source dedicated server\hl2mp'
232 if ePath = 'Team Fortress 2' then
233 ePath := trvMods.Selected.Parent.Text + '\source 2007 dedicated server\tf';
234 { ask user, just in case }
235 case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
236 mrYes: Source := False;
237 mrNo: Source := True;
241 SteamPath := IncludeTrailingPathDelimiter(SteamPath) + 'steamapps\';
243 if DirectoryExists(SteamPath + ePath) then begin
244 jspInstallProgress.Show;
245 InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True, Source);
248 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);
253 { Standalone Server }
254 if frbStandaloneServer.Checked then begin
256 ePath := trvMods.Selected.Text;
257 if ePath = 'Counter-Strike:Source' then
259 else if ePath = 'Day of Defeat:Source' then
261 else if ePath = 'Half-Life 2 Deathmatch' then
265 if ePath = 'Team Fortress 2' then
266 ePath := 'orangebox\tf';
267 { ask user, just in case }
268 case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
269 mrYes: Source := False;
270 mrNo: Source := True;
275 if DirectoryExists(StandaloneServer + ePath) then begin
276 jspInstallProgress.Show;
277 InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False, Source)
280 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);
286 if frbListenServer.Checked then begin
288 ePath := trvMods.Selected.Text;
289 if ePath = 'Counter-Strike:Source' then
290 ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\counter-strike source\cstrike'
291 else if ePath = 'Half-Life 2 Deathmatch' then
292 ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\half-life 2 deathmatch\hl2mp'
293 else if ePath = 'Day of Defeat:Source' then
294 ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod'
297 if ePath = 'Team Fortress 2' then
298 ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\team fortress 2\tf';
299 { ask user, just in case }
300 case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
301 mrYes: Source := False;
302 mrNo: Source := True;
307 if Pos(SteamPath, ePath) = 0 then
308 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)
310 if not FileExists(ePath + '\gameinfo.txt') then begin
311 MessageBox(Handle, 'You have to play this game once before installing Metamod:Source. Do that and try again.', PChar(Application.Title), MB_ICONWARNING);
315 jspInstallProgress.Show;
316 InstallListen(IncludeTrailingPathDelimiter(ePath), Source);
321 else if jplWizard.ActivePage <> jspInstallMethod then
324 if frbDedicatedServer.Checked then begin // Dedicated Server
325 eRegistry := TRegistry.Create(KEY_READ);
327 eRegistry.RootKey := HKEY_CURRENT_USER;
328 if eRegistry.OpenKey('Software\Valve\Steam', False) then begin
329 ePath := eRegistry.ReadString('SteamPath');
330 ePath := IncludeTrailingPathDelimiter(StringReplace(ePath, '/', '\', [rfReplaceAll]));
333 ePath := ePath + 'SteamApps\';
334 if DirectoryExists(ePath) then begin
337 eStr := GetAllFiles(ePath + '*.*', faDirectory, False, True, False);
338 for i := 0 to eStr.Count -1 do begin
339 CurNode := trvMods.Items.Add(nil, eStr[i]);
341 if DirectoryExists(ePath + eStr[i] + '\source dedicated server\cstrike') then
342 trvMods.Items.AddChild(CurNode, 'Counter-Strike:Source');
343 if DirectoryExists(ePath + eStr[i] + '\source dedicated server\dod') then
344 trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
345 if DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp') then
346 trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
347 if DirectoryExists(ePath + eStr[i] + '\source 2007 dedicated server\tf') then
348 trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
350 if CurNode.Count = 0 then
353 CurNode.Expand(False);
357 trvMods.Selected := nil;
358 cmdNext.Enabled := False;
361 MessageBox(Handle, 'You have to run Dedicated Server once before installing Metamod:Source!', 'Error', MB_ICONWARNING);
364 MessageBox(Handle, 'You haven''t installed Steam yet! Download it at www.steampowered.com, install Dedicated Server and try again.', 'Error', MB_ICONWARNING);
369 else if frbListenServer.Checked then begin // Listen Server
370 eRegistry := TRegistry.Create(KEY_READ);
372 eRegistry.RootKey := HKEY_CURRENT_USER;
373 if eRegistry.OpenKey('Software\Valve\Steam', False) then begin
374 ePath := eRegistry.ReadString('SteamPath');
375 ePath := IncludeTrailingPathDelimiter(StringReplace(ePath, '/', '\', [rfReplaceAll]));
378 ePath := ePath + 'SteamApps\';
379 if DirectoryExists(ePath) then begin
382 eStr := GetAllFiles(ePath + '*.*', faDirectory, False, True, False);
383 for i := 0 to eStr.Count -1 do begin
384 CurNode := trvMods.Items.Add(nil, eStr[i]);
386 if DirectoryExists(ePath + eStr[i] + '\counter-strike source') then
387 trvMods.Items.AddChild(CurNode, 'Counter-Strike:Source');
388 if DirectoryExists(ePath + eStr[i] + '\day of defeat source') then
389 trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
390 if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
391 trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
392 if DirectoryExists(ePath + eStr[i] + '\team fortress 2') then
393 trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
395 if CurNode.Count = 0 then
398 CurNode.Expand(False);
402 trvMods.Selected := nil;
403 cmdNext.Enabled := False;
406 MessageBox(Handle, 'You haven''t installed Steam yet! Download it at www.steampowered.com, install Dedicated Server and try again.', 'Error', MB_ICONWARNING);
409 MessageBox(Handle, 'You haven''t installed Steam yet! Download it at www.steampowered.com, install Dedicated Server and try again.', 'Error', MB_ICONWARNING);
414 else if frbStandaloneServer.Checked then begin // Standalone Server
415 eRegistry := TRegistry.Create;
417 eRegistry.RootKey := HKEY_CURRENT_USER;
418 if eRegistry.OpenKey('Software\Valve\HLServer', False) then begin
419 StandaloneServer := IncludeTrailingPathDelimiter(eRegistry.ReadString('InstallPath'));
420 if DirectoryExists(StandaloneServer + 'cstrike') then
421 trvMods.Items.Add(nil, 'Counter-Strike:Source');
422 if DirectoryExists(StandaloneServer + 'dod') then
423 trvMods.Items.Add(nil, 'Day of Defeat:Source');
424 if DirectoryExists(StandaloneServer + 'hl2mp') then
425 trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
426 if DirectoryExists(StandaloneServer + 'orangebox\tf') then
427 trvMods.Items.Add(nil, 'Team Fortress 2');
429 cmdNext.Enabled := False;
432 MessageBox(Handle, 'You haven''t installed Half-Life Dedicated Server yet!', 'Error', MB_ICONWARNING);
437 else if frbSelectMod.Checked then begin
439 if frmSelectModPath.ShowModal = mrOk then begin
440 ePath := frmSelectModPath.trvDirectory.SelectedFolder.PathName;
441 { check if this is an orangebox game }
443 if (AnsiSameText(ExtractFileName(ePath), 'tf')) then begin
444 case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
445 mrYes: Source := False;
446 mrNo: Source := True;
451 jspInstallProgress.Show;
452 InstallCustom(IncludeTrailingPathDelimiter(ePath), osWindows, Source);
455 else if frbFTP.Checked then // FTP
460 procedure TfrmMain.CheckNext(Sender: TObject);
462 cmdNext.Enabled := frbAgree.Checked;
465 procedure TfrmMain.cmdBackClick(Sender: TObject);
467 if jplWizard.ActivePage = jspFTP then
468 jspInstallMethod.Show
471 cmdBack.Visible := jplWizard.ActivePageIndex <> 0;
475 procedure TfrmMain.cmdConnectClick(Sender: TObject);
481 if (Trim(txtHost.Text) = '') or (Trim(txtUsername.Text) = '') then
482 MessageBox(Handle, 'Please fill in each field!', PChar(Application.Title), MB_ICONWARNING)
483 else if cmdConnect.Caption = 'Connect' then begin
484 // ... design stuff ...
485 Screen.Cursor := crHourGlass;
486 cmdConnect.Enabled := False;
487 cmdProxySettings.Enabled := False;
488 txtHost.Enabled := False;
489 txtPort.Enabled := False;
490 txtUsername.Enabled := False;
491 txtPassword.Enabled := False;
492 chkPassive.Enabled := False;
493 cmdConnect.Caption := 'Connecting...';
494 // ... set values ...
495 IdFTP.Host := txtHost.Text;
496 IdFTP.Port := StrToInt(txtPort.Text);
497 IdFTP.Username := txtUsername.Text;
498 IdFTP.Passive := chkPassive.Checked;
499 IdFTP.Password := txtPassword.Text;
500 // ... connect and check values etc ...
502 IdFTP.Connect(True, 15000);
503 // ... get initial directory ...
504 Path := IdFTP.RetrieveCurrentDir;
505 // ... "fix" path ...
506 eStr := TStringList.Create;
507 eStr.Text := StringReplace(Path, '/', #13, [rfReplaceAll]);
508 for i := eStr.Count -1 downto 0 do begin
512 if (Copy(Path, Length(Path) -1, 1) <> '/') then
514 // ... connect successful, change captions ...
515 trvDirectories.Enabled := True;
516 cmdConnect.Enabled := True;
517 cmdConnect.Caption := 'Disconnect';
518 // ... change to / and create all the directories ...
520 if (Path <> '/') then begin
522 IdFTP.ChangeDir('/');
523 with GetAllDirs do begin
524 for i := 0 to Count -1 do begin
525 if (Assigned(CurNode)) then
526 trvDirectories.Items.AddChild(trvDirectories.Items.Add(nil, Strings[i]), 'Scanning...')
528 CurNode := trvDirectories.Items.Add(nil, Strings[i]);
529 trvDirectories.Items.AddChild(CurNode, 'Scanning...');
530 if (Pos('/' + CurNode.Text + '/', Path) = 0) then
536 IdFTP.ChangeDir(Path);
538 if (IdFTP.Connected) then
539 IdFTP.ChangeDir(Path)
544 // ... find directories in start path ...
545 if eStr.Count <> 0 then begin
546 for i := 0 to eStr.Count -1 do begin
547 if (not ((i = 0) and (Assigned(CurNode)))) then
548 CurNode := trvDirectories.Items.AddChild(CurNode, eStr[i]);
551 trvDirectories.Selected := CurNode;
553 // ... scan for directories ...
554 with GetAllDirs do begin
555 for i := 0 to Count -1 do
556 trvDirectories.Items.AddChild(trvDirectories.Items.AddChild(CurNode, Strings[i]), 'Scanning...');
560 if Assigned(CurNode) then
561 CurNode.Expand(False);
563 on E: Exception do begin
564 // reset button properties
565 cmdConnect.Enabled := True;
566 txtHost.Enabled := True;
567 txtPort.Enabled := True;
568 txtUsername.Enabled := True;
569 txtPassword.Enabled := True;
570 chkPassive.Enabled := True;
571 cmdProxySettings.Enabled := True;
572 cmdNext.Enabled := False;
573 cmdConnect.Caption := 'Connect';
575 if Pos('Login incorrect.', E.Message) <> 0 then begin // login failed
576 MessageBox(Handle, 'Login incorrect. Check your FTP settings and try again.', PChar(Application.Title), MB_ICONWARNING);
577 txtUsername.SetFocus;
578 txtUsername.SelectAll;
580 else if Pos('Host not found.', E.Message) <> 0 then begin // host not found
581 MessageBox(Handle, 'The entered host couldn''t be found. Check your settings and try again.', PChar(Application.Title), MB_ICONWARNING);
585 else if Pos('Connection refused.', E.Message) <> 0 then begin // wrong port (?)
586 MessageBox(Handle, 'The host refused the connection. Check your port and try again.', PChar(Application.Title), MB_ICONWARNING);
590 else if E is EIdProtocolReplyError then begin // wrong port
591 MessageBox(Handle, 'The port you entered is definitely wrong. Check it and try again.', PChar(Application.Title), MB_ICONWARNING);
596 MessageBox(Handle, PChar(E.Message), PChar(Application.Title), MB_ICONWARNING); // unknown error
597 // ... connect failed, leave procedure ...
598 Screen.Cursor := crDefault;
603 Screen.Cursor := crDefault;
606 Screen.Cursor := crHourGlass;
608 trvDirectories.Items.Clear;
609 trvDirectories.Enabled := False;
610 cmdConnect.Enabled := True;
611 cmdProxySettings.Enabled := True;
612 txtHost.Enabled := True;
613 txtPort.Enabled := True;
614 txtUsername.Enabled := True;
615 txtPassword.Enabled := True;
616 chkPassive.Enabled := True;
617 cmdConnect.Caption := 'Connect';
618 cmdNext.Enabled := False;
619 Screen.Cursor := crDefault;
623 procedure TfrmMain.jplWizardChange(Sender: TObject);
625 if (jplWizard.ActivePage = jspInstallProgress) then begin
626 cmdNext.Caption := '&Finish';
627 cmdNext.Enabled := False;
628 cmdBack.Visible := False;
631 cmdNext.Caption := '&Next >';
632 cmdNext.Enabled := True;
633 cmdBack.Visible := jplWizard.ActivePageIndex <> 0;
636 if (jplWizard.ActivePage = jspLicense) then
637 cmdNext.Enabled := frbAgree.Checked;
639 if (jplWizard.ActivePage = jspFTP) then
640 cmdNext.Enabled := False;
643 procedure TfrmMain.FormCreate(Sender: TObject);
645 if LowerCase(ParamStr(1)) = '-logftp' then begin
646 MessageBox(Handle, 'FTP installation will be logged to FTP.log!', PChar(Application.Title), MB_ICONINFORMATION);
647 IdLogFile.Filename := ExtractFilePath(ParamStr(0)) + 'FTP.log';
648 IdLogFile.Active := True;
654 procedure TfrmMain.cmdProxySettingsClick(Sender: TObject);
657 // Apply Proxy Settings
658 case frmProxy.cboProxy.ItemIndex of
659 0: IdFTP.ProxySettings.ProxyType := fpcmNone; // none
660 1: IdFTP.ProxySettings.ProxyType := fpcmHttpProxyWithFtp; // HTTP Proxy with FTP
661 2: IdFTP.ProxySettings.ProxyType := fpcmOpen; // Open
662 3: IdFTP.ProxySettings.ProxyType := fpcmSite; // Site
663 4: IdFTP.ProxySettings.ProxyType := fpcmTransparent; // Transparent
664 5: IdFTP.ProxySettings.ProxyType := fpcmUserPass; // User (Password)
665 6: IdFTP.ProxySettings.ProxyType := fpcmUserSite; // User (Site)
668 IdFTP.ProxySettings.Host := frmProxy.txtHost.Text;
669 IdFTP.ProxySettings.UserName := frmProxy.txtPort.Text;
670 IdFTP.ProxySettings.Password := frmProxy.txtPassword.Text;
671 IdFTP.ProxySettings.Port := StrToInt(frmProxy.txtPort.Text);
674 procedure TfrmMain.txtPortChange(Sender: TObject);
677 if txtPort.Text = '' then
680 // check if value is numeric...
681 for i := Length(txtPort.Text) downto 1 do begin
682 if Pos(txtPort.Text[i], '0123456789') = 0 then begin
683 txtPort.Text := '21';
684 txtPort.SelStart := 4;
691 procedure TfrmMain.trvDirectoriesExpanded(Sender: TObject;
697 if Node.Item[0].Text = 'Scanning...' then begin // no directories added yet
698 Screen.Cursor := crHourGlass;
703 ePath := '/' + CurNode.Text + ePath;
704 CurNode := CurNode.Parent;
705 until (not Assigned(CurNode));
706 // change dir and add directories in it
709 IdFTP.ChangeDir(ePath);
710 with GetAllDirs do begin
712 for i := 0 to Count -1 do begin
713 trvDirectories.Items.AddChild(trvDirectories.Items.AddChild(Node, Strings[i]), 'Scanning...');
718 Application.ProcessMessages;
720 Screen.Cursor := crDefault;
724 procedure TfrmMain.trvDirectoriesChange(Sender: TObject; Node: TTreeNode);
726 cmdNext.Enabled := Assigned(trvDirectories.Selected);
729 procedure TfrmMain.IdFTPWork(Sender: TObject; AWorkMode: TWorkMode;
730 const AWorkCount: Integer);
732 if AWorkCount > 15 then begin
733 ggeItem.Progress := AWorkCount;
734 CurrProgress := AWorkCount;
740 Application.ProcessMessages;
743 procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
745 if (jplWizard.ActivePage = jspFTP) and (IdFTP.Connected) then
747 if (jplWizard.ActivePage = jspInstallProgress) and (ggeAll.Progress <> ggeAll.MaxValue) and (not Cancel) then begin
748 if MessageBox(Handle, 'Do you really want to cancel the installation?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNO) = mrYes then begin
749 Screen.Cursor := crDefault;
750 Application.OnException := ExceptionHandler;
752 if IdFTP.Connected then
760 procedure TfrmMain.ExceptionHandler(Sender: TObject; E: Exception);
762 // IF any exceptions were raised after close, nobody would want them so leave this empty
765 procedure TfrmMain.tmrSpeedTimer(Sender: TObject);
767 Caption := CalcSpeed(OldProgress, CurrProgress);
768 OldProgress := CurrProgress;
771 procedure TfrmMain.trvDirectoriesExpanding(Sender: TObject;
772 Node: TTreeNode; var AllowExpansion: Boolean);
774 Node.ImageIndex := 1;
775 Node.SelectedIndex := 1;
778 procedure TfrmMain.trvDirectoriesCollapsing(Sender: TObject;
779 Node: TTreeNode; var AllowCollapse: Boolean);
781 Node.ImageIndex := 0;
782 Node.SelectedIndex := 0;
785 procedure TfrmMain.trvModsClick(Sender: TObject);
787 if Assigned(trvMods.Selected) then
788 cmdNext.Enabled := Assigned(trvMods.Selected.Parent)
790 cmdNext.Enabled := False;
793 procedure TfrmMain.trvDirectoriesMouseDown(Sender: TObject;
794 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
797 Node := trvDirectories.GetNodeAt(X, Y);
798 if (Assigned(Node)) then begin
799 if (Node.DisplayRect(True).Right < X) then
800 trvDirectories.Selected := nil;