Task Priority Changes

- added a new task priority for the four auto processes.
- added the task priority selection to the global settings.
This commit is contained in:
Brett Hewitson 2022-05-15 14:24:47 +10:00
parent 138e56878a
commit fb936241c6
21 changed files with 412 additions and 64 deletions

View file

@ -900,6 +900,18 @@
<setting name="Alert_ServerStartedMessageIPandPort" serializeAs="String">
<value>{ipaddress}:{port}</value>
</setting>
<setting name="AutoBackup_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoUpdate_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoShutdown_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoStart_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
</ServerManagerTool.Config>
</userSettings>
</configuration>

View file

@ -12,7 +12,7 @@ namespace ServerManagerTool {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
public sealed partial class Config : global::System.Configuration.ApplicationSettingsBase {
private static Config defaultInstance = ((Config)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Config())));
@ -3195,5 +3195,53 @@ namespace ServerManagerTool {
this["Alert_ServerStartedMessageIPandPort"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoBackup_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoBackup_TaskPriority"]));
}
set {
this["AutoBackup_TaskPriority"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoUpdate_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoUpdate_TaskPriority"]));
}
set {
this["AutoUpdate_TaskPriority"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoShutdown_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoShutdown_TaskPriority"]));
}
set {
this["AutoShutdown_TaskPriority"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoStart_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoStart_TaskPriority"]));
}
set {
this["AutoStart_TaskPriority"] = value;
}
}
}
}

View file

@ -878,5 +878,17 @@
<Setting Name="Alert_ServerStartedMessageIPandPort" Type="System.String" Scope="User">
<Value Profile="(Default)">{ipaddress}:{port}</Value>
</Setting>
<Setting Name="AutoBackup_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="AutoUpdate_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="AutoShutdown_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="AutoStart_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -83,6 +83,15 @@
<sys:String x:Key="ProcessorAffinity_All">All</sys:String>
<!--#endregion-->
<!--#region Task Priority -->
<sys:String x:Key="TaskPriority_Idle">Idle</sys:String>
<sys:String x:Key="TaskPriority_BelowNormal">Below Normal</sys:String>
<sys:String x:Key="TaskPriority_Normal">Normal</sys:String>
<sys:String x:Key="TaskPriority_AboveNormal">Above Normal</sys:String>
<sys:String x:Key="TaskPriority_High">High</sys:String>
<sys:String x:Key="TaskPriority_RealTime">RealTime</sys:String>
<!--#endregion-->
<!--#region Window States -->
<sys:String x:Key="WindowState_Normal">Normal</sys:String>
<sys:String x:Key="WindowState_Minimized">Minimized</sys:String>
@ -741,6 +750,13 @@
<sys:String x:Key="GlobalSettings_RCON_ModeLabel">RCON Broadcast Mode:</sys:String>
<sys:String x:Key="GlobalSettings_RCON_ModeTooltip">Select the method used by the server manager to send auto process messages to the game clients via RCON.</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_InformationLabel">Any changes to these priorities will take effect after the task has been created or saved.</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_Tooltip">Select the priority used by the windows task manager when running this task.</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoBackupLabel">Auto Backup Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoUpdateLabel">Auto Update Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoShutdownLabel">Auto Shutdown/Restart Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoStartLabel">Auto Start Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_ResetSettings_ConfirmTitle">Confirm Settings Reset Action</sys:String>
<sys:String x:Key="GlobalSettings_ResetSettings_ConfirmLabel">Click 'Yes' to confirm you want to perform the settings reset.</sys:String>
<sys:String x:Key="GlobalSettings_ResetSettings_FailedTitle">Failed to Reset Settings</sys:String>

View file

@ -4482,18 +4482,18 @@ namespace ServerManagerTool.Lib
var taskKey = GetProfileKey();
if(!TaskSchedulerUtils.ScheduleAutoStart(taskKey, null, this.EnableAutoStart, GetLauncherFile(), ProfileName, true))
if(!TaskSchedulerUtils.ScheduleAutoStart(taskKey, null, this.EnableAutoStart, GetLauncherFile(), ProfileName, true, Config.Default.AutoStart_TaskPriority))
{
return false;
}
var command = Assembly.GetEntryAssembly().Location;
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#1", command, this.EnableAutoShutdown1 ? (TimeSpan.TryParseExact(this.AutoShutdownTime1, "g", null, out TimeSpan shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek1, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown1))
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#1", command, this.EnableAutoShutdown1 ? (TimeSpan.TryParseExact(this.AutoShutdownTime1, "g", null, out TimeSpan shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek1, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown1, Config.Default.AutoShutdown_TaskPriority))
{
return false;
}
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#2", command, this.EnableAutoShutdown2 ? (TimeSpan.TryParseExact(this.AutoShutdownTime2, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek2, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown2))
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#2", command, this.EnableAutoShutdown2 ? (TimeSpan.TryParseExact(this.AutoShutdownTime2, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek2, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown2, Config.Default.AutoShutdown_TaskPriority))
{
return false;
}

View file

@ -808,36 +808,52 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="*" MinWidth="150"/>
<ColumnDefinition Width="Auto" MinWidth="150"/>
<ColumnDefinition Width="*" MinWidth="150"/>
<ColumnDefinition Width="Auto" MinWidth="150"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Text="{DynamicResource GlobalSettings_AdvancedSettingsInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" Text="{DynamicResource GlobalSettings_AdvancedSettingsInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
<CheckBox Grid.Row="1" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UseShutdownCommandLabel}" IsChecked="{Binding Config.ServerShutdown_UseShutdownCommand}" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_UseShutdownCommandTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="1" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_BackupWorldFileLabel}" IsChecked="{Binding Config.BackupWorldFile, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_BackupWorldFileTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UseShutdownCommandLabel}" IsChecked="{Binding Config.ServerShutdown_UseShutdownCommand}" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_UseShutdownCommandTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_BackupWorldFileLabel}" IsChecked="{Binding Config.BackupWorldFile, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_BackupWorldFileTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedLabel}" IsChecked="{Binding Config.CloseShutdownWindowWhenFinished, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_VerifyServerAfterUpdateLabel}" IsChecked="{Binding Config.AutoUpdate_VerifyServerAfterUpdate, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_VerifyServerAfterUpdateTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedLabel}" IsChecked="{Binding Config.CloseShutdownWindowWhenFinished, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_VerifyServerAfterUpdateLabel}" IsChecked="{Binding Config.AutoUpdate_VerifyServerAfterUpdate, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_VerifyServerAfterUpdateTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRemoveQuitLabel}" IsChecked="{Binding CommonConfig.SteamCmdRemoveQuit, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRemoveQuitTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsLabel}" IsChecked="{Binding Config.UpdateDirectoryPermissions, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRemoveQuitLabel}" IsChecked="{Binding CommonConfig.SteamCmdRemoveQuit, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRemoveQuitTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsLabel}" IsChecked="{Binding Config.UpdateDirectoryPermissions, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="4" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRedirectOutputLabel}" IsChecked="{Binding Config.SteamCmdRedirectOutput, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRedirectOutputTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRedirectOutputLabel}" IsChecked="{Binding Config.SteamCmdRedirectOutput, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRedirectOutputTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="5" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_EnableLoggingLabel}" IsChecked="{Binding Config.LoggingEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_EnableLoggingTooltip}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<cctl:AnnotatedSlider Grid.Row="5" Grid.Column="1" Margin="0" Label="{DynamicResource GlobalSettings_WorldSaveDelayLabel}" Value="{Binding Config.ServerShutdown_WorldSaveDelay, Converter={cc:IntRangeValueConverter 10, 300}}" Minimum="10" Maximum="300" SmallChange="10" LargeChange="50" TickFrequency="1" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Seconds}" ToolTip="{DynamicResource GlobalSettings_WorldSaveDelayTooltip}"/>
<CheckBox Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_EnableLoggingLabel}" IsChecked="{Binding Config.LoggingEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_EnableLoggingTooltip}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<cctl:AnnotatedSlider Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="2" Margin="1" Label="{DynamicResource GlobalSettings_WorldSaveDelayLabel}" Value="{Binding Config.ServerShutdown_WorldSaveDelay, Converter={cc:IntRangeValueConverter 10, 300}}" Minimum="10" Maximum="300" SmallChange="10" LargeChange="50" TickFrequency="1" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Seconds}" ToolTip="{DynamicResource GlobalSettings_WorldSaveDelayTooltip}"/>
<cctl:AnnotatedSlider Grid.Row="6" Grid.Column="0" Margin="0" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysLabel}" Value="{Binding Config.LoggingMaxArchiveDays}" Minimum="1" Maximum="365" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<cctl:AnnotatedSlider Grid.Row="7" Grid.Column="0" Margin="0" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesLabel}" Value="{Binding Config.LoggingMaxArchiveFiles}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Files}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<cctl:AnnotatedSlider Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Margin="1" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysLabel}" Value="{Binding Config.LoggingMaxArchiveDays}" Minimum="1" Maximum="365" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<StackPanel Grid.Row="7" Grid.Column="1" Margin="0" Orientation="Horizontal">
<Label Content="{DynamicResource GlobalSettings_RCON_ModeLabel}" VerticalAlignment="Center"/>
<ComboBox Name="RconMessageModesComboBox" Margin="5" ItemsSource="{Binding ElementName=GlobalSettings, Path=RconMessageModes}" SelectedValue="{Binding Config.RCON_MessageCommand}" ToolTip="{DynamicResource GlobalSettings_RCON_ModeTooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</StackPanel>
<cctl:AnnotatedSlider Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" Margin="1" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesLabel}" Value="{Binding Config.LoggingMaxArchiveFiles}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Files}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<Label Grid.Row="7" Grid.Column="2" Content="{DynamicResource GlobalSettings_RCON_ModeLabel}" VerticalAlignment="Center"/>
<ComboBox Name="RconMessageModesComboBox" Grid.Row="7" Grid.Column="3" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=RconMessageModes}" SelectedValue="{Binding Config.RCON_MessageCommand}" ToolTip="{DynamicResource GlobalSettings_RCON_ModeTooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<TextBlock Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" Text="{DynamicResource GlobalSettings_TaskPriority_InformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
<Label Grid.Row="9" Grid.Column="0" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoBackupLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoBackupComboBox" Grid.Row="9" Grid.Column="1" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoBackup_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="9" Grid.Column="2" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoUpdateLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoUpdateComboBox" Grid.Row="9" Grid.Column="3" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoUpdate_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="10" Grid.Column="0" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoShutdownLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoShutdownComboBox" Grid.Row="10" Grid.Column="1" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoShutdown_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="10" Grid.Column="2" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoStartLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoStartComboBox" Grid.Row="10" Grid.Column="3" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoStart_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</Grid>
</GroupBox>
</Grid>

View file

@ -38,6 +38,7 @@ namespace ServerManagerTool
public static readonly DependencyProperty DiscordBotLogLevelsProperty = DependencyProperty.Register(nameof(DiscordBotLogLevels), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty DiscordBotWhitelistProperty = DependencyProperty.Register(nameof(DiscordBotWhitelist), typeof(List<DiscordBotWhitelistItem>), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty RconMessageModesProperty = DependencyProperty.Register(nameof(RconMessageModes), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty TaskPrioritiesProperty = DependencyProperty.Register(nameof(TaskPriorities), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public GlobalSettingsControl()
{
@ -54,6 +55,7 @@ namespace ServerManagerTool
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateDiscordBotLogLevelsComboBox();
PopulateRconMessageModesComboBox();
PopulateTaskPrioritiesComboBox();
DiscordBotWhitelist = new List<DiscordBotWhitelistItem>();
if (Config.DiscordBotWhitelist != null)
@ -124,6 +126,12 @@ namespace ServerManagerTool
set { SetValue(RconMessageModesProperty, value); }
}
public ComboBoxItemList TaskPriorities
{
get { return (ComboBoxItemList)GetValue(TaskPrioritiesProperty); }
set { SetValue(TaskPrioritiesProperty, value); }
}
public void ApplyChangesToConfig()
{
if (Config.DiscordBotWhitelist is null)
@ -394,6 +402,7 @@ namespace ServerManagerTool
PopulateWindowsStatesMainWindowComboBox();
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateRconMessageModesComboBox();
PopulateTaskPrioritiesComboBox();
App.Instance.OnResourceDictionaryChanged(Config.CultureName);
}
@ -555,6 +564,39 @@ namespace ServerManagerTool
}
}
private void PopulateTaskPrioritiesComboBox()
{
var selectedValueAutoBackup = this.TaskPriorityAutoBackupComboBox?.SelectedValue ?? Config.AutoBackup_TaskPriority;
var selectedValueAutoUpdate = this.TaskPriorityAutoUpdateComboBox?.SelectedValue ?? Config.AutoUpdate_TaskPriority;
var selectedValueAutoShutdown = this.TaskPriorityAutoShutdownComboBox?.SelectedValue ?? Config.AutoShutdown_TaskPriority;
var selectedValueAutoStart = this.TaskPriorityAutoStartComboBox?.SelectedValue ?? Config.AutoStart_TaskPriority;
var list = new ComboBoxItemList();
foreach (ProcessPriorityClass priority in Enum.GetValues(typeof(ProcessPriorityClass)))
{
var displayMember = _globalizer.GetResourceString($"TaskPriority_{priority}") ?? priority.ToString();
list.Add(new Common.Model.ComboBoxItem(priority.ToString(), displayMember));
}
this.TaskPriorities = list;
if (this.TaskPriorityAutoBackupComboBox != null)
{
this.TaskPriorityAutoBackupComboBox.SelectedValue = selectedValueAutoBackup;
}
if (this.TaskPriorityAutoUpdateComboBox != null)
{
this.TaskPriorityAutoUpdateComboBox.SelectedValue = selectedValueAutoUpdate;
}
if (this.TaskPriorityAutoShutdownComboBox != null)
{
this.TaskPriorityAutoShutdownComboBox.SelectedValue = selectedValueAutoShutdown;
}
if (this.TaskPriorityAutoStartComboBox != null)
{
this.TaskPriorityAutoStartComboBox.SelectedValue = selectedValueAutoStart;
}
}
#region Discord Bot Whitelist
private void AddDiscordBotWhitelist_Click(object sender, RoutedEventArgs e)
{

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
<title>1.1.428 (1.1.428.1)</title>
<summary>1.1.428.1</summary>
<title>1.1.428 (1.1.428.2)</title>
<summary>1.1.428.2</summary>
<link href="" />
<updated>2022-05-15T00:00:00Z</updated>
<content type="xhtml">
@ -21,6 +21,11 @@
<ul>
<li>Server Shutdown/Restart - rewritten the code that sends the RCON commands to prevent the hangs after the RCON command fails.</li>
</ul>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Auto Process Task Priorities - Have added task priority droplists to the global settings, allowing the priority for each auto process task to be changed.</li>
</ul>
</p>
</div>
</content>

View file

@ -7,6 +7,29 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2022-05-15T00:00:00Z</updated>
<entry>
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
<title>1.1.428 (1.1.428.2)</title>
<summary>1.1.428.2</summary>
<link href="" />
<updated>2022-05-15T00: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 Process Task Priorities - Have added task priority droplists to the global settings, allowing the priority for each auto process task to be changed.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
<title>1.1.428 (1.1.428.1)</title>

View file

@ -46,7 +46,7 @@ namespace ServerManagerTool
var taskKey = TaskSchedulerUtils.ComputeKey(Config.Default.DataDir);
var command = Assembly.GetEntryAssembly().Location;
if (!TaskSchedulerUtils.ScheduleAutoUpdate(taskKey, null, command, Config.Default.AutoUpdate_EnableUpdate ? Config.Default.AutoUpdate_UpdatePeriod : 0))
if (!TaskSchedulerUtils.ScheduleAutoUpdate(taskKey, null, command, Config.Default.AutoUpdate_EnableUpdate ? Config.Default.AutoUpdate_UpdatePeriod : 0, Config.Default.AutoUpdate_TaskPriority))
{
MessageBox.Show(_globalizer.GetResourceString("GlobalSettings_CacheTaskUpdate_ErrorLabel"), _globalizer.GetResourceString("GlobalSettings_CacheTaskUpdate_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
}
@ -62,7 +62,7 @@ namespace ServerManagerTool
}
}
if (!TaskSchedulerUtils.ScheduleAutoBackup(taskKey, null, command, Config.Default.AutoBackup_EnableBackup ? Config.Default.AutoBackup_BackupPeriod : 0))
if (!TaskSchedulerUtils.ScheduleAutoBackup(taskKey, null, command, Config.Default.AutoBackup_EnableBackup ? Config.Default.AutoBackup_BackupPeriod : 0, Config.Default.AutoBackup_TaskPriority))
{
MessageBox.Show(_globalizer.GetResourceString("GlobalSettings_BackupTaskUpdate_ErrorLabel"), _globalizer.GetResourceString("GlobalSettings_BackupTaskUpdate_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
}

View file

@ -675,6 +675,18 @@
<setting name="Alert_ServerStartedMessageIPandPort" serializeAs="String">
<value>{ipaddress}:{port}</value>
</setting>
<setting name="AutoBackup_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoUpdate_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoShutdown_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoStart_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
</ServerManagerTool.Config>
</userSettings>
</configuration>

View file

@ -12,7 +12,7 @@ namespace ServerManagerTool {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
public sealed partial class Config : global::System.Configuration.ApplicationSettingsBase {
private static Config defaultInstance = ((Config)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Config())));
@ -2378,5 +2378,53 @@ namespace ServerManagerTool {
this["Alert_ServerStartedMessageIPandPort"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoBackup_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoBackup_TaskPriority"]));
}
set {
this["AutoBackup_TaskPriority"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoUpdate_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoUpdate_TaskPriority"]));
}
set {
this["AutoUpdate_TaskPriority"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoShutdown_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoShutdown_TaskPriority"]));
}
set {
this["AutoShutdown_TaskPriority"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Diagnostics.ProcessPriorityClass AutoStart_TaskPriority {
get {
return ((global::System.Diagnostics.ProcessPriorityClass)(this["AutoStart_TaskPriority"]));
}
set {
this["AutoStart_TaskPriority"] = value;
}
}
}
}

View file

@ -653,5 +653,17 @@
<Setting Name="Alert_ServerStartedMessageIPandPort" Type="System.String" Scope="User">
<Value Profile="(Default)">{ipaddress}:{port}</Value>
</Setting>
<Setting Name="AutoBackup_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="AutoUpdate_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="AutoShutdown_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="AutoStart_TaskPriority" Type="System.Diagnostics.ProcessPriorityClass" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -57,6 +57,15 @@
<sys:String x:Key="ProcessorAffinity_All">All</sys:String>
<!--#endregion-->
<!--#region Task Priority -->
<sys:String x:Key="TaskPriority_idle">Idle</sys:String>
<sys:String x:Key="TaskPriority_belownormal">Below Normal</sys:String>
<sys:String x:Key="TaskPriority_normal">Normal</sys:String>
<sys:String x:Key="TaskPriority_abovenormal">Above Normal</sys:String>
<sys:String x:Key="TaskPriority_high">High</sys:String>
<sys:String x:Key="TaskPriority_realtime">RealTime</sys:String>
<!--#endregion-->
<!--#region Window States -->
<sys:String x:Key="WindowState_Normal">Normal</sys:String>
<sys:String x:Key="WindowState_Minimized">Minimized</sys:String>
@ -903,6 +912,13 @@
<sys:String x:Key="GlobalSettings_RCON_ModeLabel">RCON Broadcast Mode:</sys:String>
<sys:String x:Key="GlobalSettings_RCON_ModeTooltip">Select the method used by the server manager to send auto process messages to the game clients via RCON.</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_InformationLabel">Any changes to these priorities will take effect after the task has been created or saved.</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_Tooltip">Select the priority used by the windows task manager when running this task.</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoBackupLabel">Auto Backup Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoUpdateLabel">Auto Update Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoShutdownLabel">Auto Shutdown/Restart Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_TaskPriority_AutoStartLabel">Auto Start Task Priority:</sys:String>
<sys:String x:Key="GlobalSettings_ResetSettings_ConfirmTitle">Confirm Settings Reset Action</sys:String>
<sys:String x:Key="GlobalSettings_ResetSettings_ConfirmLabel">Click 'Yes' to confirm you want to perform the settings reset.</sys:String>
<sys:String x:Key="GlobalSettings_ResetSettings_FailedTitle">Failed to Reset Settings</sys:String>

View file

@ -1177,19 +1177,19 @@ namespace ServerManagerTool.Lib
var taskKey = GetProfileKey();
if(!TaskSchedulerUtils.ScheduleAutoStart(taskKey, null, this.EnableAutoStart, GetLauncherFile(), ProfileName, true))
if(!TaskSchedulerUtils.ScheduleAutoStart(taskKey, null, this.EnableAutoStart, GetLauncherFile(), ProfileName, true, Config.Default.AutoStart_TaskPriority))
{
return false;
}
TimeSpan shutdownTime;
var command = Assembly.GetEntryAssembly().Location;
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#1", command, this.EnableAutoShutdown1 ? (TimeSpan.TryParseExact(this.AutoShutdownTime1, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek1, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown1))
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#1", command, this.EnableAutoShutdown1 ? (TimeSpan.TryParseExact(this.AutoShutdownTime1, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek1, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown1, Config.Default.AutoShutdown_TaskPriority))
{
return false;
}
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#2", command, this.EnableAutoShutdown2 ? (TimeSpan.TryParseExact(this.AutoShutdownTime2, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek2, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown2))
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#2", command, this.EnableAutoShutdown2 ? (TimeSpan.TryParseExact(this.AutoShutdownTime2, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek2, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown2, Config.Default.AutoShutdown_TaskPriority))
{
return false;
}

View file

@ -753,36 +753,52 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="*" MinWidth="150"/>
<ColumnDefinition Width="Auto" MinWidth="150"/>
<ColumnDefinition Width="*" MinWidth="150"/>
<ColumnDefinition Width="Auto" MinWidth="150"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Text="{DynamicResource GlobalSettings_AdvancedSettingsInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" Text="{DynamicResource GlobalSettings_AdvancedSettingsInformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
<CheckBox Grid.Row="1" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UseShutdownCommandLabel}" IsChecked="{Binding Config.ServerShutdown_UseShutdownCommand}" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_UseShutdownCommandTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="1" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_BackupWorldFileLabel}" IsChecked="{Binding Config.BackupWorldFile, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_BackupWorldFileTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UseShutdownCommandLabel}" IsChecked="{Binding Config.ServerShutdown_UseShutdownCommand}" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_UseShutdownCommandTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_BackupWorldFileLabel}" IsChecked="{Binding Config.BackupWorldFile, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_BackupWorldFileTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedLabel}" IsChecked="{Binding Config.CloseShutdownWindowWhenFinished, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_VerifyServerAfterUpdateLabel}" IsChecked="{Binding Config.AutoUpdate_VerifyServerAfterUpdate, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_VerifyServerAfterUpdateTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedLabel}" IsChecked="{Binding Config.CloseShutdownWindowWhenFinished, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CloseShutdownWindowWhenFinishedTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_VerifyServerAfterUpdateLabel}" IsChecked="{Binding Config.AutoUpdate_VerifyServerAfterUpdate, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_VerifyServerAfterUpdateTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRemoveQuitLabel}" IsChecked="{Binding CommonConfig.SteamCmdRemoveQuit, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRemoveQuitTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsLabel}" IsChecked="{Binding Config.UpdateDirectoryPermissions, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRemoveQuitLabel}" IsChecked="{Binding CommonConfig.SteamCmdRemoveQuit, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRemoveQuitTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsLabel}" IsChecked="{Binding Config.UpdateDirectoryPermissions, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_UpdateDirectoryPermissionsTooltip}" HorizontalAlignment="Left"/>
<CheckBox Grid.Row="4" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRedirectOutputLabel}" IsChecked="{Binding Config.SteamCmdRedirectOutput, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRedirectOutputTooltip}" HorizontalAlignment="Left" />
<CheckBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_SteamCmdRedirectOutputLabel}" IsChecked="{Binding Config.SteamCmdRedirectOutput, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_SteamCmdRedirectOutputTooltip}" HorizontalAlignment="Left" />
<CheckBox Grid.Row="5" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_EnableLoggingLabel}" IsChecked="{Binding Config.LoggingEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_EnableLoggingTooltip}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<cctl:AnnotatedSlider Grid.Row="5" Grid.Column="1" Margin="0" Label="{DynamicResource GlobalSettings_WorldSaveDelayLabel}" Value="{Binding Config.ServerShutdown_WorldSaveDelay, Converter={cc:IntRangeValueConverter 10, 300}}" Minimum="10" Maximum="300" SmallChange="10" LargeChange="50" TickFrequency="1" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Seconds}" ToolTip="{DynamicResource GlobalSettings_WorldSaveDelayTooltip}"/>
<CheckBox Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_EnableLoggingLabel}" IsChecked="{Binding Config.LoggingEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_EnableLoggingTooltip}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<cctl:AnnotatedSlider Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="2" Margin="1" Label="{DynamicResource GlobalSettings_WorldSaveDelayLabel}" Value="{Binding Config.ServerShutdown_WorldSaveDelay, Converter={cc:IntRangeValueConverter 10, 300}}" Minimum="10" Maximum="300" SmallChange="10" LargeChange="50" TickFrequency="1" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" Suffix="{DynamicResource SliderUnits_Seconds}" ToolTip="{DynamicResource GlobalSettings_WorldSaveDelayTooltip}"/>
<cctl:AnnotatedSlider Grid.Row="6" Grid.Column="0" Margin="0" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysLabel}" Value="{Binding Config.LoggingMaxArchiveDays}" Minimum="1" Maximum="365" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<cctl:AnnotatedSlider Grid.Row="7" Grid.Column="0" Margin="0" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesLabel}" Value="{Binding Config.LoggingMaxArchiveFiles}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Files}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<cctl:AnnotatedSlider Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Margin="1" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysLabel}" Value="{Binding Config.LoggingMaxArchiveDays}" Minimum="1" Maximum="365" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Days}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveDaysTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<StackPanel Grid.Row="7" Grid.Column="1" Margin="0" Orientation="Horizontal">
<Label Content="{DynamicResource GlobalSettings_RCON_ModeLabel}" VerticalAlignment="Center"/>
<ComboBox Name="RconMessageModesComboBox" Margin="5" ItemsSource="{Binding ElementName=GlobalSettings, Path=RconMessageModes}" SelectedValue="{Binding Config.RCON_MessageCommand}" ToolTip="{DynamicResource GlobalSettings_RCON_ModeTooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</StackPanel>
<cctl:AnnotatedSlider Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" Margin="1" Label="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesLabel}" Value="{Binding Config.LoggingMaxArchiveFiles}" Minimum="1" Maximum="1000" SmallChange="1" LargeChange="5" TickFrequency="5" LabelRelativeWidth="Auto" SliderRelativeWidth="15*" SuffixRelativeWidth="Auto" SuffixRelativeMinWidth="40" Suffix="{DynamicResource SliderUnits_Files}" ToolTip="{DynamicResource GlobalSettings_LoggingMaxArchiveFilesTooltip}" IsEnabled="{Binding Config.LoggingEnabled}"/>
<Label Grid.Row="7" Grid.Column="2" Margin="0" Content="{DynamicResource GlobalSettings_RCON_ModeLabel}" VerticalAlignment="Center"/>
<ComboBox Name="RconMessageModesComboBox" Grid.Row="7" Grid.Column="3" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=RconMessageModes}" SelectedValue="{Binding Config.RCON_MessageCommand}" ToolTip="{DynamicResource GlobalSettings_RCON_ModeTooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<TextBlock Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" Text="{DynamicResource GlobalSettings_TaskPriority_InformationLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="{DynamicResource WarningMessage}"/>
<Label Grid.Row="9" Grid.Column="0" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoBackupLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoBackupComboBox" Grid.Row="9" Grid.Column="1" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoBackup_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="9" Grid.Column="2" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoUpdateLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoUpdateComboBox" Grid.Row="9" Grid.Column="3" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoUpdate_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="10" Grid.Column="0" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoShutdownLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoShutdownComboBox" Grid.Row="10" Grid.Column="1" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoShutdown_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="10" Grid.Column="2" Margin="0" Content="{DynamicResource GlobalSettings_TaskPriority_AutoStartLabel}" VerticalAlignment="Center"/>
<ComboBox Name="TaskPriorityAutoStartComboBox" Grid.Row="10" Grid.Column="3" Margin="1" ItemsSource="{Binding ElementName=GlobalSettings, Path=TaskPriorities}" SelectedValue="{Binding Config.AutoStart_TaskPriority}" ToolTip="{DynamicResource GlobalSettings_TaskPriority_Tooltip}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</Grid>
</GroupBox>
</Grid>

View file

@ -36,6 +36,7 @@ namespace ServerManagerTool
public static readonly DependencyProperty DiscordBotLogLevelsProperty = DependencyProperty.Register(nameof(DiscordBotLogLevels), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty DiscordBotWhitelistProperty = DependencyProperty.Register(nameof(DiscordBotWhitelist), typeof(List<DiscordBotWhitelistItem>), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty RconMessageModesProperty = DependencyProperty.Register(nameof(RconMessageModes), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty TaskPrioritiesProperty = DependencyProperty.Register(nameof(TaskPriorities), typeof(ComboBoxItemList), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public GlobalSettingsControl()
{
@ -52,6 +53,7 @@ namespace ServerManagerTool
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateDiscordBotLogLevelsComboBox();
PopulateRconMessageModesComboBox();
PopulateTaskPrioritiesComboBox();
DiscordBotWhitelist = new List<DiscordBotWhitelistItem>();
if (Config.DiscordBotWhitelist != null)
@ -122,6 +124,12 @@ namespace ServerManagerTool
set { SetValue(RconMessageModesProperty, value); }
}
public ComboBoxItemList TaskPriorities
{
get { return (ComboBoxItemList)GetValue(TaskPrioritiesProperty); }
set { SetValue(TaskPrioritiesProperty, value); }
}
public void ApplyChangesToConfig()
{
if (Config.DiscordBotWhitelist is null)
@ -396,6 +404,7 @@ namespace ServerManagerTool
PopulateWindowsStatesMainWindowComboBox();
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateRconMessageModesComboBox();
PopulateTaskPrioritiesComboBox();
App.Instance.OnResourceDictionaryChanged(Config.CultureName);
}
@ -557,6 +566,39 @@ namespace ServerManagerTool
}
}
private void PopulateTaskPrioritiesComboBox()
{
var selectedValueAutoBackup = this.TaskPriorityAutoBackupComboBox?.SelectedValue ?? Config.AutoBackup_TaskPriority;
var selectedValueAutoUpdate = this.TaskPriorityAutoUpdateComboBox?.SelectedValue ?? Config.AutoUpdate_TaskPriority;
var selectedValueAutoShutdown = this.TaskPriorityAutoShutdownComboBox?.SelectedValue ?? Config.AutoShutdown_TaskPriority;
var selectedValueAutoStart = this.TaskPriorityAutoStartComboBox?.SelectedValue ?? Config.AutoStart_TaskPriority;
var list = new ComboBoxItemList();
foreach (ProcessPriorityClass priority in Enum.GetValues(typeof(ProcessPriorityClass)))
{
var displayMember = _globalizer.GetResourceString($"TaskPriority_{priority}") ?? priority.ToString();
list.Add(new Common.Model.ComboBoxItem(priority.ToString(), displayMember));
}
this.TaskPriorities = list;
if (this.TaskPriorityAutoBackupComboBox != null)
{
this.TaskPriorityAutoBackupComboBox.SelectedValue = selectedValueAutoBackup;
}
if (this.TaskPriorityAutoUpdateComboBox != null)
{
this.TaskPriorityAutoUpdateComboBox.SelectedValue = selectedValueAutoUpdate;
}
if (this.TaskPriorityAutoShutdownComboBox != null)
{
this.TaskPriorityAutoShutdownComboBox.SelectedValue = selectedValueAutoShutdown;
}
if (this.TaskPriorityAutoStartComboBox != null)
{
this.TaskPriorityAutoStartComboBox.SelectedValue = selectedValueAutoStart;
}
}
#region Discord Bot Whitelist
private void AddDiscordBotWhitelist_Click(object sender, RoutedEventArgs e)
{

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
<title>1.1.72 (1.1.72.1)</title>
<summary>1.1.72.1</summary>
<title>1.1.72 (1.1.72.2)</title>
<summary>1.1.72.2</summary>
<link href="" />
<updated>2022-05-15T00:00:00Z</updated>
<content type="xhtml">
@ -21,6 +21,11 @@
<ul>
<li>Server Shutdown/Restart - have rewritten the code that sends the RCON commands to prevent the hangs after the RCON command fails.</li>
</ul>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Auto Process Task Priorities - Have added task priority droplists to the global settings, allowing the priority for each auto process task to be changed.</li>
</ul>
</p>
</div>
</content>

View file

@ -7,6 +7,29 @@
<link href="http://servermanagers.freeforums.net/" />
<updated>2022-05-15T00:00:00Z</updated>
<entry>
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
<title>1.1.72 (1.1.72.2)</title>
<summary>1.1.72.2</summary>
<link href="" />
<updated>2022-05-15T00: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 Process Task Priorities - Have added task priority droplists to the global settings, allowing the priority for each auto process task to be changed.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
<title>1.1.72 (1.1.72.1)</title>

View file

@ -63,7 +63,7 @@ namespace ServerManagerTool
var taskKey = TaskSchedulerUtils.ComputeKey(Config.Default.DataPath);
var command = Assembly.GetEntryAssembly().Location;
if (!TaskSchedulerUtils.ScheduleAutoUpdate(taskKey, null, command, Config.Default.AutoUpdate_EnableUpdate ? Config.Default.AutoUpdate_UpdatePeriod : 0))
if (!TaskSchedulerUtils.ScheduleAutoUpdate(taskKey, null, command, Config.Default.AutoUpdate_EnableUpdate ? Config.Default.AutoUpdate_UpdatePeriod : 0, Config.Default.AutoUpdate_TaskPriority))
{
MessageBox.Show(_globalizer.GetResourceString("GlobalSettings_CacheTaskUpdate_ErrorLabel"), _globalizer.GetResourceString("GlobalSettings_CacheTaskUpdate_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
}
@ -79,7 +79,7 @@ namespace ServerManagerTool
}
}
if (!TaskSchedulerUtils.ScheduleAutoBackup(taskKey, null, command, Config.Default.AutoBackup_EnableBackup ? Config.Default.AutoBackup_BackupPeriod : 0))
if (!TaskSchedulerUtils.ScheduleAutoBackup(taskKey, null, command, Config.Default.AutoBackup_EnableBackup ? Config.Default.AutoBackup_BackupPeriod : 0, Config.Default.AutoBackup_TaskPriority))
{
MessageBox.Show(_globalizer.GetResourceString("GlobalSettings_BackupTaskUpdate_ErrorLabel"), _globalizer.GetResourceString("GlobalSettings_BackupTaskUpdate_ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
}

View file

@ -159,7 +159,7 @@ namespace ServerManagerTool.Common.Utils
task.Run();
}
public static bool ScheduleAutoBackup(string taskKey, string taskSuffix, string command, int autoBackupPeriod)
public static bool ScheduleAutoBackup(string taskKey, string taskSuffix, string command, int autoBackupPeriod, ProcessPriorityClass priority)
{
var taskName = GetScheduledTaskName(TaskType.AutoBackup, taskKey, taskSuffix);
var taskFolder = TaskService.Instance.RootFolder.SubFolders.Exists(TaskFolder) ? TaskService.Instance.RootFolder.SubFolders[TaskFolder] : null;
@ -212,7 +212,7 @@ namespace ServerManagerTool.Common.Utils
taskDefinition.RegistrationInfo.Version = appVersion;
taskDefinition.Settings.ExecutionTimeLimit = TimeSpan.FromHours(EXECUTION_TIME_LIMIT);
taskDefinition.Settings.Priority = ProcessPriorityClass.Normal;
taskDefinition.Settings.Priority = priority;
// Add/Edit the trigger that will fire every x minutes
var triggers = taskDefinition.Triggers.OfType<TimeTrigger>();
@ -278,12 +278,12 @@ namespace ServerManagerTool.Common.Utils
return false;
}
public static bool ScheduleAutoShutdown(string taskKey, string taskSuffix, string command, TimeSpan? restartTime, string profileName, ShutdownType type)
public static bool ScheduleAutoShutdown(string taskKey, string taskSuffix, string command, TimeSpan? restartTime, string profileName, ShutdownType type, ProcessPriorityClass priority)
{
return ScheduleAutoShutdown(taskKey, taskSuffix, command, restartTime, DaysOfTheWeek.AllDays, profileName, type);
return ScheduleAutoShutdown(taskKey, taskSuffix, command, restartTime, DaysOfTheWeek.AllDays, profileName, type, priority);
}
public static bool ScheduleAutoShutdown(string taskKey, string taskSuffix, string command, TimeSpan? restartTime, DaysOfTheWeek daysOfTheWeek, string profileName, ShutdownType type)
public static bool ScheduleAutoShutdown(string taskKey, string taskSuffix, string command, TimeSpan? restartTime, DaysOfTheWeek daysOfTheWeek, string profileName, ShutdownType type, ProcessPriorityClass priority)
{
var taskName = GetScheduledTaskName(TaskType.AutoShutdown, taskKey, taskSuffix);
var taskFolder = TaskService.Instance.RootFolder.SubFolders.Exists(TaskFolder) ? TaskService.Instance.RootFolder.SubFolders[TaskFolder] : null;
@ -336,7 +336,7 @@ namespace ServerManagerTool.Common.Utils
taskDefinition.RegistrationInfo.Version = appVersion;
taskDefinition.Settings.ExecutionTimeLimit = TimeSpan.FromHours(EXECUTION_TIME_LIMIT);
taskDefinition.Settings.Priority = ProcessPriorityClass.Normal;
taskDefinition.Settings.Priority = priority;
// Add/Edit the trigger that will fire every day at the specified restart time
var triggers = taskDefinition.Triggers.OfType<WeeklyTrigger>().ToList();
@ -426,7 +426,7 @@ namespace ServerManagerTool.Common.Utils
return false;
}
public static bool ScheduleAutoStart(string taskKey, string taskSuffix, bool enableAutoStart, string command, string profileName, bool onBoot)
public static bool ScheduleAutoStart(string taskKey, string taskSuffix, bool enableAutoStart, string command, string profileName, bool onBoot, ProcessPriorityClass priority)
{
var taskName = GetScheduledTaskName(TaskType.AutoStart, taskKey, taskSuffix);
var taskFolder = TaskService.Instance.RootFolder.SubFolders.Exists(TaskFolder) ? TaskService.Instance.RootFolder.SubFolders[TaskFolder] : null;
@ -479,7 +479,7 @@ namespace ServerManagerTool.Common.Utils
taskDefinition.RegistrationInfo.Version = appVersion;
taskDefinition.Settings.ExecutionTimeLimit = TimeSpan.FromHours(EXECUTION_TIME_LIMIT);
taskDefinition.Settings.Priority = ProcessPriorityClass.Normal;
taskDefinition.Settings.Priority = priority;
// Add a trigger that will fire after the machine has started
if (onBoot)
@ -567,7 +567,7 @@ namespace ServerManagerTool.Common.Utils
return false;
}
public static bool ScheduleAutoUpdate(string taskKey, string taskSuffix, string command, int autoUpdatePeriod)
public static bool ScheduleAutoUpdate(string taskKey, string taskSuffix, string command, int autoUpdatePeriod, ProcessPriorityClass priority)
{
var taskName = GetScheduledTaskName(TaskType.AutoUpdate, taskKey, taskSuffix);
var taskFolder = TaskService.Instance.RootFolder.SubFolders.Exists(TaskFolder) ? TaskService.Instance.RootFolder.SubFolders[TaskFolder] : null;
@ -621,7 +621,7 @@ namespace ServerManagerTool.Common.Utils
taskDefinition.RegistrationInfo.Version = appVersion;
taskDefinition.Settings.ExecutionTimeLimit = TimeSpan.FromHours(EXECUTION_TIME_LIMIT);
taskDefinition.Settings.Priority = ProcessPriorityClass.Normal;
taskDefinition.Settings.Priority = priority;
// Add/Edit the trigger that will fire every x minutes
var triggers = taskDefinition.Triggers.OfType<TimeTrigger>();