mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 03:32:57 +00:00
Guid to UUID
This commit is contained in:
parent
47272f5463
commit
276e7b17fd
@ -64,11 +64,17 @@ public class BinaryList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BinaryList AddGuid(Guid value)
|
public BinaryList AddUUID(UUID value)
|
||||||
{
|
{
|
||||||
list.AddRange(DC.ToBytes(value));
|
list.AddRange(value.Data);
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//public BinaryList AddGuid(Guid value)
|
||||||
|
//{
|
||||||
|
// list.AddRange(DC.ToBytes(value));
|
||||||
|
// return this;
|
||||||
|
//}
|
||||||
|
|
||||||
public BinaryList InsertGuid(int position, Guid value)
|
public BinaryList InsertGuid(int position, Guid value)
|
||||||
{
|
{
|
||||||
|
@ -808,11 +808,16 @@ public static class DC // Data Converter
|
|||||||
return ar.ToArray();
|
return ar.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Guid GetGuid(this byte[] data, uint offset)
|
public static UUID GetUUID(this byte[] data, uint offset)
|
||||||
{
|
{
|
||||||
return new Guid(Clip(data, offset, 16));
|
return new UUID(data, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//public static Guid GetGuid(this byte[] data, uint offset)
|
||||||
|
//{
|
||||||
|
// return new Guid(Clip(data, offset, 16));
|
||||||
|
//}
|
||||||
|
|
||||||
public static DateTime GetDateTime(this byte[] data, uint offset, Endian endian)
|
public static DateTime GetDateTime(this byte[] data, uint offset, Endian endian)
|
||||||
{
|
{
|
||||||
var ticks = GetInt64(data, offset, endian);
|
var ticks = GetInt64(data, offset, endian);
|
||||||
|
@ -158,12 +158,12 @@ public static class DataDeserializer
|
|||||||
|
|
||||||
var reply = new AsyncReply<IRecord>();
|
var reply = new AsyncReply<IRecord>();
|
||||||
|
|
||||||
var classId = data.GetGuid(offset);
|
var classId = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
length -= 16;
|
length -= 16;
|
||||||
|
|
||||||
|
|
||||||
var template = Warehouse.GetTemplateByClassId((Guid)classId, TemplateType.Record);
|
var template = Warehouse.GetTemplateByClassId(classId, TemplateType.Record);
|
||||||
|
|
||||||
var initRecord = (TypeTemplate template) =>
|
var initRecord = (TypeTemplate template) =>
|
||||||
{
|
{
|
||||||
@ -216,7 +216,7 @@ public static class DataDeserializer
|
|||||||
else if (connection != null)
|
else if (connection != null)
|
||||||
{
|
{
|
||||||
// try to get the template from the other end
|
// try to get the template from the other end
|
||||||
connection.GetTemplate((Guid)classId).Then(tmp =>
|
connection.GetTemplate(classId).Then(tmp =>
|
||||||
{
|
{
|
||||||
initRecord(tmp);
|
initRecord(tmp);
|
||||||
}).Error(x => reply.TriggerError(x));
|
}).Error(x => reply.TriggerError(x));
|
||||||
@ -237,11 +237,11 @@ public static class DataDeserializer
|
|||||||
public static unsafe AsyncReply EnumParser(byte[] data, uint offset, uint length, DistributedConnection connection, uint[] requestSequence)
|
public static unsafe AsyncReply EnumParser(byte[] data, uint offset, uint length, DistributedConnection connection, uint[] requestSequence)
|
||||||
{
|
{
|
||||||
|
|
||||||
var classId = data.GetGuid(offset);
|
var classId = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
var index = data[offset++];
|
var index = data[offset++];
|
||||||
|
|
||||||
var template = Warehouse.GetTemplateByClassId((Guid)classId, TemplateType.Enum);
|
var template = Warehouse.GetTemplateByClassId(classId, TemplateType.Enum);
|
||||||
|
|
||||||
if (template != null)
|
if (template != null)
|
||||||
{
|
{
|
||||||
@ -251,7 +251,7 @@ public static class DataDeserializer
|
|||||||
{
|
{
|
||||||
var reply = new AsyncReply();
|
var reply = new AsyncReply();
|
||||||
|
|
||||||
connection.GetTemplate((Guid)classId).Then(tmp =>
|
connection.GetTemplate(classId).Then(tmp =>
|
||||||
{
|
{
|
||||||
reply.Trigger(tmp.Constants[index].Value);
|
reply.Trigger(tmp.Constants[index].Value);
|
||||||
}).Error(x => reply.TriggerError(x));
|
}).Error(x => reply.TriggerError(x));
|
||||||
|
@ -128,7 +128,7 @@ public static class DataSerializer
|
|||||||
|
|
||||||
|
|
||||||
var rt = new List<byte>();
|
var rt = new List<byte>();
|
||||||
rt.AddRange(template.ClassId.ToByteArray());
|
rt.AddRange(template.ClassId.Data);
|
||||||
rt.Add(ct.Index);
|
rt.Add(ct.Index);
|
||||||
|
|
||||||
return (TransmissionTypeIdentifier.Enum, rt.ToArray());
|
return (TransmissionTypeIdentifier.Enum, rt.ToArray());
|
||||||
@ -366,7 +366,7 @@ public static class DataSerializer
|
|||||||
var template = Warehouse.GetTemplateByType(record.GetType());
|
var template = Warehouse.GetTemplateByType(record.GetType());
|
||||||
|
|
||||||
|
|
||||||
rt.AddRange(template.ClassId.ToByteArray());
|
rt.AddRange(template.ClassId.Data);
|
||||||
|
|
||||||
foreach (var pt in template.Properties)
|
foreach (var pt in template.Properties)
|
||||||
{
|
{
|
||||||
|
@ -177,9 +177,9 @@ namespace Esiur.Data
|
|||||||
(RepresentationTypeIdentifier.DateTime) => Nullable ? typeof(DateTime?) : typeof(DateTime),
|
(RepresentationTypeIdentifier.DateTime) => Nullable ? typeof(DateTime?) : typeof(DateTime),
|
||||||
(RepresentationTypeIdentifier.Resource) => typeof(IResource),
|
(RepresentationTypeIdentifier.Resource) => typeof(IResource),
|
||||||
(RepresentationTypeIdentifier.Record) => typeof(IRecord),
|
(RepresentationTypeIdentifier.Record) => typeof(IRecord),
|
||||||
(RepresentationTypeIdentifier.TypedRecord) => Warehouse.GetTemplateByClassId((Guid)GUID!, TemplateType.Record)?.DefinedType,
|
(RepresentationTypeIdentifier.TypedRecord) => Warehouse.GetTemplateByClassId((UUID)UUID!, TemplateType.Record)?.DefinedType,
|
||||||
(RepresentationTypeIdentifier.TypedResource) => Warehouse.GetTemplateByClassId((Guid)GUID!, TemplateType.Resource)?.DefinedType,
|
(RepresentationTypeIdentifier.TypedResource) => Warehouse.GetTemplateByClassId((UUID)UUID!, TemplateType.Resource)?.DefinedType,
|
||||||
(RepresentationTypeIdentifier.Enum) => Warehouse.GetTemplateByClassId((Guid)GUID!, TemplateType.Enum)?.DefinedType,
|
(RepresentationTypeIdentifier.Enum) => Warehouse.GetTemplateByClassId((UUID)UUID!, TemplateType.Enum)?.DefinedType,
|
||||||
|
|
||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
@ -187,7 +187,7 @@ namespace Esiur.Data
|
|||||||
|
|
||||||
public RepresentationTypeIdentifier Identifier;
|
public RepresentationTypeIdentifier Identifier;
|
||||||
public bool Nullable;
|
public bool Nullable;
|
||||||
public Guid? GUID;
|
public UUID? UUID;
|
||||||
//public RepresentationType? SubType1; // List + Map
|
//public RepresentationType? SubType1; // List + Map
|
||||||
//public RepresentationType? SubType2; // Map
|
//public RepresentationType? SubType2; // Map
|
||||||
//public RepresentationType? SubType3; // No types yet
|
//public RepresentationType? SubType3; // No types yet
|
||||||
@ -197,7 +197,7 @@ namespace Esiur.Data
|
|||||||
|
|
||||||
public RepresentationType ToNullable()
|
public RepresentationType ToNullable()
|
||||||
{
|
{
|
||||||
return new RepresentationType(Identifier, true, GUID, SubTypes);
|
return new RepresentationType(Identifier, true, UUID, SubTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RepresentationType? FromType(Type type)
|
public static RepresentationType? FromType(Type type)
|
||||||
@ -226,7 +226,7 @@ namespace Esiur.Data
|
|||||||
return new RepresentationType(
|
return new RepresentationType(
|
||||||
RepresentationTypeIdentifier.TypedResource,
|
RepresentationTypeIdentifier.TypedResource,
|
||||||
nullable,
|
nullable,
|
||||||
TypeTemplate.GetTypeGuid(type)
|
TypeTemplate.GetTypeUUID(type)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (Codec.ImplementsInterface(type, typeof(IRecord)))
|
else if (Codec.ImplementsInterface(type, typeof(IRecord)))
|
||||||
@ -234,7 +234,7 @@ namespace Esiur.Data
|
|||||||
return new RepresentationType(
|
return new RepresentationType(
|
||||||
RepresentationTypeIdentifier.TypedRecord,
|
RepresentationTypeIdentifier.TypedRecord,
|
||||||
nullable,
|
nullable,
|
||||||
TypeTemplate.GetTypeGuid(type)
|
TypeTemplate.GetTypeUUID(type)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (type.IsGenericType)
|
else if (type.IsGenericType)
|
||||||
@ -396,7 +396,7 @@ namespace Esiur.Data
|
|||||||
}
|
}
|
||||||
else if (type.IsEnum)
|
else if (type.IsEnum)
|
||||||
{
|
{
|
||||||
return new RepresentationType(RepresentationTypeIdentifier.Enum, nullable, TypeTemplate.GetTypeGuid(type));
|
return new RepresentationType(RepresentationTypeIdentifier.Enum, nullable, TypeTemplate.GetTypeUUID(type));
|
||||||
}
|
}
|
||||||
//else if (typeof(Structure).IsAssignableFrom(t) || t == typeof(ExpandoObject) => RepresentationTypeIdentifier.Structure)
|
//else if (typeof(Structure).IsAssignableFrom(t) || t == typeof(ExpandoObject) => RepresentationTypeIdentifier.Structure)
|
||||||
//{
|
//{
|
||||||
@ -427,11 +427,11 @@ namespace Esiur.Data
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RepresentationType(RepresentationTypeIdentifier identifier, bool nullable, Guid? guid = null, RepresentationType[]? subTypes = null)
|
public RepresentationType(RepresentationTypeIdentifier identifier, bool nullable, UUID? uuid = null, RepresentationType[]? subTypes = null)
|
||||||
{
|
{
|
||||||
Nullable = nullable;
|
Nullable = nullable;
|
||||||
Identifier = identifier;
|
Identifier = identifier;
|
||||||
GUID = guid;
|
UUID = uuid;
|
||||||
SubTypes = subTypes;
|
SubTypes = subTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,8 +444,8 @@ namespace Esiur.Data
|
|||||||
else
|
else
|
||||||
rt.AddUInt8((byte)Identifier);
|
rt.AddUInt8((byte)Identifier);
|
||||||
|
|
||||||
if (GUID != null)
|
if (UUID != null)
|
||||||
rt.AddUInt8Array(DC.ToBytes((Guid)GUID));
|
rt.AddUInt8Array(UUID.Value.Data);
|
||||||
|
|
||||||
if (SubTypes != null)
|
if (SubTypes != null)
|
||||||
for (var i = 0; i < SubTypes.Length; i++)
|
for (var i = 0; i < SubTypes.Length; i++)
|
||||||
@ -471,14 +471,14 @@ namespace Esiur.Data
|
|||||||
if ((header & 0x40) > 0)
|
if ((header & 0x40) > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
var hasGUID = (header & 0x4) > 0;
|
var hasUUID = (header & 0x4) > 0;
|
||||||
var subsCount = (header >> 3) & 0x7;
|
var subsCount = (header >> 3) & 0x7;
|
||||||
|
|
||||||
Guid? guid = null;
|
UUID? uuid = null;
|
||||||
|
|
||||||
if (hasGUID)
|
if (hasUUID)
|
||||||
{
|
{
|
||||||
guid = data.GetGuid(offset);
|
uuid = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ namespace Esiur.Data
|
|||||||
offset += len;
|
offset += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (offset - oOffset, new RepresentationType(identifier, nullable, guid, subs));
|
return (offset - oOffset, new RepresentationType(identifier, nullable, uuid, subs));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,65 +1,113 @@
|
|||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using Microsoft.CodeAnalysis.FlowAnalysis;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esiur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
//[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public unsafe struct UUID
|
public struct UUID
|
||||||
{
|
{
|
||||||
//4e7db2d8-a785-1b99-1854-4b4018bc5677
|
//4e7db2d8-a785-1b99-1854-4b4018bc5677
|
||||||
byte a1;
|
//byte a1;
|
||||||
byte a2;
|
//byte a2;
|
||||||
byte a3;
|
//byte a3;
|
||||||
byte a4;
|
//byte a4;
|
||||||
byte b1;
|
//byte b1;
|
||||||
byte b2;
|
//byte b2;
|
||||||
byte c1;
|
//byte c1;
|
||||||
byte c2;
|
//byte c2;
|
||||||
byte d1;
|
//byte d1;
|
||||||
byte d2;
|
//byte d2;
|
||||||
byte e1;
|
//byte e1;
|
||||||
byte e2;
|
//byte e2;
|
||||||
byte e3;
|
//byte e3;
|
||||||
byte e4;
|
//byte e4;
|
||||||
byte e5;
|
//byte e5;
|
||||||
byte e6;
|
//byte e6;
|
||||||
|
|
||||||
|
public byte[] Data { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public UUID(byte[] data)
|
public UUID(byte[] data, uint offset)
|
||||||
{
|
{
|
||||||
if (data.Length < 16)
|
if (offset + 16 < data.Length)
|
||||||
throw new Exception("UUID data size must be at least 16 bytes");
|
throw new Exception("UUID data size must be at least 16 bytes");
|
||||||
|
|
||||||
for(var i = 0; i < 16; i++)
|
Data = DC.Clip(data, offset, 16);
|
||||||
Data[i] = data[i];
|
|
||||||
|
//a1 = data[offset++];
|
||||||
|
//a2 = data[offset++];
|
||||||
|
//a3 = data[offset++];
|
||||||
|
//a4 = data[offset++];
|
||||||
|
//b1 = data[offset++];
|
||||||
|
//b2 = data[offset++];
|
||||||
|
//c1 = data[offset++];
|
||||||
|
//c2 = data[offset++];
|
||||||
|
//d1 = data[offset++];
|
||||||
|
//d2 = data[offset++];
|
||||||
|
//e1 = data[offset++];
|
||||||
|
//e2 = data[offset++];
|
||||||
|
//e3 = data[offset++];
|
||||||
|
//e4 = data[offset++];
|
||||||
|
//e5 = data[offset++];
|
||||||
|
//e6 = data[offset++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID(byte[] data) {
|
||||||
|
|
||||||
|
if (data.Length != 16)
|
||||||
|
throw new Exception("UUID data size must be 16 bytes");
|
||||||
|
|
||||||
|
Data = data;
|
||||||
|
//a1 = data[0];
|
||||||
|
//a2 = data[1];
|
||||||
|
//a3 = data[2];
|
||||||
|
//a4 = data[3];
|
||||||
|
//b1 = data[4];
|
||||||
|
//b2 = data[5];
|
||||||
|
//c1 = data[6];
|
||||||
|
//c2 = data[7];
|
||||||
|
//d1 = data[8];
|
||||||
|
//d2 = data[9];
|
||||||
|
//e1 = data[10];
|
||||||
|
//e2 = data[11];
|
||||||
|
//e3 = data[12];
|
||||||
|
//e4 = data[13];
|
||||||
|
//e5 = data[14];
|
||||||
|
//e6 = data[15];
|
||||||
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"{a1.ToString("x2")}{a2.ToString("x2")}{a3.ToString("x2")}{a4.ToString("x2")}-{b1.ToString("x2")}{b2.ToString("x2")}-{c1.ToString("x2")}{c2.ToString("x2")}-{d1.ToString("x2")}{d2.ToString("x2")}-{e1.ToString("x2")}{e2.ToString("x2")}{e3.ToString("x2")}{e4.ToString("x2")}{e5.ToString("x2")}{e6.ToString("x2")}";
|
|
||||||
|
return $"{DC.ToHex(Data, 0, 4, null)}-{DC.ToHex(Data, 4, 2, null)}-{DC.ToHex(Data, 6, 2, null)}-{DC.ToHex(Data, 8, 2, null)}-{DC.ToHex(Data, 10, 6, null)}";
|
||||||
|
|
||||||
|
//return $"{a1.ToString("x2")}{a2.ToString("x2")}{a3.ToString("x2")}{a4.ToString("x2")}-{b1.ToString("x2")}{b2.ToString("x2")}-{c1.ToString("x2")}{c2.ToString("x2")}-{d1.ToString("x2")}{d2.ToString("x2")}-{e1.ToString("x2")}{e2.ToString("x2")}{e3.ToString("x2")}{e4.ToString("x2")}{e5.ToString("x2")}{e6.ToString("x2")}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator == (UUID a, UUID b)
|
public static bool operator == (UUID a, UUID b)
|
||||||
{
|
{
|
||||||
return a.a1 == b.a1
|
return a.Data.SequenceEqual(b.Data);
|
||||||
&& a.a2 == b.a2
|
|
||||||
&& a.a3 == b.a3
|
//return a.a1 == b.a1
|
||||||
&& a.a4 == b.a4
|
// && a.a2 == b.a2
|
||||||
&& a.b1 == b.b1
|
// && a.a3 == b.a3
|
||||||
&& a.b2 == b.b2
|
// && a.a4 == b.a4
|
||||||
&& a.c1 == b.c1
|
// && a.b1 == b.b1
|
||||||
&& a.c2 == b.c2
|
// && a.b2 == b.b2
|
||||||
&& a.d1 == b.d1
|
// && a.c1 == b.c1
|
||||||
&& a.d2 == b.d2
|
// && a.c2 == b.c2
|
||||||
&& a.e1 == b.e1
|
// && a.d1 == b.d1
|
||||||
&& a.e2 == b.e2
|
// && a.d2 == b.d2
|
||||||
&& a.e3 == b.e3
|
// && a.e1 == b.e1
|
||||||
&& a.e4 == b.e4
|
// && a.e2 == b.e2
|
||||||
&& a.e5 == b.e5
|
// && a.e3 == b.e3
|
||||||
&& a.e6 == b.e6;
|
// && a.e4 == b.e4
|
||||||
|
// && a.e5 == b.e5
|
||||||
|
// && a.e6 == b.e6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(UUID a, UUID b)
|
public static bool operator !=(UUID a, UUID b)
|
||||||
|
@ -48,12 +48,12 @@ partial class DistributedConnection
|
|||||||
KeyList<uint, WeakReference<DistributedResource>> suspendedResources = new KeyList<uint, WeakReference<DistributedResource>>();
|
KeyList<uint, WeakReference<DistributedResource>> suspendedResources = new KeyList<uint, WeakReference<DistributedResource>>();
|
||||||
|
|
||||||
KeyList<uint, DistributedResourceAttachRequestInfo> resourceRequests = new KeyList<uint, DistributedResourceAttachRequestInfo>();
|
KeyList<uint, DistributedResourceAttachRequestInfo> resourceRequests = new KeyList<uint, DistributedResourceAttachRequestInfo>();
|
||||||
KeyList<Guid, AsyncReply<TypeTemplate>> templateRequests = new KeyList<Guid, AsyncReply<TypeTemplate>>();
|
KeyList<UUID, AsyncReply<TypeTemplate>> templateRequests = new KeyList<UUID, AsyncReply<TypeTemplate>>();
|
||||||
|
|
||||||
KeyList<string, AsyncReply<TypeTemplate>> templateByNameRequests = new KeyList<string, AsyncReply<TypeTemplate>>();
|
KeyList<string, AsyncReply<TypeTemplate>> templateByNameRequests = new KeyList<string, AsyncReply<TypeTemplate>>();
|
||||||
|
|
||||||
|
|
||||||
Dictionary<Guid, TypeTemplate> templates = new Dictionary<Guid, TypeTemplate>();
|
Dictionary<UUID, TypeTemplate> templates = new Dictionary<UUID, TypeTemplate>();
|
||||||
|
|
||||||
KeyList<uint, AsyncReply> requests = new KeyList<uint, AsyncReply>();
|
KeyList<uint, AsyncReply> requests = new KeyList<uint, AsyncReply>();
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ partial class DistributedConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AsyncReply<object> StaticCall(Guid classId, byte index, Map<byte, object> parameters)
|
public AsyncReply<object> StaticCall(UUID classId, byte index, Map<byte, object> parameters)
|
||||||
{
|
{
|
||||||
var pb = Codec.Compose(parameters, this);// Codec.ComposeVarArray(parameters, this, true);
|
var pb = Codec.Compose(parameters, this);// Codec.ComposeVarArray(parameters, this, true);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
SendParams().AddUInt8((byte)(0x40 | (byte)IIPPacketAction.StaticCall))
|
SendParams().AddUInt8((byte)(0x40 | (byte)IIPPacketAction.StaticCall))
|
||||||
.AddUInt32(c)
|
.AddUInt32(c)
|
||||||
.AddGuid(classId)
|
.AddUUID(classId)
|
||||||
.AddUInt8(index)
|
.AddUInt8(index)
|
||||||
.AddUInt8Array(pb)
|
.AddUInt8Array(pb)
|
||||||
.Done();
|
.Done();
|
||||||
@ -577,7 +577,7 @@ partial class DistributedConnection
|
|||||||
{
|
{
|
||||||
// reply ok
|
// reply ok
|
||||||
SendReply(IIPPacketAction.AttachResource, callback)
|
SendReply(IIPPacketAction.AttachResource, callback)
|
||||||
.AddGuid(r.Instance.Template.ClassId)
|
.AddUUID(r.Instance.Template.ClassId)
|
||||||
.AddUInt64(r.Instance.Age)
|
.AddUInt64(r.Instance.Age)
|
||||||
.AddUInt16((ushort)link.Length)
|
.AddUInt16((ushort)link.Length)
|
||||||
.AddUInt8Array(link)
|
.AddUInt8Array(link)
|
||||||
@ -589,7 +589,7 @@ partial class DistributedConnection
|
|||||||
{
|
{
|
||||||
// reply ok
|
// reply ok
|
||||||
SendReply(IIPPacketAction.AttachResource, callback)
|
SendReply(IIPPacketAction.AttachResource, callback)
|
||||||
.AddGuid(r.Instance.Template.ClassId)
|
.AddUUID(r.Instance.Template.ClassId)
|
||||||
.AddUInt64(r.Instance.Age)
|
.AddUInt64(r.Instance.Age)
|
||||||
.AddUInt16((ushort)link.Length)
|
.AddUInt16((ushort)link.Length)
|
||||||
.AddUInt8Array(link)
|
.AddUInt8Array(link)
|
||||||
@ -1207,7 +1207,7 @@ partial class DistributedConnection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIPRequestTemplateFromClassId(uint callback, Guid classId)
|
void IIPRequestTemplateFromClassId(uint callback, UUID classId)
|
||||||
{
|
{
|
||||||
var t = Warehouse.GetTemplateByClassId(classId);
|
var t = Warehouse.GetTemplateByClassId(classId);
|
||||||
|
|
||||||
@ -1334,7 +1334,7 @@ partial class DistributedConnection
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void IIPRequestStaticCall(uint callback, Guid classId, byte index, TransmissionType transmissionType, byte[] content)
|
void IIPRequestStaticCall(uint callback, UUID classId, byte index, TransmissionType transmissionType, byte[] content)
|
||||||
{
|
{
|
||||||
var template = Warehouse.GetTemplateByClassId(classId);
|
var template = Warehouse.GetTemplateByClassId(classId);
|
||||||
|
|
||||||
@ -2097,7 +2097,7 @@ partial class DistributedConnection
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="classId">Class GUID.</param>
|
/// <param name="classId">Class GUID.</param>
|
||||||
/// <returns>ResourceTemplate.</returns>
|
/// <returns>ResourceTemplate.</returns>
|
||||||
public AsyncReply<TypeTemplate> GetTemplate(Guid classId)
|
public AsyncReply<TypeTemplate> GetTemplate(UUID classId)
|
||||||
{
|
{
|
||||||
if (templates.ContainsKey(classId))
|
if (templates.ContainsKey(classId))
|
||||||
return new AsyncReply<TypeTemplate>(templates[classId]);
|
return new AsyncReply<TypeTemplate>(templates[classId]);
|
||||||
@ -2108,7 +2108,7 @@ partial class DistributedConnection
|
|||||||
templateRequests.Add(classId, reply);
|
templateRequests.Add(classId, reply);
|
||||||
|
|
||||||
SendRequest(IIPPacketAction.TemplateFromClassId)
|
SendRequest(IIPPacketAction.TemplateFromClassId)
|
||||||
.AddGuid(classId)
|
.AddUUID(classId)
|
||||||
.Done()
|
.Done()
|
||||||
.Then((rt) =>
|
.Then((rt) =>
|
||||||
{
|
{
|
||||||
@ -2327,7 +2327,7 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
DistributedResource dr;
|
DistributedResource dr;
|
||||||
TypeTemplate template = null;
|
TypeTemplate template = null;
|
||||||
Guid classId = (Guid)rt[0];
|
UUID classId = (UUID)rt[0];
|
||||||
|
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
@ -2370,7 +2370,7 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
if (template == null)
|
if (template == null)
|
||||||
{
|
{
|
||||||
GetTemplate((Guid)rt[0]).Then((tmp) =>
|
GetTemplate((UUID)rt[0]).Then((tmp) =>
|
||||||
{
|
{
|
||||||
// ClassId, ResourceAge, ResourceLink, Content
|
// ClassId, ResourceAge, ResourceLink, Content
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
|
@ -119,7 +119,7 @@ class IIPPacket : Packet
|
|||||||
public string ResourceLink { get; set; }
|
public string ResourceLink { get; set; }
|
||||||
|
|
||||||
public string ResourceName { get; set; }
|
public string ResourceName { get; set; }
|
||||||
public Guid ClassId { get; set; }
|
public UUID ClassId { get; set; }
|
||||||
public byte MethodIndex { get; set; }
|
public byte MethodIndex { get; set; }
|
||||||
public string MethodName { get; set; }
|
public string MethodName { get; set; }
|
||||||
public uint CallbackId { get; set; }
|
public uint CallbackId { get; set; }
|
||||||
@ -403,7 +403,7 @@ class IIPPacket : Packet
|
|||||||
if (NotEnough(offset, ends, 16))
|
if (NotEnough(offset, ends, 16))
|
||||||
return -dataLengthNeeded;
|
return -dataLengthNeeded;
|
||||||
|
|
||||||
ClassId = data.GetGuid(offset);
|
ClassId = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ class IIPPacket : Packet
|
|||||||
if (NotEnough(offset, ends, 18))
|
if (NotEnough(offset, ends, 18))
|
||||||
return -dataLengthNeeded;
|
return -dataLengthNeeded;
|
||||||
|
|
||||||
ClassId = data.GetGuid(offset);//, Endian.Little);
|
ClassId = data.GetUUID(offset);//, Endian.Little);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
|
|
||||||
MethodIndex = data[offset++];
|
MethodIndex = data[offset++];
|
||||||
@ -615,7 +615,7 @@ class IIPPacket : Packet
|
|||||||
if (NotEnough(offset, ends, 26))
|
if (NotEnough(offset, ends, 26))
|
||||||
return -dataLengthNeeded;
|
return -dataLengthNeeded;
|
||||||
|
|
||||||
ClassId = data.GetGuid(offset);
|
ClassId = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
|
|
||||||
ResourceAge = data.GetUInt64(offset, Endian.Little);
|
ResourceAge = data.GetUInt64(offset, Endian.Little);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Esiur.Data;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@ -9,9 +10,9 @@ struct IIPPacketAttachInfo
|
|||||||
public string Link;
|
public string Link;
|
||||||
public ulong Age;
|
public ulong Age;
|
||||||
public byte[] Content;
|
public byte[] Content;
|
||||||
public Guid ClassId;
|
public UUID ClassId;
|
||||||
|
|
||||||
public IIPPacketAttachInfo(Guid classId, ulong age, string link, byte[] content)
|
public IIPPacketAttachInfo(UUID classId, ulong age, string link, byte[] content)
|
||||||
{
|
{
|
||||||
ClassId = classId;
|
ClassId = classId;
|
||||||
Age = age;
|
Age = age;
|
||||||
|
@ -77,7 +77,7 @@ public static class TemplateGenerator
|
|||||||
rt.AppendLine($"[Annotation({ToLiteral(template.Annotation)})]");
|
rt.AppendLine($"[Annotation({ToLiteral(template.Annotation)})]");
|
||||||
|
|
||||||
|
|
||||||
rt.AppendLine($"[ClassId(\"{template.ClassId.ToByteArray().ToHex(0, 16, null)}\")]");
|
rt.AppendLine($"[ClassId(\"{template.ClassId.Data.ToHex(0, 16, null)}\")]");
|
||||||
rt.AppendLine($"[Export] public class {className} : IRecord {{");
|
rt.AppendLine($"[Export] public class {className} : IRecord {{");
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public static class TemplateGenerator
|
|||||||
if (template.Annotation != null)
|
if (template.Annotation != null)
|
||||||
rt.AppendLine($"[Annotation({ToLiteral(template.Annotation)})]");
|
rt.AppendLine($"[Annotation({ToLiteral(template.Annotation)})]");
|
||||||
|
|
||||||
rt.AppendLine($"[ClassId(\"{template.ClassId.ToByteArray().ToHex(0, 16, null)}\")]");
|
rt.AppendLine($"[ClassId(\"{template.ClassId.Data.ToHex(0, 16, null)}\")]");
|
||||||
rt.AppendLine($"[Export] public enum {className} {{");
|
rt.AppendLine($"[Export] public enum {className} {{");
|
||||||
|
|
||||||
rt.AppendLine(String.Join(",\r\n", template.Constants.Select(x => $"{x.Name}={x.Value}")));
|
rt.AppendLine(String.Join(",\r\n", template.Constants.Select(x => $"{x.Name}={x.Value}")));
|
||||||
@ -126,11 +126,11 @@ public static class TemplateGenerator
|
|||||||
string name;
|
string name;
|
||||||
|
|
||||||
if (representationType.Identifier == RepresentationTypeIdentifier.TypedResource)// == DataType.Resource)
|
if (representationType.Identifier == RepresentationTypeIdentifier.TypedResource)// == DataType.Resource)
|
||||||
name = templates.First(x => x.ClassId == representationType.GUID && (x.Type == TemplateType.Resource)).ClassName;
|
name = templates.First(x => x.ClassId == representationType.UUID && (x.Type == TemplateType.Resource)).ClassName;
|
||||||
else if (representationType.Identifier == RepresentationTypeIdentifier.TypedRecord)
|
else if (representationType.Identifier == RepresentationTypeIdentifier.TypedRecord)
|
||||||
name = templates.First(x => x.ClassId == representationType.GUID && x.Type == TemplateType.Record).ClassName;
|
name = templates.First(x => x.ClassId == representationType.UUID && x.Type == TemplateType.Record).ClassName;
|
||||||
else if (representationType.Identifier == RepresentationTypeIdentifier.Enum)
|
else if (representationType.Identifier == RepresentationTypeIdentifier.Enum)
|
||||||
name = templates.First(x => x.ClassId == representationType.GUID && x.Type == TemplateType.Enum).ClassName;
|
name = templates.First(x => x.ClassId == representationType.UUID && x.Type == TemplateType.Enum).ClassName;
|
||||||
else if (representationType.Identifier == RepresentationTypeIdentifier.TypedList)
|
else if (representationType.Identifier == RepresentationTypeIdentifier.TypedList)
|
||||||
name = GetTypeName(representationType.SubTypes[0], templates) + "[]";
|
name = GetTypeName(representationType.SubTypes[0], templates) + "[]";
|
||||||
else if (representationType.Identifier == RepresentationTypeIdentifier.TypedMap)
|
else if (representationType.Identifier == RepresentationTypeIdentifier.TypedMap)
|
||||||
@ -278,7 +278,7 @@ public static class TemplateGenerator
|
|||||||
rt.AppendLine($"[Annotation({ToLiteral(template.Annotation)})]");
|
rt.AppendLine($"[Annotation({ToLiteral(template.Annotation)})]");
|
||||||
|
|
||||||
|
|
||||||
rt.AppendLine($"[ClassId(\"{template.ClassId.ToByteArray().ToHex(0, 16, null)}\")]");
|
rt.AppendLine($"[ClassId(\"{template.ClassId.Data.ToHex(0, 16, null)}\")]");
|
||||||
|
|
||||||
// extends
|
// extends
|
||||||
if (template.ParentId == null)
|
if (template.ParentId == null)
|
||||||
|
@ -8,12 +8,12 @@ namespace Esiur.Resource
|
|||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum)]
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum)]
|
||||||
public class ClassIdAttribute : Attribute
|
public class ClassIdAttribute : Attribute
|
||||||
{
|
{
|
||||||
public Guid ClassId { get; private set; }
|
public UUID ClassId { get; private set; }
|
||||||
|
|
||||||
public ClassIdAttribute(string classId)
|
public ClassIdAttribute(string classId)
|
||||||
{
|
{
|
||||||
var data = DC.FromHex(classId, null);
|
var data = DC.FromHex(classId, null);
|
||||||
ClassId = new Guid(data);
|
ClassId = new UUID(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ namespace Esiur.Resource.Template;
|
|||||||
public class TypeTemplate
|
public class TypeTemplate
|
||||||
{
|
{
|
||||||
|
|
||||||
protected Guid classId;
|
protected UUID classId;
|
||||||
protected Guid? parentId;
|
protected UUID? parentId;
|
||||||
|
|
||||||
public string Annotation { get; set; }
|
public string Annotation { get; set; }
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class TypeTemplate
|
|||||||
|
|
||||||
protected byte[] content;
|
protected byte[] content;
|
||||||
|
|
||||||
public Guid? ParentId => parentId;
|
public UUID? ParentId => parentId;
|
||||||
|
|
||||||
public byte[] Content
|
public byte[] Content
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ public class TypeTemplate
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid ClassId
|
public UUID ClassId
|
||||||
{
|
{
|
||||||
get { return classId; }
|
get { return classId; }
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ public class TypeTemplate
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Guid GetTypeGuid(Type type)
|
public static UUID GetTypeUUID(Type type)
|
||||||
{
|
{
|
||||||
var attr = type.GetCustomAttribute<ClassIdAttribute>();
|
var attr = type.GetCustomAttribute<ClassIdAttribute>();
|
||||||
if (attr != null)
|
if (attr != null)
|
||||||
@ -170,7 +170,7 @@ public class TypeTemplate
|
|||||||
hash[6] = (byte)((hash[6] & 0xF) | 0x80);
|
hash[6] = (byte)((hash[6] & 0xF) | 0x80);
|
||||||
hash[8] = (byte)((hash[8] & 0xF) | 0x80);
|
hash[8] = (byte)((hash[8] & 0xF) | 0x80);
|
||||||
|
|
||||||
var rt = new Guid(hash);
|
var rt = new UUID(hash);
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ public class TypeTemplate
|
|||||||
className = GetTypeClassName(type);
|
className = GetTypeClassName(type);
|
||||||
|
|
||||||
// set guid
|
// set guid
|
||||||
classId = GetTypeGuid(type);
|
classId = GetTypeUUID(type);
|
||||||
|
|
||||||
if (addToWarehouse)
|
if (addToWarehouse)
|
||||||
Warehouse.PutTemplate(this);
|
Warehouse.PutTemplate(this);
|
||||||
@ -525,7 +525,7 @@ public class TypeTemplate
|
|||||||
var classNameBytes = DC.ToBytes(className);
|
var classNameBytes = DC.ToBytes(className);
|
||||||
|
|
||||||
b.AddUInt8((byte)((hasParent ? 0x80 : 0) | (hasClassAnnotation ? 0x40 : 0x0) | (byte)templateType))
|
b.AddUInt8((byte)((hasParent ? 0x80 : 0) | (hasClassAnnotation ? 0x40 : 0x0) | (byte)templateType))
|
||||||
.AddGuid(classId)
|
.AddUUID(classId)
|
||||||
.AddUInt8((byte)classNameBytes.Length)
|
.AddUInt8((byte)classNameBytes.Length)
|
||||||
.AddUInt8Array(classNameBytes);
|
.AddUInt8Array(classNameBytes);
|
||||||
|
|
||||||
@ -533,8 +533,8 @@ public class TypeTemplate
|
|||||||
{
|
{
|
||||||
// find the first parent type that implements IResource
|
// find the first parent type that implements IResource
|
||||||
ParentDefinedType = ResourceProxy.GetBaseType(type.BaseType);
|
ParentDefinedType = ResourceProxy.GetBaseType(type.BaseType);
|
||||||
var parentId = GetTypeGuid(ParentDefinedType);
|
var parentId = GetTypeUUID(ParentDefinedType);
|
||||||
b.AddGuid(parentId);
|
b.AddUUID(parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasClassAnnotation)
|
if (hasClassAnnotation)
|
||||||
@ -736,7 +736,7 @@ public class TypeTemplate
|
|||||||
|
|
||||||
od.templateType = (TemplateType)(data[offset++] & 0xF);
|
od.templateType = (TemplateType)(data[offset++] & 0xF);
|
||||||
|
|
||||||
od.classId = data.GetGuid(offset);
|
od.classId = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
od.className = data.GetString(offset + 1, data[offset]);
|
od.className = data.GetString(offset + 1, data[offset]);
|
||||||
offset += (uint)data[offset] + 1;
|
offset += (uint)data[offset] + 1;
|
||||||
@ -744,7 +744,7 @@ public class TypeTemplate
|
|||||||
|
|
||||||
if (hasParent)
|
if (hasParent)
|
||||||
{
|
{
|
||||||
od.parentId = data.GetGuid(offset);
|
od.parentId = data.GetUUID(offset);
|
||||||
offset += 16;
|
offset += 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ public static class Warehouse
|
|||||||
static uint resourceCounter = 0;
|
static uint resourceCounter = 0;
|
||||||
|
|
||||||
|
|
||||||
static KeyList<TemplateType, KeyList<Guid, TypeTemplate>> templates
|
static KeyList<TemplateType, KeyList<UUID, TypeTemplate>> templates
|
||||||
= new KeyList<TemplateType, KeyList<Guid, TypeTemplate>>()
|
= new KeyList<TemplateType, KeyList<UUID, TypeTemplate>>()
|
||||||
{
|
{
|
||||||
//[TemplateType.Unspecified] = new KeyList<Guid, TypeTemplate>(),
|
//[TemplateType.Unspecified] = new KeyList<Guid, TypeTemplate>(),
|
||||||
[TemplateType.Resource] = new KeyList<Guid, TypeTemplate>(),
|
[TemplateType.Resource] = new KeyList<UUID, TypeTemplate>(),
|
||||||
[TemplateType.Record] = new KeyList<Guid, TypeTemplate>(),
|
[TemplateType.Record] = new KeyList<UUID, TypeTemplate>(),
|
||||||
//[TemplateType.Wrapper] = new KeyList<Guid, TypeTemplate>(),
|
//[TemplateType.Wrapper] = new KeyList<Guid, TypeTemplate>(),
|
||||||
[TemplateType.Enum] = new KeyList<Guid, TypeTemplate>(),
|
[TemplateType.Enum] = new KeyList<UUID, TypeTemplate>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool warehouseIsOpen = false;
|
static bool warehouseIsOpen = false;
|
||||||
@ -800,7 +800,7 @@ public static class Warehouse
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="classId">Class Id.</param>
|
/// <param name="classId">Class Id.</param>
|
||||||
/// <returns>Resource template.</returns>
|
/// <returns>Resource template.</returns>
|
||||||
public static TypeTemplate GetTemplateByClassId(Guid classId, TemplateType? templateType = null)
|
public static TypeTemplate GetTemplateByClassId(UUID classId, TemplateType? templateType = null)
|
||||||
{
|
{
|
||||||
if (templateType == null)
|
if (templateType == null)
|
||||||
{
|
{
|
||||||
|
@ -56,10 +56,10 @@ namespace Test
|
|||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
static void TestSerialization(object x)
|
static void TestSerialization(object x, DistributedConnection connection = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var y = Codec.Compose(x, null);
|
var y = Codec.Compose(x, connection);
|
||||||
var rr = DC.ToHex(y);
|
var rr = DC.ToHex(y);
|
||||||
|
|
||||||
Console.WriteLine(x.GetType().Name + ": " + rr);
|
Console.WriteLine(x.GetType().Name + ": " + rr);
|
||||||
@ -67,15 +67,25 @@ namespace Test
|
|||||||
|
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public class StudentRecord:IRecord
|
public class StudentRecord : IRecord
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public byte Grade { get; set; }
|
public byte Grade { get; set; }
|
||||||
}
|
}
|
||||||
|
public enum LogLevel : int
|
||||||
|
{
|
||||||
|
Debug,
|
||||||
|
Warning,
|
||||||
|
Error,
|
||||||
|
}
|
||||||
|
|
||||||
static async Task Main(string[] args)
|
static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var x = LogLevel.Warning;
|
||||||
|
|
||||||
|
TestSerialization(LogLevel.Warning);
|
||||||
|
|
||||||
TestSerialization(new Map<string, byte?>
|
TestSerialization(new Map<string, byte?>
|
||||||
{
|
{
|
||||||
["C++"] = 1,
|
["C++"] = 1,
|
||||||
@ -83,14 +93,16 @@ namespace Test
|
|||||||
["JS"] = null
|
["JS"] = null
|
||||||
});
|
});
|
||||||
|
|
||||||
TestSerialization(new StudentRecord() { Name = "Ali", Grade = 90});
|
|
||||||
|
|
||||||
var tn = Encoding.UTF8.GetBytes("MyProject.Tools.Logging.LogRecord");
|
TestSerialization(new StudentRecord() { Name = "Ali", Grade = 90 });
|
||||||
|
|
||||||
|
var tn = Encoding.UTF8.GetBytes("Test.StudentRecord");
|
||||||
var hash = System.Security.Cryptography.SHA256.Create().ComputeHash(tn).Clip(0, 16);
|
var hash = System.Security.Cryptography.SHA256.Create().ComputeHash(tn).Clip(0, 16);
|
||||||
hash[6] = (byte)((hash[6] & 0xF) | 0x80);
|
hash[6] = (byte)((hash[6] & 0xF) | 0x80);
|
||||||
hash[8] = (byte)((hash[8] & 0xF) | 0x80);
|
hash[8] = (byte)((hash[8] & 0xF) | 0x80);
|
||||||
|
|
||||||
var g = new Guid(hash);
|
var g = new UUID(hash);
|
||||||
|
|
||||||
Console.WriteLine(g);
|
Console.WriteLine(g);
|
||||||
|
|
||||||
@ -136,6 +148,8 @@ namespace Test
|
|||||||
var res3 = await Warehouse.Put("sys/service/c1", new MyChildResource() { ChildName = "Child 1", Description = "Child Testing 3", CategoryId = 12 });
|
var res3 = await Warehouse.Put("sys/service/c1", new MyChildResource() { ChildName = "Child 1", Description = "Child Testing 3", CategoryId = 12 });
|
||||||
var res4 = await Warehouse.Put("sys/service/c2", new MyChildResource() { ChildName = "Child 2 Destroy", Description = "Testing Destroy Handler", CategoryId = 12 });
|
var res4 = await Warehouse.Put("sys/service/c2", new MyChildResource() { ChildName = "Child 2 Destroy", Description = "Testing Destroy Handler", CategoryId = 12 });
|
||||||
|
|
||||||
|
TestSerialization(res1);
|
||||||
|
|
||||||
server.MapCall("Hello", (string msg, DateTime time, DistributedConnection sender) =>
|
server.MapCall("Hello", (string msg, DateTime time, DistributedConnection sender) =>
|
||||||
{
|
{
|
||||||
Console.WriteLine(msg);
|
Console.WriteLine(msg);
|
||||||
@ -167,7 +181,7 @@ namespace Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// AuthorizationRequest, AsyncReply<object>
|
// AuthorizationRequest, AsyncReply<object>
|
||||||
static AsyncReply<object> Authenticator(AuthorizationRequest x)
|
static AsyncReply<object> Authenticator(AuthorizationRequest x)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Authenticator: {x.Clue}");
|
Console.WriteLine($"Authenticator: {x.Clue}");
|
||||||
@ -194,7 +208,7 @@ namespace Test
|
|||||||
Authenticator = Authenticator
|
Authenticator = Authenticator
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
dynamic remote = await con.Get("sys/service");
|
dynamic remote = await con.Get("sys/service");
|
||||||
|
|
||||||
var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow);
|
var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user