/*
Copyright 2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
All rights reserved.
*/
using System.Collections.Generic;
namespace Il2CppInspector.PluginAPI.V100
{
///
/// Interface representing a plugin option
///
public interface IPluginOption
{
///
/// Option name for CLI and unique ID
///
public string Name { get; set; }
///
/// Option description for GUI
///
public string Description { get; set; }
///
/// True if the setting is required for the plugin to function, false if optional
/// Optional by default
///
public bool Required { get; set; }
///
/// The default value of the option, if any
/// Becomes the current value of the option when supplied by the user
///
public object Value { get; set; }
}
///
/// Defines how to display lists of choices in the GUI
/// Dropdown for a dropdown box, List for a list of radio buttons
///
public enum PluginOptionChoiceStyle
{
Dropdown,
List
}
///
/// Defines how to display and parse numbers in the CLI and GUI
/// Decimal for regular numbers, Hex for hexadecimal strings
///
public enum PluginOptionNumberStyle
{
Decimal,
Hex
}
///
/// The base option from which all other options are derived
///
public abstract class PluginOption : IPluginOption
{
///
/// The name of the option as it will be supplied in an argument on the command-line
///
public string Name { get; set; }
///
/// A description of what the option does
///
public string Description { get; set; }
///
/// True if the option must be specified, false if optional
///
public bool Required { get; set; }
///
/// When created, the default value of the option
/// During plugin execution, the current value of the option
///
object IPluginOption.Value { get => Value; set => Value = (T) value; }
public T Value { get; set; }
}
///
/// Numeric type option (for internal use only)
///
public interface IPluginOptionNumber
{
///
/// The style of the number
///
public PluginOptionNumberStyle Style { get; set; }
///
/// The value of the number
///
object Value { get; set; }
}
///
/// Option representing a text string
///
public class PluginOptionText : PluginOption { }
///
/// Option representing a file path
///
public class PluginOptionFilePath : PluginOption { }
///
/// And option representing boolean true or false (yes/no, on/off etc.)
///
public class PluginOptionBoolean : PluginOption { }
///
/// Option representing a number
///
/// The type of the number
public class PluginOptionNumber : PluginOption, IPluginOptionNumber where T : struct
{
///
/// Decimal for normal numbers
/// Hex to display and parse numbers as hex in the CLI and GUI
///
public PluginOptionNumberStyle Style { get; set; }
///
/// The value of the number
///
object IPluginOptionNumber.Value { get => Value; set => Value = (T) value; }
}
///
/// Option representing a single choice from a list of choices
///
public class PluginOptionChoice : PluginOption
{
///
/// List of items to choose from
/// The Keys are the actual values and those supplied via the CLI
/// The Values are descriptions of each value shown in the GUI
///
public Dictionary Choices { get; set; }
///
/// Dropdown to display the list as a drop-down box in the GUI
/// List to display the list as a set of grouped radio buttons in the GUI
///
public PluginOptionChoiceStyle Style { get; set; }
}
}