コード例 #1
0
        public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
        {
            agent = null;
            // Try local first
            if (m_localBackend.RetrieveAgent(destination, id, out agent))
            {
                return(true);
            }

            // else do the remote thing
            if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
            {
                // Eventually, we want to use a caps url instead of the agentID
                string uri = MakeUri(destination, true) + id + "/" + destination.RegionID.ToString() + "/";

                try
                {
                    OSDMap result = WebUtils.GetFromService(uri);
                    if (result["Success"].AsBoolean())
                    {
                        agent = new AgentData();
                        agent.Unpack(result);
                        return(true);
                    }
                }
                catch (Exception e)
                {
                    m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString());
                }

                return(false);
            }

            return(false);
        }
コード例 #2
0
        public bool RetrieveAgent(GridRegion destination, UUID id, bool agentIsLeaving, out AgentData agent,
                                  out AgentCircuitData circuitData)
        {
            agent = null;
            // Try local first
            if (m_localBackend.RetrieveAgent(destination, id, agentIsLeaving, out agent, out circuitData))
            {
                return(true);
            }

            // else do the remote thing
            if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
            {
                // Eventually, we want to use a caps url instead of the agentID
                string uri = MakeUri(destination, true) + id + "/" + destination.RegionID.ToString() + "/" +
                             agentIsLeaving.ToString() + "/";

                try
                {
                    string resultStr = WebUtils.GetFromService(uri);
                    if (resultStr != "")
                    {
                        OSDMap result = OSDParser.DeserializeJson(resultStr) as OSDMap;
                        if (result["Result"] == "Not Found")
                        {
                            return(false);
                        }
                        agent = new AgentData();

                        if (!result.ContainsKey("AgentData"))
                        {
                            return(false); //Disable old simulators
                        }
                        agent.Unpack((OSDMap)result["AgentData"]);
                        circuitData = new AgentCircuitData();
                        circuitData.UnpackAgentCircuitData((OSDMap)result["CircuitData"]);
                        return(true);
                    }
                }
                catch (Exception e)
                {
                    MainConsole.Instance.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e);
                }

                return(false);
            }

            return(false);
        }