From 6e41996fb907253b96b1a269cb4c8e5b134b609d Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Wed, 28 Apr 2021 19:06:10 -0600 Subject: [PATCH] Fix type import issues --- Wabbajack.Lib/ClientAPI.cs | 43 -------------- .../ModListValidationTests.cs | 1 - Wabbajack.Server/Controllers/ListsStatus.cs | 1 - Wabbajack.Server/Services/ListValidator.cs | 2 - Wabbajack/ClientAPIAdditions/ClientAPIEx.cs | 57 +++++++++++++++++++ .../View Models/Gallery/ModListMetadataVM.cs | 2 +- Wabbajack/View Models/ModListContentsVM.cs | 5 -- 7 files changed, 58 insertions(+), 53 deletions(-) create mode 100644 Wabbajack/ClientAPIAdditions/ClientAPIEx.cs diff --git a/Wabbajack.Lib/ClientAPI.cs b/Wabbajack.Lib/ClientAPI.cs index d0ef687a..b6af1b63 100644 --- a/Wabbajack.Lib/ClientAPI.cs +++ b/Wabbajack.Lib/ClientAPI.cs @@ -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 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 GetClient() @@ -334,14 +300,5 @@ using Wabbajack.Lib.Downloaders; $"{Consts.WabbajackBuildServerUri}game_files"); return results; } - - public static async Task GetDetailedStatus(string machineURL) - { - var client = await GetClient(); - var results = - await client.GetJsonAsync( - $"{Consts.WabbajackBuildServerUri}lists/status/{machineURL}.json"); - return results; - } } } diff --git a/Wabbajack.Server.Test/ModListValidationTests.cs b/Wabbajack.Server.Test/ModListValidationTests.cs index ddfd61e0..36ee449b 100644 --- a/Wabbajack.Server.Test/ModListValidationTests.cs +++ b/Wabbajack.Server.Test/ModListValidationTests.cs @@ -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 { diff --git a/Wabbajack.Server/Controllers/ListsStatus.cs b/Wabbajack.Server/Controllers/ListsStatus.cs index c3ca850c..cae82536 100644 --- a/Wabbajack.Server/Controllers/ListsStatus.cs +++ b/Wabbajack.Server/Controllers/ListsStatus.cs @@ -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 { diff --git a/Wabbajack.Server/Services/ListValidator.cs b/Wabbajack.Server/Services/ListValidator.cs index 450830ab..42d5623c 100644 --- a/Wabbajack.Server/Services/ListValidator.cs +++ b/Wabbajack.Server/Services/ListValidator.cs @@ -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 { diff --git a/Wabbajack/ClientAPIAdditions/ClientAPIEx.cs b/Wabbajack/ClientAPIAdditions/ClientAPIEx.cs new file mode 100644 index 00000000..cafef8f8 --- /dev/null +++ b/Wabbajack/ClientAPIAdditions/ClientAPIEx.cs @@ -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 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 GetDetailedStatus(string machineURL) + { + var client = await ClientAPI.GetClient(); + var results = + await client.GetJsonAsync( + $"{Consts.WabbajackBuildServerUri}lists/status/{machineURL}.json"); + return results; + } + } +} diff --git a/Wabbajack/View Models/Gallery/ModListMetadataVM.cs b/Wabbajack/View Models/Gallery/ModListMetadataVM.cs index 221a1056..a50a0e16 100644 --- a/Wabbajack/View Models/Gallery/ModListMetadataVM.cs +++ b/Wabbajack/View Models/Gallery/ModListMetadataVM.cs @@ -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); diff --git a/Wabbajack/View Models/ModListContentsVM.cs b/Wabbajack/View Models/ModListContentsVM.cs index cf22e431..7a4a5684 100644 --- a/Wabbajack/View Models/ModListContentsVM.cs +++ b/Wabbajack/View Models/ModListContentsVM.cs @@ -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 {