/* * 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 { using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Threading.Tasks; using ThreadPilot.Models; public interface IProcessService { Task> GetProcessesAsync(); Task SetProcessorAffinity(ProcessModel process, long affinityMask); Task SetProcessPriority(ProcessModel process, ProcessPriorityClass priority); Task SaveProcessProfile(string profileName, ProcessModel process); Task LoadProcessProfile(string profileName, ProcessModel process); Task RefreshProcessInfo(ProcessModel process); /// /// Gets a process by its ID. /// Task GetProcessByIdAsync(int processId); /// /// Gets processes by executable name. /// Task> GetProcessesByNameAsync(string executableName); /// /// Checks if a process with the given name is currently running. /// Task IsProcessRunningAsync(string executableName); /// /// Gets all running processes with their executable paths. /// Task> GetProcessesWithPathsAsync(); /// /// Gets only active applications with visible windows (user-facing applications). /// Task> GetActiveApplicationsAsync(); /// /// Creates a ProcessModel from a System.Diagnostics.Process. /// ProcessModel CreateProcessModel(Process process); /// /// Checks if a specific process is still running. /// Task IsProcessStillRunning(ProcessModel process); /// /// Sets the idle server state for a process (disables/enables idle functionality). /// Task SetIdleServerStateAsync(ProcessModel process, bool enableIdleServer); /// /// Sets registry-based priority enforcement for a process. /// Task SetRegistryPriorityAsync(ProcessModel process, bool enable, ProcessPriorityClass priority); /// /// Enables or disables the use of Windows CPU Sets for affinity management. /// void SetUseCpuSets(bool useCpuSets); /// /// Gets whether CPU Sets are currently enabled for affinity management. /// bool GetUseCpuSets(); /// /// Clears the CPU Set for a process (allows it to run on all cores). /// Task ClearProcessCpuSetAsync(ProcessModel process); /// /// Clears all applied CPU masks/affinities from all tracked processes /// Processes return to using all cores (used on application exit). /// Task ClearAllAppliedMasksAsync(); /// /// Resets all modified process priorities to Normal /// (used on application exit). /// Task ResetAllProcessPrioritiesAsync(); /// /// Registers that a mask has been applied to a process (for tracking). /// void TrackAppliedMask(int processId, string maskId); /// /// Registers that a priority has been changed for a process (for tracking). /// void TrackPriorityChange(int processId, ProcessPriorityClass originalPriority); /// /// Unregisters tracking when a process exits. /// void UntrackProcess(int processId); } }