add back helper methods without cancellation token for plugins

This commit is contained in:
RaidMax 2022-03-02 08:29:15 -06:00
parent 55b0caf900
commit e6e56d8d14

View File

@ -728,6 +728,12 @@ namespace SharedLibraryCore
{ {
return await server.RconParser.GetDvarAsync(server.RemoteConnection, dvarName, fallbackValue, token); return await server.RconParser.GetDvarAsync(server.RemoteConnection, dvarName, fallbackValue, token);
} }
public static async Task<Dvar<T>> GetDvarAsync<T>(this Server server, string dvarName,
T fallbackValue = default)
{
return await GetDvarAsync(server, dvarName, fallbackValue, default);
}
public static async Task<Dvar<T>> GetMappedDvarValueOrDefaultAsync<T>(this Server server, string dvarName, public static async Task<Dvar<T>> GetMappedDvarValueOrDefaultAsync<T>(this Server server, string dvarName,
string infoResponseName = null, IDictionary<string, string> infoResponse = null, string infoResponseName = null, IDictionary<string, string> infoResponse = null,
@ -757,11 +763,21 @@ namespace SharedLibraryCore
{ {
await server.RconParser.SetDvarAsync(server.RemoteConnection, dvarName, dvarValue, token); await server.RconParser.SetDvarAsync(server.RemoteConnection, dvarName, dvarValue, token);
} }
public static async Task SetDvarAsync(this Server server, string dvarName, object dvarValue)
{
await SetDvarAsync(server, dvarName, dvarValue, default);
}
public static async Task<string[]> ExecuteCommandAsync(this Server server, string commandName, CancellationToken token = default) public static async Task<string[]> ExecuteCommandAsync(this Server server, string commandName, CancellationToken token = default)
{ {
return await server.RconParser.ExecuteCommandAsync(server.RemoteConnection, commandName, token); return await server.RconParser.ExecuteCommandAsync(server.RemoteConnection, commandName, token);
} }
public static async Task<string[]> ExecuteCommandAsync(this Server server, string commandName)
{
return await ExecuteCommandAsync(server, commandName, default);
}
public static Task<IStatusResponse> GetStatusAsync(this Server server, CancellationToken token) public static Task<IStatusResponse> GetStatusAsync(this Server server, CancellationToken token)
{ {