Plugins/GUI: Implement conditional option enabling

This commit is contained in:
Katy Coe
2020-12-28 08:33:12 +01:00
parent 096b2d9c5d
commit 99f1c38b4c
4 changed files with 82 additions and 20 deletions

View File

@@ -37,6 +37,12 @@ namespace Il2CppInspector.PluginAPI.V100
/// Becomes the current value of the option when supplied by the user
/// </summary>
public object Value { get; set; }
/// <summary>
/// A condition that determines whether the option is enabled,
/// based on the settings of other options or any other desired criteria
/// </summary>
public Func<bool> If { get; set; }
}
/// <summary>
@@ -100,6 +106,12 @@ namespace Il2CppInspector.PluginAPI.V100
}
}
/// <summary>
/// This can be set to a predicate that determines whether the option is enabled in the GUI
/// By default, enable all options unless overridden
/// </summary>
public Func<bool> If { get; set; } = () => true;
/// <summary>
/// Optional validation function for the option in addition to basic automatic validation
/// Must either throw an exception or return true