當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。