mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
add modlist metadata files
This commit is contained in:
parent
b2eef2a5cc
commit
ac14aad955
@ -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
|
||||
{
|
||||
|
12
Wabbajack.Common/ModListRegistry.cs
Normal file
12
Wabbajack.Common/ModListRegistry.cs
Normal 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
|
||||
{
|
||||
}
|
||||
}
|
21
Wabbajack.Test/ModlistMetadataTests.cs
Normal file
21
Wabbajack.Test/ModlistMetadataTests.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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" />
|
||||
|
61
Wabbajack/ModListRegistry/ModListMetadata.cs
Normal file
61
Wabbajack/ModListRegistry/ModListMetadata.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user