Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e19e1e0137 |
@@ -5,3 +5,8 @@ git add .
|
|||||||
git commit -m "Add steam running games"
|
git commit -m "Add steam running games"
|
||||||
git push origin master
|
git push origin master
|
||||||
dotnet publish -c Release -o ./publish
|
dotnet publish -c Release -o ./publish
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
curl -X POST "http://<your-service-hostname-or-IP>:<port>/api/kill-process?id=<PID>"
|
||||||
@@ -50,11 +50,56 @@ namespace ResourceMonitorService
|
|||||||
await context.Response.WriteAsync(json);
|
await context.Response.WriteAsync(json);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.MapPost("/api/kill-process", async context =>
|
||||||
|
{
|
||||||
|
await Results.Ok($"Macam celaka Process ni. ").ExecuteAsync(context);
|
||||||
|
/* try
|
||||||
|
{
|
||||||
|
int pid;
|
||||||
|
if (!int.TryParse(context.Request.Query["id"], out pid))
|
||||||
|
{
|
||||||
|
await Results.BadRequest("Invalid process ID.").ExecuteAsync(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await KillProcessByIdAsync(pid); // Ensure KillProcessByIdAsync returns a Task<bool>
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
await Results.Ok($"Process with PID {pid} has been terminated successfully.").ExecuteAsync(context);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await Results.NotFound($"No process found with PID {pid}.").ExecuteAsync(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Log the exception or handle it as needed
|
||||||
|
await Results.Problem(ex.Message).ExecuteAsync(context);
|
||||||
|
} */
|
||||||
|
});
|
||||||
|
|
||||||
app.RunAsync(stoppingToken);
|
app.RunAsync(stoppingToken);
|
||||||
|
|
||||||
await Task.Delay(Timeout.Infinite, stoppingToken);
|
await Task.Delay(Timeout.Infinite, stoppingToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<bool> KillProcessByIdAsync(int pid)
|
||||||
|
{
|
||||||
|
using (Process process = Process.GetProcessById(pid))
|
||||||
|
{
|
||||||
|
if (process != null)
|
||||||
|
{
|
||||||
|
await Task.Run(() => process.Kill());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private object GetComputerInfo()
|
private object GetComputerInfo()
|
||||||
{
|
{
|
||||||
return new
|
return new
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,7 +9,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://localhost:5000"
|
"Url": "http://*:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://localhost:5000"
|
"Url": "http://*:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://localhost:5000"
|
"Url": "http://*:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://*:5000"
|
"Url": "http://localhost:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://*:5000"
|
"Url": "http://localhost:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://*:5000"
|
"Url": "http://localhost:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ build_property.PlatformNeutralAssembly =
|
|||||||
build_property.EnforceExtendedAnalyzerRules =
|
build_property.EnforceExtendedAnalyzerRules =
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
build_property.RootNamespace = ResourceMonitorService
|
build_property.RootNamespace = ResourceMonitorService
|
||||||
build_property.ProjectDir = C:\din\dev\ResourceUsageAPI\
|
build_property.ProjectDir = D:\din\dev\vmsvc\ResourceMonitorService\
|
||||||
build_property.EnableComHosting =
|
build_property.EnableComHosting =
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||||
|
|||||||
Binary file not shown.
@@ -62,3 +62,15 @@ D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish
|
|||||||
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.json
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.json
|
||||||
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.deps.json
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.deps.json
|
||||||
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.runtimeconfig.json
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.runtimeconfig.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.Development.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.Development.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.Development.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\appsettings.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.deps.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.runtimeconfig.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.deps.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.runtimeconfig.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.deps.json
|
||||||
|
D:\din\dev\vmsvc\ResourceMonitorService\bin\Debug\net9.0\publish\publish\publish\publish\publish\publish\publish\publish\publish\ResourceMonitorService.runtimeconfig.json
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
c65d161a800b1338fd7f033a5bc5016a31718066a3178665c8d03d56bd044a0a
|
3c41a5e0f936ad1402ac65b413d5b378ce34a9573acfd72fc7ebde791d66f502
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"format": 1,
|
"format": 1,
|
||||||
"restore": {
|
"restore": {
|
||||||
"C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj": {}
|
"D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj": {}
|
||||||
},
|
},
|
||||||
"projects": {
|
"projects": {
|
||||||
"C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj": {
|
"D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj",
|
"projectUniqueName": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj",
|
||||||
"projectName": "ResourceMonitorService",
|
"projectName": "ResourceMonitorService",
|
||||||
"projectPath": "C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj",
|
"projectPath": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj",
|
||||||
"packagesPath": "C:\\Users\\dinxs\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\dinxs\\.nuget\\packages\\",
|
||||||
"outputPath": "C:\\din\\dev\\ResourceUsageAPI\\obj\\",
|
"outputPath": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"configFilePaths": [
|
"configFilePaths": [
|
||||||
"C:\\Users\\dinxs\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
"C:\\Users\\dinxs\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"restoreAuditProperties": {
|
"restoreAuditProperties": {
|
||||||
"enableAudit": "true",
|
"enableAudit": "true",
|
||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "all"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.100"
|
"SdkAnalysisLevel": "9.0.100"
|
||||||
},
|
},
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.101/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dinxs\.nuget\packages\</NuGetPackageFolders>
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dinxs\.nuget\packages\</NuGetPackageFolders>
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
<SourceRoot Include="C:\Users\dinxs\.nuget\packages\" />
|
<SourceRoot Include="C:\Users\dinxs\.nuget\packages\" />
|
||||||
|
|||||||
@@ -2087,11 +2087,11 @@
|
|||||||
"project": {
|
"project": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj",
|
"projectUniqueName": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj",
|
||||||
"projectName": "ResourceMonitorService",
|
"projectName": "ResourceMonitorService",
|
||||||
"projectPath": "C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj",
|
"projectPath": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj",
|
||||||
"packagesPath": "C:\\Users\\dinxs\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\dinxs\\.nuget\\packages\\",
|
||||||
"outputPath": "C:\\din\\dev\\ResourceUsageAPI\\obj\\",
|
"outputPath": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"configFilePaths": [
|
"configFilePaths": [
|
||||||
"C:\\Users\\dinxs\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
"C:\\Users\\dinxs\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
||||||
@@ -2116,7 +2116,7 @@
|
|||||||
"restoreAuditProperties": {
|
"restoreAuditProperties": {
|
||||||
"enableAudit": "true",
|
"enableAudit": "true",
|
||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "all"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.100"
|
"SdkAnalysisLevel": "9.0.100"
|
||||||
},
|
},
|
||||||
@@ -2161,7 +2161,7 @@
|
|||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.101/PortableRuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100/PortableRuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "c9QUeYvHFTQ=",
|
"dgSpecHash": "pmjCqcyUh78=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "C:\\din\\dev\\ResourceUsageAPI\\ResourceMonitorService.csproj",
|
"projectFilePath": "D:\\din\\dev\\vmsvc\\ResourceMonitorService\\ResourceMonitorService.csproj",
|
||||||
"expectedPackageFiles": [
|
"expectedPackageFiles": [
|
||||||
"C:\\Users\\dinxs\\.nuget\\packages\\microsoft.aspnetcore.jsonpatch\\9.0.0\\microsoft.aspnetcore.jsonpatch.9.0.0.nupkg.sha512",
|
"C:\\Users\\dinxs\\.nuget\\packages\\microsoft.aspnetcore.jsonpatch\\9.0.0\\microsoft.aspnetcore.jsonpatch.9.0.0.nupkg.sha512",
|
||||||
"C:\\Users\\dinxs\\.nuget\\packages\\microsoft.aspnetcore.mvc.newtonsoftjson\\9.0.0\\microsoft.aspnetcore.mvc.newtonsoftjson.9.0.0.nupkg.sha512",
|
"C:\\Users\\dinxs\\.nuget\\packages\\microsoft.aspnetcore.mvc.newtonsoftjson\\9.0.0\\microsoft.aspnetcore.mvc.newtonsoftjson.9.0.0.nupkg.sha512",
|
||||||
|
|||||||
Reference in New Issue
Block a user