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


C# RegionInfo.PackRegionInfoData方法代码示例

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


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

示例1: UpdateRegionInfo

 public void UpdateRegionInfo(RegionInfo region)
 {
     List<object> Values = new List<object>();
     Values.Add(region.RegionID);
     Values.Add(region.RegionName);
     Values.Add(OSDParser.SerializeJsonString(region.PackRegionInfoData(true)));
     Values.Add(region.Disabled ? 1 : 0);
     GD.Replace("simulator", new string[]{"RegionID","RegionName",
         "RegionInfo","Disabled"}, Values.ToArray());
 }
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:10,代码来源:LocalRegionInfoConnector.cs

示例2: UpdateRegionInfo

 public void UpdateRegionInfo(RegionInfo region)
 {
     RegionInfo oldRegion = GetRegionInfo(region.RegionID);
     if (oldRegion != null)
     {
         m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("RegionInfoChanged", new[] 
         {
             oldRegion,
             region
         });
     }
     List<object> Values = new List<object>
                               {
                                   region.RegionID,
                                   region.RegionName.MySqlEscape(50),
                                   OSDParser.SerializeJsonString(region.PackRegionInfoData(true)),
                                   region.Disabled ? 1 : 0
                               };
     GD.Replace("simulator", new[]{"RegionID","RegionName",
         "RegionInfo","Disabled"}, Values.ToArray());
 }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:21,代码来源:LocalRegionInfoConnector.cs

示例3: UpdateRegionInfo

        public void UpdateRegionInfo(string oldName, RegionInfo regionInfo)
        {
            IRegionInfoConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IRegionInfoConnector>();
            if (connector != null)
            {
                //Make sure we have this region in the database
                if (connector.GetRegionInfo(oldName, false) == null)
                    return;
                RegionInfo copy = new RegionInfo();
                //Make an exact copy
                copy.UnpackRegionInfoData(regionInfo.PackRegionInfoData(true));

                //Fix the name of the region so we can delete the old one
                copy.RegionName = oldName;
                DeleteRegion(copy);
                //Now add the new one
                connector.UpdateRegionInfo(regionInfo);
            }
        }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:19,代码来源:RegionLoaderDataBaseSystem.cs

示例4: DoHelloNeighbourCall

        public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion)
        {
            string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/";
            //m_log.Debug("   >>> DoHelloNeighbourCall <<< " + uri);

            WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
            HelloNeighbourRequest.Method = "POST";
            HelloNeighbourRequest.ContentType = "application/json";
            HelloNeighbourRequest.Timeout = 10000;

            // Fill it in
            OSDMap args = null;
            try
            {
                args = thisRegion.PackRegionInfoData();
            }
            catch (Exception e)
            {
                m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message);
            }
            // Add the regionhandle of the destination region
            ulong regionHandle = GetRegionHandle(region.RegionHandle);
            args["destination_handle"] = OSD.FromString(regionHandle.ToString());

            string strBuffer = "";
            byte[] buffer = new byte[1];
            try
            {
                strBuffer = OSDParser.SerializeJsonString(args);
                Encoding str = Util.UTF8;
                buffer = str.GetBytes(strBuffer);

            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message);
                // ignore. buffer will be empty, caller should check.
            }

            Stream os = null;
            try
            { // send the Post
                HelloNeighbourRequest.ContentLength = buffer.Length;   //Count bytes to send
                os = HelloNeighbourRequest.GetRequestStream();
                os.Write(buffer, 0, strBuffer.Length);         //Send it
                //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
            }
            //catch (WebException ex)
            catch
            {
                //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message);

                return false;
            }
            finally
            {
                if (os != null)
                    os.Close();
            }
            // Let's wait for the response
            //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall");

            StreamReader sr = null;
            try
            {
                WebResponse webResponse = HelloNeighbourRequest.GetResponse();
                if (webResponse == null)
                {
                    m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post");
                }

                sr = new StreamReader(webResponse.GetResponseStream());
                //reply = sr.ReadToEnd().Trim();
                sr.ReadToEnd().Trim();
                //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);

            }
            catch (WebException ex)
            {
                m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message);
                // ignore, really
            }
            finally
            {
                if (sr != null)
                    sr.Close();
            }

            return true;

        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:91,代码来源:RegionClient.cs


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