本文整理汇总了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.
}
}
示例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);
}
}
示例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);
}
示例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);
}