mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 09:06:23 +02:00
Add CLI process and GUI start/stop commands with process management
This commit is contained in:
@@ -11,6 +11,18 @@ public class StartGuiCommand : ICommand
|
||||
public void Execute(string? arguments, Action<string> printLine)
|
||||
{
|
||||
printLine("Starting Desktop Process...");
|
||||
|
||||
if (ProcessManager.IsProcessRunning<DesktopProcess>())
|
||||
{
|
||||
printLine("Desktop Process is already running.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Process process in ProcessManager.GetProcessesOfType<CliProcess>())
|
||||
{
|
||||
ProcessManager.StopProcess(process.Id);
|
||||
}
|
||||
|
||||
_ = ProcessManager.SpawnProcess<DesktopProcess>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using Cosmos.Kernel.System.Graphics;
|
||||
using Org.BouncyCastle.Bcpg;
|
||||
using RemSox.Processes;
|
||||
using RemSox.Processing;
|
||||
using RemSox.UI.GUI.Windows;
|
||||
|
||||
namespace RemSox.UI.CLI.Commands;
|
||||
|
||||
public class StopGuiCommand : ICommand
|
||||
{
|
||||
public string Name => "stop-gui";
|
||||
public string Description => "Stops the Graphical User Interface (Desktop Process)";
|
||||
|
||||
public async void Execute(string? arguments, Action<string> printLine)
|
||||
{
|
||||
printLine("Stopping Desktop Process...");
|
||||
|
||||
if (!ProcessManager.IsProcessRunning<DesktopProcess>())
|
||||
{
|
||||
printLine("Desktop Process is not running.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Process process in ProcessManager.GetProcessesOfType<DesktopProcess>())
|
||||
{
|
||||
await ProcessManager.StopProcessAndWaitAsync(process.Id);
|
||||
}
|
||||
|
||||
_ = ProcessManager.SpawnProcess<CliProcess>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user