add modlist metadata files

This commit is contained in:
Timothy Baldridge 2019-10-15 17:23:14 -06:00
parent b2eef2a5cc
commit ac14aad955
6 changed files with 97 additions and 0 deletions

View File

@ -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
{

View File

@ -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
{
}
}

View File

@ -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);
}
}
}

View File

@ -76,6 +76,7 @@
<ItemGroup>
<Compile Include="DownloaderTests.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="ModlistMetadataTests.cs" />
<Compile Include="TestUtils.cs" />
<Compile Include="SanityTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -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
{
/// <summary>
/// Name of the modlist
/// </summary>
public string Name { get; set; }
/// <summary>
/// Name of the author of the modlist
/// </summary>
public string Author { get; set; }
/// <summary>
/// Game this modlist is for
/// </summary>
public Game Game { get; set; }
/// <summary>
/// Short description of the modlist
/// </summary>
public string Description { get; set; }
/// <summary>
/// URL of the logo for the modlist
/// </summary>
public string LogoUrl { get; set; }
/// <summary>
/// Download URL
/// </summary>
public string DownloadUrl { get; set; }
public static List<ModlistMetadata> 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<List<ModlistMetadata>>(result);
}
}
}
}

View File

@ -238,6 +238,7 @@
<Compile Include="Downloaders\NexusDownloader.cs" />
<Compile Include="Enums\RunMode.cs" />
<Compile Include="Extensions\ReactiveUIExt.cs" />
<Compile Include="ModListRegistry\ModListMetadata.cs" />
<Compile Include="UI\SlideshowView.xaml.cs">
<DependentUpon>SlideshowView.xaml</DependentUpon>
</Compile>