unmeme a dvar check
This commit is contained in:
parent
ee087f1c85
commit
0b643b2099
@ -929,7 +929,7 @@ namespace IW4MAdmin
|
|||||||
infoResponse["mapname"];
|
infoResponse["mapname"];
|
||||||
int maxplayers = (GameName == Game.IW4) ? // gotta love IW4 idiosyncrasies
|
int maxplayers = (GameName == Game.IW4) ? // gotta love IW4 idiosyncrasies
|
||||||
(await this.GetDvarAsync<int>("party_maxplayers")).Value :
|
(await this.GetDvarAsync<int>("party_maxplayers")).Value :
|
||||||
infoResponse == null ?
|
infoResponse == null || !infoResponse.ContainsKey("sv_maxclients") ?
|
||||||
(await this.GetDvarAsync<int>("sv_maxclients")).Value :
|
(await this.GetDvarAsync<int>("sv_maxclients")).Value :
|
||||||
Convert.ToInt32(infoResponse["sv_maxclients"]);
|
Convert.ToInt32(infoResponse["sv_maxclients"]);
|
||||||
var gametype = infoResponse == null ?
|
var gametype = infoResponse == null ?
|
||||||
|
@ -167,6 +167,12 @@ namespace IW4MAdmin.Application.RCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.Length == 0)
|
||||||
|
{
|
||||||
|
_log.WriteWarning($"Received empty response for request [{type.ToString()}, {parameters}, {Endpoint.ToString()}]");
|
||||||
|
return new string[0];
|
||||||
|
}
|
||||||
|
|
||||||
string responseString = type == StaticHelpers.QueryType.COMMAND_STATUS ?
|
string responseString = type == StaticHelpers.QueryType.COMMAND_STATUS ?
|
||||||
ReassembleSegmentedStatus(response) :
|
ReassembleSegmentedStatus(response) :
|
||||||
_gameEncoding.GetString(response[0]) + '\n';
|
_gameEncoding.GetString(response[0]) + '\n';
|
||||||
@ -187,9 +193,9 @@ namespace IW4MAdmin.Application.RCon
|
|||||||
throw new ServerException(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_NOT_RUNNING"].FormatExt(Endpoint.ToString()));
|
throw new ServerException(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_NOT_RUNNING"].FormatExt(Endpoint.ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] headerSplit = responseString.Split(config.CommandPrefixes.RConResponse);
|
string[] headerSplit = responseString.Split(type == StaticHelpers.QueryType.GET_INFO ? config.CommandPrefixes.RconGetInfoResponseHeader : config.CommandPrefixes.RConResponse);
|
||||||
|
|
||||||
if (headerSplit.Length != 2 && type != StaticHelpers.QueryType.GET_INFO)
|
if (headerSplit.Length != 2)
|
||||||
{
|
{
|
||||||
throw new NetworkException("Unexpected response header from server");
|
throw new NetworkException("Unexpected response header from server");
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ namespace IW4MAdmin.Application.RconParsers
|
|||||||
RConGetStatus = "ÿÿÿÿgetstatus",
|
RConGetStatus = "ÿÿÿÿgetstatus",
|
||||||
RConGetInfo = "ÿÿÿÿgetinfo",
|
RConGetInfo = "ÿÿÿÿgetinfo",
|
||||||
RConResponse = "ÿÿÿÿprint",
|
RConResponse = "ÿÿÿÿprint",
|
||||||
|
RconGetInfoResponseHeader = "ÿÿÿÿinfoResponse"
|
||||||
},
|
},
|
||||||
ServerNotRunningResponse = "Server is not running."
|
ServerNotRunningResponse = "Server is not running."
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ var plugin = {
|
|||||||
rconParser.Configuration.Dvar.AddMapping(107, 2);
|
rconParser.Configuration.Dvar.AddMapping(107, 2);
|
||||||
rconParser.Configuration.WaitForResponse = false;
|
rconParser.Configuration.WaitForResponse = false;
|
||||||
|
|
||||||
rconParser.Configuration.StatusHeader.Patter = 'num +score +bot +ping +guid +name +lastmsg +address +qport +rate *';
|
rconParser.Configuration.StatusHeader.Pattern = 'num +score +bot +ping +guid +name +lastmsg +address +qport +rate *';
|
||||||
rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +([0-9]+) +(?:[0-1]{1}) +([0-9]+) +([A-F0-9]+) +(.+?) +(?:[0-9]+) +(\\d+\\.\\d+\\.\\d+\\.\\d+\\:-?\\d{1,5}|0+\\.0+:-?\\d{1,5}|loopback) +(?:-?[0-9]+) +(?:[0-9]+) *$';
|
rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +([0-9]+) +(?:[0-1]{1}) +([0-9]+) +([A-F0-9]+) +(.+?) +(?:[0-9]+) +(\\d+\\.\\d+\\.\\d+\\.\\d+\\:-?\\d{1,5}|0+\\.0+:-?\\d{1,5}|loopback) +(?:-?[0-9]+) +(?:[0-9]+) *$';
|
||||||
rconParser.Configuration.Status.AddMapping(100, 1);
|
rconParser.Configuration.Status.AddMapping(100, 1);
|
||||||
rconParser.Configuration.Status.AddMapping(101, 2);
|
rconParser.Configuration.Status.AddMapping(101, 2);
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
public string RConGetStatus { get; set; }
|
public string RConGetStatus { get; set; }
|
||||||
public string RConGetInfo { get; set; }
|
public string RConGetInfo { get; set; }
|
||||||
public string RConResponse { get; set; }
|
public string RConResponse { get; set; }
|
||||||
|
public string RconGetInfoResponseHeader { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user