wabbajack/Wabbajack.Lib/ModListRegistry/ModListMetadata.cs

62 lines
1.7 KiB
C#
Raw Normal View History

2019-10-15 23:23:14 +00:00
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.Lib.Validation;
2019-10-15 23:23:14 +00:00
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
using Game = Wabbajack.Common.Game;
namespace Wabbajack.Lib.ModListRegistry
2019-10-15 23:23:14 +00:00
{
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()
2019-10-16 21:36:14 +00:00
.WithNamingConvention(PascalCaseNamingConvention.Instance)
2019-10-15 23:23:14 +00:00
.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);
}
}
}
}