2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-03 09:48:21 +00:00
This commit is contained in:
2019-12-02 03:29:30 +03:00
parent 5886cbbdac
commit 9c15b830dd
16 changed files with 298 additions and 30 deletions

View File

@@ -341,14 +341,18 @@ class DistributedConnection extends NetworkConnection with IStore
if (rt <= 0)
{
// print("hold");
var size = ends - offset;
data.holdFor(msg, offset, size, size - rt);
return ends;
}
else
{
//print("CMD ${packet.command} ${offset} ${ends}");
offset += rt;
if (packet.command == IIPPacketCommand.Event)
{
switch (packet.event)
@@ -2158,15 +2162,23 @@ class DistributedConnection extends NetworkConnection with IStore
var reply = new AsyncReply<DistributedResource>();
_resourceRequests.add(id, reply);
//print("fetch ${id}");
sendRequest(IIPPacketAction.AttachResource)
.addUint32(id)
.done()
.then((rt)
{
//print("fetched ${id}");
var dr = new DistributedResource(this, id, rt[1], rt[2]);
getTemplate(rt[0] as Guid).then((tmp)
{
//print("New template ");
// ClassId, ResourceAge, ResourceLink, Content
Warehouse.put(dr, id.toString(), this, null, tmp);
@@ -2174,6 +2186,7 @@ class DistributedConnection extends NetworkConnection with IStore
Codec.parsePropertyValueArray(d, 0, d.length, this).then((ar)
{
//print("attached");
dr.attached(ar);
_resourceRequests.remove(id);
reply.trigger(dr);

View File

@@ -80,7 +80,7 @@ class DistributedResource extends IResource
/// <summary>
/// Resource is attached when all its properties are received.
/// </summary>
bool get IsAttached => _isAttached;
bool get isAttached => _isAttached;
// public DistributedResourceStack Stack
@@ -185,6 +185,19 @@ class DistributedResource extends IResource
return connection.sendInvokeByArrayArguments(_instanceId, index, args);
}
operator [](String index)
{
var pt = instance.template.getPropertyTemplateByName(index);
if (pt != null)
return get(pt.index);
}
operator []=(String index, value)
{
var pt = instance.template.getPropertyTemplateByName(index);
if (pt != null)
set(pt.index, value);
}
String _getMemberName(Symbol symbol)
{