support per-command override of rcon timeouts / update t5 parser to reflect
This commit is contained in:
parent
71abaac9e1
commit
a6c0a94f6c
@ -368,15 +368,28 @@ namespace IW4MAdmin.Application.RConParsers
|
|||||||
(T)Convert.ChangeType(Configuration.DefaultDvarValues[dvarName], typeof(T)) :
|
(T)Convert.ChangeType(Configuration.DefaultDvarValues[dvarName], typeof(T)) :
|
||||||
default;
|
default;
|
||||||
|
|
||||||
public TimeSpan OverrideTimeoutForCommand(string command)
|
public TimeSpan? OverrideTimeoutForCommand(string command)
|
||||||
{
|
{
|
||||||
if (command.Contains("map_rotate", StringComparison.InvariantCultureIgnoreCase) ||
|
if (string.IsNullOrEmpty(command))
|
||||||
command.StartsWith("map ", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
{
|
||||||
return TimeSpan.FromSeconds(30);
|
return TimeSpan.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
var commandToken = command.Split(' ', StringSplitOptions.RemoveEmptyEntries).First().ToLower();
|
||||||
|
|
||||||
|
if (!Configuration.OverrideCommandTimeouts.ContainsKey(commandToken))
|
||||||
|
{
|
||||||
|
return TimeSpan.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TimeSpan.Zero;
|
var timeoutValue = Configuration.OverrideCommandTimeouts[commandToken];
|
||||||
|
|
||||||
|
if (timeoutValue.HasValue && timeoutValue.Value != 0) // JINT doesn't seem to be able to properly set nulls on dictionaries
|
||||||
|
{
|
||||||
|
return TimeSpan.FromSeconds(timeoutValue.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace IW4MAdmin.Application.RConParsers
|
|||||||
public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber;
|
public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber;
|
||||||
public IDictionary<string, string> OverrideDvarNameMapping { get; set; } = new Dictionary<string, string>();
|
public IDictionary<string, string> OverrideDvarNameMapping { get; set; } = new Dictionary<string, string>();
|
||||||
public IDictionary<string, string> DefaultDvarValues { get; set; } = new Dictionary<string, string>();
|
public IDictionary<string, string> DefaultDvarValues { get; set; } = new Dictionary<string, string>();
|
||||||
|
public IDictionary<string, int?> OverrideCommandTimeouts { get; set; } = new Dictionary<string, int?>();
|
||||||
public int NoticeMaximumLines { get; set; } = 8;
|
public int NoticeMaximumLines { get; set; } = 8;
|
||||||
public int NoticeMaxCharactersPerLine { get; set; } = 50;
|
public int NoticeMaxCharactersPerLine { get; set; } = 50;
|
||||||
public string NoticeLineSeparator { get; set; } = Environment.NewLine;
|
public string NoticeLineSeparator { get; set; } = Environment.NewLine;
|
||||||
@ -58,6 +59,19 @@ namespace IW4MAdmin.Application.RConParsers
|
|||||||
StatusHeader = parserRegexFactory.CreateParserRegex();
|
StatusHeader = parserRegexFactory.CreateParserRegex();
|
||||||
HostnameStatus = parserRegexFactory.CreateParserRegex();
|
HostnameStatus = parserRegexFactory.CreateParserRegex();
|
||||||
MaxPlayersStatus = parserRegexFactory.CreateParserRegex();
|
MaxPlayersStatus = parserRegexFactory.CreateParserRegex();
|
||||||
|
|
||||||
|
|
||||||
|
const string mapRotateCommand = "map_rotate";
|
||||||
|
const string mapCommand = "map";
|
||||||
|
const string fastRestartCommand = "fast_restart";
|
||||||
|
|
||||||
|
foreach (var command in new[] { mapRotateCommand, mapCommand, fastRestartCommand})
|
||||||
|
{
|
||||||
|
if (!OverrideCommandTimeouts.ContainsKey(command))
|
||||||
|
{
|
||||||
|
OverrideCommandTimeouts.Add(command, 45);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,8 +253,10 @@ namespace Integrations.Cod
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
connectionState.LastQuery = DateTime.Now;
|
connectionState.LastQuery = DateTime.Now;
|
||||||
|
var timeout = _parser.OverrideTimeoutForCommand(parameters);
|
||||||
|
waitForResponse = waitForResponse && timeout.HasValue;
|
||||||
response = await SendPayloadAsync(payload, waitForResponse,
|
response = await SendPayloadAsync(payload, waitForResponse,
|
||||||
_parser.OverrideTimeoutForCommand(parameters), token);
|
timeout ?? TimeSpan.Zero, token);
|
||||||
|
|
||||||
if ((response?.Length == 0 || response[0].Length == 0) && waitForResponse)
|
if ((response?.Length == 0 || response[0].Length == 0) && waitForResponse)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ var eventParser;
|
|||||||
|
|
||||||
var plugin = {
|
var plugin = {
|
||||||
author: 'RaidMax',
|
author: 'RaidMax',
|
||||||
version: 0.1,
|
version: 0.2,
|
||||||
name: 'Plutonium T5 Parser',
|
name: 'Plutonium T5 Parser',
|
||||||
isParser: true,
|
isParser: true,
|
||||||
|
|
||||||
@ -23,6 +23,11 @@ var plugin = {
|
|||||||
rconParser.Configuration.DefaultRConPort = 3074;
|
rconParser.Configuration.DefaultRConPort = 3074;
|
||||||
rconParser.Configuration.CanGenerateLogPath = false;
|
rconParser.Configuration.CanGenerateLogPath = false;
|
||||||
|
|
||||||
|
rconParser.Configuration.OverrideCommandTimeouts.Clear();
|
||||||
|
rconParser.Configuration.OverrideCommandTimeouts.Add('map', 0);
|
||||||
|
rconParser.Configuration.OverrideCommandTimeouts.Add('map_rotate', 0);
|
||||||
|
rconParser.Configuration.OverrideCommandTimeouts.Add('fast_restart', 0);
|
||||||
|
|
||||||
rconParser.Version = 'Call of Duty Multiplayer - Ship COD_T5_S MP build 7.0.189 CL(1022875) CODPCAB-V64 CEG Wed Nov 02 18:02:23 2011 win-x86';
|
rconParser.Version = 'Call of Duty Multiplayer - Ship COD_T5_S MP build 7.0.189 CL(1022875) CODPCAB-V64 CEG Wed Nov 02 18:02:23 2011 win-x86';
|
||||||
rconParser.GameName = 6; // T5
|
rconParser.GameName = 6; // T5
|
||||||
eventParser.Version = 'Call of Duty Multiplayer - Ship COD_T5_S MP build 7.0.189 CL(1022875) CODPCAB-V64 CEG Wed Nov 02 18:02:23 2011 win-x86';
|
eventParser.Version = 'Call of Duty Multiplayer - Ship COD_T5_S MP build 7.0.189 CL(1022875) CODPCAB-V64 CEG Wed Nov 02 18:02:23 2011 win-x86';
|
||||||
|
@ -110,6 +110,6 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command">name of command being executed</param>
|
/// <param name="command">name of command being executed</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
TimeSpan OverrideTimeoutForCommand(string command);
|
TimeSpan? OverrideTimeoutForCommand(string command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,11 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IDictionary<string, string> DefaultDvarValues { get; }
|
IDictionary<string, string> DefaultDvarValues { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// contains a setup of commands that have override timeouts
|
||||||
|
/// </summary>
|
||||||
|
IDictionary<string, int?> OverrideCommandTimeouts { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// specifies how many lines can be used for ingame notice
|
/// specifies how many lines can be used for ingame notice
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -100,7 +105,7 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
string DefaultInstallationDirectoryHint { get; }
|
string DefaultInstallationDirectoryHint { get; }
|
||||||
|
|
||||||
ColorCodeMapping ColorCodeMapping { get; }
|
ColorCodeMapping ColorCodeMapping { get; }
|
||||||
|
|
||||||
short FloodProtectInterval { get; }
|
short FloodProtectInterval { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user