예제 #1
0
        public void Check()
        {
            foreach (IXMLRPC xmlrpc in m_modules)
            {
                if (xmlrpc == null)
                {
                    return;
                }
                RPCRequestInfo        rInfo   = (RPCRequestInfo)xmlrpc.GetNextCompletedRequest();
                SendRemoteDataRequest srdInfo = (SendRemoteDataRequest)xmlrpc.GetNextCompletedSRDRequest();

                if (rInfo == null && srdInfo == null)
                {
                    return;
                }

                while (rInfo != null)
                {
                    xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID());

                    //Deliver data to prim's remote_data handler
                    object[] resobj = new object[]
                    {
                        new LSL_Types.LSLInteger(2),
                        new LSL_Types.LSLString(
                            rInfo.GetChannelKey().ToString()),
                        new LSL_Types.LSLString(
                            rInfo.GetMessageID().ToString()),
                        new LSL_Types.LSLString(String.Empty),
                        new LSL_Types.LSLInteger(rInfo.GetIntValue()),
                        new LSL_Types.LSLString(rInfo.GetStrVal())
                    };

                    m_ScriptEngine.PostScriptEvent(
                        rInfo.GetItemID(), rInfo.GetPrimID(), new EventParams(
                            "remote_data", resobj,
                            new DetectParams[0]), EventPriority.Suspended);

                    rInfo = (RPCRequestInfo)xmlrpc.GetNextCompletedRequest();
                }

                while (srdInfo != null)
                {
                    xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());

                    //Deliver data to prim's remote_data handler
                    object[] resobj = new object[]
                    {
                        new LSL_Types.LSLInteger(3),
                        new LSL_Types.LSLString(srdInfo.Channel.ToString()),
                        new LSL_Types.LSLString(srdInfo.GetReqID().ToString()),
                        new LSL_Types.LSLString(String.Empty),
                        new LSL_Types.LSLInteger(srdInfo.Idata),
                        new LSL_Types.LSLString(srdInfo.Sdata)
                    };

                    m_ScriptEngine.PostScriptEvent(
                        srdInfo.ItemID, srdInfo.PrimID, new EventParams(
                            "remote_data", resobj,
                            new DetectParams[0]), EventPriority.Suspended);

                    srdInfo = (SendRemoteDataRequest)xmlrpc.GetNextCompletedSRDRequest();
                }
            }
        }
예제 #2
0
        public void CheckXMLRPCRequests()
        {
            if (m_CmdManager.m_ScriptEngine.World == null)
            {
                return;
            }

            IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface <IXMLRPC>();

            if (xmlrpc != null)
            {
                RPCRequestInfo rInfo = (RPCRequestInfo)xmlrpc.GetNextCompletedRequest();

                while (rInfo != null)
                {
                    xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID());

                    //Deliver data to prim's remote_data handler
                    object[] resobj = new object[]
                    {
                        new LSL_Types.LSLInteger(2),
                        new LSL_Types.LSLString(
                            rInfo.GetChannelKey().ToString()),
                        new LSL_Types.LSLString(
                            rInfo.GetMessageID().ToString()),
                        new LSL_Types.LSLString(String.Empty),
                        new LSL_Types.LSLInteger(rInfo.GetIntValue()),
                        new LSL_Types.LSLString(rInfo.GetStrVal())
                    };

                    foreach (IScriptEngine e in m_CmdManager.ScriptEngines)
                    {
                        if (e.PostScriptEvent(
                                rInfo.GetItemID(), new EventParams(
                                    "remote_data", resobj,
                                    new DetectParams[0])))
                        {
                            break;
                        }
                    }

                    rInfo = (RPCRequestInfo)xmlrpc.GetNextCompletedRequest();
                }

                SendRemoteDataRequest srdInfo = (SendRemoteDataRequest)xmlrpc.GetNextCompletedSRDRequest();

                while (srdInfo != null)
                {
                    xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());

                    //Deliver data to prim's remote_data handler
                    object[] resobj = new object[]
                    {
                        new LSL_Types.LSLInteger(3),
                        new LSL_Types.LSLString(srdInfo.Channel.ToString()),
                        new LSL_Types.LSLString(srdInfo.GetReqID().ToString()),
                        new LSL_Types.LSLString(String.Empty),
                        new LSL_Types.LSLInteger(srdInfo.Idata),
                        new LSL_Types.LSLString(srdInfo.Sdata)
                    };

                    foreach (IScriptEngine e in m_CmdManager.ScriptEngines)
                    {
                        if (e.PostScriptEvent(
                                srdInfo.ItemID, new EventParams(
                                    "remote_data", resobj,
                                    new DetectParams[0])))
                        {
                            break;
                        }
                    }

                    srdInfo = (SendRemoteDataRequest)xmlrpc.GetNextCompletedSRDRequest();
                }
            }
        }