From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 17 +++++++----- OpenSim/Framework/Data.DB4o/DB4oManager.cs | 21 +++++++-------- OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 24 ++++++++--------- .../Framework/Data.DB4o/Properties/AssemblyInfo.cs | 31 +++++++++++++--------- 4 files changed, 50 insertions(+), 43 deletions(-) (limited to 'OpenSim/Framework/Data.DB4o') diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index bc7225a..a96d9bd 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs @@ -34,18 +34,19 @@ namespace OpenSim.Framework.Data.DB4o /// /// A grid server storage mechanism employing the DB4o database system /// - class DB4oGridData : IGridData + internal class DB4oGridData : IGridData { /// /// The database manager object /// - DB4oGridManager manager; + private DB4oGridManager manager; /// /// Called when the plugin is first loaded (as constructors are not called) /// - public void Initialise() { - manager = new DB4oGridManager("gridserver.yap"); + public void Initialise() + { + manager = new DB4oGridManager("gridserver.yap"); } /// @@ -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); } /// @@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o /// The location the region is logging into (unused in Db4o) /// The shared secret /// Authenticated? - 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; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 9e8a03f..033413a 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs @@ -29,23 +29,23 @@ using System; using System.Collections.Generic; using Db4objects.Db4o; using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework.Data.DB4o { /// /// A Database manager for Db4o /// - class DB4oGridManager + internal class DB4oGridManager { /// /// A list of the current regions connected (in-memory cache) /// public Dictionary simProfiles = new Dictionary(); + /// /// Database File Name /// - string dbfl; + private string dbfl; /// /// 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; } } - - } /// /// A manager for the DB4o database (user profiles) /// - class DB4oUserManager + internal class DB4oUserManager { /// /// A list of the user profiles (in memory cache) /// public Dictionary userProfiles = new Dictionary(); + /// /// Database filename /// - string dbfl; + private string dbfl; /// /// 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 /// The profile to update /// true on success, false on fail to persist to db public bool UpdateRecord(UserProfileData record) - { + { if (userProfiles.ContainsKey(record.UUID)) { userProfiles[record.UUID] = record; @@ -168,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index b00fd02..c7113bf 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs @@ -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 /// /// The database manager /// - DB4oUserManager manager; + private DB4oUserManager manager; /// /// Artificial constructor called upon plugin load /// public void Initialise() { - manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); + manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap")); } /// @@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o /// A user profile 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 /// The users account ID /// A matching users profile 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()); } } - + /// /// Creates a new user profile /// @@ -157,15 +155,17 @@ namespace OpenSim.Framework.Data.DB4o /// True on success, false on error public bool UpdateUserProfile(UserProfileData user) { - try { + try + { return manager.UpdateRecord(user); - } catch (Exception e) { + } + catch (Exception e) + { Console.WriteLine(e.ToString()); return false; } } - /// /// Creates a new user agent @@ -219,4 +219,4 @@ namespace OpenSim.Framework.Data.DB4o return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs index 52d09fa..6183b6e 100644 --- a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file -- cgit v1.1