mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added a log level droplist
This commit is contained in:
parent
708031dcbb
commit
430bfe7bbb
21 changed files with 224 additions and 59 deletions
|
|
@ -814,7 +814,7 @@
|
|||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="DiscordBotPrefix" serializeAs="String">
|
||||
<value>asm</value>
|
||||
<value>asm!</value>
|
||||
</setting>
|
||||
<setting name="DiscordBotToken" serializeAs="String">
|
||||
<value />
|
||||
|
|
@ -851,14 +851,15 @@
|
|||
</setting>
|
||||
<setting name="DiscordBotWhitelist" serializeAs="Xml">
|
||||
<value>
|
||||
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<string />
|
||||
</ArrayOfString>
|
||||
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
|
||||
</value>
|
||||
</setting>
|
||||
<setting name="DiscordBotPrefixFixed" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="DiscordBotLogLevel" serializeAs="String">
|
||||
<value>Info</value>
|
||||
</setting>
|
||||
</ServerManagerTool.Config>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -287,7 +287,8 @@ namespace ServerManagerTool
|
|||
}
|
||||
if (!Config.Default.DiscordBotPrefixFixed)
|
||||
{
|
||||
Config.Default.DiscordBotPrefix += "!";
|
||||
if (!Config.Default.DiscordBotPrefix.EndsWith("!"))
|
||||
Config.Default.DiscordBotPrefix += "!";
|
||||
Config.Default.DiscordBotPrefixFixed = true;
|
||||
Config.Default.Save();
|
||||
Config.Default.Reload();
|
||||
|
|
@ -507,7 +508,7 @@ namespace ServerManagerTool
|
|||
discordWhiteList.AddRange(Config.Default.DiscordBotWhitelist.Cast<string>());
|
||||
}
|
||||
|
||||
await ServerManagerBotFactory.GetServerManagerBot()?.StartAsync(Config.Default.DiscordBotToken, Config.Default.DiscordBotPrefix, Config.Default.DataDir, discordWhiteList, DiscordBotHelper.HandleDiscordCommand, DiscordBotHelper.HandleTranslation, _tokenSource.Token);
|
||||
await ServerManagerBotFactory.GetServerManagerBot()?.StartAsync(Config.Default.DiscordBotLogLevel, Config.Default.DiscordBotToken, Config.Default.DiscordBotPrefix, Config.Default.DataDir, discordWhiteList, DiscordBotHelper.HandleDiscordCommand, DiscordBotHelper.HandleTranslation, _tokenSource.Token);
|
||||
}, _tokenSource.Token)
|
||||
.ContinueWith(t => {
|
||||
var message = t.Exception.InnerException is null ? t.Exception.Message : t.Exception.InnerException.Message;
|
||||
|
|
|
|||
17
src/ARKServerManager/Config.Designer.cs
generated
17
src/ARKServerManager/Config.Designer.cs
generated
|
|
@ -2827,7 +2827,7 @@ namespace ServerManagerTool {
|
|||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("asm")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("asm!")]
|
||||
public string DiscordBotPrefix {
|
||||
get {
|
||||
return ((string)(this["DiscordBotPrefix"]));
|
||||
|
|
@ -2990,8 +2990,7 @@ namespace ServerManagerTool {
|
|||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsd=\"http://www.w3." +
|
||||
"org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n <s" +
|
||||
"tring />\r\n</ArrayOfString>")]
|
||||
"org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" />")]
|
||||
public global::System.Collections.Specialized.StringCollection DiscordBotWhitelist {
|
||||
get {
|
||||
return ((global::System.Collections.Specialized.StringCollection)(this["DiscordBotWhitelist"]));
|
||||
|
|
@ -3012,5 +3011,17 @@ namespace ServerManagerTool {
|
|||
this["DiscordBotPrefixFixed"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Info")]
|
||||
public global::ServerManagerTool.DiscordBot.Enums.LogLevel DiscordBotLogLevel {
|
||||
get {
|
||||
return ((global::ServerManagerTool.DiscordBot.Enums.LogLevel)(this["DiscordBotLogLevel"]));
|
||||
}
|
||||
set {
|
||||
this["DiscordBotLogLevel"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@
|
|||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="DiscordBotPrefix" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">asm</Value>
|
||||
<Value Profile="(Default)">asm!</Value>
|
||||
</Setting>
|
||||
<Setting Name="DiscordBotToken" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
|
|
@ -826,12 +826,13 @@
|
|||
</Setting>
|
||||
<Setting Name="DiscordBotWhitelist" Type="System.Collections.Specialized.StringCollection" Scope="User">
|
||||
<Value Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<string />
|
||||
</ArrayOfString></Value>
|
||||
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /></Value>
|
||||
</Setting>
|
||||
<Setting Name="DiscordBotPrefixFixed" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="DiscordBotLogLevel" Type="ServerManagerTool.DiscordBot.Enums.LogLevel" Scope="User">
|
||||
<Value Profile="(Default)">Info</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
|
|
@ -83,12 +83,21 @@
|
|||
<sys:String x:Key="ProcessorAffinity_All">All</sys:String>
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Processor Window States -->
|
||||
<!--#region Window States -->
|
||||
<sys:String x:Key="WindowState_Normal">Normal</sys:String>
|
||||
<sys:String x:Key="WindowState_Minimized">Minimized</sys:String>
|
||||
<sys:String x:Key="WindowState_Maximized">Maximized</sys:String>
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Discord Bot Log Levels -->
|
||||
<sys:String x:Key="DiscordBotLogLevel_Critical">Critical</sys:String>
|
||||
<sys:String x:Key="DiscordBotLogLevel_Error">Error</sys:String>
|
||||
<sys:String x:Key="DiscordBotLogLevel_Warning">Warning</sys:String>
|
||||
<sys:String x:Key="DiscordBotLogLevel_Info">Info</sys:String>
|
||||
<sys:String x:Key="DiscordBotLogLevel_Verbose">Verbose</sys:String>
|
||||
<sys:String x:Key="DiscordBotLogLevel_Debug">Debug</sys:String>
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Application -->
|
||||
<sys:String x:Key="Application_RunAsAdministratorTitle">Run as Administrator</sys:String>
|
||||
<sys:String x:Key="Application_RunAsAdministratorLabel">This application requires administration priviledges to access ALL functionality. Would you like to Run as Administrator?</sys:String>
|
||||
|
|
@ -622,6 +631,7 @@
|
|||
<sys:String x:Key="GlobalSettings_DiscordBotServerTooltip">The id of the discord server the bot will listen to.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotPrefixLabel">Prefix:</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotPrefixTooltip">The prefix that must be used when sending a command via discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotLogLevelLabel">Log Level:</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotApplyButtonLabel">Get Token...</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotHelpButtonLabel">Help...</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotWhitelistLabel">Bot Whitelist</sys:String>
|
||||
|
|
|
|||
|
|
@ -618,6 +618,8 @@
|
|||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding Config.DiscordBotServerId}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotServerTooltip}"/>
|
||||
<Label Grid.Row="2" Grid.Column="3" Content="{DynamicResource GlobalSettings_DiscordBotPrefixLabel}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="4" Margin="1" Text="{Binding Config.DiscordBotPrefix}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotPrefixTooltip}"/>
|
||||
<Label Grid.Row="2" Grid.Column="6" Margin="1" Content="{DynamicResource GlobalSettings_DiscordBotLogLevelLabel}" VerticalAlignment="Center"/>
|
||||
<ComboBox Name="DiscordBotLogLevelComboBox" Grid.Row="2" Grid.Column="7" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=DiscordBotLogLevels}" SelectedValue="{Binding Config.DiscordBotLogLevel}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" VerticalContentAlignment="Center" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1" Margin="0,5,0,0" IsChecked="{Binding Config.AllowDiscordBackup}" Content="{DynamicResource ServerSettings_AllowDiscordBackupLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowBackupTooltip}"/>
|
||||
<CheckBox Grid.Row="3" Grid.Column="4" Margin="0,5,0,0" IsChecked="{Binding Config.AllowDiscordUpdate}" Content="{DynamicResource ServerSettings_AllowDiscordUpdateLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowUpdateTooltip}"/>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ namespace ServerManagerTool
|
|||
public static readonly DependencyProperty ConfigProperty = DependencyProperty.Register(nameof(Config), typeof(Config), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty CommonConfigProperty = DependencyProperty.Register(nameof(CommonConfig), typeof(CommonConfig), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty WindowStatesProperty = DependencyProperty.Register(nameof(WindowStates), 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<DiscordBotWhitelist>), typeof(GlobalSettingsControl), new PropertyMetadata(null));
|
||||
|
||||
public GlobalSettingsControl()
|
||||
|
|
@ -43,7 +44,11 @@ namespace ServerManagerTool
|
|||
this.CommonConfig = CommonConfig.Default;
|
||||
this.DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
||||
PopulateWindowsStatesComboBox();
|
||||
PopulateDiscordBotLogLevelsComboBox();
|
||||
|
||||
DiscordBotWhitelist = new List<DiscordBotWhitelist>();
|
||||
if (Config.DiscordBotWhitelist != null)
|
||||
|
|
@ -54,9 +59,6 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
||||
this.IsAdministrator = SecurityUtils.IsAdministrator();
|
||||
}
|
||||
|
||||
|
|
@ -90,6 +92,12 @@ namespace ServerManagerTool
|
|||
set { SetValue(WindowStatesProperty, value); }
|
||||
}
|
||||
|
||||
public ComboBoxItemList DiscordBotLogLevels
|
||||
{
|
||||
get { return (ComboBoxItemList)GetValue(DiscordBotLogLevelsProperty); }
|
||||
set { SetValue(DiscordBotLogLevelsProperty, value); }
|
||||
}
|
||||
|
||||
public List<DiscordBotWhitelist> DiscordBotWhitelist
|
||||
{
|
||||
get { return (List<DiscordBotWhitelist>)GetValue(DiscordBotWhitelistProperty); }
|
||||
|
|
@ -476,21 +484,39 @@ namespace ServerManagerTool
|
|||
private void PopulateWindowsStatesComboBox()
|
||||
{
|
||||
var selectedValue = this.WindowStateComboBox?.SelectedValue ?? Config.MainWindow_WindowState;
|
||||
var windowStates = new ComboBoxItemList();
|
||||
var comboBoxList = new ComboBoxItemList();
|
||||
|
||||
foreach (WindowState windowState in Enum.GetValues(typeof(WindowState)))
|
||||
{
|
||||
var displayMember = _globalizer.GetResourceString($"WindowState_{windowState}") ?? windowState.ToString();
|
||||
windowStates.Add(new Common.Model.ComboBoxItem(windowState.ToString(), displayMember));
|
||||
comboBoxList.Add(new Common.Model.ComboBoxItem(windowState.ToString(), displayMember));
|
||||
}
|
||||
|
||||
this.WindowStates = windowStates;
|
||||
this.WindowStates = comboBoxList;
|
||||
if (this.WindowStateComboBox != null)
|
||||
{
|
||||
this.WindowStateComboBox.SelectedValue = selectedValue;
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateDiscordBotLogLevelsComboBox()
|
||||
{
|
||||
var selectedValue = this.DiscordBotLogLevelComboBox?.SelectedValue ?? Config.DiscordBotLogLevel;
|
||||
var comboBoxList = new ComboBoxItemList();
|
||||
|
||||
foreach (DiscordBot.Enums.LogLevel logLevel in Enum.GetValues(typeof(DiscordBot.Enums.LogLevel)))
|
||||
{
|
||||
var displayMember = _globalizer.GetResourceString($"DiscordBotLogLevel_{logLevel}") ?? logLevel.ToString();
|
||||
comboBoxList.Add(new Common.Model.ComboBoxItem(logLevel.ToString(), displayMember));
|
||||
}
|
||||
|
||||
this.DiscordBotLogLevels = comboBoxList;
|
||||
if (this.DiscordBotLogLevelComboBox != null)
|
||||
{
|
||||
this.DiscordBotLogLevelComboBox.SelectedValue = selectedValue;
|
||||
}
|
||||
}
|
||||
|
||||
#region Discord Bot Whitelist
|
||||
private void AddDiscordBotWhitelist_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
<entry>
|
||||
<id>urn:uuid:3E33DCB2-ECFE-4489-B1A4-56F5D386F9DC</id>
|
||||
<title>1.1.413 (1.1.413.4)</title>
|
||||
<summary>1.1.413.4</summary>
|
||||
<title>1.1.413 (1.1.413.5)</title>
|
||||
<summary>1.1.413.5</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-16T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
<u style="font-size: .9em;">NEW</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Global Settings - Discord Bot section - Added a log level droplist.</li>
|
||||
<li>Global Settings - Discord Bot section - Added a whitelist to allow bots to send commands to the server manager.</li>
|
||||
<li>Server Settings - Discord Bot section - Added an alias that can be used with the discord command instead of the profile id.</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="http://arkservermanager.freeforums.net/" />
|
||||
<updated>2021-12-16T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:65A7E6B1-98D1-422D-B42F-B0EBB1D20E41</id>
|
||||
<title>1.1.413 (1.1.413.5)</title>
|
||||
<summary>1.1.413.5</summary>
|
||||
<link href="" />
|
||||
<updated>2021-12-16T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">NEW</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Global Settings - Discord Bot section - Added a log level droplist.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:98FFBFA1-4E99-4801-BF2B-CA68BE300C27</id>
|
||||
<title>1.1.413 (1.1.413.4)</title>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue