using System; using System.Collections.Generic; using System.Threading.Tasks; using SharedLibraryCore.Database.Models; using static SharedLibraryCore.Server; namespace SharedLibraryCore.Interfaces { public interface IRConParser { /// /// retrieves the value of a given DVAR /// /// type of DVAR expected (string, int, float etc...) /// RCon connection to retrieve with /// name of DVAR /// default value to return if dvar retrieval fails /// Task> GetDvarAsync(IRConConnection connection, string dvarName, T fallbackValue = default); /// /// set value of DVAR by name /// /// RCon connection to use /// name of DVAR to set /// value to set DVAR to /// Task SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue); /// /// executes a console command on the server /// /// RCon connection to use /// console command to execute /// Task ExecuteCommandAsync(IRConConnection connection, string command); /// /// get the list of connected clients from status response /// /// RCon connection to use /// list of clients, current map, and current gametype Task<(List, string, string)> GetStatusAsync(IRConConnection connection); /// /// stores the RCon configuration /// IRConParserConfiguration Configuration { get; set; } /// /// stores the game/client specific version (usually the value of the "version" DVAR) /// string Version { get; set; } /// /// specifies the game name (usually the internal studio iteration ie: IW4, T5 etc...) /// Game GameName { get; set; } /// /// indicates if the game supports generating a log path from DVAR retrieval /// of fs_game, fs_basepath, g_log /// bool CanGenerateLogPath { get; set; } /// /// specifies the name of the parser /// string Name { get; set; } /// /// retrieves the value of given dvar key if it exists in the override dict /// otherwise returns original /// /// name of dvar key /// string GetOverrideDvarName(string dvarName); /// /// retrieves the configuration value of a dvar key for /// games that do not support the given dvar /// /// dvar key name /// T GetDefaultDvarValue(string dvarName); /// /// determines the amount of time to wait for the command to respond /// /// name of command being executed /// TimeSpan OverrideTimeoutForCommand(string command); } }