Fix type import issues

This commit is contained in:
Timothy Baldridge 2021-04-28 19:06:10 -06:00
parent 94113158ee
commit 6e41996fb9
7 changed files with 58 additions and 53 deletions

View File

@ -81,41 +81,7 @@ using Wabbajack.Lib.Downloaders;
return false;
}
}
[JsonName("DetailedStatus")]
public class DetailedStatus
{
public string Name { get; set; } = "";
public DateTime Checked { get; set; } = DateTime.UtcNow;
public List<DetailedStatusItem> Archives { get; set; } = new();
public DownloadMetadata DownloadMetaData { get; set; } = new();
public bool HasFailures { get; set; }
public string MachineName { get; set; } = "";
}
[JsonName("DetailedStatusItem")]
public class DetailedStatusItem
{
public bool IsFailing { get; set; }
public Archive? Archive { get; set; }
public string Name => string.IsNullOrWhiteSpace(Archive!.Name) ? Archive.State.PrimaryKeyString : Archive.Name;
public string? Url => Archive?.State.GetManifestURL(Archive!);
[JsonIgnore]
public bool HasUrl => Url != null;
public ArchiveStatus ArchiveStatus { get; set; }
}
public enum ArchiveStatus
{
Valid,
InValid,
Updating,
Updated,
Mirrored
}
public class ClientAPI
{
public static async Task<Wabbajack.Lib.Http.Client> GetClient()
@ -334,14 +300,5 @@ using Wabbajack.Lib.Downloaders;
$"{Consts.WabbajackBuildServerUri}game_files");
return results;
}
public static async Task<DetailedStatus> GetDetailedStatus(string machineURL)
{
var client = await GetClient();
var results =
await client.GetJsonAsync<DetailedStatus>(
$"{Consts.WabbajackBuildServerUri}lists/status/{machineURL}.json");
return results;
}
}
}

View File

@ -14,7 +14,6 @@ using Wabbajack.Server.DTOs;
using Wabbajack.Server.Services;
using Xunit;
using Xunit.Abstractions;
using DetailedStatus = Wabbajack.Server.DTOs.DetailedStatus;
namespace Wabbajack.BuildServer.Test
{

View File

@ -15,7 +15,6 @@ using Wabbajack.Server.DataLayer;
using Wabbajack.Server.DTOs;
using Wabbajack.Server.Services;
using ArchiveStatus = Wabbajack.Server.DTOs.ArchiveStatus;
using DetailedStatus = Wabbajack.Server.DTOs.DetailedStatus;
namespace Wabbajack.BuildServer.Controllers
{

View File

@ -14,8 +14,6 @@ using Wabbajack.Lib.NexusApi;
using Wabbajack.Server.DataLayer;
using Wabbajack.Server.DTOs;
using ArchiveStatus = Wabbajack.Server.DTOs.ArchiveStatus;
using DetailedStatus = Wabbajack.Server.DTOs.DetailedStatus;
using DetailedStatusItem = Wabbajack.Server.DTOs.DetailedStatusItem;
namespace Wabbajack.Server.Services
{

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Wabbajack.Common;
using Wabbajack.Common.Serialization.Json;
using Wabbajack.Lib;
using Wabbajack.Lib.ModListRegistry;
namespace Wabbajack
{
[JsonName("DetailedStatus")]
public class DetailedStatus
{
public string Name { get; set; } = "";
public DateTime Checked { get; set; } = DateTime.UtcNow;
public List<DetailedStatusItem> Archives { get; set; } = new();
public DownloadMetadata DownloadMetaData { get; set; } = new();
public bool HasFailures { get; set; }
public string MachineName { get; set; } = "";
}
[JsonName("DetailedStatusItem")]
public class DetailedStatusItem
{
public bool IsFailing { get; set; }
public Archive Archive { get; set; }
public string Name => string.IsNullOrWhiteSpace(Archive!.Name) ? Archive.State.PrimaryKeyString : Archive.Name;
public string Url => Archive?.State.GetManifestURL(Archive!);
[JsonIgnore]
public bool HasUrl => Url != null;
public ArchiveStatus ArchiveStatus { get; set; }
}
public enum ArchiveStatus
{
Valid,
InValid,
Updating,
Updated,
Mirrored
}
public class ClientAPIEx
{
public static async Task<DetailedStatus> GetDetailedStatus(string machineURL)
{
var client = await ClientAPI.GetClient();
var results =
await client.GetJsonAsync<DetailedStatus>(
$"{Consts.WabbajackBuildServerUri}lists/status/{machineURL}.json");
return results;
}
}
}

View File

@ -104,7 +104,7 @@ namespace Wabbajack
IsLoadingIdle.OnNext(false);
try
{
var status = await ClientAPI.GetDetailedStatus(metadata.Links.MachineURL);
var status = await ClientAPIEx.GetDetailedStatus(metadata.Links.MachineURL);
var coll = _parent.MWVM.ModListContentsVM.Value.Status;
coll.Clear();
coll.AddRange(status.Archives);

View File

@ -1,17 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Text.RegularExpressions;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib;
using ReactiveUI;
using DynamicData;
using DynamicData.Binding;
using Wabbajack.Common;
namespace Wabbajack
{