当前位置: 首页>>代码示例>>C#>>正文


C# GridRegion.ToOSD方法代码示例

本文整理汇总了C#中OpenSim.Services.Interfaces.GridRegion.ToOSD方法的典型用法代码示例。如果您正苦于以下问题:C# GridRegion.ToOSD方法的具体用法?C# GridRegion.ToOSD怎么用?C# GridRegion.ToOSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Services.Interfaces.GridRegion的用法示例。


在下文中一共展示了GridRegion.ToOSD方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterRegion

        public virtual string RegisterRegion (GridRegion regionInfo, UUID SecureSessionID, out UUID SessionID, out List<GridRegion> neighbors)
        {
            neighbors = new List<GridRegion> ();
            OSDMap map = new OSDMap();
            map["Region"] = regionInfo.ToOSD();
            map["SecureSessionID"] = SecureSessionID;
            map["Method"] = "Register";
            
            List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RegistrationURI");
            foreach (string m_ServerURI in serverURIs)
            {
                OSDMap result = WebUtils.PostToService (m_ServerURI + "/grid", map, true, false);
                if (result["Success"].AsBoolean())
                {
                    try
                    {
                        OSD r = OSDParser.DeserializeJson(result["_RawResult"]);
                        if (r is OSDMap)
                        {
                            OSDMap innerresult = (OSDMap)r;
                            if (innerresult["Result"].AsString() == "")
                            {
                                object[] o = new object[2];
                                o[0] = regionInfo;
                                o[1] = innerresult;
                                SessionID = innerresult["SecureSessionID"].AsUUID();
                                m_registry.RequestModuleInterface<IConfigurationService>().AddNewUrls(regionInfo.RegionHandle.ToString(), (OSDMap)innerresult["URLs"]);

                                OSDArray array = (OSDArray)innerresult["Neighbors"];
                                foreach (OSD ar in array)
                                {
                                    GridRegion n = new GridRegion();
                                    n.FromOSD((OSDMap)ar);
                                    neighbors.Add (n);
                                }
                                m_registry.RequestModuleInterface<ISimulationBase> ().EventManager.FireGenericEventHandler ("GridRegionRegistered", o);
                                return "";
                            }
                            else
                            {
                                SessionID = UUID.Zero;
                                return innerresult["Result"].AsString();
                            }
                        }
                    }
                    catch (Exception)//JsonException
                    {
                        m_log.Warn("[GridServiceConnector]: Exception on parsing OSDMap from server, legacy (OpenSim) server?");
                    }
                }
            }
            SessionID = SecureSessionID;
            return OldRegisterRegion(regionInfo);
        }
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:54,代码来源:GridServiceConnector.cs

示例2: RegisterRegion

        public virtual string RegisterRegion(GridRegion regionInfo, UUID SecureSessionID, out UUID SessionID)
        {
            OSDMap map = new OSDMap();
            map["Region"] = regionInfo.ToOSD();
            map["SecureSessionID"] = SecureSessionID;
            map["Method"] = "Register";

            foreach (string m_ServerURI in m_ServerURIs)
            {
                OSDMap result = WebUtils.PostToService(m_ServerURI + "/grid", map);
                if (result["Success"].AsBoolean())
                {
                    try
                    {
                        OSD r = OSDParser.DeserializeJson(result["_RawResult"]);
                        if (r is OSDMap)
                        {
                            OSDMap innerresult = (OSDMap)r;
                            if (innerresult["Result"].AsString() == "")
                            {
                                SessionID = innerresult["SecureSessionID"].AsUUID();
                                return "";
                            }
                            else
                            {
                                SessionID = UUID.Zero;
                                return innerresult["Result"].AsString();
                            }
                        }
                    }
                    catch (Exception)//JsonException
                    {
                        m_log.Warn("[GridServiceConnector]: Exception on parsing OSDMap from server, legacy (OpenSim) server?");
                    }
                }
            } 
            SessionID = UUID.Zero;
            return OldRegisterRegion(regionInfo);
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:39,代码来源:GridServiceConnector.cs

示例3: OnMessageReceived


//.........这里部分代码省略.........
                }
            }
            else if (message["Method"] == "TeleportAgent")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    OSDMap body = ((OSDMap) message["Message"]);

                    GridRegion destination = new GridRegion();
                    destination.FromOSD((OSDMap) body["Region"]);

                    uint TeleportFlags = body["TeleportFlags"].AsUInteger();
                    int DrawDistance = body["DrawDistance"].AsInteger();

                    AgentCircuitData Circuit = new AgentCircuitData();
                    Circuit.UnpackAgentCircuitData((OSDMap) body["Circuit"]);

                    AgentData AgentData = new AgentData();
                    AgentData.Unpack((OSDMap) body["AgentData"]);
                    regionCaps.Disabled = false;
                    string ResponseURL = message["ResponseURL"].AsString();
                    if (ResponseURL == "")
                    {
                        OSDMap result = new OSDMap();
                        string reason = "";
                        result["success"] = TeleportAgent(ref destination, TeleportFlags, DrawDistance,
                                                          Circuit, AgentData, AgentID, requestingRegion, out reason);
                        result["Reason"] = reason;
                        //Remove the region flags, not the regions problem
                        destination.Flags = 0;
                        result["Destination"] = destination.ToOSD(); //Send back the new destination
                        return result;
                    }
                    else
                    {
                        Util.FireAndForget(delegate
                        {
                            OSDMap result = new OSDMap();
                            string reason = "";
                            result["success"] = TeleportAgent(ref destination, TeleportFlags, DrawDistance,
                                                              Circuit, AgentData, AgentID, requestingRegion, out reason);
                            result["Reason"] = reason;
                            //Remove the region flags, not the regions problem
                            destination.Flags = 0;
                            result["Destination"] = destination.ToOSD(); //Send back the new destination
                            WebUtils.PostToService(ResponseURL, result);
                        });
                        return new OSDMap() { new KeyValuePair<string, OSD>("WillHaveResponse", true) };
                    }
                }
            }
            else if (message["Method"] == "CrossAgent")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps == null || rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    //This is a simulator message that tells us to cross the agent
                    OSDMap body = ((OSDMap) message["Message"]);

                    Vector3 pos = body["Pos"].AsVector3();
                    Vector3 Vel = body["Vel"].AsVector3();
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:67,代码来源:AgentProcessing.cs

示例4: GridRegion2WebOSD

 private static OSDMap GridRegion2WebOSD(GridRegion region)
 {
     OSDMap regionOSD = region.ToOSD();
     regionOSD["EstateID"] = Aurora.DataManager.DataManager.RequestPlugin<IEstateConnector>().GetEstateID(region.RegionID);
     return regionOSD;
 }
开发者ID:SignpostMarv,项目名称:Aurora-WebAPI,代码行数:6,代码来源:WebAPIHandler.cs

示例5: UpdateMap

        public virtual string UpdateMap(GridRegion regionInfo, UUID SecureSessionID)
        {
            OSDMap map = new OSDMap();
            map["Region"] = regionInfo.ToOSD();
            map["SecureSessionID"] = SecureSessionID;
            map["Method"] = "UpdateMap";

            List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
            foreach (string m_ServerURI in serverURIs)
            {
                OSDMap result = WebUtils.PostToService (m_ServerURI, map, true, true);
                if (result["Success"].AsBoolean())
                {
                    try
                    {
                        OSDMap innerresult = (OSDMap)result["_Result"];
                        return innerresult["Result"].AsString();
                    }
                    catch
                    {
                    }
                }
            }
            return "Error communicating with grid service";
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:25,代码来源:GridServiceConnector.cs

示例6: UpdateMap

        public virtual string UpdateMap(GridRegion regionInfo, UUID SecureSessionID)
        {
            OSDMap map = new OSDMap();
            map["Region"] = regionInfo.ToOSD();
            map["SecureSessionID"] = SecureSessionID;
            map["Method"] = "UpdateMap";

            foreach (string m_ServerURI in m_ServerURIs)
            {
                OSDMap result = WebUtils.PostToService(m_ServerURI + "/grid", map);
                if (result["Success"].AsBoolean())
                {
                    try
                    {
                        OSDMap innerresult = (OSDMap)result["_Result"];
                        return innerresult["Result"].AsString();
                    }
                    catch
                    {
                    }
                }
            }
            return "Error communicating with grid service";
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:24,代码来源:GridServiceConnector.cs

示例7: LoginAgentToGrid

        public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
        {
            MainConsole.Instance.DebugFormat ("[USER AGENT SERVICE]: Request to login user {0} (@{1}) to grid {2}",
                agentCircuit.AgentID, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString ()), gatekeeper.ServerURI);
            // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
            GridRegion region = new GridRegion ();
            region.FromOSD (gatekeeper.ToOSD ());
            region.ServerURI = gatekeeper.ServerURI;
            region.ExternalHostName = finalDestination.ExternalHostName;
            region.InternalEndPoint = finalDestination.InternalEndPoint;
            region.RegionName = finalDestination.RegionName;
            region.RegionID = finalDestination.RegionID;
            region.RegionLocX = finalDestination.RegionLocX;
            region.RegionLocY = finalDestination.RegionLocY;

            // Generate a new service session
            agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random ();
            TravelingAgentInfo old = UpdateTravelInfo (agentCircuit, region);

            bool success = false;
            string myExternalIP = string.Empty;
            string gridName = gatekeeper.ServerURI;

            MainConsole.Instance.DebugFormat ("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);

            if (m_GridName == gridName)
                success = m_GatekeeperService.LoginAgent (agentCircuit, finalDestination, out reason);
            else
            {
                success = m_GatekeeperConnector.CreateAgent (region, agentCircuit, (uint)TeleportFlags.ViaLogin, out myExternalIP, out reason);
                if (success)
                    // Report them as nowhere with the LOGIN_STATUS_LOCKED so that they don't get logged out automatically after an hour of not responding via HG
                    m_PresenceService.SetLastPosition (agentCircuit.AgentID.ToString (), AgentInfoHelpers.LOGIN_STATUS_LOCKED, Vector3.Zero, Vector3.Zero);
            }

            if (!success)
            {
                MainConsole.Instance.DebugFormat ("[USER AGENT SERVICE]: Unable to login user {0} to grid {1}, reason: {2}",
                    agentCircuit.AgentID, region.ServerURI, reason);

                // restore the old travel info
                lock (m_TravelingAgents)
                {
                    if (old == null)
                        m_TravelingAgents.Remove (agentCircuit.SessionID);
                    else
                        m_TravelingAgents[agentCircuit.SessionID] = old;
                }

                return false;
            }
            else
                reason = "";

            MainConsole.Instance.DebugFormat ("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
            // else set the IP addresses associated with this client
            if (clientIP != null)
                m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString ();
            m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;

            return true;
        }
开发者ID:djphil,项目名称:Aurora-HG-Plugin,代码行数:62,代码来源:UserAgentService.cs

示例8: LoginAgentToGrid

        public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
        {
            m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} (@{1}) to grid {2}", 
                agentCircuit.AgentID, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), 
                gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);

            // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
            GridRegion region = new GridRegion();
            region.FromOSD(gatekeeper.ToOSD());
            region.RegionName = finalDestination.RegionName;
            region.RegionID = finalDestination.RegionID;
            region.RegionLocX = finalDestination.RegionLocX;
            region.RegionLocY = finalDestination.RegionLocY;

            // Generate a new service session
            agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
            TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);

            bool success = false;
            string myExternalIP = string.Empty;
            string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
            if (m_GridName == gridName)
                success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, null, out reason);
            else
                success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);

            if (!success)
            {
                m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} to grid {1}, reason: {2}", 
                    agentCircuit.AgentID, region.ExternalHostName + ":" + region.HttpPort, reason);

                // restore the old travel info
                lock (m_TravelingAgents)
                    m_TravelingAgents[agentCircuit.SessionID] = old;

                return false;
            }

            m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
            // else set the IP addresses associated with this client
            if (clientIP != null)
                m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString();
            m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;
            return true;
        }
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:45,代码来源:UserAgentService.cs


注:本文中的OpenSim.Services.Interfaces.GridRegion.ToOSD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。