procedure GetInfo;
var
request: TInfoRequest;
response: TInfoResponse;
buffer: TBufferArray;
i: Integer;
begin
request.RequestHeader := -1;
request.PacketHeader := '
T';
request.Payload := '
Source Engine Query';
// Von mir aus auch mit einer Konstante oder einem Ressourcestring
request.Payload[19] := #0;
form4.udp1.RemoteHost:= form4.edit1.Text;
form4.udp1.RemotePort:= form4.edit2.Text;
form4.udp1.Open;
if (form4.udp1.Connected)
then
form4.Udp1.SendBuf(request, SizeOf(TInfoRequest));
form4.Udp1.ReceiveBuf(buffer, SizeOf(buffer));
i := 0;
Move(buffer[i], response.ResponseHeader, SizeOf(response.ResponseHeader)); inc(i, SizeOf(response.ResponseHeader));
Move(buffer[i], response.PacketHeader, SizeOf(response.PacketHeader)); inc(i, SizeOf(response.PacketHeader));
Move(buffer[i], response.Protocol, SizeOf(response.Protocol)); inc(i, SizeOf(response.Protocol));
response.
Name := GetString(buffer, i);
response.Map := GetString(buffer, i);
response.Folder := GetString(buffer, i);
response.Game := GetString(buffer, i);
Move(buffer[i], response.ID, SizeOf(response.ID)); inc(i, SizeOf(response.ID));
Move(buffer[i], response.Players, SizeOf(response.Players)); inc(i, SizeOf(response.Players));
Move(buffer[i], response.MaxPlayers, SizeOf(response.MaxPlayers)); inc(i, SizeOf(response.MaxPlayers));
Move(buffer[i], response.Bots, SizeOf(response.Bots)); inc(i, SizeOf(response.Bots));
Move(buffer[i], response.ServerType, SizeOf(response.ServerType)); inc(i, SizeOf(response.ServerType));
Move(buffer[i], response.Environment, SizeOf(response.Environment)); inc(i, SizeOf(response.Environment));
Move(buffer[i], response.Visibility, SizeOf(response.Visibility)); inc(i, SizeOf(response.Visibility));
Move(buffer[i], response.VAC, SizeOf(response.VAC)); inc(i, SizeOf(response.VAC));
response.Version := GetString(buffer, i);
form4.lblServerName.Caption := response.
Name;