2020-11-19 20:48:25 -06:00
|
|
|
|
using System;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2019-01-26 20:33:37 -06:00
|
|
|
|
using SharedLibraryCore.RCon;
|
2020-06-16 17:16:12 -05:00
|
|
|
|
using System.Collections.Generic;
|
2020-01-15 18:43:52 -06:00
|
|
|
|
using System.Globalization;
|
2021-11-23 17:26:33 -06:00
|
|
|
|
using SharedLibraryCore.Formatting;
|
2019-01-26 20:33:37 -06:00
|
|
|
|
|
2021-06-03 10:51:03 -05:00
|
|
|
|
namespace IW4MAdmin.Application.RConParsers
|
2019-01-26 20:33:37 -06:00
|
|
|
|
{
|
2019-02-02 19:40:37 -06:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// generic implementation of the IRConParserConfiguration
|
|
|
|
|
/// allows script plugins to generate dynamic RCon configurations
|
|
|
|
|
/// </summary>
|
2020-04-21 17:34:00 -05:00
|
|
|
|
public class DynamicRConParserConfiguration : IRConParserConfiguration
|
2019-01-26 20:33:37 -06:00
|
|
|
|
{
|
|
|
|
|
public CommandPrefix CommandPrefixes { get; set; }
|
2020-04-01 14:11:56 -05:00
|
|
|
|
public ParserRegex Status { get; set; }
|
|
|
|
|
public ParserRegex MapStatus { get; set; }
|
2020-08-05 09:30:02 -05:00
|
|
|
|
public ParserRegex GametypeStatus { get; set; }
|
2021-06-03 10:51:03 -05:00
|
|
|
|
public ParserRegex HostnameStatus { get; set; }
|
|
|
|
|
public ParserRegex MaxPlayersStatus { get; set; }
|
2020-04-01 14:11:56 -05:00
|
|
|
|
public ParserRegex Dvar { get; set; }
|
2020-04-17 15:05:16 -05:00
|
|
|
|
public ParserRegex StatusHeader { get; set; }
|
2020-01-13 16:51:16 -06:00
|
|
|
|
public string ServerNotRunningResponse { get; set; }
|
2019-02-03 20:47:05 -06:00
|
|
|
|
public bool WaitForResponse { get; set; } = true;
|
2020-01-15 18:43:52 -06:00
|
|
|
|
public NumberStyles GuidNumberStyle { get; set; } = NumberStyles.HexNumber;
|
2020-06-16 17:16:12 -05:00
|
|
|
|
public IDictionary<string, string> OverrideDvarNameMapping { get; set; } = new Dictionary<string, string>();
|
|
|
|
|
public IDictionary<string, string> DefaultDvarValues { get; set; } = new Dictionary<string, string>();
|
2020-11-17 18:24:54 -06:00
|
|
|
|
public int NoticeMaximumLines { get; set; } = 8;
|
|
|
|
|
public int NoticeMaxCharactersPerLine { get; set; } = 50;
|
2020-11-19 20:48:25 -06:00
|
|
|
|
public string NoticeLineSeparator { get; set; } = Environment.NewLine;
|
2021-11-14 21:38:00 -06:00
|
|
|
|
public int? DefaultRConPort { get; set; }
|
|
|
|
|
public string DefaultInstallationDirectoryHint { get; set; }
|
2022-02-08 12:03:55 -06:00
|
|
|
|
public short FloodProtectInterval { get; set; } = 750;
|
2020-04-01 14:11:56 -05:00
|
|
|
|
|
2021-11-23 17:26:33 -06:00
|
|
|
|
public ColorCodeMapping ColorCodeMapping { get; set; } = new ColorCodeMapping
|
|
|
|
|
{
|
|
|
|
|
// this is the default mapping (IW4), but can be overridden as needed in the parsers
|
|
|
|
|
{ColorCodes.Black.ToString(), "^0"},
|
|
|
|
|
{ColorCodes.Red.ToString(), "^1"},
|
|
|
|
|
{ColorCodes.Green.ToString(), "^2"},
|
|
|
|
|
{ColorCodes.Yellow.ToString(), "^3"},
|
|
|
|
|
{ColorCodes.Blue.ToString(), "^4"},
|
|
|
|
|
{ColorCodes.Cyan.ToString(), "^5"},
|
|
|
|
|
{ColorCodes.Pink.ToString(), "^6"},
|
|
|
|
|
{ColorCodes.White.ToString(), "^7"},
|
|
|
|
|
{ColorCodes.Map.ToString(), "^8"},
|
|
|
|
|
{ColorCodes.Grey.ToString(), "^9"},
|
|
|
|
|
{ColorCodes.Wildcard.ToString(), ":^"},
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-01 14:11:56 -05:00
|
|
|
|
public DynamicRConParserConfiguration(IParserRegexFactory parserRegexFactory)
|
|
|
|
|
{
|
|
|
|
|
Status = parserRegexFactory.CreateParserRegex();
|
|
|
|
|
MapStatus = parserRegexFactory.CreateParserRegex();
|
2020-08-05 09:30:02 -05:00
|
|
|
|
GametypeStatus = parserRegexFactory.CreateParserRegex();
|
2020-04-01 14:11:56 -05:00
|
|
|
|
Dvar = parserRegexFactory.CreateParserRegex();
|
2020-04-17 15:05:16 -05:00
|
|
|
|
StatusHeader = parserRegexFactory.CreateParserRegex();
|
2021-06-03 10:51:03 -05:00
|
|
|
|
HostnameStatus = parserRegexFactory.CreateParserRegex();
|
|
|
|
|
MaxPlayersStatus = parserRegexFactory.CreateParserRegex();
|
2020-04-01 14:11:56 -05:00
|
|
|
|
}
|
2019-01-26 20:33:37 -06:00
|
|
|
|
}
|
2022-02-08 12:03:55 -06:00
|
|
|
|
}
|