Initial commit of new UI c# component

This commit is contained in:
LukeFZ
2025-01-25 15:37:43 +01:00
parent ec76447122
commit cc822b418b
21 changed files with 837 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
namespace Il2CppInspector.Redux.GUI;
public static class DictionaryExtensions
{
public static bool GetAsBooleanOrDefault(this Dictionary<string, string> dict, string key, bool defaultValue)
{
if (dict.TryGetValue(key, out var value) && bool.TryParse(value, out var boolResult))
return boolResult;
return defaultValue;
}
public static T GetAsEnumOrDefault<T>(this Dictionary<string, string> dict, string key, T defaultValue)
where T : struct, Enum
{
if (dict.TryGetValue(key, out var value) && Enum.TryParse<T>(value, out var enumResult))
return enumResult;
return defaultValue;
}
}