diff --git a/Wabbajack.Common/Consts.cs b/Wabbajack.Common/Consts.cs index fdf6eac1..0ecf9975 100644 --- a/Wabbajack.Common/Consts.cs +++ b/Wabbajack.Common/Consts.cs @@ -50,6 +50,7 @@ namespace Wabbajack.Common public static string ModPermissionsURL = "https://raw.githubusercontent.com/wabbajack-tools/opt-out-lists/master/NexusModPermissions.yml"; public static string ServerWhitelistURL = "https://raw.githubusercontent.com/wabbajack-tools/opt-out-lists/master/ServerWhitelist.yml"; + public static string ModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/Modlists.yaml"; public static string UserAgent { diff --git a/Wabbajack.Common/ModListRegistry.cs b/Wabbajack.Common/ModListRegistry.cs new file mode 100644 index 00000000..bd7910a3 --- /dev/null +++ b/Wabbajack.Common/ModListRegistry.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Wabbajack.Common +{ + class ModListRegistry + { + } +} diff --git a/Wabbajack.Test/ModlistMetadataTests.cs b/Wabbajack.Test/ModlistMetadataTests.cs new file mode 100644 index 00000000..5d8ddb40 --- /dev/null +++ b/Wabbajack.Test/ModlistMetadataTests.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Wabbajack.ModListRegistry; + +namespace Wabbajack.Test +{ + [TestClass] + public class ModlistMetadataTests + { + [TestMethod] + public void TestLoadingModlists() + { + var modlists = ModlistMetadata.LoadFromGithub(); + Assert.IsTrue(modlists.Count > 0); + } + } +} diff --git a/Wabbajack.Test/Wabbajack.Test.csproj b/Wabbajack.Test/Wabbajack.Test.csproj index 49042276..2044ecb5 100644 --- a/Wabbajack.Test/Wabbajack.Test.csproj +++ b/Wabbajack.Test/Wabbajack.Test.csproj @@ -76,6 +76,7 @@ + diff --git a/Wabbajack/ModListRegistry/ModListMetadata.cs b/Wabbajack/ModListRegistry/ModListMetadata.cs new file mode 100644 index 00000000..a19cad0a --- /dev/null +++ b/Wabbajack/ModListRegistry/ModListMetadata.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Wabbajack.Common; +using Wabbajack.Validation; +using YamlDotNet.Serialization; +using YamlDotNet.Serialization.NamingConventions; +using Game = Wabbajack.Common.Game; + +namespace Wabbajack.ModListRegistry +{ + public class ModlistMetadata + { + /// + /// Name of the modlist + /// + public string Name { get; set; } + + /// + /// Name of the author of the modlist + /// + public string Author { get; set; } + + /// + /// Game this modlist is for + /// + public Game Game { get; set; } + + /// + /// Short description of the modlist + /// + public string Description { get; set; } + + /// + /// URL of the logo for the modlist + /// + public string LogoUrl { get; set; } + + /// + /// Download URL + /// + public string DownloadUrl { get; set; } + + public static List LoadFromGithub() + { + var d = new DeserializerBuilder() + .WithNamingConvention(new PascalCaseNamingConvention()) + .Build(); + var client = new HttpClient(); + Utils.Log("Loading Modlists from Github"); + using (var result = new StringReader(client.GetStringSync(Consts.ModlistMetadataURL))) + { + return d.Deserialize>(result); + } + } + } +} diff --git a/Wabbajack/Wabbajack.csproj b/Wabbajack/Wabbajack.csproj index 24e17ac2..e2a0799d 100644 --- a/Wabbajack/Wabbajack.csproj +++ b/Wabbajack/Wabbajack.csproj @@ -238,6 +238,7 @@ + SlideshowView.xaml