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


C# RegionInfo.WriteNiniConfig方法代码示例

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


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

示例1: ReadNiniConfig


//.........这里部分代码省略.........
                {
                    if(int.TryParse(MainConsole.Instance.Prompt("Region Y Size for region " + name, "256"), out regionSizeY))
                        break;
                }
                config.Set("RegionSizeY", regionSizeY);
            }
            region.RegionSizeY = regionSizeY;

            int regionSizeZ = config.GetInt("RegionSizeZ", 1024);
            //if (regionSizeZ == String.Empty)
            //{
            //    NeedsUpdate = true;
            //    regionSizeZ = MainConsole.Instance.CmdPrompt("Region Z Size for region " + name, "1024");
            //    config.Set("RegionSizeZ", regionSizeZ);
            //}
            region.RegionSizeZ = regionSizeZ;

            // Internal IP
            IPAddress address;

            if (config.Contains("InternalAddress"))
            {
                address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
            }
            else
            {
                NeedsUpdate = true;
                address = IPAddress.Parse(MainConsole.Instance.Prompt("Internal IP address for region " + name, "0.0.0.0"));
                config.Set("InternalAddress", address.ToString());
            }

            int port;

            if (config.Contains("InternalPort"))
            {
                port = config.GetInt("InternalPort", 9000);
            }
            else
            {
                NeedsUpdate = true;
                port = Convert.ToInt32(MainConsole.Instance.Prompt("Internal port for region " + name, "9000"));
                config.Set("InternalPort", port);
            }
            region.UDPPorts.Add (port);
            region.InternalEndPoint = new IPEndPoint(address, port);

            // External IP
            //
            string externalName;
            if (config.Contains("ExternalHostName"))
            {
                //Let's know our external IP (by Enrico Nirvana)
                externalName = config.GetString("ExternalHostName", Aurora.Framework.Utilities.GetExternalIp());
            }
            else
            {
                NeedsUpdate = true;
                //Let's know our external IP (by Enrico Nirvana)
                externalName = MainConsole.Instance.Prompt("External host name for region " + name, Aurora.Framework.Utilities.GetExternalIp());
                config.Set("ExternalHostName", externalName);
                //ended here (by Enrico Nirvana)
            }

            region.RegionType = config.GetString("RegionType", region.RegionType);

            if (region.RegionType == String.Empty)
            {
                NeedsUpdate = true;
                region.RegionType = MainConsole.Instance.Prompt("Region Type for region " + name, "Mainland");
                config.Set("RegionType", region.RegionType);
            }

            region.AllowPhysicalPrims = config.GetBoolean("AllowPhysicalPrims", region.AllowPhysicalPrims);

            region.AllowScriptCrossing = config.GetBoolean("AllowScriptCrossing", region.AllowScriptCrossing);

            region.TrustBinariesFromForeignSims = config.GetBoolean("TrustBinariesFromForeignSims", region.TrustBinariesFromForeignSims);

            region.SeeIntoThisSimFromNeighbor = config.GetBoolean("SeeIntoThisSimFromNeighbor", region.SeeIntoThisSimFromNeighbor);

            region.ObjectCapacity = config.GetInt ("MaxPrims", region.ObjectCapacity);

            region.Startup = (StartupType)Enum.Parse(typeof(StartupType), config.GetString ("StartupType", region.Startup.ToString()));


            // Multi-tenancy
            //
            region.ScopeID = new UUID(config.GetString("ScopeID", region.ScopeID.ToString()));

            //Do this last so that we can save the password immediately if it doesn't exist
            UUID password = region.Password; //Save the pass as this TryParse will wipe it out
            if (!UUID.TryParse(config.GetString("NeighborPassword", ""), out region.Password))
            {
                region.Password = password;
                config.Set("NeighborPassword", password);
                region.WriteNiniConfig(source);
            }

            return NeedsUpdate;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:101,代码来源:RegionLoaderFileBasePlugin.cs


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