Переименование UOI в COI
This commit is contained in:
@@ -65,6 +65,50 @@ namespace mROA.Cbor
|
||||
return Convert.ChangeType(nonCasted, type);
|
||||
}
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
{
|
||||
}
|
||||
|
||||
public byte[] Serialize<T>(T objectToSerialize)
|
||||
{
|
||||
return Serialize(objectToSerialize, typeof(T));
|
||||
}
|
||||
|
||||
public byte[] Serialize(object objectToSerialize, Type type)
|
||||
{
|
||||
return Serialize(objectToSerialize, context: null);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(byte[] rawData)
|
||||
{
|
||||
return Deserialize<T>(rawData: rawData, context: null);
|
||||
}
|
||||
|
||||
public object? Deserialize(byte[] rawData, Type type)
|
||||
{
|
||||
return Deserialize(rawData: rawData, type, context: null);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(Span<byte> rawData)
|
||||
{
|
||||
return Deserialize<T>(rawData.ToArray().AsMemory(), context: null);
|
||||
}
|
||||
|
||||
public object? Deserialize(Span<byte> rawData, Type type)
|
||||
{
|
||||
return Deserialize(rawData: rawData.ToArray(), type: type);
|
||||
}
|
||||
|
||||
public T Cast<T>(object nonCasted)
|
||||
{
|
||||
return Cast<T>(nonCasted: nonCasted, context: null);
|
||||
}
|
||||
|
||||
public object Cast(object nonCasted, Type type)
|
||||
{
|
||||
return Cast(nonCasted: nonCasted, type: type, context: null);
|
||||
}
|
||||
|
||||
private void WriteData(object? obj, CborWriter writer, IEndPointContext? context)
|
||||
{
|
||||
switch (obj)
|
||||
@@ -322,7 +366,7 @@ namespace mROA.Cbor
|
||||
var identifier = reader.ReadUInt64();
|
||||
reader.ReadEndArray();
|
||||
|
||||
so.Identifier = UniversalObjectIdentifier.FromFlat(identifier);
|
||||
so.Identifier = ComplexObjectIdentifier.FromFlat(identifier);
|
||||
return so.UniversalValue;
|
||||
}
|
||||
|
||||
@@ -387,49 +431,5 @@ namespace mROA.Cbor
|
||||
|
||||
return finalProperties;
|
||||
}
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
{
|
||||
}
|
||||
|
||||
public byte[] Serialize<T>(T objectToSerialize)
|
||||
{
|
||||
return Serialize(objectToSerialize, typeof(T));
|
||||
}
|
||||
|
||||
public byte[] Serialize(object objectToSerialize, Type type)
|
||||
{
|
||||
return Serialize(objectToSerialize, context: null);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(byte[] rawData)
|
||||
{
|
||||
return Deserialize<T>(rawData: rawData, context: null);
|
||||
}
|
||||
|
||||
public object? Deserialize(byte[] rawData, Type type)
|
||||
{
|
||||
return Deserialize(rawData: rawData, type, context: null);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(Span<byte> rawData)
|
||||
{
|
||||
return Deserialize<T>(rawData.ToArray().AsMemory(), context: null);
|
||||
}
|
||||
|
||||
public object? Deserialize(Span<byte> rawData, Type type)
|
||||
{
|
||||
return Deserialize(rawData: rawData.ToArray(), type: type);
|
||||
}
|
||||
|
||||
public T Cast<T>(object nonCasted)
|
||||
{
|
||||
return Cast<T>(nonCasted: nonCasted, context: null);
|
||||
}
|
||||
|
||||
public object Cast(object nonCasted, Type type)
|
||||
{
|
||||
return Cast(nonCasted: nonCasted, type: type, context: null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,16 +12,15 @@ namespace mROA.Cbor
|
||||
|
||||
public class PreParsedValue : IPreParsedValue
|
||||
{
|
||||
private List<object> _properties { get; set; }
|
||||
|
||||
public PreParsedValue(List<object> properties)
|
||||
{
|
||||
_properties = properties;
|
||||
}
|
||||
|
||||
private List<object> _properties { get; set; }
|
||||
|
||||
public object? ToObject(Type type, IEndPointContext? context)
|
||||
{
|
||||
|
||||
if (type.IsInterface)
|
||||
{
|
||||
var sharedShell = typeof(SharedObjectShellShell<>).MakeGenericType(type);
|
||||
@@ -31,10 +30,10 @@ namespace mROA.Cbor
|
||||
if (context != null)
|
||||
so.EndPointContext = context;
|
||||
|
||||
so.Identifier = UniversalObjectIdentifier.FromFlat((ulong)_properties[0]);
|
||||
so.Identifier = ComplexObjectIdentifier.FromFlat((ulong)_properties[0]);
|
||||
return so.UniversalValue;
|
||||
}
|
||||
|
||||
|
||||
var instance = Activator.CreateInstance(type);
|
||||
if (instance == null)
|
||||
return null;
|
||||
@@ -48,7 +47,10 @@ namespace mROA.Cbor
|
||||
for (var index = 0; index < properties.Count; index++)
|
||||
{
|
||||
var property = properties[index];
|
||||
property.SetValue(instance, _properties[index] is IPreParsedValue ppv ? ppv.ToObject(property.PropertyType, context) : _properties[index]);
|
||||
property.SetValue(instance,
|
||||
_properties[index] is IPreParsedValue ppv
|
||||
? ppv.ToObject(property.PropertyType, context)
|
||||
: _properties[index]);
|
||||
}
|
||||
|
||||
return instance;
|
||||
@@ -57,13 +59,13 @@ namespace mROA.Cbor
|
||||
|
||||
public class ParsedValue : IPreParsedValue
|
||||
{
|
||||
private object? _value;
|
||||
|
||||
public ParsedValue(object? value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
private object? _value;
|
||||
|
||||
|
||||
public object? ToObject(Type type, IEndPointContext? context)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user