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 --- .../Framework/Communications/UserManagerBase.cs | 49 +++++++++++----------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 006c8ee..cdc3baf 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -33,18 +33,15 @@ using System.Reflection; using System.Security.Cryptography; using libsecondlife; using Nwc.XmlRpc; -using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Data; using OpenSim.Framework.Interfaces; - namespace OpenSim.Framework.UserManagement { public abstract class UserManagerBase : IUserService { public UserConfig _config; - Dictionary _plugins = new Dictionary(); + private Dictionary _plugins = new Dictionary(); /// /// Adds a new user server plugin - user servers will be requested in the order they were loaded. @@ -78,11 +75,12 @@ namespace OpenSim.Framework.UserManagement public void AddPlugin(IUserData plug) { plug.Initialise(); - this._plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); + _plugins.Add(plug.getName(), plug); + MainLog.Instance.Verbose("Userstorage: Added IUserData Interface"); } #region Get UserProfile + /// /// Loads a user profile from a database by UUID /// @@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -126,7 +124,7 @@ namespace OpenSim.Framework.UserManagement catch (Exception e) { System.Console.WriteLine("EEK!"); - MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -145,7 +143,7 @@ namespace OpenSim.Framework.UserManagement { try { - UserProfileData profile = plugin.Value.GetUserByName(fname,lname); + UserProfileData profile = plugin.Value.GetUserByName(fname, lname); profile.currentAgent = getUserAgent(profile.UUID); @@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -170,20 +168,24 @@ namespace OpenSim.Framework.UserManagement { foreach (KeyValuePair plugin in _plugins) { - try { + try + { plugin.Value.UpdateUserProfile(data); return true; - } catch (Exception e) { - MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); + } + catch (Exception e) + { + MainLog.Instance.Verbose("Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); } } - + return false; } #endregion #region Get UserAgent + /// /// Loads a user agent by uuid (not called directly) /// @@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -221,7 +223,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -249,11 +251,11 @@ namespace OpenSim.Framework.UserManagement { try { - return plugin.Value.GetAgentByName(fname,lname); + return plugin.Value.GetAgentByName(fname, lname); } catch (Exception e) { - MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -263,6 +265,7 @@ namespace OpenSim.Framework.UserManagement #endregion #region CreateAgent + /// /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB /// @@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement /// The users loginrequest public void CreateAgent(UserProfileData profile, XmlRpcRequest request) { - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; UserAgentData agent = new UserAgentData(); @@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement // If user specified additional start, use that if (requestData.ContainsKey("start")) { - string startLoc = ((string)requestData["start"]).Trim(); + string startLoc = ((string) requestData["start"]).Trim(); if (!(startLoc == "last" || startLoc == "home")) { // Format: uri:Ahern&162&213&34 @@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement } catch (Exception) { - } } } @@ -323,7 +325,7 @@ namespace OpenSim.Framework.UserManagement // Current location agent.regionID = new LLUUID(); // Fill in later - agent.currentRegion = new LLUUID(); // Fill in later + agent.currentRegion = new LLUUID(); // Fill in later profile.currentAgent = agent; } @@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement try { plugin.Value.AddNewUserProfile(user); - } catch (Exception e) { @@ -376,4 +377,4 @@ namespace OpenSim.Framework.UserManagement public abstract UserProfileData SetupMasterUser(string firstName, string lastName); public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); } -} +} \ No newline at end of file -- cgit v1.1