* Optimized usings

* shortened references
* Removed redundant 'this'
* Normalized EOF
This commit is contained in:
lbsa71
2007-12-27 21:41:48 +00:00
parent d508d77122
commit efd90b56b7
277 changed files with 4685 additions and 4408 deletions

View File

@@ -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;
/// <summary>
/// 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<byte>(ref result, (int)ms.Length);
Array.Resize<byte>(ref result, (int) ms.Length);
}
else if (string.Compare(parms[1], "user", true) == 0)
{
@@ -204,4 +207,4 @@ namespace OpenSim.Grid.InventoryServer
}
}
}
}
}