-
Notifications
You must be signed in to change notification settings - Fork 0
/
servermain.pas
760 lines (680 loc) · 24.9 KB
/
servermain.pas
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
(*----------------------------------------------------------------------------+
Winfragg(c) is created by Wash for A.M.U
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The CsTiger searching feature is an exclusivity for Winfragg(c) only.
Amu's page : http://winfragg.sourceforge.net/
Dev Page : https://sourceforge.net/projects/winfragg/
Contact : amunit@users.sourceforge.net
CsTiger : http://www.cstiger.de
Borland : http://www.borland.com
+----------------------------------------------------------------------------*)
unit servermain;
interface
uses
Windows, SysUtils, Variants, Classes, Controls, Forms, ComCtrls, QueryLib,
ExtCtrls, Buttons, StdCtrls, Menus, NMHttp, constants, tstruct, Clipbrd,
Graphics, ShellApi, Dialogs;
type
TMainServer = class(TForm)
lvServers : TListView;
TopPanel: TShape;
StatusB: TStatusBar;
CBMap: TComboBox;
CBmod: TComboBox;
CBPing: TComboBox;
CBPinging: TComboBox;
LPing: TLabel;
CBEGames: TComboBoxEx;
SBSearch: TSpeedButton;
SBStop: TSpeedButton;
SBPing: TSpeedButton;
Pop: TPopupMenu;
SBSetup: TSpeedButton;
Image1: TImage;
CBName: TComboBox;
LName: TLabel;
CBGames: TComboBoxEx;
CBNetwork: TComboBoxEx;
lvServers2: TListView;
Pop2: TPopupMenu;
function SetFilters : TFilter;
function Initialize : Boolean;
function Filter(HPacket : TPacketHead; Nfo : TRInfo) : boolean;
procedure LoadTigerList(Tlst : PTCsTiger);
Procedure addItem(Sender : Tobject);
Procedure AddServer(HPacket : TPacketHead; Nfo : TRInfo);
procedure QueryTiming(Sender : TObject);
procedure GetPacket(HPacket : TPacketHead; nfo : TRInfo; lst : PTSSList);
procedure LoadMasterList(HPacket : TPacketHead; Ml : PTSSList);
procedure SBSearchClick(Sender: TObject);
procedure SBStopClick(Sender: TObject);
procedure SBSetupClick(Sender: TObject);
procedure lvServersColumnClick(Sender: TObject; Column: TListColumn);
procedure lvServersCompare(Sender: TObject; Item1, Item2: TListItem;
Data: Integer; var Compare: Integer);
procedure lvServersDblClick(Sender: TObject);
procedure SBPingClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure lvServersContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Refreshserver1Click(Sender: TObject);
procedure Importtobookmark1Click(Sender: TObject);
procedure Go1Click(Sender: TObject);
procedure RestoredefaultColumnwidth1Click(Sender: TObject);
procedure HTTPOPacketRecvd(Sender: TObject);
procedure HTTPODisconnect(Sender: TObject);
procedure Copyiptoclipboard1Click(Sender: TObject);
procedure DisplayRules;
procedure lvServers2ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Image1Click(Sender: TObject);
procedure CBEGamesClick(Sender: TObject);
protected
ColumnToSort: integer;
ColumnSortUp: boolean;
private
MasterFilter : TFilter;
DelayQuery : TTImer;
HTTPO : TNMHTTP;
TopM : PTSSList;
nbServ, ListIndex : Word;
ProgressBar : TProgressBar;
end;
var MainServer: TMainServer;
implementation
uses main, setup, bookmark, syslib;
{$R *.dfm}
procedure TMainServer.FormCreate(Sender: TObject);
begin
DelayQuery := TTimer.create (nil);
DelayQuery.Enabled := false;
DelayQuery.OnTimer := QueryTiming;
HTTPO := TNMHTTP.Create(Nil);
HTTPO.OnPacketRecvd := HTTPOPacketRecvd;
HTTPO.OnDisconnect := HTTPODisconnect;
HTTPO.TimeOut := HTTPMASTERQUERYTIMEOUT;
HTTPO.Port := 80;
ProgressBar := TProgressBar.Create(Self);
with ProgressBar do
begin
Parent := StatusB;
Top := 2;
Left := 1;
Width := StatusB.Panels[0].Width;
Height := Parent.ClientHeight - 2;
Smooth := true
end
end;
procedure TMainServer.SBSetupClick(Sender: TObject);
begin
SetupMain.PAdvance.BringToFront;
SetupMain.Show
end;
procedure TMainServer.SBStopClick(Sender: TObject);
begin
if DelayQuery.Enabled then DelayQuery.Enabled := false;
SBStop.Tag := SBSearch.Tag
end;
procedure TMainServer.SBPingClick(Sender: TObject);
begin
if lvServers.Items.Count = 0 then exit;
ListIndex:=0;
SBPing.Enabled := false;
DelayQuery.Tag := 1;
DelayQuery.Enabled := true
end;
Procedure TMainServer.addItem(Sender : Tobject);
begin
if (Sender as TComboBox).Items.IndexOf((Sender as TComboBox).Text) = -1
then (Sender as TComboBox).Items.Append((Sender as TComboBox).Text)
end;
function TMainServer.Initialize : Boolean;
var S, Code : Integer;
begin
Result := false;
val(CBPing.Text,S,Code);
if (Code <> 0) and (CBPinging.Text <> '') then
begin
MessageDlg('Invalid ping value', mtWarning, [mbOk], 0);
exit
end;
Case CBEGames.ItemIndex of
0..9 : begin
addItem(CBMap);
addItem(CBMod);
addItem(CBPing);
end;
10..11 : addItem(CBName)
end;
lvServers.Clear;
ProgressBar.Position := 0;
ProgressBar.Max := 0;
StatusB.Panels[2].Text := '';
DelayQuery.Interval := SetupMain.SENetwork.Value;
DelayQuery.Enabled := false;
SBSearch.Tag := 1;
SBStop.Tag := 0;
nbserv := 0;
TopM:=new(PTSSList);
TopM^.Next := nil;
Result := true
end;
(*----------------------------------------------------------------------------+
"SetFilters" creates a master filter with current settings.
+----------------------------------------------------------------------------*)
function TMainServer.SetFilters : TFilter;
var Game, Mode : String[5];
begin
ProgressBar.Max := SetupMain.SPMaxServerQuery.Value;
With Result do
begin
MaxSrv := SetupMain.SPMaxServerQuery.Value;
PassWord := SetupMain.CBPassword.Checked;
EmptySrv := SetupMain.CBEmptyServer.Checked;
FullSrv := SetupMain.CBFullServer.Checked;
DedicSrv := SetupMain.CBDServer.Checked;
ACProtect := SetupMain.CBVAC.Checked;
FriendlyFire := SetupMain.CBFF.Checked;
QueryMaster := '';
case CBEGames.ItemIndex of
0..3 : //HL
begin
Case CBEGames.ItemIndex of
0 : MasterIP := VLMSIPEAST;
1 : MasterIP := VLMSIPWEST;
2 : MasterIP := VLMSIPCENTRAL;
3 : MasterIP := STEAMMSCENTRAL;
end;
QueryPing := VLPING;
QueryServer := VLQUERY;
if CBmod.Text <> ''
then QueryMaster := '\gamedir\' + CBmod.Text;
if CBMap.Text <> ''
then QueryMaster := QueryMaster + '\map\' + CBMap.Text;
if FullSrv
then QueryMaster := QueryMaster + '\full\1';
if EmptySrv
then QueryMaster := QueryMaster + '\empty\1';
if PassWord
then QueryMaster := QueryMaster + '\password\1';
if DedicSrv
then QueryMaster := QueryMaster + '\type\d';
if ACProtect
then QueryMaster := QueryMaster + '\secure\1'
end;
4..8 : //iD
begin
QueryPing := IDPING;
QueryServer := IDQUERY;
QueryMaster := 'ÿÿÿÿgetservers ';
Case CBEGames.ItemIndex of
4 : begin
QueryMaster := QueryMaster +
SetupMain.ListGame.Items[4].SubItems[4];
MasterIP := IDMSIPJK2
end;
5 : begin
QueryMaster := QueryMaster +
SetupMain.ListGame.Items[1].SubItems[4];
MasterIP := IDMSIPMONSTER
end;
6 : begin
QueryMaster := QueryMaster +
SetupMain.ListGame.Items[3].SubItems[4];
MasterIP := IDMSIPRTCWET
end;
7 : begin
QueryMaster := QueryMaster +
SetupMain.ListGame.Items[2].SubItems[4];
MasterIP := IDMSIPMONSTER
end;
8 : begin
QueryMaster := QueryMaster +
SetupMain.ListGame.Items[5].SubItems[4];
MasterIP := IDMSIPSOF2
end
end
end;
9 : //UT
begin
QueryServer := EPQUERY;
QueryPing := EPPING;
QueryMaster := EPMASTERQUERY
end;
10..11 : //CsTiger
begin
Mode := 's=';
if CBEGames.ItemIndex = 10 then Mode := 'p=';
Case CBGames.ItemIndex of
0 : Game := 'all';
1 : Game := 'hl';
2 : Game := 'q3';
3 : Game := 'ut2k3';
4 : Game := 'bf42'
end;
QueryMaster := CSTIGERQ + Mode + CBName.Text + '&e=' + Game;
end
end;
end;
MasterFilter := Result
end;
procedure TMainServer.DisplayRules;
begin
With MasterFilter do
begin
StatusB.Panels[2].Text := ' No rule(s)';
if DedicSrv
then StatusB.Panels[2].Text := ' | Dedicated';
if EmptySrv
then StatusB.Panels[2].Text := ' | No Empty';
if FullSrv
then StatusB.Panels[2].Text := StatusB.Panels[2].Text + ' | No Fully';
if ACProtect
then StatusB.Panels[2].Text := StatusB.Panels[2].Text + ' | AC';
if PassWord
then StatusB.Panels[2].Text := StatusB.Panels[2].Text + ' | No Password';
if FriendlyFire
then StatusB.Panels[2].Text := StatusB.Panels[2].Text + ' | Friendly Fire'
end
end;
procedure TMainServer.SBSearchClick(Sender: TObject);
var HPacket : TPacketHead;
begin
if not Initialize then exit;
SetFilters;
DisplayRules;
Case CBEGames.ItemIndex of
0..8 : LoadMasterList(HPacket,nil);
9..11 : begin
HTTPO.Tag := CBEGames.ItemIndex;
HTTPO.Get(MasterFilter.QueryMaster)
end
end
end;
procedure TMainServer.Refreshserver1Click(Sender: TObject);
begin
QueryMain.QueryServer(4,MasterFilter.QueryServer,lvServers.Selected.Caption)
end;
procedure TMainServer.HTTPODisconnect(Sender: TObject);
begin
DelayQuery.Tag := 0;
DelayQuery.Enabled := true
end;
procedure TMainServer.HTTPOPacketRecvd(Sender: TObject);
var HPacket : TPacketHead;
begin
Case TNMHTTP(Sender).Tag of
9 : LoadMasterList(HPacket,QueryMain.FUTSList(HTTPO.Body))
else LoadTigerList(QueryMain.FCSTiger(HTTPO.Body))
end
end;
(*----------------------------------------------------------------------------+
"LoadTigerList" gets "Tlst" PTCsTiger type. Displays the players coming from
CsTiger.de report.
+----------------------------------------------------------------------------*)
procedure TMainServer.LoadTigerList(Tlst : PTCsTiger);
var Curr : PTCsTiger;
LstItem : TListItem;
begin
lvServers2.Clear;
Curr := TLst;
While Curr^.Next <> nil do
begin
if Curr.Game <> 0 then
begin
LstItem := lvServers2.Items.Add;
With LstItem.SubItems do
begin
LstItem.ImageIndex := Curr^.Game;
LstItem.Caption := Curr^.Address;
Add(Curr^.SPName);
if CBEGames.ItemIndex = 11 then Add('')
else Add(Curr^.PSNAme)
end;
end;
Curr := Curr^.Next;
end;
ProgressBar.Position := ProgressBar.Max;
StatusB.Panels[1].Text := IntToStr(lvServers2.Items.Count) + ' Item(s) found';
Dispose(Tlst)
end;
(*----------------------------------------------------------------------------+
"GetPacket" gets "HPacket" TPacketHead type, "nfo" TRInfo type and "lst"
PSSList type. Adds or loads new incoming servers.
+----------------------------------------------------------------------------*)
procedure TMainServer.GetPacket(HPacket : TPacketHead; nfo : TRInfo; lst : PTSSList);
begin
if lst <> nil then LoadMasterList(HPacket,lst)
else
if HPacket.UdpTag = 6 then AddServer(HPacket,nfo)
else
if Filter(HPacket, nfo) then AddServer(HPacket,nfo)
end;
(*----------------------------------------------------------------------------+
"LoadMasterList" gets "HPacket" TPacketHead type and "Ml" PSSList type.
Loads the Master server list before query.
+----------------------------------------------------------------------------*)
procedure TMainServer.LoadMasterList(HPacket : TPacketHead; Ml : PTSSList);
var Curr : PTSSList;
i : byte;
begin
if Ml = nil then
Case CBEGames.ItemIndex of
0..3 : for i:=0 to 3 do HPacket.MQuery[i]:=0
end
else
begin
Curr := Ml;
while (Curr^.Next <> nil) and
(nbserv < MasterFilter.MaxSrv) and
(SBStop.Tag <> 1) do
begin
inc(nbserv);
StatusB.Panels[1].Text := inttostr(nbserv) + ' server(s) received';
Curr := Curr^.Next
end;
Curr^.Next := TopM^.Next;
TopM^.Next := Ml;
if (HPacket.MQuery[0] = 0) and (CBEGames.ItemIndex = 0)
then nbserv := MasterFilter.MaxSrv;
end;
if CBEGames.ItemIndex = 9 then exit;
if (nbserv < MasterFilter.MaxSrv) and (SBStop.Tag = 0)
then
Case CBEGames.ItemIndex of
0..3 : QueryMain.QueryServer(5,#$31+chr(HPacket.MQuery[0])+
chr(HPacket.MQuery[1])+
chr(HPacket.MQuery[2])+
chr(HPacket.MQuery[3])+
MasterFilter.QueryMaster,
MasterFilter.MasterIP)
else QueryMain.QueryServer(5, MasterFilter.QueryMaster, MasterFilter.MasterIP)
end
else
begin
DelayQuery.Tag := 0;
DelayQuery.Enabled := true
end
end;
(*----------------------------------------------------------------------------+
"QueryTiming" performs a ping "1" or a query "0" for each interval of time.
+----------------------------------------------------------------------------*)
procedure TMainServer.QueryTiming(Sender : TObject);
begin
Case TTImer(Sender).Tag of
0 : begin
QueryMain.QueryServer(4,MasterFilter.QueryServer,TopM^.Address);
dec(nbServ);
ProgressBar.Position := ProgressBar.Max - nbServ;
if TopM^.Next <> nil then TopM:=TopM^.Next
else DelayQuery.Enabled := false
end;
1 : begin
if ListIndex > lvServers.Items.Count-1
then
begin
DelayQuery.Enabled := false;
SBPing.Enabled := true;
exit
end;
QueryMain.QueryServer(6,MasterFilter.QueryPing,lvServers.Items[ListIndex].Caption);
inc(ListIndex)
end
end
end;
(*----------------------------------------------------------------------------+
"Filter" gets "HPacket" TPacketHead type and "Nfo" TRInfo type. Performs a
filtering of the list.
+----------------------------------------------------------------------------*)
function TMainServer.Filter(HPacket : TPacketHead; Nfo : TRInfo) : boolean;
begin
Result := false;
if CBEGames.ItemIndex > 3 then//exclude Half Life
begin
if CBPinging.Text = '=' then
if HPacket.Ping <> StrToInt(CBPing.Text) then exit;
if CBPinging.Text = '>' then
if HPacket.Ping < StrToInt(CBPing.Text) then exit;
if CBPinging.Text = '<' then
if HPacket.Ping > StrToInt(CBPing.Text) then exit;
if (MasterFilter.FriendlyFire) and (Nfo.FF = 'OFF')
then exit;
if (Nfo.Description <> CBMod.Text) and (CBMod.Text <> '')
then exit;
if (Nfo.Map <> CBMap.Text) and (CBMap.Text <> '')
then exit;
if (MasterFilter.PassWord) and (Nfo.PassWord <> '-' )
then exit;
if (MasterFilter.ACProtect) and (Nfo.AC = 'OFF')
then exit;
if (MasterFilter.EmptySrv) and (Nfo.NumPlayers = '0')
then exit;
if (MasterFilter.DedicSrv) and (Nfo.NumPlayers <> 'Dedicated')
then exit;
if (MasterFilter.FullSrv) and
((Nfo.NumPlayers + Nfo.ReservedSlots) >= Nfo.MaxPlayers)
then exit;
end;
Result := true
end;
Procedure TMainServer.AddServer(HPacket : TPacketHead; Nfo : TRInfo);
var LstItem : TListItem;
begin
LstItem:= lvServers.FindCaption(0,HPacket.ip +':'+
inttostr(HPacket.port)
,false, true, false);
if LstItem <> nil then
With lvServers.Items[LstItem.Index] do
begin
if HPacket.UdpTag = 6
then
Begin
SubItems[4]:=inttostr(HPacket.Ping);
exit;
end;
ImageIndex := nfo.Icn;
SubItems[0]:=nfo.HostName;
SubItems[1]:=nfo.Description;
SubItems[2]:=nfo.OS;
SubItems[3]:=nfo.Map;
SubItems[5]:=(nfo.NumPlayers + '/' + nfo.MaxPlayers);
SubItems[6]:=nfo.PassWord;
SubItems[10]:=nfo.TypeServer
end
else
begin
LstItem := lvServers.Items.Add;
With LstItem.SubItems do
begin
LstItem.ImageIndex := nfo.Icn;
LstItem.Caption := HPacket.Address;
Add(nfo.HostName);
Add(nfo.Description);
Add(nfo.OS);
Add(nfo.Map);
Add(inttostr(HPacket.Ping));
Add(nfo.NumPlayers + '/' + nfo.MaxPlayers);
Add(nfo.PassWord);
Add(nfo.AC);
Add(nfo.FF);
Add(nfo.TimeLeft);
Add(nfo.TypeServer)
end
end
end;
procedure TMainServer.lvServersColumnClick(Sender: TObject;
Column: TListColumn);
begin
ColumnToSort := Column.Index;
ColumnSortUp := not ColumnSortUp;
TCustomListView(Sender).AlphaSort
end;
(*----------------------------------------------------------------------------+
"LstPlayCompare" compares values into the Listview (players). The syntax was
inspired from "eD2k Utils" (BierBaron).
+----------------------------------------------------------------------------*)
procedure TMainServer.lvServersCompare(Sender: TObject; Item1,
Item2: TListItem; Data: Integer; var Compare: Integer);
var ix, code1, code2: Integer;
x, y: real;
begin
ix := ColumnToSort - 1;
if ix < 0 then
begin
if item1.ImageIndex < item2.ImageIndex then compare := -1
else compare := 1;
exit;
end;
Val(Item1.SubItems[ix], x, Code1);
Val(Item2.SubItems[ix], y, Code2);
If ((Code1 = 0) and (Code2 = 0)) then
begin
If (x < y) then Compare := -1
else Compare := 1;
end
else Compare := CompareText(Item1.SubItems[ix],Item2.SubItems[ix]);
If ColumnSortUp then Compare := Compare * -1
end;
procedure TMainServer.RestoredefaultColumnwidth1Click(Sender: TObject);
begin
Case (Sender as TComponent).Tag of
1 : With lvServers do
begin
Column[0].Width := 140;
Column[1].Width := 160;
Column[2].Width := 100;
Column[3].Width := 100;
Column[4].Width := 90;
Column[5].Width := 40;
Column[6].Width := 65;
Column[7].Width := 65;
Column[8].Width := 35;
Column[9].Width := 35;
Column[10].Width := 60;
Column[11].Width := 70
end;
2 : With lvServers2 do
begin
Column[0].Width := 140;
Column[1].Width := 160;
Column[2].Width := 300
end
end
end;
procedure TMainServer.lvServersDblClick(Sender: TObject);
begin
Case (Sender as TComponent).Tag of
1 : begin
if lvServers.ItemIndex < 0 then exit;
MainForm.CBedit.Text := lvServers.Selected.Caption
end;
2 : begin
if lvServers2.ItemIndex < 0 then exit;
MainForm.CBedit.Text := lvServers2.Selected.Caption
end
end;
MainForm.SBnfo.Click;
MainForm.BringToFront
end;
procedure TMainServer.Go1Click(Sender: TObject);
begin
Case (Sender as TComponent).Tag of
1 : MainForm.CBedit.Text := lvServers.Selected.Caption;
2 : MainForm.CBedit.Text := lvServers2.Selected.Caption
end;
MainForm.BringToFront;
MainForm.SBgo.Click
end;
procedure TMainServer.Importtobookmark1Click(Sender: TObject);
begin
Case (Sender as TComponent).Tag of
1 : MainForm.CBedit.Text := lvServers.Selected.Caption;
2 : MainForm.CBedit.Text := lvServers2.Selected.Caption
end;
MainBook.AddServer(Sender)
end;
procedure TMainServer.Copyiptoclipboard1Click(Sender: TObject);
begin
Case (Sender as TComponent).Tag of
1 :Clipboard.AsText := LvServers.Selected.Caption;
2 :Clipboard.AsText := LvServers2.Selected.Caption
end
end;
procedure TMainServer.lvServers2ContextPopup(Sender: TObject;
MousePos: TPoint; var Handled: Boolean);
begin
if TListView(Sender).GetItemAt(MousePos.X,MousePos.Y) = nil
then
With Pop2 do
begin
Items[0].Enabled := false;
Items[1].Enabled := false;
Items[3].Enabled := false;
Items[5].Enabled := false
end
else
With Pop2 do
begin
Items[0].Enabled := true;
Items[1].Enabled := true;
Items[3].Enabled := true;
Items[5].Enabled := true
end
end;
procedure TMainServer.lvServersContextPopup(Sender: TObject;
MousePos: TPoint; var Handled: Boolean);
begin
if LvServers.GetItemAt(MousePos.X,MousePos.Y) = nil
then
With Pop do
begin
Items[0].Enabled := false;
Items[1].Enabled := false;
Items[2].Enabled := false;
Items[4].Enabled := false;
Items[6].Enabled := false
end
else
With Pop do
begin
Items[0].Enabled := true;
Items[1].Enabled := true;
Items[2].Enabled := true;
Items[4].Enabled := true;
Items[6].Enabled := true
end
end;
procedure TMainServer.FormClose(Sender: TObject; var Action: TCloseAction);
begin
SBStop.Click
end;
procedure TMainServer.Image1Click(Sender: TObject);
begin
try
ShellExecute(Application.MainForm.Handle, Nil,
pchar('http://www.cstiger.de'), Nil, Nil, SW_SHOWNORMAL)
except on E:Exception do getErrorLog(E.Message)
end
end;
procedure TMainServer.CBEGamesClick(Sender: TObject);
begin
Case CBEGames.ItemIndex of
0..9: begin
lvServers.BringToFront;
TopPanel.Height := 26
end;
10..11: begin
lvServers2.BringToFront;
TopPanel.Height := 79
end
end
end;
end.