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/Grid/UserServer/Main.cs | 27 +++++++-------- OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | 31 +++++++++-------- OpenSim/Grid/UserServer/UserLoginService.cs | 39 ++++++++++++---------- OpenSim/Grid/UserServer/UserManager.cs | 17 +++++----- 4 files changed, 59 insertions(+), 55 deletions(-) (limited to 'OpenSim/Grid/UserServer') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 492f67f..779a72b 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -27,28 +27,23 @@ */ using System; -using System.Collections.Generic; using System.IO; -using System.Reflection; -using libsecondlife; +using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; -using OpenSim.Framework; -using OpenSim.Framework; namespace OpenSim.Grid.UserServer { /// /// - public class OpenUser_Main : conscmd_callback + public class OpenUser_Main : conscmd_callback { private UserConfig Cfg; public UserManager m_userManager; public UserLoginService m_loginService; - LogBase m_console; + private LogBase m_console; [STAThread] public static void Main(string[] args) @@ -67,7 +62,8 @@ namespace OpenSim.Grid.UserServer { Directory.CreateDirectory(Util.logDir()); } - m_console = new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); + m_console = + new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); MainLog.Instance = m_console; } @@ -83,7 +79,7 @@ namespace OpenSim.Grid.UserServer public void Startup() { - this.Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); + Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); m_userManager = new UserManager(); @@ -93,15 +89,16 @@ namespace OpenSim.Grid.UserServer m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); - BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); + BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort); httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); - httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); - + httpServer.AddStreamHandler( + new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); + httpServer.Start(); m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); } @@ -126,7 +123,7 @@ namespace OpenSim.Grid.UserServer tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); - m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); + m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); break; } } @@ -178,4 +175,4 @@ namespace OpenSim.Grid.UserServer { } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs index 877f02f..079e05e 100644 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/UserServer/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("OGS-UserServer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OGS-UserServer")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OGS-UserServer")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OGS-UserServer")] +[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("e266513a-090b-4d38-80f6-8599eef68c8c")] + +[assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] // Version information for an assembly consists of the following four values: // @@ -27,5 +31,6 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[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 diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 1523f81..bbef4b2 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -30,12 +30,10 @@ using System; using System.Collections; using System.Net; using Nwc.XmlRpc; -using OpenSim.Framework.Data; -using OpenSim.Framework.UserManagement; -using OpenSim.Framework; -using OpenSim.Framework; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Data; +using OpenSim.Framework.UserManagement; namespace OpenSim.Grid.UserServer { @@ -58,18 +56,24 @@ namespace OpenSim.Grid.UserServer { // Load information from the gridserver RegionProfileData SimInfo = new RegionProfileData(); - SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); + SimInfo = + SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, + m_config.GridSendKey, m_config.GridRecvKey); // Customise the response // Home Location - response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + - "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + - "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + + (SimInfo.regionLocY*256).ToString() + "], " + + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; // Destination - MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); + MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + + SimInfo.regionLocY); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); - response.SimPort = (Int32)SimInfo.serverPort; + response.SimPort = (Int32) SimInfo.serverPort; response.RegionX = SimInfo.regionLocX; response.RegionY = SimInfo.regionLocY; @@ -87,7 +91,7 @@ namespace OpenSim.Grid.UserServer SimParams["firstname"] = theUser.username; SimParams["lastname"] = theUser.surname; SimParams["agent_id"] = theUser.UUID.ToString(); - SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); + SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); @@ -107,21 +111,20 @@ namespace OpenSim.Grid.UserServer XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); } - catch( WebException e ) + catch (WebException e) { - switch( e.Status ) + switch (e.Status) { case WebExceptionStatus.Timeout: //TODO: Send him to nearby or default region instead - MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); + MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + + ")"); break; - + default: throw; } } } } -} - - +} \ No newline at end of file diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 2b2bf72..96cdfb3 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -27,12 +27,10 @@ */ using System; using System.Collections; -using System.Net; +using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Framework.UserManagement; -using OpenSim.Framework; -using libsecondlife; namespace OpenSim.Grid.UserServer { @@ -118,11 +116,11 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; UserProfileData userProfile; if (requestData.Contains("avatar_name")) { - userProfile = GetUserProfile((string)requestData["avatar_name"]); + userProfile = GetUserProfile((string) requestData["avatar_name"]); if (userProfile == null) { return CreateUnknownUserErrorResponse(); @@ -139,12 +137,12 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; UserProfileData userProfile; - System.Console.WriteLine("METHOD BY UUID CALLED"); + Console.WriteLine("METHOD BY UUID CALLED"); if (requestData.Contains("avatar_uuid")) { - userProfile = GetUserProfile((LLUUID)(string)requestData["avatar_uuid"]); + userProfile = GetUserProfile((LLUUID) (string) requestData["avatar_uuid"]); if (userProfile == null) { return CreateUnknownUserErrorResponse(); @@ -158,6 +156,7 @@ namespace OpenSim.Grid.UserServer return ProfileToXmlRPCResponse(userProfile); } + #endregion public override UserProfileData SetupMasterUser(string firstName, string lastName) @@ -170,4 +169,4 @@ namespace OpenSim.Grid.UserServer throw new Exception("The method or operation is not implemented."); } } -} +} \ No newline at end of file -- cgit v1.1