mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Expose CanUpdate property in ASF API
This commit is contained in:
@@ -66,7 +66,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
||||
|
||||
uint memoryUsage = (uint) GC.GetTotalMemory(false) / 1024;
|
||||
|
||||
ASFResponse result = new ASFResponse(SharedInfo.BuildInfo.Variant, ASF.GlobalConfig, memoryUsage, RuntimeCompatibility.ProcessStartTime, SharedInfo.Version);
|
||||
ASFResponse result = new ASFResponse(SharedInfo.BuildInfo.Variant, SharedInfo.BuildInfo.CanUpdate, ASF.GlobalConfig, memoryUsage, RuntimeCompatibility.ProcessStartTime, SharedInfo.Version);
|
||||
|
||||
return Ok(new GenericResponse<ASFResponse>(result));
|
||||
}
|
||||
|
||||
@@ -32,6 +32,13 @@ namespace ArchiSteamFarm.IPC.Responses {
|
||||
[Required]
|
||||
public readonly string BuildVariant;
|
||||
|
||||
/// <summary>
|
||||
/// A value specifying whether this variant of ASF is capable of auto-update.
|
||||
/// </summary>
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
[Required]
|
||||
public readonly bool CanUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Currently loaded ASF's global config.
|
||||
/// </summary>
|
||||
@@ -60,12 +67,13 @@ namespace ArchiSteamFarm.IPC.Responses {
|
||||
[Required]
|
||||
public readonly Version Version;
|
||||
|
||||
internal ASFResponse(string buildVariant, GlobalConfig globalConfig, uint memoryUsage, DateTime processStartTime, Version version) {
|
||||
internal ASFResponse(string buildVariant, bool canUpdate, GlobalConfig globalConfig, uint memoryUsage, DateTime processStartTime, Version version) {
|
||||
if (string.IsNullOrEmpty(buildVariant) || (globalConfig == null) || (memoryUsage == 0) || (processStartTime == DateTime.MinValue) || (version == null)) {
|
||||
throw new ArgumentNullException(nameof(buildVariant) + " || " + nameof(globalConfig) + " || " + nameof(memoryUsage) + " || " + nameof(processStartTime) + " || " + nameof(version));
|
||||
}
|
||||
|
||||
BuildVariant = buildVariant;
|
||||
CanUpdate = canUpdate;
|
||||
GlobalConfig = globalConfig;
|
||||
MemoryUsage = memoryUsage;
|
||||
ProcessStartTime = processStartTime;
|
||||
|
||||
Reference in New Issue
Block a user