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


C# RegionInfo.WriteNiniConfig方法代码示例

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


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

示例1: ReadNiniConfig


//.........这里部分代码省略.........
            else
            {
                NeedsUpdate = true;
                address = IPAddress.Parse(MainConsole.Instance.CmdPrompt("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.CmdPrompt("Internal port for region " + name, "9000"));
                config.Set("InternalPort", port);
            }

            region.InternalEndPoint = new IPEndPoint(address, port);

            if (config.Contains("AllowAlternatePorts"))
            {
                region.m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
            }
            else
            {
                NeedsUpdate = true;
                region.m_allow_alternate_ports = Convert.ToBoolean(MainConsole.Instance.CmdPrompt("Allow alternate ports", "False"));

                config.Set("AllowAlternatePorts", region.m_allow_alternate_ports.ToString());
            }

            // External IP
            //
            string externalName;
            //Let's know our external IP (by Enrico Nirvana)
            WebClient client = new WebClient();
            string myIP = client.DownloadString("http://www.whatismyip.com/automation/n09230945.asp");
            MainConsole.Instance.Output("Your External ip is:" + myIP);
            //ended here (by Enrico Nirvana)
            if (config.Contains("ExternalHostName"))
            {
                externalName = config.GetString("ExternalHostName", "SYSTEMIP");
            }
            else
            {
                NeedsUpdate = true;
                externalName = MainConsole.Instance.CmdPrompt("External host name for region " + name, "SYSTEMIP");
                config.Set("ExternalHostName", externalName);
            }

            if (externalName == "SYSTEMIP")
            {
                region.ExternalHostName = Util.GetLocalHost().ToString();
                m_log.InfoFormat(
                    "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
                    region.ExternalHostName, name);
            }
            else
            {
                region.ExternalHostName = Util.ResolveEndPoint(externalName, port).Address.ToString();
            }

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

            if (region.RegionType == String.Empty)
            {
                NeedsUpdate = true;
                region.RegionType = MainConsole.Instance.CmdPrompt("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);


            // 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:mugginsm,项目名称:Aurora-Sim,代码行数:101,代码来源:RegionLoaderFileBasePlugin.cs


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