Added prefix launcher option to launcher arguments.

This commit is contained in:
Brett Hewitson 2022-01-25 12:26:03 +10:00
parent dd69808b24
commit 09938ce932
11 changed files with 122 additions and 228 deletions

View file

@ -436,6 +436,14 @@ namespace ServerManagerTool.Lib
set { SetValue(AdditionalArgsProperty, value); }
}
public static readonly DependencyProperty LauncherArgsProperty = DependencyProperty.Register(nameof(LauncherArgs), typeof(string), typeof(ServerProfile), new PropertyMetadata(String.Empty));
[DataMember]
public string LauncherArgs
{
get { return (string)GetValue(LauncherArgsProperty); }
set { SetValue(LauncherArgsProperty, value); }
}
public static readonly DependencyProperty LauncherArgsOverrideProperty = DependencyProperty.Register(nameof(LauncherArgsOverride), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[DataMember]
public bool LauncherArgsOverride
@ -444,12 +452,12 @@ namespace ServerManagerTool.Lib
set { SetValue(LauncherArgsOverrideProperty, value); }
}
public static readonly DependencyProperty LauncherArgsProperty = DependencyProperty.Register(nameof(LauncherArgs), typeof(string), typeof(ServerProfile), new PropertyMetadata(String.Empty));
public static readonly DependencyProperty LauncherArgsPrefixProperty = DependencyProperty.Register(nameof(LauncherArgsPrefix), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[DataMember]
public string LauncherArgs
public bool LauncherArgsPrefix
{
get { return (string)GetValue(LauncherArgsProperty); }
set { SetValue(LauncherArgsProperty, value); }
get { return (bool)GetValue(LauncherArgsPrefixProperty); }
set { SetValue(LauncherArgsPrefixProperty, value); }
}
#endregion
@ -703,7 +711,7 @@ namespace ServerManagerTool.Lib
private void CheckLauncherArgs()
{
// do not process if overriding the launcher args
if (this.LauncherArgsOverride)
if (this.LauncherArgsOverride || this.LauncherArgsPrefix)
return;
var launcherArgs = LauncherArgs?.ToLower() ?? string.Empty;
@ -1078,9 +1086,10 @@ namespace ServerManagerTool.Lib
}
else
{
var drive = Path.GetPathRoot(this.InstallDirectory);
drive = drive.Replace(Path.DirectorySeparatorChar.ToString(), string.Empty);
drive = drive.Replace(Path.AltDirectorySeparatorChar.ToString(), string.Empty);
if (this.LauncherArgsPrefix && !string.IsNullOrWhiteSpace(this.LauncherArgs))
{
commandArgs.AppendLine(this.LauncherArgs);
}
commandArgs.Append("start");
commandArgs.Append($" \"{this.ProfileName}\"");
@ -1093,7 +1102,7 @@ namespace ServerManagerTool.Lib
commandArgs.Append($" /{ProcessPriority}");
if (ProcessAffinity > 0 && ProcessUtils.IsProcessorAffinityValid(ProcessAffinity))
{
commandArgs.Append($" /affinity {ProcessAffinity.ToString("X")}");
commandArgs.Append($" /affinity {ProcessAffinity:X}");
}
if (!string.IsNullOrWhiteSpace(this.LauncherArgs))