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


C# ISimulationBase.GetHttpServer方法代码示例

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


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

示例1: Initialize

        public void Initialize(ISimulationBase openSim)
        {
            IConfig handlerConfig = openSim.ConfigSource.Configs["ApplicationPlugins"];
            if (handlerConfig.GetString("RemoteAdminPlugin", "") != Name)
                return;

            m_configSource = openSim.ConfigSource;
            try
            {
                if (m_configSource.Configs["RemoteAdmin"] == null ||
                    !m_configSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
                {
                    // No config or disabled
                }
                else
                {
                    m_enabled = true;
                    m_config = m_configSource.Configs["RemoteAdmin"];
                    m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
                    m_requiredPassword = m_config.GetString("access_password", String.Empty);
                    int port = m_config.GetInt("port", 0);

                    m_application = openSim;
                    m_httpServer = m_application.GetHttpServer((uint)port);

                    Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>();
                    availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod;
                    availableMethods["admin_delete_region"] = XmlRpcDeleteRegionMethod;
                    availableMethods["admin_close_region"] = XmlRpcCloseRegionMethod;
                    availableMethods["admin_modify_region"] = XmlRpcModifyRegionMethod;
                    availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod;
                    availableMethods["admin_shutdown"] = XmlRpcShutdownMethod;
                    availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
                    availableMethods["admin_restart"] = XmlRpcRestartMethod;
                    availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
                    // User management
                    availableMethods["admin_create_user"] = XmlRpcCreateUserMethod;
                    availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod;
                    availableMethods["admin_exists_user"] = XmlRpcUserExistsMethod;
                    availableMethods["admin_update_user"] = XmlRpcUpdateUserAccountMethod;
                    // Region state management
                    availableMethods["admin_load_xml"] = XmlRpcLoadXMLMethod;
                    availableMethods["admin_save_xml"] = XmlRpcSaveXMLMethod;
                    availableMethods["admin_load_oar"] = XmlRpcLoadOARMethod;
                    availableMethods["admin_save_oar"] = XmlRpcSaveOARMethod;
                    // Estate access list management
                    availableMethods["admin_acl_clear"] = XmlRpcAccessListClear;
                    availableMethods["admin_acl_add"] = XmlRpcAccessListAdd;
                    availableMethods["admin_acl_remove"] = XmlRpcAccessListRemove;
                    availableMethods["admin_acl_list"] = XmlRpcAccessListList;

                    // Either enable full remote functionality or just selected features
                    string enabledMethods = m_config.GetString("enabled_methods", "all");

                    // To get this, you must explicitly specify "all" or
                    // mention it in a whitelist. It won't be available
                    // If you just leave the option out!
                    //
                    if (!String.IsNullOrEmpty(enabledMethods))
                        availableMethods["admin_console_command"] = XmlRpcConsoleCommandMethod;

                    // The assumption here is that simply enabling Remote Admin as before will produce the same
                    // behavior - enable all methods unless the whitelist is in place for backward-compatibility.
                    if (enabledMethods.ToLower() == "all" || String.IsNullOrEmpty(enabledMethods))
                    {
                        foreach (string method in availableMethods.Keys)
                        {
                            m_httpServer.AddXmlRPCHandler(method, availableMethods[method], false);
                        }
                    }
                    else
                    {
                        foreach (string enabledMethod in enabledMethods.Split('|'))
                        {
                            m_httpServer.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]);
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                // Ignore.
            }
        }
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:84,代码来源:RemoteAdminPlugin.cs

示例2: RegionLoaded

        public void RegionLoaded (IScene scene)
        {
            if (!m_Enabled)
                return;

            m_Generator = scene.RequestModuleInterface<IMapImageGenerator> ();
            if (m_Generator == null) {
                m_Enabled = false;
                return;
            }

            simulationBase = scene.RequestModuleInterface<ISimulationBase> ();
            if (simulationBase != null) {
                // verify cache path
                if (m_cacheEnabled) {
                    if (m_assetCacheDir == "") {
                        var defpath = simulationBase.DefaultDataPath;
                        m_assetCacheDir = Path.Combine (defpath, Constants.DEFAULT_ASSETCACHE_DIR);
                    }
                    CreateCacheDirectories (m_assetCacheDir);
                }

                IHttpServer server = simulationBase.GetHttpServer (0);
                server.AddStreamHandler (new WorldViewRequestHandler (this,
                        scene.RegionInfo.RegionID.ToString ()));
                MainConsole.Instance.Info ("[World view]: Configured and enabled for " + scene.RegionInfo.RegionName);
                MainConsole.Instance.Info ("[World view]: RegionID " + scene.RegionInfo.RegionID);
            }
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:29,代码来源:WorldViewModule.cs

示例3: Initialize

        public override void Initialize(IConfigSource source, ISimulationBase baseOpenSim)
        {
            uint m_consolePort = 0;

            if (source.Configs["Console"] != null)
            {
                if (source.Configs["Console"].GetString("Console", String.Empty) != Name)
                    return;
                m_consolePort = (uint) source.Configs["Console"].GetInt("remote_console_port", 0);
                m_UserName = source.Configs["Console"].GetString("RemoteConsoleUser", String.Empty);
                m_Password = source.Configs["Console"].GetString("RemoteConsolePass", String.Empty);
            }
            else
                return;

            baseOpenSim.ApplicationRegistry.RegisterModuleInterface<ICommandConsole>(this);
            MainConsole.Instance = this;

            SetServer(m_consolePort == 0 ? MainServer.Instance : baseOpenSim.GetHttpServer(m_consolePort));

            m_Commands.AddCommand("help", "help",
                                  "Get a general command list", base.Help);
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:23,代码来源:RemoteConsole.cs

示例4: Initialize

        public override void Initialize(string defaultPrompt, IConfigSource source, ISimulationBase baseOpenSim)
        {
            m_Config = source;
            uint m_consolePort = 0;

            if (source.Configs["Console"] != null)
            {
                if (source.Configs["Console"].GetString("Console", String.Empty) != Name)
                    return;
                m_consolePort = (uint)source.Configs["Console"].GetInt("remote_console_port", 0);
                m_UserName = source.Configs["Console"].GetString("RemoteConsoleUser", String.Empty);
                m_Password = source.Configs["Console"].GetString("RemoteConsolePass", String.Empty);
            }
            else
                return;

            baseOpenSim.ApplicationRegistry.RegisterModuleInterface<ICommandConsole>(this);

            if (m_consolePort == 0)
                SetServer(MainServer.Instance);
            else
                SetServer(baseOpenSim.GetHttpServer(m_consolePort));

            m_Commands.AddCommand("console", false, "help", "help [<command>]",
                    "Get general command list or more detailed help on a specific command", base.Help);
        }
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:26,代码来源:RemoteConsole.cs


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