mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
This commit is contained in:
@@ -26,27 +26,24 @@
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using Nini.Config;
|
||||
using System.Threading;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
{
|
||||
//could move our main function into OpenSimMain and kill this class
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
||||
|
||||
|
||||
|
||||
Console.Write("Performing compatibility checks... ");
|
||||
string supported = "";
|
||||
if (OpenSim.Framework.Util.IsEnvironmentSupported(ref supported))
|
||||
if (Util.IsEnvironmentSupported(ref supported))
|
||||
{
|
||||
Console.WriteLine(" Environment is compatible.\n");
|
||||
}
|
||||
@@ -54,10 +51,10 @@ namespace OpenSim
|
||||
{
|
||||
Console.WriteLine(" Environment is unsupported (" + supported + ")\n");
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("Starting...\n");
|
||||
|
||||
Culture.SetCurrentCulture();
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||
|
||||
@@ -80,4 +77,4 @@ namespace OpenSim
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.ClientStack;
|
||||
using OpenSim.Region.Communications.Local;
|
||||
using OpenSim.Region.Communications.OGS1;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Timers;
|
||||
using Nwc.XmlRpc;
|
||||
using RegionInfo = OpenSim.Framework.RegionInfo;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
class OpenSimController
|
||||
internal class OpenSimController
|
||||
{
|
||||
private OpenSimMain m_app;
|
||||
private BaseHttpServer m_httpServer;
|
||||
@@ -44,22 +31,23 @@ namespace OpenSim
|
||||
{
|
||||
MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
|
||||
if ((string)requestData["shutdown"] == "delayed")
|
||||
if ((string) requestData["shutdown"] == "delayed")
|
||||
{
|
||||
int timeout = Convert.ToInt32((string)requestData["milliseconds"]);
|
||||
int timeout = Convert.ToInt32((string) requestData["milliseconds"]);
|
||||
|
||||
Hashtable responseData = new Hashtable();
|
||||
responseData["accepted"] = "true";
|
||||
response.Value = responseData;
|
||||
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out.");
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
|
||||
" second(s). Please save what you are doing and log out.");
|
||||
|
||||
// Perform shutdown
|
||||
System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
|
||||
Timer shutdownTimer = new Timer(timeout); // Wait before firing
|
||||
shutdownTimer.AutoReset = false;
|
||||
shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -72,15 +60,15 @@ namespace OpenSim
|
||||
m_app.SceneManager.SendGeneralMessage("Region is going down now.");
|
||||
|
||||
// Perform shutdown
|
||||
System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing
|
||||
Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
|
||||
shutdownTimer.AutoReset = false;
|
||||
shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
m_app.Shutdown();
|
||||
}
|
||||
@@ -89,28 +77,28 @@ namespace OpenSim
|
||||
{
|
||||
MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
|
||||
RegionInfo newRegionData = new RegionInfo();
|
||||
|
||||
try
|
||||
{
|
||||
newRegionData.RegionID = (string)requestData["region_id"];
|
||||
newRegionData.RegionName = (string)requestData["region_name"];
|
||||
newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]);
|
||||
newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]);
|
||||
newRegionData.RegionID = (string) requestData["region_id"];
|
||||
newRegionData.RegionName = (string) requestData["region_name"];
|
||||
newRegionData.RegionLocX = Convert.ToUInt32((string) requestData["region_x"]);
|
||||
newRegionData.RegionLocY = Convert.ToUInt32((string) requestData["region_y"]);
|
||||
|
||||
// Security risk
|
||||
newRegionData.DataStore = (string)requestData["datastore"];
|
||||
newRegionData.DataStore = (string) requestData["datastore"];
|
||||
|
||||
newRegionData.InternalEndPoint = new System.Net.IPEndPoint(
|
||||
System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0);
|
||||
newRegionData.InternalEndPoint = new IPEndPoint(
|
||||
IPAddress.Parse((string) requestData["listen_ip"]), 0);
|
||||
|
||||
newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]);
|
||||
newRegionData.ExternalHostName = (string)requestData["external_address"];
|
||||
newRegionData.InternalEndPoint.Port = Convert.ToInt32((string) requestData["listen_port"]);
|
||||
newRegionData.ExternalHostName = (string) requestData["external_address"];
|
||||
|
||||
newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"];
|
||||
newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"];
|
||||
newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"];
|
||||
newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"];
|
||||
|
||||
m_app.CreateRegion(newRegionData);
|
||||
|
||||
@@ -129,4 +117,4 @@ namespace OpenSim
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,21 +31,17 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.ClientStack;
|
||||
using OpenSim.Region.Communications.Local;
|
||||
using OpenSim.Region.Communications.OGS1;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Framework;
|
||||
using System.Globalization;
|
||||
using RegionInfo = OpenSim.Framework.RegionInfo;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
@@ -114,7 +110,6 @@ namespace OpenSim
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// no default config files, so set default values, and save it
|
||||
SetDefaultConfig();
|
||||
|
||||
@@ -125,7 +120,6 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
ReadConfigSettings();
|
||||
|
||||
}
|
||||
|
||||
protected void SetDefaultConfig()
|
||||
@@ -148,7 +142,6 @@ namespace OpenSim
|
||||
config.Set("script_engine", "DotNetEngine");
|
||||
|
||||
config.Set("asset_database", "sqlite");
|
||||
|
||||
}
|
||||
|
||||
if (m_config.Configs["StandAlone"] == null)
|
||||
@@ -217,7 +210,8 @@ namespace OpenSim
|
||||
standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
||||
m_standaloneUserPlugin =
|
||||
standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
|
||||
m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
||||
m_standaloneAssetPlugin =
|
||||
standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
|
||||
|
||||
m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
|
||||
}
|
||||
@@ -230,7 +224,6 @@ namespace OpenSim
|
||||
/// </summary>
|
||||
public override void StartUp()
|
||||
{
|
||||
|
||||
if (!Directory.Exists(Util.logDir()))
|
||||
{
|
||||
Directory.CreateDirectory(Util.logDir());
|
||||
@@ -248,22 +241,28 @@ namespace OpenSim
|
||||
LocalInventoryService inventoryService = new LocalInventoryService();
|
||||
inventoryService.AddPlugin(m_standaloneInventoryPlugin);
|
||||
|
||||
LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService);
|
||||
LocalUserServices userService =
|
||||
new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
|
||||
m_networkServersInfo.DefaultHomeLocY, inventoryService);
|
||||
userService.AddPlugin(m_standaloneUserPlugin);
|
||||
|
||||
LocalBackEndServices backendService = new LocalBackEndServices();
|
||||
|
||||
CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, m_dumpAssetsToFile);
|
||||
CommunicationsLocal localComms =
|
||||
new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService,
|
||||
inventoryService, backendService, backendService, m_dumpAssetsToFile);
|
||||
m_commsManager = localComms;
|
||||
|
||||
m_loginService = new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, m_standaloneAuthenticate);
|
||||
m_loginService =
|
||||
new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo,
|
||||
m_standaloneAuthenticate);
|
||||
m_loginService.OnLoginToRegion += backendService.AddNewSession;
|
||||
|
||||
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
||||
|
||||
if (m_standaloneAuthenticate)
|
||||
{
|
||||
this.CreateAccount = localComms.doCreate;
|
||||
CreateAccount = localComms.doCreate;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -308,7 +307,7 @@ namespace OpenSim
|
||||
// Start UDP servers
|
||||
for (int i = 0; i < m_udpServers.Count; i++)
|
||||
{
|
||||
this.m_udpServers[i].ServerListener();
|
||||
m_udpServers[i].ServerListener();
|
||||
}
|
||||
|
||||
//Run Startup Commands
|
||||
@@ -321,7 +320,8 @@ namespace OpenSim
|
||||
MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on...");
|
||||
}
|
||||
|
||||
MainLog.Instance.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
|
||||
MainLog.Instance.Status("STARTUP",
|
||||
"Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
|
||||
}
|
||||
|
||||
public UDPServer CreateRegion(RegionInfo regionInfo)
|
||||
@@ -365,9 +365,12 @@ namespace OpenSim
|
||||
return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName);
|
||||
}
|
||||
|
||||
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)
|
||||
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
|
||||
AgentCircuitManager circuitManager)
|
||||
{
|
||||
return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, m_moduleLoader, m_dumpAssetsToFile);
|
||||
return
|
||||
new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer,
|
||||
m_moduleLoader, m_dumpAssetsToFile);
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
@@ -436,7 +439,6 @@ namespace OpenSim
|
||||
|
||||
protected void ConnectToRemoteGridServer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -464,6 +466,7 @@ namespace OpenSim
|
||||
}
|
||||
|
||||
#region Console Commands
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -649,11 +652,10 @@ namespace OpenSim
|
||||
case "change-region":
|
||||
if (cmdparams.Length > 0)
|
||||
{
|
||||
string regionName = this.CombineParams(cmdparams, 0);
|
||||
string regionName = CombineParams(cmdparams, 0);
|
||||
|
||||
if (m_sceneManager.TrySetCurrentScene(regionName))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -663,11 +665,13 @@ namespace OpenSim
|
||||
|
||||
if (m_sceneManager.CurrentScene == null)
|
||||
{
|
||||
MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'");
|
||||
MainLog.Instance.Verbose(
|
||||
"Currently at Root level. To change region please use 'change-region <regioname>'");
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'");
|
||||
MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
|
||||
". To change region please use 'change-region <regioname>'");
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -676,7 +680,6 @@ namespace OpenSim
|
||||
m_log.Error("Unknown command");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Debug(string[] args)
|
||||
@@ -695,8 +698,7 @@ namespace OpenSim
|
||||
{
|
||||
m_log.Error("packet debug should be 0..2");
|
||||
}
|
||||
System.Console.WriteLine("New packet debug: " + newDebug.ToString());
|
||||
|
||||
Console.WriteLine("New packet debug: " + newDebug.ToString());
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -704,7 +706,6 @@ namespace OpenSim
|
||||
m_log.Error("Unknown debug");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -720,7 +721,9 @@ namespace OpenSim
|
||||
m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString());
|
||||
break;
|
||||
case "users":
|
||||
m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"));
|
||||
m_log.Error(
|
||||
String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
|
||||
"Agent ID", "Session ID", "Circuit", "IP", "World"));
|
||||
|
||||
foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars())
|
||||
{
|
||||
@@ -750,7 +753,7 @@ namespace OpenSim
|
||||
break;
|
||||
case "modules":
|
||||
m_log.Error("The currently loaded shared modules are:");
|
||||
foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.GetLoadedSharedModules )
|
||||
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
|
||||
{
|
||||
m_log.Error("Shared Module: " + module.Name);
|
||||
}
|
||||
@@ -768,8 +771,7 @@ namespace OpenSim
|
||||
result = result.TrimEnd(' ');
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,4 +33,4 @@ namespace OpenSim
|
||||
{
|
||||
public static string Version = "0.4, SVN build ";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user