29 lines
864 B
C#
29 lines
864 B
C#
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
namespace ModpackUpdater;
|
|
|
|
public class ModpackConfig
|
|
{
|
|
public bool Maintenance { get; set; }
|
|
public string? Name { get; set; }
|
|
public string? UpdateUrl { get; set; }
|
|
public string? InstallUrl { get; set; }
|
|
public List<string> ExtrasKeys { get; } = [];
|
|
public string? MinecraftVersion { get; set; }
|
|
public string? RefTag { get; set; }
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public ModLoader ModLoader { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public string? ConfigUrl { get; private set; }
|
|
|
|
public static ModpackConfig LoadFromUrl(string? url)
|
|
{
|
|
var result = new HttpClient().GetStringAsync(url).Result;
|
|
var config = JsonConvert.DeserializeObject<ModpackConfig>(result) ?? new();
|
|
config.ConfigUrl = url;
|
|
return config;
|
|
}
|
|
} |