Works, but slow for many connections
This commit is contained in:
@@ -116,9 +116,9 @@ namespace mROA.Cbor
|
||||
return preParsed.ToObject(type, context);
|
||||
|
||||
|
||||
if (type == typeof(Guid))
|
||||
if (type == typeof(RequestId))
|
||||
{
|
||||
return new Guid((byte[])nonCasted);
|
||||
return new RequestId((byte[])nonCasted);
|
||||
}
|
||||
|
||||
return Convert.ChangeType(nonCasted, type);
|
||||
@@ -164,7 +164,7 @@ namespace mROA.Cbor
|
||||
case DateTimeOffset dto:
|
||||
writer.WriteDateTimeOffset(dto);
|
||||
break;
|
||||
case Guid g:
|
||||
case RequestId g:
|
||||
writer.WriteByteString(g.ToByteArray());
|
||||
break;
|
||||
case byte[] bytes:
|
||||
@@ -270,8 +270,8 @@ namespace mROA.Cbor
|
||||
|
||||
return reader.ReadUInt64();
|
||||
case CborReaderState.ByteString:
|
||||
if (type == typeof(Guid))
|
||||
return new Guid(reader.ReadByteString());
|
||||
if (type == typeof(RequestId))
|
||||
return new RequestId(reader.ReadByteString());
|
||||
return reader.ReadByteString();
|
||||
case CborReaderState.TextString:
|
||||
return reader.ReadTextString();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace mROA.Cbor
|
||||
reader.ReadStartArray();
|
||||
var value = new NetworkMessage
|
||||
{
|
||||
Id = new Guid(reader.ReadByteString()),
|
||||
Id = new RequestId(reader.ReadByteString()),
|
||||
MessageType = (EMessageType)reader.ReadInt32(),
|
||||
Data = reader.ReadByteString()
|
||||
};
|
||||
@@ -57,7 +57,7 @@ namespace mROA.Cbor
|
||||
reader.ReadStartArray();
|
||||
var value = new DefaultCallRequest
|
||||
{
|
||||
Id = new Guid(reader.ReadByteString()),
|
||||
Id = new RequestId(reader.ReadByteString()),
|
||||
CommandId = reader.ReadInt32(),
|
||||
ObjectId = (ComplexObjectIdentifier)ComplexObjectIdentifierParser.Instance.Read(reader, context, serialization),
|
||||
Parameters = serialization.ReadData(reader, typeof(object[]), context) as object[]
|
||||
@@ -102,7 +102,7 @@ namespace mROA.Cbor
|
||||
reader.ReadStartArray();
|
||||
var result = new FinalCommandExecution<object>
|
||||
{
|
||||
Id = new Guid(reader.ReadByteString()),
|
||||
Id = new RequestId(reader.ReadByteString()),
|
||||
Result = serialization.ReadData(reader, typeof(object), context),
|
||||
};
|
||||
reader.ReadEndArray();
|
||||
@@ -125,7 +125,7 @@ namespace mROA.Cbor
|
||||
reader.ReadStartArray();
|
||||
var result = new FinalCommandExecution
|
||||
{
|
||||
Id = new Guid(reader.ReadByteString())
|
||||
Id = new RequestId(reader.ReadByteString())
|
||||
};
|
||||
reader.ReadEndArray();
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user