|
@@ -20,13 +20,21 @@ namespace InABox.DynamicGrid
|
|
foreach(var type in CoreUtils.TypeList(AppDomain.CurrentDomain.GetAssemblies(),
|
|
foreach(var type in CoreUtils.TypeList(AppDomain.CurrentDomain.GetAssemblies(),
|
|
x => x.IsClass
|
|
x => x.IsClass
|
|
&& !x.IsAbstract
|
|
&& !x.IsAbstract
|
|
- && !x.IsGenericType
|
|
|
|
- && x.IsSubclassOfRawGeneric(typeof(DynamicEditorControl<,>))))
|
|
|
|
|
|
+ && !x.IsGenericType))
|
|
{
|
|
{
|
|
- var editorClass = type.GetSuperclassDefinition(typeof(DynamicEditorControl<,>))!;
|
|
|
|
- var valueType = editorClass.GenericTypeArguments[0];
|
|
|
|
- var editor = editorClass.GenericTypeArguments[1];
|
|
|
|
- if (editor == typeof(IBaseEditor) || editor.HasInterface<IBaseEditor>())
|
|
|
|
|
|
+ Type? valueType = null;
|
|
|
|
+ Type? editor = null;
|
|
|
|
+ if(type.GetSuperclassDefinition(typeof(DynamicEditorControl<,>)) is Type editorClass)
|
|
|
|
+ {
|
|
|
|
+ valueType = editorClass.GenericTypeArguments[0];
|
|
|
|
+ editor = editorClass.GenericTypeArguments[1];
|
|
|
|
+ }
|
|
|
|
+ else if(type.GetSuperclassDefinition(typeof(DynamicEnclosedEditorControl<,>)) is Type enclosedEditorClass)
|
|
|
|
+ {
|
|
|
|
+ valueType = enclosedEditorClass.GenericTypeArguments[0];
|
|
|
|
+ editor = enclosedEditorClass.GenericTypeArguments[1];
|
|
|
|
+ }
|
|
|
|
+ if (editor is not null && valueType is not null && (editor == typeof(IBaseEditor) || editor.HasInterface<IBaseEditor>()))
|
|
{
|
|
{
|
|
_editors.GetValueOrAdd(editor).Add((valueType, type));
|
|
_editors.GetValueOrAdd(editor).Add((valueType, type));
|
|
}
|
|
}
|