Files
minecraft-modpack-updater/ModpackUpdater/InstallInfos.cs
2025-11-17 16:35:02 +01:00

35 lines
985 B
C#

using Newtonsoft.Json;
using System.ComponentModel;
namespace ModpackUpdater;
public class InstallInfos : IActionSetInfos
{
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
public Version Version { get; set; } = new();
[DefaultValue(true)]
public bool IsPublic { get; set; } = true;
public List<InstallAction> Actions { get; } = [];
public List<InstallOptionSet> OptionSets { get; } = [];
IEnumerable<InstallAction> IActionSet.Actions => Actions;
public static InstallInfos? Parse(string? content)
{
if (string.IsNullOrWhiteSpace(content))
return null;
return JsonConvert.DeserializeObject<InstallInfos>(content);
}
public override string ToString()
{
return JsonConvert.SerializeObject(this, new JsonSerializerSettings
{
Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
});
}
}