You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
50 lines
1.7 KiB
1 year ago
|
using System.Text.Json.Serialization;
|
||
1 year ago
|
|
||
1 year ago
|
namespace StabilityMatrix.Core.Models;
|
||
1 year ago
|
|
||
|
/// <summary>
|
||
|
/// Defines a launch option for a BasePackage.
|
||
|
/// </summary>
|
||
|
public class LaunchOptionDefinition
|
||
|
{
|
||
1 year ago
|
public string Name { get; init; }
|
||
1 year ago
|
|
||
|
/// <summary>
|
||
|
/// Type of the option. "bool", "int", or "string"
|
||
|
/// - "bool" can supply 1 or more flags in the Options list (e.g. ["--api", "--lowvram"])
|
||
|
/// - "int" and "string" should supply a single flag in the Options list (e.g. ["--width"], ["--api"])
|
||
|
/// </summary>
|
||
1 year ago
|
public LaunchOptionType Type { get; init; } = LaunchOptionType.Bool;
|
||
1 year ago
|
public string? Description { get; init; }
|
||
1 year ago
|
|
||
|
/// <summary>
|
||
1 year ago
|
/// Server-side default for the option. (Ignored for launch and saving if value matches)
|
||
|
/// Use `InitialValue` to provide a default that is set as the user value and used for launch.
|
||
1 year ago
|
/// </summary>
|
||
1 year ago
|
public object? DefaultValue { get; init; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// Initial value for the option if no set value is available, set as the user value on save.
|
||
|
/// Use `DefaultValue` to provide a server-side default that is ignored for launch and saving.
|
||
|
/// </summary>
|
||
|
public object? InitialValue { get; set; }
|
||
1 year ago
|
|
||
1 year ago
|
// Minimum number of selected options
|
||
|
public int? MinSelectedOptions { get; set; }
|
||
|
// Maximum number of selected options
|
||
|
public int? MaxSelectedOptions { get; set; }
|
||
1 year ago
|
|
||
|
/// <summary>
|
||
|
/// List of option flags like "--api", "--lowvram", etc.
|
||
|
/// </summary>
|
||
1 year ago
|
public List<string> Options { get; set; }
|
||
1 year ago
|
|
||
1 year ago
|
[JsonIgnore]
|
||
1 year ago
|
public static LaunchOptionDefinition Extras => new()
|
||
|
{
|
||
|
Name = "Extra Launch Arguments",
|
||
|
Type = LaunchOptionType.String,
|
||
|
Options = new() {""}
|
||
|
};
|
||
1 year ago
|
}
|