mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Server Monitor Changes
- added shutdown reason to window.
This commit is contained in:
parent
b24904d13c
commit
10506765fb
10 changed files with 143 additions and 39 deletions
|
|
@ -99,6 +99,7 @@ namespace ServerManagerTool.Lib
|
|||
private QueryMaster.Rcon _rconConsole = null;
|
||||
private bool _serverRunning = false;
|
||||
|
||||
public bool AllMessagesShowShutdownReason { get; set; } = Config.Default.ServerShutdown_AllMessagesShowReason;
|
||||
public bool BackupWorldFile { get; set; } = Config.Default.BackupWorldFile;
|
||||
public bool CheckForOnlinePlayers { get; set; } = Config.Default.ServerShutdown_CheckForOnlinePlayers;
|
||||
public bool DeleteOldBackupFiles { get; set; } = Config.Default.AutoBackup_DeleteOldFiles;
|
||||
|
|
@ -430,7 +431,7 @@ namespace ServerManagerTool.Lib
|
|||
gameServer = QueryMaster.ServerQuery.GetServerInstance(QueryMaster.EngineType.Source, endPoint);
|
||||
|
||||
// check if there is a shutdown reason
|
||||
if (!string.IsNullOrWhiteSpace(ShutdownReason) && !Config.Default.ServerShutdown_AllMessagesShowReason)
|
||||
if (!string.IsNullOrWhiteSpace(ShutdownReason) && !AllMessagesShowShutdownReason)
|
||||
{
|
||||
LogProfileMessage("Sending shutdown reason...");
|
||||
|
||||
|
|
@ -541,7 +542,7 @@ namespace ServerManagerTool.Lib
|
|||
ProcessAlert(AlertType.ShutdownMessage, message);
|
||||
|
||||
// check if there is a shutdown reason
|
||||
if (!string.IsNullOrWhiteSpace(ShutdownReason) && Config.Default.ServerShutdown_AllMessagesShowReason)
|
||||
if (!string.IsNullOrWhiteSpace(ShutdownReason) && AllMessagesShowShutdownReason)
|
||||
{
|
||||
ProcessAlert(AlertType.ShutdownReason, ShutdownReason);
|
||||
|
||||
|
|
@ -569,12 +570,22 @@ namespace ServerManagerTool.Lib
|
|||
// // perform a world save
|
||||
// if (!string.IsNullOrWhiteSpace(Config.Default.ServerShutdown_WorldSaveMessage))
|
||||
// {
|
||||
// LogProfileMessage(Config.Default.ServerShutdown_WorldSaveMessage);
|
||||
// ProcessAlert(AlertType.ShutdownMessage, Config.Default.ServerShutdown_WorldSaveMessage);
|
||||
// SendMessage(Config.Default.ServerShutdown_WorldSaveMessage, cancellationToken);
|
||||
// var message = Config.Default.ServerShutdown_WorldSaveMessage;
|
||||
|
||||
// LogProfileMessage(message);
|
||||
// ProcessAlert(AlertType.ShutdownMessage, message);
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(ShutdownReason) && AllMessagesShowShutdownReason)
|
||||
// {
|
||||
// ProcessAlert(AlertType.ShutdownReason, ShutdownReason);
|
||||
|
||||
// message = $"{message}\r\n{ShutdownReason}";
|
||||
// }
|
||||
|
||||
// SendMessage(message, cancellationToken);
|
||||
// }
|
||||
|
||||
// if (SendCommandAsync(Config.Default.ServerSaveCommand).Result)
|
||||
// if (SendCommand(Config.Default.ServerSaveCommand, cancellationToken))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
|
|
@ -610,7 +621,7 @@ namespace ServerManagerTool.Lib
|
|||
ProcessAlert(AlertType.ShutdownMessage, message);
|
||||
|
||||
// check if there is a shutdown reason
|
||||
if (!string.IsNullOrWhiteSpace(ShutdownReason) && Config.Default.ServerShutdown_AllMessagesShowReason)
|
||||
if (!string.IsNullOrWhiteSpace(ShutdownReason) && AllMessagesShowShutdownReason)
|
||||
{
|
||||
ProcessAlert(AlertType.ShutdownReason, ShutdownReason);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@
|
|||
<ul>
|
||||
<li>Reset Server - added new button to reset your server. This will delete all server files and reset your server back to new.</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Server Monitor - added shutdown reason.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="http://servermanagers.freeforums.net/" />
|
||||
<updated>2022-06-16T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:4E189446-9861-4B64-9B27-0E3E655CD1CA</id>
|
||||
<title>1.1.75 (1.1.75.2)</title>
|
||||
<summary>1.1.75.2</summary>
|
||||
<link href="" />
|
||||
<updated>2022-06-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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Server Monitor - added shutdown reason.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:4E189446-9861-4B64-9B27-0E3E655CD1CA</id>
|
||||
<title>1.1.75 (1.1.75.1)</title>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
<DockPanel x:Name="dockPanel">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*" MinHeight="200"/>
|
||||
|
|
@ -156,9 +157,19 @@
|
|||
<Image Source="{com:Icon Path=/ConanServerManager;component/Art/ChangeNotes.ico,Size=32}"/>
|
||||
</Button>
|
||||
|
||||
<cctl:AnnotatedSlider Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="13" Margin="1" Label="{DynamicResource ServerMonitor_SequentialProcessDelayLabel}" Value="{Binding SequentialProcessDelay}" Minimum="0" Maximum="300" SmallChange="1" LargeChange="5" TickFrequency="1" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Seconds}" Visibility="{Binding ProcessServersSequentially, Converter={StaticResource BooleanToVisibilityConverter}}" ToolTip="{DynamicResource ServerMonitor_SequentialProcessDelayTooltip}"/>
|
||||
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="13" Margin="1,2,5,1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<DataGrid Name="ServersGrid" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="13" Margin="5,5,5,0" HorizontalAlignment="Stretch" ItemsSource="{Binding ServerManager.Servers}" GridLinesVisibility="Horizontal" HeadersVisibility="All" AutoGenerateColumns="False" CanUserAddRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" RowHeaderWidth="25" SelectionMode="Single" PreviewMouseLeftButtonDown="OnMouseLeftButtonDown">
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource ShutdownWindow_ShutdownReasonLabel}" ToolTip="{DynamicResource ShutdownWindow_ShutdownReasonTooltip}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding ShutdownReason}" ToolTip="{DynamicResource ShutdownWindow_ShutdownReasonTooltip}" VerticalContentAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<cctl:AnnotatedSlider Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="13" Margin="1" Label="{DynamicResource ServerMonitor_SequentialProcessDelayLabel}" Value="{Binding SequentialProcessDelay}" Minimum="0" Maximum="300" SmallChange="1" LargeChange="5" TickFrequency="1" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Seconds}" Visibility="{Binding ProcessServersSequentially, Converter={StaticResource BooleanToVisibilityConverter}}" ToolTip="{DynamicResource ServerMonitor_SequentialProcessDelayTooltip}"/>
|
||||
|
||||
<DataGrid Name="ServersGrid" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="13" Margin="5,5,5,0" HorizontalAlignment="Stretch" ItemsSource="{Binding ServerManager.Servers}" GridLinesVisibility="Horizontal" HeadersVisibility="All" AutoGenerateColumns="False" CanUserAddRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" RowHeaderWidth="25" SelectionMode="Single" PreviewMouseLeftButtonDown="OnMouseLeftButtonDown">
|
||||
<DataGrid.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
|
|
@ -636,9 +647,9 @@
|
|||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<GridSplitter Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="13" Height="5" ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Center" Opacity="0"/>
|
||||
<GridSplitter Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="13" Height="5" ShowsPreview="True" HorizontalAlignment="Stretch" VerticalAlignment="Center" Opacity="0"/>
|
||||
|
||||
<RichTextBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="13" Margin="5,0,5,5" BorderBrush="LightGray" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" IsReadOnlyCaretVisible="True" IsReadOnly="True" IsTabStop="False">
|
||||
<RichTextBox Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="13" Margin="5,0,5,5" BorderBrush="LightGray" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" IsReadOnlyCaretVisible="True" IsReadOnly="True" IsTabStop="False">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="TextChanged" >
|
||||
<sm:ScrollToBottomAction IsEnabled="True"/>
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ namespace ServerManagerTool.Windows
|
|||
public static readonly DependencyProperty CancellationTokenSourceProperty = DependencyProperty.Register(nameof(CancellationTokenSource), typeof(CancellationTokenSource), typeof(ServerMonitorWindow));
|
||||
public static readonly DependencyProperty ProcessServersSequentiallyProperty = DependencyProperty.Register(nameof(ProcessServersSequentially), typeof(bool), typeof(ServerMonitorWindow), new PropertyMetadata(false));
|
||||
public static readonly DependencyProperty SequentialProcessDelayProperty = DependencyProperty.Register(nameof(SequentialProcessDelay), typeof(int), typeof(ServerMonitorWindow), new PropertyMetadata(10));
|
||||
public static readonly DependencyProperty ShutdownReasonProperty = DependencyProperty.Register(nameof(ShutdownReason), typeof(string), typeof(ServerMonitorWindow), new PropertyMetadata(null));
|
||||
|
||||
public ServerMonitorWindow(): this(null)
|
||||
{
|
||||
|
|
@ -158,6 +159,12 @@ namespace ServerManagerTool.Windows
|
|||
set { SetValue(SequentialProcessDelayProperty, value); }
|
||||
}
|
||||
|
||||
public string ShutdownReason
|
||||
{
|
||||
get { return (string)GetValue(ShutdownReasonProperty); }
|
||||
set { SetValue(ShutdownReasonProperty, value); }
|
||||
}
|
||||
|
||||
private void ServerMonitorWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ServerManager == null)
|
||||
|
|
@ -891,8 +898,9 @@ namespace ServerManagerTool.Windows
|
|||
{
|
||||
var processServersSequentially = ProcessServersSequentially;
|
||||
var sequentialProcessDelay = SequentialProcessDelay;
|
||||
var shutdownReason = ShutdownReason;
|
||||
|
||||
await StartSelectedServersAsync(restart: true, processServersSequentially, sequentialProcessDelay);
|
||||
await StartSelectedServersAsync(restart: true, processServersSequentially, sequentialProcessDelay, shutdownReason);
|
||||
},
|
||||
canExecute: (_) =>
|
||||
{
|
||||
|
|
@ -912,8 +920,9 @@ namespace ServerManagerTool.Windows
|
|||
{
|
||||
var processServersSequentially = ProcessServersSequentially;
|
||||
var sequentialProcessDelay = SequentialProcessDelay;
|
||||
var shutdownReason = ShutdownReason;
|
||||
|
||||
await StopSelectedServersAsync(shutdown: true, processServersSequentially, sequentialProcessDelay);
|
||||
await StopSelectedServersAsync(shutdown: true, processServersSequentially, sequentialProcessDelay, shutdownReason);
|
||||
},
|
||||
canExecute: (_) =>
|
||||
{
|
||||
|
|
@ -934,7 +943,7 @@ namespace ServerManagerTool.Windows
|
|||
var processServersSequentially = ProcessServersSequentially;
|
||||
var sequentialProcessDelay = SequentialProcessDelay;
|
||||
|
||||
await StartSelectedServersAsync(restart: false, processServersSequentially, sequentialProcessDelay);
|
||||
await StartSelectedServersAsync(restart: false, processServersSequentially, sequentialProcessDelay, shutdownReason: null);
|
||||
},
|
||||
canExecute: (_) =>
|
||||
{
|
||||
|
|
@ -954,8 +963,9 @@ namespace ServerManagerTool.Windows
|
|||
{
|
||||
var processServersSequentially = ProcessServersSequentially;
|
||||
var sequentialProcessDelay = SequentialProcessDelay;
|
||||
var shutdownReason = ShutdownReason;
|
||||
|
||||
await StopSelectedServersAsync(shutdown: false, processServersSequentially, sequentialProcessDelay);
|
||||
await StopSelectedServersAsync(shutdown: false, processServersSequentially, sequentialProcessDelay, shutdownReason);
|
||||
},
|
||||
canExecute: (_) =>
|
||||
{
|
||||
|
|
@ -975,8 +985,9 @@ namespace ServerManagerTool.Windows
|
|||
{
|
||||
var processServersSequentially = ProcessServersSequentially;
|
||||
var sequentialProcessDelay = SequentialProcessDelay;
|
||||
var shutdownReason = ShutdownReason;
|
||||
|
||||
await UpdateSelectedServersAsync(updateModsOnly: true, processServersSequentially, sequentialProcessDelay);
|
||||
await UpdateSelectedServersAsync(updateModsOnly: true, processServersSequentially, sequentialProcessDelay, shutdownReason);
|
||||
},
|
||||
canExecute: (_) =>
|
||||
{
|
||||
|
|
@ -996,8 +1007,9 @@ namespace ServerManagerTool.Windows
|
|||
{
|
||||
var processServersSequentially = ProcessServersSequentially;
|
||||
var sequentialProcessDelay = SequentialProcessDelay;
|
||||
var shutdownReason = ShutdownReason;
|
||||
|
||||
await UpdateSelectedServersAsync(updateModsOnly: false, processServersSequentially, sequentialProcessDelay);
|
||||
await UpdateSelectedServersAsync(updateModsOnly: false, processServersSequentially, sequentialProcessDelay, shutdownReason);
|
||||
},
|
||||
canExecute: (_) =>
|
||||
{
|
||||
|
|
@ -1263,7 +1275,7 @@ namespace ServerManagerTool.Windows
|
|||
}
|
||||
}
|
||||
|
||||
private async Task StartSelectedServersAsync(bool restart, bool processServersSequentially, int sequentialProcessDelay)
|
||||
private async Task StartSelectedServersAsync(bool restart, bool processServersSequentially, int sequentialProcessDelay, string shutdownReason)
|
||||
{
|
||||
if (CancellationTokenSource != null)
|
||||
return;
|
||||
|
|
@ -1331,6 +1343,7 @@ namespace ServerManagerTool.Windows
|
|||
OutputLogs = false,
|
||||
SendAlerts = true,
|
||||
SendEmails = false,
|
||||
ShutdownReason = shutdownReason,
|
||||
ServerProcess = ServerProcessType.Restart,
|
||||
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
|
||||
{
|
||||
|
|
@ -1403,7 +1416,7 @@ namespace ServerManagerTool.Windows
|
|||
}
|
||||
}
|
||||
|
||||
private async Task StopSelectedServersAsync(bool shutdown, bool processServersSequentially, int sequentialProcessDelay)
|
||||
private async Task StopSelectedServersAsync(bool shutdown, bool processServersSequentially, int sequentialProcessDelay, string shutdownReason)
|
||||
{
|
||||
if (CancellationTokenSource != null)
|
||||
return;
|
||||
|
|
@ -1473,6 +1486,7 @@ namespace ServerManagerTool.Windows
|
|||
PerformWorldSave = shutdown,
|
||||
SendAlerts = true,
|
||||
SendEmails = false,
|
||||
ShutdownReason = shutdownReason,
|
||||
ServerProcess = shutdown ? ServerProcessType.Shutdown : ServerProcessType.Stop,
|
||||
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
|
||||
{
|
||||
|
|
@ -1548,7 +1562,7 @@ namespace ServerManagerTool.Windows
|
|||
}
|
||||
}
|
||||
|
||||
private async Task UpdateSelectedServersAsync(bool updateModsOnly, bool processServersSequentially, int sequentialProcessDelay)
|
||||
private async Task UpdateSelectedServersAsync(bool updateModsOnly, bool processServersSequentially, int sequentialProcessDelay, string shutdownReason)
|
||||
{
|
||||
if (CancellationTokenSource != null)
|
||||
return;
|
||||
|
|
@ -1613,6 +1627,7 @@ namespace ServerManagerTool.Windows
|
|||
OutputLogs = false,
|
||||
SendAlerts = true,
|
||||
SendEmails = false,
|
||||
ShutdownReason = shutdownReason,
|
||||
ServerProcess = ServerProcessType.Update,
|
||||
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue