* Optimized usings

* Shortened type references
* Removed redundant 'this' qualifier
This commit is contained in:
lbsa71
2007-10-30 09:05:31 +00:00
parent c32d1f0562
commit 67e12b95ea
353 changed files with 15459 additions and 10338 deletions

View File

@@ -34,18 +34,19 @@ namespace OpenSim.Framework.Data.DB4o
/// <summary>
/// A grid server storage mechanism employing the DB4o database system
/// </summary>
class DB4oGridData : IGridData
internal class DB4oGridData : IGridData
{
/// <summary>
/// The database manager object
/// </summary>
DB4oGridManager manager;
private DB4oGridManager manager;
/// <summary>
/// Called when the plugin is first loaded (as constructors are not called)
/// </summary>
public void Initialise() {
manager = new DB4oGridManager("gridserver.yap");
public void Initialise()
{
manager = new DB4oGridManager("gridserver.yap");
}
/// <summary>
@@ -93,7 +94,8 @@ namespace OpenSim.Framework.Data.DB4o
if (manager.simProfiles.ContainsKey(uuid))
return manager.simProfiles[uuid];
}
throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count);
throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() +
"). Total Registered Regions: " + manager.simProfiles.Count);
}
/// <summary>
@@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="handle">The location the region is logging into (unused in Db4o)</param>
/// <param name="key">The shared secret</param>
/// <returns>Authenticated?</returns>
public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
public bool AuthenticateSim(LLUUID uuid, ulong handle, string key)
{
if (manager.simProfiles[uuid].regionRecvKey == key)
return true;
return false;
@@ -160,4 +163,4 @@ namespace OpenSim.Framework.Data.DB4o
return null;
}
}
}
}

View File

@@ -29,23 +29,23 @@ using System;
using System.Collections.Generic;
using Db4objects.Db4o;
using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework.Data.DB4o
{
/// <summary>
/// A Database manager for Db4o
/// </summary>
class DB4oGridManager
internal class DB4oGridManager
{
/// <summary>
/// A list of the current regions connected (in-memory cache)
/// </summary>
public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>();
/// <summary>
/// Database File Name
/// </summary>
string dbfl;
private string dbfl;
/// <summary>
/// Creates a new grid storage manager
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o
dbfl = db4odb;
IObjectContainer database;
database = Db4oFactory.OpenFile(dbfl);
IObjectSet result = database.Get(typeof(RegionProfileData));
IObjectSet result = database.Get(typeof (RegionProfileData));
// Loads the file into the in-memory cache
foreach (RegionProfileData row in result)
{
@@ -94,23 +94,22 @@ namespace OpenSim.Framework.Data.DB4o
return false;
}
}
}
/// <summary>
/// A manager for the DB4o database (user profiles)
/// </summary>
class DB4oUserManager
internal class DB4oUserManager
{
/// <summary>
/// A list of the user profiles (in memory cache)
/// </summary>
public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
/// <summary>
/// Database filename
/// </summary>
string dbfl;
private string dbfl;
/// <summary>
/// Initialises a new DB manager
@@ -122,7 +121,7 @@ namespace OpenSim.Framework.Data.DB4o
IObjectContainer database;
database = Db4oFactory.OpenFile(dbfl);
// Load to cache
IObjectSet result = database.Get(typeof(UserProfileData));
IObjectSet result = database.Get(typeof (UserProfileData));
foreach (UserProfileData row in result)
{
if (userProfiles.ContainsKey(row.UUID))
@@ -144,7 +143,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="record">The profile to update</param>
/// <returns>true on success, false on fail to persist to db</returns>
public bool UpdateRecord(UserProfileData record)
{
{
if (userProfiles.ContainsKey(record.UUID))
{
userProfiles[record.UUID] = record;
@@ -168,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o
}
}
}
}
}

View File

@@ -28,8 +28,6 @@
using System;
using System.IO;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework;
namespace OpenSim.Framework.Data.DB4o
{
@@ -41,14 +39,14 @@ namespace OpenSim.Framework.Data.DB4o
/// <summary>
/// The database manager
/// </summary>
DB4oUserManager manager;
private DB4oUserManager manager;
/// <summary>
/// Artificial constructor called upon plugin load
/// </summary>
public void Initialise()
{
manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap"));
manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap"));
}
/// <summary>
@@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <returns>A user profile</returns>
public UserProfileData GetUserByUUID(LLUUID uuid)
{
if(manager.userProfiles.ContainsKey(uuid))
if (manager.userProfiles.ContainsKey(uuid))
return manager.userProfiles[uuid];
return null;
}
@@ -95,7 +93,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="uuid">The users account ID</param>
/// <returns>A matching users profile</returns>
public UserAgentData GetAgentByUUID(LLUUID uuid)
{
{
try
{
return GetUserByUUID(uuid).currentAgent;
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.Data.DB4o
{
try
{
return GetUserByName(fname,lname).currentAgent;
return GetUserByName(fname, lname).currentAgent;
}
catch (Exception)
{
@@ -149,7 +147,7 @@ namespace OpenSim.Framework.Data.DB4o
Console.WriteLine(e.ToString());
}
}
/// <summary>
/// Creates a new user profile
/// </summary>
@@ -157,15 +155,17 @@ namespace OpenSim.Framework.Data.DB4o
/// <returns>True on success, false on error</returns>
public bool UpdateUserProfile(UserProfileData user)
{
try {
try
{
return manager.UpdateRecord(user);
} catch (Exception e) {
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
}
/// <summary>
/// Creates a new user agent
@@ -219,4 +219,4 @@ namespace OpenSim.Framework.Data.DB4o
return "0.1";
}
}
}
}

View File

@@ -1,24 +1,28 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")]
[assembly : AssemblyCopyright("Copyright © 2007")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
[assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
// Version information for an assembly consists of the following four values:
//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]