2023-11-07 17:10:47 +08:00
|
|
|
unit ServerProperties;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
2023-12-16 23:28:45 +08:00
|
|
|
Dialogs, StdCtrls, Menus;
|
2023-11-07 17:10:47 +08:00
|
|
|
|
|
|
|
type
|
2023-11-07 23:44:02 +08:00
|
|
|
TfmServerProperties = class(TForm)
|
2023-12-02 20:35:55 +08:00
|
|
|
lbAddressLab: TLabel;
|
|
|
|
lbPlayersLab: TLabel;
|
|
|
|
lbPingLab: TLabel;
|
|
|
|
lbModeLab: TLabel;
|
|
|
|
lbMapLab: TLabel;
|
|
|
|
lbMap: TLabel;
|
|
|
|
lbMode: TLabel;
|
|
|
|
lbPing: TLabel;
|
|
|
|
lbPlayers: TLabel;
|
|
|
|
edAddress: TEdit;
|
|
|
|
lbHostName: TLabel;
|
|
|
|
lbServerPassword: TLabel;
|
|
|
|
lbRconPassword: TLabel;
|
|
|
|
edServerPassword: TEdit;
|
|
|
|
edRconPassword: TEdit;
|
|
|
|
bnSave: TButton;
|
|
|
|
bnCancel: TButton;
|
|
|
|
bnConnect: TButton;
|
|
|
|
pmCopy: TPopupMenu;
|
|
|
|
piCopy: TMenuItem;
|
2023-12-02 19:57:04 +08:00
|
|
|
procedure bnSaveClick(Sender: TObject);
|
|
|
|
procedure bnCancelClick(Sender: TObject);
|
|
|
|
procedure bnConnectClick(Sender: TObject);
|
|
|
|
procedure pmCopyPopup(Sender: TObject);
|
|
|
|
procedure piCopyClick(Sender: TObject);
|
2023-11-07 17:10:47 +08:00
|
|
|
private
|
|
|
|
{ Private declarations }
|
|
|
|
public
|
|
|
|
{ Public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
2023-11-07 23:44:02 +08:00
|
|
|
fmServerProperties: TfmServerProperties;
|
2023-11-07 17:10:47 +08:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2023-12-16 23:28:45 +08:00
|
|
|
uses Main;
|
|
|
|
|
2023-11-07 17:10:47 +08:00
|
|
|
{$R *.dfm}
|
|
|
|
|
2023-12-02 19:57:04 +08:00
|
|
|
procedure TfmServerProperties.bnSaveClick(Sender: TObject);
|
2023-12-16 23:28:45 +08:00
|
|
|
var
|
|
|
|
Idx: Integer;
|
2023-12-02 19:57:04 +08:00
|
|
|
begin
|
2023-12-16 23:28:45 +08:00
|
|
|
Idx:= StrToInt(fmMain.lbServers.Items.Strings[fmMain.lbServers.ItemIndex]);
|
|
|
|
Servers[Idx].ServerPassword:= edServerPassword.Text;
|
|
|
|
Servers[Idx].RconPassword:= edRconPassword.Text;
|
|
|
|
Close;
|
2023-12-02 19:57:04 +08:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfmServerProperties.bnCancelClick(Sender: TObject);
|
|
|
|
begin
|
2023-12-16 23:28:45 +08:00
|
|
|
Close;
|
2023-12-02 19:57:04 +08:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfmServerProperties.bnConnectClick(Sender: TObject);
|
2023-12-16 23:28:45 +08:00
|
|
|
var
|
|
|
|
Idx: Integer;
|
2023-12-02 19:57:04 +08:00
|
|
|
begin
|
2023-12-16 23:28:45 +08:00
|
|
|
Idx:= StrToInt(fmMain.lbServers.Items.Strings[fmMain.lbServers.ItemIndex]);
|
|
|
|
Servers[Idx].ServerPassword:= edServerPassword.Text;
|
|
|
|
Servers[Idx].RconPassword:= edRconPassword.Text;
|
|
|
|
fmMain.ConnectClick(fmMain);
|
|
|
|
Close;
|
2023-12-02 19:57:04 +08:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfmServerProperties.pmCopyPopup(Sender: TObject);
|
|
|
|
begin
|
2023-12-16 23:28:45 +08:00
|
|
|
piCopy.Enabled:= edAddress.Text <> '- - -';
|
2023-12-02 19:57:04 +08:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfmServerProperties.piCopyClick(Sender: TObject);
|
|
|
|
begin
|
2023-12-16 23:28:45 +08:00
|
|
|
fmMain.SetClipBoardStr(edAddress.Text);
|
2023-12-02 19:57:04 +08:00
|
|
|
end;
|
|
|
|
|
2023-11-07 17:10:47 +08:00
|
|
|
end.
|