mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Closes #736
Note to self: check if this works on Linux/OS X too before documenting it. I might need to change it if it doesn't.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
@@ -172,7 +173,14 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
uint memoryUsage = (uint) GC.GetTotalMemory(true) / 1024;
|
||||
ASFResponse asfResponse = new ASFResponse(memoryUsage, SharedInfo.Version);
|
||||
|
||||
DateTime processStartTime;
|
||||
|
||||
using (Process process = Process.GetCurrentProcess()) {
|
||||
processStartTime = process.StartTime;
|
||||
}
|
||||
|
||||
ASFResponse asfResponse = new ASFResponse(memoryUsage, processStartTime, SharedInfo.Version);
|
||||
|
||||
await ResponseJsonObject(request, response, new GenericResponse(true, "OK", asfResponse)).ConfigureAwait(false);
|
||||
return true;
|
||||
@@ -761,15 +769,19 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty]
|
||||
internal readonly uint MemoryUsage;
|
||||
|
||||
[JsonProperty]
|
||||
internal readonly DateTime ProcessStartTime;
|
||||
|
||||
[JsonProperty]
|
||||
internal readonly Version Version;
|
||||
|
||||
internal ASFResponse(uint memoryUsage, Version version) {
|
||||
if ((memoryUsage == 0) || (version == null)) {
|
||||
throw new ArgumentNullException(nameof(memoryUsage) + " || " + nameof(version));
|
||||
internal ASFResponse(uint memoryUsage, DateTime processStartTime, Version version) {
|
||||
if ((memoryUsage == 0) || (processStartTime == DateTime.MinValue) || (version == null)) {
|
||||
throw new ArgumentNullException(nameof(memoryUsage) + " || " + nameof(processStartTime) + " || " + nameof(version));
|
||||
}
|
||||
|
||||
MemoryUsage = memoryUsage;
|
||||
ProcessStartTime = processStartTime;
|
||||
Version = version;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user