Add ResourceHub for real-time updates and implement web dashboard with REST API
- Created ResourceHub.cs for SignalR group management. - Developed a modern web dashboard using Tailwind CSS for responsive design. - Implemented real-time updates with SignalR for CPU, Memory, GPU, and Network usage. - Added REST API endpoints for resource information and process management. - Integrated process management features to view and terminate high-usage processes. - Enhanced UI with loading spinners, notifications, and responsive tables. - Included performance charts for historical CPU and Memory usage. - Configured Swagger UI for API documentation. - Established security features including process kill restrictions and API key authentication.
This commit is contained in:
@@ -249,22 +249,39 @@ namespace ResourceMonitorService.Services
|
||||
"setup", "installer", "update", "vshost", "devenv"
|
||||
};
|
||||
|
||||
// Skip if it's a known system process
|
||||
if (systemExclusions.Any(exclusion => fileName.Contains(exclusion)))
|
||||
// Exclude gaming platform clients (they are not games themselves)
|
||||
var platformClientExclusions = new[]
|
||||
{
|
||||
"steam", "steamwebhelper", "steamservice", "steamerrorreporter",
|
||||
"epicgameslauncher", "epic games launcher", "epiconlineservices",
|
||||
"origin", "originwebhelperservice", "originweb", "originthinsetup",
|
||||
"uplay", "upc", "ubisoftgamelauncher", "ubisoftconnect",
|
||||
"battle.net", "battlenet", "blizzardlauncher", "blizzard update agent",
|
||||
"gog galaxy", "goggalaxy", "gogcom",
|
||||
"rockstar games launcher", "rockstargameslauncher",
|
||||
"riotclientservices", "riot client", "valorant-win64-shipping",
|
||||
"ea app", "ea desktop", "eadesktop", "eabackground",
|
||||
"xbox", "xboxapp", "xboxgamebar", "microsoftstore"
|
||||
};
|
||||
|
||||
// Skip if it's a known system process or platform client
|
||||
if (systemExclusions.Any(exclusion => fileName.Contains(exclusion)) ||
|
||||
platformClientExclusions.Any(exclusion => fileName.Contains(exclusion)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var knownGameExecutables = new[]
|
||||
{
|
||||
"game", "launcher", "client"
|
||||
// Removed generic terms like "main", "start", "run" that match too many system processes
|
||||
"game"
|
||||
// Removed "launcher" and "client" as they often refer to platform clients, not games
|
||||
};
|
||||
|
||||
var gameIndicators = new[]
|
||||
{
|
||||
"unreal", "unity", "godot", "gamemaker", "rpgmaker",
|
||||
"steam", "epic", "origin", "uplay", "battle.net"
|
||||
"\\steamapps\\common\\", "\\epic games\\", "\\gog galaxy\\games\\",
|
||||
"\\origin games\\", "\\ubisoft game launcher\\games\\"
|
||||
};
|
||||
|
||||
// Check if it's likely a game based on executable name or path
|
||||
@@ -398,6 +415,20 @@ namespace ResourceMonitorService.Services
|
||||
if (!string.IsNullOrEmpty(versionInfo.ProductName) &&
|
||||
!versionInfo.ProductName.Equals(versionInfo.FileName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Check if this is a platform client by product name
|
||||
var platformClientNames = new[]
|
||||
{
|
||||
"steam", "epic games launcher", "origin", "uplay", "ubisoft connect",
|
||||
"battle.net", "blizzard launcher", "gog galaxy", "riot client",
|
||||
"ea app", "ea desktop", "xbox", "microsoft store", "rockstar games launcher"
|
||||
};
|
||||
|
||||
if (platformClientNames.Any(client =>
|
||||
versionInfo.ProductName.Contains(client, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return string.Empty; // Return empty to indicate this should not be treated as a game
|
||||
}
|
||||
|
||||
return versionInfo.ProductName;
|
||||
}
|
||||
|
||||
|
||||
@@ -770,7 +770,7 @@ namespace ResourceMonitorService.Services
|
||||
|
||||
var processInfo = new ProcessInfo
|
||||
{
|
||||
Id = p.Id,
|
||||
ProcessId = p.Id,
|
||||
Name = p.ProcessName,
|
||||
MemoryUsage = memoryUsage,
|
||||
MemoryUsagePercentage = totalSystemMemory > 0 ? (float)(memoryUsage * 100.0 / totalSystemMemory) : 0f,
|
||||
@@ -818,7 +818,7 @@ namespace ResourceMonitorService.Services
|
||||
_logger.LogDebug("Processed {ValidCount} valid processes, skipped {SkippedCount}", validProcesses.Count, skippedCount);
|
||||
|
||||
// Clean up old process entries to prevent memory leaks
|
||||
CleanupOldProcessEntries(validProcesses.Select(p => p.Id).ToHashSet());
|
||||
CleanupOldProcessEntries(validProcesses.Select(p => p.ProcessId).ToHashSet());
|
||||
|
||||
var topProcesses = validProcesses
|
||||
.OrderByDescending(p => p.CpuUsage)
|
||||
|
||||
Reference in New Issue
Block a user