2020-11-11 19:53:23 -05:00
|
|
|
|
using System;
|
2018-04-11 18:24:21 -04:00
|
|
|
|
using System.Threading.Tasks;
|
2019-01-26 21:33:37 -05:00
|
|
|
|
using static SharedLibraryCore.Server;
|
2018-04-11 18:24:21 -04:00
|
|
|
|
|
|
|
|
|
namespace SharedLibraryCore.Interfaces
|
|
|
|
|
{
|
|
|
|
|
public interface IRConParser
|
|
|
|
|
{
|
2019-02-02 20:40:37 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// retrieves the value of a given DVAR
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">type of DVAR expected (string, int, float etc...)</typeparam>
|
|
|
|
|
/// <param name="connection">RCon connection to retrieve with</param>
|
|
|
|
|
/// <param name="dvarName">name of DVAR</param>
|
2020-04-17 16:05:16 -04:00
|
|
|
|
/// <param name="fallbackValue">default value to return if dvar retrieval fails</param>
|
2019-02-02 20:40:37 -05:00
|
|
|
|
/// <returns></returns>
|
2020-04-17 16:05:16 -04:00
|
|
|
|
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default);
|
2019-02-02 20:40:37 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// set value of DVAR by name
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="connection">RCon connection to use</param>
|
|
|
|
|
/// <param name="dvarName">name of DVAR to set</param>
|
|
|
|
|
/// <param name="dvarValue">value to set DVAR to</param>
|
|
|
|
|
/// <returns></returns>
|
2020-02-11 17:44:06 -05:00
|
|
|
|
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue);
|
2019-02-02 20:40:37 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// executes a console command on the server
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="connection">RCon connection to use</param>
|
|
|
|
|
/// <param name="command">console command to execute</param>
|
|
|
|
|
/// <returns></returns>
|
2020-02-11 17:44:06 -05:00
|
|
|
|
Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command);
|
2019-02-02 20:40:37 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// get the list of connected clients from status response
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="connection">RCon connection to use</param>
|
2021-06-03 11:51:03 -04:00
|
|
|
|
/// <returns><see cref="IStatusResponse"/></returns>
|
|
|
|
|
Task<IStatusResponse> GetStatusAsync(IRConConnection connection);
|
2019-02-02 20:40:37 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// stores the RCon configuration
|
|
|
|
|
/// </summary>
|
2019-01-26 21:33:37 -05:00
|
|
|
|
IRConParserConfiguration Configuration { get; set; }
|
2019-02-02 20:40:37 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// stores the game/client specific version (usually the value of the "version" DVAR)
|
|
|
|
|
/// </summary>
|
2021-06-03 11:51:03 -04:00
|
|
|
|
string Version { get; }
|
2019-02-05 19:02:45 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...)
|
|
|
|
|
/// </summary>
|
2021-06-03 11:51:03 -04:00
|
|
|
|
Game GameName { get; }
|
2019-02-05 19:02:45 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// indicates if the game supports generating a log path from DVAR retrieval
|
|
|
|
|
/// of fs_game, fs_basepath, g_log
|
|
|
|
|
/// </summary>
|
2021-06-03 11:51:03 -04:00
|
|
|
|
bool CanGenerateLogPath { get; }
|
2020-01-21 19:08:18 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-16 18:16:12 -04:00
|
|
|
|
/// specifies the name of the parser
|
2020-01-21 19:08:18 -05:00
|
|
|
|
/// </summary>
|
2021-06-03 11:51:03 -04:00
|
|
|
|
string Name { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// specifies the type of rcon engine
|
|
|
|
|
/// eg: COD, Source
|
|
|
|
|
/// </summary>
|
|
|
|
|
string RConEngine { get; }
|
2021-06-07 17:58:36 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// indicates that the game does not log to the mods folder (when mod is loaded),
|
|
|
|
|
/// but rather always to the fs_basegame directory
|
|
|
|
|
/// </summary>
|
|
|
|
|
bool IsOneLog { get; }
|
2020-06-16 18:16:12 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// retrieves the value of given dvar key if it exists in the override dict
|
|
|
|
|
/// otherwise returns original
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dvarName">name of dvar key</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
string GetOverrideDvarName(string dvarName);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// retrieves the configuration value of a dvar key for
|
|
|
|
|
/// games that do not support the given dvar
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dvarName">dvar key name</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
T GetDefaultDvarValue<T>(string dvarName);
|
2020-11-11 19:53:23 -05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// determines the amount of time to wait for the command to respond
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="command">name of command being executed</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
TimeSpan OverrideTimeoutForCommand(string command);
|
2018-04-11 18:24:21 -04:00
|
|
|
|
}
|
|
|
|
|
}
|