mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
partial T7 (BO3) support. includes rcon communication improvements and a small fix for displaying live radar tab
This commit is contained in:
@ -13,8 +13,9 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <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);
|
||||
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default);
|
||||
|
||||
/// <summary>
|
||||
/// set value of DVAR by name
|
||||
|
@ -25,6 +25,11 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// </summary>
|
||||
ParserRegex Dvar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// stores the regex info for parsing the header of a status response
|
||||
/// </summary>
|
||||
ParserRegex StatusHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the expected response message from rcon when the server is not running
|
||||
/// </summary>
|
||||
|
@ -720,9 +720,9 @@ namespace SharedLibraryCore
|
||||
return Convert.ToBase64String(src.Select(c => Convert.ToByte(c)).ToArray()).Replace('+', '-').Replace('/', '_');
|
||||
}
|
||||
|
||||
public static Task<Dvar<T>> GetDvarAsync<T>(this Server server, string dvarName)
|
||||
public static Task<Dvar<T>> GetDvarAsync<T>(this Server server, string dvarName, T fallbackValue = default)
|
||||
{
|
||||
return server.RconParser.GetDvarAsync<T>(server.RemoteConnection, dvarName);
|
||||
return server.RconParser.GetDvarAsync<T>(server.RemoteConnection, dvarName, fallbackValue);
|
||||
}
|
||||
|
||||
public static Task SetDvarAsync(this Server server, string dvarName, object dvarValue)
|
||||
@ -754,7 +754,8 @@ namespace SharedLibraryCore
|
||||
}
|
||||
|
||||
var response = await server.RemoteConnection.SendQueryAsync(RCon.StaticHelpers.QueryType.GET_INFO);
|
||||
return response.FirstOrDefault(r => r[0] == '\\')?.DictionaryFromKeyValue();
|
||||
string combinedResponse = string.Join('\\', response.Where(r => r.Length > 0 && r[0] == '\\'));
|
||||
return combinedResponse.DictionaryFromKeyValue();
|
||||
}
|
||||
|
||||
public static double GetVersionAsDouble()
|
||||
@ -883,7 +884,7 @@ namespace SharedLibraryCore
|
||||
{
|
||||
foreach (char separator in DirectorySeparatorChars)
|
||||
{
|
||||
path = path.Replace(separator, Path.DirectorySeparatorChar);
|
||||
path = (path ?? "").Replace(separator, Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
return path;
|
||||
|
Reference in New Issue
Block a user