From efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Dec 2007 21:41:48 +0000 Subject: [PATCH] * Optimized usings * shortened references * Removed redundant 'this' * Normalized EOF --- .../LoadRegions/LoadRegionsPlugin.cs | 23 +- .../LoadRegions/Properties/AssemblyInfo.cs | 31 +- .../RemoteController/RemoteAdminPlugin.cs | 78 ++-- OpenSim/Framework/AgentCircuitData.cs | 10 +- OpenSim/Framework/AgentCircuitManager.cs | 2 +- OpenSim/Framework/AgentInventory.cs | 2 +- OpenSim/Framework/AssetBase.cs | 2 +- OpenSim/Framework/AssetLandmark.cs | 2 +- OpenSim/Framework/AssetStorage.cs | 2 +- OpenSim/Framework/AuthenticateResponse.cs | 2 +- OpenSim/Framework/AvatarWearable.cs | 2 +- OpenSim/Framework/BlockingQueue.cs | 4 +- OpenSim/Framework/ChildAgentDataUpdate.cs | 8 +- OpenSim/Framework/ClientManager.cs | 21 +- .../Communications/Cache/AssetCache.cs | 49 +-- .../Communications/Cache/AssetServer.cs | 6 +- .../Communications/Cache/AssetServerBase.cs | 10 +- .../Cache/AssetTransactionManager.cs | 2 +- .../Communications/Cache/AssetTransactions.cs | 6 +- .../Communications/Cache/CachedUserInfo.cs | 2 +- .../Communications/Cache/GridAssetClient.cs | 15 +- .../Cache/InventoryFolderImpl.cs | 4 +- .../Communications/Cache/LibraryRootFolder.cs | 37 +- .../Communications/Cache/SQLAssetServer.cs | 8 +- .../Cache/UserProfileCacheService.cs | 37 +- .../Communications/Capabilities/Caps.cs | 82 ++-- .../Communications/Capabilities/LLSD.cs | 42 +- .../Communications/Capabilities/LLSDArray.cs | 2 +- .../Capabilities/LLSDAssetUploadComplete.cs | 2 +- .../Capabilities/LLSDCapEvent.cs | 2 +- .../Capabilities/LLSDCapsDetails.cs | 2 +- .../Communications/Capabilities/LLSDEmpty.cs | 2 +- .../Capabilities/LLSDHelpers.cs | 15 +- .../Capabilities/LLSDMapLayer.cs | 2 +- .../Capabilities/LLSDMapLayerResponse.cs | 2 +- .../Capabilities/LLSDStreamHandler.cs | 8 +- .../LLSDTaskInventoryUploadComplete.cs | 14 +- .../Capabilities/LLSDTaskScriptUpdate.cs | 12 +- .../Communications/Capabilities/LLSDTest.cs | 2 +- .../Communications/Capabilities/LLSDType.cs | 2 +- .../Communications/CommunicationsManager.cs | 7 +- .../Framework/Communications/IGridServices.cs | 4 +- .../IInterRegionCommunications.cs | 6 +- .../Communications/IInventoryServices.cs | 2 +- .../Communications/InventoryServiceBase.cs | 5 +- .../Framework/Communications/LoginResponse.cs | 6 +- .../Framework/Communications/LoginService.cs | 25 +- .../Communications/Properties/AssemblyInfo.cs | 2 +- .../Communications/RestClient/RestClient.cs | 16 +- .../Communications/UserManagerBase.cs | 32 +- .../Configuration/XML/XmlConfiguration.cs | 2 +- OpenSim/Framework/ConfigurationMember.cs | 141 +++--- OpenSim/Framework/ConfigurationOption.cs | 1 - OpenSim/Framework/Console/AssemblyInfo.cs | 2 +- .../Framework/Console/ConsoleCallbacksBase.cs | 2 +- OpenSim/Framework/Console/LogBase.cs | 6 +- OpenSim/Framework/Console/MainLog.cs | 2 +- OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 5 +- OpenSim/Framework/Data.DB4o/DB4oManager.cs | 2 +- OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 10 +- .../Framework/Data.MSSQL/MSSQLAssetData.cs | 59 ++- OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | 46 +- .../Data.MSSQL/MSSQLInventoryData.cs | 163 ++++--- OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs | 13 +- OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | 261 +++++------ OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs | 142 +++--- .../Framework/Data.MySQL/MySQLAssetData.cs | 14 +- .../Framework/Data.MySQL/MySQLDataStore.cs | 398 +++++++++-------- OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 49 +-- .../Data.MySQL/MySQLInventoryData.cs | 4 +- OpenSim/Framework/Data.MySQL/MySQLLogData.cs | 2 +- OpenSim/Framework/Data.MySQL/MySQLManager.cs | 2 +- OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 53 ++- .../Framework/Data.SQLite/SQLiteAssetData.cs | 2 +- OpenSim/Framework/Data.SQLite/SQLiteBase.cs | 2 +- .../Framework/Data.SQLite/SQLiteGridData.cs | 5 +- .../Data.SQLite/SQLiteInventoryStore.cs | 6 +- .../Framework/Data.SQLite/SQLiteManager.cs | 2 +- .../Framework/Data.SQLite/SQLiteUserData.cs | 44 +- OpenSim/Framework/Data/GridData.cs | 7 +- OpenSim/Framework/Data/ILogData.cs | 2 +- OpenSim/Framework/Data/IniConfig.cs | 2 +- OpenSim/Framework/Data/RegionProfileData.cs | 2 +- OpenSim/Framework/Data/ReservationData.cs | 2 +- OpenSim/Framework/EstateSettings.cs | 4 +- OpenSim/Framework/GridConfig.cs | 5 +- OpenSim/Framework/IAssetServer.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 56 ++- OpenSim/Framework/IGenericConfig.cs | 2 +- OpenSim/Framework/IRegionCommsListener.cs | 5 +- OpenSim/Framework/IRegionLoader.cs | 7 +- OpenSim/Framework/IScene.cs | 7 +- OpenSim/Framework/IUserData.cs | 8 +- OpenSim/Framework/IUserService.cs | 4 +- OpenSim/Framework/InventoryItemBase.cs | 2 +- OpenSim/Framework/LandData.cs | 7 +- OpenSim/Framework/Login.cs | 2 +- OpenSim/Framework/NeighbourInfo.cs | 2 +- OpenSim/Framework/NetworkServersInfo.cs | 8 +- OpenSim/Framework/PrimitiveBaseShape.cs | 32 +- OpenSim/Framework/RegionCommsListener.cs | 13 +- OpenSim/Framework/RegionInfo.cs | 205 +++++---- .../Filesystem/RegionLoaderFileSystem.cs | 8 +- .../RegionLoader/Web/RegionLoaderWebServer.cs | 37 +- OpenSim/Framework/Remoting.cs | 2 +- OpenSim/Framework/SerializableRegionInfo.cs | 79 +--- OpenSim/Framework/Servers/BaseHttpServer.cs | 66 +-- OpenSim/Framework/Servers/CheckSumServer.cs | 2 +- OpenSim/Framework/Servers/RestMethod.cs | 2 +- OpenSim/Framework/Servers/RestObjectPoster.cs | 8 +- .../Servers/RestObjectPosterResponse.cs | 14 +- .../Servers/SynchronousRestObjectPoster.cs | 14 +- OpenSim/Framework/Servers/XmlRpcMethod.cs | 2 +- OpenSim/Framework/UserConfig.cs | 11 +- OpenSim/Framework/UserProfileData.cs | 15 +- OpenSim/Framework/Util.cs | 17 +- OpenSim/Framework/sLLVector3.cs | 7 +- OpenSim/Grid/AssetServer/Main.cs | 2 +- .../AssetServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Grid/AssetServer/RestService.cs | 4 +- OpenSim/Grid/GridServer/GridManager.cs | 17 +- OpenSim/Grid/GridServer/Main.cs | 4 +- .../GridServer/Properties/AssemblyInfo.cs | 2 +- .../InventoryServer/GridInventoryService.cs | 45 +- .../Grid/InventoryServer/InventoryManager.cs | 43 +- OpenSim/Grid/InventoryServer/Main.cs | 34 +- OpenSim/Grid/ScriptServer/Application.cs | 2 +- .../ScriptServer/RegionCommManager.cs | 2 +- .../ScriptEngineInterface.cs | 2 +- .../ScriptEngineManager/ScriptEngineLoader.cs | 2 +- OpenSim/Grid/UserServer/Main.cs | 21 +- OpenSim/Grid/UserServer/UserLoginService.cs | 65 ++- OpenSim/Grid/UserServer/UserManager.cs | 32 +- OpenSim/Region/Application/Application.cs | 2 +- .../Region/Application/IApplicationPlugin.cs | 11 +- OpenSim/Region/Application/OpenSimMain.cs | 85 ++-- OpenSim/Region/Application/VersionInfo.cs | 2 +- .../ClientStack/ClientStackNetworkHandler.cs | 2 +- OpenSim/Region/ClientStack/ClientView.cs | 376 ++++++++-------- OpenSim/Region/ClientStack/PacketQueue.cs | 196 +++++---- OpenSim/Region/ClientStack/PacketServer.cs | 13 +- OpenSim/Region/ClientStack/PacketThrottle.cs | 43 +- OpenSim/Region/ClientStack/QueItem.cs | 18 +- .../ClientStack/RegionApplicationBase.cs | 9 +- OpenSim/Region/ClientStack/UDPServer.cs | 89 ++-- .../Local/CommunicationsLocal.cs | 2 +- .../Local/LocalBackEndServices.cs | 40 +- .../Local/LocalInventoryService.cs | 10 +- .../Communications/Local/LocalLoginService.cs | 14 +- .../Communications/Local/LocalUserServices.cs | 3 +- .../Communications/OGS1/OGS1GridServices.cs | 219 +++++---- .../Communications/OGS1/OGS1InterSimComms.cs | 32 +- .../OGS1/OGS1InventoryService.cs | 24 +- .../Communications/OGS1/OGS1UserServices.cs | 29 +- OpenSim/Region/Environment/EstateManager.cs | 24 +- .../Environment/Interfaces/IAvatarFactory.cs | 1 - .../Environment/Interfaces/IHttpRequests.cs | 2 +- .../Interfaces/IRegionDataStore.cs | 7 +- .../Region/Environment/LandManagement/Land.cs | 61 ++- .../Environment/LandManagement/LandManager.cs | 95 ++-- OpenSim/Region/Environment/ModuleLoader.cs | 2 +- .../Modules/AvatarFactoryModule.cs | 17 +- .../Region/Environment/Modules/ChatModule.cs | 10 +- .../Modules/ScriptsHttpRequests.cs | 224 +++++----- .../Region/Environment/Modules/SunModule.cs | 37 +- .../Modules/TextureDownloadModule.cs | 42 +- .../Environment/Modules/WorldCommModule.cs | 4 +- .../Environment/Modules/XMLRPCModule.cs | 9 +- .../Region/Environment/PermissionManager.cs | 31 +- .../Environment/Scenes/AvatarAnimations.cs | 17 +- .../Environment/Scenes/AvatarAppearance.cs | 14 +- .../Region/Environment/Scenes/EntityBase.cs | 5 +- .../Environment/Scenes/IScenePresenceBody.cs | 1 - .../Region/Environment/Scenes/InnerScene.cs | 123 +++--- .../Environment/Scenes/Scene.Inventory.cs | 187 ++++---- .../Scenes/Scene.PacketHandlers.cs | 19 +- OpenSim/Region/Environment/Scenes/Scene.cs | 406 +++++++++-------- .../Region/Environment/Scenes/SceneBase.cs | 11 +- .../Scenes/SceneCommunicationService.cs | 72 +-- .../Region/Environment/Scenes/SceneEvents.cs | 12 +- .../Region/Environment/Scenes/SceneManager.cs | 9 +- .../Environment/Scenes/SceneObjectGroup.cs | 93 ++-- .../Environment/Scenes/SceneObjectPart.cs | 414 +++++++++--------- .../Environment/Scenes/ScenePresence.cs | 132 +++--- .../Environment/Scenes/SceneXmlLoader.cs | 25 +- .../Scenes/Scripting/ScriptEngineInterface.cs | 2 +- .../Scenes/Scripting/ScriptEngineLoader.cs | 2 +- .../Environment/Scenes/SimStatsReporter.cs | 69 +-- .../Examples/SimpleApp/FileSystemObject.cs | 1 - .../Examples/SimpleApp/MyNpcCharacter.cs | 27 +- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 9 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 5 +- .../Engines/CSharp/CSharpScriptEngine.cs | 2 +- .../CSharp/Examples/ExportRegionToLSL.cs | 2 +- .../Engines/JScript/JScriptEngine.cs | 2 +- .../Engines/JVMEngine/JVM/ClassInstance.cs | 2 +- .../Engines/JVMEngine/JVM/ClassRecord.cs | 2 +- .../Engines/JVMEngine/JVM/Heap.cs | 2 +- .../JVMEngine/JVM/Interpreter.Logic.cs | 2 +- .../JVMEngine/JVM/Interpreter.Methods.cs | 2 +- .../JVMEngine/JVM/Interpreter.Return.cs | 2 +- .../Engines/JVMEngine/JVM/Interpreter.cs | 2 +- .../Engines/JVMEngine/JVM/MainMemory.cs | 2 +- .../Engines/JVMEngine/JVM/MethodMemory.cs | 2 +- .../Engines/JVMEngine/JVM/Object.cs | 2 +- .../Engines/JVMEngine/JVM/Stack.cs | 2 +- .../Engines/JVMEngine/JVM/StackFrame.cs | 2 +- .../Engines/JVMEngine/JVM/Thread.cs | 2 +- .../Engines/JVMEngine/OpenSimJVM.cs | 2 +- .../Region/ExtensionsScriptModule/Script.cs | 2 +- .../ExtensionsScriptModule/ScriptInfo.cs | 2 +- .../ExtensionsScriptModule/ScriptManager.cs | 2 +- .../BasicPhysicsPlugin/AssemblyInfo.cs | 2 +- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 42 +- .../Physics/BulletXPlugin/AssemblyInfo.cs | 2 +- .../Physics/BulletXPlugin/BulletXPlugin.cs | 206 +++++---- .../BulletXPlugin/TriangleIndexVertexArray.cs | 69 ++- .../Region/Physics/Manager/AssemblyInfo.cs | 2 +- OpenSim/Region/Physics/Manager/IMesher.cs | 9 +- .../Region/Physics/Manager/PhysicsActor.cs | 105 +++-- .../Physics/Manager/PhysicsPluginManager.cs | 8 +- .../Region/Physics/Manager/PhysicsScene.cs | 15 +- .../Region/Physics/Manager/PhysicsVector.cs | 15 +- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 9 +- OpenSim/Region/Physics/Meshing/Extruder.cs | 21 +- OpenSim/Region/Physics/Meshing/HelperTypes.cs | 10 +- OpenSim/Region/Physics/Meshing/Mesh.cs | 42 +- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 74 ++-- OpenSim/Region/Physics/Meshing/SimpleHull.cs | 120 ++--- OpenSim/Region/Physics/Meshing/Simplex.cs | 49 +-- .../Region/Physics/OdePlugin/AssemblyInfo.cs | 2 +- .../Region/Physics/OdePlugin/ODECharacter.cs | 114 +++-- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 175 ++++---- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 334 +++++++------- .../Region/Physics/POSPlugin/AssemblyInfo.cs | 2 +- OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 84 ++-- .../Physics/PhysXPlugin/AssemblyInfo.cs | 2 +- .../Region/Physics/PhysXPlugin/PhysXPlugin.cs | 124 +++--- .../Common/LSL_BuiltIn_Commands_Interface.cs | 2 +- .../Region/ScriptEngine/Common/LSL_Types.cs | 66 +-- .../ScriptEngine/DotNetEngine/Common.cs | 2 +- .../DotNetEngine/Compiler/LSL/Compiler.cs | 9 +- .../Compiler/LSL/LSL2CSConverter.cs | 4 +- .../Compiler/LSL/LSL_BaseClass.cs | 8 +- .../Server_API/LSL_BuiltIn_Commands.cs | 2 - .../ScriptEngine/DotNetEngine/EventManager.cs | 2 +- .../DotNetEngine/EventQueueManager.cs | 21 +- .../DotNetEngine/LSLLongCmdHandler.cs | 14 +- .../ScriptEngine/DotNetEngine/ScriptEngine.cs | 2 +- .../DotNetEngine/ScriptManager.cs | 65 +-- .../OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | 309 ++++++------- .../MonoSqliteDataStore.cs | 300 +++++++------ .../NullDataStore.cs | 5 +- .../Properties/AssemblyInfo.cs | 2 +- .../Terrain.BasicTerrain/TerrainEngine.cs | 35 +- .../Terrain.BasicTerrain/TerrainFilter.cs | 2 +- .../libTerrainBSD/Bitmap/Bitmap.cs | 2 +- .../libTerrainBSD/Channel/Channel.cs | 2 +- .../libTerrainBSD/Channel/Common.cs | 2 +- .../libTerrainBSD/Channel/Editing/Flatten.cs | 2 +- .../libTerrainBSD/Channel/Editing/Raise.cs | 2 +- .../libTerrainBSD/Channel/File.cs | 2 +- .../Channel/Generators/Fracture.cs | 2 +- .../Channel/Generators/Gradient.cs | 2 +- .../Channel/Generators/HillPlanter.cs | 2 +- .../libTerrainBSD/Channel/Generators/Noise.cs | 2 +- .../Channel/Generators/Spiral.cs | 2 +- .../Channel/Generators/Voronoi.cs | 2 +- .../libTerrainBSD/Channel/Generators/Worms.cs | 2 +- .../libTerrainBSD/Channel/Grid.cs | 2 +- .../Channel/Manipulators/AerobicErosion.cs | 2 +- .../Channel/Manipulators/HydraulicErosion.cs | 2 +- .../Channel/Manipulators/NavierStokes.cs | 2 +- .../Channel/Manipulators/ThermalWeathering.cs | 2 +- .../libTerrainBSD/Channel/Neighbours.cs | 2 +- .../libTerrainBSD/Channel/Operators.cs | 2 +- OpenSim/Tools/Export/OpenSimExport.cs | 36 +- 277 files changed, 4685 insertions(+), 4408 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 3c27108448..b897c60617 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -26,21 +26,14 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim; -using OpenSim.Framework.Console; +using Mono.Addins; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Framework.RegionLoader.Filesystem; using OpenSim.Framework.RegionLoader.Web; -using Mono.Addins; -using Mono.Addins.Description; -using Nini; -using Nini.Config; -[assembly:Addin] -[assembly:AddinDependency ("OpenSim", "0.4")] +[assembly : Addin] +[assembly : AddinDependency("OpenSim", "0.4")] namespace OpenSim.ApplicationPlugins.LoadRegions { @@ -65,7 +58,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions regionLoader.SetIniConfigSource(openSim.ConfigSource); RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); - + openSim.ModuleLoader.LoadDefaultSharedModules(); for (int i = 0; i < regionsToLoad.Length; i++) @@ -77,6 +70,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions openSim.ModuleLoader.PostInitialise(); openSim.ModuleLoader.ClearCache(); } + public void LoadRegionFromConfig(OpenSimMain openSim, ulong regionhandle) { MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised"); @@ -103,11 +97,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions openSim.CreateRegion(regionsToLoad[i]); } } - } + public void Close() { - } } } \ No newline at end of file diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs index 0b5f4bd539..ffb3e48bf4 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs @@ -1,26 +1,28 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +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.Addin")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Addin")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Addin")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Addin")] +[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("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")] + +[assembly : Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")] // Version information for an assembly consists of the following four values: // @@ -32,5 +34,6 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[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/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9ae1a7b239..b57d3e6b66 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -27,24 +27,19 @@ */ using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using OpenSim; -using OpenSim.Framework.Console; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using Mono.Addins; -using Mono.Addins.Description; -using Nini; -using Nini.Config; -using Nwc.XmlRpc; using System.Collections; +using System.Net; using System.Timers; using libsecondlife; +using Mono.Addins; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; +using OpenSim.Region.Environment.Scenes; -[assembly: Addin] -[assembly: AddinDependency("OpenSim", "0.4")] +[assembly : Addin] +[assembly : AddinDependency("OpenSim", "0.4")] namespace OpenSim.ApplicationPlugins.LoadRegions { @@ -54,6 +49,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions private OpenSimMain m_app; private BaseHttpServer m_httpd; private string requiredPassword = ""; + public void Initialise(OpenSimMain openSim) { try @@ -81,12 +77,13 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; - LLUUID regionID = new LLUUID((string)requestData["regionID"]); + LLUUID regionID = new LLUUID((string) requestData["regionID"]); Hashtable responseData = new Hashtable(); - if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) + if (requiredPassword != "" && + (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) { responseData["accepted"] = "false"; response.Value = responseData; @@ -96,7 +93,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions responseData["accepted"] = "true"; response.Value = responseData; - OpenSim.Region.Environment.Scenes.Scene RebootedScene; + Scene RebootedScene; if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene)) { @@ -115,18 +112,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; Hashtable responseData = new Hashtable(); - if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) + if (requiredPassword != "" && + (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) { responseData["accepted"] = "false"; response.Value = responseData; } else { - - string message = (string)requestData["message"]; + string message = (string) requestData["message"]; MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message); responseData["accepted"] = "true"; @@ -142,23 +139,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request"); XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; Hashtable responseData = new Hashtable(); - if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) + if (requiredPassword != "" && + (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) { responseData["accepted"] = "false"; response.Value = responseData; } else { - if ((string)requestData["shutdown"] == "delayed") + if ((string) requestData["shutdown"] == "delayed") { - int timeout = (Int32)requestData["milliseconds"]; + int timeout = (Int32) requestData["milliseconds"]; responseData["accepted"] = "true"; response.Value = responseData; - m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + + m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + " second(s). Please save what you are doing and log out."); // Perform shutdown @@ -197,9 +195,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request"); XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; Hashtable responseData = new Hashtable(); - if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) + if (requiredPassword != "" && + (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) { responseData["created"] = "false"; response.Value = responseData; @@ -210,22 +209,22 @@ namespace OpenSim.ApplicationPlugins.LoadRegions try { - newRegionData.RegionID = (string)requestData["region_id"]; - newRegionData.RegionName = (string)requestData["region_name"]; - newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]); - newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]); + newRegionData.RegionID = (string) requestData["region_id"]; + newRegionData.RegionName = (string) requestData["region_name"]; + newRegionData.RegionLocX = Convert.ToUInt32((Int32) requestData["region_x"]); + newRegionData.RegionLocY = Convert.ToUInt32((Int32) requestData["region_y"]); // Security risk - newRegionData.DataStore = (string)requestData["datastore"]; + newRegionData.DataStore = (string) requestData["datastore"]; newRegionData.InternalEndPoint = new IPEndPoint( - IPAddress.Parse((string)requestData["listen_ip"]), 0); + IPAddress.Parse((string) requestData["listen_ip"]), 0); - newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"]; - newRegionData.ExternalHostName = (string)requestData["external_address"]; + newRegionData.InternalEndPoint.Port = (Int32) requestData["listen_port"]; + newRegionData.ExternalHostName = (string) requestData["external_address"]; - newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; - newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; + newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; + newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; m_app.CreateRegion(newRegionData); @@ -245,7 +244,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public void Close() { - } } } \ No newline at end of file diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 0617a76ab2..65a072f056 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -35,12 +35,13 @@ namespace OpenSim.Framework public AgentCircuitData() { } + public AgentCircuitData(sAgentCircuitData cAgent) { AgentID = new LLUUID(cAgent.AgentID); SessionID = new LLUUID(cAgent.SessionID); SecureSessionID = new LLUUID(cAgent.SecureSessionID); - startpos = new LLVector3(cAgent.startposx,cAgent.startposy,cAgent.startposz); + startpos = new LLVector3(cAgent.startposx, cAgent.startposy, cAgent.startposz); firstname = cAgent.firstname; lastname = cAgent.lastname; circuitcode = cAgent.circuitcode; @@ -69,6 +70,7 @@ namespace OpenSim.Framework public sAgentCircuitData() { } + public sAgentCircuitData(AgentCircuitData cAgent) { AgentID = cAgent.AgentID.UUID; @@ -85,6 +87,7 @@ namespace OpenSim.Framework BaseFolder = cAgent.BaseFolder.UUID; CapsPath = cAgent.CapsPath; } + public Guid AgentID; public Guid SessionID; public Guid SecureSessionID; @@ -98,8 +101,5 @@ namespace OpenSim.Framework public Guid InventoryFolder; public Guid BaseFolder; public string CapsPath = ""; - - - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs index 2803a4a82f..938dce8db9 100644 --- a/OpenSim/Framework/AgentCircuitManager.cs +++ b/OpenSim/Framework/AgentCircuitManager.cs @@ -124,4 +124,4 @@ namespace OpenSim.Framework return false; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AgentInventory.cs b/OpenSim/Framework/AgentInventory.cs index 541bc27514..84a782b9df 100644 --- a/OpenSim/Framework/AgentInventory.cs +++ b/OpenSim/Framework/AgentInventory.cs @@ -255,4 +255,4 @@ namespace OpenSim.Framework return result; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 5775f060c7..2bef61b0e8 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -52,4 +52,4 @@ namespace OpenSim.Framework Name = name; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index d83b43bce8..050b80f27f 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs @@ -56,4 +56,4 @@ namespace OpenSim.Framework LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AssetStorage.cs b/OpenSim/Framework/AssetStorage.cs index 9e0cf101dd..7d6cdf0a5e 100644 --- a/OpenSim/Framework/AssetStorage.cs +++ b/OpenSim/Framework/AssetStorage.cs @@ -45,4 +45,4 @@ namespace OpenSim.Framework public string Name; public LLUUID UUID; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AuthenticateResponse.cs b/OpenSim/Framework/AuthenticateResponse.cs index 7d4cd11d81..90c9acd863 100644 --- a/OpenSim/Framework/AuthenticateResponse.cs +++ b/OpenSim/Framework/AuthenticateResponse.cs @@ -36,4 +36,4 @@ namespace OpenSim.Framework { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index d0c68defeb..c7083f39b9 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -68,4 +68,4 @@ namespace OpenSim.Framework } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index a3cae63425..ae2a189045 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -34,7 +34,7 @@ namespace OpenSim.Framework { private Queue _queue = new Queue(); private object _queueSync = new object(); - + public void Enqueue(T value) { lock (_queueSync) @@ -55,4 +55,4 @@ namespace OpenSim.Framework } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index fb9a48ffeb..32ce4ab91a 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -27,8 +27,6 @@ */ using System; -using System.Collections.Generic; -using System.Text; namespace OpenSim.Framework { @@ -37,8 +35,8 @@ namespace OpenSim.Framework { public ChildAgentDataUpdate() { - } + public sLLVector3 Position; public ulong regionHandle; public float drawdistance; @@ -47,6 +45,6 @@ namespace OpenSim.Framework public float AVHeight; public Guid AgentID; public float godlevel; - public byte[] throttles; + public byte[] throttles; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index e32c9ebbc7..da60ed776b 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs @@ -26,9 +26,11 @@ * */ +using System; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; +using OpenSim.Framework.Console; namespace OpenSim.Framework { @@ -40,7 +42,6 @@ namespace OpenSim.Framework public void ForEachClient(ForEachClientDelegate whatToDo) { - // Wasteful, I know IClientAPI[] LocalClients = new IClientAPI[0]; lock (m_clients) @@ -55,9 +56,11 @@ namespace OpenSim.Framework { whatToDo(LocalClients[i]); } - catch (System.Exception e) + catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("CLIENT", "Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString()); + MainLog.Instance.Warn("CLIENT", + "Unable to do ForEachClient for one of the clients" + "\n Reason: " + + e.ToString()); } } } @@ -107,20 +110,19 @@ namespace OpenSim.Framework IClientAPI client; try { - if (m_clients.TryGetValue(circuits[i], out client)) { Remove(client.CircuitCode); client.Close(false); } } - catch (System.Exception e) + catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Error("CLIENT", "Unable to shutdown circuit for: " + agentId.ToString() + "\n Reason: " + e.ToString()); + MainLog.Instance.Error("CLIENT", + "Unable to shutdown circuit for: " + agentId.ToString() + "\n Reason: " + + e.ToString()); } } - - } private uint[] GetAllCircuits(LLUUID agentId) @@ -135,7 +137,7 @@ namespace OpenSim.Framework } - for (int i = 0; i < LocalClients.Length; i++ ) + for (int i = 0; i < LocalClients.Length; i++) { if (LocalClients[i].AgentId == agentId) { @@ -168,7 +170,6 @@ namespace OpenSim.Framework packet.AgentData.SessionID = LocalClients[i].SessionId; LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task); } - } } diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 4765548bbe..664625e4b6 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Threading; using libsecondlife; using libsecondlife.Packets; @@ -92,7 +91,7 @@ namespace OpenSim.Framework.Communications.Cache Thread.Sleep(500); } catch (Exception e) - { + { m_log.Error("ASSETCACHE", e.ToString()); } } @@ -177,30 +176,29 @@ namespace OpenSim.Framework.Communications.Cache // packets from the client. int pollPeriod = 200; int maxPolls = 15; - + AssetBase asset = GetCachedAsset(assetID); if (asset != null) { return asset; } - - m_assetServer.RequestAsset(assetID, isTexture); - + + m_assetServer.RequestAsset(assetID, isTexture); + do { Thread.Sleep(pollPeriod); - + asset = GetCachedAsset(assetID); if (asset != null) { return asset; } - } - while (--maxPolls > 0); - + } while (--maxPolls > 0); + MainLog.Instance.Warn( "ASSETCACHE", "Asset {0} was not received before the retrieval timeout was reached"); - + return null; } @@ -368,12 +366,13 @@ namespace OpenSim.Framework.Communications.Cache { // over max number of bytes so split up file long restData = data.LongLength - m_maxPacketSize; - int restPackets = (int) ((restData + m_maxPacketSize - 1) / m_maxPacketSize); + int restPackets = (int) ((restData + m_maxPacketSize - 1)/m_maxPacketSize); numPackets += restPackets; } return numPackets; } + #region Assets /// @@ -448,7 +447,7 @@ namespace OpenSim.Framework.Communications.Cache AssetRequest req; for (int i = 0; i < num; i++) { - req = (AssetRequest)AssetRequests[i]; + req = (AssetRequest) AssetRequests[i]; //Console.WriteLine("sending asset " + req.RequestAssetID); TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; @@ -458,7 +457,7 @@ namespace OpenSim.Framework.Communications.Cache { Transfer.TransferInfo.Params = new byte[20]; Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); - int assType = (int)req.AssetInf.Type; + int assType = (int) req.AssetInf.Type; Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); } else if (req.AssetRequestSource == 3) @@ -468,7 +467,7 @@ namespace OpenSim.Framework.Communications.Cache //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); } - Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; + Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; req.RequestUser.OutPacket(Transfer, ThrottleOutPacketType.Asset); @@ -488,20 +487,20 @@ namespace OpenSim.Framework.Communications.Cache // libsecondlife hardcodes 1500 as the maximum data chunk size int maxChunkSize = 1500; int packetNumber = 0; - + while (processedLength < req.AssetInf.Data.Length) { TransferPacketPacket TransferPacket = new TransferPacketPacket(); TransferPacket.TransferData.Packet = packetNumber; TransferPacket.TransferData.ChannelType = 2; TransferPacket.TransferData.TransferID = req.TransferRequestID; - - int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize); + + int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize); byte[] chunk = new byte[chunkSize]; - Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length); - + Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length); + TransferPacket.TransferData.Data = chunk; - + // 0 indicates more packets to come, 1 indicates last packet if (req.AssetInf.Data.Length - processedLength > maxChunkSize) { @@ -510,10 +509,10 @@ namespace OpenSim.Framework.Communications.Cache else { TransferPacket.TransferData.Status = 1; - } - + } + req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset); - + processedLength += chunkSize; packetNumber++; } @@ -609,4 +608,4 @@ namespace OpenSim.Framework.Communications.Cache } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index ae6494fb3d..692ee1e499 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs @@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); if (result.Count > 0) { - foundAsset = (AssetStorage)result.Next(); + foundAsset = (AssetStorage) result.Next(); found = true; } @@ -93,7 +93,7 @@ namespace OpenSim.Framework.Communications.Cache asset.Name = foundAsset.Name; idata = foundAsset.Data; asset.Data = idata; - + return asset; } else @@ -141,4 +141,4 @@ namespace OpenSim.Framework.Communications.Cache return (asset.UUID == _findID); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 43d3dd9f41..1b2c836268 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs @@ -69,7 +69,7 @@ namespace OpenSim.Framework.Communications.Cache { MainLog.Instance.Verbose( "ASSET", "Asset {0} received from asset server", req.AssetID); - + _receiver.AssetReceived(asset, req.IsTexture); } else @@ -112,9 +112,9 @@ namespace OpenSim.Framework.Communications.Cache ProcessRequest(req); } - catch(Exception e) + catch (Exception e) { - MainLog.Instance.Error("ASSETSERVER", e.Message ); + MainLog.Instance.Error("ASSETSERVER", e.Message); } } } @@ -149,7 +149,7 @@ namespace OpenSim.Framework.Communications.Cache req.AssetID = assetID; req.IsTexture = isTexture; _assetRequests.Enqueue(req); - + MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID); } @@ -253,4 +253,4 @@ namespace OpenSim.Framework.Communications.Cache assets.ForEach(action); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs index 7de84fa754..c9c9541805 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs @@ -106,4 +106,4 @@ namespace OpenSim.Framework.Communications.Cache } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index 57c1fa6ea6..8aa567ce00 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs @@ -182,7 +182,7 @@ namespace OpenSim.Framework.Communications.Cache Asset.Description = "empty"; Asset.Local = storeLocal; Asset.Temporary = tempFile; - + TransactionID = transaction; m_storeLocal = storeLocal; if (Asset.Data.Length > 2) @@ -312,6 +312,7 @@ namespace OpenSim.Framework.Communications.Cache } #region Nested Classes currently not in use (waiting for them to be enabled) + public class AssetCapsUploader { // Fields @@ -424,6 +425,7 @@ namespace OpenSim.Framework.Communications.Cache return text; } } + #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index a547c8a938..1cf95b7989 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -130,4 +130,4 @@ namespace OpenSim.Framework.Communications.Cache return result; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 9c460c7a30..cf54fa4484 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -27,10 +27,8 @@ */ using System; -using System.Collections.Generic; using System.IO; using System.Xml.Serialization; -using libsecondlife; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -65,9 +63,9 @@ namespace OpenSim.Framework.Communications.Cache if (s.Length > 0) { - XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); - - return (AssetBase)xs.Deserialize(s); + XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); + + return (AssetBase) xs.Deserialize(s); } } catch (Exception e) @@ -76,12 +74,11 @@ namespace OpenSim.Framework.Communications.Cache MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString()); MainLog.Instance.Error("ASSETCACHE", e.StackTrace); } - + return null; } - public override void UpdateAsset(AssetBase asset) { throw new Exception("The method or operation is not implemented."); @@ -119,8 +116,6 @@ namespace OpenSim.Framework.Communications.Cache throw new Exception("The method or operation is not implemented."); } - - #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index 1d2c920a81..a1e79b22b5 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs @@ -65,7 +65,7 @@ namespace OpenSim.Framework.Communications.Cache InventoryFolderImpl subFold = new InventoryFolderImpl(); subFold.name = folderName; subFold.folderID = folderID; - subFold.type = (short)type; + subFold.type = (short) type; subFold.parentID = this.folderID; subFold.agentID = agentID; SubFolders.Add(subFold.folderID, subFold); @@ -153,4 +153,4 @@ namespace OpenSim.Framework.Communications.Cache return folderList; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index 4c8eddfa97..fd93b19bcf 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -49,8 +49,8 @@ namespace OpenSim.Framework.Communications.Cache folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); name = "OpenSim Library"; parentID = LLUUID.Zero; - type = (short)-1; - version = (ushort)1; + type = (short) -1; + version = (ushort) 1; InventoryFolderImpl folderInfo = new InventoryFolderImpl(); folderInfo.agentID = libOwner; @@ -81,28 +81,41 @@ namespace OpenSim.Framework.Communications.Cache private void CreateLibraryItems() { - InventoryItemBase item = CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"), new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape", (int)AssetType.Bodypart, (int)InventoryType.Wearable, folderID); + InventoryItemBase item = + CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"), + new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape", + (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID); item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; Items.Add(item.inventoryID, item); - item = CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"), new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin", (int)AssetType.Bodypart, (int)InventoryType.Wearable, folderID); + item = + CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"), + new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin", + (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID); item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; Items.Add(item.inventoryID, item); - item = CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"), new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt", (int)AssetType.Clothing, (int)InventoryType.Wearable, folderID); + item = + CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"), + new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt", + (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID); item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; Items.Add(item.inventoryID, item); - item = CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"), new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants", (int)AssetType.Clothing, (int)InventoryType.Wearable, folderID); + item = + CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"), + new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants", + (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID); item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; Items.Add(item.inventoryID, item); } - public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description, int assetType, int invType, LLUUID parentFolderID) + public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description, + int assetType, int invType, LLUUID parentFolderID) { InventoryItemBase item = new InventoryItemBase(); item.avatarID = libOwner; @@ -135,10 +148,10 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryName = source.Configs[i].GetString("name", ""); item.assetType = source.Configs[i].GetInt("assetType", 0); item.invType = source.Configs[i].GetInt("inventoryType", 0); - item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); - item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); - item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); - item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); + item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); + item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); + item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); + item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); if (item.assetType == 0) { item.parentFolderID = m_textureFolder.folderID; @@ -152,4 +165,4 @@ namespace OpenSim.Framework.Communications.Cache } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 7fcff10263..e4c278f716 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs @@ -57,7 +57,7 @@ namespace OpenSim.Framework.Communications.Cache if (typeInterface != null) { IAssetProvider plug = - (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); m_assetProviderPlugin = plug; m_assetProviderPlugin.Initialise(); @@ -84,8 +84,8 @@ namespace OpenSim.Framework.Communications.Cache { asset = m_assetProviderPlugin.FetchAsset(req.AssetID); } - - return asset; + + return asset; } protected override void StoreAsset(AssetBase asset) @@ -98,4 +98,4 @@ namespace OpenSim.Framework.Communications.Cache m_assetProviderPlugin.CommitAssets(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 47f970ef3f..14670fda5c 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -130,7 +130,8 @@ namespace OpenSim.Framework.Communications.Cache } } - public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID) + public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name, + LLUUID parentID) { CachedUserInfo userProfile; @@ -143,7 +144,7 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.folderID = folderID; baseFolder.name = name; baseFolder.parentID = parentID; - baseFolder.type = (short)type; + baseFolder.type = (short) type; baseFolder.version = userProfile.RootFolder.version; m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); } @@ -180,12 +181,12 @@ namespace OpenSim.Framework.Communications.Cache bool fetchFolders, bool fetchItems, int sortOrder) { // XXX We're not handling sortOrder yet! - + InventoryFolderImpl fold = null; if (folderID == libraryRoot.folderID) { remoteClient.SendInventoryFolderDetails( - libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(), + libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(), libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems); return; @@ -194,7 +195,7 @@ namespace OpenSim.Framework.Communications.Cache if ((fold = libraryRoot.HasSubFolder(folderID)) != null) { remoteClient.SendInventoryFolderDetails( - libraryRoot.agentID, folderID, fold.RequestListOfItems(), + libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fetchFolders, fetchItems); return; @@ -209,9 +210,9 @@ namespace OpenSim.Framework.Communications.Cache { remoteClient.SendInventoryFolderDetails( remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(), - userProfile.RootFolder.RequestListOfFolders(), + userProfile.RootFolder.RequestListOfFolders(), fetchFolders, fetchItems); - + return; } else @@ -219,9 +220,9 @@ namespace OpenSim.Framework.Communications.Cache if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) { remoteClient.SendInventoryFolderDetails( - remoteClient.AgentId, folderID, fold.RequestListOfItems(), + remoteClient.AgentId, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fetchFolders, fetchItems); - + return; } } @@ -230,20 +231,20 @@ namespace OpenSim.Framework.Communications.Cache { MainLog.Instance.Error( "INVENTORYCACHE", "Could not find root folder for user {0}", remoteClient.Name); - + return; } } else { MainLog.Instance.Error( - "INVENTORYCACHE", - "Could not find user profile for {0} for folder {1}", - remoteClient.Name, folderID); - + "INVENTORYCACHE", + "Could not find user profile for {0} for folder {1}", + remoteClient.Name, folderID); + return; } - + // If we've reached this point then we couldn't find the folder, even though the client thinks // it exists MainLog.Instance.Error( @@ -262,8 +263,8 @@ namespace OpenSim.Framework.Communications.Cache InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID); if (subFolder != null) { - List items=subFolder.RequestListOfItems(); - foreach(InventoryItemBase item in items) + List items = subFolder.RequestListOfItems(); + foreach (InventoryItemBase item in items) { userProfile.DeleteItem(remoteClient.AgentId, item); } @@ -300,4 +301,4 @@ namespace OpenSim.Framework.Communications.Cache m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index e00f49d64e..4b420468e0 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -38,33 +38,33 @@ using OpenSim.Framework.Servers; namespace OpenSim.Region.Capabilities { public delegate void UpLoadedAsset( - string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, + string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); - + public delegate void UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data); public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); - - public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, - bool isScriptRunning, byte[] data); + + public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, + bool isScriptRunning, byte[] data); public class Caps { private string m_httpListenerHostName; private uint m_httpListenPort; - + private string m_capsObjectPath = "00001-"; private string m_requestPath = "0000/"; private string m_mapLayerPath = "0001/"; private string m_newInventory = "0002/"; - //private string m_requestTexture = "0003/"; + //private string m_requestTexture = "0003/"; private string m_notecardUpdatePath = "0004/"; private string m_notecardTaskUpdatePath = "0005/"; - + //private string eventQueue = "0100/"; private BaseHttpServer m_httpListener; private LLUUID m_agentID; @@ -78,7 +78,7 @@ namespace OpenSim.Region.Capabilities public NewInventoryItem AddNewInventoryItem = null; public ItemUpdatedCallback ItemUpdatedCall = null; public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; - + public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) { @@ -138,7 +138,7 @@ namespace OpenSim.Region.Capabilities /// public string CapsRequest(string request, string path, string param) { - //Console.WriteLine("caps request " + request); + //Console.WriteLine("caps request " + request); string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities()); return result; } @@ -153,7 +153,7 @@ namespace OpenSim.Region.Capabilities string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; caps.MapLayer = capsBaseUrl + m_mapLayerPath; - // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; + // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; @@ -262,7 +262,7 @@ namespace OpenSim.Region.Capabilities } #endregion - + /// /// Callback for a client request for an upload url for a script task /// inventory update @@ -272,28 +272,28 @@ namespace OpenSim.Region.Capabilities /// /// public string ScriptTaskInventory(string request, string path, string param) - { + { try { // MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param); - - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); + + Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); - + string capsBase = "/CAPS/" + m_capsObjectPath; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - + TaskInventoryScriptUpdater uploader = new TaskInventoryScriptUpdater( - llsdUpdateRequest.item_id, - llsdUpdateRequest.task_id, - llsdUpdateRequest.is_script_running, - capsBase + uploaderPath, - m_httpListener, - m_dumpAssetsToFile); + llsdUpdateRequest.item_id, + llsdUpdateRequest.task_id, + llsdUpdateRequest.is_script_running, + capsBase + uploaderPath, + m_httpListener, + m_dumpAssetsToFile); uploader.OnUpLoad += TaskScriptUpdated; - + m_httpListener.AddStreamHandler( new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + @@ -302,13 +302,13 @@ namespace OpenSim.Region.Capabilities LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; - + // MainLog.Instance.Verbose( // "CAPS", // "ScriptTaskInventory response: {0}", // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); - - return LLSDHelpers.SerialiseLLSDReply(uploadResponse); + + return LLSDHelpers.SerialiseLLSDReply(uploadResponse); } catch (Exception e) { @@ -329,7 +329,7 @@ namespace OpenSim.Region.Capabilities public string NoteCardAgentInventory(string request, string path, string param) { //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); + Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); @@ -353,7 +353,7 @@ namespace OpenSim.Region.Capabilities // "CAPS", // "NoteCardAgentInventory response: {0}", // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); - + return LLSDHelpers.SerialiseLLSDReply(uploadResponse); } @@ -453,7 +453,7 @@ namespace OpenSim.Region.Capabilities { return ItemUpdatedCall(m_agentID, itemID, data); } - + return LLUUID.Zero; } @@ -613,7 +613,7 @@ namespace OpenSim.Region.Capabilities fs.Close(); } } - + /// /// This class is a callback invoked when a client sends asset data to /// a task inventory script update url @@ -629,17 +629,17 @@ namespace OpenSim.Region.Capabilities private BaseHttpServer httpListener; private bool m_dumpAssetToFile; - public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning, + public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning, string path, BaseHttpServer httpServer, bool dumpAssetToFile) { m_dumpAssetToFile = dumpAssetToFile; this.inventoryItemID = inventoryItemID; this.primID = primID; - + // This comes in over the packet as an integer, but actually appears to be treated as a bool this.isScriptRunning = (0 == isScriptRunning ? false : true); - + uploaderPath = path; httpListener = httpServer; } @@ -659,7 +659,7 @@ namespace OpenSim.Region.Capabilities // "CAPS", // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", // data, path, param); - + string res = ""; LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); @@ -668,7 +668,7 @@ namespace OpenSim.Region.Capabilities OnUpLoad(inventoryItemID, primID, isScriptRunning, data); } - uploadComplete.item_id = inventoryItemID; + uploadComplete.item_id = inventoryItemID; uploadComplete.task_id = primID; uploadComplete.state = "complete"; @@ -680,7 +680,7 @@ namespace OpenSim.Region.Capabilities { SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); } - + // MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); return res; @@ -689,9 +689,9 @@ namespace OpenSim.Region.Capabilities { MainLog.Instance.Error("CAPS", e.ToString()); } - + // XXX Maybe this should be some meaningful error packet - return null; + return null; } private void SaveAssetToFile(string filename, byte[] data) @@ -702,6 +702,6 @@ namespace OpenSim.Region.Capabilities bw.Close(); fs.Close(); } - } + } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSD.cs b/OpenSim/Framework/Communications/Capabilities/LLSD.cs index 987d6e61ff..dab926c39b 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSD.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSD.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -28,12 +28,12 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.Xml; +using System.Globalization; using System.IO; -using libsecondlife; using System.Security.Cryptography; using System.Text; +using System.Xml; +using libsecondlife; namespace OpenSim.Region.Capabilities { @@ -47,7 +47,9 @@ namespace OpenSim.Region.Capabilities /// public class LLSDParseException : Exception { - public LLSDParseException(string message) : base(message) { } + public LLSDParseException(string message) : base(message) + { + } } /// @@ -55,7 +57,9 @@ namespace OpenSim.Region.Capabilities /// public class LLSDSerializeException : Exception { - public LLSDSerializeException(string message) : base(message) { } + public LLSDSerializeException(string message) : base(message) + { + } } /// @@ -129,7 +133,7 @@ namespace OpenSim.Region.Capabilities if (obj is string) { writer.WriteStartElement(String.Empty, "string", String.Empty); - writer.WriteString((string)obj); + writer.WriteString((string) obj); writer.WriteEndElement(); } else if (obj is int) @@ -146,7 +150,7 @@ namespace OpenSim.Region.Capabilities } else if (obj is bool) { - bool b = (bool)obj; + bool b = (bool) obj; writer.WriteStartElement(String.Empty, "boolean", String.Empty); writer.WriteString(b ? "1" : "0"); writer.WriteEndElement(); @@ -157,7 +161,7 @@ namespace OpenSim.Region.Capabilities } else if (obj is LLUUID) { - LLUUID u = (LLUUID)obj; + LLUUID u = (LLUUID) obj; writer.WriteStartElement(String.Empty, "uuid", String.Empty); writer.WriteString(u.ToString()); writer.WriteEndElement(); @@ -463,7 +467,7 @@ namespace OpenSim.Region.Capabilities } else if (obj is string) { - return GetSpaces(indent) + "- string \"" + (string)obj + "\"\n"; + return GetSpaces(indent) + "- string \"" + (string) obj + "\"\n"; } else if (obj is int) { @@ -475,13 +479,13 @@ namespace OpenSim.Region.Capabilities } else if (obj is LLUUID) { - return GetSpaces(indent) + "- uuid " + ((LLUUID)obj).ToString() + Environment.NewLine; + return GetSpaces(indent) + "- uuid " + ((LLUUID) obj).ToString() + Environment.NewLine; } else if (obj is Hashtable) { StringBuilder ret = new StringBuilder(); ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine); - Hashtable map = (Hashtable)obj; + Hashtable map = (Hashtable) obj; foreach (string key in map.Keys) { @@ -495,7 +499,7 @@ namespace OpenSim.Region.Capabilities { StringBuilder ret = new StringBuilder(); ret.Append(GetSpaces(indent) + "- array\n"); - ArrayList list = (ArrayList)obj; + ArrayList list = (ArrayList) obj; foreach (object item in list) { @@ -506,8 +510,8 @@ namespace OpenSim.Region.Capabilities } else if (obj is byte[]) { - return GetSpaces(indent) + "- binary\n" + Helpers.FieldToHexString((byte[])obj, GetSpaces(indent)) + - Environment.NewLine; + return GetSpaces(indent) + "- binary\n" + Helpers.FieldToHexString((byte[]) obj, GetSpaces(indent)) + + Environment.NewLine; } else { @@ -557,8 +561,8 @@ namespace OpenSim.Region.Capabilities double value; endPos = FindEnd(llsd, 1); - if (Double.TryParse(llsd.Substring(1, endPos - 1), System.Globalization.NumberStyles.Float, - Helpers.EnUsCulture.NumberFormat, out value)) + if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float, + Helpers.EnUsCulture.NumberFormat, out value)) return value; else throw new LLSDParseException("Failed to parse double value type"); @@ -652,7 +656,7 @@ namespace OpenSim.Region.Capabilities private static int FindEnd(string llsd, int start) { - int end = llsd.IndexOfAny(new char[] { ',', ']', '}' }); + int end = llsd.IndexOfAny(new char[] {',', ']', '}'}); if (end == -1) end = llsd.Length - 1; return end; } @@ -673,4 +677,4 @@ namespace OpenSim.Region.Capabilities } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs index 2bc164326a..d641b5c380 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs @@ -38,4 +38,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs index 307e3e3e95..f838c85c0a 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs @@ -41,4 +41,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs index eb76d64c7d..3b8c07791e 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs @@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs index dfb16834c6..7b09cb3e72 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs @@ -34,7 +34,7 @@ namespace OpenSim.Region.Capabilities public string MapLayer = ""; public string NewFileAgentInventory = ""; //public string EventQueueGet = ""; - // public string RequestTextureDownload = ""; + // public string RequestTextureDownload = ""; // public string ChatSessionRequest = ""; public string UpdateNotecardAgentInventory = ""; public string UpdateScriptAgentInventory = ""; diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs index 101d9c05b3..5e6e9178ef 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs @@ -34,4 +34,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index 60aa60c0c6..28f838de65 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs @@ -30,7 +30,6 @@ using System.Collections; using System.IO; using System.Reflection; using System.Xml; -using libsecondlife; namespace OpenSim.Region.Capabilities { @@ -77,7 +76,7 @@ namespace OpenSim.Region.Capabilities writer.WriteString(fields[i].Name); writer.WriteEndElement(); LLSD.LLSDWriteOne(writer, fieldValue); - // libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( + // libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( // writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue)); } } @@ -102,8 +101,8 @@ namespace OpenSim.Region.Capabilities else { LLSD.LLSDWriteOne(writer, obj); - //libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( - // writer, libsecondlife.StructuredData.LLSD.FromObject(obj)); + //libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( + // writer, libsecondlife.StructuredData.LLSD.FromObject(obj)); } } @@ -122,12 +121,12 @@ namespace OpenSim.Region.Capabilities FieldInfo field = myType.GetField((string) enumerator.Key); if (field != null) { - // if (enumerator.Value is libsecondlife.StructuredData.LLSDMap) + // if (enumerator.Value is libsecondlife.StructuredData.LLSDMap) if (enumerator.Value is Hashtable) { object fieldValue = field.GetValue(obj); - DeserialiseLLSDMap((Hashtable)enumerator.Value, fieldValue); - // DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue); + DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); + // DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue); } else if (enumerator.Value is ArrayList) { @@ -149,4 +148,4 @@ namespace OpenSim.Region.Capabilities return obj; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs index 214b9c70d0..121b36a4dc 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs @@ -42,4 +42,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs index 48130b1faa..93b0f83b95 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs @@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs index 71cc3580ea..4321d7b914 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs @@ -29,9 +29,7 @@ using System.Collections; using System.IO; using System.Text; -using libsecondlife; using OpenSim.Framework.Servers; -using System.Xml; namespace OpenSim.Region.Capabilities { @@ -54,10 +52,10 @@ namespace OpenSim.Region.Capabilities //string requestBody = streamReader.ReadToEnd(); //streamReader.Close(); - // libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap) + // libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap) // libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request)); - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(request); + Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request); TRequest llsdRequest = new TRequest(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); @@ -68,4 +66,4 @@ namespace OpenSim.Region.Capabilities return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs index 3703efc083..8d6550b896 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs @@ -25,10 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; - +using libsecondlife; + namespace OpenSim.Region.Capabilities -{ +{ [LLSDMap] public class LLSDTaskInventoryUploadComplete { @@ -36,15 +36,15 @@ namespace OpenSim.Region.Capabilities /// The task inventory item that was updated /// public LLUUID item_id; - + /// /// The task that was updated /// - public LLUUID task_id; - + public LLUUID task_id; + /// /// State of the upload. So far have only even seen this set to "complete" /// public string state; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs index 6dcf2b56d5..e9c77b81ec 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs @@ -26,10 +26,10 @@ * */ -using libsecondlife; - +using libsecondlife; + namespace OpenSim.Region.Capabilities -{ +{ [LLSDMap] public class LLSDTaskScriptUpdate { @@ -37,15 +37,15 @@ namespace OpenSim.Region.Capabilities /// The item containing the script to update /// public LLUUID item_id; - + /// /// The task containing the script /// public LLUUID task_id; - + /// /// Signals whether the script is currently active /// public int is_script_running; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs index 70bfd2ca86..d10b0c0c8c 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs @@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs index 7bbe16e71c..e85174248b 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs @@ -52,4 +52,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 46147561d2..02c54e1b1c 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -26,9 +26,9 @@ * */ using System; +using System.Collections.Generic; using libsecondlife; using OpenSim.Framework.Communications.Cache; -using System.Collections.Generic; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -173,12 +173,13 @@ namespace OpenSim.Framework.Communications } } } + public List GenerateAgentPickerRequestResponse(LLUUID queryID, string query) { - List pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query); + List pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query); return pickerlist; } #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index d51f234d21..e2c2661947 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System.Collections; using System.Collections.Generic; namespace OpenSim.Framework.Communications @@ -39,6 +38,5 @@ namespace OpenSim.Framework.Communications RegionInfo RequestNeighbourInfo(ulong regionHandle); Dictionary GetGridSettings(); List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 3aa20a3b62..e2a96f6832 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs @@ -31,8 +31,7 @@ namespace OpenSim.Framework.Communications { public interface IInterRegionCommunications { - - string rdebugRegionName{ get; set; } + string rdebugRegionName { get; set; } bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); bool RegionUp(SearializableRegionInfo region, ulong regionhandle); @@ -45,6 +44,5 @@ namespace OpenSim.Framework.Communications bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID); void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID); - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 9c493d48bc..f2e5cc52c5 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -52,4 +52,4 @@ namespace OpenSim.Framework.Communications /// List RequestFirstLevelFolders(LLUUID userID); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 534383a23b..098d08e9fb 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -30,7 +30,6 @@ using System; using System.Collections.Generic; using System.Reflection; using libsecondlife; -using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; namespace OpenSim.Framework.Communications @@ -65,7 +64,7 @@ namespace OpenSim.Framework.Communications if (typeInterface != null) { IInventoryData plug = - (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); m_plugins.Add(plug.getName(), plug); MainLog.Instance.Verbose("AGENTINVENTORY", "Added IInventoryData Interface"); @@ -370,4 +369,4 @@ namespace OpenSim.Framework.Communications public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index ede3148231..954aecbd43 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -525,9 +525,9 @@ namespace OpenSim.Framework.UserManagement set { welcomeMessage = value; } } - public BuddyList BuddList + public BuddyList BuddList { - get{return m_buddyList;} + get { return m_buddyList; } set { m_buddyList = value; } } @@ -591,4 +591,4 @@ namespace OpenSim.Framework.UserManagement } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 6d4cb68b4e..a2849107da 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -64,7 +64,7 @@ namespace OpenSim.Framework.UserManagement //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this. //CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); @@ -75,17 +75,17 @@ namespace OpenSim.Framework.UserManagement if (GoodXML) { - string firstname = (string)requestData["first"]; - string lastname = (string)requestData["last"]; - string passwd = (string)requestData["passwd"]; + string firstname = (string) requestData["first"]; + string lastname = (string) requestData["last"]; + string passwd = (string) requestData["passwd"]; userProfile = GetTheUser(firstname, lastname); if (userProfile == null) { MainLog.Instance.Verbose( - "LOGIN", + "LOGIN", "Could not find a profile for " + firstname + " " + lastname); - + return logResponse.CreateLoginFailedResponse(); } @@ -103,15 +103,14 @@ namespace OpenSim.Framework.UserManagement else { // If we already have a session... - + if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) { userProfile.currentAgent = null; m_userManager.CommitAgent(ref userProfile); - + // Reject the login return logResponse.CreateAlreadyLoggedInResponse(); - } // Otherwise... // Create a new agent session @@ -132,7 +131,7 @@ namespace OpenSim.Framework.UserManagement userProfile.rootInventoryFolderID = inventData.RootFolderID; // Circuit Code - uint circode = (uint)(Util.RandomClass.Next()); + uint circode = (uint) (Util.RandomClass.Next()); logResponse.Lastname = userProfile.surname; logResponse.Firstname = userProfile.username; @@ -150,7 +149,7 @@ namespace OpenSim.Framework.UserManagement logResponse.InventoryLibRoot = InventoryLibRoot; logResponse.InventoryLibraryOwner = GetLibraryOwner(); - logResponse.CircuitCode = (Int32)circode; + logResponse.CircuitCode = (Int32) circode; //logResponse.RegionX = 0; //overwritten //logResponse.RegionY = 0; //overwritten logResponse.Home = "!!null temporary value {home}!!"; // Overwritten @@ -277,7 +276,7 @@ namespace OpenSim.Framework.UserManagement TempHash["type_default"] = -1; TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; temp.Add(TempHash); - + return temp; } @@ -328,4 +327,4 @@ namespace OpenSim.Framework.UserManagement } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs index fd8ce384f0..e9c7bf38bc 100644 --- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs @@ -62,4 +62,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs index 5c77193b80..1aaf68eed9 100644 --- a/OpenSim/Framework/Communications/RestClient/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs @@ -238,7 +238,7 @@ namespace OpenSim.Framework.Communications } } realuri = sb.ToString(); - MainLog.Instance.Verbose("REST", "RestURL: {0}", realuri); + MainLog.Instance.Verbose("REST", "RestURL: {0}", realuri); return new Uri(sb.ToString()); } @@ -365,7 +365,7 @@ namespace OpenSim.Framework.Communications } public Stream Request(Stream src) - { + { _request = (HttpWebRequest) WebRequest.Create(buildUri()); _request.KeepAlive = false; _request.ContentType = "application/xml"; @@ -374,16 +374,16 @@ namespace OpenSim.Framework.Communications _asyncException = null; _request.ContentLength = src.Length; - MainLog.Instance.Verbose("REST", "Request Length {0}", _request.ContentLength); - MainLog.Instance.Verbose("REST", "Sending Web Request {0}", buildUri()); + MainLog.Instance.Verbose("REST", "Request Length {0}", _request.ContentLength); + MainLog.Instance.Verbose("REST", "Sending Web Request {0}", buildUri()); src.Seek(0, SeekOrigin.Begin); - MainLog.Instance.Verbose("REST", "Seek is ok"); + MainLog.Instance.Verbose("REST", "Seek is ok"); Stream dst = _request.GetRequestStream(); - MainLog.Instance.Verbose("REST", "GetRequestStream is ok"); + MainLog.Instance.Verbose("REST", "GetRequestStream is ok"); byte[] buf = new byte[1024]; int length = src.Read(buf, 0, 1024); - MainLog.Instance.Verbose("REST", "First Read is ok"); + MainLog.Instance.Verbose("REST", "First Read is ok"); while (length > 0) { dst.Write(buf, 0, length); @@ -440,4 +440,4 @@ namespace OpenSim.Framework.Communications #endregion Async Invocation } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index d946e00835..f913d2cd38 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -27,7 +27,6 @@ */ using System; -using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Security.Cryptography; @@ -93,13 +92,13 @@ namespace OpenSim.Framework.UserManagement foreach (KeyValuePair plugin in _plugins) { UserProfileData profile = plugin.Value.GetUserByUUID(uuid); - + if (null != profile) { profile.currentAgent = getUserAgent(profile.UUID); return profile; - } - } + } + } return null; } @@ -112,11 +111,11 @@ namespace OpenSim.Framework.UserManagement try { pickerlist = plugin.Value.GeneratePickerResults(queryID, query); - } catch (Exception) { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")"); + MainLog.Instance.Verbose("USERSTORAGE", + "Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")"); return new List(); } } @@ -162,7 +161,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("USERSTORAGE", + "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -188,7 +188,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("USERSTORAGE", + "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -210,7 +211,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("USERSTORAGE", + "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -222,7 +224,7 @@ namespace OpenSim.Framework.UserManagement { UserProfileData profile = GetUserProfile(agentID); profile.currentAgent = null; - + setUserProfile(profile); } @@ -242,7 +244,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("USERSTORAGE", + "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -356,7 +359,8 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); + MainLog.Instance.Verbose("USERSTORAGE", + "Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); } } @@ -365,6 +369,6 @@ namespace OpenSim.Framework.UserManagement public abstract UserProfileData SetupMasterUser(string firstName, string lastName); public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); - public abstract UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid); + public abstract UserProfileData SetupMasterUser(LLUUID uuid); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index b8e64f3c1d..8bb31f841f 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs @@ -136,4 +136,4 @@ namespace OpenSim.Framework.Configuration doc = null; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index 271c02c272..a5ab613afe 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs @@ -27,24 +27,20 @@ */ using System; -using System.Reflection; -using System.Collections; using System.Collections.Generic; -using System.Text; -using System.Net; -using System.Xml; - -using libsecondlife; - -using OpenSim.Framework.Console; -using OpenSim.Framework; using System.Globalization; +using System.Net; +using System.Reflection; +using System.Xml; +using libsecondlife; +using OpenSim.Framework.Console; namespace OpenSim.Framework { public class ConfigurationMember { public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); + public delegate void ConfigurationOptionsLoad(); private List configurationOptions = new List(); @@ -55,29 +51,36 @@ namespace OpenSim.Framework private ConfigurationOptionResult resultFunction; private IGenericConfig configurationPlugin = null; + /// /// This is the default configuration DLL loaded /// private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; - public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) + + public ConfigurationMember(string configuration_filename, string configuration_description, + ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) { - this.configurationFilename = configuration_filename; - this.configurationDescription = configuration_description; - this.loadFunction = load_function; - this.resultFunction = result_function; + configurationFilename = configuration_filename; + configurationDescription = configuration_description; + loadFunction = load_function; + resultFunction = result_function; } - public ConfigurationMember(XmlNode configuration_xml, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) + + public ConfigurationMember(XmlNode configuration_xml, string configuration_description, + ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) { - this.configurationFilename = ""; - this.configurationFromXMLNode = configuration_xml; - this.configurationDescription = configuration_description; - this.loadFunction = load_function; - this.resultFunction = result_function; + configurationFilename = ""; + configurationFromXMLNode = configuration_xml; + configurationDescription = configuration_description; + loadFunction = load_function; + resultFunction = result_function; } + public void setConfigurationFilename(string filename) { configurationFilename = filename; } + public void setConfigurationDescription(string desc) { configurationDescription = desc; @@ -92,9 +95,11 @@ namespace OpenSim.Framework { configurationPluginFilename = dll_filename; } + private void checkAndAddConfigOption(ConfigurationOption option) { - if ((option.configurationKey != "" && option.configurationQuestion != "") || (option.configurationKey != "" && option.configurationUseDefaultNoPrompt)) + if ((option.configurationKey != "" && option.configurationQuestion != "") || + (option.configurationKey != "" && option.configurationUseDefaultNoPrompt)) { if (!configurationOptions.Contains(option)) { @@ -103,11 +108,16 @@ namespace OpenSim.Framework } else { - MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + option.configurationKey + ")"); + MainLog.Instance.Notice( + "Required fields for adding a configuration option is invalid. Will not add this option (" + + option.configurationKey + ")"); } } - public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) + public void addConfigurationOption(string configuration_key, + ConfigurationOption.ConfigurationTypes configuration_type, + string configuration_question, string configuration_default, + bool use_default_no_prompt) { ConfigurationOption configOption = new ConfigurationOption(); configOption.configurationKey = configuration_key; @@ -119,7 +129,11 @@ namespace OpenSim.Framework checkAndAddConfigOption(configOption); } - public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt, ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate) + public void addConfigurationOption(string configuration_key, + ConfigurationOption.ConfigurationTypes configuration_type, + string configuration_question, string configuration_default, + bool use_default_no_prompt, + ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate) { ConfigurationOption configOption = new ConfigurationOption(); configOption.configurationKey = configuration_key; @@ -133,26 +147,30 @@ namespace OpenSim.Framework public void performConfigurationRetrieve() { - configurationPlugin = this.LoadConfigDll(configurationPluginFilename); + configurationPlugin = LoadConfigDll(configurationPluginFilename); configurationOptions.Clear(); - if(loadFunction == null) + if (loadFunction == null) { - MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); + MainLog.Instance.Error("Load Function for '" + configurationDescription + + "' is null. Refusing to run configuration."); return; } - if(resultFunction == null) + if (resultFunction == null) { - MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); + MainLog.Instance.Error("Result Function for '" + configurationDescription + + "' is null. Refusing to run configuration."); return; } MainLog.Instance.Verbose("CONFIG", "Calling Configuration Load Function..."); - this.loadFunction(); + loadFunction(); - if(configurationOptions.Count <= 0) + if (configurationOptions.Count <= 0) { - MainLog.Instance.Error("CONFIG", "No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); + MainLog.Instance.Error("CONFIG", + "No configuration options were specified for '" + configurationOptions + + "'. Refusing to continue configuration."); return; } @@ -179,7 +197,7 @@ namespace OpenSim.Framework } else { - if (this.configurationFromXMLNode != null) + if (configurationFromXMLNode != null) { MainLog.Instance.Notice("Loading from XML Node, will not save to the file"); configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml); @@ -219,15 +237,22 @@ namespace OpenSim.Framework } else { - if ((configOption.shouldIBeAsked != null && configOption.shouldIBeAsked(configOption.configurationKey)) || configOption.shouldIBeAsked == null) + if ((configOption.shouldIBeAsked != null && + configOption.shouldIBeAsked(configOption.configurationKey)) || + configOption.shouldIBeAsked == null) { if (configurationDescription.Trim() != "") { - console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); + console_result = + MainLog.Instance.CmdPrompt( + configurationDescription + ": " + configOption.configurationQuestion, + configOption.configurationDefault); } else { - console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); + console_result = + MainLog.Instance.CmdPrompt(configOption.configurationQuestion, + configOption.configurationDefault); } } else @@ -235,7 +260,7 @@ namespace OpenSim.Framework //Dont Ask! Just use default console_result = configOption.configurationDefault; } - } + } } else { @@ -366,7 +391,9 @@ namespace OpenSim.Framework break; case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: float floatResult; - if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult)) + if ( + float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, + out floatResult)) { convertSuccess = true; return_result = floatResult; @@ -375,7 +402,9 @@ namespace OpenSim.Framework break; case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: double doubleResult; - if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult)) + if ( + Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, + out doubleResult)) { convertSuccess = true; return_result = doubleResult; @@ -391,9 +420,10 @@ namespace OpenSim.Framework configurationPlugin.SetAttribute(configOption.configurationKey, console_result); } - if (!this.resultFunction(configOption.configurationKey, return_result)) + if (!resultFunction(configOption.configurationKey, return_result)) { - Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); + MainLog.Instance.Notice( + "The handler for the last configuration option denied that input, please try again."); convertSuccess = false; ignoreNextFromConfig = true; } @@ -402,19 +432,27 @@ namespace OpenSim.Framework { if (configOption.configurationUseDefaultNoPrompt) { - MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); + MainLog.Instance.Error("CONFIG", + string.Format( + "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", + configOption.configurationKey, console_result, errorMessage, + configurationFilename)); convertSuccess = true; } else { - MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); + MainLog.Instance.Warn("CONFIG", + string.Format( + "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", + configOption.configurationKey, console_result, errorMessage, + configurationFilename)); ignoreNextFromConfig = true; } } } } - if(useFile) + if (useFile) { configurationPlugin.Commit(); configurationPlugin.Close(); @@ -436,7 +474,8 @@ namespace OpenSim.Framework if (typeInterface != null) { - plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug = + (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); } } } @@ -448,10 +487,10 @@ namespace OpenSim.Framework public void forceSetConfigurationOption(string configuration_key, string configuration_value) { - this.configurationPlugin.LoadData(); - this.configurationPlugin.SetAttribute(configuration_key, configuration_value); - this.configurationPlugin.Commit(); - this.configurationPlugin.Close(); + configurationPlugin.LoadData(); + configurationPlugin.SetAttribute(configuration_key, configuration_value); + configurationPlugin.Commit(); + configurationPlugin.Close(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/ConfigurationOption.cs b/OpenSim/Framework/ConfigurationOption.cs index b83be5e7c2..7f9b5b5165 100644 --- a/OpenSim/Framework/ConfigurationOption.cs +++ b/OpenSim/Framework/ConfigurationOption.cs @@ -30,7 +30,6 @@ namespace OpenSim.Framework { public class ConfigurationOption { - public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key); public enum ConfigurationTypes diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs index bba4f955de..73ecd1867e 100644 --- a/OpenSim/Framework/Console/AssemblyInfo.cs +++ b/OpenSim/Framework/Console/AssemblyInfo.cs @@ -55,4 +55,4 @@ using System.Runtime.InteropServices; // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly : AssemblyVersion("1.0.*")] +[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file diff --git a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs index 93540aae47..606469d50c 100644 --- a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs +++ b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs @@ -32,4 +32,4 @@ namespace OpenSim.Framework.Console void RunCmd(string cmd, string[] cmdparams); void Show(string ShowWhat); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index dd0c5fa5fd..e7b1945ef3 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs @@ -248,12 +248,12 @@ namespace OpenSim.Framework.Console // Some older systems dont support coloured text. System.Console.WriteLine(format, args); } - catch (System.FormatException) + catch (FormatException) { // Some older systems dont support coloured text. System.Console.WriteLine(args); } - + return; } } @@ -479,4 +479,4 @@ namespace OpenSim.Framework.Console } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Console/MainLog.cs b/OpenSim/Framework/Console/MainLog.cs index 16ba2c222c..bea2a2290f 100644 --- a/OpenSim/Framework/Console/MainLog.cs +++ b/OpenSim/Framework/Console/MainLog.cs @@ -37,4 +37,4 @@ namespace OpenSim.Framework.Console set { instance = value; } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index 00999c28a5..263716640c 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs @@ -140,16 +140,17 @@ namespace OpenSim.Framework.Data.DB4o { manager = null; } + /// /// // Returns a list of avatar and UUIDs that match the query /// - public List GeneratePickerResults(LLUUID queryID, string query) { //Do nothing yet List returnlist = new List(); return returnlist; } + /// /// Returns the providers name /// @@ -173,4 +174,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 cf1dfaea96..4b1b451c7d 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs @@ -167,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 383bfbef42..e0973f1dc1 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs @@ -26,8 +26,8 @@ * */ using System; -using System.IO; using System.Collections.Generic; +using System.IO; using libsecondlife; namespace OpenSim.Framework.Data.DB4o @@ -132,12 +132,14 @@ namespace OpenSim.Framework.Data.DB4o return null; } } - public List GeneratePickerResults(LLUUID queryID, string query) + + public List GeneratePickerResults(LLUUID queryID, string query) { //Do nothing yet - List returnlist = new List(); + List returnlist = new List(); return returnlist; } + /// /// Creates a new user profile /// @@ -225,4 +227,4 @@ namespace OpenSim.Framework.Data.DB4o return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs index cc0422ca58..08fbef07dd 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs @@ -27,18 +27,18 @@ */ using System; -using System.Data; using System.Collections.Generic; +using System.Data; using System.Data.SqlClient; - using libsecondlife; using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MSSQL { - class MSSQLAssetData : IAssetProvider + internal class MSSQLAssetData : IAssetProvider { - MSSQLManager database; + private MSSQLManager database; + #region IAssetProvider Members private void UpgradeAssetsTable(string tableName) @@ -46,7 +46,7 @@ namespace OpenSim.Framework.Data.MSSQL // null as the version, indicates that the table didn't exist if (tableName == null) { - MainLog.Instance.Notice("ASSETS", "Creating new database tables"); + MainLog.Instance.Notice("ASSETS", "Creating new database tables"); database.ExecuteResourceSql("CreateAssetsTable.sql"); return; } @@ -57,14 +57,12 @@ namespace OpenSim.Framework.Data.MSSQL /// private void TestTables() { - Dictionary tableList = new Dictionary(); tableList["assets"] = null; database.GetTableVersion(tableList); UpgradeAssetsTable(tableList["assets"]); - } public AssetBase FetchAsset(LLUUID assetID) @@ -80,30 +78,27 @@ namespace OpenSim.Framework.Data.MSSQL asset = database.getAssetRow(reader); reader.Close(); result.Dispose(); - + return asset; } public void CreateAsset(AssetBase asset) { - - if (ExistsAsset((LLUUID)asset.FullID)) + if (ExistsAsset((LLUUID) asset.FullID)) { return; } - SqlCommand cmd = new SqlCommand( - "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])"+ - " VALUES "+ + "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])" + + " VALUES " + "(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)", database.getConnection()); - + using (cmd) { - //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar); //p.Value = asset.FullID.ToString(); cmd.Parameters.AddWithValue("id", asset.FullID.ToString()); @@ -127,24 +122,23 @@ namespace OpenSim.Framework.Data.MSSQL { throw; } - + cmd.Dispose(); } - } public void UpdateAsset(AssetBase asset) { SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + - "name = @name, " + - "description = @description," + - "assetType = @assetType," + - "invType = @invType," + - "local = @local,"+ - "temporary = @temporary," + - "data = @data where " + - "id = @keyId;", database.getConnection()); + "name = @name, " + + "description = @description," + + "assetType = @assetType," + + "invType = @invType," + + "local = @local," + + "temporary = @temporary," + + "data = @data where " + + "id = @keyId;", database.getConnection()); SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString()); SqlParameter param2 = new SqlParameter("@name", asset.Name); SqlParameter param3 = new SqlParameter("@description", asset.Description); @@ -172,12 +166,12 @@ namespace OpenSim.Framework.Data.MSSQL { MainLog.Instance.Error(e.ToString()); } - } public bool ExistsAsset(LLUUID uuid) { - if (FetchAsset(uuid) != null) { + if (FetchAsset(uuid) != null) + { return true; } return false; @@ -194,11 +188,8 @@ namespace OpenSim.Framework.Data.MSSQL #region IPlugin Members - - public void Initialise() { - IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); @@ -206,7 +197,9 @@ namespace OpenSim.Framework.Data.MSSQL string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); - this.database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); + database = + new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, + settingPassword); TestTables(); } @@ -214,7 +207,7 @@ namespace OpenSim.Framework.Data.MSSQL public string Version { // get { return database.getVersion(); } - get { return database.getVersion(); } + get { return database.getVersion(); } } public string Name @@ -224,4 +217,4 @@ namespace OpenSim.Framework.Data.MSSQL #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index 72db568302..7d228e6bda 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs @@ -57,8 +57,9 @@ namespace OpenSim.Framework.Data.MSSQL string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); - database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); - + database = + new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, + settingPassword); } /// @@ -120,14 +121,13 @@ namespace OpenSim.Framework.Data.MSSQL result.Dispose(); return row; - } catch (Exception) - { - if (reader != null) { + { + if (reader != null) + { reader.Close(); } - } return null; } @@ -135,7 +135,6 @@ namespace OpenSim.Framework.Data.MSSQL /// /// // Returns a list of avatar and UUIDs that match the query /// - public List GeneratePickerResults(LLUUID queryID, string query) { List returnlist = new List(); @@ -152,18 +151,19 @@ namespace OpenSim.Framework.Data.MSSQL param["second"] = querysplit[1]; IDbCommand result = - database.Query("SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", param); + database.Query( + "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { AvatarPickerAvatar user = new AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["surname"]; + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["surname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -175,13 +175,9 @@ namespace OpenSim.Framework.Data.MSSQL MainLog.Instance.Error(e.ToString()); return returnlist; } - - - } else if (querysplit.Length == 1) { - try { lock (database) @@ -191,18 +187,19 @@ namespace OpenSim.Framework.Data.MSSQL param["second"] = querysplit[1]; IDbCommand result = - database.Query("SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", param); + database.Query( + "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { AvatarPickerAvatar user = new AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["surname"]; + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["surname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -225,8 +222,8 @@ namespace OpenSim.Framework.Data.MSSQL /// The sim profile public RegionProfileData GetProfileByLLUUID(LLUUID uuid) { - Dictionary param = new Dictionary(); - param["uuid"] = uuid.ToString(); + Dictionary param = new Dictionary(); + param["uuid"] = uuid.ToString(); IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); IDataReader reader = result.ExecuteReader(); @@ -244,7 +241,6 @@ namespace OpenSim.Framework.Data.MSSQL /// A dataresponse enum indicating success public DataResponse AddProfile(RegionProfileData profile) { - try { if (GetProfileByLLUUID(profile.UUID) != null) @@ -310,4 +306,4 @@ namespace OpenSim.Framework.Data.MSSQL return null; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs index a6b8819487..4b2c7af4b9 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs @@ -26,10 +26,9 @@ * */ using System; -using System.IO; +using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Collections.Generic; using libsecondlife; using OpenSim.Framework.Console; @@ -57,7 +56,9 @@ namespace OpenSim.Framework.Data.MSSQL string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); - database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); + database = + new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, + settingPassword); TestTables(); } @@ -72,7 +73,6 @@ namespace OpenSim.Framework.Data.MSSQL //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql"); return; } - } private void UpgradeItemsTable(string tableName) @@ -88,17 +88,17 @@ namespace OpenSim.Framework.Data.MSSQL private void TestTables() { - Dictionary tableList = new Dictionary(); tableList["inventoryfolders"] = null; tableList["inventoryitems"] = null; database.GetTableVersion(tableList); - + UpgradeFoldersTable(tableList["inventoryfolders"]); UpgradeItemsTable(tableList["inventoryitems"]); } + #endregion /// @@ -124,7 +124,7 @@ namespace OpenSim.Framework.Data.MSSQL /// A string containing the DB provider public string getVersion() { - return database.getVersion(); + return database.getVersion(); } /// @@ -143,15 +143,16 @@ namespace OpenSim.Framework.Data.MSSQL Dictionary param = new Dictionary(); param["parentFolderID"] = folderID.ToString(); - IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param); + IDbCommand result = + database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param); IDataReader reader = result.ExecuteReader(); - while(reader.Read()) + while (reader.Read()) items.Add(readInventoryItem(reader)); reader.Close(); result.Dispose(); - + return items; } } @@ -174,16 +175,17 @@ namespace OpenSim.Framework.Data.MSSQL { lock (database) { - Dictionary param = new Dictionary(); param["uuid"] = user.ToString(); param["zero"] = LLUUID.Zero.ToString(); - IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); + IDbCommand result = + database.Query( + "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); IDataReader reader = result.ExecuteReader(); List items = new List(); - while(reader.Read()) + while (reader.Read()) items.Add(readInventoryFolder(reader)); @@ -212,24 +214,27 @@ namespace OpenSim.Framework.Data.MSSQL param["uuid"] = user.ToString(); param["zero"] = LLUUID.Zero.ToString(); - IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); + IDbCommand result = + database.Query( + "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); IDataReader reader = result.ExecuteReader(); List items = new List(); - while(reader.Read()) + while (reader.Read()) items.Add(readInventoryFolder(reader)); InventoryFolderBase rootFolder = null; - + // There should only ever be one root folder for a user. However, if there's more // than one we'll simply use the first one rather than failing. It would be even // nicer to print some message to this effect, but this feels like it's too low a // to put such a message out, and it's too minor right now to spare the time to // suitably refactor. - if (items.Count > 0) { + if (items.Count > 0) + { rootFolder = items[0]; } - + reader.Close(); result.Dispose(); @@ -259,12 +264,13 @@ namespace OpenSim.Framework.Data.MSSQL param["parentFolderID"] = parentID.ToString(); - IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param); + IDbCommand result = + database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param); IDataReader reader = result.ExecuteReader(); List items = new List(); - - while(reader.Read()) + + while (reader.Read()) items.Add(readInventoryFolder(reader)); reader.Close(); @@ -292,17 +298,17 @@ namespace OpenSim.Framework.Data.MSSQL { InventoryItemBase item = new InventoryItemBase(); - item.inventoryID = new LLUUID((string)reader["inventoryID"]); - item.assetID = new LLUUID((string)reader["assetID"]); - item.assetType = (int)reader["assetType"]; - item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); - item.avatarID = new LLUUID((string)reader["avatarID"]); - item.inventoryName = (string)reader["inventoryName"]; - item.inventoryDescription = (string)reader["inventoryDescription"]; + item.inventoryID = new LLUUID((string) reader["inventoryID"]); + item.assetID = new LLUUID((string) reader["assetID"]); + item.assetType = (int) reader["assetType"]; + item.parentFolderID = new LLUUID((string) reader["parentFolderID"]); + item.avatarID = new LLUUID((string) reader["avatarID"]); + item.inventoryName = (string) reader["inventoryName"]; + item.inventoryDescription = (string) reader["inventoryDescription"]; item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); - item.invType = (int)reader["invType"]; - item.creatorsID = new LLUUID((string)reader["creatorID"]); + item.invType = (int) reader["invType"]; + item.creatorsID = new LLUUID((string) reader["creatorID"]); item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); return item; @@ -322,7 +328,6 @@ namespace OpenSim.Framework.Data.MSSQL /// An inventory item public InventoryItemBase getInventoryItem(LLUUID itemID) { - try { lock (database) @@ -330,11 +335,12 @@ namespace OpenSim.Framework.Data.MSSQL Dictionary param = new Dictionary(); param["inventoryID"] = itemID.ToString(); - IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param); + IDbCommand result = + database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param); IDataReader reader = result.ExecuteReader(); InventoryItemBase item = null; - if(reader.Read()) + if (reader.Read()) item = readInventoryItem(reader); reader.Close(); @@ -361,12 +367,12 @@ namespace OpenSim.Framework.Data.MSSQL try { InventoryFolderBase folder = new InventoryFolderBase(); - folder.agentID = new LLUUID((string)reader["agentID"]); - folder.parentID = new LLUUID((string)reader["parentFolderID"]); - folder.folderID = new LLUUID((string)reader["folderID"]); - folder.name = (string)reader["folderName"]; - folder.type = (short)reader["type"]; - folder.version = (ushort)((int)reader["version"]); + folder.agentID = new LLUUID((string) reader["agentID"]); + folder.parentID = new LLUUID((string) reader["parentFolderID"]); + folder.folderID = new LLUUID((string) reader["folderID"]); + folder.name = (string) reader["folderName"]; + folder.type = (short) reader["type"]; + folder.version = (ushort) ((int) reader["version"]); return folder; } catch (Exception e) @@ -389,7 +395,7 @@ namespace OpenSim.Framework.Data.MSSQL { lock (database) { - Dictionary param = new Dictionary(); + Dictionary param = new Dictionary(); param["uuid"] = folderID.ToString(); IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param); @@ -418,8 +424,10 @@ namespace OpenSim.Framework.Data.MSSQL public void addInventoryItem(InventoryItemBase item) { string sql = "INSERT INTO inventoryitems"; - sql += "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES "; - sql += "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);"; + sql += + "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES "; + sql += + "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);"; try { @@ -441,7 +449,6 @@ namespace OpenSim.Framework.Data.MSSQL IDbCommand result = database.Query(sql, param); result.ExecuteNonQuery(); result.Dispose(); - } catch (SqlException e) { @@ -454,21 +461,21 @@ namespace OpenSim.Framework.Data.MSSQL /// /// Inventory item to update public void updateInventoryItem(InventoryItemBase item) - { + { SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " + - "assetID = @assetID, " + - "assetType = @assetType" + - "parentFolderID = @parentFolderID" + - "avatarID = @avatarID" + - "inventoryName = @inventoryName"+ - "inventoryDescription = @inventoryDescription" + - "inventoryNextPermissions = @inventoryNextPermissions" + - "inventoryCurrentPermissions = @inventoryCurrentPermissions" + - "invType = @invType" + - "creatorID = @creatorID" + - "inventoryBasePermissions = @inventoryBasePermissions" + - "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " + - "invenoryID = @keyInventoryID;", database.getConnection()); + "assetID = @assetID, " + + "assetType = @assetType" + + "parentFolderID = @parentFolderID" + + "avatarID = @avatarID" + + "inventoryName = @inventoryName" + + "inventoryDescription = @inventoryDescription" + + "inventoryNextPermissions = @inventoryNextPermissions" + + "inventoryCurrentPermissions = @inventoryCurrentPermissions" + + "invType = @invType" + + "creatorID = @creatorID" + + "inventoryBasePermissions = @inventoryBasePermissions" + + "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " + + "invenoryID = @keyInventoryID;", database.getConnection()); SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString()); SqlParameter param2 = new SqlParameter("@assetID", item.assetID); SqlParameter param3 = new SqlParameter("@assetType", item.assetType); @@ -481,7 +488,7 @@ namespace OpenSim.Framework.Data.MSSQL SqlParameter param10 = new SqlParameter("@invType", item.invType); SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID); SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions); - SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); + SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString()); command.Parameters.Add(param1); command.Parameters.Add(param2); @@ -506,7 +513,6 @@ namespace OpenSim.Framework.Data.MSSQL { MainLog.Instance.Error(e.ToString()); } - } /// @@ -523,8 +529,6 @@ namespace OpenSim.Framework.Data.MSSQL IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param); cmd.ExecuteNonQuery(); cmd.Dispose(); - - } catch (SqlException e) { @@ -539,7 +543,8 @@ namespace OpenSim.Framework.Data.MSSQL /// Folder to create public void addInventoryFolder(InventoryFolderBase folder) { - string sql = "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES "; + string sql = + "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES "; sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; @@ -550,9 +555,9 @@ namespace OpenSim.Framework.Data.MSSQL param["folderName"] = folder.name; param["type"] = Convert.ToString(folder.type); param["version"] = Convert.ToString(folder.version); - + try - { + { IDbCommand result = database.Query(sql, param); result.ExecuteNonQuery(); result.Dispose(); @@ -567,16 +572,15 @@ namespace OpenSim.Framework.Data.MSSQL /// Updates an inventory folder /// /// Folder to update - public void updateInventoryFolder(InventoryFolderBase folder) { SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + - "agentID = @agentID, " + - "parentFolderID = @parentFolderID," + - "folderName = @folderName," + - "type = @type," + - "version = @version where " + - "folderID = @keyFolderID;", database.getConnection()); + "agentID = @agentID, " + + "parentFolderID = @parentFolderID," + + "folderName = @folderName," + + "type = @type," + + "version = @version where " + + "folderID = @keyFolderID;", database.getConnection()); SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString()); SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); @@ -600,20 +604,17 @@ namespace OpenSim.Framework.Data.MSSQL { MainLog.Instance.Error(e.ToString()); } - - } /// /// Updates an inventory folder /// /// Folder to update - public void moveInventoryFolder(InventoryFolderBase folder) { SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + - "parentFolderID = @parentFolderID," + - "folderID = @keyFolderID;", database.getConnection()); + "parentFolderID = @parentFolderID," + + "folderID = @keyFolderID;", database.getConnection()); SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); @@ -629,8 +630,6 @@ namespace OpenSim.Framework.Data.MSSQL { MainLog.Instance.Error(e.ToString()); } - - } /// @@ -645,7 +644,7 @@ namespace OpenSim.Framework.Data.MSSQL foreach (InventoryFolderBase f in subfolderList) folders.Add(f); } - + /// /// Returns all child folders in the hierarchy from the parent folder and down /// @@ -672,7 +671,6 @@ namespace OpenSim.Framework.Data.MSSQL IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param); cmd.ExecuteNonQuery(); cmd.Dispose(); - } catch (SqlException e) { @@ -689,7 +687,8 @@ namespace OpenSim.Framework.Data.MSSQL param["parentFolderID"] = folderID.ToString(); - IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param); + IDbCommand cmd = + database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param); cmd.ExecuteNonQuery(); cmd.Dispose(); } @@ -724,4 +723,4 @@ namespace OpenSim.Framework.Data.MSSQL } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs index a5b33ec92f..c3ec7c6496 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs @@ -25,14 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; - namespace OpenSim.Framework.Data.MSSQL { /// /// An interface to the log database for MySQL /// - class MSSQLLogData : ILogData + internal class MSSQLLogData : ILogData { /// /// The database manager @@ -51,7 +49,9 @@ namespace OpenSim.Framework.Data.MSSQL string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); - database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); + database = + new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, + settingPassword); } /// @@ -63,7 +63,8 @@ namespace OpenSim.Framework.Data.MSSQL /// The arguments passed to the method /// How critical is this? /// The message to log - public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) + public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, + string logMessage) { try { @@ -101,4 +102,4 @@ namespace OpenSim.Framework.Data.MSSQL return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index b009a56822..0dc33387fc 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; using System.Data; @@ -32,7 +33,6 @@ using System.Data.SqlClient; using System.IO; using System.Reflection; using libsecondlife; - using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MSSQL @@ -40,12 +40,12 @@ namespace OpenSim.Framework.Data.MSSQL /// /// A management class for the MS SQL Storage Engine /// - class MSSQLManager + internal class MSSQLManager { /// /// The database connection object /// - IDbConnection dbcon; + private IDbConnection dbcon; /// /// Connection string for ADO.net @@ -60,12 +60,14 @@ namespace OpenSim.Framework.Data.MSSQL /// The username logging into the database /// The password for the user logging in /// Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'. - public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, string password) + public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, + string password) { try { - - connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + password+";"; + connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + + ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + + password + ";"; dbcon = new SqlConnection(connectionString); TestTables(dbcon); dbcon.Open(); @@ -78,7 +80,7 @@ namespace OpenSim.Framework.Data.MSSQL private bool TestTables(IDbConnection conn) { - IDbCommand cmd = this.Query("SELECT * FROM regions", new Dictionary()); + IDbCommand cmd = Query("SELECT * FROM regions", new Dictionary()); //SqlCommand cmd = (SqlCommand)dbcon.CreateCommand(); //cmd.CommandText = "SELECT * FROM regions"; try @@ -90,7 +92,7 @@ namespace OpenSim.Framework.Data.MSSQL } catch (Exception) { - MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); + MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); InitDB(conn); } return true; @@ -100,66 +102,66 @@ namespace OpenSim.Framework.Data.MSSQL { string createRegions = defineTable(createRegionsTable()); Dictionary param = new Dictionary(); - IDbCommand pcmd = this.Query(createRegions, param); - if (conn.State == ConnectionState.Closed) { + IDbCommand pcmd = Query(createRegions, param); + if (conn.State == ConnectionState.Closed) + { conn.Open(); - } + } pcmd.ExecuteNonQuery(); pcmd.Dispose(); - this.ExecuteResourceSql("Mssql-users.sql"); - this.ExecuteResourceSql("Mssql-agents.sql"); - this.ExecuteResourceSql("Mssql-logs.sql"); + ExecuteResourceSql("Mssql-users.sql"); + ExecuteResourceSql("Mssql-agents.sql"); + ExecuteResourceSql("Mssql-logs.sql"); conn.Close(); - } private DataTable createRegionsTable() { DataTable regions = new DataTable("regions"); - createCol(regions, "regionHandle", typeof(ulong)); - createCol(regions, "regionName", typeof(System.String)); - createCol(regions, "uuid", typeof(System.String)); + createCol(regions, "regionHandle", typeof (ulong)); + createCol(regions, "regionName", typeof (String)); + createCol(regions, "uuid", typeof (String)); - createCol(regions, "regionRecvKey", typeof(System.String)); - createCol(regions, "regionSecret", typeof(System.String)); - createCol(regions, "regionSendKey", typeof(System.String)); + createCol(regions, "regionRecvKey", typeof (String)); + createCol(regions, "regionSecret", typeof (String)); + createCol(regions, "regionSendKey", typeof (String)); - createCol(regions, "regionDataURI", typeof(System.String)); - createCol(regions, "serverIP", typeof(System.String)); - createCol(regions, "serverPort", typeof(System.String)); - createCol(regions, "serverURI", typeof(System.String)); + createCol(regions, "regionDataURI", typeof (String)); + createCol(regions, "serverIP", typeof (String)); + createCol(regions, "serverPort", typeof (String)); + createCol(regions, "serverURI", typeof (String)); - createCol(regions, "locX", typeof(uint)); - createCol(regions, "locY", typeof(uint)); - createCol(regions, "locZ", typeof(uint)); + createCol(regions, "locX", typeof (uint)); + createCol(regions, "locY", typeof (uint)); + createCol(regions, "locZ", typeof (uint)); - createCol(regions, "eastOverrideHandle", typeof(ulong)); - createCol(regions, "westOverrideHandle", typeof(ulong)); - createCol(regions, "southOverrideHandle", typeof(ulong)); - createCol(regions, "northOverrideHandle", typeof(ulong)); + createCol(regions, "eastOverrideHandle", typeof (ulong)); + createCol(regions, "westOverrideHandle", typeof (ulong)); + createCol(regions, "southOverrideHandle", typeof (ulong)); + createCol(regions, "northOverrideHandle", typeof (ulong)); - createCol(regions, "regionAssetURI", typeof(System.String)); - createCol(regions, "regionAssetRecvKey", typeof(System.String)); - createCol(regions, "regionAssetSendKey", typeof(System.String)); + createCol(regions, "regionAssetURI", typeof (String)); + createCol(regions, "regionAssetRecvKey", typeof (String)); + createCol(regions, "regionAssetSendKey", typeof (String)); - createCol(regions, "regionUserURI", typeof(System.String)); - createCol(regions, "regionUserRecvKey", typeof(System.String)); - createCol(regions, "regionUserSendKey", typeof(System.String)); + createCol(regions, "regionUserURI", typeof (String)); + createCol(regions, "regionUserRecvKey", typeof (String)); + createCol(regions, "regionUserSendKey", typeof (String)); - createCol(regions, "regionMapTexture", typeof(System.String)); - createCol(regions, "serverHttpPort", typeof(System.String)); - createCol(regions, "serverRemotingPort", typeof(uint)); + createCol(regions, "regionMapTexture", typeof (String)); + createCol(regions, "serverHttpPort", typeof (String)); + createCol(regions, "serverRemotingPort", typeof (uint)); // Add in contraints - regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; + regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]}; return regions; } - protected static void createCol(DataTable dt, string name, System.Type type) + protected static void createCol(DataTable dt, string name, Type type) { DataColumn col = new DataColumn(name, type); dt.Columns.Add(col); @@ -172,10 +174,11 @@ namespace OpenSim.Framework.Data.MSSQL foreach (DataColumn col in dt.Columns) { if (subsql.Length > 0) - { // a map function would rock so much here + { + // a map function would rock so much here subsql += ",\n"; } - + subsql += col.ColumnName + " " + SqlType(col.DataType); if (col == dt.PrimaryKey[0]) { @@ -192,19 +195,19 @@ namespace OpenSim.Framework.Data.MSSQL // slightly differently. private static string SqlType(Type type) { - if (type == typeof(System.String)) + if (type == typeof (String)) { return "varchar(255)"; } - else if (type == typeof(System.Int32)) + else if (type == typeof (Int32)) { return "integer"; } - else if (type == typeof(System.Double)) + else if (type == typeof (Double)) { return "float"; } - else if (type == typeof(System.Byte[])) + else if (type == typeof (Byte[])) { return "image"; } @@ -254,14 +257,14 @@ namespace OpenSim.Framework.Data.MSSQL /// A Sql DB Command public IDbCommand Query(string sql, Dictionary parameters) { - SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); - dbcommand.CommandText = sql; + SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand(); + dbcommand.CommandText = sql; foreach (KeyValuePair param in parameters) { dbcommand.Parameters.AddWithValue(param.Key, param.Value); } - - return (IDbCommand)dbcommand; + + return (IDbCommand) dbcommand; } /// @@ -277,20 +280,20 @@ namespace OpenSim.Framework.Data.MSSQL { // Region Main regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]); - regionprofile.regionName = (string)reader["regionName"]; - regionprofile.UUID = new LLUUID((string)reader["uuid"]); + regionprofile.regionName = (string) reader["regionName"]; + regionprofile.UUID = new LLUUID((string) reader["uuid"]); // Secrets - regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; - regionprofile.regionSecret = (string)reader["regionSecret"]; - regionprofile.regionSendKey = (string)reader["regionSendKey"]; + regionprofile.regionRecvKey = (string) reader["regionRecvKey"]; + regionprofile.regionSecret = (string) reader["regionSecret"]; + regionprofile.regionSendKey = (string) reader["regionSendKey"]; // Region Server - regionprofile.regionDataURI = (string)reader["regionDataURI"]; + regionprofile.regionDataURI = (string) reader["regionDataURI"]; regionprofile.regionOnline = false; // Needs to be pinged before this can be set. - regionprofile.serverIP = (string)reader["serverIP"]; + regionprofile.serverIP = (string) reader["serverIP"]; regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]); - regionprofile.serverURI = (string)reader["serverURI"]; + regionprofile.serverURI = (string) reader["serverURI"]; regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]); regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]); @@ -307,14 +310,14 @@ namespace OpenSim.Framework.Data.MSSQL regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]); // Assets - regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; - regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; - regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + regionprofile.regionAssetURI = (string) reader["regionAssetURI"]; + regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; + regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"]; // Userserver - regionprofile.regionUserURI = (string)reader["regionUserURI"]; - regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; - regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; + regionprofile.regionUserURI = (string) reader["regionUserURI"]; + regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"]; + regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"]; // World Map Addition string tempRegionMap = reader["regionMapTexture"].ToString(); @@ -331,7 +334,6 @@ namespace OpenSim.Framework.Data.MSSQL { reader.Close(); throw new Exception("No rows to return"); - } return regionprofile; } @@ -347,12 +349,12 @@ namespace OpenSim.Framework.Data.MSSQL if (reader.Read()) { - retval.UUID = new LLUUID((string)reader["UUID"]); - retval.username = (string)reader["username"]; - retval.surname = (string)reader["lastname"]; + retval.UUID = new LLUUID((string) reader["UUID"]); + retval.username = (string) reader["username"]; + retval.surname = (string) reader["lastname"]; - retval.passwordHash = (string)reader["passwordHash"]; - retval.passwordSalt = (string)reader["passwordSalt"]; + retval.passwordHash = (string) reader["passwordHash"]; + retval.passwordSalt = (string) reader["passwordSalt"]; retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); retval.homeLocation = new LLVector3( @@ -367,18 +369,17 @@ namespace OpenSim.Framework.Data.MSSQL retval.created = Convert.ToInt32(reader["created"].ToString()); retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); - retval.userInventoryURI = (string)reader["userInventoryURI"]; - retval.userAssetURI = (string)reader["userAssetURI"]; + retval.userInventoryURI = (string) reader["userInventoryURI"]; + retval.userAssetURI = (string) reader["userAssetURI"]; retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); - retval.profileAboutText = (string)reader["profileAboutText"]; - retval.profileFirstText = (string)reader["profileFirstText"]; - - retval.profileImage = new LLUUID((string)reader["profileImage"]); - retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); + retval.profileAboutText = (string) reader["profileAboutText"]; + retval.profileFirstText = (string) reader["profileFirstText"]; + retval.profileImage = new LLUUID((string) reader["profileImage"]); + retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]); } else { @@ -399,12 +400,12 @@ namespace OpenSim.Framework.Data.MSSQL if (reader.Read()) { // Agent IDs - retval.UUID = new LLUUID((string)reader["UUID"]); - retval.sessionID = new LLUUID((string)reader["sessionID"]); - retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); + retval.UUID = new LLUUID((string) reader["UUID"]); + retval.sessionID = new LLUUID((string) reader["sessionID"]); + retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]); // Agent Who? - retval.agentIP = (string)reader["agentIP"]; + retval.agentIP = (string) reader["agentIP"]; retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); @@ -413,9 +414,9 @@ namespace OpenSim.Framework.Data.MSSQL retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); // Current position - retval.currentRegion = (string)reader["currentRegion"]; + retval.currentRegion = (string) reader["currentRegion"]; retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); - LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); + LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos); } else { @@ -426,20 +427,19 @@ namespace OpenSim.Framework.Data.MSSQL public AssetBase getAssetRow(IDataReader reader) { - AssetBase asset = new AssetBase(); + AssetBase asset = new AssetBase(); if (reader.Read()) { // Region Main asset = new AssetBase(); - asset.Data = (byte[])reader["data"]; - asset.Description = (string)reader["description"]; - asset.FullID = new LLUUID((string)reader["id"]); + asset.Data = (byte[]) reader["data"]; + asset.Description = (string) reader["description"]; + asset.FullID = new LLUUID((string) reader["id"]); asset.InvType = Convert.ToSByte(reader["invType"]); asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; - asset.Name = (string)reader["name"]; + asset.Name = (string) reader["name"]; asset.Type = Convert.ToSByte(reader["assetType"]); - } else { @@ -455,15 +455,19 @@ namespace OpenSim.Framework.Data.MSSQL /// Successful? public bool insertRegionRow(RegionProfileData profile) { - //Insert new region - string sql = "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], "; - sql += "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], "; - sql += "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES "; + string sql = + "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], "; + sql += + "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], "; + sql += + "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES "; sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; - sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; - sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);"; + sql += + "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; + sql += + "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);"; Dictionary parameters = new Dictionary(); @@ -498,9 +502,9 @@ namespace OpenSim.Framework.Data.MSSQL bool returnval = false; try - { + { IDbCommand result = Query(sql, parameters); - + if (result.ExecuteNonQuery() == 1) returnval = true; @@ -509,15 +513,12 @@ namespace OpenSim.Framework.Data.MSSQL catch (Exception e) { MainLog.Instance.Error("MSSQLManager : " + e.ToString()); - } return returnval; - } - /// /// Inserts a new row into the log database /// @@ -528,7 +529,8 @@ namespace OpenSim.Framework.Data.MSSQL /// How critical is this? /// Extra message info /// Saved successfully? - public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) + public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, + string logMessage) { string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES "; sql += "(@target, @server, @method, @arguments, @priority, @message);"; @@ -588,19 +590,26 @@ namespace OpenSim.Framework.Data.MSSQL /// UUID for profile image /// UUID for firstlife image /// Success? - public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, - float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, - libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) + public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash, + string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, + float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, + string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, + string aboutText, string firstText, + LLUUID profileImage, LLUUID firstImage) { string sql = "INSERT INTO users "; sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], "; - sql += "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], "; - sql += "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], "; + sql += + "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], "; + sql += + "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], "; sql += "[profileFirstText], [profileImage], [profileFirstImage]) VALUES "; sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, "; - sql += "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, "; - sql += "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, "; + sql += + "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, "; + sql += + "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, "; sql += "@profileFirstText, @profileImage, @profileFirstImage);"; Dictionary parameters = new Dictionary(); @@ -624,13 +633,13 @@ namespace OpenSim.Framework.Data.MSSQL parameters["profileWantDoMask"] = "0"; parameters["profileAboutText"] = ""; parameters["profileFirstText"] = ""; - parameters["profileImage"] = libsecondlife.LLUUID.Zero.ToString(); - parameters["profileFirstImage"] = libsecondlife.LLUUID.Zero.ToString(); + parameters["profileImage"] = LLUUID.Zero.ToString(); + parameters["profileFirstImage"] = LLUUID.Zero.ToString(); bool returnval = false; try - { + { IDbCommand result = Query(sql, parameters); if (result.ExecuteNonQuery() == 1) @@ -655,8 +664,7 @@ namespace OpenSim.Framework.Data.MSSQL { try { - - SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon); + SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection) dbcon); cmd.ExecuteNonQuery(); cmd.Dispose(); } @@ -668,7 +676,7 @@ namespace OpenSim.Framework.Data.MSSQL public SqlConnection getConnection() { - return (SqlConnection)dbcon; + return (SqlConnection) dbcon; } /// @@ -681,14 +689,15 @@ namespace OpenSim.Framework.Data.MSSQL { Dictionary param = new Dictionary(); param["dbname"] = dbcon.Database; - IDbCommand tablesCmd = this.Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param); + IDbCommand tablesCmd = + Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param); using (IDataReader tables = tablesCmd.ExecuteReader()) { while (tables.Read()) { try { - string tableName = (string)tables["TABLE_NAME"]; + string tableName = (string) tables["TABLE_NAME"]; if (tableList.ContainsKey(tableName)) tableList[tableName] = tableName; } @@ -704,7 +713,7 @@ namespace OpenSim.Framework.Data.MSSQL private string getResourceString(string name) { - Assembly assem = this.GetType().Assembly; + Assembly assem = GetType().Assembly; string[] names = assem.GetManifestResourceNames(); foreach (string s in names) @@ -726,16 +735,14 @@ namespace OpenSim.Framework.Data.MSSQL /// A string containing the DB provider public string getVersion() { - System.Reflection.Module module = this.GetType().Module; + Module module = GetType().Module; string dllName = module.Assembly.ManifestModule.Name; Version dllVersion = module.Assembly.GetName().Version; - return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); + return + string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, + dllVersion.Revision); } - } - - - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs index eac98265e4..01ef559c2f 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs @@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.MSSQL /// /// A database interface class to a user profile storage system /// - class MSSQLUserData : IUserData + internal class MSSQLUserData : IUserData { /// /// Database manager for MySQL @@ -58,7 +58,9 @@ namespace OpenSim.Framework.Data.MSSQL string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); - database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); + database = + new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, + settingPassword); } /// @@ -77,11 +79,12 @@ namespace OpenSim.Framework.Data.MSSQL param["first"] = user; param["second"] = last; - IDbCommand result = database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param); + IDbCommand result = + database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param); IDataReader reader = result.ExecuteReader(); UserProfileData row = database.readUserRow(reader); - + reader.Close(); result.Dispose(); @@ -96,9 +99,9 @@ namespace OpenSim.Framework.Data.MSSQL } } - public List GeneratePickerResults(LLUUID queryID, string query) + public List GeneratePickerResults(LLUUID queryID, string query) { - List returnlist = new List(); + List returnlist = new List(); string[] querysplit; querysplit = query.Split(' '); if (querysplit.Length == 2) @@ -112,18 +115,19 @@ namespace OpenSim.Framework.Data.MSSQL param["second"] = querysplit[1]; IDbCommand result = - database.Query("SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", param); + database.Query( + "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { - OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["surname"]; + Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["surname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -135,13 +139,9 @@ namespace OpenSim.Framework.Data.MSSQL MainLog.Instance.Error(e.ToString()); return returnlist; } - - - } else if (querysplit.Length == 1) { - try { lock (database) @@ -151,18 +151,19 @@ namespace OpenSim.Framework.Data.MSSQL param["second"] = querysplit[1]; IDbCommand result = - database.Query("SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", param); + database.Query( + "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { - OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["surname"]; + Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["surname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -268,21 +269,25 @@ namespace OpenSim.Framework.Data.MSSQL /// The user profile to create public void AddNewUserProfile(UserProfileData user) { - try - { - lock (database) - { - database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, - user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, - user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); - } - } - catch (Exception e) - { - database.Reconnect(); - MainLog.Instance.Error(e.ToString()); - } - + try + { + lock (database) + { + database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, + user.homeRegion, user.homeLocation.X, user.homeLocation.Y, + user.homeLocation.Z, + user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, + user.lastLogin, user.userInventoryURI, user.userAssetURI, + user.profileCanDoMask, user.profileWantDoMask, + user.profileAboutText, user.profileFirstText, user.profileImage, + user.profileFirstImage); + } + } + catch (Exception e) + { + database.Reconnect(); + MainLog.Instance.Error(e.ToString()); + } } /// @@ -293,34 +298,33 @@ namespace OpenSim.Framework.Data.MSSQL { // Do nothing. } - - + + public bool UpdateUserProfile(UserProfileData user) { - SqlCommand command = new SqlCommand("UPDATE users set UUID = @uuid, " + - "username = @username, " + - "lastname = @lastname," + - "passwordHash = @passwordHash," + - "passwordSalt = @passwordSalt," + - "homeRegion = @homeRegion," + - "homeLocationX = @homeLocationX," + - "homeLocationY = @homeLocationY," + - "homeLocationZ = @homeLocationZ," + - "homeLookAtX = @homeLookAtX," + - "homeLookAtY = @homeLookAtY," + - "homeLookAtZ = @homeLookAtZ," + - "created = @created," + - "lastLogin = @lastLogin," + - "userInventoryURI = @userInventoryURI," + - "userAssetURI = @userAssetURI," + - "profileCanDoMask = @profileCanDoMask," + - "profileWantDoMask = @profileWantDoMask," + - "profileAboutText = @profileAboutText," + - "profileFirstText = @profileFirstText," + - "profileImage = @profileImage," + - "profileFirstImage = @profileFirstImage where " + - "UUID = @keyUUUID;", database.getConnection()); + "username = @username, " + + "lastname = @lastname," + + "passwordHash = @passwordHash," + + "passwordSalt = @passwordSalt," + + "homeRegion = @homeRegion," + + "homeLocationX = @homeLocationX," + + "homeLocationY = @homeLocationY," + + "homeLocationZ = @homeLocationZ," + + "homeLookAtX = @homeLookAtX," + + "homeLookAtY = @homeLookAtY," + + "homeLookAtZ = @homeLookAtZ," + + "created = @created," + + "lastLogin = @lastLogin," + + "userInventoryURI = @userInventoryURI," + + "userAssetURI = @userAssetURI," + + "profileCanDoMask = @profileCanDoMask," + + "profileWantDoMask = @profileWantDoMask," + + "profileAboutText = @profileAboutText," + + "profileFirstText = @profileFirstText," + + "profileImage = @profileImage," + + "profileFirstImage = @profileFirstImage where " + + "UUID = @keyUUUID;", database.getConnection()); SqlParameter param1 = new SqlParameter("@uuid", user.UUID.ToString()); SqlParameter param2 = new SqlParameter("@username", user.username); SqlParameter param3 = new SqlParameter("@lastname", user.surname); @@ -341,8 +345,8 @@ namespace OpenSim.Framework.Data.MSSQL SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask)); SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText); SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText); - SqlParameter param21 = new SqlParameter("@profileImage", libsecondlife.LLUUID.Zero.ToString()); - SqlParameter param22 = new SqlParameter("@profileFirstImage", libsecondlife.LLUUID.Zero.ToString()); + SqlParameter param21 = new SqlParameter("@profileImage", LLUUID.Zero.ToString()); + SqlParameter param22 = new SqlParameter("@profileFirstImage", LLUUID.Zero.ToString()); SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString()); command.Parameters.Add(param1); command.Parameters.Add(param2); @@ -370,9 +374,12 @@ namespace OpenSim.Framework.Data.MSSQL try { int affected = command.ExecuteNonQuery(); - if (affected != 0) { + if (affected != 0) + { return true; - } else { + } + else + { return false; } } @@ -433,6 +440,5 @@ namespace OpenSim.Framework.Data.MSSQL public void runQuery(string query) { } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index 19ae115b68..b20c54e557 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -83,13 +83,13 @@ namespace OpenSim.Framework.Data.MySQL if (dbReader.Read()) { asset = new AssetBase(); - asset.Data = (byte[])dbReader["data"]; - asset.Description = (string)dbReader["description"]; + asset.Data = (byte[]) dbReader["data"]; + asset.Description = (string) dbReader["description"]; asset.FullID = assetID; - asset.InvType = (sbyte)dbReader["invType"]; - asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; - asset.Name = (string)dbReader["name"]; - asset.Type = (sbyte)dbReader["assetType"]; + asset.InvType = (sbyte) dbReader["invType"]; + asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; + asset.Name = (string) dbReader["name"]; + asset.Type = (sbyte) dbReader["assetType"]; } dbReader.Close(); cmd.Dispose(); @@ -98,7 +98,7 @@ namespace OpenSim.Framework.Data.MySQL catch (Exception) { MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset"); - } + } } return asset; } diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index c48c88f24e..fcf8c6fa6a 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -31,15 +31,12 @@ using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; -using System.Text; using libsecondlife; using MySql.Data.MySqlClient; using OpenSim.Framework.Console; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.Scenes; -using System.Data.SqlClient; -using System.Data.Common; namespace OpenSim.Framework.Data.MySQL { @@ -130,7 +127,7 @@ namespace OpenSim.Framework.Data.MySQL { foreach (SceneObjectPart prim in obj.Children.Values) { - if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) + if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) { MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); addPrim(prim, obj.UUID, regionUUID); @@ -156,7 +153,7 @@ namespace OpenSim.Framework.Data.MySQL DataRow[] primRows = prims.Select(selectExp); foreach (DataRow row in primRows) { - LLUUID uuid = new LLUUID((string)row["UUID"]); + LLUUID uuid = new LLUUID((string) row["UUID"]); DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); if (shapeRow != null) { @@ -191,8 +188,8 @@ namespace OpenSim.Framework.Data.MySQL { try { - string uuid = (string)primRow["UUID"]; - string objID = (string)primRow["SceneGroupID"]; + string uuid = (string) primRow["UUID"]; + string objID = (string) primRow["SceneGroupID"]; if (uuid == objID) //is new SceneObjectGroup ? { SceneObjectGroup group = new SceneObjectGroup(); @@ -255,10 +252,9 @@ namespace OpenSim.Framework.Data.MySQL lock (m_dataSet) { MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + - " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); + " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); using (cmd) { - cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter))); @@ -269,7 +265,7 @@ namespace OpenSim.Framework.Data.MySQL public double[,] LoadTerrain(LLUUID regionID) { - double[,] terret = new double[256, 256]; + double[,] terret = new double[256,256]; terret.Initialize(); MySqlCommand cmd = new MySqlCommand( @@ -278,7 +274,7 @@ namespace OpenSim.Framework.Data.MySQL , m_connection); MySqlParameter param = new MySqlParameter(); - cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); + cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); if (m_connection.State != ConnectionState.Open) { @@ -290,15 +286,15 @@ namespace OpenSim.Framework.Data.MySQL int rev = 0; if (row.Read()) { - byte[] heightmap = (byte[])row["Heightfield"]; + byte[] heightmap = (byte[]) row["Heightfield"]; for (int x = 0; x < 256; x++) { for (int y = 0; y < 256; y++) { - terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); + terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); } } - rev = (int)row["Revision"]; + rev = (int) row["Revision"]; } else { @@ -322,7 +318,9 @@ namespace OpenSim.Framework.Data.MySQL cmd.ExecuteNonQuery(); } - using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection)) + using ( + MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection) + ) { cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID))); cmd.ExecuteNonQuery(); @@ -336,7 +334,7 @@ namespace OpenSim.Framework.Data.MySQL { DataTable land = m_landTable; DataTable landaccesslist = m_landAccessListTable; - + DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID)); if (landRow == null) { @@ -349,7 +347,9 @@ namespace OpenSim.Framework.Data.MySQL fillLandRow(landRow, parcel.landData, regionUUID); } - using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection)) + using ( + MySqlCommand cmd = + new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection)) { cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); cmd.ExecuteNonQuery(); @@ -361,13 +361,12 @@ namespace OpenSim.Framework.Data.MySQL fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); landaccesslist.Rows.Add(newAccessRow); } - } Commit(); } - public List LoadLandObjects(LLUUID regionUUID) + public List LoadLandObjects(LLUUID regionUUID) { List landDataForRegion = new List(); lock (m_dataSet) @@ -403,7 +402,7 @@ namespace OpenSim.Framework.Data.MySQL foreach (DataRow row in table.Rows) { //--- Display the original values, if there are any. - if (row.HasVersion(System.Data.DataRowVersion.Original)) + if (row.HasVersion(DataRowVersion.Original)) { Debug.Write("Original Row Values ===> "); foreach (DataColumn column in table.Columns) @@ -412,7 +411,7 @@ namespace OpenSim.Framework.Data.MySQL Debug.WriteLine(""); } //--- Display the current values, if there are any. - if (row.HasVersion(System.Data.DataRowVersion.Current)) + if (row.HasVersion(DataRowVersion.Current)) { Debug.Write("Current Row Values ====> "); foreach (DataColumn column in table.Columns) @@ -470,9 +469,9 @@ namespace OpenSim.Framework.Data.MySQL { DataTable terrain = new DataTable("terrain"); - createCol(terrain, "RegionUUID", typeof(String)); - createCol(terrain, "Revision", typeof(Int32)); - DataColumn heightField = createCol(terrain, "Heightfield", typeof(Byte[])); + createCol(terrain, "RegionUUID", typeof (String)); + createCol(terrain, "Revision", typeof (Int32)); + DataColumn heightField = createCol(terrain, "Heightfield", typeof (Byte[])); return terrain; } @@ -480,62 +479,62 @@ namespace OpenSim.Framework.Data.MySQL { DataTable prims = new DataTable("prims"); - createCol(prims, "UUID", typeof(String)); - createCol(prims, "RegionUUID", typeof(String)); - createCol(prims, "ParentID", typeof(Int32)); - createCol(prims, "CreationDate", typeof(Int32)); - createCol(prims, "Name", typeof(String)); - createCol(prims, "SceneGroupID", typeof(String)); + createCol(prims, "UUID", typeof (String)); + createCol(prims, "RegionUUID", typeof (String)); + createCol(prims, "ParentID", typeof (Int32)); + createCol(prims, "CreationDate", typeof (Int32)); + createCol(prims, "Name", typeof (String)); + createCol(prims, "SceneGroupID", typeof (String)); // various text fields - createCol(prims, "Text", typeof(String)); - createCol(prims, "Description", typeof(String)); - createCol(prims, "SitName", typeof(String)); - createCol(prims, "TouchName", typeof(String)); + createCol(prims, "Text", typeof (String)); + createCol(prims, "Description", typeof (String)); + createCol(prims, "SitName", typeof (String)); + createCol(prims, "TouchName", typeof (String)); // permissions - createCol(prims, "ObjectFlags", typeof(Int32)); - createCol(prims, "CreatorID", typeof(String)); - createCol(prims, "OwnerID", typeof(String)); - createCol(prims, "GroupID", typeof(String)); - createCol(prims, "LastOwnerID", typeof(String)); - createCol(prims, "OwnerMask", typeof(Int32)); - createCol(prims, "NextOwnerMask", typeof(Int32)); - createCol(prims, "GroupMask", typeof(Int32)); - createCol(prims, "EveryoneMask", typeof(Int32)); - createCol(prims, "BaseMask", typeof(Int32)); + createCol(prims, "ObjectFlags", typeof (Int32)); + createCol(prims, "CreatorID", typeof (String)); + createCol(prims, "OwnerID", typeof (String)); + createCol(prims, "GroupID", typeof (String)); + createCol(prims, "LastOwnerID", typeof (String)); + createCol(prims, "OwnerMask", typeof (Int32)); + createCol(prims, "NextOwnerMask", typeof (Int32)); + createCol(prims, "GroupMask", typeof (Int32)); + createCol(prims, "EveryoneMask", typeof (Int32)); + createCol(prims, "BaseMask", typeof (Int32)); // vectors - createCol(prims, "PositionX", typeof(Double)); - createCol(prims, "PositionY", typeof(Double)); - createCol(prims, "PositionZ", typeof(Double)); - createCol(prims, "GroupPositionX", typeof(Double)); - createCol(prims, "GroupPositionY", typeof(Double)); - createCol(prims, "GroupPositionZ", typeof(Double)); - createCol(prims, "VelocityX", typeof(Double)); - createCol(prims, "VelocityY", typeof(Double)); - createCol(prims, "VelocityZ", typeof(Double)); - createCol(prims, "AngularVelocityX", typeof(Double)); - createCol(prims, "AngularVelocityY", typeof(Double)); - createCol(prims, "AngularVelocityZ", typeof(Double)); - createCol(prims, "AccelerationX", typeof(Double)); - createCol(prims, "AccelerationY", typeof(Double)); - createCol(prims, "AccelerationZ", typeof(Double)); + createCol(prims, "PositionX", typeof (Double)); + createCol(prims, "PositionY", typeof (Double)); + createCol(prims, "PositionZ", typeof (Double)); + createCol(prims, "GroupPositionX", typeof (Double)); + createCol(prims, "GroupPositionY", typeof (Double)); + createCol(prims, "GroupPositionZ", typeof (Double)); + createCol(prims, "VelocityX", typeof (Double)); + createCol(prims, "VelocityY", typeof (Double)); + createCol(prims, "VelocityZ", typeof (Double)); + createCol(prims, "AngularVelocityX", typeof (Double)); + createCol(prims, "AngularVelocityY", typeof (Double)); + createCol(prims, "AngularVelocityZ", typeof (Double)); + createCol(prims, "AccelerationX", typeof (Double)); + createCol(prims, "AccelerationY", typeof (Double)); + createCol(prims, "AccelerationZ", typeof (Double)); // quaternions - createCol(prims, "RotationX", typeof(Double)); - createCol(prims, "RotationY", typeof(Double)); - createCol(prims, "RotationZ", typeof(Double)); - createCol(prims, "RotationW", typeof(Double)); + createCol(prims, "RotationX", typeof (Double)); + createCol(prims, "RotationY", typeof (Double)); + createCol(prims, "RotationZ", typeof (Double)); + createCol(prims, "RotationW", typeof (Double)); // sit target - createCol(prims, "SitTargetOffsetX", typeof(Double)); - createCol(prims, "SitTargetOffsetY", typeof(Double)); - createCol(prims, "SitTargetOffsetZ", typeof(Double)); + createCol(prims, "SitTargetOffsetX", typeof (Double)); + createCol(prims, "SitTargetOffsetY", typeof (Double)); + createCol(prims, "SitTargetOffsetZ", typeof (Double)); - createCol(prims, "SitTargetOrientW", typeof(Double)); - createCol(prims, "SitTargetOrientX", typeof(Double)); - createCol(prims, "SitTargetOrientY", typeof(Double)); - createCol(prims, "SitTargetOrientZ", typeof(Double)); + createCol(prims, "SitTargetOrientW", typeof (Double)); + createCol(prims, "SitTargetOrientX", typeof (Double)); + createCol(prims, "SitTargetOrientY", typeof (Double)); + createCol(prims, "SitTargetOrientZ", typeof (Double)); // Add in contraints - prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; + prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; return prims; } @@ -543,42 +542,42 @@ namespace OpenSim.Framework.Data.MySQL private DataTable createLandTable() { DataTable land = new DataTable("land"); - createCol(land, "UUID", typeof(String)); - createCol(land, "RegionUUID", typeof(String)); - createCol(land, "LocalLandID", typeof(Int32)); + createCol(land, "UUID", typeof (String)); + createCol(land, "RegionUUID", typeof (String)); + createCol(land, "LocalLandID", typeof (Int32)); // Bitmap is a byte[512] - createCol(land, "Bitmap", typeof(Byte[])); + createCol(land, "Bitmap", typeof (Byte[])); - createCol(land, "Name", typeof(String)); - createCol(land, "Description", typeof(String)); - createCol(land, "OwnerUUID", typeof(String)); - createCol(land, "IsGroupOwned", typeof(Int32)); - createCol(land, "Area", typeof(Int32)); - createCol(land, "AuctionID", typeof(Int32)); //Unemplemented - createCol(land, "Category", typeof(Int32)); //Enum libsecondlife.Parcel.ParcelCategory - createCol(land, "ClaimDate", typeof(Int32)); - createCol(land, "ClaimPrice", typeof(Int32)); - createCol(land, "GroupUUID", typeof(String)); - createCol(land, "SalePrice", typeof(Int32)); - createCol(land, "LandStatus", typeof(Int32)); //Enum. libsecondlife.Parcel.ParcelStatus - createCol(land, "LandFlags", typeof(Int32)); - createCol(land, "LandingType", typeof(Int32)); - createCol(land, "MediaAutoScale", typeof(Int32)); - createCol(land, "MediaTextureUUID", typeof(String)); - createCol(land, "MediaURL", typeof(String)); - createCol(land, "MusicURL", typeof(String)); - createCol(land, "PassHours", typeof(Double)); - createCol(land, "PassPrice", typeof(Int32)); - createCol(land, "SnapshotUUID", typeof(String)); - createCol(land, "UserLocationX", typeof(Double)); - createCol(land, "UserLocationY", typeof(Double)); - createCol(land, "UserLocationZ", typeof(Double)); - createCol(land, "UserLookAtX", typeof(Double)); - createCol(land, "UserLookAtY", typeof(Double)); - createCol(land, "UserLookAtZ", typeof(Double)); + createCol(land, "Name", typeof (String)); + createCol(land, "Description", typeof (String)); + createCol(land, "OwnerUUID", typeof (String)); + createCol(land, "IsGroupOwned", typeof (Int32)); + createCol(land, "Area", typeof (Int32)); + createCol(land, "AuctionID", typeof (Int32)); //Unemplemented + createCol(land, "Category", typeof (Int32)); //Enum libsecondlife.Parcel.ParcelCategory + createCol(land, "ClaimDate", typeof (Int32)); + createCol(land, "ClaimPrice", typeof (Int32)); + createCol(land, "GroupUUID", typeof (String)); + createCol(land, "SalePrice", typeof (Int32)); + createCol(land, "LandStatus", typeof (Int32)); //Enum. libsecondlife.Parcel.ParcelStatus + createCol(land, "LandFlags", typeof (Int32)); + createCol(land, "LandingType", typeof (Int32)); + createCol(land, "MediaAutoScale", typeof (Int32)); + createCol(land, "MediaTextureUUID", typeof (String)); + createCol(land, "MediaURL", typeof (String)); + createCol(land, "MusicURL", typeof (String)); + createCol(land, "PassHours", typeof (Double)); + createCol(land, "PassPrice", typeof (Int32)); + createCol(land, "SnapshotUUID", typeof (String)); + createCol(land, "UserLocationX", typeof (Double)); + createCol(land, "UserLocationY", typeof (Double)); + createCol(land, "UserLocationZ", typeof (Double)); + createCol(land, "UserLookAtX", typeof (Double)); + createCol(land, "UserLookAtY", typeof (Double)); + createCol(land, "UserLookAtZ", typeof (Double)); - land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; + land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; return land; } @@ -586,9 +585,9 @@ namespace OpenSim.Framework.Data.MySQL private DataTable createLandAccessListTable() { DataTable landaccess = new DataTable("landaccesslist"); - createCol(landaccess, "LandUUID", typeof(String)); - createCol(landaccess, "AccessUUID", typeof(String)); - createCol(landaccess, "Flags", typeof(Int32)); + createCol(landaccess, "LandUUID", typeof (String)); + createCol(landaccess, "AccessUUID", typeof (String)); + createCol(landaccess, "Flags", typeof (Int32)); return landaccess; } @@ -596,38 +595,38 @@ namespace OpenSim.Framework.Data.MySQL private DataTable createShapeTable() { DataTable shapes = new DataTable("primshapes"); - createCol(shapes, "UUID", typeof(String)); + createCol(shapes, "UUID", typeof (String)); // shape is an enum - createCol(shapes, "Shape", typeof(Int32)); + createCol(shapes, "Shape", typeof (Int32)); // vectors - createCol(shapes, "ScaleX", typeof(Double)); - createCol(shapes, "ScaleY", typeof(Double)); - createCol(shapes, "ScaleZ", typeof(Double)); + createCol(shapes, "ScaleX", typeof (Double)); + createCol(shapes, "ScaleY", typeof (Double)); + createCol(shapes, "ScaleZ", typeof (Double)); // paths - createCol(shapes, "PCode", typeof(Int32)); - createCol(shapes, "PathBegin", typeof(Int32)); - createCol(shapes, "PathEnd", typeof(Int32)); - createCol(shapes, "PathScaleX", typeof(Int32)); - createCol(shapes, "PathScaleY", typeof(Int32)); - createCol(shapes, "PathShearX", typeof(Int32)); - createCol(shapes, "PathShearY", typeof(Int32)); - createCol(shapes, "PathSkew", typeof(Int32)); - createCol(shapes, "PathCurve", typeof(Int32)); - createCol(shapes, "PathRadiusOffset", typeof(Int32)); - createCol(shapes, "PathRevolutions", typeof(Int32)); - createCol(shapes, "PathTaperX", typeof(Int32)); - createCol(shapes, "PathTaperY", typeof(Int32)); - createCol(shapes, "PathTwist", typeof(Int32)); - createCol(shapes, "PathTwistBegin", typeof(Int32)); + createCol(shapes, "PCode", typeof (Int32)); + createCol(shapes, "PathBegin", typeof (Int32)); + createCol(shapes, "PathEnd", typeof (Int32)); + createCol(shapes, "PathScaleX", typeof (Int32)); + createCol(shapes, "PathScaleY", typeof (Int32)); + createCol(shapes, "PathShearX", typeof (Int32)); + createCol(shapes, "PathShearY", typeof (Int32)); + createCol(shapes, "PathSkew", typeof (Int32)); + createCol(shapes, "PathCurve", typeof (Int32)); + createCol(shapes, "PathRadiusOffset", typeof (Int32)); + createCol(shapes, "PathRevolutions", typeof (Int32)); + createCol(shapes, "PathTaperX", typeof (Int32)); + createCol(shapes, "PathTaperY", typeof (Int32)); + createCol(shapes, "PathTwist", typeof (Int32)); + createCol(shapes, "PathTwistBegin", typeof (Int32)); // profile - createCol(shapes, "ProfileBegin", typeof(Int32)); - createCol(shapes, "ProfileEnd", typeof(Int32)); - createCol(shapes, "ProfileCurve", typeof(Int32)); - createCol(shapes, "ProfileHollow", typeof(Int32)); - createCol(shapes, "Texture", typeof(Byte[])); - createCol(shapes, "ExtraParams", typeof(Byte[])); + createCol(shapes, "ProfileBegin", typeof (Int32)); + createCol(shapes, "ProfileEnd", typeof (Int32)); + createCol(shapes, "ProfileCurve", typeof (Int32)); + createCol(shapes, "ProfileHollow", typeof (Int32)); + createCol(shapes, "Texture", typeof (Byte[])); + createCol(shapes, "ExtraParams", typeof (Byte[])); - shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; + shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; return shapes; } @@ -643,23 +642,23 @@ namespace OpenSim.Framework.Data.MySQL private SceneObjectPart buildPrim(DataRow row) { SceneObjectPart prim = new SceneObjectPart(); - prim.UUID = new LLUUID((String)row["UUID"]); + prim.UUID = new LLUUID((String) row["UUID"]); // explicit conversion of integers is required, which sort // of sucks. No idea if there is a shortcut here or not. prim.ParentID = Convert.ToUInt32(row["ParentID"]); prim.CreationDate = Convert.ToInt32(row["CreationDate"]); - prim.Name = (String)row["Name"]; + prim.Name = (String) row["Name"]; // various text fields - prim.Text = (String)row["Text"]; - prim.Description = (String)row["Description"]; - prim.SitName = (String)row["SitName"]; - prim.TouchName = (String)row["TouchName"]; + prim.Text = (String) row["Text"]; + prim.Description = (String) row["Description"]; + prim.SitName = (String) row["SitName"]; + prim.TouchName = (String) row["TouchName"]; // permissions prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); - prim.CreatorID = new LLUUID((String)row["CreatorID"]); - prim.OwnerID = new LLUUID((String)row["OwnerID"]); - prim.GroupID = new LLUUID((String)row["GroupID"]); - prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); + prim.CreatorID = new LLUUID((String) row["CreatorID"]); + prim.OwnerID = new LLUUID((String) row["OwnerID"]); + prim.GroupID = new LLUUID((String) row["GroupID"]); + prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]); prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); @@ -701,19 +700,27 @@ namespace OpenSim.Framework.Data.MySQL try { prim.SetSitTargetLL(new LLVector3( - Convert.ToSingle(row["SitTargetOffsetX"]), - Convert.ToSingle(row["SitTargetOffsetY"]), - Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( - Convert.ToSingle(row["SitTargetOrientX"]), - Convert.ToSingle(row["SitTargetOrientY"]), - Convert.ToSingle(row["SitTargetOrientZ"]), - Convert.ToSingle(row["SitTargetOrientW"]))); + Convert.ToSingle(row["SitTargetOffsetX"]), + Convert.ToSingle(row["SitTargetOffsetY"]), + Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( + Convert.ToSingle( + row["SitTargetOrientX"]), + Convert.ToSingle( + row["SitTargetOrientY"]), + Convert.ToSingle( + row["SitTargetOrientZ"]), + Convert.ToSingle( + row["SitTargetOrientW"]))); } - catch (System.InvalidCastException) + catch (InvalidCastException) { // Database table was created before we got here and needs to be created! :P - using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) + using ( + MySqlCommand cmd = + new MySqlCommand( + "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", + m_connection)) { cmd.ExecuteNonQuery(); } @@ -725,36 +732,42 @@ namespace OpenSim.Framework.Data.MySQL { LandData newData = new LandData(); - newData.globalID = new LLUUID((String)row["UUID"]); + newData.globalID = new LLUUID((String) row["UUID"]); newData.localID = Convert.ToInt32(row["LocalLandID"]); // Bitmap is a byte[512] - newData.landBitmapByteArray = (Byte[])row["Bitmap"]; + newData.landBitmapByteArray = (Byte[]) row["Bitmap"]; - newData.landName = (String)row["Name"]; - newData.landDesc = (String)row["Description"]; - newData.ownerID = (String)row["OwnerUUID"]; + newData.landName = (String) row["Name"]; + newData.landDesc = (String) row["Description"]; + newData.ownerID = (String) row["OwnerUUID"]; newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); newData.area = Convert.ToInt32(row["Area"]); newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented - newData.category = (Parcel.ParcelCategory)Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory + newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]); + //Enum libsecondlife.Parcel.ParcelCategory newData.claimDate = Convert.ToInt32(row["ClaimDate"]); newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]); - newData.groupID = new LLUUID((String)row["GroupUUID"]); + newData.groupID = new LLUUID((String) row["GroupUUID"]); newData.salePrice = Convert.ToInt32(row["SalePrice"]); - newData.landStatus = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus + newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]); + //Enum. libsecondlife.Parcel.ParcelStatus newData.landFlags = Convert.ToUInt32(row["LandFlags"]); newData.landingType = Convert.ToByte(row["LandingType"]); newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); - newData.mediaID = new LLUUID((String)row["MediaTextureUUID"]); - newData.mediaURL = (String)row["MediaURL"]; - newData.musicURL = (String)row["MusicURL"]; + newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]); + newData.mediaURL = (String) row["MediaURL"]; + newData.musicURL = (String) row["MusicURL"]; newData.passHours = Convert.ToSingle(row["PassHours"]); newData.passPrice = Convert.ToInt32(row["PassPrice"]); - newData.snapshotID = (String)row["SnapshotUUID"]; + newData.snapshotID = (String) row["SnapshotUUID"]; - newData.userLocation = new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), Convert.ToSingle(row["UserLocationZ"])); - newData.userLookAt = new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), Convert.ToSingle(row["UserLookAtZ"])); + newData.userLocation = + new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), + Convert.ToSingle(row["UserLocationZ"])); + newData.userLookAt = + new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), + Convert.ToSingle(row["UserLookAtZ"])); newData.parcelAccessList = new List(); return newData; @@ -763,7 +776,7 @@ namespace OpenSim.Framework.Data.MySQL private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = new LLUUID((string)row["AccessUUID"]); + entry.AgentID = new LLUUID((string) row["AccessUUID"]); entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]); entry.Time = new DateTime(); return entry; @@ -771,7 +784,7 @@ namespace OpenSim.Framework.Data.MySQL private Array serializeTerrain(double[,] val) { - MemoryStream str = new MemoryStream(65536 * sizeof(double)); + MemoryStream str = new MemoryStream(65536*sizeof (double)); BinaryWriter bw = new BinaryWriter(str); // TODO: COMPATIBILITY - Add byte-order conversions @@ -789,7 +802,8 @@ namespace OpenSim.Framework.Data.MySQL row["ParentID"] = prim.ParentID; row["CreationDate"] = prim.CreationDate; row["Name"] = prim.Name; - row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup + row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); + // the UUID of the root part for this SceneObjectGroup // various text fields row["Text"] = prim.Text; row["Description"] = prim.Description; @@ -841,18 +855,20 @@ namespace OpenSim.Framework.Data.MySQL row["SitTargetOrientX"] = sitTargetOrient.X; row["SitTargetOrientY"] = sitTargetOrient.Y; row["SitTargetOrientZ"] = sitTargetOrient.Z; - } - catch (MySql.Data.MySqlClient.MySqlException) + } + catch (MySqlException) { // Database table was created before we got here and needs to be created! :P - using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) + using ( + MySqlCommand cmd = + new MySqlCommand( + "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", + m_connection)) { cmd.ExecuteNonQuery(); } } - - } private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) @@ -929,11 +945,11 @@ namespace OpenSim.Framework.Data.MySQL s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); - - byte[] textureEntry = (byte[])row["Texture"]; + + byte[] textureEntry = (byte[]) row["Texture"]; s.TextureEntry = textureEntry; - - s.ExtraParams = (byte[])row["ExtraParams"]; + + s.ExtraParams = (byte[]) row["ExtraParams"]; return s; } @@ -1146,7 +1162,7 @@ namespace OpenSim.Framework.Data.MySQL da.UpdateCommand = updateCommand; MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID"); - delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); + delete.Parameters.Add(createMySqlParameter("UUID", typeof (String))); delete.Connection = conn; da.DeleteCommand = delete; } @@ -1181,7 +1197,7 @@ namespace OpenSim.Framework.Data.MySQL da.UpdateCommand.Connection = conn; MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID"); - delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); + delete.Parameters.Add(createMySqlParameter("UUID", typeof (String))); delete.Connection = conn; da.DeleteCommand = delete; } @@ -1337,27 +1353,27 @@ namespace OpenSim.Framework.Data.MySQL private DbType dbtypeFromType(Type type) { - if (type == typeof(String)) + if (type == typeof (String)) { return DbType.String; } - else if (type == typeof(Int32)) + else if (type == typeof (Int32)) { return DbType.Int32; } - else if (type == typeof(Double)) + else if (type == typeof (Double)) { return DbType.Double; } - else if (type == typeof(Byte)) + else if (type == typeof (Byte)) { return DbType.Byte; } - else if (type == typeof(Double)) + else if (type == typeof (Double)) { return DbType.Double; } - else if (type == typeof(Byte[])) + else if (type == typeof (Byte[])) { return DbType.Binary; } @@ -1371,19 +1387,19 @@ namespace OpenSim.Framework.Data.MySQL // slightly differently. private string MySqlType(Type type) { - if (type == typeof(String)) + if (type == typeof (String)) { return "varchar(255)"; } - else if (type == typeof(Int32)) + else if (type == typeof (Int32)) { return "integer"; } - else if (type == typeof(Double)) + else if (type == typeof (Double)) { return "float"; } - else if (type == typeof(Byte[])) + else if (type == typeof (Byte[])) { return "longblob"; } @@ -1393,4 +1409,4 @@ namespace OpenSim.Framework.Data.MySQL } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 78435621f1..7cfac12253 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Data; using System.Security.Cryptography; using System.Text; +using System.Text.RegularExpressions; using libsecondlife; using OpenSim.Framework.Console; @@ -62,7 +63,7 @@ namespace OpenSim.Framework.Data.MySQL database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); - + TestTables(); } @@ -80,7 +81,7 @@ namespace OpenSim.Framework.Data.MySQL UpgradeRegionsTable(tableList["regions"]); } - + /// /// Create or upgrade the table if necessary /// @@ -94,10 +95,10 @@ namespace OpenSim.Framework.Data.MySQL database.ExecuteResourceSql("CreateRegionsTable.sql"); return; } - } - + } + #endregion - + /// /// Shuts down the grid interface /// @@ -203,42 +204,41 @@ namespace OpenSim.Framework.Data.MySQL return null; } } + /// /// // Returns a list of avatar and UUIDs that match the query /// - public List GeneratePickerResults(LLUUID queryID, string query) { List returnlist = new List(); - System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); + Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); string[] querysplit; querysplit = query.Split(' '); if (querysplit.Length == 2) { Dictionary param = new Dictionary(); - param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; + param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%"; try { lock (database) { - - IDbCommand result = - database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); + database.Query( + "SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { AvatarPickerAvatar user = new AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["surname"]; + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["surname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -250,33 +250,30 @@ namespace OpenSim.Framework.Data.MySQL MainLog.Instance.Error(e.ToString()); return returnlist; } - - - } else if (querysplit.Length == 1) { - try { lock (database) { Dictionary param = new Dictionary(); - param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; + param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; IDbCommand result = - database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", param); + database.Query( + "SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { AvatarPickerAvatar user = new AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["surname"]; + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["surname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -413,4 +410,4 @@ namespace OpenSim.Framework.Data.MySQL } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index a47a126c78..c317f4aa9e 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs @@ -232,7 +232,7 @@ namespace OpenSim.Framework.Data.MySQL List items = new List(); while (reader.Read()) items.Add(readInventoryFolder(reader)); - + InventoryFolderBase rootFolder = null; // There should only ever be one root folder for a user. However, if there's more @@ -637,4 +637,4 @@ namespace OpenSim.Framework.Data.MySQL } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs index eda5cc54ee..d2605fa14c 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs @@ -103,4 +103,4 @@ namespace OpenSim.Framework.Data.MySQL return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index d652db8cf2..96f0c4d796 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs @@ -666,4 +666,4 @@ namespace OpenSim.Framework.Data.MySQL return returnval; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 4b86d80124..2d96f6e620 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Data; +using System.Text.RegularExpressions; using libsecondlife; using OpenSim.Framework.Console; @@ -61,7 +62,7 @@ namespace OpenSim.Framework.Data.MySQL database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); - + TestTables(); } @@ -81,7 +82,7 @@ namespace OpenSim.Framework.Data.MySQL UpgradeAgentsTable(tableList["agents"]); UpgradeUsersTable(tableList["users"]); } - + /// /// Create or upgrade the table if necessary /// @@ -95,8 +96,8 @@ namespace OpenSim.Framework.Data.MySQL database.ExecuteResourceSql("CreateAgentsTable.sql"); return; } - } - + } + /// /// Create or upgrade the table if necessary /// @@ -110,8 +111,8 @@ namespace OpenSim.Framework.Data.MySQL database.ExecuteResourceSql("CreateUsersTable.sql"); return; } - } - + } + #endregion // see IUserData @@ -144,11 +145,11 @@ namespace OpenSim.Framework.Data.MySQL } } - public List GeneratePickerResults(LLUUID queryID, string query) + public List GeneratePickerResults(LLUUID queryID, string query) { - List returnlist = new List(); + List returnlist = new List(); - System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); + Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); string[] querysplit; querysplit = query.Split(' '); @@ -161,21 +162,20 @@ namespace OpenSim.Framework.Data.MySQL { lock (database) { - - IDbCommand result = - database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); + database.Query( + "SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { - OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["lastname"]; + Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["lastname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -187,13 +187,9 @@ namespace OpenSim.Framework.Data.MySQL MainLog.Instance.Error(e.ToString()); return returnlist; } - - - } else if (querysplit.Length == 1) { - try { lock (database) @@ -202,18 +198,19 @@ namespace OpenSim.Framework.Data.MySQL param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; IDbCommand result = - database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", param); + database.Query( + "SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", + param); IDataReader reader = result.ExecuteReader(); while (reader.Read()) { - OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); - user.AvatarID = new LLUUID((string)reader["UUID"]); - user.firstName = (string)reader["username"]; - user.lastName = (string)reader["lastname"]; + Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); + user.AvatarID = new LLUUID((string) reader["UUID"]); + user.firstName = (string) reader["username"]; + user.lastName = (string) reader["lastname"]; returnlist.Add(user); - } reader.Close(); result.Dispose(); @@ -402,4 +399,4 @@ namespace OpenSim.Framework.Data.MySQL return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs index 3723343bbc..462c4336f9 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs @@ -313,4 +313,4 @@ namespace OpenSim.Framework.Data.SQLite #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs index d9aaa97f62..2e8d341c21 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs @@ -263,4 +263,4 @@ namespace OpenSim.Framework.Data.SQLite } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index dddc0850c8..4b790c387b 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs @@ -130,16 +130,17 @@ namespace OpenSim.Framework.Data.SQLite return row; } + /// /// // Returns a list of avatar and UUIDs that match the query /// - public List GeneratePickerResults(LLUUID queryID, string query) { //Do nothing yet List returnlist = new List(); return returnlist; } + /// /// Adds a new specified region to the database /// @@ -201,4 +202,4 @@ namespace OpenSim.Framework.Data.SQLite return null; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index c6962594b4..64a27f0e68 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs @@ -159,6 +159,7 @@ namespace OpenSim.Framework.Data.SQLite invFoldersDa.Update(ds, "inventoryfolders"); } + private void addItem(InventoryItemBase item) { DataTable inventoryItemTable = ds.Tables["inventoryitems"]; @@ -248,7 +249,8 @@ namespace OpenSim.Framework.Data.SQLite { List folders = new List(); DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; - string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + Util.ToRawUuidString(LLUUID.Zero) + "'"; + string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + + Util.ToRawUuidString(LLUUID.Zero) + "'"; DataRow[] rows = inventoryFolderTable.Select(selectExp); foreach (DataRow row in rows) { @@ -627,4 +629,4 @@ namespace OpenSim.Framework.Data.SQLite return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index cac37d46c5..a97b14619c 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs @@ -275,4 +275,4 @@ namespace OpenSim.Framework.Data.SQLite return returnval; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index 811e0fa728..a719fa2fce 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Data; using libsecondlife; using Mono.Data.SqliteClient; -using OpenSim.Framework; using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.SQLite @@ -38,7 +37,6 @@ namespace OpenSim.Framework.Data.SQLite /// /// A User storage interface for the SQLite database system /// - public class SQLiteUserData : SQLiteBase, IUserData { /// @@ -119,46 +117,46 @@ namespace OpenSim.Framework.Data.SQLite } } - public List GeneratePickerResults(LLUUID queryID, string query) + public List GeneratePickerResults(LLUUID queryID, string query) { - List returnlist = new List(); + List returnlist = new List(); string[] querysplit; querysplit = query.Split(' '); - if (querysplit.Length == 2) + if (querysplit.Length == 2) { string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'"; - lock(ds) + lock (ds) { DataRow[] rows = ds.Tables["users"].Select(select); - if (rows.Length > 0) + if (rows.Length > 0) { for (int i = 0; i < rows.Length; i++) { - OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); + Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar(); DataRow row = rows[i]; - user.AvatarID = new LLUUID((string)row["UUID"]); - user.firstName = (string)row["username"]; - user.lastName = (string)row["surname"]; + user.AvatarID = new LLUUID((string) row["UUID"]); + user.firstName = (string) row["username"]; + user.lastName = (string) row["surname"]; returnlist.Add(user); } } } - } - else if (querysplit.Length == 1) + } + else if (querysplit.Length == 1) { - string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'"; - lock(ds) + lock (ds) { DataRow[] rows = ds.Tables["users"].Select(select); - if (rows.Length > 0) + if (rows.Length > 0) { - for (int i = 0;i /// Returns a user by UUID direct /// @@ -263,7 +262,6 @@ namespace OpenSim.Framework.Data.SQLite } else { - row.Delete(); ua.AcceptChanges(); } @@ -595,4 +593,4 @@ namespace OpenSim.Framework.Data.SQLite return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 7864dda2d7..6072600bd9 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs @@ -25,8 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; using System.Collections.Generic; +using libsecondlife; namespace OpenSim.Framework.Data { @@ -35,10 +35,12 @@ namespace OpenSim.Framework.Data public LLUUID AvatarID; public string firstName; public string lastName; + public AvatarPickerAvatar() { } } + public enum DataResponse { RESPONSE_OK, @@ -78,6 +80,7 @@ namespace OpenSim.Framework.Data List GeneratePickerResults(LLUUID queryID, string query); + /// /// Authenticates a sim by use of its recv key. /// WARNING: Insecure @@ -119,4 +122,4 @@ namespace OpenSim.Framework.Data ReservationData GetReservationAtPoint(uint x, uint y); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs index 2c05f4f441..8765b5c795 100644 --- a/OpenSim/Framework/Data/ILogData.cs +++ b/OpenSim/Framework/Data/ILogData.cs @@ -88,4 +88,4 @@ namespace OpenSim.Framework.Data /// A string containing the plugin version string getVersion(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs index 6b02553ee3..6af97701e2 100644 --- a/OpenSim/Framework/Data/IniConfig.cs +++ b/OpenSim/Framework/Data/IniConfig.cs @@ -95,4 +95,4 @@ namespace OpenSim.Framework.Data private string _iniFileName; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index a1fe901b14..ec50baa535 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs @@ -198,4 +198,4 @@ namespace OpenSim.Framework.Data return simData; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs index acab400561..285f9ca23a 100644 --- a/OpenSim/Framework/Data/ReservationData.cs +++ b/OpenSim/Framework/Data/ReservationData.cs @@ -44,4 +44,4 @@ namespace OpenSim.Framework.Data public string gridSendKey = ""; public string gridRecvKey = ""; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index b95ca83165..8c9d7f41e9 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -482,7 +482,7 @@ namespace OpenSim.Framework // I don't think there is a reason that this actually // needs to be written back to the estate settings // file. - + // configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); } } @@ -708,4 +708,4 @@ namespace OpenSim.Framework return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs index 799be46274..88210102a2 100644 --- a/OpenSim/Framework/GridConfig.cs +++ b/OpenSim/Framework/GridConfig.cs @@ -93,7 +93,8 @@ namespace OpenSim.Framework configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); - configMember.addConfigurationOption("allow_forceful_banlines", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + configMember.addConfigurationOption("allow_forceful_banlines", + ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Allow Forceful Banlines", "TRUE", true); } @@ -135,7 +136,7 @@ namespace OpenSim.Framework HttpPort = (uint) configuration_result; break; case "allow_forceful_banlines": - AllowForcefulBanlines = (string)configuration_result; + AllowForcefulBanlines = (string) configuration_result; break; } diff --git a/OpenSim/Framework/IAssetServer.cs b/OpenSim/Framework/IAssetServer.cs index 2fa77a048d..afd3687b6c 100644 --- a/OpenSim/Framework/IAssetServer.cs +++ b/OpenSim/Framework/IAssetServer.cs @@ -60,4 +60,4 @@ namespace OpenSim.Framework { IAssetServer GetAssetServer(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 18ecd92b71..8ef5576831 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -229,7 +229,8 @@ namespace OpenSim.Framework public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); public delegate void ModifyTerrain( - float height, float seconds, byte size, byte action, float north, float west, float south, float east, IClientAPI remoteClient); + float height, float seconds, byte size, byte action, float north, float west, float south, float east, + IClientAPI remoteClient); public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); @@ -269,7 +270,8 @@ namespace OpenSim.Framework public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); - public delegate void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID TaskID); + public delegate void RequestObjectPropertiesFamily( + IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID TaskID); public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); @@ -297,13 +299,17 @@ namespace OpenSim.Framework public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); - public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery); + public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery + ); public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); - public delegate void ParcelAccessListRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID,IClientAPI remote_client); - - public delegate void ParcelAccessListUpdateRequest(LLUUID agentID, LLUUID sessionID,uint flags, int landLocalID, List entries, IClientAPI remote_client); + public delegate void ParcelAccessListRequest( + LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); + + public delegate void ParcelAccessListUpdateRequest( + LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List entries, + IClientAPI remote_client); public delegate void ParcelPropertiesRequest( int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); @@ -330,13 +336,14 @@ namespace OpenSim.Framework public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client); - public delegate void GodKickUser(LLUUID GodAgentID, LLUUID GodSessionID, LLUUID AgentID, uint kickflags, byte[] reason); + public delegate void GodKickUser( + LLUUID GodAgentID, LLUUID GodSessionID, LLUUID AgentID, uint kickflags, byte[] reason); public delegate void CreateInventoryFolder( IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); public delegate void UpdateInventoryFolder( - IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); + IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); public delegate void MoveInventoryFolder( IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); @@ -360,7 +367,8 @@ namespace OpenSim.Framework uint nextOwnerMask); public delegate void CopyInventoryItem( - IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName); + IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, + string newName); public delegate void MoveInventoryItem( IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName); @@ -372,15 +380,18 @@ namespace OpenSim.Framework public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); public delegate void UDPAssetUploadRequest( - IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile); + IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal, + bool tempFile); public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); - - public delegate void ObjectPermissions(IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, List permChanges); + + public delegate void ObjectPermissions( + IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, + List permChanges); public interface IClientAPI { @@ -472,19 +483,19 @@ namespace OpenSim.Framework event EstateOwnerMessageRequest OnEstateOwnerMessage; event RegionInfoRequest OnRegionInfoRequest; event EstateCovenantRequest OnEstateCovenantRequest; - + LLVector3 StartPos { get; set; } LLUUID AgentId { get; } LLUUID SessionId { get; } - + LLUUID SecureSessionId { get; } string FirstName { get; } string LastName { get; } - + /// /// Returns the full name of the agent/avatar represented by this client /// @@ -536,26 +547,29 @@ namespace OpenSim.Framework void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); void SetChildAgentThrottle(byte[] throttle); + void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction); void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); + void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); - void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items, - List folders, bool fetchFolders, + void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items, + List folders, bool fetchFolders, bool fetchItems); + void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); - + /// /// Tell the client that we have created the item it requested. /// /// void SendInventoryItemCreateUpdate(InventoryItemBase Item); - + void SendRemoveInventoryItem(LLUUID itemID); void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); void SendXferPacket(ulong xferID, uint packet, byte[] data); @@ -566,7 +580,7 @@ namespace OpenSim.Framework void SendNameReply(LLUUID profileId, string firstname, string lastname); void SendAlertMessage(string message); - + void SendAgentAlertMessage(string message, bool modal); void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); bool AddMoney(int debit); @@ -587,4 +601,4 @@ namespace OpenSim.Framework event Action OnConnectionClosed; void SendLogoutPacket(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IGenericConfig.cs b/OpenSim/Framework/IGenericConfig.cs index cf742ccd63..0c9689c358 100644 --- a/OpenSim/Framework/IGenericConfig.cs +++ b/OpenSim/Framework/IGenericConfig.cs @@ -37,4 +37,4 @@ namespace OpenSim.Framework void Commit(); void Close(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index 363ab27c1e..19608c8c05 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs @@ -51,8 +51,6 @@ namespace OpenSim.Framework public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); - - public interface IRegionCommsListener { event ExpectUserDelegate OnExpectUser; @@ -66,6 +64,5 @@ namespace OpenSim.Framework event CloseAgentConnection OnCloseAgentConnection; event RegionUp OnRegionUp; event ChildAgentUpdate OnChildAgentUpdate; - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/Framework/IRegionLoader.cs index fe74737107..f3e0a231a2 100644 --- a/OpenSim/Framework/IRegionLoader.cs +++ b/OpenSim/Framework/IRegionLoader.cs @@ -26,11 +26,8 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework; using Nini.Config; + namespace OpenSim.Framework { public interface IRegionLoader @@ -38,4 +35,4 @@ namespace OpenSim.Framework void SetIniConfigSource(IniConfigSource configSource); RegionInfo[] LoadRegions(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 4b6e9a55c3..7b9eced6c3 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -29,7 +29,8 @@ using libsecondlife; namespace OpenSim.Framework { - public delegate void restart( RegionInfo thisRegion ); + public delegate void restart(RegionInfo thisRegion); + //public delegate void regionup ( RegionInfo thisRegion ); public enum RegionStatus : int @@ -38,7 +39,7 @@ namespace OpenSim.Framework Up = 1, Crashed = 2, Starting = 3 - }; + } ; public interface IScene { @@ -58,4 +59,4 @@ namespace OpenSim.Framework ClientManager ClientManager { get; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs index 0679a686f7..d06784c25d 100644 --- a/OpenSim/Framework/IUserData.cs +++ b/OpenSim/Framework/IUserData.cs @@ -25,8 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; using System.Collections.Generic; +using libsecondlife; namespace OpenSim.Framework { @@ -50,7 +50,7 @@ namespace OpenSim.Framework /// The user data profile UserProfileData GetUserByName(string fname, string lname); - List GeneratePickerResults(LLUUID queryID, string query); + List GeneratePickerResults(LLUUID queryID, string query); /// /// Returns the current agent for a user searching by it's UUID @@ -127,13 +127,15 @@ namespace OpenSim.Framework /// void Initialise(); } + public class AvatarPickerAvatar { public LLUUID AvatarID; public string firstName; public string lastName; + public AvatarPickerAvatar() { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs index 3440e3063d..2b08582d70 100644 --- a/OpenSim/Framework/IUserService.cs +++ b/OpenSim/Framework/IUserService.cs @@ -25,8 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; using System.Collections.Generic; +using libsecondlife; namespace OpenSim.Framework { @@ -48,4 +48,4 @@ namespace OpenSim.Framework /// LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 8cb3e731d8..c60fb01c98 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -291,4 +291,4 @@ namespace OpenSim.Framework [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 1a94cfd8ca..885545ded0 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -25,8 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; using System.Collections.Generic; +using libsecondlife; + namespace OpenSim.Framework { public class LandData @@ -53,7 +54,7 @@ namespace OpenSim.Framework public int simwideArea = 0; public int salePrice = 0; //Unemeplemented. Parcels price. public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; - + public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark | (uint) Parcel.ParcelFlags.AllowAllObjectEntry | (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform | @@ -133,4 +134,4 @@ namespace OpenSim.Framework return landData; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Login.cs b/OpenSim/Framework/Login.cs index 1da0a2b2b6..5228fe9ed6 100644 --- a/OpenSim/Framework/Login.cs +++ b/OpenSim/Framework/Login.cs @@ -47,4 +47,4 @@ namespace OpenSim.Framework StartPos = new LLVector3(128, 128, 70); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/NeighbourInfo.cs b/OpenSim/Framework/NeighbourInfo.cs index ca98cd1565..ddf9df6a89 100644 --- a/OpenSim/Framework/NeighbourInfo.cs +++ b/OpenSim/Framework/NeighbourInfo.cs @@ -39,4 +39,4 @@ namespace OpenSim.Framework public string sim_ip; public uint sim_port; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index 6f8ff7df85..cf1457de68 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs @@ -80,8 +80,10 @@ namespace OpenSim.Framework m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); - HttpListenerPort = (uint) config.Configs["Network"].GetInt("http_listener_port", (int) DefaultHttpListenerPort); - RemotingListenerPort = (uint) config.Configs["Network"].GetInt("remoting_listener_port", (int) RemotingListenerPort); + HttpListenerPort = + (uint) config.Configs["Network"].GetInt("http_listener_port", (int) DefaultHttpListenerPort); + RemotingListenerPort = + (uint) config.Configs["Network"].GetInt("remoting_listener_port", (int) RemotingListenerPort); GridURL = config.Configs["Network"].GetString("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); @@ -98,4 +100,4 @@ namespace OpenSim.Framework InventoryConfig.DefaultHttpPort.ToString()); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 98e583e7ae..c29b973e1e 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -26,9 +26,9 @@ * */ +using System; using System.Xml.Serialization; using libsecondlife; -using System; namespace OpenSim.Framework { @@ -91,32 +91,21 @@ namespace OpenSim.Framework public sbyte PathTwist; public sbyte PathTwistBegin; - [XmlIgnore] + [XmlIgnore] public LLObject.TextureEntry Textures { - get - { - return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); - } + get { return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } - set - { - m_textureEntry = value.ToBytes(); - } + set { m_textureEntry = value.ToBytes(); } } private byte[] m_textureEntry; + public byte[] TextureEntry { - get - { - return m_textureEntry; - } + get { return m_textureEntry; } - set - { - m_textureEntry = value; - } + set { m_textureEntry = value; } } public byte[] ExtraParams; @@ -134,11 +123,11 @@ namespace OpenSim.Framework [XmlIgnore] public HollowShape HollowShape { - get { return (HollowShape)(ProfileCurve & 0xf0); } + get { return (HollowShape) (ProfileCurve & 0xf0); } set { - byte oldValueMasked = (byte)(ProfileCurve & 0x0f); - ProfileCurve = (byte)(oldValueMasked | (byte)value); + byte oldValueMasked = (byte) (ProfileCurve & 0x0f); + ProfileCurve = (byte) (oldValueMasked | (byte) value); } } @@ -147,7 +136,6 @@ namespace OpenSim.Framework get { return Scale; } } - static PrimitiveBaseShape() { diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index a14677805d..9472a9ea71 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs @@ -44,10 +44,10 @@ namespace OpenSim.Framework public event CloseAgentConnection OnCloseAgentConnection; public event RegionUp OnRegionUp; public event ChildAgentUpdate OnChildAgentUpdate; - - public string debugRegionName=""; - + + public string debugRegionName = ""; + /// /// @@ -66,7 +66,6 @@ namespace OpenSim.Framework } - public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData) { if (OnExpectUser != null) @@ -107,7 +106,9 @@ namespace OpenSim.Framework } return false; } - public virtual bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) + + public virtual bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, + bool isPhysical) { if (OnPrimCrossingIntoRegion != null) { @@ -178,4 +179,4 @@ namespace OpenSim.Framework return false; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index c4557f8f85..8c25603dd3 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -26,16 +26,11 @@ * */ using System; -using System.Globalization; using System.Net; -using System.Xml; using System.Net.Sockets; -using Nini.Config; +using System.Xml; using libsecondlife; -using OpenSim.Framework.Console; -using OpenSim.Framework; - - +using Nini.Config; namespace OpenSim.Framework { @@ -64,6 +59,7 @@ namespace OpenSim.Framework m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); } + public SimpleRegionInfo(RegionInfo ConvertFrom) { m_regionLocX = ConvertFrom.RegionLocX; @@ -78,16 +74,11 @@ namespace OpenSim.Framework public LLUUID RegionID = LLUUID.Zero; public uint m_remotingPort; + public uint RemotingPort { - get - { - return m_remotingPort; - } - set - { - m_remotingPort = value; - } + get { return m_remotingPort; } + set { m_remotingPort = value; } } public string RemotingAddress; @@ -123,73 +114,47 @@ namespace OpenSim.Framework return new IPEndPoint(ia, m_internalEndPoint.Port); } - set - { - m_externalHostName = value.ToString(); - } + set { m_externalHostName = value.ToString(); } } protected string m_externalHostName; + public string ExternalHostName { - get - { - return m_externalHostName; - } - set - { - m_externalHostName = value; - } + get { return m_externalHostName; } + set { m_externalHostName = value; } } protected IPEndPoint m_internalEndPoint; + public IPEndPoint InternalEndPoint { - get - { - return m_internalEndPoint; - } - set - { - m_internalEndPoint = value; - } + get { return m_internalEndPoint; } + set { m_internalEndPoint = value; } } protected uint? m_regionLocX; + public uint RegionLocX { - get - { - return m_regionLocX.Value; - } - set - { - m_regionLocX = value; - } + get { return m_regionLocX.Value; } + set { m_regionLocX = value; } } protected uint? m_regionLocY; + public uint RegionLocY { - get - { - return m_regionLocY.Value; - } - set - { - m_regionLocY = value; - } + get { return m_regionLocY.Value; } + set { m_regionLocY = value; } } public ulong RegionHandle { - get - { - return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); - } + get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } } } - + public class RegionInfo : SimpleRegionInfo { public string RegionName = ""; @@ -206,15 +171,16 @@ namespace OpenSim.Framework // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. private static EstateSettings m_estateSettings; + public EstateSettings EstateSettings { get { - if( m_estateSettings == null ) + if (m_estateSettings == null) { m_estateSettings = new EstateSettings(); } - + return m_estateSettings; } } @@ -223,14 +189,18 @@ namespace OpenSim.Framework public RegionInfo(string description, string filename) { - configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); configMember.performConfigurationRetrieve(); } + public RegionInfo(string description, XmlNode xmlNode) { - configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember = + new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration); configMember.performConfigurationRetrieve(); } + public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : base(regionLocX, regionLocY, internalEndPoint, externalUri) { @@ -239,6 +209,7 @@ namespace OpenSim.Framework public RegionInfo() { } + public RegionInfo(SearializableRegionInfo ConvertFrom) { m_regionLocX = ConvertFrom.RegionLocX; @@ -249,6 +220,7 @@ namespace OpenSim.Framework RemotingAddress = ConvertFrom.RemotingAddress; RegionID = LLUUID.Zero; } + public RegionInfo(SimpleRegionInfo ConvertFrom) { m_regionLocX = ConvertFrom.RegionLocX; @@ -259,47 +231,49 @@ namespace OpenSim.Framework RemotingAddress = ConvertFrom.RemotingAddress; RegionID = LLUUID.Zero; } + //not in use, should swap to nini though. public void LoadFromNiniSource(IConfigSource source) { - this.LoadFromNiniSource(source, "RegionInfo"); + LoadFromNiniSource(source, "RegionInfo"); } //not in use, should swap to nini though. public void LoadFromNiniSource(IConfigSource source, string sectionName) { string errorMessage = ""; - this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToString())); - this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); - this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); - this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); + RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToString())); + RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); + m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); + m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); IPAddress ipAddressResult; if (IPAddress.TryParse(ipAddress, out ipAddressResult)) { - this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); + m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); } else { errorMessage = "needs an IP Address (IPAddress)"; } - this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort); + m_internalEndPoint.Port = + source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort); string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); if (externalHost != "SYSTEMIP") { - this.m_externalHostName = externalHost; + m_externalHostName = externalHost; } else { - this.m_externalHostName = Util.GetLocalHost().ToString(); + m_externalHostName = Util.GetLocalHost().ToString(); } - this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); - this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); - this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); + MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); + MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); + MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); if (errorMessage != "") { @@ -309,19 +283,45 @@ namespace OpenSim.Framework public void loadConfigurationOptions() { - configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); - configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); - configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); - configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); + configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "UUID of Region (Default is recommended, random UUID)", + LLUUID.Random().ToString(), true); + configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Region Name", "OpenSim Test", false); + configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Grid Location (X Axis)", "1000", false); + configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Grid Location (Y Axis)", "1000", false); //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); - configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); - configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); - configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); - configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Master Avatar UUID", LLUUID.Zero.ToString(), true); - configMember.addConfigurationOption("estate_covanant_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant", LLUUID.Zero.ToString(), true); - configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false,(ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); - configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); - configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); + configMember.addConfigurationOption("internal_ip_address", + ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, + "Internal IP Address for incoming UDP client connections", "0.0.0.0", + false); + configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Internal IP Port for incoming UDP client connections", + NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); + configMember.addConfigurationOption("external_host_name", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "External Host Name", "127.0.0.1", false); + configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "Master Avatar UUID", LLUUID.Zero.ToString(), true); + configMember.addConfigurationOption("estate_covanant_uuid", + ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant", + LLUUID.Zero.ToString(), true); + configMember.addConfigurationOption("master_avatar_first", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "First Name of Master Avatar", "Test", false, + (ConfigurationOption.ConfigurationOptionShouldBeAsked) + shouldMasterAvatarDetailsBeAsked); + configMember.addConfigurationOption("master_avatar_last", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Last Name of Master Avatar", "User", false, + (ConfigurationOption.ConfigurationOptionShouldBeAsked) + shouldMasterAvatarDetailsBeAsked); + configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "(Sandbox Mode Only)Password for Master Avatar account", "test", false, + (ConfigurationOption.ConfigurationOptionShouldBeAsked) + shouldMasterAvatarDetailsBeAsked); } public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) @@ -338,58 +338,57 @@ namespace OpenSim.Framework switch (configuration_key) { case "sim_UUID": - this.RegionID = (LLUUID)configuration_result; + RegionID = (LLUUID) configuration_result; break; case "sim_name": - this.RegionName = (string)configuration_result; + RegionName = (string) configuration_result; break; case "sim_location_x": - this.m_regionLocX = (uint)configuration_result; + m_regionLocX = (uint) configuration_result; break; case "sim_location_y": - this.m_regionLocY = (uint)configuration_result; + m_regionLocY = (uint) configuration_result; break; case "datastore": - this.DataStore = (string)configuration_result; + DataStore = (string) configuration_result; break; case "internal_ip_address": - IPAddress address = (IPAddress)configuration_result; - this.m_internalEndPoint = new IPEndPoint(address, 0); + IPAddress address = (IPAddress) configuration_result; + m_internalEndPoint = new IPEndPoint(address, 0); break; case "internal_ip_port": - this.m_internalEndPoint.Port = (int)configuration_result; + m_internalEndPoint.Port = (int) configuration_result; break; case "external_host_name": - if ((string)configuration_result != "SYSTEMIP") + if ((string) configuration_result != "SYSTEMIP") { - this.m_externalHostName = (string)configuration_result; + m_externalHostName = (string) configuration_result; } else { - this.m_externalHostName = Util.GetLocalHost().ToString(); + m_externalHostName = Util.GetLocalHost().ToString(); } break; case "master_avatar_uuid": - this.MasterAvatarAssignedUUID = (LLUUID)configuration_result; + MasterAvatarAssignedUUID = (LLUUID) configuration_result; break; case "estate_covanant_uuid": - this.CovenantID = (LLUUID)configuration_result; + CovenantID = (LLUUID) configuration_result; break; case "master_avatar_first": - this.MasterAvatarFirstName = (string)configuration_result; + MasterAvatarFirstName = (string) configuration_result; break; case "master_avatar_last": - this.MasterAvatarLastName = (string)configuration_result; + MasterAvatarLastName = (string) configuration_result; break; case "master_avatar_pass": - string tempMD5Passwd = (string)configuration_result; - this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); + string tempMD5Passwd = (string) configuration_result; + MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); break; } return true; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index fb50171a85..a710f505e0 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs @@ -25,12 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; -using Nini.Config; -using OpenSim.Framework; using System.IO; +using Nini.Config; namespace OpenSim.Framework.RegionLoader.Filesystem { @@ -67,4 +63,4 @@ namespace OpenSim.Framework.RegionLoader.Filesystem return regionInfos; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index ec7059ae63..1625fa663a 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -25,48 +25,46 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Net; using System.IO; +using System.Net; using System.Xml; -using System.Collections.Generic; -using System.Text; using Nini.Config; -using OpenSim.Framework; +using OpenSim.Framework.Console; namespace OpenSim.Framework.RegionLoader.Web { public class RegionLoaderWebServer : IRegionLoader { private IniConfigSource m_configSouce; + public void SetIniConfigSource(IniConfigSource configSource) { m_configSouce = configSource; } + public RegionInfo[] LoadRegions() { if (m_configSouce == null) { - Console.MainLog.Instance.Error("WEBLOADER", "Unable to load configuration source!"); + MainLog.Instance.Error("WEBLOADER", "Unable to load configuration source!"); return null; } else { - IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"]; - string url = startupConfig.GetString("regionload_webserver_url","").Trim(); + IniConfig startupConfig = (IniConfig) m_configSouce.Configs["Startup"]; + string url = startupConfig.GetString("regionload_webserver_url", "").Trim(); if (url == "") { - Console.MainLog.Instance.Error("WEBLOADER", "Unable to load webserver URL - URL was empty."); + MainLog.Instance.Error("WEBLOADER", "Unable to load webserver URL - URL was empty."); return null; } else { - - HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); + HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); webRequest.Timeout = 30000; //30 Second Timeout - Console.MainLog.Instance.Debug("WEBLOADER", "Sending Download Request..."); - HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); - Console.MainLog.Instance.Debug("WEBLOADER", "Downloading Region Information From Remote Server..."); + MainLog.Instance.Debug("WEBLOADER", "Sending Download Request..."); + HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); + MainLog.Instance.Debug("WEBLOADER", "Downloading Region Information From Remote Server..."); StreamReader reader = new StreamReader(webResponse.GetResponseStream()); string xmlSource = ""; string tempStr = reader.ReadLine(); @@ -75,7 +73,9 @@ namespace OpenSim.Framework.RegionLoader.Web xmlSource = xmlSource + tempStr; tempStr = reader.ReadLine(); } - Console.MainLog.Instance.Debug("WEBLOADER", "Done downloading region information from server. Total Bytes: " + xmlSource.Length); + MainLog.Instance.Debug("WEBLOADER", + "Done downloading region information from server. Total Bytes: " + + xmlSource.Length); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlSource); if (xmlDoc.FirstChild.Name == "Regions") @@ -84,8 +84,9 @@ namespace OpenSim.Framework.RegionLoader.Web int i; for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) { - Console.MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); - regionInfos[i] = new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]); + MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); + regionInfos[i] = + new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]); } return regionInfos; @@ -95,4 +96,4 @@ namespace OpenSim.Framework.RegionLoader.Web } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Remoting.cs b/OpenSim/Framework/Remoting.cs index 9cf0d11db1..ddc1cfb342 100644 --- a/OpenSim/Framework/Remoting.cs +++ b/OpenSim/Framework/Remoting.cs @@ -131,4 +131,4 @@ namespace OpenSim.Framework return c; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs index 5df22cd003..18a3829a64 100644 --- a/OpenSim/Framework/SerializableRegionInfo.cs +++ b/OpenSim/Framework/SerializableRegionInfo.cs @@ -26,15 +26,10 @@ * */ using System; -using System.Globalization; using System.Net; -using System.Xml; using System.Net.Sockets; using libsecondlife; - - - namespace OpenSim.Framework { [Serializable] @@ -46,7 +41,8 @@ namespace OpenSim.Framework public SearializableRegionInfo() { } - public SearializableRegionInfo(RegionInfo ConvertFrom) + + public SearializableRegionInfo(RegionInfo ConvertFrom) { m_regionLocX = ConvertFrom.RegionLocX; m_regionLocY = ConvertFrom.RegionLocY; @@ -55,9 +51,9 @@ namespace OpenSim.Framework m_remotingPort = ConvertFrom.RemotingPort; RemotingAddress = ConvertFrom.RemotingAddress; } + public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) { - m_regionLocX = regionLocX; m_regionLocY = regionLocY; @@ -78,16 +74,11 @@ namespace OpenSim.Framework public Guid RegionID = LLUUID.Zero.UUID; public uint m_remotingPort; + public uint RemotingPort { - get - { - return m_remotingPort; - } - set - { - m_remotingPort = value; - } + get { return m_remotingPort; } + set { m_remotingPort = value; } } public string RemotingAddress; @@ -120,77 +111,49 @@ namespace OpenSim.Framework ia = Adr; break; } - } return new IPEndPoint(ia, m_internalEndPoint.Port); } - set - { - m_externalHostName = value.ToString(); - } + set { m_externalHostName = value.ToString(); } } protected string m_externalHostName; + public string ExternalHostName { - get - { - return m_externalHostName; - } - set - { - m_externalHostName = value; - } + get { return m_externalHostName; } + set { m_externalHostName = value; } } protected IPEndPoint m_internalEndPoint; + public IPEndPoint InternalEndPoint { - get - { - return m_internalEndPoint; - } - set - { - m_internalEndPoint = value; - } + get { return m_internalEndPoint; } + set { m_internalEndPoint = value; } } protected uint? m_regionLocX; + public uint RegionLocX { - get - { - return m_regionLocX.Value; - } - set - { - m_regionLocX = value; - } + get { return m_regionLocX.Value; } + set { m_regionLocX = value; } } protected uint? m_regionLocY; + public uint RegionLocY { - get - { - return m_regionLocY.Value; - } - set - { - m_regionLocY = value; - } + get { return m_regionLocY.Value; } + set { m_regionLocY = value; } } public ulong RegionHandle { - get - { - return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); - } + get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } } } - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index d865ae8288..7af1716f40 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -97,7 +97,7 @@ namespace OpenSim.Framework.Servers HttpListenerRequest request = context.Request; HttpListenerResponse response = context.Response; - + response.KeepAlive = false; response.SendChunked = false; @@ -192,15 +192,12 @@ namespace OpenSim.Framework.Servers MainLog.Instance.Error("XML", responseString); string[] querystringkeys = request.QueryString.AllKeys; string[] rHeaders = request.Headers.AllKeys; - - - + foreach (string queryname in querystringkeys) { keysvals.Add(queryname, request.QueryString[queryname]); MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]); - } foreach (string headername in rHeaders) { @@ -218,7 +215,6 @@ namespace OpenSim.Framework.Servers string methodName = xmlRprcRequest.MethodName; if (methodName != null) { - XmlRpcResponse xmlRpcResponse; XmlRpcMethod method; @@ -241,8 +237,8 @@ namespace OpenSim.Framework.Servers } else { - System.Console.WriteLine("Handler not found for http request " +request.RawUrl); - responseString = "Error"; + System.Console.WriteLine("Handler not found for http request " + request.RawUrl); + responseString = "Error"; } } @@ -266,7 +262,8 @@ namespace OpenSim.Framework.Servers response.OutputStream.Close(); } } - public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response) + + public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response) { // This is a test. There's a workable alternative.. as this way sucks. // We'd like to put this into a text file parhaps that's easily editable. @@ -280,12 +277,14 @@ namespace OpenSim.Framework.Servers // to display the form, or process it. // a better way would be nifty. - if ((string)keysvals["show_login_form"] == "TRUE") + if ((string) keysvals["show_login_form"] == "TRUE") { - string responseString = ""; + string responseString = + ""; responseString = responseString + ""; responseString = responseString + ""; - responseString = responseString + ""; + responseString = responseString + + ""; responseString = responseString + ""; responseString = responseString + ""; responseString = responseString + "Second Life Login"; @@ -299,37 +298,50 @@ namespace OpenSim.Framework.Servers responseString = responseString + ""; responseString = responseString + "
"; responseString = responseString + "First Name:"; - responseString = responseString + ""; + responseString = responseString + + ""; responseString = responseString + "
"; responseString = responseString + "
"; responseString = responseString + "Last Name:"; - responseString = responseString + ""; + responseString = responseString + + ""; responseString = responseString + "
"; responseString = responseString + "
"; responseString = responseString + "Password:"; responseString = responseString + ""; responseString = responseString + ""; - responseString = responseString + ""; + responseString = responseString + + ""; responseString = responseString + ""; responseString = responseString + ""; - responseString = responseString + ""; + responseString = responseString + + ""; responseString = responseString + ""; responseString = responseString + ""; responseString = responseString + "
"; responseString = responseString + "
"; responseString = responseString + ""; - responseString = responseString + ""; + responseString = responseString + ""; responseString = responseString + "
"; responseString = responseString + ""; responseString = responseString + "
"; - responseString = responseString + "
Connecting...
"; + responseString = responseString + + "
Connecting...
"; responseString = responseString + "
"; - responseString = responseString + "Create new account | "; - responseString = responseString + "Forgot password?"; + responseString = responseString + + "Create new account | "; + responseString = responseString + + "Forgot password?"; responseString = responseString + "
"; - responseString = responseString + "
" + keysvals["channel"] + " | " + keysvals["version"] + "=" + keysvals["lang"] + "
"; + responseString = responseString + "
" + keysvals["channel"] + " | " + + keysvals["version"] + "=" + keysvals["lang"] + "
"; responseString = responseString + ""; responseString = responseString + "