* Cleanup and CCC (Code Convention Conformance)

0.6.5-rc1
lbsa71 2009-03-10 20:27:41 +00:00
parent 63a5a01945
commit 91a096dca6
7 changed files with 305 additions and 283 deletions

View File

@ -51,7 +51,8 @@ namespace OpenSim
public static void Main(string[] args)
{
// First line
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
XmlConfigurator.Configure();
@ -143,7 +144,7 @@ namespace OpenSim
msg += "\r\n";
msg += "Exception: " + e.ExceptionObject.ToString() + "\r\n";
Exception ex = (Exception)e.ExceptionObject;
Exception ex = (Exception) e.ExceptionObject;
if (ex.InnerException != null)
{
msg += "InnerException: " + ex.InnerException.ToString() + "\r\n";
@ -177,7 +178,7 @@ namespace OpenSim
m_log.ErrorFormat("[CRASH LOGGER CRASHED]: {0}", e2);
}
_IsHandlingException=false;
_IsHandlingException = false;
}
}
}

View File

@ -48,7 +48,8 @@ namespace OpenSim
{
}
public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo)
public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings,
out NetworkServersInfo networkInfo)
{
m_configSettings = configSettings = new ConfigSettings();
m_networkServersInfo = networkInfo = new NetworkServersInfo();
@ -79,7 +80,8 @@ namespace OpenSim
{
m_log.InfoFormat("[CONFIG] Reading config master file {0}", masterfilePath);
bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) &&
configUri.Scheme == Uri.UriSchemeHttp;
if (!ReadConfig(masterFileName, masterfilePath, m_config, isMasterUri))
{
@ -103,7 +105,8 @@ namespace OpenSim
// Check for .INI file (either default or name passed on command
// line) or XML config source over http
bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) &&
configUri.Scheme == Uri.UriSchemeHttp;
iniFileExists = ReadConfig(iniFileName, Application.iniFilePath, m_config, isIniUri);
if (!iniFileExists)

View File

@ -33,11 +33,7 @@ using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Region.Communications.Hypergrid;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
@ -68,9 +64,11 @@ namespace OpenSim
base.StartupSpecific();
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
"Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
"Link a hypergrid region", RunCommand);
}
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
@ -85,7 +83,7 @@ namespace OpenSim
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
}
new void RunCommand(string module, string[] cp)
private new void RunCommand(string module, string[] cp)
{
List<string> cmdparams = new List<string>(cp);
if (cmdparams.Count < 1)
@ -128,7 +126,8 @@ namespace OpenSim
}
if (cmdparams[2].Contains(":"))
{ // New format
{
// New format
uint xloc, yloc;
string mapName;
try
@ -154,7 +153,8 @@ namespace OpenSim
HGHyperlink.TryLinkRegionToCoords(m_sceneManager.CurrentOrFirstScene, null, mapName, xloc, yloc);
}
else
{ // old format
{
// old format
RegionInfo regInfo;
uint xloc, yloc;
uint externalPort;
@ -205,7 +205,7 @@ namespace OpenSim
{
string excludeString = cmdparams[1].ToLower();
excludeString = excludeString.Remove(0, 12);
char[] splitter = { ';' };
char[] splitter = {';'};
excludeSections = excludeString.Split(splitter);
}
@ -255,13 +255,17 @@ namespace OpenSim
if (m_enableAutoMapping)
{
xloc = (uint)((xloc % 100) + m_autoMappingX);
yloc = (uint)((yloc % 100) + m_autoMappingY);
xloc = (uint) ((xloc%100) + m_autoMappingX);
yloc = (uint) ((yloc%100) + m_autoMappingY);
}
if (((realXLoc == 0) && (realYLoc == 0)) || (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
if (((realXLoc == 0) && (realYLoc == 0)) ||
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
{
if (HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
if (
HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, "", externalPort,
externalHostName, out regInfo))
{
regInfo.RegionName = config.GetString("localName", "");
}

View File

@ -38,11 +38,16 @@ namespace OpenSim
public class ApplicationPluginInitialiser : PluginInitialiserBase
{
private OpenSimBase server;
public ApplicationPluginInitialiser (OpenSimBase s) { server = s; }
public override void Initialise (IPlugin plugin)
public ApplicationPluginInitialiser(OpenSimBase s)
{
server = s;
}
public override void Initialise(IPlugin plugin)
{
IApplicationPlugin p = plugin as IApplicationPlugin;
p.Initialise (server);
p.Initialise(server);
}
}
}

View File

@ -85,7 +85,8 @@ namespace OpenSim
m_log.Info("====================================================================");
m_log.Info("========================= STARTING OPENSIM =========================");
m_log.Info("====================================================================");
m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Standalone ? "sandbox" : "grid"));
m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode",
(ConfigurationSettings.Standalone ? "sandbox" : "grid"));
//m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
// http://msdn.microsoft.com/en-us/library/bb384202.aspx
//GCSettings.LatencyMode = GCLatencyMode.Batch;
@ -100,7 +101,7 @@ namespace OpenSim
base.StartupSpecific();
//Run Startup Commands
if (String.IsNullOrEmpty( m_startupCommandsFile ))
if (String.IsNullOrEmpty(m_startupCommandsFile))
{
m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
}
@ -114,7 +115,7 @@ namespace OpenSim
{
m_scriptTimer = new Timer();
m_scriptTimer.Enabled = true;
m_scriptTimer.Interval = 1200 * 1000;
m_scriptTimer.Interval = 1200*1000;
m_scriptTimer.Elapsed += RunAutoTimerScript;
}
@ -122,7 +123,8 @@ namespace OpenSim
// For now, start at the 'root' level by default
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
ChangeSelectedRegion("region", new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
ChangeSelectedRegion("region",
new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
else
ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
}
@ -321,7 +323,8 @@ namespace OpenSim
{
RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
{
m_console.Notice(
String.Format(
@ -541,7 +544,6 @@ namespace OpenSim
{
foreach (Scene s in new ArrayList(m_sceneManager.Scenes))
{
m_console.Notice("Loading module: " + cmdparams[1]);
m_moduleLoader.LoadRegionModules(cmdparams[1], s);
}
@ -743,7 +745,7 @@ namespace OpenSim
}
// see BaseOpenSimServer
override public void HandleShow(string mod, string[] cmd)
public override void HandleShow(string mod, string[] cmd)
{
base.HandleShow(mod, cmd);
@ -815,7 +817,8 @@ namespace OpenSim
{
m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
scene.RegionInfo.RegionLocX + " , Region YLoc: " +
scene.RegionInfo.RegionLocY + " , Region Port: " + scene.RegionInfo.InternalEndPoint.Port.ToString());
scene.RegionInfo.RegionLocY + " , Region Port: " +
scene.RegionInfo.InternalEndPoint.Port.ToString());
});
break;
@ -878,7 +881,7 @@ namespace OpenSim
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
else firstName = cmdparams[2];
if ( cmdparams.Length < 4 )
if (cmdparams.Length < 4)
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
else lastName = cmdparams[3];
@ -886,11 +889,11 @@ namespace OpenSim
password = MainConsole.Instance.PasswdPrompt("Password");
else password = cmdparams[4];
if ( cmdparams.Length < 6 )
if (cmdparams.Length < 6)
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
else regX = Convert.ToUInt32(cmdparams[5]);
if ( cmdparams.Length < 7 )
if (cmdparams.Length < 7)
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
else regY = Convert.ToUInt32(cmdparams[6]);
@ -922,11 +925,11 @@ namespace OpenSim
firstName = MainConsole.Instance.CmdPrompt("First name");
else firstName = cmdparams[3];
if ( cmdparams.Length < 5 )
if (cmdparams.Length < 5)
lastName = MainConsole.Instance.CmdPrompt("Last name");
else lastName = cmdparams[4];
if ( cmdparams.Length < 6 )
if (cmdparams.Length < 6)
newPassword = MainConsole.Instance.PasswdPrompt("New password");
else newPassword = cmdparams[5];

View File

@ -56,7 +56,8 @@ namespace OpenSim
m_log.Info("====================================================================");
m_log.Info("========================= STARTING OPENSIM =========================");
m_log.Info("====================================================================");
m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Standalone ? "sandbox" : "grid");
m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode",
ConfigurationSettings.Standalone ? "sandbox" : "grid");
base.Startup();

View File

@ -41,8 +41,6 @@ using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@ -83,6 +81,7 @@ namespace OpenSim
get { return m_configSettings; }
set { m_configSettings = value; }
}
protected ConfigSettings m_configSettings;
protected ConfigurationLoader m_configLoader;
@ -101,12 +100,14 @@ namespace OpenSim
get { return m_config; }
set { m_config = value; }
}
protected OpenSimConfigSource m_config;
public List<IClientNetworkServer> ClientServers
{
get { return m_clientServers; }
}
protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
public new BaseHttpServer HttpServer
@ -124,6 +125,7 @@ namespace OpenSim
get { return m_moduleLoader; }
set { m_moduleLoader = value; }
}
protected ModuleLoader m_moduleLoader;
protected IRegistryCore m_applicationRegistry = new RegistryCore();
@ -311,14 +313,14 @@ namespace OpenSim
{
// If grid is specified then the grid server is chose regardless
// of whether the server is standalone.
case "grid" :
case "grid":
linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
assetServer = loadAssetServer("Grid", linit);
break;
// If cryptogrid is specified then the cryptogrid server is chose regardless
// of whether the server is standalone.
case "cryptogrid" :
case "cryptogrid":
cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
Environment.CurrentDirectory, true);
assetServer = loadAssetServer("Crypto", cinit);
@ -326,7 +328,7 @@ namespace OpenSim
// If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
// of whether the server is standalone.
case "cryptogrid_eou" :
case "cryptogrid_eou":
cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
Environment.CurrentDirectory, false);
assetServer = loadAssetServer("Crypto", cinit);
@ -334,7 +336,7 @@ namespace OpenSim
// If file is specified then the file server is chose regardless
// of whether the server is standalone.
case "file" :
case "file":
linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
assetServer = loadAssetServer("File", linit);
break;
@ -342,20 +344,22 @@ namespace OpenSim
// If local is specified then we're going to use the local SQL server
// implementation. We drop through, because that will be the fallback
// for the following default clause too.
case "local" :
case "local":
break;
// If the asset_database value is none of the previously mentioned strings, then we
// try to load a turnkey plugin that matches this value. If not we drop through to
// a local default.
default :
default:
try
{
init = new AssetClientPluginInitialiser(m_configSettings);
assetServer = loadAssetServer(m_configSettings.AssetStorage, init);
break;
}
catch {}
catch
{
}
m_log.Info("[OPENSIMBASE] Default assetserver will be used");
break;
}
@ -624,7 +628,7 @@ namespace OpenSim
//if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
// listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint)regionInfo.InternalEndPoint.Port;
uint port = (uint) regionInfo.InternalEndPoint.Port;
if (m_autoCreateClientStack)
{
@ -638,7 +642,7 @@ namespace OpenSim
clientServer = null;
}
regionInfo.InternalEndPoint.Port = (int)port;
regionInfo.InternalEndPoint.Port = (int) port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
@ -651,7 +655,7 @@ namespace OpenSim
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);
scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
// TODO: Remove this cruft once MasterAvatar is fully deprecated
//Master Avatar Setup
@ -687,7 +691,8 @@ namespace OpenSim
protected override StorageManager CreateStorageManager()
{
return CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
return
CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
}
protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
@ -840,12 +845,12 @@ namespace OpenSim
{
if (Source is IniConfigSource)
{
IniConfigSource iniCon = (IniConfigSource)Source;
IniConfigSource iniCon = (IniConfigSource) Source;
iniCon.Save(path);
}
else if (Source is XmlConfigSource)
{
XmlConfigSource xmlCon = (XmlConfigSource)Source;
XmlConfigSource xmlCon = (XmlConfigSource) Source;
xmlCon.Save(path);
}
}