From 5818958a9a6c5a10743928973172d255632af6de Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 24 Sep 2007 02:41:13 +0000 Subject: *** CHANGED CONFIG BEHAVIOUR *** * Changed really strange LocalSettings behaviour with enforcing hard-coded plugin names if none supplied * UserServices and InventoryPlugin will only load if supplied with filename --- .../InventoryServiceBase/InventoryServiceBase.cs | 32 ++++++++--------- OpenSim/Framework/UserManager/UserManagerBase.cs | 41 ++++++++++------------ 2 files changed, 35 insertions(+), 38 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs index dc66bd4..d76fac5 100644 --- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs +++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs @@ -23,28 +23,28 @@ namespace OpenSim.Framework.InventoryServiceBase /// The filename to the user server plugin DLL public void AddPlugin(string FileName) { - MainLog.Instance.Verbose("Inventory", "Inventorystorage: Attempting to load " + FileName); - Assembly pluginAssembly = Assembly.LoadFrom(FileName); - - foreach (Type pluginType in pluginAssembly.GetTypes()) + if (!String.IsNullOrEmpty(FileName)) { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IInventoryData", true); + MainLog.Instance.Verbose("Inventory", "Inventorystorage: Attempting to load " + FileName); + Assembly pluginAssembly = Assembly.LoadFrom(FileName); - if (typeInterface != null) + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (!pluginType.IsAbstract) { - IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Initialise(); - this.m_plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); + Type typeInterface = pluginType.GetInterface("IInventoryData", true); + + if (typeInterface != null) + { + IInventoryData plug = + (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Initialise(); + this.m_plugins.Add(plug.getName(), plug); + MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); + } } - - typeInterface = null; } } - - pluginAssembly = null; } /// diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index e11204b..4a2870b 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections; using System.Collections.Generic; @@ -32,15 +33,11 @@ using System.Reflection; using System.Security.Cryptography; using libsecondlife; using Nwc.XmlRpc; +using OpenSim.Framework.Configuration; using OpenSim.Framework.Console; using OpenSim.Framework.Data; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.Framework.Configuration; -using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; - namespace OpenSim.Framework.UserManagement { public abstract class UserManagerBase @@ -54,32 +51,32 @@ namespace OpenSim.Framework.UserManagement /// The filename to the user server plugin DLL public void AddPlugin(string FileName) { - MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName); - Assembly pluginAssembly = Assembly.LoadFrom(FileName); - - MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); - foreach (Type pluginType in pluginAssembly.GetTypes()) + if (!String.IsNullOrEmpty(FileName)) { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IUserData", true); + MainLog.Instance.Verbose("Userstorage: Attempting to load " + FileName); + Assembly pluginAssembly = Assembly.LoadFrom(FileName); - if (typeInterface != null) + MainLog.Instance.Verbose("Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (!pluginType.IsAbstract) { - IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Initialise(); - AddPlugin(plug); + Type typeInterface = pluginType.GetInterface("IUserData", true); + + if (typeInterface != null) + { + IUserData plug = + (IUserData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + AddPlugin(plug); + } } - - typeInterface = null; } } - - pluginAssembly = null; } - private void AddPlugin(IUserData plug) + public void AddPlugin(IUserData plug) { + plug.Initialise(); this._plugins.Add(plug.getName(), plug); MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); } -- cgit v1.1