Как то худо-бедно начинает работать лучше

This commit is contained in:
2025-03-08 23:22:59 +03:00
parent 0e09b479af
commit 493f56c99a
6 changed files with 16 additions and 6 deletions
+5 -3
View File
@@ -56,13 +56,13 @@ namespace mROA.Cbor
{
if (nonCasted == null)
return null;
if (nonCasted.GetType() == type)
return nonCasted;
if (nonCasted is PreParsedValue preParsed)
return preParsed.ToObject(type, context);
return null;
return Convert.ChangeType(nonCasted, type);
}
private void WriteData(object? obj, CborWriter writer, IEndPointContext? context)
@@ -214,6 +214,9 @@ namespace mROA.Cbor
return reader.ReadDouble();
case CborReaderState.SinglePrecisionFloat:
return reader.ReadSingle();
case CborReaderState.HalfPrecisionFloat:
return type == typeof(float) ? reader.ReadSingle() : reader.ReadDouble();
case CborReaderState.StartArray:
if (type == null)
return ReadList(reader, null, context);
@@ -308,7 +311,6 @@ namespace mROA.Cbor
if (type.IsInterface)
{
var sharedShell = typeof(SharedObjectShellShell<>).MakeGenericType(type);
var so =
Activator.CreateInstance(sharedShell) as