/* * ThreadPilot - Advanced Windows Process and Power Plan Manager * Copyright (C) 2025 Prime Build * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, version 3 only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace ThreadPilot.Services.ProcessManagement { using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tasks; using ThreadPilot.Models; /// /// Unified interface for process management operations. /// public interface IProcessManagementService { /// /// Event fired when a process starts /// event EventHandler? ProcessStarted; /// /// Event fired when a process stops /// event EventHandler? ProcessStopped; /// /// Event fired when process monitoring status changes /// event EventHandler? MonitoringStatusChanged; /// /// Gets a value indicating whether gets whether process monitoring is currently active. /// bool IsMonitoringActive { get; } /// /// Gets all currently running processes. /// Task> GetRunningProcessesAsync(); /// /// Gets a specific process by ID. /// Task GetProcessByIdAsync(int processId); /// /// Gets processes by executable name. /// Task> GetProcessesByNameAsync(string executableName); /// /// Start monitoring for process events. /// Task StartMonitoringAsync(); /// /// Stop monitoring for process events. /// Task StopMonitoringAsync(); /// /// Set processor affinity for a process. /// Task SetProcessorAffinityAsync(ProcessModel process, long affinityMask); /// /// Set priority for a process. /// Task SetProcessPriorityAsync(ProcessModel process, ProcessPriorityClass priority); /// /// Refresh process information. /// Task RefreshProcessInfoAsync(ProcessModel process); } /// /// Event args for process events. /// public class ProcessEventArgs : EventArgs { public ProcessModel Process { get; } public DateTime Timestamp { get; } public ProcessEventArgs(ProcessModel process) { this.Process = process ?? throw new ArgumentNullException(nameof(process)); this.Timestamp = DateTime.Now; } } /// /// Event args for monitoring status changes. /// public class MonitoringStatusChangedEventArgs : EventArgs { public bool IsActive { get; } public string? Reason { get; } public MonitoringStatusChangedEventArgs(bool isActive, string? reason = null) { this.IsActive = isActive; this.Reason = reason; } } }