From 91a096dca6adc62bb6b185d391a8d2181291e9a3 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 10 Mar 2009 20:27:41 +0000 Subject: * Cleanup and CCC (Code Convention Conformance) --- OpenSim/Region/Application/Application.cs | 11 +- OpenSim/Region/Application/ConfigurationLoader.cs | 29 +- OpenSim/Region/Application/HGOpenSimNode.cs | 46 +-- OpenSim/Region/Application/IApplicationPlugin.cs | 13 +- OpenSim/Region/Application/OpenSim.cs | 345 +++++++++++----------- OpenSim/Region/Application/OpenSimBackground.cs | 5 +- OpenSim/Region/Application/OpenSimBase.cs | 153 +++++----- 7 files changed, 312 insertions(+), 290 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 0c01b02..a7f61ff 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -39,7 +39,7 @@ namespace OpenSim public class Application { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + public static string iniFilePath = ""; public static bool m_saveCrashDumps = false; @@ -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; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index ac65e82..6a103bd 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -45,10 +45,11 @@ namespace OpenSim private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public ConfigurationLoader() - { + { } - 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(); @@ -70,16 +71,17 @@ namespace OpenSim m_config.Source.Merge(DefaultConfig()); m_log.Info("[CONFIG] Reading configuration settings"); - + Uri configUri; - String xmlPath = Path.Combine(Util.configDir(), "OpenSim.xml"); + String xmlPath = Path.Combine(Util.configDir(), "OpenSim.xml"); //check for master .INI file (name passed in command line, no default), or XML over http if (masterFileName.Length > 0) // If a master file name is given ... { 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)) { @@ -100,10 +102,11 @@ 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) @@ -119,7 +122,7 @@ namespace OpenSim m_config.Source = new XmlConfigSource(); m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); } - } + } m_config.Source.Merge(configSource); @@ -152,7 +155,7 @@ namespace OpenSim private bool ReadConfig(string iniName, string iniPath, OpenSimConfigSource m_config, bool isUri) { bool success = false; - + if (!isUri && File.Exists(iniPath)) { m_log.InfoFormat("[CONFIG] Reading configuration file {0}", Path.GetFullPath(iniPath)); @@ -235,7 +238,7 @@ namespace OpenSim config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll"); config.Set("user_source", ""); config.Set("asset_plugin", "OpenSim.Data.SQLite.dll"); - config.Set("asset_source", ""); + config.Set("asset_source", ""); config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar)); config.Set("AssetSetsXMLFile", string.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar)); config.Set("dump_assets_to_file", false); @@ -307,11 +310,11 @@ namespace OpenSim m_configSettings.LibrariesXMLFile = standaloneConfig.GetString("LibrariesXMLFile"); m_configSettings.AssetSetsXMLFile = standaloneConfig.GetString("AssetSetsXMLFile"); - - m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); + + m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); } m_networkServersInfo.loadFromConfiguration(m_config.Source); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index 44c1602..6e7f1c5 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs @@ -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,24 +64,26 @@ namespace OpenSim base.StartupSpecific(); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region :[:] ", "Link a hypergrid region", RunCommand); - + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", + "Set local coordinate to map HG regions to", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region :[:] ", + "Link a hypergrid region", RunCommand); } protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, - AgentCircuitManager circuitManager) + AgentCircuitManager circuitManager) { HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); - + return new HGScene( regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager, - m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, + m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, 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 cmdparams = new List(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); } @@ -236,7 +236,7 @@ namespace OpenSim m_log.Error(e.ToString()); } } - + private void ReadLinkFromConfig(IConfig config) { @@ -255,19 +255,23 @@ 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", ""); } } } - + private void LinkRegionCmdUsage() { @@ -276,4 +280,4 @@ namespace OpenSim m_log.Info("Usage: link-region []"); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs index 09e3336..2f601e9 100644 --- a/OpenSim/Region/Application/IApplicationPlugin.cs +++ b/OpenSim/Region/Application/IApplicationPlugin.cs @@ -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); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 920d35c..69dfac5 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -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"}); } @@ -130,164 +132,164 @@ namespace OpenSim private void RegisterConsoleCommands() { m_console.Commands.AddCommand("region", false, "clear assets", - "clear assets", - "Clear the asset cache", HandleClearAssets); + "clear assets", + "Clear the asset cache", HandleClearAssets); m_console.Commands.AddCommand("region", false, "force update", - "force update", - "Force the update of all objects on clients", - HandleForceUpdate); + "force update", + "Force the update of all objects on clients", + HandleForceUpdate); m_console.Commands.AddCommand("region", false, "debug packet", - "debug packet ", - "Turn on packet debugging", Debug); + "debug packet ", + "Turn on packet debugging", Debug); m_console.Commands.AddCommand("region", false, "debug scene", - "debug scene ", - "Turn on scene debugging", Debug); + "debug scene ", + "Turn on scene debugging", Debug); m_console.Commands.AddCommand("region", false, "change region", - "change region ", - "Change current console region", ChangeSelectedRegion); + "change region ", + "Change current console region", ChangeSelectedRegion); m_console.Commands.AddCommand("region", false, "save xml", - "save xml", - "Save a region's data in XML format", SaveXml); + "save xml", + "Save a region's data in XML format", SaveXml); m_console.Commands.AddCommand("region", false, "save xml2", - "save xml2", - "Save a region's data in XML2 format", SaveXml2); + "save xml2", + "Save a region's data in XML2 format", SaveXml2); m_console.Commands.AddCommand("region", false, "load xml", - "load xml [-newIDs [ ]]", - "Load a region's data from XML format", LoadXml); + "load xml [-newIDs [ ]]", + "Load a region's data from XML format", LoadXml); m_console.Commands.AddCommand("region", false, "load xml2", - "load xml2", - "Load a region's data from XML2 format", LoadXml2); + "load xml2", + "Load a region's data from XML2 format", LoadXml2); m_console.Commands.AddCommand("region", false, "save prims xml2", - "save prims xml2 [ ]", - "Save named prim to XML2", SavePrimsXml2); + "save prims xml2 [ ]", + "Save named prim to XML2", SavePrimsXml2); m_console.Commands.AddCommand("region", false, "load oar", - "load oar ", - "Load a region's data from OAR archive", LoadOar); + "load oar ", + "Load a region's data from OAR archive", LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar ", - "Save a region's data to an OAR archive", - "More information on forthcoming options here soon", SaveOar); + "save oar ", + "Save a region's data to an OAR archive", + "More information on forthcoming options here soon", SaveOar); m_console.Commands.AddCommand("region", false, "edit scale", - "edit scale ", - "Change the scale of a named prim", HandleEditScale); + "edit scale ", + "Change the scale of a named prim", HandleEditScale); m_console.Commands.AddCommand("region", false, "kick user", - "kick user ", - "Kick a user off the simulator", KickUserCommand); + "kick user ", + "Kick a user off the simulator", KickUserCommand); m_console.Commands.AddCommand("region", false, "show assets", - "show assets", - "Show asset data", HandleShow); + "show assets", + "Show asset data", HandleShow); m_console.Commands.AddCommand("region", false, "show users", - "show users [full]", - "Show user data", HandleShow); + "show users [full]", + "Show user data", HandleShow); m_console.Commands.AddCommand("region", false, "show users full", - "show users full", - String.Empty, HandleShow); + "show users full", + String.Empty, HandleShow); m_console.Commands.AddCommand("region", false, "show modules", - "show modules", - "Show module data", HandleShow); + "show modules", + "Show module data", HandleShow); m_console.Commands.AddCommand("region", false, "show regions", - "show regions", - "Show region data", HandleShow); + "show regions", + "Show region data", HandleShow); m_console.Commands.AddCommand("region", false, "show queues", - "show queues", - "Show queue data", HandleShow); + "show queues", + "Show queue data", HandleShow); m_console.Commands.AddCommand("region", false, "backup", - "backup", - "Persist objects to the database now", RunCommand); + "backup", + "Persist objects to the database now", RunCommand); m_console.Commands.AddCommand("region", false, "create region", - "create region", - "Create a new region", HandleCreateRegion); + "create region", + "Create a new region", HandleCreateRegion); m_console.Commands.AddCommand("region", false, "login enable", - "login enable", - "Enable logins to the simulator", HandleLoginEnable); + "login enable", + "Enable logins to the simulator", HandleLoginEnable); m_console.Commands.AddCommand("region", false, "login disable", - "login disable", - "Disable logins to the simulator", HandleLoginDisable); + "login disable", + "Disable logins to the simulator", HandleLoginDisable); m_console.Commands.AddCommand("region", false, "login status", - "login status", - "Display status of logins", HandleLoginStatus); + "login status", + "Display status of logins", HandleLoginStatus); m_console.Commands.AddCommand("region", false, "restart", - "restart", - "Restart all sims in this instance", RunCommand); + "restart", + "Restart all sims in this instance", RunCommand); m_console.Commands.AddCommand("region", false, "config set", - "config set
", - "Set a config option", HandleConfig); + "config set
", + "Set a config option", HandleConfig); m_console.Commands.AddCommand("region", false, "config get", - "config get
", - "Read a config option", HandleConfig); + "config get
", + "Read a config option", HandleConfig); m_console.Commands.AddCommand("region", false, "config save", - "config save", - "Save current configuration", HandleConfig); + "config save", + "Save current configuration", HandleConfig); m_console.Commands.AddCommand("region", false, "command-script", - "command-script