Теперь без шела работает

This commit is contained in:
2025-03-01 19:06:18 +03:00
parent b5b766342e
commit bd3c623626
16 changed files with 219 additions and 176 deletions
+15 -1
View File
@@ -21,11 +21,25 @@ namespace mROA.Cbor
public object? ToObject(Type type, IEndPointContext? context)
{
if (type.IsInterface)
{
var sharedShell = typeof(SharedObjectShellShell<>).MakeGenericType(type);
var so =
Activator.CreateInstance(sharedShell) as
ISharedObjectShell;
if (context != null)
so.EndPointContext = context;
so.Identifier = UniversalObjectIdentifier.FromFlat((ulong)_properties[0]);
return so.UniversalValue;
}
var instance = Activator.CreateInstance(type);
if (instance == null)
return null;
if (instance is ISharedObject sharedObject && context != null)
if (instance is ISharedObjectShell sharedObject && context != null)
{
sharedObject.EndPointContext = context;
}