finalize model for option sets
This commit is contained in:
6
ModpackUpdater/IActionSet.cs
Normal file
6
ModpackUpdater/IActionSet.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace ModpackUpdater;
|
||||||
|
|
||||||
|
public interface IActionSet
|
||||||
|
{
|
||||||
|
IEnumerable<InstallAction> Actions { get; }
|
||||||
|
}
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
namespace ModpackUpdater;
|
namespace ModpackUpdater;
|
||||||
|
|
||||||
public interface IActionSetInfos
|
public interface IActionSetInfos : IActionSet
|
||||||
{
|
{
|
||||||
Version Version { get; set; }
|
Version Version { get; set; }
|
||||||
|
bool IsPublic { get; set; }
|
||||||
public bool IsPublic { get; set; }
|
|
||||||
|
|
||||||
IEnumerable<InstallAction> Actions { get; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ public class InstallAction
|
|||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool IsExtra { get; set; }
|
public bool IsExtra { get; set; }
|
||||||
|
|
||||||
|
[DefaultValue(null)]
|
||||||
|
public string TargetOption { get; set; }
|
||||||
|
|
||||||
[JsonProperty, Obsolete]
|
[JsonProperty, Obsolete]
|
||||||
private string DownloadUrl
|
private string DownloadUrl
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class InstallInfos : IActionSetInfos
|
|||||||
|
|
||||||
public List<InstallOptionSet> OptionSets { get; } = [];
|
public List<InstallOptionSet> OptionSets { get; } = [];
|
||||||
|
|
||||||
IEnumerable<InstallAction> IActionSetInfos.Actions => Actions;
|
IEnumerable<InstallAction> IActionSet.Actions => Actions;
|
||||||
|
|
||||||
public static InstallInfos Parse(string content)
|
public static InstallInfos Parse(string content)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,21 @@
|
|||||||
namespace ModpackUpdater;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
public class InstallOption
|
namespace ModpackUpdater;
|
||||||
|
|
||||||
|
public class InstallOption : IActionSet
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public List<InstallAction> InstallActions { get; } = [];
|
|
||||||
|
[DefaultValue(null)]
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[DefaultValue(Side.Both)]
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public Side Side { get; set; } = Side.Both;
|
||||||
|
|
||||||
public List<UpdateAction> UninstallActions { get; } = [];
|
public List<UpdateAction> UninstallActions { get; } = [];
|
||||||
|
|
||||||
|
IEnumerable<InstallAction> IActionSet.Actions => UninstallActions.Cast<InstallAction>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,24 @@
|
|||||||
namespace ModpackUpdater;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace ModpackUpdater;
|
||||||
|
|
||||||
public class InstallOptionSet
|
public class InstallOptionSet
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
[DefaultValue(null)]
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[DefaultValue(Side.Both)]
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public Side Side { get; set; } = Side.Both;
|
||||||
|
|
||||||
|
[DefaultValue(false)]
|
||||||
public bool Multiselect { get; set; }
|
public bool Multiselect { get; set; }
|
||||||
public string DefaultValue { get; set; }
|
|
||||||
|
public List<int> Defaults { get; } = [];
|
||||||
|
|
||||||
public List<InstallOption> Options { get; } = [];
|
public List<InstallOption> Options { get; } = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ public class UpdateInfo : IActionSetInfos
|
|||||||
|
|
||||||
public List<UpdateAction> Actions { get; } = [];
|
public List<UpdateAction> Actions { get; } = [];
|
||||||
|
|
||||||
IEnumerable<InstallAction> IActionSetInfos.Actions => Actions.Cast<InstallAction>();
|
IEnumerable<InstallAction> IActionSet.Actions => Actions.Cast<InstallAction>();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user