RCON Broadcast Mode

- Added RCON broadcast mode selection to ASM global settings.
- Added new Mode selection method to ServerApp, so the correct command is used.
This commit is contained in:
Brett Hewitson 2022-05-06 12:50:50 +10:00
parent 35d8153236
commit dc830c602c
9 changed files with 149 additions and 107 deletions

View file

@ -37,6 +37,7 @@ namespace ServerManagerTool
public static readonly DependencyProperty WindowStatesServerMonitorProperty = DependencyProperty.Register(nameof(WindowStatesServerMonitor), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty DiscordBotLogLevelsProperty = DependencyProperty.Register(nameof(DiscordBotLogLevels), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty DiscordBotWhitelistProperty = DependencyProperty.Register(nameof(DiscordBotWhitelist), typeof(List<DiscordBotWhitelistItem>), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty RconMessageModesProperty = DependencyProperty.Register(nameof(RconMessageModes), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public GlobalSettingsControl()
{
@ -52,6 +53,7 @@ namespace ServerManagerTool
PopulateWindowsStatesMainWindowComboBox();
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateDiscordBotLogLevelsComboBox();
PopulateRconMessageModesComboBox();
DiscordBotWhitelist = new List<DiscordBotWhitelistItem>();
if (Config.DiscordBotWhitelist != null)
@ -116,6 +118,12 @@ namespace ServerManagerTool
set { SetValue(DiscordBotWhitelistProperty, value); }
}
public ComboBoxItemList RconMessageModes
{
get { return (ComboBoxItemList)GetValue(RconMessageModesProperty); }
set { SetValue(RconMessageModesProperty, value); }
}
public void ApplyChangesToConfig()
{
if (Config.DiscordBotWhitelist is null)
@ -412,6 +420,7 @@ namespace ServerManagerTool
PopulateWindowsStatesMainWindowComboBox();
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateRconMessageModesComboBox();
App.Instance.OnResourceDictionaryChanged(Config.CultureName);
}
@ -552,6 +561,27 @@ namespace ServerManagerTool
}
}
private void PopulateRconMessageModesComboBox()
{
var selectedValue = this.RconMessageModesComboBox?.SelectedValue ?? Config.RCON_MessageCommand;
var list = new ComboBoxItemList();
foreach (InputMode inputMode in Enum.GetValues(typeof(InputMode)))
{
if (inputMode == InputMode.Command)
continue;
var displayMember = _globalizer.GetResourceString($"InputMode_{inputMode}") ?? inputMode.ToString();
list.Add(new Common.Model.ComboBoxItem(inputMode.ToString(), displayMember));
}
this.RconMessageModes = list;
if (this.RconMessageModesComboBox != null)
{
this.RconMessageModesComboBox.SelectedValue = selectedValue;
}
}
#region Discord Bot Whitelist
private void AddDiscordBotWhitelist_Click(object sender, RoutedEventArgs e)
{