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


C# GridRegion.FromKVP方法代码示例

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


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

示例1: GetFallbackRegions

        public List<GridRegion> GetFallbackRegions(List<UUID> scopeIDs, int x, int y)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["SCOPEID"] = GetScopeID(scopeIDs);
            sendData["X"] = x.ToString();
            sendData["Y"] = y.ToString();

            sendData["METHOD"] = "get_fallback_regions";

            List<GridRegion> rinfos = new List<GridRegion>();
            string reply = string.Empty;
            List<string> serverURIs =
                m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
            foreach (string uri in serverURIs)
            {
                try
                {
                    reply = SynchronousRestFormsRequester.MakeRequest("POST",
                            uri,
                            WebUtils.BuildQueryString(sendData));

                    //MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
                }
                catch (Exception e)
                {
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
                    return rinfos;
                }

                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if (replyData != null)
                    {
                        Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
                        foreach (object r in rinfosList)
                        {
                            if (r is Dictionary<string, object>)
                            {
                                GridRegion rinfo = new GridRegion();
                                rinfo.FromKVP((Dictionary<string, object>)r);
                                rinfos.Add(rinfo);
                            }
                        }
                    }
                    else
                        MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions {0}-{1} received null response",
                            x, y);
                }
                else
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions received null reply");
            }

            return FixGridRegions(rinfos);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:57,代码来源:RobustGridServiceConnector.cs

示例2: GetNeighbors

        public List<GridRegion> GetNeighbors(List<UUID> scopeIDs, GridRegion region)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["SCOPEID"] = region.ScopeID.ToString();
            sendData["REGIONID"] = region.RegionID.ToString();

            sendData["METHOD"] = "get_neighbours";

            List<GridRegion> rinfos = new List<GridRegion>();

            string reqString = WebUtils.BuildQueryString(sendData);
            string reply = string.Empty;
            List<string> serverURIs =
                m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
            foreach (string uri in serverURIs)
            {
                try
                {
                    reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
                }
                catch (Exception e)
                {
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
                    return rinfos;
                }

                Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                if (replyData != null)
                {
                    Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
                    //MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
                    foreach (object r in rinfosList)
                    {
                        if (r is Dictionary<string, object>)
                        {
                            GridRegion rinfo = new GridRegion();
                            rinfo.FromKVP((Dictionary<string, object>)r);
                            rinfos.Add(rinfo);
                        }
                    }
                }
                else
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received null response",
                        region.ScopeID, region.RegionID);
            }

            return FixGridRegions(rinfos);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:50,代码来源:RobustGridServiceConnector.cs

示例3: GetRegionByName

        public GridRegion GetRegionByName(List<UUID> scopeIDs, string regionName)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["SCOPEID"] = GetScopeID(scopeIDs);
            sendData["NAME"] = regionName;

            sendData["METHOD"] = "get_region_by_name";
            string reply = string.Empty;
            List<string> serverURIs =
                m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
            foreach (string uri in serverURIs)
            {
                try
                {
                    reply = SynchronousRestFormsRequester.MakeRequest("POST",
                            uri,
                            WebUtils.BuildQueryString(sendData));
                }
                catch (Exception e)
                {
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
                    return null;
                }

                GridRegion rinfo = null;
                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if ((replyData != null) && (replyData["result"] != null))
                    {
                        if (replyData["result"] is Dictionary<string, object>)
                        {
                            rinfo = new GridRegion();
                            rinfo.FromKVP((Dictionary<string, object>)replyData["result"]);
                            return FixGridRegion(rinfo);
                        }
                    }
                    else
                        MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0} received null response",
                            regionName);
                }
                else
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply");
            }

            return null;
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:49,代码来源:RobustGridServiceConnector.cs

示例4: GetRegionsByName

        public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["SCOPEID"] = scopeID.ToString();
            sendData["NAME"] = name;
            sendData["MAX"] = maxNumber.ToString();

            sendData["METHOD"] = "get_regions_by_name";
            List<GridRegion> rinfos = new List<GridRegion>();
            string reply = string.Empty;
            List<string> serverURIs =
                m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
            foreach (string uri in serverURIs)
            {
                try
                {
                    reply = SynchronousRestFormsRequester.MakeRequest("POST",
                            uri,
                            WebUtils.BuildQueryString(sendData));
                }
                catch (Exception e)
                {
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
                    return rinfos;
                }

                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if (replyData != null)
                    {
                        Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
                        foreach (object r in rinfosList)
                        {
                            if (r is Dictionary<string, object>)
                            {
                                GridRegion rinfo = new GridRegion();
                                rinfo.FromKVP((Dictionary<string, object>)r);
                                rinfos.Add(rinfo);
                            }
                        }
                    }
                    else
                        MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response",
                            scopeID, name, maxNumber);
                }
                else
                    MainConsole.Instance.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply");
            }

            return FixGridRegions(rinfos);
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:54,代码来源:RobustGridServiceConnector.cs


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