Exemplo n.º 1
0
        public void HandleClientFunctionCall(SyncIOConnectedClient client, RemoteCallRequest reqst)
        {
            lock (SyncLock)
            {
                var respPacket = new RemoteCallResponse(reqst.CallId, reqst.Name);

                if (FunctionLookup.ContainsKey(reqst.Name))
                {
                    var func = FunctionLookup[reqst.Name];

                    for (int i = 0; i < reqst.Args.Length; i++)
                    {
                        var argType = reqst.Args[i].GetType();
                        if (!BindableTypes.ContainsKey(argType) || !func.ValidParameter(i, BindableTypes[argType]))
                        {
                            respPacket.Response = FunctionResponseStatus.InvalidParameters;
                            client.Send(respPacket);
                            return;
                        }
                    }

                    func.Invoke(client, respPacket, reqst.Args);
                }
                else
                {
                    respPacket.Response = FunctionResponseStatus.DoesNotExist;
                }

                client.Send(respPacket);
            }
        }
Exemplo n.º 2
0
        public void HandleClientFunctionCall(SecureSocketConnectedClient client, RemoteCallRequest request)
        {
            lock (_syncLock) {
                RemoteCallResponse respPacket = new RemoteCallResponse(request.CallId, request.Name);

                if (_functionLookup.ContainsKey(request.Name))
                {
                    RemoteFunctionBind func = _functionLookup[request.Name];

                    if (request.Args.Select(t => t.GetType()).Where((argType, i) => !_bindableTypes.ContainsKey(argType) || !func.ValidParameter(i, _bindableTypes[argType])).Any())
                    {
                        respPacket.Response = RemoteFunctionStatus.InvalidParameters;
                        client.Send(respPacket);
                        return;
                    }

                    func.Invoke(client, respPacket, request.Args);
                }
                else
                {
                    respPacket.Response = RemoteFunctionStatus.DoesNotExist;
                }

                client.Send(respPacket);
            }
        }