2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00

Static Calling

This commit is contained in:
2022-08-07 23:09:31 +03:00
parent 0dc457bf7e
commit af94ce318a
18 changed files with 784 additions and 259 deletions

View File

@ -222,9 +222,8 @@ public class DistributedResource : DynamicObject, IResource
public AsyncReply<object> _Invoke(byte index, Map<byte, object> args)
{
if (destroyed)
throw new Exception("Trying to access destroyed object");
throw new Exception("Trying to access a destroyed object");
if (suspended)
throw new Exception("Trying to access suspended object");
@ -232,11 +231,17 @@ public class DistributedResource : DynamicObject, IResource
if (index >= Instance.Template.Functions.Length)
throw new Exception("Function index is incorrect");
var ft = Instance.Template.GetFunctionTemplateByIndex(index);
return connection.SendInvoke(instanceId, index, args);
if (ft == null)
throw new Exception("Function template not found.");
if (ft.IsStatic)
return connection.StaticCall(Instance.Template.ClassId, index, args);
else
return connection.SendInvoke(instanceId, index, args);
}
public AsyncReply Listen(EventTemplate et)
{
if (et == null)