Move T6 parser to javascript parser

This commit is contained in:
RaidMax
2019-02-03 20:47:05 -06:00
parent e6bfa408f8
commit ce02f5dd68
17 changed files with 97 additions and 192 deletions

View File

@ -13,7 +13,9 @@ namespace SharedLibraryCore.RCon
public string Ban { get; set; }
public string Unban { get; set; }
public string TempBan { get; set; }
public string RConQuery { get; set; }
public string RConCommand { get; set; }
public string RConGetDvar { get; set; }
public string RConSetDvar { get; set; }
public string RConGetStatus { get; set; }
public string RConGetInfo { get; set; }
public string RConResponse { get; set; }

View File

@ -45,7 +45,7 @@ namespace SharedLibraryCore.RCon
Config = config;
}
public async Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "", bool waitForResponse = true)
public async Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "")
{
if (!ActiveQueries.ContainsKey(this.Endpoint))
{
@ -75,18 +75,26 @@ namespace SharedLibraryCore.RCon
#endif
byte[] payload = null;
bool waitForResponse = Config.WaitForResponse;
switch (type)
{
case StaticHelpers.QueryType.DVAR:
case StaticHelpers.QueryType.GET_DVAR:
waitForResponse |= true;
payload = (string.Format(Config.CommandPrefixes.RConGetDvar, RConPassword, parameters + '\0')).Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.SET_DVAR:
payload = (string.Format(Config.CommandPrefixes.RConSetDvar, RConPassword, parameters + '\0')).Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.COMMAND:
payload = Utilities.EncodingType
.GetBytes(string.Format(Config.CommandPrefixes.RConQuery, RConPassword, parameters + '\0'));
payload = (string.Format(Config.CommandPrefixes.RConCommand, RConPassword, parameters + '\0')).Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.GET_STATUS:
waitForResponse |= true;
payload = (Config.CommandPrefixes.RConGetStatus + '\0').Select(Convert.ToByte).ToArray();
break;
case StaticHelpers.QueryType.GET_INFO:
waitForResponse |= true;
payload = (Config.CommandPrefixes.RConGetInfo + '\0').Select(Convert.ToByte).ToArray();
break;
}

View File

@ -24,7 +24,12 @@ namespace SharedLibraryCore.RCon
/// retrieve the value of a DVAR
/// RCon password is required
/// </summary>
DVAR,
GET_DVAR,
/// <summary>
/// set the value of a DVAR
/// RCon password is required
/// </summary>
SET_DVAR,
/// <summary>
/// execute a command
/// RCon password is required