mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-08 20:21:06 +00:00
Rcon Command Changes
- moved the rcon commands to the gamedata files, so they can be extended.
This commit is contained in:
parent
f3ff807cd0
commit
e7100e6323
18 changed files with 266 additions and 152 deletions
|
|
@ -10,6 +10,8 @@ namespace ServerManagerTool.Lib
|
|||
{
|
||||
public static class GameData
|
||||
{
|
||||
public const string RCONINPUTMODE_COMMAND = "Command";
|
||||
|
||||
public static string MainDataFolder = Path.Combine(Environment.CurrentDirectory, Config.Default.GameDataRelativePath);
|
||||
public static string UserDataFolder = Path.Combine(Config.Default.DataPath, Config.Default.GameDataRelativePath);
|
||||
|
||||
|
|
@ -59,6 +61,17 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
serverRegions = allServerRegions.ToArray();
|
||||
}
|
||||
|
||||
// rcon input modes
|
||||
gameData.RconInputModes.AddRange(userGameData.RconInputModes);
|
||||
|
||||
if (gameData.RconInputModes.Count > 0)
|
||||
{
|
||||
var modes1 = rconInputModes.ToList();
|
||||
modes1.AddRange(gameData.RconInputModes.Select(item => new ComboBoxItem { ValueMember = item.Command, DisplayMember = item.Description }));
|
||||
|
||||
rconInputModes = modes1.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static string FriendlyNameForClass(string className, bool returnNullIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? (returnNullIfNotFound ? null : string.Empty) : GlobalizedApplication.Instance.GetResourceString(className) ?? (returnNullIfNotFound ? null : className);
|
||||
|
|
@ -94,5 +107,18 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
public static string FriendlyServerRegionName(string regionNumber, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(regionNumber) ? string.Empty : GlobalizedApplication.Instance.GetResourceString($"ServerRegion_{regionNumber}") ?? gameData?.ServerRegions?.FirstOrDefault(i => i.RegionNumber.Equals(regionNumber))?.Description ?? (returnEmptyIfNotFound ? string.Empty : regionNumber);
|
||||
#endregion
|
||||
|
||||
#region Rcon Message Modes
|
||||
private static ComboBoxItem[] rconInputModes = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember=RCONINPUTMODE_COMMAND, DisplayMember=FriendlyNameForClass($"InputMode_{RCONINPUTMODE_COMMAND}") },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetAllRconInputModes() => rconInputModes.Select(m => m.Duplicate());
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetMessageRconInputModes() => rconInputModes.Where(m => !m.ValueMember.Equals(RCONINPUTMODE_COMMAND, StringComparison.OrdinalIgnoreCase)).Select(m => m.Duplicate());
|
||||
|
||||
public static string FriendlyRconInputModeName(string rconInputMode, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(rconInputMode) ? string.Empty : GlobalizedApplication.Instance.GetResourceString("InputMode_" + rconInputMode) ?? gameData?.RconInputModes?.FirstOrDefault(i => i.Command.Equals(rconInputMode))?.Description ?? (returnEmptyIfNotFound ? string.Empty : rconInputMode);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue