From a473cbe128280779423562140b9e52c1fc5133f9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 2 Jun 2021 11:07:56 +0100 Subject: [PATCH] cosmetics like change empty string compares --- .../RegionModulesControllerPlugin.cs | 65 +++++++------------ 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs index 2e25c60063..0827ea8957 100644 --- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs +++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs @@ -43,9 +43,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController IApplicationPlugin { // Logger - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// Controls whether we load modules from Mono.Addins. @@ -60,14 +58,11 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController private string m_name; // Internal lists to collect information about modules present - private List m_nonSharedModules = - new List(); - private List m_sharedModules = - new List(); + private List m_nonSharedModules = new List(); + private List m_sharedModules = new List(); // List of shared module instances, for adding to Scenes - private List m_sharedInstances = - new List(); + private List m_sharedInstances = new List(); public RegionModulesControllerPlugin() { @@ -96,8 +91,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController m_name = id.Substring(pos + 1); // The [Modules] section in the ini file - IConfig modulesConfig = - m_openSim.ConfigSource.Source.Configs["Modules"]; + IConfig modulesConfig = m_openSim.ConfigSource.Source.Configs["Modules"]; if (modulesConfig == null) modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules"); @@ -126,21 +120,19 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController // foreach (TypeExtensionNode node in m_sharedModules) { - Object[] ctorArgs = new Object[] { (uint)0 }; + object[] ctorArgs = new object[] { (uint)0 }; // Read the config again - string moduleString = - modulesConfig.GetString("Setup_" + node.Id, String.Empty); + string moduleString = modulesConfig.GetString("Setup_" + node.Id, string.Empty); // Test to see if we want this module if (moduleString == "disabled") continue; // Get the port number, if there is one - if (moduleString != String.Empty) + if (moduleString != string.Empty) { // Get the port number from the string - string[] moduleParts = moduleString.Split(new char[] { '/' }, - 2); + string[] moduleParts = moduleString.Split(new char[] { '/' }, 2); if (moduleParts.Length > 1) ctorArgs[0] = Convert.ToUInt32(moduleParts[0]); } @@ -151,13 +143,11 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController try { - module = (ISharedRegionModule)Activator.CreateInstance( - node.Type, ctorArgs); + module = (ISharedRegionModule)Activator.CreateInstance(node.Type, ctorArgs); } catch { - module = (ISharedRegionModule)Activator.CreateInstance( - node.Type); + module = (ISharedRegionModule)Activator.CreateInstance(node.Type); } // OK, we're up and running @@ -181,8 +171,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController #region IPlugin implementation - private void AddNode( - TypeExtensionNode node, IConfig modulesConfig, Dictionary> loadedModules) + private void AddNode(TypeExtensionNode node, IConfig modulesConfig, Dictionary> loadedModules) { IList loadedModuleData; @@ -271,11 +260,10 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController protected bool CheckModuleEnabled(TypeExtensionNode node, IConfig modulesConfig) { // Get the config string - string moduleString = - modulesConfig.GetString("Setup_" + node.Id, String.Empty); + string moduleString = modulesConfig.GetString("Setup_" + node.Id, string.Empty); // We have a selector - if (moduleString != String.Empty) + if (!string.IsNullOrEmpty(moduleString)) { // Allow disabling modules even if they don't have // support for it @@ -305,10 +293,8 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController // public void AddRegionToModules (Scene scene) { - Dictionary deferredSharedModules = - new Dictionary(); - Dictionary deferredNonSharedModules = - new Dictionary(); + Dictionary deferredSharedModules = new Dictionary(); + Dictionary deferredNonSharedModules = new Dictionary(); // We need this to see if a module has already been loaded and // has defined a replaceable interface. It's a generic call, @@ -317,8 +303,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController MethodInfo mi = s.GetMethod("RequestModuleInterface"); // This will hold the shared modules we actually load - List sharedlist = - new List(); + List sharedlist = new List(); // Iterate over the shared modules that have been loaded // Add them to the new Scene @@ -355,29 +340,26 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController sharedlist.Add(module); } - IConfig modulesConfig = - m_openSim.ConfigSource.Source.Configs["Modules"]; + IConfig modulesConfig = m_openSim.ConfigSource.Source.Configs["Modules"]; // Scan for, and load, nonshared modules List list = new List(); foreach (TypeExtensionNode node in m_nonSharedModules) { - Object[] ctorArgs = new Object[] {0}; + object[] ctorArgs = new object[] {0}; // Read the config - string moduleString = - modulesConfig.GetString("Setup_" + node.Id, String.Empty); + string moduleString = modulesConfig.GetString("Setup_" + node.Id, string.Empty); // We may not want to load this at all if (moduleString == "disabled") continue; // Get the port number, if there is one - if (moduleString != String.Empty) + if (!string.IsNullOrEmpty(moduleString)) { // Get the port number from the string - string[] moduleParts = moduleString.Split(new char[] {'/'}, - 2); + string[] moduleParts = moduleString.Split(new char[] {'/'}, 2); if (moduleParts.Length > 1) ctorArgs[0] = Convert.ToUInt32(moduleParts[0]); } @@ -456,8 +438,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController } // Same thing for nonshared modules, load them unless overridden - List deferredlist = - new List(); + List deferredlist = new List(); foreach (INonSharedRegionModule module in deferredNonSharedModules.Values) {