mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added options to enable/disable each command.
This commit is contained in:
parent
57d99681e7
commit
ab3546688b
16 changed files with 521 additions and 43 deletions
|
|
@ -825,6 +825,24 @@
|
|||
<setting name="SectionDiscordBotIsExpanded" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordBackup" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordStart" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordRestart" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordShutdown" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordStop" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</ServerManagerTool.Config>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
|
|
|||
72
src/ARKServerManager/Config.Designer.cs
generated
72
src/ARKServerManager/Config.Designer.cs
generated
|
|
@ -2890,5 +2890,77 @@ namespace ServerManagerTool {
|
|||
this["SectionDiscordBotIsExpanded"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordBackup {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordBackup"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordBackup"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordUpdate {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordUpdate"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordUpdate"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordStart {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordStart"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordStart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordRestart {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordRestart"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordRestart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordShutdown {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordShutdown"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordShutdown"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordStop {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordStop"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordStop"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -800,5 +800,23 @@
|
|||
<Setting Name="SectionDiscordBotIsExpanded" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordBackup" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordStart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordRestart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordShutdown" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordStop" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
|
|
@ -621,6 +621,12 @@
|
|||
<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_DiscordBotApplyButtonLabel">Get Token...</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotHelpButtonLabel">Help...</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowBackupTooltip">If enabled, the backup command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowRestartTooltip">If enabled, the restart command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowShutdownTooltip">If enabled, the shutdown command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowStartTooltip">If enabled, the start command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowStopTooltip">If enabled, the stop command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowUpdateTooltip">If enabled, the update command can be sent from discord.</sys:String>
|
||||
|
||||
<sys:String x:Key="GlobalSettings_EmailSettingsLabel">SMTP Email Settings</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_EmailHostLabel">Host:</sys:String>
|
||||
|
|
@ -1196,7 +1202,19 @@
|
|||
<!--#region Server Settings - Discord Bot Details -->
|
||||
<sys:String x:Key="ServerSettings_DiscordBotLabel">Discord Bot Details</sys:String>
|
||||
<sys:String x:Key="ServerSettings_DiscordBotChannelLabel">Channel Id:</sys:String>
|
||||
<sys:String x:Key="ServerSettings_DiscordBotChannelTooltip">The id of the discord server channel the bot will listen to.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_DiscordBotChannelTooltip">The id of the discord server channel this profile will listen to.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordBackupLabel">Allow Backup</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordBackupTooltip">If enabled, the profile will listen for backup commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordRestartLabel">Allow Restart</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordRestartTooltip">If enabled, the profile will listen for restart commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordShutdownLabel">Allow Shutdown</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordShutdownTooltip">If enabled, the profile will listen for shutdown commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStartLabel">Allow Start</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStartTooltip">If enabled, the profile will listen for start commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStopLabel">Allow Stop</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStopTooltip">If enabled, the profile will listen for stop commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordUpdateLabel">Allow Update</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordUpdateTooltip">If enabled, the profile will listen for update commands from discord.</sys:String>
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Server Settings - Rules -->
|
||||
|
|
@ -5548,10 +5566,11 @@
|
|||
<sys:String x:Key="DiscordBot_MissingTokenError">The discord bot requires a valid token so it can log into the discord server\r\nThis can be set in the global settings.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_InvalidPrefixError">The discord bot prefix contains invalid characters. Only letters and numbers are allowed.</sys:String>
|
||||
|
||||
<sys:String x:Key="DiscordBot_CommandNotImplemented">Command '{0}' has not been implemented.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandNotEnabled">Command '{0}' has not been enabled.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandUnknown">Unknown command '{0}'.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandRunning">Another command is currently being processed.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandRunningProfile">Another command '{0}' is currently running against profile '{1}'.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandDisabledProfile">Command '{0}' has been disabled for profile '{1}'.</sys:String>
|
||||
|
||||
<sys:String x:Key="DiscordBot_ProfileMissing">The '{0}' command requires a profile id.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_ProfileNotFound">Profile '{0}' was not found or is not associated with the channel.</sys:String>
|
||||
|
|
|
|||
|
|
@ -965,6 +965,54 @@ namespace ServerManagerTool.Lib
|
|||
get { return (string)GetValue(DiscordChannelIdProperty); }
|
||||
set { SetValue(DiscordChannelIdProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordBackupProperty = DependencyProperty.Register(nameof(AllowDiscordBackup), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordBackup
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordBackupProperty); }
|
||||
set { SetValue(AllowDiscordBackupProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordRestartProperty = DependencyProperty.Register(nameof(AllowDiscordRestart), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordRestart
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordRestartProperty); }
|
||||
set { SetValue(AllowDiscordRestartProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordShutdownProperty = DependencyProperty.Register(nameof(AllowDiscordShutdown), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordShutdown
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordShutdownProperty); }
|
||||
set { SetValue(AllowDiscordShutdownProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordStartProperty = DependencyProperty.Register(nameof(AllowDiscordStart), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordStart
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordStartProperty); }
|
||||
set { SetValue(AllowDiscordStartProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordStopProperty = DependencyProperty.Register(nameof(AllowDiscordStop), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordStop
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordStopProperty); }
|
||||
set { SetValue(AllowDiscordStopProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordUpdateProperty = DependencyProperty.Register(nameof(AllowDiscordUpdate), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordUpdate
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordUpdateProperty); }
|
||||
set { SetValue(AllowDiscordUpdateProperty, value); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Rules
|
||||
|
|
|
|||
|
|
@ -49,17 +49,29 @@ namespace ServerManagerTool.Utils
|
|||
return GetServerStatus(channelId, profileId);
|
||||
|
||||
case CommandType.Backup:
|
||||
return BackupServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordBackup)
|
||||
return BackupServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Restart:
|
||||
return RestartServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordRestart)
|
||||
return RestartServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Shutdown:
|
||||
return ShutdownServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordShutdown)
|
||||
return ShutdownServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Stop:
|
||||
return StopServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordStop)
|
||||
return StopServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Start:
|
||||
return StartServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordStart)
|
||||
return StartServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Update:
|
||||
return UpdateServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordUpdate)
|
||||
return UpdateServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
|
||||
default:
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandUnknown"), commandType) };
|
||||
|
|
@ -224,6 +236,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordBackup)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Backup, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -303,6 +320,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordRestart)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Restart, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -385,6 +407,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordShutdown)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Shutdown, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -443,7 +470,7 @@ namespace ServerManagerTool.Utils
|
|||
{
|
||||
if (string.IsNullOrWhiteSpace(profileId))
|
||||
{
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Shutdown) };
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Stop) };
|
||||
}
|
||||
|
||||
// check if another command is being run against the profile
|
||||
|
|
@ -451,7 +478,7 @@ namespace ServerManagerTool.Utils
|
|||
{
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[profileId], profileId) };
|
||||
}
|
||||
_currentProfileCommands.Add(profileId, CommandType.Shutdown);
|
||||
_currentProfileCommands.Add(profileId, CommandType.Stop);
|
||||
|
||||
ServerProfileSnapshot profile = null;
|
||||
Task task = null;
|
||||
|
|
@ -467,6 +494,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordStop)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Stop, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -550,6 +582,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordStart)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Start, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -634,6 +671,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordUpdate)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Update, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
|
|||
|
|
@ -589,29 +589,41 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Margin="5" Text="{DynamicResource GlobalSettings_DiscordBotInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="8" Margin="5" Text="{DynamicResource GlobalSettings_DiscordBotInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource GlobalSettings_DiscordBotTokenLabel}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Margin="1" Name="HideDiscordBotTokenTextBox" Text="{DynamicResource ServerSettings_HidePasswordText}" ToolTip="{DynamicResource ServerSettings_HidePasswordTooltip}" GotFocus="HiddenField_GotFocus" Style="{StaticResource HiddenTextBoxStyle}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Margin="1" Name="DiscordBotTokenTextBox" Text="{Binding CurrentConfig.DiscordBotToken}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotTokenTooltip}" LostFocus="HiddenField_LostFocus" Visibility="Collapsed"/>
|
||||
<Button Grid.Row="1" Grid.Column="5" Margin="1" Content="{DynamicResource DiscordBotApplyButtonContent}" Click="DiscordBotApply_Click"/>
|
||||
<Button Grid.Row="1" Grid.Column="6" Margin="1" Content="{DynamicResource DiscordBotHelpButtonContent}" Click="DiscordBotHelp_Click"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" Margin="1" Name="HideDiscordBotTokenTextBox" Text="{DynamicResource ServerSettings_HidePasswordText}" ToolTip="{DynamicResource ServerSettings_HidePasswordTooltip}" GotFocus="HiddenField_GotFocus" Style="{StaticResource HiddenTextBoxStyle}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" Margin="1" Name="DiscordBotTokenTextBox" Text="{Binding CurrentConfig.DiscordBotToken}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotTokenTooltip}" LostFocus="HiddenField_LostFocus" Visibility="Collapsed"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="7" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Margin="1" Content="{DynamicResource DiscordBotApplyButtonContent}" Click="DiscordBotApply_Click"/>
|
||||
<Button Margin="1" Content="{DynamicResource DiscordBotHelpButtonContent}" Click="DiscordBotHelp_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource GlobalSettings_DiscordBotServerLabel}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CurrentConfig.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 CurrentConfig.DiscordBotPrefix}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotPrefixTooltip}"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1" Margin="0,5,0,0" IsChecked="{Binding CurrentConfig.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 CurrentConfig.AllowDiscordUpdate}" Content="{DynamicResource ServerSettings_AllowDiscordUpdateLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowUpdateTooltip}"/>
|
||||
<CheckBox Grid.Row="3" Grid.Column="7" Margin="0,5,0,0" IsChecked="{Binding CurrentConfig.AllowDiscordStart}" Content="{DynamicResource ServerSettings_AllowDiscordStartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowStartTooltip}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1" Margin="0,5,0,5" IsChecked="{Binding CurrentConfig.AllowDiscordRestart}" Content="{DynamicResource ServerSettings_AllowDiscordRestartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowRestartTooltip}"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="4" Margin="0,5,0,5" IsChecked="{Binding CurrentConfig.AllowDiscordShutdown}" Content="{DynamicResource ServerSettings_AllowDiscordShutdownLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowShutdownTooltip}"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="7" Margin="0,5,0,5" IsChecked="{Binding CurrentConfig.AllowDiscordStop}" Content="{DynamicResource ServerSettings_AllowDiscordStopLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowStopTooltip}"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
|
|
|
|||
|
|
@ -1600,7 +1600,7 @@
|
|||
</Style>
|
||||
</Expander.Style>
|
||||
|
||||
<Grid>
|
||||
<Grid Margin="-8,0,2,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
|
@ -1611,10 +1611,20 @@
|
|||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource ServerSettings_DiscordBotChannelLabel}" ToolTip="{DynamicResource ServerSettings_DiscordBotChannelTooltip}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding DiscordChannelId, Mode=TwoWay}" ToolTip="{DynamicResource ServerSettings_DiscordBotChannelTooltip}" VerticalContentAlignment="Center" />
|
||||
|
||||
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding AllowDiscordBackup, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordBackupLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordBackupTooltip}"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding AllowDiscordUpdate, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordUpdateLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordUpdateTooltip}"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding AllowDiscordStart, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordStartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordStartTooltip}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" IsChecked="{Binding AllowDiscordRestart, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordRestartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordRestartTooltip}"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="5" IsChecked="{Binding AllowDiscordShutdown, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordShutdownLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordShutdownTooltip}"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="4" Grid.ColumnSpan="2" Margin="5" IsChecked="{Binding AllowDiscordStop, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordStopLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordStopTooltip}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
|
|
|
|||
|
|
@ -591,6 +591,24 @@
|
|||
<setting name="SectionDiscordBotIsExpanded" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordBackup" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordStart" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordRestart" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordShutdown" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AllowDiscordStop" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</ServerManagerTool.Config>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
72
src/ConanServerManager/Config.Designer.cs
generated
72
src/ConanServerManager/Config.Designer.cs
generated
|
|
@ -2043,5 +2043,77 @@ namespace ServerManagerTool {
|
|||
this["SectionDiscordBotIsExpanded"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordBackup {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordBackup"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordBackup"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordUpdate {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordUpdate"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordUpdate"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordStart {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordStart"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordStart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordRestart {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordRestart"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordRestart"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordShutdown {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordShutdown"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordShutdown"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AllowDiscordStop {
|
||||
get {
|
||||
return ((bool)(this["AllowDiscordStop"]));
|
||||
}
|
||||
set {
|
||||
this["AllowDiscordStop"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -566,5 +566,23 @@
|
|||
<Setting Name="SectionDiscordBotIsExpanded" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordBackup" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordStart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordRestart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordShutdown" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AllowDiscordStop" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
|
|
@ -781,6 +781,12 @@
|
|||
<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_DiscordBotApplyButtonLabel">Get Token...</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotHelpButtonLabel">Help...</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowBackupTooltip">If enabled, the backup command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowRestartTooltip">If enabled, the restart command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowShutdownTooltip">If enabled, the shutdown command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowStartTooltip">If enabled, the start command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowStopTooltip">If enabled, the stop command can be sent from discord.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_DiscordBotAllowUpdateTooltip">If enabled, the update command can be sent from discord.</sys:String>
|
||||
|
||||
<sys:String x:Key="GlobalSettings_EmailSettingsLabel">SMTP Email Settings</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_EmailHostLabel">Host:</sys:String>
|
||||
|
|
@ -1138,7 +1144,19 @@
|
|||
<!--#region Server Settings - Discord Bot Details -->
|
||||
<sys:String x:Key="ServerSettings_DiscordBotLabel">Discord Bot Details</sys:String>
|
||||
<sys:String x:Key="ServerSettings_DiscordBotChannelLabel">Channel Id:</sys:String>
|
||||
<sys:String x:Key="ServerSettings_DiscordBotChannelTooltip">The id of the discord server channel the bot will listen to.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_DiscordBotChannelTooltip">The id of the discord server channel this profile will listen to.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordBackupLabel">Allow Backup</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordBackupTooltip">If enabled, the profile will listen for backup commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordRestartLabel">Allow Restart</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordRestartTooltip">If enabled, the profile will listen for restart commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordShutdownLabel">Allow Shutdown</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordShutdownTooltip">If enabled, the profile will listen for shutdown commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStartLabel">Allow Start</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStartTooltip">If enabled, the profile will listen for start commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStopLabel">Allow Stop</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordStopTooltip">If enabled, the profile will listen for stop commands from discord.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordUpdateLabel">Allow Update</sys:String>
|
||||
<sys:String x:Key="ServerSettings_AllowDiscordUpdateTooltip">If enabled, the profile will listen for update commands from discord.</sys:String>
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Server Settings - Server File Details -->
|
||||
|
|
@ -1218,10 +1236,11 @@
|
|||
<sys:String x:Key="DiscordBot_MissingTokenError">The discord bot requires a valid token so it can log into the discord server\r\nThis can be set in the global settings.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_InvalidPrefixError">The discord bot prefix contains invalid characters. Only letters and numbers are allowed.</sys:String>
|
||||
|
||||
<sys:String x:Key="DiscordBot_CommandNotImplemented">Command '{0}' has not been implemented.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandNotEnabled">Command '{0}' has not been enabled.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandUnknown">Unknown command '{0}'.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandRunning">Another command is currently being processed.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandRunningProfile">Another command '{0}' is currently running against profile '{1}'.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_CommandDisabledProfile">Command '{0}' has been disabled for profile '{1}'.</sys:String>
|
||||
|
||||
<sys:String x:Key="DiscordBot_ProfileMissing">The '{0}' command requires a profile id.</sys:String>
|
||||
<sys:String x:Key="DiscordBot_ProfileNotFound">Profile '{0}' was not found or is not associated with the channel.</sys:String>
|
||||
|
|
|
|||
|
|
@ -575,6 +575,54 @@ namespace ServerManagerTool.Lib
|
|||
get { return (string)GetValue(DiscordChannelIdProperty); }
|
||||
set { SetValue(DiscordChannelIdProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordBackupProperty = DependencyProperty.Register(nameof(AllowDiscordBackup), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordBackup
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordBackupProperty); }
|
||||
set { SetValue(AllowDiscordBackupProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordRestartProperty = DependencyProperty.Register(nameof(AllowDiscordRestart), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordRestart
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordRestartProperty); }
|
||||
set { SetValue(AllowDiscordRestartProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordShutdownProperty = DependencyProperty.Register(nameof(AllowDiscordShutdown), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordShutdown
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordShutdownProperty); }
|
||||
set { SetValue(AllowDiscordShutdownProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordStartProperty = DependencyProperty.Register(nameof(AllowDiscordStart), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordStart
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordStartProperty); }
|
||||
set { SetValue(AllowDiscordStartProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordStopProperty = DependencyProperty.Register(nameof(AllowDiscordStop), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordStop
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordStopProperty); }
|
||||
set { SetValue(AllowDiscordStopProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AllowDiscordUpdateProperty = DependencyProperty.Register(nameof(AllowDiscordUpdate), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
|
||||
[DataMember]
|
||||
public bool AllowDiscordUpdate
|
||||
{
|
||||
get { return (bool)GetValue(AllowDiscordUpdateProperty); }
|
||||
set { SetValue(AllowDiscordUpdateProperty, value); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Server Files
|
||||
|
|
|
|||
|
|
@ -49,17 +49,29 @@ namespace ServerManagerTool.Utils
|
|||
return GetServerStatus(channelId, profileId);
|
||||
|
||||
case CommandType.Backup:
|
||||
return BackupServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordBackup)
|
||||
return BackupServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Restart:
|
||||
return RestartServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordRestart)
|
||||
return RestartServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Shutdown:
|
||||
return ShutdownServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordShutdown)
|
||||
return ShutdownServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Stop:
|
||||
return StopServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordStop)
|
||||
return StopServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Start:
|
||||
return StartServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordStart)
|
||||
return StartServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
case CommandType.Update:
|
||||
return UpdateServer(channelId, profileId, token);
|
||||
if (Config.Default.AllowDiscordUpdate)
|
||||
return UpdateServer(channelId, profileId, token);
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandNotEnabled"), commandType) };
|
||||
|
||||
default:
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandUnknown"), commandType) };
|
||||
|
|
@ -224,6 +236,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordBackup)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Backup, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -303,6 +320,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordRestart)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Restart, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -385,6 +407,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordShutdown)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Shutdown, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -443,7 +470,7 @@ namespace ServerManagerTool.Utils
|
|||
{
|
||||
if (string.IsNullOrWhiteSpace(profileId))
|
||||
{
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Shutdown) };
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_ProfileMissing"), CommandType.Stop) };
|
||||
}
|
||||
|
||||
// check if another command is being run against the profile
|
||||
|
|
@ -451,7 +478,7 @@ namespace ServerManagerTool.Utils
|
|||
{
|
||||
return new List<string> { string.Format(_globalizer.GetResourceString("DiscordBot_CommandRunningProfile"), _currentProfileCommands[profileId], profileId) };
|
||||
}
|
||||
_currentProfileCommands.Add(profileId, CommandType.Shutdown);
|
||||
_currentProfileCommands.Add(profileId, CommandType.Stop);
|
||||
|
||||
ServerProfileSnapshot profile = null;
|
||||
Task task = null;
|
||||
|
|
@ -467,6 +494,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordStop)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Stop, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -550,6 +582,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordStart)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Start, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
@ -634,6 +671,11 @@ namespace ServerManagerTool.Utils
|
|||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_ProfileNotFound"), profileId));
|
||||
}
|
||||
|
||||
if (!server.Profile.AllowDiscordUpdate)
|
||||
{
|
||||
throw new Exception(string.Format(_globalizer.GetResourceString("DiscordBot_CommandDisabledProfile"), CommandType.Update, profileId));
|
||||
}
|
||||
|
||||
switch (server.Runtime.Status)
|
||||
{
|
||||
case ServerStatus.Initializing:
|
||||
|
|
|
|||
|
|
@ -537,29 +537,41 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Margin="5" Text="{DynamicResource GlobalSettings_DiscordBotInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="8" Margin="5" Text="{DynamicResource GlobalSettings_DiscordBotInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource GlobalSettings_DiscordBotTokenLabel}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Margin="1" Name="HideDiscordBotTokenTextBox" Text="{DynamicResource ServerSettings_HidePasswordText}" ToolTip="{DynamicResource ServerSettings_HidePasswordTooltip}" GotFocus="HiddenField_GotFocus" Style="{StaticResource HiddenTextBoxStyle}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Margin="1" Name="DiscordBotTokenTextBox" Text="{Binding Config.DiscordBotToken}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotTokenTooltip}" LostFocus="HiddenField_LostFocus" Visibility="Collapsed"/>
|
||||
<Button Grid.Row="1" Grid.Column="5" Margin="1" Content="{DynamicResource DiscordBotApplyButtonContent}" Click="DiscordBotApply_Click"/>
|
||||
<Button Grid.Row="1" Grid.Column="6" Margin="1" Content="{DynamicResource DiscordBotHelpButtonContent}" Click="DiscordBotHelp_Click"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" Margin="1" Name="HideDiscordBotTokenTextBox" Text="{DynamicResource ServerSettings_HidePasswordText}" ToolTip="{DynamicResource ServerSettings_HidePasswordTooltip}" GotFocus="HiddenField_GotFocus" Style="{StaticResource HiddenTextBoxStyle}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" Margin="1" Name="DiscordBotTokenTextBox" Text="{Binding Config.DiscordBotToken}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_DiscordBotTokenTooltip}" LostFocus="HiddenField_LostFocus" Visibility="Collapsed"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="7" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Margin="1" Content="{DynamicResource DiscordBotApplyButtonContent}" Click="DiscordBotApply_Click"/>
|
||||
<Button Margin="1" Content="{DynamicResource DiscordBotHelpButtonContent}" Click="DiscordBotHelp_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource GlobalSettings_DiscordBotServerLabel}" VerticalAlignment="Center"/>
|
||||
<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}"/>
|
||||
|
||||
<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}"/>
|
||||
<CheckBox Grid.Row="3" Grid.Column="7" Margin="0,5,0,0" IsChecked="{Binding Config.AllowDiscordStart}" Content="{DynamicResource ServerSettings_AllowDiscordStartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowStartTooltip}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1" Margin="0,5,0,5" IsChecked="{Binding Config.AllowDiscordRestart}" Content="{DynamicResource ServerSettings_AllowDiscordRestartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowRestartTooltip}"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="4" Margin="0,5,0,5" IsChecked="{Binding Config.AllowDiscordShutdown}" Content="{DynamicResource ServerSettings_AllowDiscordShutdownLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowShutdownTooltip}"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="7" Margin="0,5,0,5" IsChecked="{Binding Config.AllowDiscordStop}" Content="{DynamicResource ServerSettings_AllowDiscordStopLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource GlobalSettings_DiscordBotAllowStopTooltip}"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
|
|
@ -575,13 +587,13 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="60"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
|
|
|||
|
|
@ -1075,7 +1075,7 @@
|
|||
</Style>
|
||||
</Expander.Style>
|
||||
|
||||
<Grid>
|
||||
<Grid Margin="-8,0,2,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
|
@ -1086,10 +1086,20 @@
|
|||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource ServerSettings_DiscordBotChannelLabel}" ToolTip="{DynamicResource ServerSettings_DiscordBotChannelTooltip}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding DiscordChannelId, Mode=TwoWay}" ToolTip="{DynamicResource ServerSettings_DiscordBotChannelTooltip}" VerticalContentAlignment="Center" />
|
||||
|
||||
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding AllowDiscordBackup, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordBackupLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordBackupTooltip}"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding AllowDiscordUpdate, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordUpdateLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordUpdateTooltip}"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding AllowDiscordStart, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordStartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordStartTooltip}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" IsChecked="{Binding AllowDiscordRestart, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordRestartLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordRestartTooltip}"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="5" IsChecked="{Binding AllowDiscordShutdown, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordShutdownLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordShutdownTooltip}"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="4" Grid.ColumnSpan="2" Margin="5" IsChecked="{Binding AllowDiscordStop, Mode=TwoWay}" Content="{DynamicResource ServerSettings_AllowDiscordStopLabel}" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_AllowDiscordStopTooltip}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue