From efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Dec 2007 21:41:48 +0000 Subject: * Optimized usings * shortened references * Removed redundant 'this' * Normalized EOF --- OpenSim/Grid/InventoryServer/InventoryManager.cs | 43 +++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'OpenSim/Grid/InventoryServer/InventoryManager.cs') diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs index 1070bcf..a003ce3 100644 --- a/OpenSim/Grid/InventoryServer/InventoryManager.cs +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs @@ -25,26 +25,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.IO; -using System.Text; using System.Reflection; -using System.Collections; -using System.Collections.Generic; +using System.Text; using System.Xml; using System.Xml.Serialization; using libsecondlife; - using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; namespace OpenSim.Grid.InventoryServer { - public class InventoryManager { - IInventoryData _databasePlugin; + private IInventoryData _databasePlugin; /// /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. @@ -55,7 +52,8 @@ namespace OpenSim.Grid.InventoryServer MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); - MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + MainLog.Instance.Verbose(OpenInventory_Main.LogName, + "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); foreach (Type pluginType in pluginAssembly.GetTypes()) { if (!pluginType.IsAbstract) @@ -64,10 +62,12 @@ namespace OpenSim.Grid.InventoryServer if (typeInterface != null) { - IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + IInventoryData plug = + (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _databasePlugin = plug; - MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Added IInventoryData Interface"); + MainLog.Instance.Verbose(OpenInventory_Main.LogName, + "Invenstorage: Added IInventoryData Interface"); break; } @@ -82,8 +82,8 @@ namespace OpenSim.Grid.InventoryServer { FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); XmlReader reader = new XmlTextReader(fs); - XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); - SerializableInventory inventory = (SerializableInventory)x.Deserialize(reader); + XmlSerializer x = new XmlSerializer(typeof (SerializableInventory)); + SerializableInventory inventory = (SerializableInventory) x.Deserialize(reader); fs.Close(); fs.Dispose(); return inventory; @@ -93,11 +93,12 @@ namespace OpenSim.Grid.InventoryServer { XmlTextWriter writer = new XmlTextWriter(s, Encoding.UTF8); writer.Formatting = Formatting.Indented; - XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); + XmlSerializer x = new XmlSerializer(typeof (SerializableInventory)); x.Serialize(writer, inventory); } - protected static bool fixupFolder(SerializableInventory.SerializableFolder f, SerializableInventory.SerializableFolder parent) + protected static bool fixupFolder(SerializableInventory.SerializableFolder f, + SerializableInventory.SerializableFolder parent) { bool modified = false; @@ -142,6 +143,7 @@ namespace OpenSim.Grid.InventoryServer { private SerializableInventory _inventory; private InventoryManager _manager; + public GetInventory(InventoryManager manager) : base("GET", "/inventory") { @@ -165,23 +167,24 @@ namespace OpenSim.Grid.InventoryServer private byte[] GetUserInventory(LLUUID userID) { MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString()); - byte[] result = new byte[] { }; + byte[] result = new byte[] {}; InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID); if (fb == null) { - MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", userID.ToString()); + MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", + userID.ToString()); CreateDefaultInventory(userID); } return result; } - override public byte[] Handle(string path, Stream request) + public override byte[] Handle(string path, Stream request) { - byte[] result = new byte[] { }; + byte[] result = new byte[] {}; - string[] parms = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if (parms.Length > 1) { if (string.Compare(parms[1], "library", true) == 0) @@ -190,7 +193,7 @@ namespace OpenSim.Grid.InventoryServer saveInventoryToStream(_inventory, ms); result = ms.GetBuffer(); - Array.Resize(ref result, (int)ms.Length); + Array.Resize(ref result, (int) ms.Length); } else if (string.Compare(parms[1], "user", true) == 0) { @@ -204,4 +207,4 @@ namespace OpenSim.Grid.InventoryServer } } } -} +} \ No newline at end of file -- cgit v1.1