From b29fb68ec60e8f2951bce19d9b4293312bc5d28b Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 16 Dec 2023 23:28:14 +0800 Subject: [PATCH] [exgui] Implement RconConfig procedures --- exgui/RconConfig.dfm | Bin 1306 -> 902 bytes exgui/RconConfig.pas | 31 ++++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/exgui/RconConfig.dfm b/exgui/RconConfig.dfm index e62f2e51d519e247d3347e7e01f9686232c09d85..48e8653b91a7e0adaadbedad3af44101dd8ce80e 100644 GIT binary patch literal 902 zcmaKq!Ec)|6viD`FaZ+fl0$DjZ`zjg4x1VpmZ)7o30jYvftSRpV@JkQ+dpNu{f(7& z-oSVESJJLq>tC1<>7I zS@*sv?`Wa+_A}~-f(eNSIh!dSksN|ZaP=YF6Ip`7!PRQB{1Gm$)|+|inU=l~jm)WC^oqS;9+GL zfj4hqs+s;Do6$=RAboNUr!3SCW zGCAZ;#ztt-gmcrbc5%uWH{*EDNyeaXJ4FjuOEa3^rT$C8ieP-%-jEibd;~i QIcB^Qu}>nymepvW|7G48=>Px# literal 1306 zcmbtTO>f&U488AH=oVl=hd7_zfE^kyL5dYkkQnP>7zWv95^ahUNE+Jy`;n5R*j<+$ zb}`IHihPex(&Z1R9NQf?l~%b{JF)-3igx&hu{+o~_K^+yLktRi!vFD*{%6|MV7BgA z0%E28B)HUjOyvCJgjNXlHgMDq81}Xr%fgHv)kp!#EkW!L)IIA@6Zjx%cR*|~8W5(X zHW*cM=G1~$fY?GS_bxwhV}TCe+;4Bc=gXVTc3z}xI`$w`tse_`axs^tUS(Ot?)i~a z^uB>)Zf$up;GHzTnalp|!T6k$lqI$^fVw<$0Y-tIt_OvlAMlxWx6_p5VxLi(>aiwD_%;d xk#@ZL9pa%k5|^U-iA9N*2VQO#vs_gmUnQMQ{*Sfq{Ksa4Lmh&?u+5J)`x~w#ah(7F diff --git a/exgui/RconConfig.pas b/exgui/RconConfig.pas index 78c2f50..2343a82 100644 --- a/exgui/RconConfig.pas +++ b/exgui/RconConfig.pas @@ -4,7 +4,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls; + Dialogs, StdCtrls, ShellAPI; type TfmRconConfig = class(TForm) @@ -29,26 +29,47 @@ var implementation +uses + Rcon; + {$R *.dfm} procedure TfmRconConfig.edHostKeyPress(Sender: TObject; var Key: Char); begin - // TODO: TfmRconConfig.edHostKeyPress + if not (Key in ['0'..'9','a'..'z','A'..'Z','.',':']) + and (Key <> #8) and (Key <> #46) then + Key:= #0; end; procedure TfmRconConfig.bnCancelClick(Sender: TObject); begin - // TODO: TfmRconConfig.bnCancelClick + Close; end; procedure TfmRconConfig.bnConnectClick(Sender: TObject); + var + //fmRcon: TfmRcon; + Server, Addr, Port: String; begin - // TODO: TfmRconConfig.bnConnectClick + //fmRcon:= TfmRcon.Create(Application); + //fmRcon.Host:= edHost.Text; + //fmRcon.Password:= edPassword.Text; + //fmRcon.Show; + Server:= edHost.Text; + if Pos(':', Server) <> 0 then begin + Addr:= Copy(Server, 1, Pos(':', Server)-1); + Port:= Copy(Server, Pos(':', Server)+1, 5); + end else begin + Addr:= Server; + Port:= '5193'; + end; + ShellExecute(0, 'open', 'rcon.exe', PChar(Addr + ' ' + Port + ' ' + edPassword.text), PChar(ExtractFilePath(ParamStr(0))), SW_SHOWNORMAL); + Close; end; procedure TfmRconConfig.edPasswordChange(Sender: TObject); begin - // TODO: TfmRconConfig.edPasswordChange + bnConnect.Enabled:= (edHost.Text <> '') and (edPassword.Text <> ''); end; end.