IW4M-Admin/SharedLibraryCore/Interfaces/IRConParser.cs

106 lines
3.9 KiB
C#
Raw Normal View History

using System;
using System.Threading.Tasks;
using static SharedLibraryCore.Server;
namespace SharedLibraryCore.Interfaces
{
public interface IRConParser
{
/// <summary>
2022-01-26 11:32:16 -05:00
/// stores the RCon configuration
/// </summary>
2022-01-26 11:32:16 -05:00
IRConParserConfiguration Configuration { get; set; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// stores the game/client specific version (usually the value of the "version" DVAR)
/// </summary>
2022-01-26 11:32:16 -05:00
string Version { get; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...)
/// </summary>
2022-01-26 11:32:16 -05:00
Game GameName { get; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// indicates if the game supports generating a log path from DVAR retrieval
/// of fs_game, fs_basepath, g_log
/// </summary>
2022-01-26 11:32:16 -05:00
bool CanGenerateLogPath { get; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// specifies the name of the parser
/// </summary>
2022-01-26 11:32:16 -05:00
string Name { get; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// specifies the type of rcon engine
/// eg: COD, Source
/// </summary>
2022-01-26 11:32:16 -05:00
string RConEngine { get; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// indicates that the game does not log to the mods folder (when mod is loaded),
/// but rather always to the fs_basegame directory
/// </summary>
2022-01-26 11:32:16 -05:00
bool IsOneLog { get; }
/// <summary>
2022-01-26 11:32:16 -05:00
/// retrieves the value of a given DVAR
/// </summary>
2022-01-26 11:32:16 -05:00
/// <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>
/// <param name="fallbackValue">default value to return if dvar retrieval fails</param>
/// <returns></returns>
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default);
/// <summary>
2022-01-26 11:32:16 -05:00
/// set value of DVAR by name
/// </summary>
2022-01-26 11:32:16 -05:00
/// <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>
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue);
2021-06-03 11:51:03 -04:00
/// <summary>
2022-01-26 11:32:16 -05:00
/// executes a console command on the server
2021-06-03 11:51:03 -04:00
/// </summary>
2022-01-26 11:32:16 -05:00
/// <param name="connection">RCon connection to use</param>
/// <param name="command">console command to execute</param>
/// <returns></returns>
Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command);
/// <summary>
2022-01-26 11:32:16 -05:00
/// get the list of connected clients from status response
/// </summary>
2022-01-26 11:32:16 -05:00
/// <param name="connection">RCon connection to use</param>
/// <returns>
/// <see cref="IStatusResponse" />
/// </returns>
Task<IStatusResponse> GetStatusAsync(IRConConnection connection);
/// <summary>
2022-01-26 11:32:16 -05:00
/// 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>
2022-01-26 11:32:16 -05:00
/// 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);
/// <summary>
2022-01-26 11:32:16 -05:00
/// 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);
}
2022-01-26 11:32:16 -05:00
}