using System.Collections.Concurrent; using System.Diagnostics; namespace MaksIT.UScheduler.Services; /// /// Interface for managing and executing external processes. /// public interface IProcessService { /// /// Starts and monitors an external process asynchronously. /// /// The path to the executable to run. /// Optional command-line arguments to pass to the process. /// Cancellation token to signal when the process should stop. /// A task representing the asynchronous operation. Task RunProcessAsync(string processPath, string[]? args, CancellationToken stoppingToken); /// /// Gets the dictionary of currently running processes. /// /// A concurrent dictionary mapping process IDs to their Process objects. ConcurrentDictionary GetRunningProcesses(); /// /// Terminates a running process by its ID. /// /// The ID of the process to terminate. void TerminateProcessById(int processId); /// /// Terminates all currently running processes managed by this service. /// void TerminateAllProcesses(); }