Auto Backup Settings

- added an RCON broadcast mode droplist, so backup processes can send messages via RCON using this mode.
This commit is contained in:
Brett Hewitson 2022-05-06 14:07:38 +10:00
parent 5be23f75ef
commit c1c303f32a
14 changed files with 120 additions and 16 deletions

View file

@ -891,6 +891,9 @@
<setting name="DiscordBotAllServersKeyword" serializeAs="String">
<value>all</value>
</setting>
<setting name="RCON_BackupMessageCommand" serializeAs="String">
<value>Broadcast</value>
</setting>
</ServerManagerTool.Config>
</userSettings>
</configuration>

View file

@ -3159,5 +3159,17 @@ namespace ServerManagerTool {
return ((string)(this["SaveGamesRelativePath"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Broadcast")]
public string RCON_BackupMessageCommand {
get {
return ((string)(this["RCON_BackupMessageCommand"]));
}
set {
this["RCON_BackupMessageCommand"] = value;
}
}
}
}

View file

@ -869,5 +869,8 @@
<Setting Name="SaveGamesRelativePath" Type="System.String" Scope="Application">
<Value Profile="(Default)">SaveGames</Value>
</Setting>
<Setting Name="RCON_BackupMessageCommand" Type="System.String" Scope="User">
<Value Profile="(Default)">Broadcast</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -158,7 +158,7 @@ namespace ServerManagerTool.Lib
if (!string.IsNullOrWhiteSpace(Config.Default.ServerBackup_WorldSaveMessage))
{
ProcessAlert(AlertType.Backup, Config.Default.ServerBackup_WorldSaveMessage);
sent = SendMessageAsync(Config.Default.ServerBackup_WorldSaveMessage, cancellationToken).Result;
sent = SendMessageAsync(Config.Default.RCON_BackupMessageCommand, Config.Default.ServerBackup_WorldSaveMessage, cancellationToken).Result;
if (sent)
{
emailMessage.AppendLine("sent server save message.");
@ -2664,6 +2664,7 @@ namespace ServerManagerTool.Lib
LogProfileMessage($"{ex.StackTrace}", false);
}
await Task.Delay(100);
retries++;
}
}
@ -2677,11 +2678,16 @@ namespace ServerManagerTool.Lib
}
private async Task<bool> SendMessageAsync(string message, CancellationToken token)
{
return await SendMessageAsync(Config.Default.RCON_MessageCommand, message, token);
}
private async Task<bool> SendMessageAsync(string mode, string message, CancellationToken token)
{
if (string.IsNullOrWhiteSpace(message) || !SendMessages)
return false;
var sent = await SendCommandAsync($"{GetRconMessageCommand(Config.Default.RCON_MessageCommand)} {message}", false);
var sent = await SendCommandAsync($"{GetRconMessageCommand(mode)} {message}", false);
if (sent)
{

View file

@ -379,12 +379,9 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource GlobalSettings_BackupIntervalLabel}" VerticalAlignment="Center"/>
@ -394,11 +391,16 @@
</TextBox.Text>
</TextBox>
<StackPanel Grid.Row="0" Grid.Column="2" Margin="0" Orientation="Horizontal">
<Label Content="{DynamicResource GlobalSettings_RCON_ModeLabel}" VerticalAlignment="Center"/>
<ComboBox Name="RconBackupMessageModesComboBox" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=RconMessageModes}" SelectedValue="{Binding Config.RCON_BackupMessageCommand}" ToolTip="{DynamicResource GlobalSettings_RCON_ModeTooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</StackPanel>
<CheckBox Grid.Row="1" Grid.Column="0" Margin="0" Grid.ColumnSpan="2" Content="{DynamicResource GlobalSettings_DeleteOldFilesLabel}" IsChecked="{Binding Config.AutoBackup_DeleteOldFiles, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_DeleteOldFilesTooltip}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<cctl:AnnotatedSlider Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" Margin="5,0,5,0" Label="{DynamicResource GlobalSettings_DeleteIntervalLabel}" Value="{Binding Config.AutoBackup_DeleteInterval}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="2" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_DeleteIntervalTooltip}" IsEnabled="{Binding Config.AutoBackup_DeleteOldFiles}"/>
<cctl:AnnotatedSlider Grid.Row="1" Grid.Column="2" Margin="0" Label="{DynamicResource GlobalSettings_DeleteIntervalLabel}" Value="{Binding Config.AutoBackup_DeleteInterval}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="2" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_DeleteIntervalTooltip}" IsEnabled="{Binding Config.AutoBackup_DeleteOldFiles}"/>
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource GlobalSettings_BackupWorldSaveLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="4" Margin="1" Text="{Binding Config.ServerBackup_WorldSaveMessage}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_BackupWorldSaveTooltip}"/>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.ServerBackup_WorldSaveMessage}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_BackupWorldSaveTooltip}"/>
</Grid>
</GroupBox>

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:2C48A585-72D2-43FB-8987-6B5F0B3E460F</id>
<title>1.1.425 (1.1.425.1)</title>
<summary>1.1.425.1</summary>
<title>1.1.425 (1.1.425.2)</title>
<summary>1.1.425.2</summary>
<link href="" />
<updated>2022-05-06T00:00:00Z</updated>
<content type="xhtml">
@ -21,6 +21,7 @@
<ul>
<li>Global Settings - added RCON broadcast mode droplist, so auto processes can send messages via RCON using this mode.</li>
<li>Auto Processes - changed the message broadcast to use the new config setting, not a hardcoded value.</li>
<li>Auto Backup Settings - added RCON broadcast mode droplist, so backup processes can send messages via RCON using this mode.</li>
</ul>
</p>
</div>

View file

@ -7,6 +7,29 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2022-05-06T00:00:00Z</updated>
<entry>
<id>urn:uuid:E6701920-FF1E-48B7-B70A-18B9BC3592F7</id>
<title>1.1.425 (1.1.425.2)</title>
<summary>1.1.425.2</summary>
<link href="" />
<updated>2022-05-06T00: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;">CHANGE</u>
<br/>
<ul>
<li>Auto Backup Settings - added RCON broadcast mode droplist, so backup processes can send messages via RCON using this mode.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:2C48A585-72D2-43FB-8987-6B5F0B3E460F</id>
<title>1.1.425 (1.1.425.1)</title>

View file

@ -666,6 +666,9 @@
<setting name="DiscordBotAllServersKeyword" serializeAs="String">
<value>all</value>
</setting>
<setting name="RCON_BackupMessageCommand" serializeAs="String">
<value>Broadcast</value>
</setting>
</ServerManagerTool.Config>
</userSettings>
</configuration>

View file

@ -2342,5 +2342,17 @@ namespace ServerManagerTool {
return ((string)(this["SaveGamesRelativePath"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Broadcast")]
public string RCON_BackupMessageCommand {
get {
return ((string)(this["RCON_BackupMessageCommand"]));
}
set {
this["RCON_BackupMessageCommand"] = value;
}
}
}
}

View file

@ -644,5 +644,8 @@
<Setting Name="SaveGamesRelativePath" Type="System.String" Scope="Application">
<Value Profile="(Default)">SaveGames</Value>
</Setting>
<Setting Name="RCON_BackupMessageCommand" Type="System.String" Scope="User">
<Value Profile="(Default)">Broadcast</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -159,7 +159,7 @@ namespace ServerManagerTool.Lib
if (!string.IsNullOrWhiteSpace(Config.Default.ServerBackup_WorldSaveMessage))
{
ProcessAlert(AlertType.Backup, Config.Default.ServerBackup_WorldSaveMessage);
sent = SendMessageAsync(Config.Default.ServerBackup_WorldSaveMessage, cancellationToken).Result;
sent = SendMessageAsync(Config.Default.RCON_BackupMessageCommand, Config.Default.ServerBackup_WorldSaveMessage, cancellationToken).Result;
if (sent)
{
emailMessage.AppendLine("sent server save message.");
@ -2561,6 +2561,7 @@ namespace ServerManagerTool.Lib
LogProfileMessage($"{ex.StackTrace}", false);
}
await Task.Delay(100);
retries++;
}
}
@ -2574,11 +2575,16 @@ namespace ServerManagerTool.Lib
}
private async Task<bool> SendMessageAsync(string message, CancellationToken token)
{
return await SendMessageAsync(Config.Default.RCON_MessageCommand, message, token);
}
private async Task<bool> SendMessageAsync(string mode, string message, CancellationToken token)
{
if (string.IsNullOrWhiteSpace(message) || !SendMessages)
return false;
var sent = await SendCommandAsync($"{GetRconMessageCommand(Config.Default.RCON_MessageCommand)} {message}", false);
var sent = await SendCommandAsync($"{GetRconMessageCommand(mode)} {message}", false);
if (sent)
{

View file

@ -330,12 +330,9 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource GlobalSettings_BackupIntervalLabel}" VerticalAlignment="Center"/>
@ -345,11 +342,16 @@
</TextBox.Text>
</TextBox>
<StackPanel Grid.Row="0" Grid.Column="2" Margin="0" Orientation="Horizontal">
<Label Content="{DynamicResource GlobalSettings_RCON_ModeLabel}" VerticalAlignment="Center"/>
<ComboBox Name="RconBackupMessageModesComboBox" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=RconMessageModes}" SelectedValue="{Binding Config.RCON_BackupMessageCommand}" ToolTip="{DynamicResource GlobalSettings_RCON_ModeTooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</StackPanel>
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0" Content="{DynamicResource GlobalSettings_DeleteOldFilesLabel}" IsChecked="{Binding Config.AutoBackup_DeleteOldFiles, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_DeleteOldFilesTooltip}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<cctl:AnnotatedSlider Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" Margin="5,0,5,0" Label="{DynamicResource GlobalSettings_DeleteIntervalLabel}" Value="{Binding Config.AutoBackup_DeleteInterval}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="2" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_DeleteIntervalTooltip}" IsEnabled="{Binding Config.AutoBackup_DeleteOldFiles}"/>
<cctl:AnnotatedSlider Grid.Row="1" Grid.Column="2" Margin="0" Label="{DynamicResource GlobalSettings_DeleteIntervalLabel}" Value="{Binding Config.AutoBackup_DeleteInterval}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="2" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_DeleteIntervalTooltip}" IsEnabled="{Binding Config.AutoBackup_DeleteOldFiles}"/>
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource GlobalSettings_BackupWorldSaveLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="4" Margin="1" Text="{Binding Config.ServerBackup_WorldSaveMessage}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_BackupWorldSaveTooltip}"/>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="1,0,0,0" Text="{Binding Config.ServerBackup_WorldSaveMessage}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_BackupWorldSaveTooltip}"/>
</Grid>
</GroupBox>

View file

@ -21,6 +21,11 @@
<ul>
<li>Fixed an issue that would not send through the auto process messages via RCON using the correct mode selected in the global settings.</li>
</ul>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Auto Backup Settings - added RCON broadcast mode droplist, so backup processes can send messages via RCON using this mode.</li>
</ul>
</p>
</div>
</content>

View file

@ -7,6 +7,29 @@
<link href="http://servermanagers.freeforums.net/" />
<updated>2022-05-06T00:00:00Z</updated>
<entry>
<id>urn:uuid:6AC9586B-1678-46B5-9FD7-86B20FB67293</id>
<title>1.1.69 (1.1.69.2)</title>
<summary>1.1.69.2</summary>
<link href="" />
<updated>2022-05-06T00: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;">CHANGE</u>
<br/>
<ul>
<li>Auto Backup Settings - added RCON broadcast mode droplist, so backup processes can send messages via RCON using this mode.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:AD8ABBB5-093A-4FDB-B473-FCED2DB46781</id>
<title>1.1.69 (1.1.69.1)</title>