增加附加命令

This commit is contained in:
cglcv
2022-06-12 20:54:10 +08:00
parent 4793279e4a
commit 97a84f8428
2 changed files with 36 additions and 7 deletions

View File

@@ -35,6 +35,10 @@
<Button Command="{s:Action SelectEmulatorExec}" Content="选择" Margin="10" />
</StackPanel>
<TextBox Text="{Binding EmulatorPath}" Margin="10" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Margin="10" Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center" Text="附加命令" />
</StackPanel>
<TextBox Text="{Binding EmulatorAddCommand}" Margin="10" />
<TextBlock Margin="10" Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center" Text="客户端版本" />
<ComboBox IsHitTestVisible ="{Binding Idle}" Margin="10"
ItemsSource="{Binding ClientTypeList}"

View File

@@ -203,6 +203,19 @@ namespace MeoAsstGui
}
}
private string _emulatorAddCommand = ViewStatusStorage.Get("Start.EmulatorAddCommand", string.Empty);
public string EmulatorAddCommand
{
get { return _emulatorAddCommand; }
set
{
SetAndNotify(ref _emulatorAddCommand, value);
ViewStatusStorage.Set("Start.EmulatorAddCommand", value);
}
}
private string _emulatorWaitSeconds = ViewStatusStorage.Get("Start.EmulatorWaitSeconds", "60");
public string EmulatorWaitSeconds
@@ -222,13 +235,25 @@ namespace MeoAsstGui
{
return;
}
Process emuProcess = new Process();
emuProcess.StartInfo.FileName = "cmd.exe";
emuProcess.StartInfo.RedirectStandardInput = true;
emuProcess.StartInfo.UseShellExecute = false;
emuProcess.Start();
emuProcess.StandardInput.WriteLine(EmulatorPath);
emuProcess.StandardInput.WriteLine("exit");
if (EmulatorAddCommand.Length != 0)
{
string StartCommand = "";
if (EmulatorPath.StartsWith("\""))
{
StartCommand += EmulatorPath.ToString();
}
else StartCommand = "\"" + EmulatorPath.ToString() + "\"";
StartCommand += " ";
StartCommand += EmulatorAddCommand.ToString();
Process emuProcess = new Process();
emuProcess.StartInfo.FileName = "cmd.exe";
emuProcess.StartInfo.RedirectStandardInput = true;
emuProcess.StartInfo.UseShellExecute = false;
emuProcess.Start();
emuProcess.StandardInput.WriteLine(StartCommand);
emuProcess.StandardInput.WriteLine("exit");
}
else Process.Start(EmulatorPath);
int delay = 0;
if (!int.TryParse(EmulatorWaitSeconds, out delay))
{