aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs142
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs82
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs76
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs34
-rw-r--r--OpenSim/Framework/Communications/IUserServices.cs86
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs120
-rw-r--r--OpenSim/Framework/Communications/caches/CachedUserInfo.cs154
-rw-r--r--OpenSim/Framework/Communications/caches/InventoryFolder.cs102
-rw-r--r--OpenSim/Framework/Communications/caches/UserProfileCache.cs214
-rw-r--r--OpenSim/Framework/Console/AssemblyInfo.cs112
-rw-r--r--OpenSim/Framework/Console/ConsoleCallbacksBase.cs70
-rw-r--r--OpenSim/Framework/Console/LogBase.cs564
-rw-r--r--OpenSim/Framework/Console/MainLog.cs94
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oGridData.cs324
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oManager.cs326
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oUserData.cs404
-rw-r--r--OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs388
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs422
-rw-r--r--OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs574
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs618
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLLogData.cs210
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs1212
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs512
-rw-r--r--OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteGridData.cs394
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteManager.cs412
-rw-r--r--OpenSim/Framework/Data/GridData.cs222
-rw-r--r--OpenSim/Framework/Data/ILogData.cs180
-rw-r--r--OpenSim/Framework/Data/IniConfig.cs192
-rw-r--r--OpenSim/Framework/Data/InventoryData.cs394
-rw-r--r--OpenSim/Framework/Data/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Framework/Data/ReservationData.cs94
-rw-r--r--OpenSim/Framework/Data/SimProfileData.cs384
-rw-r--r--OpenSim/Framework/Data/UserData.cs256
-rw-r--r--OpenSim/Framework/Data/UserProfileData.cs360
-rw-r--r--OpenSim/Framework/General/AgentInventory.cs530
-rw-r--r--OpenSim/Framework/General/AuthenticateSessionBase.cs258
-rw-r--r--OpenSim/Framework/General/BlockingQueue.cs116
-rw-r--r--OpenSim/Framework/General/ClientManager.cs72
-rw-r--r--OpenSim/Framework/General/IRegionCommsListener.cs92
-rw-r--r--OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs86
-rw-r--r--OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs76
-rw-r--r--OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs118
-rw-r--r--OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs106
-rw-r--r--OpenSim/Framework/General/Interfaces/IAssetServer.cs128
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs390
-rw-r--r--OpenSim/Framework/General/Interfaces/ILocalStorage.cs142
-rw-r--r--OpenSim/Framework/General/Interfaces/IUserServer.cs78
-rw-r--r--OpenSim/Framework/General/Interfaces/IWorld.cs84
-rw-r--r--OpenSim/Framework/General/NpcClientBase.cs254
-rw-r--r--OpenSim/Framework/General/Properties/AssemblyInfo.cs62
-rw-r--r--OpenSim/Framework/General/RegionCommsListener.cs206
-rw-r--r--OpenSim/Framework/General/Remoting.cs270
-rw-r--r--OpenSim/Framework/General/Types/AgentCiruitData.cs98
-rw-r--r--OpenSim/Framework/General/Types/AgentWearable.cs114
-rw-r--r--OpenSim/Framework/General/Types/AssetBase.cs92
-rw-r--r--OpenSim/Framework/General/Types/AssetLandmark.cs118
-rw-r--r--OpenSim/Framework/General/Types/AssetStorage.cs94
-rw-r--r--OpenSim/Framework/General/Types/EstateSettings.cs186
-rw-r--r--OpenSim/Framework/General/Types/Login.cs98
-rw-r--r--OpenSim/Framework/General/Types/MapBlockData.cs46
-rw-r--r--OpenSim/Framework/General/Types/NeighbourInfo.cs84
-rw-r--r--OpenSim/Framework/General/Types/NetworkServersInfo.cs438
-rw-r--r--OpenSim/Framework/General/Types/ParcelData.cs240
-rw-r--r--OpenSim/Framework/General/Types/PrimData.cs456
-rw-r--r--OpenSim/Framework/General/Types/PrimitiveBaseShape.cs218
-rw-r--r--OpenSim/Framework/General/Types/RegionHandle.cs242
-rw-r--r--OpenSim/Framework/General/Types/RegionInfo.cs684
-rw-r--r--OpenSim/Framework/General/Types/UUID.cs254
-rw-r--r--OpenSim/Framework/General/UserProfile.cs174
-rw-r--r--OpenSim/Framework/General/Util.cs368
-rw-r--r--OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs244
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs448
-rw-r--r--OpenSim/Framework/Servers/BaseStreamHandler.cs80
-rw-r--r--OpenSim/Framework/Servers/BinaryStreamHandler.cs98
-rw-r--r--OpenSim/Framework/Servers/CheckSumServer.cs252
-rw-r--r--OpenSim/Framework/Servers/IStreamHandler.cs44
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs62
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs62
-rw-r--r--OpenSim/Framework/Servers/UDPServerBase.cs174
-rw-r--r--OpenSim/Framework/Servers/XmlRpcMethod.cs66
-rw-r--r--OpenSim/Framework/UserManager/LoginResponse.cs1286
-rw-r--r--OpenSim/Framework/UserManager/UserManagerBase.cs1262
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs812
-rw-r--r--OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs116
-rw-r--r--OpenSim/Grid/Framework.Manager/GridManagementAgent.cs276
-rw-r--r--OpenSim/Grid/Framework.Manager/GridServerManager.cs186
-rw-r--r--OpenSim/Grid/GridServer.Config/AssemblyInfo.cs112
-rw-r--r--OpenSim/Grid/GridServer.Config/DbGridConfig.cs320
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs1420
-rw-r--r--OpenSim/Grid/GridServer/Main.cs516
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs116
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs250
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs174
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs66
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs266
-rw-r--r--OpenSim/Grid/UserServer.Config/AssemblyInfo.cs112
-rw-r--r--OpenSim/Grid/UserServer.Config/DbUserConfig.cs190
-rw-r--r--OpenSim/Grid/UserServer/Main.cs428
-rw-r--r--OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs62
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs200
-rw-r--r--OpenSim/Region/Application/Application.cs250
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs992
-rw-r--r--OpenSim/Region/Application/VersionInfo.cs72
-rw-r--r--OpenSim/Region/Caches/AssetCache.cs1338
-rw-r--r--OpenSim/Region/Caches/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Region/Capabilities/Caps.cs626
-rw-r--r--OpenSim/Region/Capabilities/LLSDArray.cs84
-rw-r--r--OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs88
-rw-r--r--OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs42
-rw-r--r--OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs36
-rw-r--r--OpenSim/Region/Capabilities/LLSDCapEvent.cs82
-rw-r--r--OpenSim/Region/Capabilities/LLSDCapsDetails.cs34
-rw-r--r--OpenSim/Region/Capabilities/LLSDEmpty.cs76
-rw-r--r--OpenSim/Region/Capabilities/LLSDHelpers.cs328
-rw-r--r--OpenSim/Region/Capabilities/LLSDMapLayer.cs92
-rw-r--r--OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs82
-rw-r--r--OpenSim/Region/Capabilities/LLSDMapRequest.cs26
-rw-r--r--OpenSim/Region/Capabilities/LLSDMethod.cs16
-rw-r--r--OpenSim/Region/Capabilities/LLSDStreamHandler.cs84
-rw-r--r--OpenSim/Region/Capabilities/LLSDTest.cs82
-rw-r--r--OpenSim/Region/Capabilities/LLSDType.cs118
-rw-r--r--OpenSim/Region/ClientStack/Assets/InventoryCache.cs676
-rw-r--r--OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs80
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs2360
-rw-r--r--OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs714
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs472
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs1294
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs586
-rw-r--r--OpenSim/Region/ClientStack/ClientViewBase.cs652
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs368
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs236
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs390
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs110
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs412
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs284
-rw-r--r--OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs36
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs862
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs138
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs202
-rw-r--r--OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs66
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs598
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs124
-rw-r--r--OpenSim/Region/Environment/ParcelManager.cs2412
-rw-r--r--OpenSim/Region/Environment/RegionManager.cs58
-rw-r--r--OpenSim/Region/Environment/Scenes/Entity.cs230
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs284
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs28
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs1296
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs1236
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1838
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs390
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs164
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs618
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs148
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs170
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs1246
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs204
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs138
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs204
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs90
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs1006
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs86
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs854
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs192
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs80
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs270
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs90
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs92
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs74
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs84
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs98
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs238
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs58
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs340
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs280
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs102
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs970
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs1216
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs210
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Script.cs128
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs64
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs116
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs412
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs214
-rw-r--r--OpenSim/Region/Environment/StorageManager.cs120
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs368
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MySceneObject.cs80
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs194
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs252
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs62
-rw-r--r--OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs622
-rw-r--r--OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs266
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs602
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs1068
-rw-r--r--OpenSim/Region/Physics/Manager/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs334
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsManager.cs230
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs220
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs110
-rw-r--r--OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs914
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs850
-rw-r--r--OpenSim/Region/Scripting/Properties/AssemblyInfo.cs70
-rw-r--r--OpenSim/Region/Scripting/Script.cs64
-rw-r--r--OpenSim/Region/Scripting/ScriptAccess.cs62
-rw-r--r--OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs222
-rw-r--r--OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs532
-rw-r--r--OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs76
-rw-r--r--OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs94
-rw-r--r--OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs94
-rw-r--r--OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs120
-rw-r--r--OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs394
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs131
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs70
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs120
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs1906
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs252
237 files changed, 35934 insertions, 35933 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 550372f..db34d1b 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -1,71 +1,71 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Text; 28using System.Text;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework.Data; 31using OpenSim.Framework.Data;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Communications.Caches; 35using OpenSim.Framework.Communications.Caches;
36 36
37namespace OpenSim.Framework.Communications 37namespace OpenSim.Framework.Communications
38{ 38{
39 39
40 public class CommunicationsManager 40 public class CommunicationsManager
41 { 41 {
42 public IUserServices UserServer; 42 public IUserServices UserServer;
43 public IGridServices GridServer; 43 public IGridServices GridServer;
44 public IInventoryServices InventoryServer; 44 public IInventoryServices InventoryServer;
45 public IInterRegionCommunications InterRegion; 45 public IInterRegionCommunications InterRegion;
46 public UserProfileCache UserProfilesCache; 46 public UserProfileCache UserProfilesCache;
47 47
48 public NetworkServersInfo ServersInfo; 48 public NetworkServersInfo ServersInfo;
49 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer) 49 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer)
50 { 50 {
51 ServersInfo = serversInfo; 51 ServersInfo = serversInfo;
52 UserProfilesCache = new UserProfileCache(this); 52 UserProfilesCache = new UserProfileCache(this);
53 } 53 }
54 54
55 #region Packet Handlers 55 #region Packet Handlers
56 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) 56 public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
57 { 57 {
58 UserProfileData profileData = this.UserServer.GetUserProfile(uuid); 58 UserProfileData profileData = this.UserServer.GetUserProfile(uuid);
59 if (profileData != null) 59 if (profileData != null)
60 { 60 {
61 LLUUID profileId = profileData.UUID; 61 LLUUID profileId = profileData.UUID;
62 string firstname = profileData.username; 62 string firstname = profileData.username;
63 string lastname = profileData.surname; 63 string lastname = profileData.surname;
64 64
65 remote_client.SendNameReply(profileId, firstname, lastname); 65 remote_client.SendNameReply(profileId, firstname, lastname);
66 } 66 }
67 } 67 }
68 68
69 #endregion 69 #endregion
70 } 70 }
71} 71}
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index d2e5ab6..1cfe2b6 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -1,41 +1,41 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework.Types; 30using OpenSim.Framework.Types;
31 31
32namespace OpenSim.Framework.Communications 32namespace OpenSim.Framework.Communications
33{ 33{
34 public interface IGridServices 34 public interface IGridServices
35 { 35 {
36 RegionCommsListener RegisterRegion(RegionInfo regionInfos); 36 RegionCommsListener RegisterRegion(RegionInfo regionInfos);
37 List<RegionInfo> RequestNeighbours(RegionInfo regionInfo); 37 List<RegionInfo> RequestNeighbours(RegionInfo regionInfo);
38 RegionInfo RequestNeighbourInfo(ulong regionHandle); 38 RegionInfo RequestNeighbourInfo(ulong regionHandle);
39 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); 39 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
40 } 40 }
41} 41}
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index 55f12ac..7758f2b 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -1,38 +1,38 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Types; 29using OpenSim.Framework.Types;
30 30
31namespace OpenSim.Framework.Communications 31namespace OpenSim.Framework.Communications
32{ 32{
33 public interface IInterRegionCommunications 33 public interface IInterRegionCommunications
34 { 34 {
35 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); 35 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
36 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position); 36 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position);
37 } 37 }
38} 38}
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 0b05834..807952c 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -1,17 +1,17 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Communications.Caches; 6using OpenSim.Framework.Communications.Caches;
7 7
8namespace OpenSim.Framework.Communications 8namespace OpenSim.Framework.Communications
9{ 9{
10 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo); 10 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
11 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); 11 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
12 12
13 public interface IInventoryServices 13 public interface IInventoryServices
14 { 14 {
15 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 15 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
16 } 16 }
17} 17}
diff --git a/OpenSim/Framework/Communications/IUserServices.cs b/OpenSim/Framework/Communications/IUserServices.cs
index 0b1f86c..cd97b52 100644
--- a/OpenSim/Framework/Communications/IUserServices.cs
+++ b/OpenSim/Framework/Communications/IUserServices.cs
@@ -1,43 +1,43 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Data; 29using OpenSim.Framework.Data;
30 30
31namespace OpenSim.Framework.Communications 31namespace OpenSim.Framework.Communications
32{ 32{
33 public interface IUserServices 33 public interface IUserServices
34 { 34 {
35 UserProfileData GetUserProfile(string firstName, string lastName); 35 UserProfileData GetUserProfile(string firstName, string lastName);
36 UserProfileData GetUserProfile(string name); 36 UserProfileData GetUserProfile(string name);
37 UserProfileData GetUserProfile(LLUUID avatarID); 37 UserProfileData GetUserProfile(LLUUID avatarID);
38 38
39 UserProfileData SetupMasterUser(string firstName, string lastName); 39 UserProfileData SetupMasterUser(string firstName, string lastName);
40 UserProfileData SetupMasterUser(string firstName, string lastName, string password); 40 UserProfileData SetupMasterUser(string firstName, string lastName, string password);
41 41
42 } 42 }
43} 43}
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
index 09f6473..79f3e30 100644
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
@@ -1,60 +1,60 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OpenGrid.Framework.Communications")] 33[assembly: AssemblyTitle("OpenGrid.Framework.Communications")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OpenGrid.Framework.Communications")] 37[assembly: AssemblyProduct("OpenGrid.Framework.Communications")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] 48[assembly: Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57// You can specify all the values or you can default the Revision and Build Numbers 57// You can specify all the values or you can default the Revision and Build Numbers
58// by using the '*' as shown below: 58// by using the '*' as shown below:
59[assembly: AssemblyVersion("1.0.0.0")] 59[assembly: AssemblyVersion("1.0.0.0")]
60[assembly: AssemblyFileVersion("1.0.0.0")] 60[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
index 1c779e9..b8d8847 100644
--- a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
@@ -1,77 +1,77 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
5using libsecondlife; 5using libsecondlife;
6 6
7namespace OpenSim.Framework.Communications.Caches 7namespace OpenSim.Framework.Communications.Caches
8{ 8{
9 public class CachedUserInfo 9 public class CachedUserInfo
10 { 10 {
11 public UserProfileData UserProfile; 11 public UserProfileData UserProfile;
12 //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>(); 12 //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>();
13 public InventoryFolder RootFolder; 13 public InventoryFolder RootFolder;
14 14
15 public CachedUserInfo() 15 public CachedUserInfo()
16 { 16 {
17 17
18 } 18 }
19 19
20 /// <summary> 20 /// <summary>
21 /// 21 ///
22 /// </summary> 22 /// </summary>
23 /// <param name="userID"></param> 23 /// <param name="userID"></param>
24 /// <param name="folderInfo"></param> 24 /// <param name="folderInfo"></param>
25 public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) 25 public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
26 { 26 {
27 if (userID == UserProfile.UUID) 27 if (userID == UserProfile.UUID)
28 { 28 {
29 if (this.RootFolder == null) 29 if (this.RootFolder == null)
30 { 30 {
31 if (folderInfo.parentID == LLUUID.Zero) 31 if (folderInfo.parentID == LLUUID.Zero)
32 { 32 {
33 this.RootFolder = folderInfo; 33 this.RootFolder = folderInfo;
34 } 34 }
35 } 35 }
36 else 36 else
37 { 37 {
38 if (this.RootFolder.folderID == folderInfo.parentID) 38 if (this.RootFolder.folderID == folderInfo.parentID)
39 { 39 {
40 this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); 40 this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
41 } 41 }
42 else 42 else
43 { 43 {
44 InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID); 44 InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID);
45 if (pFolder != null) 45 if (pFolder != null)
46 { 46 {
47 pFolder.SubFolders.Add(folderInfo.folderID, folderInfo); 47 pFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
48 } 48 }
49 } 49 }
50 } 50 }
51 } 51 }
52 } 52 }
53 53
54 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 54 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
55 { 55 {
56 if (userID == UserProfile.UUID) 56 if (userID == UserProfile.UUID)
57 { 57 {
58 if (this.RootFolder != null) 58 if (this.RootFolder != null)
59 { 59 {
60 if (itemInfo.parentFolderID == this.RootFolder.folderID) 60 if (itemInfo.parentFolderID == this.RootFolder.folderID)
61 { 61 {
62 this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); 62 this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
63 } 63 }
64 else 64 else
65 { 65 {
66 InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); 66 InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID);
67 if (pFolder != null) 67 if (pFolder != null)
68 { 68 {
69 pFolder.Items.Add(itemInfo.inventoryID, itemInfo); 69 pFolder.Items.Add(itemInfo.inventoryID, itemInfo);
70 } 70 }
71 } 71 }
72 } 72 }
73 73
74 } 74 }
75 } 75 }
76 } 76 }
77} 77}
diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs
index eaddf19..af38b12 100644
--- a/OpenSim/Framework/Communications/caches/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/caches/InventoryFolder.cs
@@ -1,51 +1,51 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6 6
7namespace OpenSim.Framework.Communications.Caches 7namespace OpenSim.Framework.Communications.Caches
8{ 8{
9 public class InventoryFolder : InventoryFolderBase 9 public class InventoryFolder : InventoryFolderBase
10 { 10 {
11 public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); 11 public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>();
12 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); 12 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
13 13
14 public InventoryFolder() 14 public InventoryFolder()
15 { 15 {
16 } 16 }
17 17
18 public InventoryFolder HasSubFolder(LLUUID folderID) 18 public InventoryFolder HasSubFolder(LLUUID folderID)
19 { 19 {
20 InventoryFolder returnFolder = null; 20 InventoryFolder returnFolder = null;
21 if (this.SubFolders.ContainsKey(folderID)) 21 if (this.SubFolders.ContainsKey(folderID))
22 { 22 {
23 returnFolder = this.SubFolders[folderID]; 23 returnFolder = this.SubFolders[folderID];
24 } 24 }
25 else 25 else
26 { 26 {
27 foreach (InventoryFolder folder in this.SubFolders.Values) 27 foreach (InventoryFolder folder in this.SubFolders.Values)
28 { 28 {
29 returnFolder = folder.HasSubFolder(folderID); 29 returnFolder = folder.HasSubFolder(folderID);
30 if (returnFolder != null) 30 if (returnFolder != null)
31 { 31 {
32 break; 32 break;
33 } 33 }
34 } 34 }
35 } 35 }
36 return returnFolder; 36 return returnFolder;
37 } 37 }
38 38
39 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) 39 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
40 { 40 {
41 InventoryFolder subFold = new InventoryFolder(); 41 InventoryFolder subFold = new InventoryFolder();
42 subFold.name = folderName; 42 subFold.name = folderName;
43 subFold.folderID = folderID; 43 subFold.folderID = folderID;
44 subFold.type = type; 44 subFold.type = type;
45 subFold.parentID = this.folderID; 45 subFold.parentID = this.folderID;
46 subFold.agentID = this.agentID; 46 subFold.agentID = this.agentID;
47 this.SubFolders.Add(subFold.folderID, subFold); 47 this.SubFolders.Add(subFold.folderID, subFold);
48 return subFold; 48 return subFold;
49 } 49 }
50 } 50 }
51} 51}
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
index 0ee63ba..f651b8a 100644
--- a/OpenSim/Framework/Communications/caches/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
@@ -1,107 +1,107 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6using OpenSim.Framework.Communications; 6using OpenSim.Framework.Communications;
7 7
8namespace OpenSim.Framework.Communications.Caches 8namespace OpenSim.Framework.Communications.Caches
9{ 9{
10 public class UserProfileCache 10 public class UserProfileCache
11 { 11 {
12 public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>(); 12 public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>();
13 13
14 private CommunicationsManager m_parent; 14 private CommunicationsManager m_parent;
15 15
16 public UserProfileCache(CommunicationsManager parent) 16 public UserProfileCache(CommunicationsManager parent)
17 { 17 {
18 m_parent = parent; 18 m_parent = parent;
19 } 19 }
20 20
21 /// <summary> 21 /// <summary>
22 /// A new user has moved into a region in this instance 22 /// A new user has moved into a region in this instance
23 /// so get info from servers 23 /// so get info from servers
24 /// </summary> 24 /// </summary>
25 /// <param name="userID"></param> 25 /// <param name="userID"></param>
26 public void AddNewUser(LLUUID userID) 26 public void AddNewUser(LLUUID userID)
27 { 27 {
28 if (!this.UserProfiles.ContainsKey(userID)) 28 if (!this.UserProfiles.ContainsKey(userID))
29 { 29 {
30 CachedUserInfo userInfo = new CachedUserInfo(); 30 CachedUserInfo userInfo = new CachedUserInfo();
31 userInfo.UserProfile = this.RequestUserProfileForUser(userID); 31 userInfo.UserProfile = this.RequestUserProfileForUser(userID);
32 this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 32 this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
33 if (userInfo.UserProfile != null) 33 if (userInfo.UserProfile != null)
34 { 34 {
35 this.UserProfiles.Add(userID, userInfo); 35 this.UserProfiles.Add(userID, userInfo);
36 } 36 }
37 else 37 else
38 { 38 {
39 //no profile for this user, what do we do now? 39 //no profile for this user, what do we do now?
40 } 40 }
41 } 41 }
42 else 42 else
43 { 43 {
44 //already have a cached profile for this user 44 //already have a cached profile for this user
45 //we should make sure its upto date with the user server version 45 //we should make sure its upto date with the user server version
46 } 46 }
47 } 47 }
48 48
49 /// <summary> 49 /// <summary>
50 /// A new user has moved into a region in this instance 50 /// A new user has moved into a region in this instance
51 /// so get info from servers 51 /// so get info from servers
52 /// </summary> 52 /// </summary>
53 /// <param name="firstName"></param> 53 /// <param name="firstName"></param>
54 /// <param name="lastName"></param> 54 /// <param name="lastName"></param>
55 public void AddNewUser(string firstName, string lastName) 55 public void AddNewUser(string firstName, string lastName)
56 { 56 {
57 57
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
61 /// A user has left this instance 61 /// A user has left this instance
62 /// so make sure servers have been updated 62 /// so make sure servers have been updated
63 /// Then remove cached info 63 /// Then remove cached info
64 /// </summary> 64 /// </summary>
65 /// <param name="userID"></param> 65 /// <param name="userID"></param>
66 public void UserLogOut(LLUUID userID) 66 public void UserLogOut(LLUUID userID)
67 { 67 {
68 68
69 } 69 }
70 70
71 /// <summary> 71 /// <summary>
72 /// Request the user profile from User server 72 /// Request the user profile from User server
73 /// </summary> 73 /// </summary>
74 /// <param name="userID"></param> 74 /// <param name="userID"></param>
75 private UserProfileData RequestUserProfileForUser(LLUUID userID) 75 private UserProfileData RequestUserProfileForUser(LLUUID userID)
76 { 76 {
77 return this.m_parent.UserServer.GetUserProfile(userID); 77 return this.m_parent.UserServer.GetUserProfile(userID);
78 } 78 }
79 79
80 /// <summary> 80 /// <summary>
81 /// Request Iventory Info from Inventory server 81 /// Request Iventory Info from Inventory server
82 /// </summary> 82 /// </summary>
83 /// <param name="userID"></param> 83 /// <param name="userID"></param>
84 private void RequestInventoryForUser(LLUUID userID) 84 private void RequestInventoryForUser(LLUUID userID)
85 { 85 {
86 86
87 } 87 }
88 88
89 /// <summary> 89 /// <summary>
90 /// Make sure UserProfile is updated on user server 90 /// Make sure UserProfile is updated on user server
91 /// </summary> 91 /// </summary>
92 /// <param name="userID"></param> 92 /// <param name="userID"></param>
93 private void UpdateUserProfileToServer(LLUUID userID) 93 private void UpdateUserProfileToServer(LLUUID userID)
94 { 94 {
95 95
96 } 96 }
97 97
98 /// <summary> 98 /// <summary>
99 /// Update Inventory data to Inventory server 99 /// Update Inventory data to Inventory server
100 /// </summary> 100 /// </summary>
101 /// <param name="userID"></param> 101 /// <param name="userID"></param>
102 private void UpdateInventoryToServer(LLUUID userID) 102 private void UpdateInventoryToServer(LLUUID userID)
103 { 103 {
104 104
105 } 105 }
106 } 106 }
107} 107}
diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs
index 30f6167..61bd423 100644
--- a/OpenSim/Framework/Console/AssemblyInfo.cs
+++ b/OpenSim/Framework/Console/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("ServerConsole")] 36[assembly: AssemblyTitle("ServerConsole")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("ServerConsole")] 40[assembly: AssemblyProduct("ServerConsole")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs
index 346cfe6..1dea251 100644
--- a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs
+++ b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs
@@ -1,35 +1,35 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Console 28namespace OpenSim.Framework.Console
29{ 29{
30 public interface conscmd_callback 30 public interface conscmd_callback
31 { 31 {
32 void RunCmd(string cmd, string[] cmdparams); 32 void RunCmd(string cmd, string[] cmdparams);
33 void Show(string ShowWhat); 33 void Show(string ShowWhat);
34 } 34 }
35} 35}
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs
index f73e15e..1eb6ff0 100644
--- a/OpenSim/Framework/Console/LogBase.cs
+++ b/OpenSim/Framework/Console/LogBase.cs
@@ -1,282 +1,282 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31 31
32namespace OpenSim.Framework.Console 32namespace OpenSim.Framework.Console
33{ 33{
34 public enum LogPriority : int 34 public enum LogPriority : int
35 { 35 {
36 CRITICAL, 36 CRITICAL,
37 HIGH, 37 HIGH,
38 MEDIUM, 38 MEDIUM,
39 NORMAL, 39 NORMAL,
40 LOW, 40 LOW,
41 VERBOSE, 41 VERBOSE,
42 EXTRAVERBOSE 42 EXTRAVERBOSE
43 } 43 }
44 44
45 public class LogBase 45 public class LogBase
46 { 46 {
47 StreamWriter Log; 47 StreamWriter Log;
48 public conscmd_callback cmdparser; 48 public conscmd_callback cmdparser;
49 public string componentname; 49 public string componentname;
50 private bool m_silent; 50 private bool m_silent;
51 51
52 public LogBase(string LogFile, string componentname, conscmd_callback cmdparser, bool silent) 52 public LogBase(string LogFile, string componentname, conscmd_callback cmdparser, bool silent)
53 { 53 {
54 this.componentname = componentname; 54 this.componentname = componentname;
55 this.cmdparser = cmdparser; 55 this.cmdparser = cmdparser;
56 this.m_silent = silent; 56 this.m_silent = silent;
57 System.Console.WriteLine("ServerConsole.cs - creating new local console"); 57 System.Console.WriteLine("ServerConsole.cs - creating new local console");
58 58
59 if (String.IsNullOrEmpty(LogFile)) 59 if (String.IsNullOrEmpty(LogFile))
60 { 60 {
61 LogFile = componentname + ".log"; 61 LogFile = componentname + ".log";
62 } 62 }
63 63
64 System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); 64 System.Console.WriteLine("Logs will be saved to current directory in " + LogFile);
65 Log = File.AppendText(LogFile); 65 Log = File.AppendText(LogFile);
66 Log.WriteLine("========================================================================"); 66 Log.WriteLine("========================================================================");
67 Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString()); 67 Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString());
68 } 68 }
69 69
70 public void Close() 70 public void Close()
71 { 71 {
72 Log.WriteLine("Shutdown at " + DateTime.Now.ToString()); 72 Log.WriteLine("Shutdown at " + DateTime.Now.ToString());
73 Log.Close(); 73 Log.Close();
74 } 74 }
75 75
76 public void Write(string format, params object[] args) 76 public void Write(string format, params object[] args)
77 { 77 {
78 Notice(format, args); 78 Notice(format, args);
79 return; 79 return;
80 } 80 }
81 81
82 public void WriteLine(LogPriority importance, string format, params object[] args) 82 public void WriteLine(LogPriority importance, string format, params object[] args)
83 { 83 {
84 Log.WriteLine(format, args); 84 Log.WriteLine(format, args);
85 Log.Flush(); 85 Log.Flush();
86 if (!m_silent) 86 if (!m_silent)
87 { 87 {
88 System.Console.WriteLine(format, args); 88 System.Console.WriteLine(format, args);
89 } 89 }
90 return; 90 return;
91 } 91 }
92 92
93 public void Warn(string format, params object[] args) 93 public void Warn(string format, params object[] args)
94 { 94 {
95 WriteNewLine(ConsoleColor.Yellow, format, args); 95 WriteNewLine(ConsoleColor.Yellow, format, args);
96 return; 96 return;
97 } 97 }
98 98
99 public void Notice(string format, params object[] args) 99 public void Notice(string format, params object[] args)
100 { 100 {
101 WriteNewLine(ConsoleColor.White, format, args); 101 WriteNewLine(ConsoleColor.White, format, args);
102 return; 102 return;
103 } 103 }
104 104
105 public void Error(string format, params object[] args) 105 public void Error(string format, params object[] args)
106 { 106 {
107 WriteNewLine(ConsoleColor.Red, format, args); 107 WriteNewLine(ConsoleColor.Red, format, args);
108 return; 108 return;
109 } 109 }
110 110
111 public void Verbose(string format, params object[] args) 111 public void Verbose(string format, params object[] args)
112 { 112 {
113 WriteNewLine(ConsoleColor.Gray, format, args); 113 WriteNewLine(ConsoleColor.Gray, format, args);
114 return; 114 return;
115 } 115 }
116 116
117 public void Status(string format, params object[] args) 117 public void Status(string format, params object[] args)
118 { 118 {
119 WriteNewLine(ConsoleColor.Blue, format, args); 119 WriteNewLine(ConsoleColor.Blue, format, args);
120 return; 120 return;
121 } 121 }
122 122
123 private void WriteNewLine(ConsoleColor color, string format, params object[] args) 123 private void WriteNewLine(ConsoleColor color, string format, params object[] args)
124 { 124 {
125 Log.WriteLine(format, args); 125 Log.WriteLine(format, args);
126 Log.Flush(); 126 Log.Flush();
127 if (!m_silent) 127 if (!m_silent)
128 { 128 {
129 try 129 try
130 { 130 {
131 System.Console.ForegroundColor = color; 131 System.Console.ForegroundColor = color;
132 System.Console.WriteLine(format, args); 132 System.Console.WriteLine(format, args);
133 System.Console.ResetColor(); 133 System.Console.ResetColor();
134 } 134 }
135 catch (ArgumentNullException) 135 catch (ArgumentNullException)
136 { 136 {
137 // Some older systems dont support coloured text. 137 // Some older systems dont support coloured text.
138 System.Console.WriteLine(format, args); 138 System.Console.WriteLine(format, args);
139 } 139 }
140 } 140 }
141 return; 141 return;
142 } 142 }
143 143
144 public string ReadLine() 144 public string ReadLine()
145 { 145 {
146 string TempStr = System.Console.ReadLine(); 146 string TempStr = System.Console.ReadLine();
147 Log.WriteLine(TempStr); 147 Log.WriteLine(TempStr);
148 return TempStr; 148 return TempStr;
149 } 149 }
150 150
151 public int Read() 151 public int Read()
152 { 152 {
153 int TempInt = System.Console.Read(); 153 int TempInt = System.Console.Read();
154 Log.Write((char)TempInt); 154 Log.Write((char)TempInt);
155 return TempInt; 155 return TempInt;
156 } 156 }
157 157
158 public IPAddress CmdPromptIPAddress(string prompt, string defaultvalue) 158 public IPAddress CmdPromptIPAddress(string prompt, string defaultvalue)
159 { 159 {
160 IPAddress address; 160 IPAddress address;
161 string addressStr; 161 string addressStr;
162 162
163 while (true) 163 while (true)
164 { 164 {
165 addressStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue); 165 addressStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue);
166 if (IPAddress.TryParse(addressStr, out address)) 166 if (IPAddress.TryParse(addressStr, out address))
167 { 167 {
168 break; 168 break;
169 } 169 }
170 else 170 else
171 { 171 {
172 MainLog.Instance.Error("Illegal address. Please re-enter."); 172 MainLog.Instance.Error("Illegal address. Please re-enter.");
173 } 173 }
174 } 174 }
175 175
176 return address; 176 return address;
177 } 177 }
178 178
179 public int CmdPromptIPPort(string prompt, string defaultvalue) 179 public int CmdPromptIPPort(string prompt, string defaultvalue)
180 { 180 {
181 int port; 181 int port;
182 string portStr; 182 string portStr;
183 183
184 while (true) 184 while (true)
185 { 185 {
186 portStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue); 186 portStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue);
187 if (int.TryParse(portStr, out port)) 187 if (int.TryParse(portStr, out port))
188 { 188 {
189 if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort) 189 if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort)
190 { 190 {
191 break; 191 break;
192 } 192 }
193 } 193 }
194 194
195 MainLog.Instance.Error("Illegal address. Please re-enter."); 195 MainLog.Instance.Error("Illegal address. Please re-enter.");
196 } 196 }
197 197
198 return port; 198 return port;
199 } 199 }
200 200
201 // Displays a prompt and waits for the user to enter a string, then returns that string 201 // Displays a prompt and waits for the user to enter a string, then returns that string
202 // Done with no echo and suitable for passwords 202 // Done with no echo and suitable for passwords
203 public string PasswdPrompt(string prompt) 203 public string PasswdPrompt(string prompt)
204 { 204 {
205 // FIXME: Needs to be better abstracted 205 // FIXME: Needs to be better abstracted
206 Log.WriteLine(prompt); 206 Log.WriteLine(prompt);
207 this.Write(prompt); 207 this.Write(prompt);
208 ConsoleColor oldfg = System.Console.ForegroundColor; 208 ConsoleColor oldfg = System.Console.ForegroundColor;
209 System.Console.ForegroundColor = System.Console.BackgroundColor; 209 System.Console.ForegroundColor = System.Console.BackgroundColor;
210 string temp = System.Console.ReadLine(); 210 string temp = System.Console.ReadLine();
211 System.Console.ForegroundColor = oldfg; 211 System.Console.ForegroundColor = oldfg;
212 return temp; 212 return temp;
213 } 213 }
214 214
215 // Displays a command prompt and waits for the user to enter a string, then returns that string 215 // Displays a command prompt and waits for the user to enter a string, then returns that string
216 public string CmdPrompt(string prompt) 216 public string CmdPrompt(string prompt)
217 { 217 {
218 this.Write(String.Format("{0}: ", prompt)); 218 this.Write(String.Format("{0}: ", prompt));
219 return this.ReadLine(); 219 return this.ReadLine();
220 } 220 }
221 221
222 // Displays a command prompt and returns a default value if the user simply presses enter 222 // Displays a command prompt and returns a default value if the user simply presses enter
223 public string CmdPrompt(string prompt, string defaultresponse) 223 public string CmdPrompt(string prompt, string defaultresponse)
224 { 224 {
225 string temp = CmdPrompt(String.Format("{0} [{1}]", prompt, defaultresponse)); 225 string temp = CmdPrompt(String.Format("{0} [{1}]", prompt, defaultresponse));
226 if (temp == "") 226 if (temp == "")
227 { 227 {
228 return defaultresponse; 228 return defaultresponse;
229 } 229 }
230 else 230 else
231 { 231 {
232 return temp; 232 return temp;
233 } 233 }
234 } 234 }
235 235
236 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options 236 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
237 public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) 237 public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB)
238 { 238 {
239 bool itisdone = false; 239 bool itisdone = false;
240 string temp = CmdPrompt(prompt, defaultresponse); 240 string temp = CmdPrompt(prompt, defaultresponse);
241 while (itisdone == false) 241 while (itisdone == false)
242 { 242 {
243 if ((temp == OptionA) || (temp == OptionB)) 243 if ((temp == OptionA) || (temp == OptionB))
244 { 244 {
245 itisdone = true; 245 itisdone = true;
246 } 246 }
247 else 247 else
248 { 248 {
249 Notice("Valid options are " + OptionA + " or " + OptionB); 249 Notice("Valid options are " + OptionA + " or " + OptionB);
250 temp = CmdPrompt(prompt, defaultresponse); 250 temp = CmdPrompt(prompt, defaultresponse);
251 } 251 }
252 } 252 }
253 return temp; 253 return temp;
254 } 254 }
255 255
256 // Runs a command with a number of parameters 256 // Runs a command with a number of parameters
257 public Object RunCmd(string Cmd, string[] cmdparams) 257 public Object RunCmd(string Cmd, string[] cmdparams)
258 { 258 {
259 cmdparser.RunCmd(Cmd, cmdparams); 259 cmdparser.RunCmd(Cmd, cmdparams);
260 return null; 260 return null;
261 } 261 }
262 262
263 // Shows data about something 263 // Shows data about something
264 public void ShowCommands(string ShowWhat) 264 public void ShowCommands(string ShowWhat)
265 { 265 {
266 cmdparser.Show(ShowWhat); 266 cmdparser.Show(ShowWhat);
267 } 267 }
268 268
269 public void MainLogPrompt() 269 public void MainLogPrompt()
270 { 270 {
271 string[] tempstrarray; 271 string[] tempstrarray;
272 string tempstr = this.CmdPrompt(this.componentname + "# "); 272 string tempstr = this.CmdPrompt(this.componentname + "# ");
273 tempstrarray = tempstr.Split(' '); 273 tempstrarray = tempstr.Split(' ');
274 string cmd = tempstrarray[0]; 274 string cmd = tempstrarray[0];
275 Array.Reverse(tempstrarray); 275 Array.Reverse(tempstrarray);
276 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); 276 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
277 Array.Reverse(tempstrarray); 277 Array.Reverse(tempstrarray);
278 string[] cmdparams = (string[])tempstrarray; 278 string[] cmdparams = (string[])tempstrarray;
279 RunCmd(cmd, cmdparams); 279 RunCmd(cmd, cmdparams);
280 } 280 }
281 } 281 }
282} 282}
diff --git a/OpenSim/Framework/Console/MainLog.cs b/OpenSim/Framework/Console/MainLog.cs
index 7d52622..e6bf9d9 100644
--- a/OpenSim/Framework/Console/MainLog.cs
+++ b/OpenSim/Framework/Console/MainLog.cs
@@ -1,47 +1,47 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Console 28namespace OpenSim.Framework.Console
29{ 29{
30 public class MainLog { 30 public class MainLog {
31 31
32 private static LogBase instance; 32 private static LogBase instance;
33 33
34 public static LogBase Instance 34 public static LogBase Instance
35 { 35 {
36 get 36 get
37 { 37 {
38 return instance; 38 return instance;
39 } 39 }
40 set 40 set
41 { 41 {
42 instance = value; 42 instance = value;
43 } 43 }
44 } 44 }
45 } 45 }
46 46
47} 47}
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
index 5fec367..e57a3aa 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
@@ -1,162 +1,162 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using libsecondlife; 30using libsecondlife;
31 31
32namespace OpenSim.Framework.Data.DB4o 32namespace OpenSim.Framework.Data.DB4o
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// A grid server storage mechanism employing the DB4o database system 35 /// A grid server storage mechanism employing the DB4o database system
36 /// </summary> 36 /// </summary>
37 class DB4oGridData : IGridData 37 class DB4oGridData : IGridData
38 { 38 {
39 /// <summary> 39 /// <summary>
40 /// The database manager object 40 /// The database manager object
41 /// </summary> 41 /// </summary>
42 DB4oGridManager manager; 42 DB4oGridManager manager;
43 43
44 /// <summary> 44 /// <summary>
45 /// Called when the plugin is first loaded (as constructors are not called) 45 /// Called when the plugin is first loaded (as constructors are not called)
46 /// </summary> 46 /// </summary>
47 public void Initialise() { 47 public void Initialise() {
48 manager = new DB4oGridManager("gridserver.yap"); 48 manager = new DB4oGridManager("gridserver.yap");
49 } 49 }
50 50
51 /// <summary> 51 /// <summary>
52 /// Returns a list of regions within the specified ranges 52 /// Returns a list of regions within the specified ranges
53 /// </summary> 53 /// </summary>
54 /// <param name="a">minimum X coordinate</param> 54 /// <param name="a">minimum X coordinate</param>
55 /// <param name="b">minimum Y coordinate</param> 55 /// <param name="b">minimum Y coordinate</param>
56 /// <param name="c">maximum X coordinate</param> 56 /// <param name="c">maximum X coordinate</param>
57 /// <param name="d">maximum Y coordinate</param> 57 /// <param name="d">maximum Y coordinate</param>
58 /// <returns>An array of region profiles</returns> 58 /// <returns>An array of region profiles</returns>
59 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) 59 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
60 { 60 {
61 return null; 61 return null;
62 } 62 }
63 63
64 /// <summary> 64 /// <summary>
65 /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) 65 /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned)
66 /// </summary> 66 /// </summary>
67 /// <param name="handle">The handle to search for</param> 67 /// <param name="handle">The handle to search for</param>
68 /// <returns>A region profile</returns> 68 /// <returns>A region profile</returns>
69 public SimProfileData GetProfileByHandle(ulong handle) { 69 public SimProfileData GetProfileByHandle(ulong handle) {
70 lock (manager.simProfiles) 70 lock (manager.simProfiles)
71 { 71 {
72 foreach (LLUUID UUID in manager.simProfiles.Keys) 72 foreach (LLUUID UUID in manager.simProfiles.Keys)
73 { 73 {
74 if (manager.simProfiles[UUID].regionHandle == handle) 74 if (manager.simProfiles[UUID].regionHandle == handle)
75 { 75 {
76 return manager.simProfiles[UUID]; 76 return manager.simProfiles[UUID];
77 } 77 }
78 } 78 }
79 } 79 }
80 throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); 80 throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")");
81 } 81 }
82 82
83 /// <summary> 83 /// <summary>
84 /// Returns a specific region 84 /// Returns a specific region
85 /// </summary> 85 /// </summary>
86 /// <param name="uuid">The region ID code</param> 86 /// <param name="uuid">The region ID code</param>
87 /// <returns>A region profile</returns> 87 /// <returns>A region profile</returns>
88 public SimProfileData GetProfileByLLUUID(LLUUID uuid) 88 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
89 { 89 {
90 lock (manager.simProfiles) 90 lock (manager.simProfiles)
91 { 91 {
92 if (manager.simProfiles.ContainsKey(uuid)) 92 if (manager.simProfiles.ContainsKey(uuid))
93 return manager.simProfiles[uuid]; 93 return manager.simProfiles[uuid];
94 } 94 }
95 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); 95 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count);
96 } 96 }
97 97
98 /// <summary> 98 /// <summary>
99 /// Adds a new specified region to the database 99 /// Adds a new specified region to the database
100 /// </summary> 100 /// </summary>
101 /// <param name="profile">The profile to add</param> 101 /// <param name="profile">The profile to add</param>
102 /// <returns>A dataresponse enum indicating success</returns> 102 /// <returns>A dataresponse enum indicating success</returns>
103 public DataResponse AddProfile(SimProfileData profile) 103 public DataResponse AddProfile(SimProfileData profile)
104 { 104 {
105 lock (manager.simProfiles) 105 lock (manager.simProfiles)
106 { 106 {
107 if (manager.AddRow(profile)) 107 if (manager.AddRow(profile))
108 { 108 {
109 return DataResponse.RESPONSE_OK; 109 return DataResponse.RESPONSE_OK;
110 } 110 }
111 else 111 else
112 { 112 {
113 return DataResponse.RESPONSE_ERROR; 113 return DataResponse.RESPONSE_ERROR;
114 } 114 }
115 } 115 }
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
119 /// Authenticates a new region using the shared secrets. NOT SECURE. 119 /// Authenticates a new region using the shared secrets. NOT SECURE.
120 /// </summary> 120 /// </summary>
121 /// <param name="uuid">The UUID the region is authenticating with</param> 121 /// <param name="uuid">The UUID the region is authenticating with</param>
122 /// <param name="handle">The location the region is logging into (unused in Db4o)</param> 122 /// <param name="handle">The location the region is logging into (unused in Db4o)</param>
123 /// <param name="key">The shared secret</param> 123 /// <param name="key">The shared secret</param>
124 /// <returns>Authenticated?</returns> 124 /// <returns>Authenticated?</returns>
125 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { 125 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
126 if (manager.simProfiles[uuid].regionRecvKey == key) 126 if (manager.simProfiles[uuid].regionRecvKey == key)
127 return true; 127 return true;
128 return false; 128 return false;
129 } 129 }
130 130
131 /// <summary> 131 /// <summary>
132 /// Shuts down the database 132 /// Shuts down the database
133 /// </summary> 133 /// </summary>
134 public void Close() 134 public void Close()
135 { 135 {
136 manager = null; 136 manager = null;
137 } 137 }
138 138
139 /// <summary> 139 /// <summary>
140 /// Returns the providers name 140 /// Returns the providers name
141 /// </summary> 141 /// </summary>
142 /// <returns>The name of the storage system</returns> 142 /// <returns>The name of the storage system</returns>
143 public string getName() 143 public string getName()
144 { 144 {
145 return "DB4o Grid Provider"; 145 return "DB4o Grid Provider";
146 } 146 }
147 147
148 /// <summary> 148 /// <summary>
149 /// Returns the providers version 149 /// Returns the providers version
150 /// </summary> 150 /// </summary>
151 /// <returns>The version of the storage system</returns> 151 /// <returns>The version of the storage system</returns>
152 public string getVersion() 152 public string getVersion()
153 { 153 {
154 return "0.1"; 154 return "0.1";
155 } 155 }
156 156
157 public ReservationData GetReservationAtPoint(uint x, uint y) 157 public ReservationData GetReservationAtPoint(uint x, uint y)
158 { 158 {
159 return null; 159 return null;
160 } 160 }
161 } 161 }
162} 162}
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs
index 0df6350..43f9095 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs
@@ -1,163 +1,163 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Db4objects.Db4o; 30using Db4objects.Db4o;
31using libsecondlife; 31using libsecondlife;
32 32
33namespace OpenSim.Framework.Data.DB4o 33namespace OpenSim.Framework.Data.DB4o
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// A Database manager for Db4o 36 /// A Database manager for Db4o
37 /// </summary> 37 /// </summary>
38 class DB4oGridManager 38 class DB4oGridManager
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// A list of the current regions connected (in-memory cache) 41 /// A list of the current regions connected (in-memory cache)
42 /// </summary> 42 /// </summary>
43 public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>(); 43 public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>();
44 /// <summary> 44 /// <summary>
45 /// Database File Name 45 /// Database File Name
46 /// </summary> 46 /// </summary>
47 string dbfl; 47 string dbfl;
48 48
49 /// <summary> 49 /// <summary>
50 /// Creates a new grid storage manager 50 /// Creates a new grid storage manager
51 /// </summary> 51 /// </summary>
52 /// <param name="db4odb">Filename to the database file</param> 52 /// <param name="db4odb">Filename to the database file</param>
53 public DB4oGridManager(string db4odb) 53 public DB4oGridManager(string db4odb)
54 { 54 {
55 dbfl = db4odb; 55 dbfl = db4odb;
56 IObjectContainer database; 56 IObjectContainer database;
57 database = Db4oFactory.OpenFile(dbfl); 57 database = Db4oFactory.OpenFile(dbfl);
58 IObjectSet result = database.Get(typeof(SimProfileData)); 58 IObjectSet result = database.Get(typeof(SimProfileData));
59 // Loads the file into the in-memory cache 59 // Loads the file into the in-memory cache
60 foreach(SimProfileData row in result) { 60 foreach(SimProfileData row in result) {
61 simProfiles.Add(row.UUID, row); 61 simProfiles.Add(row.UUID, row);
62 } 62 }
63 database.Close(); 63 database.Close();
64 } 64 }
65 65
66 /// <summary> 66 /// <summary>
67 /// Adds a new profile to the database (Warning: Probably slow.) 67 /// Adds a new profile to the database (Warning: Probably slow.)
68 /// </summary> 68 /// </summary>
69 /// <param name="row">The profile to add</param> 69 /// <param name="row">The profile to add</param>
70 /// <returns>Successful?</returns> 70 /// <returns>Successful?</returns>
71 public bool AddRow(SimProfileData row) 71 public bool AddRow(SimProfileData row)
72 { 72 {
73 if (simProfiles.ContainsKey(row.UUID)) 73 if (simProfiles.ContainsKey(row.UUID))
74 { 74 {
75 simProfiles[row.UUID] = row; 75 simProfiles[row.UUID] = row;
76 } 76 }
77 else 77 else
78 { 78 {
79 simProfiles.Add(row.UUID, row); 79 simProfiles.Add(row.UUID, row);
80 } 80 }
81 81
82 try 82 try
83 { 83 {
84 IObjectContainer database; 84 IObjectContainer database;
85 database = Db4oFactory.OpenFile(dbfl); 85 database = Db4oFactory.OpenFile(dbfl);
86 database.Set(row); 86 database.Set(row);
87 database.Close(); 87 database.Close();
88 return true; 88 return true;
89 } 89 }
90 catch (Exception) 90 catch (Exception)
91 { 91 {
92 return false; 92 return false;
93 } 93 }
94 } 94 }
95 95
96 96
97 } 97 }
98 98
99 /// <summary> 99 /// <summary>
100 /// A manager for the DB4o database (user profiles) 100 /// A manager for the DB4o database (user profiles)
101 /// </summary> 101 /// </summary>
102 class DB4oUserManager 102 class DB4oUserManager
103 { 103 {
104 /// <summary> 104 /// <summary>
105 /// A list of the user profiles (in memory cache) 105 /// A list of the user profiles (in memory cache)
106 /// </summary> 106 /// </summary>
107 public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); 107 public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
108 /// <summary> 108 /// <summary>
109 /// Database filename 109 /// Database filename
110 /// </summary> 110 /// </summary>
111 string dbfl; 111 string dbfl;
112 112
113 /// <summary> 113 /// <summary>
114 /// Initialises a new DB manager 114 /// Initialises a new DB manager
115 /// </summary> 115 /// </summary>
116 /// <param name="db4odb">The filename to the database</param> 116 /// <param name="db4odb">The filename to the database</param>
117 public DB4oUserManager(string db4odb) 117 public DB4oUserManager(string db4odb)
118 { 118 {
119 dbfl = db4odb; 119 dbfl = db4odb;
120 IObjectContainer database; 120 IObjectContainer database;
121 database = Db4oFactory.OpenFile(dbfl); 121 database = Db4oFactory.OpenFile(dbfl);
122 // Load to cache 122 // Load to cache
123 IObjectSet result = database.Get(typeof(UserProfileData)); 123 IObjectSet result = database.Get(typeof(UserProfileData));
124 foreach (UserProfileData row in result) 124 foreach (UserProfileData row in result)
125 { 125 {
126 userProfiles.Add(row.UUID, row); 126 userProfiles.Add(row.UUID, row);
127 } 127 }
128 database.Close(); 128 database.Close();
129 } 129 }
130 130
131 /// <summary> 131 /// <summary>
132 /// Adds a new profile to the database (Warning: Probably slow.) 132 /// Adds a new profile to the database (Warning: Probably slow.)
133 /// </summary> 133 /// </summary>
134 /// <param name="row">The profile to add</param> 134 /// <param name="row">The profile to add</param>
135 /// <returns>Successful?</returns> 135 /// <returns>Successful?</returns>
136 public bool AddRow(UserProfileData row) 136 public bool AddRow(UserProfileData row)
137 { 137 {
138 if (userProfiles.ContainsKey(row.UUID)) 138 if (userProfiles.ContainsKey(row.UUID))
139 { 139 {
140 userProfiles[row.UUID] = row; 140 userProfiles[row.UUID] = row;
141 } 141 }
142 else 142 else
143 { 143 {
144 userProfiles.Add(row.UUID, row); 144 userProfiles.Add(row.UUID, row);
145 } 145 }
146 146
147 try 147 try
148 { 148 {
149 IObjectContainer database; 149 IObjectContainer database;
150 database = Db4oFactory.OpenFile(dbfl); 150 database = Db4oFactory.OpenFile(dbfl);
151 database.Set(row); 151 database.Set(row);
152 database.Close(); 152 database.Close();
153 return true; 153 return true;
154 } 154 }
155 catch (Exception) 155 catch (Exception)
156 { 156 {
157 return false; 157 return false;
158 } 158 }
159 } 159 }
160 160
161 161
162 } 162 }
163} 163}
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
index 2e33ab0..845b764 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
@@ -1,202 +1,202 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Data.DB4o 31namespace OpenSim.Framework.Data.DB4o
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// A User storage interface for the DB4o database system 34 /// A User storage interface for the DB4o database system
35 /// </summary> 35 /// </summary>
36 public class DB4oUserData : IUserData 36 public class DB4oUserData : IUserData
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// The database manager 39 /// The database manager
40 /// </summary> 40 /// </summary>
41 DB4oUserManager manager; 41 DB4oUserManager manager;
42 42
43 /// <summary> 43 /// <summary>
44 /// Artificial constructor called upon plugin load 44 /// Artificial constructor called upon plugin load
45 /// </summary> 45 /// </summary>
46 public void Initialise() 46 public void Initialise()
47 { 47 {
48 manager = new DB4oUserManager("userprofiles.yap"); 48 manager = new DB4oUserManager("userprofiles.yap");
49 } 49 }
50 50
51 /// <summary> 51 /// <summary>
52 /// Loads a specified user profile from a UUID 52 /// Loads a specified user profile from a UUID
53 /// </summary> 53 /// </summary>
54 /// <param name="uuid">The users UUID</param> 54 /// <param name="uuid">The users UUID</param>
55 /// <returns>A user profile</returns> 55 /// <returns>A user profile</returns>
56 public UserProfileData getUserByUUID(LLUUID uuid) 56 public UserProfileData getUserByUUID(LLUUID uuid)
57 { 57 {
58 if(manager.userProfiles.ContainsKey(uuid)) 58 if(manager.userProfiles.ContainsKey(uuid))
59 return manager.userProfiles[uuid]; 59 return manager.userProfiles[uuid];
60 return null; 60 return null;
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Returns a user by searching for its name 64 /// Returns a user by searching for its name
65 /// </summary> 65 /// </summary>
66 /// <param name="name">The users account name</param> 66 /// <param name="name">The users account name</param>
67 /// <returns>A matching users profile</returns> 67 /// <returns>A matching users profile</returns>
68 public UserProfileData getUserByName(string name) 68 public UserProfileData getUserByName(string name)
69 { 69 {
70 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); 70 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
74 /// Returns a user by searching for its name 74 /// Returns a user by searching for its name
75 /// </summary> 75 /// </summary>
76 /// <param name="fname">The first part of the users account name</param> 76 /// <param name="fname">The first part of the users account name</param>
77 /// <param name="lname">The second part of the users account name</param> 77 /// <param name="lname">The second part of the users account name</param>
78 /// <returns>A matching users profile</returns> 78 /// <returns>A matching users profile</returns>
79 public UserProfileData getUserByName(string fname, string lname) 79 public UserProfileData getUserByName(string fname, string lname)
80 { 80 {
81 foreach (UserProfileData profile in manager.userProfiles.Values) 81 foreach (UserProfileData profile in manager.userProfiles.Values)
82 { 82 {
83 if (profile.username == fname && profile.surname == lname) 83 if (profile.username == fname && profile.surname == lname)
84 return profile; 84 return profile;
85 } 85 }
86 return null; 86 return null;
87 } 87 }
88 88
89 /// <summary> 89 /// <summary>
90 /// Returns a user by UUID direct 90 /// Returns a user by UUID direct
91 /// </summary> 91 /// </summary>
92 /// <param name="uuid">The users account ID</param> 92 /// <param name="uuid">The users account ID</param>
93 /// <returns>A matching users profile</returns> 93 /// <returns>A matching users profile</returns>
94 public UserAgentData getAgentByUUID(LLUUID uuid) 94 public UserAgentData getAgentByUUID(LLUUID uuid)
95 { 95 {
96 try 96 try
97 { 97 {
98 return getUserByUUID(uuid).currentAgent; 98 return getUserByUUID(uuid).currentAgent;
99 } 99 }
100 catch (Exception) 100 catch (Exception)
101 { 101 {
102 return null; 102 return null;
103 } 103 }
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// Returns a session by account name 107 /// Returns a session by account name
108 /// </summary> 108 /// </summary>
109 /// <param name="name">The account name</param> 109 /// <param name="name">The account name</param>
110 /// <returns>The users session agent</returns> 110 /// <returns>The users session agent</returns>
111 public UserAgentData getAgentByName(string name) 111 public UserAgentData getAgentByName(string name)
112 { 112 {
113 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); 113 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
114 } 114 }
115 115
116 /// <summary> 116 /// <summary>
117 /// Returns a session by account name 117 /// Returns a session by account name
118 /// </summary> 118 /// </summary>
119 /// <param name="fname">The first part of the users account name</param> 119 /// <param name="fname">The first part of the users account name</param>
120 /// <param name="lname">The second part of the users account name</param> 120 /// <param name="lname">The second part of the users account name</param>
121 /// <returns>A user agent</returns> 121 /// <returns>A user agent</returns>
122 public UserAgentData getAgentByName(string fname, string lname) 122 public UserAgentData getAgentByName(string fname, string lname)
123 { 123 {
124 try 124 try
125 { 125 {
126 return getUserByName(fname,lname).currentAgent; 126 return getUserByName(fname,lname).currentAgent;
127 } 127 }
128 catch (Exception) 128 catch (Exception)
129 { 129 {
130 return null; 130 return null;
131 } 131 }
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Creates a new user profile 135 /// Creates a new user profile
136 /// </summary> 136 /// </summary>
137 /// <param name="user">The profile to add to the database</param> 137 /// <param name="user">The profile to add to the database</param>
138 public void addNewUserProfile(UserProfileData user) 138 public void addNewUserProfile(UserProfileData user)
139 { 139 {
140 try 140 try
141 { 141 {
142 manager.AddRow(user); 142 manager.AddRow(user);
143 } 143 }
144 catch (Exception e) 144 catch (Exception e)
145 { 145 {
146 Console.WriteLine(e.ToString()); 146 Console.WriteLine(e.ToString());
147 } 147 }
148 } 148 }
149 149
150 /// <summary> 150 /// <summary>
151 /// Creates a new user agent 151 /// Creates a new user agent
152 /// </summary> 152 /// </summary>
153 /// <param name="agent">The agent to add to the database</param> 153 /// <param name="agent">The agent to add to the database</param>
154 public void addNewUserAgent(UserAgentData agent) 154 public void addNewUserAgent(UserAgentData agent)
155 { 155 {
156 // Do nothing. yet. 156 // Do nothing. yet.
157 } 157 }
158 158
159 /// <summary> 159 /// <summary>
160 /// Transfers money between two user accounts 160 /// Transfers money between two user accounts
161 /// </summary> 161 /// </summary>
162 /// <param name="from">Starting account</param> 162 /// <param name="from">Starting account</param>
163 /// <param name="to">End account</param> 163 /// <param name="to">End account</param>
164 /// <param name="amount">The amount to move</param> 164 /// <param name="amount">The amount to move</param>
165 /// <returns>Success?</returns> 165 /// <returns>Success?</returns>
166 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) 166 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
167 { 167 {
168 return true; 168 return true;
169 } 169 }
170 170
171 /// <summary> 171 /// <summary>
172 /// Transfers inventory between two accounts 172 /// Transfers inventory between two accounts
173 /// </summary> 173 /// </summary>
174 /// <remarks>Move to inventory server</remarks> 174 /// <remarks>Move to inventory server</remarks>
175 /// <param name="from">Senders account</param> 175 /// <param name="from">Senders account</param>
176 /// <param name="to">Recievers account</param> 176 /// <param name="to">Recievers account</param>
177 /// <param name="item">Inventory item</param> 177 /// <param name="item">Inventory item</param>
178 /// <returns>Success?</returns> 178 /// <returns>Success?</returns>
179 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) 179 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
180 { 180 {
181 return true; 181 return true;
182 } 182 }
183 183
184 /// <summary> 184 /// <summary>
185 /// Returns the name of the storage provider 185 /// Returns the name of the storage provider
186 /// </summary> 186 /// </summary>
187 /// <returns>Storage provider name</returns> 187 /// <returns>Storage provider name</returns>
188 public string getName() 188 public string getName()
189 { 189 {
190 return "DB4o Userdata"; 190 return "DB4o Userdata";
191 } 191 }
192 192
193 /// <summary> 193 /// <summary>
194 /// Returns the version of the storage provider 194 /// Returns the version of the storage provider
195 /// </summary> 195 /// </summary>
196 /// <returns>Storage provider version</returns> 196 /// <returns>Storage provider version</returns>
197 public string getVersion() 197 public string getVersion()
198 { 198 {
199 return "0.1"; 199 return "0.1";
200 } 200 }
201 } 201 }
202} 202}
diff --git a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs
index 905cd9b..52d09fa 100644
--- a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] 6[assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] 10[assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] 21[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index ca9196a5..dc60ca4 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -1,194 +1,194 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Security.Cryptography; 31using System.Security.Cryptography;
32using System.Text; 32using System.Text;
33using libsecondlife; 33using libsecondlife;
34 34
35namespace OpenSim.Framework.Data.MSSQL 35namespace OpenSim.Framework.Data.MSSQL
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// A grid data interface for Microsoft SQL Server 38 /// A grid data interface for Microsoft SQL Server
39 /// </summary> 39 /// </summary>
40 public class SqlGridData : IGridData 40 public class SqlGridData : IGridData
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// Database manager 43 /// Database manager
44 /// </summary> 44 /// </summary>
45 private MSSqlManager database; 45 private MSSqlManager database;
46 46
47 /// <summary> 47 /// <summary>
48 /// Initialises the Grid Interface 48 /// Initialises the Grid Interface
49 /// </summary> 49 /// </summary>
50 public void Initialise() 50 public void Initialise()
51 { 51 {
52 database = new MSSqlManager("localhost", "db", "user", "password", "false"); 52 database = new MSSqlManager("localhost", "db", "user", "password", "false");
53 } 53 }
54 54
55 /// <summary> 55 /// <summary>
56 /// Shuts down the grid interface 56 /// Shuts down the grid interface
57 /// </summary> 57 /// </summary>
58 public void Close() 58 public void Close()
59 { 59 {
60 database.Close(); 60 database.Close();
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Returns the storage system name 64 /// Returns the storage system name
65 /// </summary> 65 /// </summary>
66 /// <returns>A string containing the storage system name</returns> 66 /// <returns>A string containing the storage system name</returns>
67 public string getName() 67 public string getName()
68 { 68 {
69 return "Sql OpenGridData"; 69 return "Sql OpenGridData";
70 } 70 }
71 71
72 /// <summary> 72 /// <summary>
73 /// Returns the storage system version 73 /// Returns the storage system version
74 /// </summary> 74 /// </summary>
75 /// <returns>A string containing the storage system version</returns> 75 /// <returns>A string containing the storage system version</returns>
76 public string getVersion() 76 public string getVersion()
77 { 77 {
78 return "0.1"; 78 return "0.1";
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Returns a list of regions within the specified ranges 82 /// Returns a list of regions within the specified ranges
83 /// </summary> 83 /// </summary>
84 /// <param name="a">minimum X coordinate</param> 84 /// <param name="a">minimum X coordinate</param>
85 /// <param name="b">minimum Y coordinate</param> 85 /// <param name="b">minimum Y coordinate</param>
86 /// <param name="c">maximum X coordinate</param> 86 /// <param name="c">maximum X coordinate</param>
87 /// <param name="d">maximum Y coordinate</param> 87 /// <param name="d">maximum Y coordinate</param>
88 /// <returns>An array of region profiles</returns> 88 /// <returns>An array of region profiles</returns>
89 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) 89 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
90 { 90 {
91 return null; 91 return null;
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
95 /// Returns a sim profile from it's location 95 /// Returns a sim profile from it's location
96 /// </summary> 96 /// </summary>
97 /// <param name="handle">Region location handle</param> 97 /// <param name="handle">Region location handle</param>
98 /// <returns>Sim profile</returns> 98 /// <returns>Sim profile</returns>
99 public SimProfileData GetProfileByHandle(ulong handle) 99 public SimProfileData GetProfileByHandle(ulong handle)
100 { 100 {
101 Dictionary<string, string> param = new Dictionary<string, string>(); 101 Dictionary<string, string> param = new Dictionary<string, string>();
102 param["handle"] = handle.ToString(); 102 param["handle"] = handle.ToString();
103 103
104 IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); 104 IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param);
105 IDataReader reader = result.ExecuteReader(); 105 IDataReader reader = result.ExecuteReader();
106 106
107 SimProfileData row = database.getRow(reader); 107 SimProfileData row = database.getRow(reader);
108 reader.Close(); 108 reader.Close();
109 result.Dispose(); 109 result.Dispose();
110 110
111 return row; 111 return row;
112 } 112 }
113 113
114 /// <summary> 114 /// <summary>
115 /// Returns a sim profile from it's UUID 115 /// Returns a sim profile from it's UUID
116 /// </summary> 116 /// </summary>
117 /// <param name="uuid">The region UUID</param> 117 /// <param name="uuid">The region UUID</param>
118 /// <returns>The sim profile</returns> 118 /// <returns>The sim profile</returns>
119 public SimProfileData GetProfileByLLUUID(LLUUID uuid) 119 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
120 { 120 {
121 Dictionary<string, string> param = new Dictionary<string, string>(); 121 Dictionary<string, string> param = new Dictionary<string, string>();
122 param["uuid"] = uuid.ToStringHyphenated(); 122 param["uuid"] = uuid.ToStringHyphenated();
123 123
124 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); 124 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
125 IDataReader reader = result.ExecuteReader(); 125 IDataReader reader = result.ExecuteReader();
126 126
127 SimProfileData row = database.getRow(reader); 127 SimProfileData row = database.getRow(reader);
128 reader.Close(); 128 reader.Close();
129 result.Dispose(); 129 result.Dispose();
130 130
131 return row; 131 return row;
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Adds a new specified region to the database 135 /// Adds a new specified region to the database
136 /// </summary> 136 /// </summary>
137 /// <param name="profile">The profile to add</param> 137 /// <param name="profile">The profile to add</param>
138 /// <returns>A dataresponse enum indicating success</returns> 138 /// <returns>A dataresponse enum indicating success</returns>
139 public DataResponse AddProfile(SimProfileData profile) 139 public DataResponse AddProfile(SimProfileData profile)
140 { 140 {
141 if (database.insertRow(profile)) 141 if (database.insertRow(profile))
142 { 142 {
143 return DataResponse.RESPONSE_OK; 143 return DataResponse.RESPONSE_OK;
144 } 144 }
145 else 145 else
146 { 146 {
147 return DataResponse.RESPONSE_ERROR; 147 return DataResponse.RESPONSE_ERROR;
148 } 148 }
149 } 149 }
150 150
151 /// <summary> 151 /// <summary>
152 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. 152 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
153 /// </summary> 153 /// </summary>
154 /// <param name="uuid">The UUID of the challenger</param> 154 /// <param name="uuid">The UUID of the challenger</param>
155 /// <param name="handle">The attempted regionHandle of the challenger</param> 155 /// <param name="handle">The attempted regionHandle of the challenger</param>
156 /// <param name="authkey">The secret</param> 156 /// <param name="authkey">The secret</param>
157 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> 157 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
158 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) 158 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
159 { 159 {
160 bool throwHissyFit = false; // Should be true by 1.0 160 bool throwHissyFit = false; // Should be true by 1.0
161 161
162 if (throwHissyFit) 162 if (throwHissyFit)
163 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); 163 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
164 164
165 SimProfileData data = GetProfileByLLUUID(uuid); 165 SimProfileData data = GetProfileByLLUUID(uuid);
166 166
167 return (handle == data.regionHandle && authkey == data.regionSecret); 167 return (handle == data.regionHandle && authkey == data.regionSecret);
168 } 168 }
169 169
170 /// <summary> 170 /// <summary>
171 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region 171 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
172 /// </summary> 172 /// </summary>
173 /// <remarks>This requires a security audit.</remarks> 173 /// <remarks>This requires a security audit.</remarks>
174 /// <param name="uuid"></param> 174 /// <param name="uuid"></param>
175 /// <param name="handle"></param> 175 /// <param name="handle"></param>
176 /// <param name="authhash"></param> 176 /// <param name="authhash"></param>
177 /// <param name="challenge"></param> 177 /// <param name="challenge"></param>
178 /// <returns></returns> 178 /// <returns></returns>
179 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) 179 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
180 { 180 {
181 SHA512Managed HashProvider = new SHA512Managed(); 181 SHA512Managed HashProvider = new SHA512Managed();
182 ASCIIEncoding TextProvider = new ASCIIEncoding(); 182 ASCIIEncoding TextProvider = new ASCIIEncoding();
183 183
184 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); 184 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
185 byte[] hash = HashProvider.ComputeHash(stream); 185 byte[] hash = HashProvider.ComputeHash(stream);
186 return false; 186 return false;
187 } 187 }
188 public ReservationData GetReservationAtPoint(uint x, uint y) 188 public ReservationData GetReservationAtPoint(uint x, uint y)
189 { 189 {
190 return null; 190 return null;
191 } 191 }
192 } 192 }
193 193
194} 194}
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
index 49bf31c..26677a5 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
@@ -1,211 +1,211 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Data.SqlClient; 31using System.Data.SqlClient;
32using libsecondlife; 32using libsecondlife;
33 33
34namespace OpenSim.Framework.Data.MSSQL 34namespace OpenSim.Framework.Data.MSSQL
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// A management class for the MS SQL Storage Engine 37 /// A management class for the MS SQL Storage Engine
38 /// </summary> 38 /// </summary>
39 class MSSqlManager 39 class MSSqlManager
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// The database connection object 42 /// The database connection object
43 /// </summary> 43 /// </summary>
44 IDbConnection dbcon; 44 IDbConnection dbcon;
45 45
46 /// <summary> 46 /// <summary>
47 /// Initialises and creates a new Sql connection and maintains it. 47 /// Initialises and creates a new Sql connection and maintains it.
48 /// </summary> 48 /// </summary>
49 /// <param name="hostname">The Sql server being connected to</param> 49 /// <param name="hostname">The Sql server being connected to</param>
50 /// <param name="database">The name of the Sql database being used</param> 50 /// <param name="database">The name of the Sql database being used</param>
51 /// <param name="username">The username logging into the database</param> 51 /// <param name="username">The username logging into the database</param>
52 /// <param name="password">The password for the user logging in</param> 52 /// <param name="password">The password for the user logging in</param>
53 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> 53 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
54 public MSSqlManager(string hostname, string database, string username, string password, string cpooling) 54 public MSSqlManager(string hostname, string database, string username, string password, string cpooling)
55 { 55 {
56 try 56 try
57 { 57 {
58 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; 58 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
59 dbcon = new SqlConnection(connectionString); 59 dbcon = new SqlConnection(connectionString);
60 60
61 dbcon.Open(); 61 dbcon.Open();
62 } 62 }
63 catch (Exception e) 63 catch (Exception e)
64 { 64 {
65 throw new Exception("Error initialising Sql Database: " + e.ToString()); 65 throw new Exception("Error initialising Sql Database: " + e.ToString());
66 } 66 }
67 } 67 }
68 68
69 /// <summary> 69 /// <summary>
70 /// Shuts down the database connection 70 /// Shuts down the database connection
71 /// </summary> 71 /// </summary>
72 public void Close() 72 public void Close()
73 { 73 {
74 dbcon.Close(); 74 dbcon.Close();
75 dbcon = null; 75 dbcon = null;
76 } 76 }
77 77
78 /// <summary> 78 /// <summary>
79 /// Runs a query with protection against SQL Injection by using parameterised input. 79 /// Runs a query with protection against SQL Injection by using parameterised input.
80 /// </summary> 80 /// </summary>
81 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> 81 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
82 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> 82 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
83 /// <returns>A Sql DB Command</returns> 83 /// <returns>A Sql DB Command</returns>
84 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 84 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
85 { 85 {
86 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); 86 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand();
87 dbcommand.CommandText = sql; 87 dbcommand.CommandText = sql;
88 foreach (KeyValuePair<string, string> param in parameters) 88 foreach (KeyValuePair<string, string> param in parameters)
89 { 89 {
90 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 90 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
91 } 91 }
92 92
93 return (IDbCommand)dbcommand; 93 return (IDbCommand)dbcommand;
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
97 /// Runs a database reader object and returns a region row 97 /// Runs a database reader object and returns a region row
98 /// </summary> 98 /// </summary>
99 /// <param name="reader">An active database reader</param> 99 /// <param name="reader">An active database reader</param>
100 /// <returns>A region row</returns> 100 /// <returns>A region row</returns>
101 public SimProfileData getRow(IDataReader reader) 101 public SimProfileData getRow(IDataReader reader)
102 { 102 {
103 SimProfileData regionprofile = new SimProfileData(); 103 SimProfileData regionprofile = new SimProfileData();
104 104
105 if (reader.Read()) 105 if (reader.Read())
106 { 106 {
107 // Region Main 107 // Region Main
108 regionprofile.regionHandle = (ulong)reader["regionHandle"]; 108 regionprofile.regionHandle = (ulong)reader["regionHandle"];
109 regionprofile.regionName = (string)reader["regionName"]; 109 regionprofile.regionName = (string)reader["regionName"];
110 regionprofile.UUID = new LLUUID((string)reader["uuid"]); 110 regionprofile.UUID = new LLUUID((string)reader["uuid"]);
111 111
112 // Secrets 112 // Secrets
113 regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; 113 regionprofile.regionRecvKey = (string)reader["regionRecvKey"];
114 regionprofile.regionSecret = (string)reader["regionSecret"]; 114 regionprofile.regionSecret = (string)reader["regionSecret"];
115 regionprofile.regionSendKey = (string)reader["regionSendKey"]; 115 regionprofile.regionSendKey = (string)reader["regionSendKey"];
116 116
117 // Region Server 117 // Region Server
118 regionprofile.regionDataURI = (string)reader["regionDataURI"]; 118 regionprofile.regionDataURI = (string)reader["regionDataURI"];
119 regionprofile.regionOnline = false; // Needs to be pinged before this can be set. 119 regionprofile.regionOnline = false; // Needs to be pinged before this can be set.
120 regionprofile.serverIP = (string)reader["serverIP"]; 120 regionprofile.serverIP = (string)reader["serverIP"];
121 regionprofile.serverPort = (uint)reader["serverPort"]; 121 regionprofile.serverPort = (uint)reader["serverPort"];
122 regionprofile.serverURI = (string)reader["serverURI"]; 122 regionprofile.serverURI = (string)reader["serverURI"];
123 123
124 // Location 124 // Location
125 regionprofile.regionLocX = (uint)((int)reader["locX"]); 125 regionprofile.regionLocX = (uint)((int)reader["locX"]);
126 regionprofile.regionLocY = (uint)((int)reader["locY"]); 126 regionprofile.regionLocY = (uint)((int)reader["locY"]);
127 regionprofile.regionLocZ = (uint)((int)reader["locZ"]); 127 regionprofile.regionLocZ = (uint)((int)reader["locZ"]);
128 128
129 // Neighbours - 0 = No Override 129 // Neighbours - 0 = No Override
130 regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; 130 regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"];
131 regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; 131 regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"];
132 regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; 132 regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"];
133 regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; 133 regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"];
134 134
135 // Assets 135 // Assets
136 regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; 136 regionprofile.regionAssetURI = (string)reader["regionAssetURI"];
137 regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 137 regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
138 regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 138 regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"];
139 139
140 // Userserver 140 // Userserver
141 regionprofile.regionUserURI = (string)reader["regionUserURI"]; 141 regionprofile.regionUserURI = (string)reader["regionUserURI"];
142 regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 142 regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"];
143 regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; 143 regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"];
144 } 144 }
145 else 145 else
146 { 146 {
147 throw new Exception("No rows to return"); 147 throw new Exception("No rows to return");
148 } 148 }
149 return regionprofile; 149 return regionprofile;
150 } 150 }
151 151
152 /// <summary> 152 /// <summary>
153 /// Creates a new region in the database 153 /// Creates a new region in the database
154 /// </summary> 154 /// </summary>
155 /// <param name="profile">The region profile to insert</param> 155 /// <param name="profile">The region profile to insert</param>
156 /// <returns>Successful?</returns> 156 /// <returns>Successful?</returns>
157 public bool insertRow(SimProfileData profile) 157 public bool insertRow(SimProfileData profile)
158 { 158 {
159 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 159 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
160 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 160 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
161 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; 161 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
162 162
163 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 163 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
164 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 164 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
165 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; 165 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
166 166
167 Dictionary<string, string> parameters = new Dictionary<string, string>(); 167 Dictionary<string, string> parameters = new Dictionary<string, string>();
168 168
169 parameters["regionHandle"] = profile.regionHandle.ToString(); 169 parameters["regionHandle"] = profile.regionHandle.ToString();
170 parameters["regionName"] = profile.regionName; 170 parameters["regionName"] = profile.regionName;
171 parameters["uuid"] = profile.UUID.ToString(); 171 parameters["uuid"] = profile.UUID.ToString();
172 parameters["regionRecvKey"] = profile.regionRecvKey; 172 parameters["regionRecvKey"] = profile.regionRecvKey;
173 parameters["regionSendKey"] = profile.regionSendKey; 173 parameters["regionSendKey"] = profile.regionSendKey;
174 parameters["regionDataURI"] = profile.regionDataURI; 174 parameters["regionDataURI"] = profile.regionDataURI;
175 parameters["serverIP"] = profile.serverIP; 175 parameters["serverIP"] = profile.serverIP;
176 parameters["serverPort"] = profile.serverPort.ToString(); 176 parameters["serverPort"] = profile.serverPort.ToString();
177 parameters["serverURI"] = profile.serverURI; 177 parameters["serverURI"] = profile.serverURI;
178 parameters["locX"] = profile.regionLocX.ToString(); 178 parameters["locX"] = profile.regionLocX.ToString();
179 parameters["locY"] = profile.regionLocY.ToString(); 179 parameters["locY"] = profile.regionLocY.ToString();
180 parameters["locZ"] = profile.regionLocZ.ToString(); 180 parameters["locZ"] = profile.regionLocZ.ToString();
181 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); 181 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
182 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); 182 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
183 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); 183 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
184 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); 184 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
185 parameters["regionAssetURI"] = profile.regionAssetURI; 185 parameters["regionAssetURI"] = profile.regionAssetURI;
186 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; 186 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
187 parameters["regionAssetSendKey"] = profile.regionAssetSendKey; 187 parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
188 parameters["regionUserURI"] = profile.regionUserURI; 188 parameters["regionUserURI"] = profile.regionUserURI;
189 parameters["regionUserRecvKey"] = profile.regionUserRecvKey; 189 parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
190 parameters["regionUserSendKey"] = profile.regionUserSendKey; 190 parameters["regionUserSendKey"] = profile.regionUserSendKey;
191 191
192 bool returnval = false; 192 bool returnval = false;
193 193
194 try 194 try
195 { 195 {
196 IDbCommand result = Query(sql, parameters); 196 IDbCommand result = Query(sql, parameters);
197 197
198 if (result.ExecuteNonQuery() == 1) 198 if (result.ExecuteNonQuery() == 1)
199 returnval = true; 199 returnval = true;
200 200
201 result.Dispose(); 201 result.Dispose();
202 } 202 }
203 catch (Exception) 203 catch (Exception)
204 { 204 {
205 return false; 205 return false;
206 } 206 }
207 207
208 return returnval; 208 return returnval;
209 } 209 }
210 } 210 }
211} 211}
diff --git a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs
index 066c739..eeac06c 100644
--- a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")] 6[assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] 10[assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] 21[assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index ef643d2..09f5e83 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -1,287 +1,287 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Security.Cryptography; 31using System.Security.Cryptography;
32using System.Text; 32using System.Text;
33using libsecondlife; 33using libsecondlife;
34 34
35namespace OpenSim.Framework.Data.MySQL 35namespace OpenSim.Framework.Data.MySQL
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// A MySQL Interface for the Grid Server 38 /// A MySQL Interface for the Grid Server
39 /// </summary> 39 /// </summary>
40 public class MySQLGridData : IGridData 40 public class MySQLGridData : IGridData
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// MySQL Database Manager 43 /// MySQL Database Manager
44 /// </summary> 44 /// </summary>
45 private MySQLManager database; 45 private MySQLManager database;
46 46
47 /// <summary> 47 /// <summary>
48 /// Initialises the Grid Interface 48 /// Initialises the Grid Interface
49 /// </summary> 49 /// </summary>
50 public void Initialise() 50 public void Initialise()
51 { 51 {
52 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 52 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
53 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 53 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
54 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); 54 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
55 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); 55 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
56 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 56 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
57 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 57 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
58 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 58 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
59 59
60 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 60 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Shuts down the grid interface 64 /// Shuts down the grid interface
65 /// </summary> 65 /// </summary>
66 public void Close() 66 public void Close()
67 { 67 {
68 database.Close(); 68 database.Close();
69 } 69 }
70 70
71 /// <summary> 71 /// <summary>
72 /// Returns the plugin name 72 /// Returns the plugin name
73 /// </summary> 73 /// </summary>
74 /// <returns>Plugin name</returns> 74 /// <returns>Plugin name</returns>
75 public string getName() 75 public string getName()
76 { 76 {
77 return "MySql OpenGridData"; 77 return "MySql OpenGridData";
78 } 78 }
79 79
80 /// <summary> 80 /// <summary>
81 /// Returns the plugin version 81 /// Returns the plugin version
82 /// </summary> 82 /// </summary>
83 /// <returns>Plugin version</returns> 83 /// <returns>Plugin version</returns>
84 public string getVersion() 84 public string getVersion()
85 { 85 {
86 return "0.1"; 86 return "0.1";
87 } 87 }
88 88
89 /// <summary> 89 /// <summary>
90 /// Returns all the specified region profiles within coordates -- coordinates are inclusive 90 /// Returns all the specified region profiles within coordates -- coordinates are inclusive
91 /// </summary> 91 /// </summary>
92 /// <param name="xmin">Minimum X coordinate</param> 92 /// <param name="xmin">Minimum X coordinate</param>
93 /// <param name="ymin">Minimum Y coordinate</param> 93 /// <param name="ymin">Minimum Y coordinate</param>
94 /// <param name="xmax">Maximum X coordinate</param> 94 /// <param name="xmax">Maximum X coordinate</param>
95 /// <param name="ymax">Maximum Y coordinate</param> 95 /// <param name="ymax">Maximum Y coordinate</param>
96 /// <returns></returns> 96 /// <returns></returns>
97 public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) 97 public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
98 { 98 {
99 try 99 try
100 { 100 {
101 lock (database) 101 lock (database)
102 { 102 {
103 Dictionary<string, string> param = new Dictionary<string, string>(); 103 Dictionary<string, string> param = new Dictionary<string, string>();
104 param["?xmin"] = xmin.ToString(); 104 param["?xmin"] = xmin.ToString();
105 param["?ymin"] = ymin.ToString(); 105 param["?ymin"] = ymin.ToString();
106 param["?xmax"] = xmax.ToString(); 106 param["?xmax"] = xmax.ToString();
107 param["?ymax"] = ymax.ToString(); 107 param["?ymax"] = ymax.ToString();
108 108
109 IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); 109 IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
110 IDataReader reader = result.ExecuteReader(); 110 IDataReader reader = result.ExecuteReader();
111 111
112 SimProfileData row; 112 SimProfileData row;
113 113
114 List<SimProfileData> rows = new List<SimProfileData>(); 114 List<SimProfileData> rows = new List<SimProfileData>();
115 115
116 while ((row = database.readSimRow(reader)) != null) 116 while ((row = database.readSimRow(reader)) != null)
117 { 117 {
118 rows.Add(row); 118 rows.Add(row);
119 } 119 }
120 reader.Close(); 120 reader.Close();
121 result.Dispose(); 121 result.Dispose();
122 122
123 return rows.ToArray(); 123 return rows.ToArray();
124 124
125 } 125 }
126 } 126 }
127 catch (Exception e) 127 catch (Exception e)
128 { 128 {
129 database.Reconnect(); 129 database.Reconnect();
130 Console.WriteLine(e.ToString()); 130 Console.WriteLine(e.ToString());
131 return null; 131 return null;
132 } 132 }
133 } 133 }
134 134
135 /// <summary> 135 /// <summary>
136 /// Returns a sim profile from it's location 136 /// Returns a sim profile from it's location
137 /// </summary> 137 /// </summary>
138 /// <param name="handle">Region location handle</param> 138 /// <param name="handle">Region location handle</param>
139 /// <returns>Sim profile</returns> 139 /// <returns>Sim profile</returns>
140 public SimProfileData GetProfileByHandle(ulong handle) 140 public SimProfileData GetProfileByHandle(ulong handle)
141 { 141 {
142 try 142 try
143 { 143 {
144 lock (database) 144 lock (database)
145 { 145 {
146 Dictionary<string, string> param = new Dictionary<string, string>(); 146 Dictionary<string, string> param = new Dictionary<string, string>();
147 param["?handle"] = handle.ToString(); 147 param["?handle"] = handle.ToString();
148 148
149 IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); 149 IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
150 IDataReader reader = result.ExecuteReader(); 150 IDataReader reader = result.ExecuteReader();
151 151
152 SimProfileData row = database.readSimRow(reader); 152 SimProfileData row = database.readSimRow(reader);
153 reader.Close(); 153 reader.Close();
154 result.Dispose(); 154 result.Dispose();
155 155
156 return row; 156 return row;
157 } 157 }
158 } 158 }
159 catch (Exception e) 159 catch (Exception e)
160 { 160 {
161 database.Reconnect(); 161 database.Reconnect();
162 Console.WriteLine(e.ToString()); 162 Console.WriteLine(e.ToString());
163 return null; 163 return null;
164 } 164 }
165 } 165 }
166 166
167 /// <summary> 167 /// <summary>
168 /// Returns a sim profile from it's UUID 168 /// Returns a sim profile from it's UUID
169 /// </summary> 169 /// </summary>
170 /// <param name="uuid">The region UUID</param> 170 /// <param name="uuid">The region UUID</param>
171 /// <returns>The sim profile</returns> 171 /// <returns>The sim profile</returns>
172 public SimProfileData GetProfileByLLUUID(LLUUID uuid) 172 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
173 { 173 {
174 try 174 try
175 { 175 {
176 lock (database) 176 lock (database)
177 { 177 {
178 Dictionary<string, string> param = new Dictionary<string, string>(); 178 Dictionary<string, string> param = new Dictionary<string, string>();
179 param["?uuid"] = uuid.ToStringHyphenated(); 179 param["?uuid"] = uuid.ToStringHyphenated();
180 180
181 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); 181 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
182 IDataReader reader = result.ExecuteReader(); 182 IDataReader reader = result.ExecuteReader();
183 183
184 SimProfileData row = database.readSimRow(reader); 184 SimProfileData row = database.readSimRow(reader);
185 reader.Close(); 185 reader.Close();
186 result.Dispose(); 186 result.Dispose();
187 187
188 return row; 188 return row;
189 } 189 }
190 } 190 }
191 catch (Exception e) 191 catch (Exception e)
192 { 192 {
193 database.Reconnect(); 193 database.Reconnect();
194 Console.WriteLine(e.ToString()); 194 Console.WriteLine(e.ToString());
195 return null; 195 return null;
196 } 196 }
197 } 197 }
198 198
199 /// <summary> 199 /// <summary>
200 /// Adds a new profile to the database 200 /// Adds a new profile to the database
201 /// </summary> 201 /// </summary>
202 /// <param name="profile">The profile to add</param> 202 /// <param name="profile">The profile to add</param>
203 /// <returns>Successful?</returns> 203 /// <returns>Successful?</returns>
204 public DataResponse AddProfile(SimProfileData profile) 204 public DataResponse AddProfile(SimProfileData profile)
205 { 205 {
206 lock (database) 206 lock (database)
207 { 207 {
208 if (database.insertRegion(profile)) 208 if (database.insertRegion(profile))
209 { 209 {
210 return DataResponse.RESPONSE_OK; 210 return DataResponse.RESPONSE_OK;
211 } 211 }
212 else 212 else
213 { 213 {
214 return DataResponse.RESPONSE_ERROR; 214 return DataResponse.RESPONSE_ERROR;
215 } 215 }
216 } 216 }
217 } 217 }
218 218
219 /// <summary> 219 /// <summary>
220 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. 220 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
221 /// </summary> 221 /// </summary>
222 /// <param name="uuid">The UUID of the challenger</param> 222 /// <param name="uuid">The UUID of the challenger</param>
223 /// <param name="handle">The attempted regionHandle of the challenger</param> 223 /// <param name="handle">The attempted regionHandle of the challenger</param>
224 /// <param name="authkey">The secret</param> 224 /// <param name="authkey">The secret</param>
225 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> 225 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
226 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) 226 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
227 { 227 {
228 bool throwHissyFit = false; // Should be true by 1.0 228 bool throwHissyFit = false; // Should be true by 1.0
229 229
230 if (throwHissyFit) 230 if (throwHissyFit)
231 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); 231 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
232 232
233 SimProfileData data = GetProfileByLLUUID(uuid); 233 SimProfileData data = GetProfileByLLUUID(uuid);
234 234
235 return (handle == data.regionHandle && authkey == data.regionSecret); 235 return (handle == data.regionHandle && authkey == data.regionSecret);
236 } 236 }
237 237
238 /// <summary> 238 /// <summary>
239 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region 239 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
240 /// </summary> 240 /// </summary>
241 /// <remarks>This requires a security audit.</remarks> 241 /// <remarks>This requires a security audit.</remarks>
242 /// <param name="uuid"></param> 242 /// <param name="uuid"></param>
243 /// <param name="handle"></param> 243 /// <param name="handle"></param>
244 /// <param name="authhash"></param> 244 /// <param name="authhash"></param>
245 /// <param name="challenge"></param> 245 /// <param name="challenge"></param>
246 /// <returns></returns> 246 /// <returns></returns>
247 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) 247 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
248 { 248 {
249 SHA512Managed HashProvider = new SHA512Managed(); 249 SHA512Managed HashProvider = new SHA512Managed();
250 ASCIIEncoding TextProvider = new ASCIIEncoding(); 250 ASCIIEncoding TextProvider = new ASCIIEncoding();
251 251
252 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); 252 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
253 byte[] hash = HashProvider.ComputeHash(stream); 253 byte[] hash = HashProvider.ComputeHash(stream);
254 254
255 return false; 255 return false;
256 } 256 }
257 257
258 public ReservationData GetReservationAtPoint(uint x, uint y) 258 public ReservationData GetReservationAtPoint(uint x, uint y)
259 { 259 {
260 try 260 try
261 { 261 {
262 lock (database) 262 lock (database)
263 { 263 {
264 Dictionary<string, string> param = new Dictionary<string, string>(); 264 Dictionary<string, string> param = new Dictionary<string, string>();
265 param["?x"] = x.ToString(); 265 param["?x"] = x.ToString();
266 param["?y"] = y.ToString(); 266 param["?y"] = y.ToString();
267 IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); 267 IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param);
268 IDataReader reader = result.ExecuteReader(); 268 IDataReader reader = result.ExecuteReader();
269 269
270 ReservationData row = database.readReservationRow(reader); 270 ReservationData row = database.readReservationRow(reader);
271 reader.Close(); 271 reader.Close();
272 result.Dispose(); 272 result.Dispose();
273 273
274 return row; 274 return row;
275 } 275 }
276 } 276 }
277 catch (Exception e) 277 catch (Exception e)
278 { 278 {
279 database.Reconnect(); 279 database.Reconnect();
280 Console.WriteLine(e.ToString()); 280 Console.WriteLine(e.ToString());
281 return null; 281 return null;
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 286
287} 287}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index 790759a..d32db1b 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -1,309 +1,309 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32 32
33namespace OpenSim.Framework.Data.MySQL 33namespace OpenSim.Framework.Data.MySQL
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// A MySQL interface for the inventory server 36 /// A MySQL interface for the inventory server
37 /// </summary> 37 /// </summary>
38 class MySQLInventoryData : IInventoryData 38 class MySQLInventoryData : IInventoryData
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// The database manager 41 /// The database manager
42 /// </summary> 42 /// </summary>
43 public MySQLManager database; 43 public MySQLManager database;
44 44
45 /// <summary> 45 /// <summary>
46 /// Loads and initialises this database plugin 46 /// Loads and initialises this database plugin
47 /// </summary> 47 /// </summary>
48 public void Initialise() 48 public void Initialise()
49 { 49 {
50 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 50 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
51 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 51 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
52 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); 52 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
53 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); 53 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
54 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 54 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
55 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 55 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
56 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 56 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
57 57
58 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 58 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// The name of this DB provider 62 /// The name of this DB provider
63 /// </summary> 63 /// </summary>
64 /// <returns>Name of DB provider</returns> 64 /// <returns>Name of DB provider</returns>
65 public string getName() 65 public string getName()
66 { 66 {
67 return "MySQL Inventory Data Interface"; 67 return "MySQL Inventory Data Interface";
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// Closes this DB provider 71 /// Closes this DB provider
72 /// </summary> 72 /// </summary>
73 public void Close() 73 public void Close()
74 { 74 {
75 // Do nothing. 75 // Do nothing.
76 } 76 }
77 77
78 /// <summary> 78 /// <summary>
79 /// Returns the version of this DB provider 79 /// Returns the version of this DB provider
80 /// </summary> 80 /// </summary>
81 /// <returns>A string containing the DB provider</returns> 81 /// <returns>A string containing the DB provider</returns>
82 public string getVersion() 82 public string getVersion()
83 { 83 {
84 return "0.1"; 84 return "0.1";
85 } 85 }
86 86
87 /// <summary> 87 /// <summary>
88 /// Returns a list of items in a specified folder 88 /// Returns a list of items in a specified folder
89 /// </summary> 89 /// </summary>
90 /// <param name="folderID">The folder to search</param> 90 /// <param name="folderID">The folder to search</param>
91 /// <returns>A list containing inventory items</returns> 91 /// <returns>A list containing inventory items</returns>
92 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 92 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
93 { 93 {
94 try 94 try
95 { 95 {
96 lock (database) 96 lock (database)
97 { 97 {
98 Dictionary<string, string> param = new Dictionary<string, string>(); 98 Dictionary<string, string> param = new Dictionary<string, string>();
99 param["?uuid"] = folderID.ToStringHyphenated(); 99 param["?uuid"] = folderID.ToStringHyphenated();
100 100
101 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param); 101 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param);
102 IDataReader reader = result.ExecuteReader(); 102 IDataReader reader = result.ExecuteReader();
103 103
104 List<InventoryItemBase> items = database.readInventoryItems(reader); 104 List<InventoryItemBase> items = database.readInventoryItems(reader);
105 105
106 reader.Close(); 106 reader.Close();
107 result.Dispose(); 107 result.Dispose();
108 108
109 return items; 109 return items;
110 } 110 }
111 } 111 }
112 catch (Exception e) 112 catch (Exception e)
113 { 113 {
114 database.Reconnect(); 114 database.Reconnect();
115 Console.WriteLine(e.ToString()); 115 Console.WriteLine(e.ToString());
116 return null; 116 return null;
117 } 117 }
118 } 118 }
119 119
120 /// <summary> 120 /// <summary>
121 /// Returns a list of the root folders within a users inventory 121 /// Returns a list of the root folders within a users inventory
122 /// </summary> 122 /// </summary>
123 /// <param name="user">The user whos inventory is to be searched</param> 123 /// <param name="user">The user whos inventory is to be searched</param>
124 /// <returns>A list of folder objects</returns> 124 /// <returns>A list of folder objects</returns>
125 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 125 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
126 { 126 {
127 try 127 try
128 { 128 {
129 lock (database) 129 lock (database)
130 { 130 {
131 Dictionary<string, string> param = new Dictionary<string, string>(); 131 Dictionary<string, string> param = new Dictionary<string, string>();
132 param["?uuid"] = user.ToStringHyphenated(); 132 param["?uuid"] = user.ToStringHyphenated();
133 param["?zero"] = LLUUID.Zero.ToStringHyphenated(); 133 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
134 134
135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); 135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
136 IDataReader reader = result.ExecuteReader(); 136 IDataReader reader = result.ExecuteReader();
137 137
138 List<InventoryFolderBase> items = database.readInventoryFolders(reader); 138 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
139 139
140 reader.Close(); 140 reader.Close();
141 result.Dispose(); 141 result.Dispose();
142 142
143 return items; 143 return items;
144 } 144 }
145 } 145 }
146 catch (Exception e) 146 catch (Exception e)
147 { 147 {
148 database.Reconnect(); 148 database.Reconnect();
149 Console.WriteLine(e.ToString()); 149 Console.WriteLine(e.ToString());
150 return null; 150 return null;
151 } 151 }
152 } 152 }
153 153
154 /// <summary> 154 /// <summary>
155 /// Returns a list of folders in a users inventory contained within the specified folder 155 /// Returns a list of folders in a users inventory contained within the specified folder
156 /// </summary> 156 /// </summary>
157 /// <param name="parentID">The folder to search</param> 157 /// <param name="parentID">The folder to search</param>
158 /// <returns>A list of inventory folders</returns> 158 /// <returns>A list of inventory folders</returns>
159 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) 159 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
160 { 160 {
161 try 161 try
162 { 162 {
163 lock (database) 163 lock (database)
164 { 164 {
165 Dictionary<string, string> param = new Dictionary<string, string>(); 165 Dictionary<string, string> param = new Dictionary<string, string>();
166 param["?uuid"] = parentID.ToStringHyphenated(); 166 param["?uuid"] = parentID.ToStringHyphenated();
167 167
168 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param); 168 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param);
169 IDataReader reader = result.ExecuteReader(); 169 IDataReader reader = result.ExecuteReader();
170 170
171 List<InventoryFolderBase> items = database.readInventoryFolders(reader); 171 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
172 172
173 reader.Close(); 173 reader.Close();
174 result.Dispose(); 174 result.Dispose();
175 175
176 return items; 176 return items;
177 } 177 }
178 } 178 }
179 catch (Exception e) 179 catch (Exception e)
180 { 180 {
181 database.Reconnect(); 181 database.Reconnect();
182 Console.WriteLine(e.ToString()); 182 Console.WriteLine(e.ToString());
183 return null; 183 return null;
184 } 184 }
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// Returns a specified inventory item 188 /// Returns a specified inventory item
189 /// </summary> 189 /// </summary>
190 /// <param name="item">The item to return</param> 190 /// <param name="item">The item to return</param>
191 /// <returns>An inventory item</returns> 191 /// <returns>An inventory item</returns>
192 public InventoryItemBase getInventoryItem(LLUUID item) 192 public InventoryItemBase getInventoryItem(LLUUID item)
193 { 193 {
194 try 194 try
195 { 195 {
196 lock (database) 196 lock (database)
197 { 197 {
198 Dictionary<string, string> param = new Dictionary<string, string>(); 198 Dictionary<string, string> param = new Dictionary<string, string>();
199 param["?uuid"] = item.ToStringHyphenated(); 199 param["?uuid"] = item.ToStringHyphenated();
200 200
201 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param); 201 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param);
202 IDataReader reader = result.ExecuteReader(); 202 IDataReader reader = result.ExecuteReader();
203 203
204 List<InventoryItemBase> items = database.readInventoryItems(reader); 204 List<InventoryItemBase> items = database.readInventoryItems(reader);
205 205
206 reader.Close(); 206 reader.Close();
207 result.Dispose(); 207 result.Dispose();
208 208
209 if (items.Count > 0) 209 if (items.Count > 0)
210 { 210 {
211 return items[0]; 211 return items[0];
212 } 212 }
213 else 213 else
214 { 214 {
215 return null; 215 return null;
216 } 216 }
217 } 217 }
218 } 218 }
219 catch (Exception e) 219 catch (Exception e)
220 { 220 {
221 database.Reconnect(); 221 database.Reconnect();
222 Console.WriteLine(e.ToString()); 222 Console.WriteLine(e.ToString());
223 return null; 223 return null;
224 } 224 }
225 } 225 }
226 226
227 /// <summary> 227 /// <summary>
228 /// Returns a specified inventory folder 228 /// Returns a specified inventory folder
229 /// </summary> 229 /// </summary>
230 /// <param name="folder">The folder to return</param> 230 /// <param name="folder">The folder to return</param>
231 /// <returns>A folder class</returns> 231 /// <returns>A folder class</returns>
232 public InventoryFolderBase getInventoryFolder(LLUUID folder) 232 public InventoryFolderBase getInventoryFolder(LLUUID folder)
233 { 233 {
234 try 234 try
235 { 235 {
236 lock (database) 236 lock (database)
237 { 237 {
238 Dictionary<string, string> param = new Dictionary<string, string>(); 238 Dictionary<string, string> param = new Dictionary<string, string>();
239 param["?uuid"] = folder.ToStringHyphenated(); 239 param["?uuid"] = folder.ToStringHyphenated();
240 240
241 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param); 241 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param);
242 IDataReader reader = result.ExecuteReader(); 242 IDataReader reader = result.ExecuteReader();
243 243
244 List<InventoryFolderBase> items = database.readInventoryFolders(reader); 244 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
245 245
246 reader.Close(); 246 reader.Close();
247 result.Dispose(); 247 result.Dispose();
248 248
249 if (items.Count > 0) 249 if (items.Count > 0)
250 { 250 {
251 return items[0]; 251 return items[0];
252 } 252 }
253 else 253 else
254 { 254 {
255 return null; 255 return null;
256 } 256 }
257 } 257 }
258 } 258 }
259 catch (Exception e) 259 catch (Exception e)
260 { 260 {
261 database.Reconnect(); 261 database.Reconnect();
262 Console.WriteLine(e.ToString()); 262 Console.WriteLine(e.ToString());
263 return null; 263 return null;
264 } 264 }
265 } 265 }
266 266
267 /// <summary> 267 /// <summary>
268 /// Adds a specified item to the database 268 /// Adds a specified item to the database
269 /// </summary> 269 /// </summary>
270 /// <param name="item">The inventory item</param> 270 /// <param name="item">The inventory item</param>
271 public void addInventoryItem(InventoryItemBase item) 271 public void addInventoryItem(InventoryItemBase item)
272 { 272 {
273 lock (database) 273 lock (database)
274 { 274 {
275 database.insertItem(item); 275 database.insertItem(item);
276 } 276 }
277 } 277 }
278 278
279 /// <summary> 279 /// <summary>
280 /// Updates the specified inventory item 280 /// Updates the specified inventory item
281 /// </summary> 281 /// </summary>
282 /// <param name="item">Inventory item to update</param> 282 /// <param name="item">Inventory item to update</param>
283 public void updateInventoryItem(InventoryItemBase item) 283 public void updateInventoryItem(InventoryItemBase item)
284 { 284 {
285 addInventoryItem(item); 285 addInventoryItem(item);
286 } 286 }
287 287
288 /// <summary> 288 /// <summary>
289 /// Creates a new inventory folder 289 /// Creates a new inventory folder
290 /// </summary> 290 /// </summary>
291 /// <param name="folder">Folder to create</param> 291 /// <param name="folder">Folder to create</param>
292 public void addInventoryFolder(InventoryFolderBase folder) 292 public void addInventoryFolder(InventoryFolderBase folder)
293 { 293 {
294 lock (database) 294 lock (database)
295 { 295 {
296 database.insertFolder(folder); 296 database.insertFolder(folder);
297 } 297 }
298 } 298 }
299 299
300 /// <summary> 300 /// <summary>
301 /// Updates an inventory folder 301 /// Updates an inventory folder
302 /// </summary> 302 /// </summary>
303 /// <param name="folder">Folder to update</param> 303 /// <param name="folder">Folder to update</param>
304 public void updateInventoryFolder(InventoryFolderBase folder) 304 public void updateInventoryFolder(InventoryFolderBase folder)
305 { 305 {
306 addInventoryFolder(folder); 306 addInventoryFolder(folder);
307 } 307 }
308 } 308 }
309} 309}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
index 38f9fd3..2ba9c3d 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
@@ -1,105 +1,105 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29 29
30namespace OpenSim.Framework.Data.MySQL 30namespace OpenSim.Framework.Data.MySQL
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// An interface to the log database for MySQL 33 /// An interface to the log database for MySQL
34 /// </summary> 34 /// </summary>
35 class MySQLLogData : ILogData 35 class MySQLLogData : ILogData
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// The database manager 38 /// The database manager
39 /// </summary> 39 /// </summary>
40 public MySQLManager database; 40 public MySQLManager database;
41 41
42 /// <summary> 42 /// <summary>
43 /// Artificial constructor called when the plugin is loaded 43 /// Artificial constructor called when the plugin is loaded
44 /// </summary> 44 /// </summary>
45 public void Initialise() 45 public void Initialise()
46 { 46 {
47 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 47 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
48 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 48 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
49 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); 49 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
50 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); 50 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
51 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 51 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
52 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 52 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
53 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 53 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
54 54
55 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 55 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
56 } 56 }
57 57
58 /// <summary> 58 /// <summary>
59 /// Saves a log item to the database 59 /// Saves a log item to the database
60 /// </summary> 60 /// </summary>
61 /// <param name="serverDaemon">The daemon triggering the event</param> 61 /// <param name="serverDaemon">The daemon triggering the event</param>
62 /// <param name="target">The target of the action (region / agent UUID, etc)</param> 62 /// <param name="target">The target of the action (region / agent UUID, etc)</param>
63 /// <param name="methodCall">The method call where the problem occured</param> 63 /// <param name="methodCall">The method call where the problem occured</param>
64 /// <param name="arguments">The arguments passed to the method</param> 64 /// <param name="arguments">The arguments passed to the method</param>
65 /// <param name="priority">How critical is this?</param> 65 /// <param name="priority">How critical is this?</param>
66 /// <param name="logMessage">The message to log</param> 66 /// <param name="logMessage">The message to log</param>
67 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 67 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
68 { 68 {
69 try 69 try
70 { 70 {
71 database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage); 71 database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
72 } 72 }
73 catch 73 catch
74 { 74 {
75 database.Reconnect(); 75 database.Reconnect();
76 } 76 }
77 } 77 }
78 78
79 /// <summary> 79 /// <summary>
80 /// Returns the name of this DB provider 80 /// Returns the name of this DB provider
81 /// </summary> 81 /// </summary>
82 /// <returns>A string containing the DB provider name</returns> 82 /// <returns>A string containing the DB provider name</returns>
83 public string getName() 83 public string getName()
84 { 84 {
85 return "MySQL Logdata Interface"; 85 return "MySQL Logdata Interface";
86 } 86 }
87 87
88 /// <summary> 88 /// <summary>
89 /// Closes the database provider 89 /// Closes the database provider
90 /// </summary> 90 /// </summary>
91 public void Close() 91 public void Close()
92 { 92 {
93 // Do nothing. 93 // Do nothing.
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
97 /// Returns the version of this DB provider 97 /// Returns the version of this DB provider
98 /// </summary> 98 /// </summary>
99 /// <returns>A string containing the provider version</returns> 99 /// <returns>A string containing the provider version</returns>
100 public string getVersion() 100 public string getVersion()
101 { 101 {
102 return "0.1"; 102 return "0.1";
103 } 103 }
104 } 104 }
105} 105}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index ab7f277..a5434c8 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -1,606 +1,606 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32using MySql.Data.MySqlClient; 32using MySql.Data.MySqlClient;
33 33
34namespace OpenSim.Framework.Data.MySQL 34namespace OpenSim.Framework.Data.MySQL
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// A MySQL Database manager 37 /// A MySQL Database manager
38 /// </summary> 38 /// </summary>
39 class MySQLManager 39 class MySQLManager
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// The database connection object 42 /// The database connection object
43 /// </summary> 43 /// </summary>
44 IDbConnection dbcon; 44 IDbConnection dbcon;
45 /// <summary> 45 /// <summary>
46 /// Connection string for ADO.net 46 /// Connection string for ADO.net
47 /// </summary> 47 /// </summary>
48 string connectionString; 48 string connectionString;
49 49
50 /// <summary> 50 /// <summary>
51 /// Initialises and creates a new MySQL connection and maintains it. 51 /// Initialises and creates a new MySQL connection and maintains it.
52 /// </summary> 52 /// </summary>
53 /// <param name="hostname">The MySQL server being connected to</param> 53 /// <param name="hostname">The MySQL server being connected to</param>
54 /// <param name="database">The name of the MySQL database being used</param> 54 /// <param name="database">The name of the MySQL database being used</param>
55 /// <param name="username">The username logging into the database</param> 55 /// <param name="username">The username logging into the database</param>
56 /// <param name="password">The password for the user logging in</param> 56 /// <param name="password">The password for the user logging in</param>
57 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> 57 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
58 public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) 58 public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port)
59 { 59 {
60 try 60 try
61 { 61 {
62 connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; 62 connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
63 dbcon = new MySqlConnection(connectionString); 63 dbcon = new MySqlConnection(connectionString);
64 64
65 dbcon.Open(); 65 dbcon.Open();
66 66
67 Console.WriteLine("MySQL connection established"); 67 Console.WriteLine("MySQL connection established");
68 } 68 }
69 catch (Exception e) 69 catch (Exception e)
70 { 70 {
71 throw new Exception("Error initialising MySql Database: " + e.ToString()); 71 throw new Exception("Error initialising MySql Database: " + e.ToString());
72 } 72 }
73 } 73 }
74 74
75 /// <summary> 75 /// <summary>
76 /// Shuts down the database connection 76 /// Shuts down the database connection
77 /// </summary> 77 /// </summary>
78 public void Close() 78 public void Close()
79 { 79 {
80 dbcon.Close(); 80 dbcon.Close();
81 dbcon = null; 81 dbcon = null;
82 } 82 }
83 83
84 /// <summary> 84 /// <summary>
85 /// Reconnects to the database 85 /// Reconnects to the database
86 /// </summary> 86 /// </summary>
87 public void Reconnect() 87 public void Reconnect()
88 { 88 {
89 lock (dbcon) 89 lock (dbcon)
90 { 90 {
91 try 91 try
92 { 92 {
93 // Close the DB connection 93 // Close the DB connection
94 dbcon.Close(); 94 dbcon.Close();
95 // Try reopen it 95 // Try reopen it
96 dbcon = new MySqlConnection(connectionString); 96 dbcon = new MySqlConnection(connectionString);
97 dbcon.Open(); 97 dbcon.Open();
98 } 98 }
99 catch (Exception e) 99 catch (Exception e)
100 { 100 {
101 Console.WriteLine("Unable to reconnect to database " + e.ToString()); 101 Console.WriteLine("Unable to reconnect to database " + e.ToString());
102 } 102 }
103 } 103 }
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// Runs a query with protection against SQL Injection by using parameterised input. 107 /// Runs a query with protection against SQL Injection by using parameterised input.
108 /// </summary> 108 /// </summary>
109 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> 109 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
110 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> 110 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
111 /// <returns>A MySQL DB Command</returns> 111 /// <returns>A MySQL DB Command</returns>
112 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 112 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
113 { 113 {
114 try 114 try
115 { 115 {
116 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 116 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
117 dbcommand.CommandText = sql; 117 dbcommand.CommandText = sql;
118 foreach (KeyValuePair<string, string> param in parameters) 118 foreach (KeyValuePair<string, string> param in parameters)
119 { 119 {
120 dbcommand.Parameters.Add(param.Key, param.Value); 120 dbcommand.Parameters.Add(param.Key, param.Value);
121 } 121 }
122 122
123 return (IDbCommand)dbcommand; 123 return (IDbCommand)dbcommand;
124 } 124 }
125 catch 125 catch
126 { 126 {
127 lock (dbcon) 127 lock (dbcon)
128 { 128 {
129 // Close the DB connection 129 // Close the DB connection
130 try 130 try
131 { 131 {
132 dbcon.Close(); 132 dbcon.Close();
133 } 133 }
134 catch { } 134 catch { }
135 135
136 // Try reopen it 136 // Try reopen it
137 try 137 try
138 { 138 {
139 dbcon = new MySqlConnection(connectionString); 139 dbcon = new MySqlConnection(connectionString);
140 dbcon.Open(); 140 dbcon.Open();
141 } 141 }
142 catch (Exception e) 142 catch (Exception e)
143 { 143 {
144 Console.WriteLine("Unable to reconnect to database " + e.ToString()); 144 Console.WriteLine("Unable to reconnect to database " + e.ToString());
145 } 145 }
146 146
147 // Run the query again 147 // Run the query again
148 try 148 try
149 { 149 {
150 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 150 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
151 dbcommand.CommandText = sql; 151 dbcommand.CommandText = sql;
152 foreach (KeyValuePair<string, string> param in parameters) 152 foreach (KeyValuePair<string, string> param in parameters)
153 { 153 {
154 dbcommand.Parameters.Add(param.Key, param.Value); 154 dbcommand.Parameters.Add(param.Key, param.Value);
155 } 155 }
156 156
157 return (IDbCommand)dbcommand; 157 return (IDbCommand)dbcommand;
158 } 158 }
159 catch (Exception e) 159 catch (Exception e)
160 { 160 {
161 // Return null if it fails. 161 // Return null if it fails.
162 Console.WriteLine("Failed during Query generation: " + e.ToString()); 162 Console.WriteLine("Failed during Query generation: " + e.ToString());
163 return null; 163 return null;
164 } 164 }
165 } 165 }
166 } 166 }
167 } 167 }
168 168
169 /// <summary> 169 /// <summary>
170 /// Reads a region row from a database reader 170 /// Reads a region row from a database reader
171 /// </summary> 171 /// </summary>
172 /// <param name="reader">An active database reader</param> 172 /// <param name="reader">An active database reader</param>
173 /// <returns>A region profile</returns> 173 /// <returns>A region profile</returns>
174 public SimProfileData readSimRow(IDataReader reader) 174 public SimProfileData readSimRow(IDataReader reader)
175 { 175 {
176 SimProfileData retval = new SimProfileData(); 176 SimProfileData retval = new SimProfileData();
177 177
178 if (reader.Read()) 178 if (reader.Read())
179 { 179 {
180 // Region Main 180 // Region Main
181 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); 181 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
182 retval.regionName = (string)reader["regionName"]; 182 retval.regionName = (string)reader["regionName"];
183 retval.UUID = new LLUUID((string)reader["uuid"]); 183 retval.UUID = new LLUUID((string)reader["uuid"]);
184 184
185 // Secrets 185 // Secrets
186 retval.regionRecvKey = (string)reader["regionRecvKey"]; 186 retval.regionRecvKey = (string)reader["regionRecvKey"];
187 retval.regionSecret = (string)reader["regionSecret"]; 187 retval.regionSecret = (string)reader["regionSecret"];
188 retval.regionSendKey = (string)reader["regionSendKey"]; 188 retval.regionSendKey = (string)reader["regionSendKey"];
189 189
190 // Region Server 190 // Region Server
191 retval.regionDataURI = (string)reader["regionDataURI"]; 191 retval.regionDataURI = (string)reader["regionDataURI"];
192 retval.regionOnline = false; // Needs to be pinged before this can be set. 192 retval.regionOnline = false; // Needs to be pinged before this can be set.
193 retval.serverIP = (string)reader["serverIP"]; 193 retval.serverIP = (string)reader["serverIP"];
194 retval.serverPort = (uint)reader["serverPort"]; 194 retval.serverPort = (uint)reader["serverPort"];
195 retval.serverURI = (string)reader["serverURI"]; 195 retval.serverURI = (string)reader["serverURI"];
196 retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); 196 retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
197 retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); 197 retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
198 198
199 // Location 199 // Location
200 retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString()); 200 retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString());
201 retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString()); 201 retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString());
202 retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString()); 202 retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString());
203 203
204 // Neighbours - 0 = No Override 204 // Neighbours - 0 = No Override
205 retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString()); 205 retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString());
206 retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString()); 206 retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString());
207 retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString()); 207 retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString());
208 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); 208 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
209 209
210 // Assets 210 // Assets
211 retval.regionAssetURI = (string)reader["regionAssetURI"]; 211 retval.regionAssetURI = (string)reader["regionAssetURI"];
212 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 212 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
213 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 213 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
214 214
215 // Userserver 215 // Userserver
216 retval.regionUserURI = (string)reader["regionUserURI"]; 216 retval.regionUserURI = (string)reader["regionUserURI"];
217 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 217 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
218 retval.regionUserSendKey = (string)reader["regionUserSendKey"]; 218 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
219 219
220 // World Map Addition 220 // World Map Addition
221 string tempRegionMap = reader["regionMapTexture"].ToString(); 221 string tempRegionMap = reader["regionMapTexture"].ToString();
222 if (tempRegionMap != "") 222 if (tempRegionMap != "")
223 { 223 {
224 retval.regionMapTextureID = new LLUUID(tempRegionMap); 224 retval.regionMapTextureID = new LLUUID(tempRegionMap);
225 } 225 }
226 else 226 else
227 { 227 {
228 retval.regionMapTextureID = new LLUUID(); 228 retval.regionMapTextureID = new LLUUID();
229 } 229 }
230 } 230 }
231 else 231 else
232 { 232 {
233 return null; 233 return null;
234 } 234 }
235 return retval; 235 return retval;
236 } 236 }
237 237
238 /// <summary> 238 /// <summary>
239 /// Reads a reservation row from a database reader 239 /// Reads a reservation row from a database reader
240 /// </summary> 240 /// </summary>
241 /// <param name="reader">An active database reader</param> 241 /// <param name="reader">An active database reader</param>
242 /// <returns>A reservation data object</returns> 242 /// <returns>A reservation data object</returns>
243 public ReservationData readReservationRow(IDataReader reader) 243 public ReservationData readReservationRow(IDataReader reader)
244 { 244 {
245 ReservationData retval = new ReservationData(); 245 ReservationData retval = new ReservationData();
246 if (reader.Read()) 246 if (reader.Read())
247 { 247 {
248 retval.gridRecvKey = (string)reader["gridRecvKey"]; 248 retval.gridRecvKey = (string)reader["gridRecvKey"];
249 retval.gridSendKey = (string)reader["gridSendKey"]; 249 retval.gridSendKey = (string)reader["gridSendKey"];
250 retval.reservationCompany = (string)reader["resCompany"]; 250 retval.reservationCompany = (string)reader["resCompany"];
251 retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); 251 retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString());
252 retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); 252 retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString());
253 retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); 253 retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString());
254 retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); 254 retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString());
255 retval.reservationName = (string)reader["resName"]; 255 retval.reservationName = (string)reader["resName"];
256 retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; 256 retval.status = Convert.ToInt32(reader["status"].ToString()) == 1;
257 retval.userUUID = new LLUUID((string)reader["userUUID"]); 257 retval.userUUID = new LLUUID((string)reader["userUUID"]);
258 258
259 } 259 }
260 else 260 else
261 { 261 {
262 return null; 262 return null;
263 } 263 }
264 return retval; 264 return retval;
265 } 265 }
266 /// <summary> 266 /// <summary>
267 /// Reads an agent row from a database reader 267 /// Reads an agent row from a database reader
268 /// </summary> 268 /// </summary>
269 /// <param name="reader">An active database reader</param> 269 /// <param name="reader">An active database reader</param>
270 /// <returns>A user session agent</returns> 270 /// <returns>A user session agent</returns>
271 public UserAgentData readAgentRow(IDataReader reader) 271 public UserAgentData readAgentRow(IDataReader reader)
272 { 272 {
273 UserAgentData retval = new UserAgentData(); 273 UserAgentData retval = new UserAgentData();
274 274
275 if (reader.Read()) 275 if (reader.Read())
276 { 276 {
277 // Agent IDs 277 // Agent IDs
278 retval.UUID = new LLUUID((string)reader["UUID"]); 278 retval.UUID = new LLUUID((string)reader["UUID"]);
279 retval.sessionID = new LLUUID((string)reader["sessionID"]); 279 retval.sessionID = new LLUUID((string)reader["sessionID"]);
280 retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); 280 retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]);
281 281
282 // Agent Who? 282 // Agent Who?
283 retval.agentIP = (string)reader["agentIP"]; 283 retval.agentIP = (string)reader["agentIP"];
284 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); 284 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
285 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); 285 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
286 286
287 // Login/Logout times (UNIX Epoch) 287 // Login/Logout times (UNIX Epoch)
288 retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString()); 288 retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString());
289 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); 289 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
290 290
291 // Current position 291 // Current position
292 retval.currentRegion = (string)reader["currentRegion"]; 292 retval.currentRegion = (string)reader["currentRegion"];
293 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); 293 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
294 LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); 294 LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
295 } 295 }
296 else 296 else
297 { 297 {
298 return null; 298 return null;
299 } 299 }
300 return retval; 300 return retval;
301 } 301 }
302 302
303 /// <summary> 303 /// <summary>
304 /// Reads a user profile from an active data reader 304 /// Reads a user profile from an active data reader
305 /// </summary> 305 /// </summary>
306 /// <param name="reader">An active database reader</param> 306 /// <param name="reader">An active database reader</param>
307 /// <returns>A user profile</returns> 307 /// <returns>A user profile</returns>
308 public UserProfileData readUserRow(IDataReader reader) 308 public UserProfileData readUserRow(IDataReader reader)
309 { 309 {
310 UserProfileData retval = new UserProfileData(); 310 UserProfileData retval = new UserProfileData();
311 311
312 if (reader.Read()) 312 if (reader.Read())
313 { 313 {
314 retval.UUID = new LLUUID((string)reader["UUID"]); 314 retval.UUID = new LLUUID((string)reader["UUID"]);
315 retval.username = (string)reader["username"]; 315 retval.username = (string)reader["username"];
316 retval.surname = (string)reader["lastname"]; 316 retval.surname = (string)reader["lastname"];
317 317
318 retval.passwordHash = (string)reader["passwordHash"]; 318 retval.passwordHash = (string)reader["passwordHash"];
319 retval.passwordSalt = (string)reader["passwordSalt"]; 319 retval.passwordSalt = (string)reader["passwordSalt"];
320 320
321 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); 321 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
322 retval.homeLocation = new LLVector3( 322 retval.homeLocation = new LLVector3(
323 Convert.ToSingle(reader["homeLocationX"].ToString()), 323 Convert.ToSingle(reader["homeLocationX"].ToString()),
324 Convert.ToSingle(reader["homeLocationY"].ToString()), 324 Convert.ToSingle(reader["homeLocationY"].ToString()),
325 Convert.ToSingle(reader["homeLocationZ"].ToString())); 325 Convert.ToSingle(reader["homeLocationZ"].ToString()));
326 retval.homeLookAt = new LLVector3( 326 retval.homeLookAt = new LLVector3(
327 Convert.ToSingle(reader["homeLookAtX"].ToString()), 327 Convert.ToSingle(reader["homeLookAtX"].ToString()),
328 Convert.ToSingle(reader["homeLookAtY"].ToString()), 328 Convert.ToSingle(reader["homeLookAtY"].ToString()),
329 Convert.ToSingle(reader["homeLookAtZ"].ToString())); 329 Convert.ToSingle(reader["homeLookAtZ"].ToString()));
330 330
331 retval.created = Convert.ToInt32(reader["created"].ToString()); 331 retval.created = Convert.ToInt32(reader["created"].ToString());
332 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); 332 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
333 333
334 retval.userInventoryURI = (string)reader["userInventoryURI"]; 334 retval.userInventoryURI = (string)reader["userInventoryURI"];
335 retval.userAssetURI = (string)reader["userAssetURI"]; 335 retval.userAssetURI = (string)reader["userAssetURI"];
336 336
337 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); 337 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
338 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); 338 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
339 339
340 retval.profileAboutText = (string)reader["profileAboutText"]; 340 retval.profileAboutText = (string)reader["profileAboutText"];
341 retval.profileFirstText = (string)reader["profileFirstText"]; 341 retval.profileFirstText = (string)reader["profileFirstText"];
342 342
343 retval.profileImage = new LLUUID((string)reader["profileImage"]); 343 retval.profileImage = new LLUUID((string)reader["profileImage"]);
344 retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); 344 retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]);
345 345
346 } 346 }
347 else 347 else
348 { 348 {
349 return null; 349 return null;
350 } 350 }
351 return retval; 351 return retval;
352 } 352 }
353 353
354 /// <summary> 354 /// <summary>
355 /// Reads a list of inventory folders returned by a query. 355 /// Reads a list of inventory folders returned by a query.
356 /// </summary> 356 /// </summary>
357 /// <param name="reader">A MySQL Data Reader</param> 357 /// <param name="reader">A MySQL Data Reader</param>
358 /// <returns>A List containing inventory folders</returns> 358 /// <returns>A List containing inventory folders</returns>
359 public List<InventoryFolderBase> readInventoryFolders(IDataReader reader) 359 public List<InventoryFolderBase> readInventoryFolders(IDataReader reader)
360 { 360 {
361 List<InventoryFolderBase> rows = new List<InventoryFolderBase>(); 361 List<InventoryFolderBase> rows = new List<InventoryFolderBase>();
362 362
363 while(reader.Read()) 363 while(reader.Read())
364 { 364 {
365 try 365 try
366 { 366 {
367 InventoryFolderBase folder = new InventoryFolderBase(); 367 InventoryFolderBase folder = new InventoryFolderBase();
368 368
369 folder.agentID = new LLUUID((string)reader["agentID"]); 369 folder.agentID = new LLUUID((string)reader["agentID"]);
370 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 370 folder.parentID = new LLUUID((string)reader["parentFolderID"]);
371 folder.folderID = new LLUUID((string)reader["folderID"]); 371 folder.folderID = new LLUUID((string)reader["folderID"]);
372 folder.name = (string)reader["folderName"]; 372 folder.name = (string)reader["folderName"];
373 373
374 rows.Add(folder); 374 rows.Add(folder);
375 } 375 }
376 catch (Exception e) 376 catch (Exception e)
377 { 377 {
378 Console.WriteLine(e.ToString()); 378 Console.WriteLine(e.ToString());
379 } 379 }
380 } 380 }
381 381
382 return rows; 382 return rows;
383 } 383 }
384 384
385 /// <summary> 385 /// <summary>
386 /// Reads a collection of items from an SQL result 386 /// Reads a collection of items from an SQL result
387 /// </summary> 387 /// </summary>
388 /// <param name="reader">The SQL Result</param> 388 /// <param name="reader">The SQL Result</param>
389 /// <returns>A List containing Inventory Items</returns> 389 /// <returns>A List containing Inventory Items</returns>
390 public List<InventoryItemBase> readInventoryItems(IDataReader reader) 390 public List<InventoryItemBase> readInventoryItems(IDataReader reader)
391 { 391 {
392 List<InventoryItemBase> rows = new List<InventoryItemBase>(); 392 List<InventoryItemBase> rows = new List<InventoryItemBase>();
393 393
394 while (reader.Read()) 394 while (reader.Read())
395 { 395 {
396 try 396 try
397 { 397 {
398 InventoryItemBase item = new InventoryItemBase(); 398 InventoryItemBase item = new InventoryItemBase();
399 399
400 item.assetID = new LLUUID((string)reader["assetID"]); 400 item.assetID = new LLUUID((string)reader["assetID"]);
401 item.avatarID = new LLUUID((string)reader["avatarID"]); 401 item.avatarID = new LLUUID((string)reader["avatarID"]);
402 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString()); 402 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString());
403 item.inventoryDescription = (string)reader["inventoryDescription"]; 403 item.inventoryDescription = (string)reader["inventoryDescription"];
404 item.inventoryID = new LLUUID((string)reader["inventoryID"]); 404 item.inventoryID = new LLUUID((string)reader["inventoryID"]);
405 item.inventoryName = (string)reader["inventoryName"]; 405 item.inventoryName = (string)reader["inventoryName"];
406 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString()); 406 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString());
407 item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); 407 item.parentFolderID = new LLUUID((string)reader["parentFolderID"]);
408 item.type = Convert.ToInt32(reader["type"].ToString()); 408 item.type = Convert.ToInt32(reader["type"].ToString());
409 409
410 rows.Add(item); 410 rows.Add(item);
411 } 411 }
412 catch (Exception e) 412 catch (Exception e)
413 { 413 {
414 Console.WriteLine(e.ToString()); 414 Console.WriteLine(e.ToString());
415 } 415 }
416 } 416 }
417 417
418 return rows; 418 return rows;
419 } 419 }
420 420
421 /// <summary> 421 /// <summary>
422 /// Inserts a new row into the log database 422 /// Inserts a new row into the log database
423 /// </summary> 423 /// </summary>
424 /// <param name="serverDaemon">The daemon which triggered this event</param> 424 /// <param name="serverDaemon">The daemon which triggered this event</param>
425 /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param> 425 /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param>
426 /// <param name="methodCall">The method call where the problem occured</param> 426 /// <param name="methodCall">The method call where the problem occured</param>
427 /// <param name="arguments">The arguments passed to the method</param> 427 /// <param name="arguments">The arguments passed to the method</param>
428 /// <param name="priority">How critical is this?</param> 428 /// <param name="priority">How critical is this?</param>
429 /// <param name="logMessage">Extra message info</param> 429 /// <param name="logMessage">Extra message info</param>
430 /// <returns>Saved successfully?</returns> 430 /// <returns>Saved successfully?</returns>
431 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 431 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
432 { 432 {
433 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; 433 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
434 sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; 434 sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
435 435
436 Dictionary<string, string> parameters = new Dictionary<string, string>(); 436 Dictionary<string, string> parameters = new Dictionary<string, string>();
437 parameters["?server"] = serverDaemon; 437 parameters["?server"] = serverDaemon;
438 parameters["?target"] = target; 438 parameters["?target"] = target;
439 parameters["?method"] = methodCall; 439 parameters["?method"] = methodCall;
440 parameters["?arguments"] = arguments; 440 parameters["?arguments"] = arguments;
441 parameters["?priority"] = priority.ToString(); 441 parameters["?priority"] = priority.ToString();
442 parameters["?message"] = logMessage; 442 parameters["?message"] = logMessage;
443 443
444 bool returnval = false; 444 bool returnval = false;
445 445
446 try 446 try
447 { 447 {
448 IDbCommand result = Query(sql, parameters); 448 IDbCommand result = Query(sql, parameters);
449 449
450 if (result.ExecuteNonQuery() == 1) 450 if (result.ExecuteNonQuery() == 1)
451 returnval = true; 451 returnval = true;
452 452
453 result.Dispose(); 453 result.Dispose();
454 } 454 }
455 catch (Exception e) 455 catch (Exception e)
456 { 456 {
457 Console.WriteLine(e.ToString()); 457 Console.WriteLine(e.ToString());
458 return false; 458 return false;
459 } 459 }
460 460
461 return returnval; 461 return returnval;
462 } 462 }
463 463
464 /// <summary> 464 /// <summary>
465 /// Inserts a new item into the database 465 /// Inserts a new item into the database
466 /// </summary> 466 /// </summary>
467 /// <param name="item">The item</param> 467 /// <param name="item">The item</param>
468 /// <returns>Success?</returns> 468 /// <returns>Success?</returns>
469 public bool insertItem(InventoryItemBase item) 469 public bool insertItem(InventoryItemBase item)
470 { 470 {
471 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES "; 471 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES ";
472 sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)"; 472 sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)";
473 473
474 Dictionary<string, string> parameters = new Dictionary<string, string>(); 474 Dictionary<string, string> parameters = new Dictionary<string, string>();
475 parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated(); 475 parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated();
476 parameters["?assetID"] = item.assetID.ToStringHyphenated(); 476 parameters["?assetID"] = item.assetID.ToStringHyphenated();
477 parameters["?type"] = item.type.ToString(); 477 parameters["?type"] = item.type.ToString();
478 parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated(); 478 parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated();
479 parameters["?avatarID"] = item.avatarID.ToStringHyphenated(); 479 parameters["?avatarID"] = item.avatarID.ToStringHyphenated();
480 parameters["?inventoryName"] = item.inventoryName; 480 parameters["?inventoryName"] = item.inventoryName;
481 parameters["?inventoryDescription"] = item.inventoryDescription; 481 parameters["?inventoryDescription"] = item.inventoryDescription;
482 parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString(); 482 parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString();
483 parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString(); 483 parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString();
484 484
485 bool returnval = false; 485 bool returnval = false;
486 486
487 try 487 try
488 { 488 {
489 IDbCommand result = Query(sql, parameters); 489 IDbCommand result = Query(sql, parameters);
490 490
491 if (result.ExecuteNonQuery() == 1) 491 if (result.ExecuteNonQuery() == 1)
492 returnval = true; 492 returnval = true;
493 493
494 result.Dispose(); 494 result.Dispose();
495 } 495 }
496 catch (Exception e) 496 catch (Exception e)
497 { 497 {
498 Console.WriteLine(e.ToString()); 498 Console.WriteLine(e.ToString());
499 return false; 499 return false;
500 } 500 }
501 501
502 return returnval; 502 return returnval;
503 } 503 }
504 504
505 /// <summary> 505 /// <summary>
506 /// Inserts a new folder into the database 506 /// Inserts a new folder into the database
507 /// </summary> 507 /// </summary>
508 /// <param name="folder">The folder</param> 508 /// <param name="folder">The folder</param>
509 /// <returns>Success?</returns> 509 /// <returns>Success?</returns>
510 public bool insertFolder(InventoryFolderBase folder) 510 public bool insertFolder(InventoryFolderBase folder)
511 { 511 {
512 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; 512 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
513 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; 513 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
514 514
515 Dictionary<string, string> parameters = new Dictionary<string, string>(); 515 Dictionary<string, string> parameters = new Dictionary<string, string>();
516 parameters["?folderID"] = folder.folderID.ToStringHyphenated(); 516 parameters["?folderID"] = folder.folderID.ToStringHyphenated();
517 parameters["?agentID"] = folder.agentID.ToStringHyphenated(); 517 parameters["?agentID"] = folder.agentID.ToStringHyphenated();
518 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); 518 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
519 parameters["?folderName"] = folder.name; 519 parameters["?folderName"] = folder.name;
520 520
521 bool returnval = false; 521 bool returnval = false;
522 try 522 try
523 { 523 {
524 IDbCommand result = Query(sql, parameters); 524 IDbCommand result = Query(sql, parameters);
525 525
526 if (result.ExecuteNonQuery() == 1) 526 if (result.ExecuteNonQuery() == 1)
527 returnval = true; 527 returnval = true;
528 528
529 result.Dispose(); 529 result.Dispose();
530 } 530 }
531 catch (Exception e) 531 catch (Exception e)
532 { 532 {
533 Console.WriteLine(e.ToString()); 533 Console.WriteLine(e.ToString());
534 return false; 534 return false;
535 } 535 }
536 return returnval; 536 return returnval;
537 } 537 }
538 538
539 /// <summary> 539 /// <summary>
540 /// Inserts a new region into the database 540 /// Inserts a new region into the database
541 /// </summary> 541 /// </summary>
542 /// <param name="profile">The region to insert</param> 542 /// <param name="profile">The region to insert</param>
543 /// <returns>Success?</returns> 543 /// <returns>Success?</returns>
544 public bool insertRegion(SimProfileData regiondata) 544 public bool insertRegion(SimProfileData regiondata)
545 { 545 {
546 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 546 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
547 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 547 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
548 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; 548 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES ";
549 549
550 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; 550 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
551 sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; 551 sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
552 sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; 552 sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);";
553 553
554 Dictionary<string, string> parameters = new Dictionary<string, string>(); 554 Dictionary<string, string> parameters = new Dictionary<string, string>();
555 555
556 parameters["?regionHandle"] = regiondata.regionHandle.ToString(); 556 parameters["?regionHandle"] = regiondata.regionHandle.ToString();
557 parameters["?regionName"] = regiondata.regionName.ToString(); 557 parameters["?regionName"] = regiondata.regionName.ToString();
558 parameters["?uuid"] = regiondata.UUID.ToStringHyphenated(); 558 parameters["?uuid"] = regiondata.UUID.ToStringHyphenated();
559 parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString(); 559 parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString();
560 parameters["?regionSecret"] = regiondata.regionSecret.ToString(); 560 parameters["?regionSecret"] = regiondata.regionSecret.ToString();
561 parameters["?regionSendKey"] = regiondata.regionSendKey.ToString(); 561 parameters["?regionSendKey"] = regiondata.regionSendKey.ToString();
562 parameters["?regionDataURI"] = regiondata.regionDataURI.ToString(); 562 parameters["?regionDataURI"] = regiondata.regionDataURI.ToString();
563 parameters["?serverIP"] = regiondata.serverIP.ToString(); 563 parameters["?serverIP"] = regiondata.serverIP.ToString();
564 parameters["?serverPort"] = regiondata.serverPort.ToString(); 564 parameters["?serverPort"] = regiondata.serverPort.ToString();
565 parameters["?serverURI"] = regiondata.serverURI.ToString(); 565 parameters["?serverURI"] = regiondata.serverURI.ToString();
566 parameters["?locX"] = regiondata.regionLocX.ToString(); 566 parameters["?locX"] = regiondata.regionLocX.ToString();
567 parameters["?locY"] = regiondata.regionLocY.ToString(); 567 parameters["?locY"] = regiondata.regionLocY.ToString();
568 parameters["?locZ"] = regiondata.regionLocZ.ToString(); 568 parameters["?locZ"] = regiondata.regionLocZ.ToString();
569 parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString(); 569 parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString();
570 parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString(); 570 parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString();
571 parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString(); 571 parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString();
572 parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString(); 572 parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString();
573 parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString(); 573 parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString();
574 parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString(); 574 parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString();
575 parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString(); 575 parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString();
576 parameters["?regionUserURI"] = regiondata.regionUserURI.ToString(); 576 parameters["?regionUserURI"] = regiondata.regionUserURI.ToString();
577 parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString(); 577 parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString();
578 parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString(); 578 parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString();
579 parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated(); 579 parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated();
580 parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); 580 parameters["?serverHttpPort"] = regiondata.httpPort.ToString();
581 parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); 581 parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString();
582 582
583 bool returnval = false; 583 bool returnval = false;
584 584
585 try 585 try
586 { 586 {
587 587
588 IDbCommand result = Query(sql, parameters); 588 IDbCommand result = Query(sql, parameters);
589 589
590 //Console.WriteLine(result.CommandText); 590 //Console.WriteLine(result.CommandText);
591 591
592 if (result.ExecuteNonQuery() == 1) 592 if (result.ExecuteNonQuery() == 1)
593 returnval = true; 593 returnval = true;
594 594
595 result.Dispose(); 595 result.Dispose();
596 } 596 }
597 catch (Exception e) 597 catch (Exception e)
598 { 598 {
599 Console.WriteLine(e.ToString()); 599 Console.WriteLine(e.ToString());
600 return false; 600 return false;
601 } 601 }
602 602
603 return returnval; 603 return returnval;
604 } 604 }
605 } 605 }
606} 606}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index c116536..b044bdd 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -1,256 +1,256 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32 32
33namespace OpenSim.Framework.Data.MySQL 33namespace OpenSim.Framework.Data.MySQL
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// A database interface class to a user profile storage system 36 /// A database interface class to a user profile storage system
37 /// </summary> 37 /// </summary>
38 class MySQLUserData : IUserData 38 class MySQLUserData : IUserData
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// Database manager for MySQL 41 /// Database manager for MySQL
42 /// </summary> 42 /// </summary>
43 public MySQLManager database; 43 public MySQLManager database;
44 44
45 /// <summary> 45 /// <summary>
46 /// Loads and initialises the MySQL storage plugin 46 /// Loads and initialises the MySQL storage plugin
47 /// </summary> 47 /// </summary>
48 public void Initialise() 48 public void Initialise()
49 { 49 {
50 // Load from an INI file connection details 50 // Load from an INI file connection details
51 // TODO: move this to XML? 51 // TODO: move this to XML?
52 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 52 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
53 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); 53 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
54 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); 54 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
55 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); 55 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
56 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 56 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
57 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 57 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
58 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 58 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
59 59
60 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 60 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Searches the database for a specified user profile 64 /// Searches the database for a specified user profile
65 /// </summary> 65 /// </summary>
66 /// <param name="name">The account name of the user</param> 66 /// <param name="name">The account name of the user</param>
67 /// <returns>A user profile</returns> 67 /// <returns>A user profile</returns>
68 public UserProfileData getUserByName(string name) 68 public UserProfileData getUserByName(string name)
69 { 69 {
70 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); 70 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
74 /// Searches the database for a specified user profile by name components 74 /// Searches the database for a specified user profile by name components
75 /// </summary> 75 /// </summary>
76 /// <param name="user">The first part of the account name</param> 76 /// <param name="user">The first part of the account name</param>
77 /// <param name="last">The second part of the account name</param> 77 /// <param name="last">The second part of the account name</param>
78 /// <returns>A user profile</returns> 78 /// <returns>A user profile</returns>
79 public UserProfileData getUserByName(string user, string last) 79 public UserProfileData getUserByName(string user, string last)
80 { 80 {
81 try 81 try
82 { 82 {
83 lock (database) 83 lock (database)
84 { 84 {
85 Dictionary<string, string> param = new Dictionary<string, string>(); 85 Dictionary<string, string> param = new Dictionary<string, string>();
86 param["?first"] = user; 86 param["?first"] = user;
87 param["?second"] = last; 87 param["?second"] = last;
88 88
89 IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); 89 IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
90 IDataReader reader = result.ExecuteReader(); 90 IDataReader reader = result.ExecuteReader();
91 91
92 UserProfileData row = database.readUserRow(reader); 92 UserProfileData row = database.readUserRow(reader);
93 93
94 reader.Close(); 94 reader.Close();
95 result.Dispose(); 95 result.Dispose();
96 96
97 return row; 97 return row;
98 } 98 }
99 } 99 }
100 catch (Exception e) 100 catch (Exception e)
101 { 101 {
102 database.Reconnect(); 102 database.Reconnect();
103 Console.WriteLine(e.ToString()); 103 Console.WriteLine(e.ToString());
104 return null; 104 return null;
105 } 105 }
106 } 106 }
107 107
108 /// <summary> 108 /// <summary>
109 /// Searches the database for a specified user profile by UUID 109 /// Searches the database for a specified user profile by UUID
110 /// </summary> 110 /// </summary>
111 /// <param name="uuid">The account ID</param> 111 /// <param name="uuid">The account ID</param>
112 /// <returns>The users profile</returns> 112 /// <returns>The users profile</returns>
113 public UserProfileData getUserByUUID(LLUUID uuid) 113 public UserProfileData getUserByUUID(LLUUID uuid)
114 { 114 {
115 try 115 try
116 { 116 {
117 lock (database) 117 lock (database)
118 { 118 {
119 Dictionary<string, string> param = new Dictionary<string, string>(); 119 Dictionary<string, string> param = new Dictionary<string, string>();
120 param["?uuid"] = uuid.ToStringHyphenated(); 120 param["?uuid"] = uuid.ToStringHyphenated();
121 121
122 IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); 122 IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
123 IDataReader reader = result.ExecuteReader(); 123 IDataReader reader = result.ExecuteReader();
124 124
125 UserProfileData row = database.readUserRow(reader); 125 UserProfileData row = database.readUserRow(reader);
126 126
127 reader.Close(); 127 reader.Close();
128 result.Dispose(); 128 result.Dispose();
129 129
130 return row; 130 return row;
131 } 131 }
132 } 132 }
133 catch (Exception e) 133 catch (Exception e)
134 { 134 {
135 database.Reconnect(); 135 database.Reconnect();
136 Console.WriteLine(e.ToString()); 136 Console.WriteLine(e.ToString());
137 return null; 137 return null;
138 } 138 }
139 } 139 }
140 140
141 /// <summary> 141 /// <summary>
142 /// Returns a user session searching by name 142 /// Returns a user session searching by name
143 /// </summary> 143 /// </summary>
144 /// <param name="name">The account name</param> 144 /// <param name="name">The account name</param>
145 /// <returns>The users session</returns> 145 /// <returns>The users session</returns>
146 public UserAgentData getAgentByName(string name) 146 public UserAgentData getAgentByName(string name)
147 { 147 {
148 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); 148 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
149 } 149 }
150 150
151 /// <summary> 151 /// <summary>
152 /// Returns a user session by account name 152 /// Returns a user session by account name
153 /// </summary> 153 /// </summary>
154 /// <param name="user">First part of the users account name</param> 154 /// <param name="user">First part of the users account name</param>
155 /// <param name="last">Second part of the users account name</param> 155 /// <param name="last">Second part of the users account name</param>
156 /// <returns>The users session</returns> 156 /// <returns>The users session</returns>
157 public UserAgentData getAgentByName(string user, string last) 157 public UserAgentData getAgentByName(string user, string last)
158 { 158 {
159 UserProfileData profile = getUserByName(user, last); 159 UserProfileData profile = getUserByName(user, last);
160 return getAgentByUUID(profile.UUID); 160 return getAgentByUUID(profile.UUID);
161 } 161 }
162 162
163 /// <summary> 163 /// <summary>
164 /// Returns an agent session by account UUID 164 /// Returns an agent session by account UUID
165 /// </summary> 165 /// </summary>
166 /// <param name="uuid">The accounts UUID</param> 166 /// <param name="uuid">The accounts UUID</param>
167 /// <returns>The users session</returns> 167 /// <returns>The users session</returns>
168 public UserAgentData getAgentByUUID(LLUUID uuid) 168 public UserAgentData getAgentByUUID(LLUUID uuid)
169 { 169 {
170 try 170 try
171 { 171 {
172 lock (database) 172 lock (database)
173 { 173 {
174 Dictionary<string, string> param = new Dictionary<string, string>(); 174 Dictionary<string, string> param = new Dictionary<string, string>();
175 param["?uuid"] = uuid.ToStringHyphenated(); 175 param["?uuid"] = uuid.ToStringHyphenated();
176 176
177 IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); 177 IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
178 IDataReader reader = result.ExecuteReader(); 178 IDataReader reader = result.ExecuteReader();
179 179
180 UserAgentData row = database.readAgentRow(reader); 180 UserAgentData row = database.readAgentRow(reader);
181 181
182 reader.Close(); 182 reader.Close();
183 result.Dispose(); 183 result.Dispose();
184 184
185 return row; 185 return row;
186 } 186 }
187 } 187 }
188 catch (Exception e) 188 catch (Exception e)
189 { 189 {
190 database.Reconnect(); 190 database.Reconnect();
191 Console.WriteLine(e.ToString()); 191 Console.WriteLine(e.ToString());
192 return null; 192 return null;
193 } 193 }
194 } 194 }
195 195
196 /// <summary> 196 /// <summary>
197 /// Creates a new users profile 197 /// Creates a new users profile
198 /// </summary> 198 /// </summary>
199 /// <param name="user">The user profile to create</param> 199 /// <param name="user">The user profile to create</param>
200 public void addNewUserProfile(UserProfileData user) 200 public void addNewUserProfile(UserProfileData user)
201 { 201 {
202 } 202 }
203 203
204 /// <summary> 204 /// <summary>
205 /// Creates a new agent 205 /// Creates a new agent
206 /// </summary> 206 /// </summary>
207 /// <param name="agent">The agent to create</param> 207 /// <param name="agent">The agent to create</param>
208 public void addNewUserAgent(UserAgentData agent) 208 public void addNewUserAgent(UserAgentData agent)
209 { 209 {
210 // Do nothing. 210 // Do nothing.
211 } 211 }
212 212
213 /// <summary> 213 /// <summary>
214 /// Performs a money transfer request between two accounts 214 /// Performs a money transfer request between two accounts
215 /// </summary> 215 /// </summary>
216 /// <param name="from">The senders account ID</param> 216 /// <param name="from">The senders account ID</param>
217 /// <param name="to">The recievers account ID</param> 217 /// <param name="to">The recievers account ID</param>
218 /// <param name="amount">The amount to transfer</param> 218 /// <param name="amount">The amount to transfer</param>
219 /// <returns>Success?</returns> 219 /// <returns>Success?</returns>
220 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) 220 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
221 { 221 {
222 return false; 222 return false;
223 } 223 }
224 224
225 /// <summary> 225 /// <summary>
226 /// Performs an inventory transfer request between two accounts 226 /// Performs an inventory transfer request between two accounts
227 /// </summary> 227 /// </summary>
228 /// <remarks>TODO: Move to inventory server</remarks> 228 /// <remarks>TODO: Move to inventory server</remarks>
229 /// <param name="from">The senders account ID</param> 229 /// <param name="from">The senders account ID</param>
230 /// <param name="to">The recievers account ID</param> 230 /// <param name="to">The recievers account ID</param>
231 /// <param name="item">The item to transfer</param> 231 /// <param name="item">The item to transfer</param>
232 /// <returns>Success?</returns> 232 /// <returns>Success?</returns>
233 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) 233 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
234 { 234 {
235 return false; 235 return false;
236 } 236 }
237 237
238 /// <summary> 238 /// <summary>
239 /// Database provider name 239 /// Database provider name
240 /// </summary> 240 /// </summary>
241 /// <returns>Provider name</returns> 241 /// <returns>Provider name</returns>
242 public string getName() 242 public string getName()
243 { 243 {
244 return "MySQL Userdata Interface"; 244 return "MySQL Userdata Interface";
245 } 245 }
246 246
247 /// <summary> 247 /// <summary>
248 /// Database provider version 248 /// Database provider version
249 /// </summary> 249 /// </summary>
250 /// <returns>provider version</returns> 250 /// <returns>provider version</returns>
251 public string getVersion() 251 public string getVersion()
252 { 252 {
253 return "0.1"; 253 return "0.1";
254 } 254 }
255 } 255 }
256} 256}
diff --git a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs
index 52d6a54..46c0ae0 100644
--- a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")] 6[assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] 10[assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] 21[assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs
index 9de5edb..8136bc1 100644
--- a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")] 6[assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] 10[assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] 21[assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
index 511c5f0..c1d74ae 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
@@ -1,197 +1,197 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Security.Cryptography; 31using System.Security.Cryptography;
32using System.Text; 32using System.Text;
33using libsecondlife; 33using libsecondlife;
34 34
35namespace OpenSim.Framework.Data.SQLite 35namespace OpenSim.Framework.Data.SQLite
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// A Grid Interface to the SQLite database 38 /// A Grid Interface to the SQLite database
39 /// </summary> 39 /// </summary>
40 public class SQLiteGridData : IGridData 40 public class SQLiteGridData : IGridData
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// A database manager 43 /// A database manager
44 /// </summary> 44 /// </summary>
45 private SQLiteManager database; 45 private SQLiteManager database;
46 46
47 /// <summary> 47 /// <summary>
48 /// Initialises the Grid Interface 48 /// Initialises the Grid Interface
49 /// </summary> 49 /// </summary>
50 public void Initialise() 50 public void Initialise()
51 { 51 {
52 database = new SQLiteManager("localhost", "db", "user", "password", "false"); 52 database = new SQLiteManager("localhost", "db", "user", "password", "false");
53 } 53 }
54 54
55 /// <summary> 55 /// <summary>
56 /// Shuts down the grid interface 56 /// Shuts down the grid interface
57 /// </summary> 57 /// </summary>
58 public void Close() 58 public void Close()
59 { 59 {
60 database.Close(); 60 database.Close();
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Returns the name of this grid interface 64 /// Returns the name of this grid interface
65 /// </summary> 65 /// </summary>
66 /// <returns>A string containing the grid interface</returns> 66 /// <returns>A string containing the grid interface</returns>
67 public string getName() 67 public string getName()
68 { 68 {
69 return "SQLite OpenGridData"; 69 return "SQLite OpenGridData";
70 } 70 }
71 71
72 /// <summary> 72 /// <summary>
73 /// Returns the version of this grid interface 73 /// Returns the version of this grid interface
74 /// </summary> 74 /// </summary>
75 /// <returns>A string containing the version</returns> 75 /// <returns>A string containing the version</returns>
76 public string getVersion() 76 public string getVersion()
77 { 77 {
78 return "0.1"; 78 return "0.1";
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Returns a list of regions within the specified ranges 82 /// Returns a list of regions within the specified ranges
83 /// </summary> 83 /// </summary>
84 /// <param name="a">minimum X coordinate</param> 84 /// <param name="a">minimum X coordinate</param>
85 /// <param name="b">minimum Y coordinate</param> 85 /// <param name="b">minimum Y coordinate</param>
86 /// <param name="c">maximum X coordinate</param> 86 /// <param name="c">maximum X coordinate</param>
87 /// <param name="d">maximum Y coordinate</param> 87 /// <param name="d">maximum Y coordinate</param>
88 /// <returns>An array of region profiles</returns> 88 /// <returns>An array of region profiles</returns>
89 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) 89 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
90 { 90 {
91 return null; 91 return null;
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
95 /// Returns a sim profile from it's location 95 /// Returns a sim profile from it's location
96 /// </summary> 96 /// </summary>
97 /// <param name="handle">Region location handle</param> 97 /// <param name="handle">Region location handle</param>
98 /// <returns>Sim profile</returns> 98 /// <returns>Sim profile</returns>
99 public SimProfileData GetProfileByHandle(ulong handle) 99 public SimProfileData GetProfileByHandle(ulong handle)
100 { 100 {
101 Dictionary<string, string> param = new Dictionary<string, string>(); 101 Dictionary<string, string> param = new Dictionary<string, string>();
102 param["handle"] = handle.ToString(); 102 param["handle"] = handle.ToString();
103 103
104 IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); 104 IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param);
105 IDataReader reader = result.ExecuteReader(); 105 IDataReader reader = result.ExecuteReader();
106 106
107 SimProfileData row = database.getRow(reader); 107 SimProfileData row = database.getRow(reader);
108 reader.Close(); 108 reader.Close();
109 result.Dispose(); 109 result.Dispose();
110 110
111 return row; 111 return row;
112 } 112 }
113 113
114 /// <summary> 114 /// <summary>
115 /// Returns a sim profile from it's UUID 115 /// Returns a sim profile from it's UUID
116 /// </summary> 116 /// </summary>
117 /// <param name="uuid">The region UUID</param> 117 /// <param name="uuid">The region UUID</param>
118 /// <returns>The sim profile</returns> 118 /// <returns>The sim profile</returns>
119 public SimProfileData GetProfileByLLUUID(LLUUID uuid) 119 public SimProfileData GetProfileByLLUUID(LLUUID uuid)
120 { 120 {
121 Dictionary<string, string> param = new Dictionary<string, string>(); 121 Dictionary<string, string> param = new Dictionary<string, string>();
122 param["uuid"] = uuid.ToStringHyphenated(); 122 param["uuid"] = uuid.ToStringHyphenated();
123 123
124 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); 124 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
125 IDataReader reader = result.ExecuteReader(); 125 IDataReader reader = result.ExecuteReader();
126 126
127 SimProfileData row = database.getRow(reader); 127 SimProfileData row = database.getRow(reader);
128 reader.Close(); 128 reader.Close();
129 result.Dispose(); 129 result.Dispose();
130 130
131 return row; 131 return row;
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Adds a new specified region to the database 135 /// Adds a new specified region to the database
136 /// </summary> 136 /// </summary>
137 /// <param name="profile">The profile to add</param> 137 /// <param name="profile">The profile to add</param>
138 /// <returns>A dataresponse enum indicating success</returns> 138 /// <returns>A dataresponse enum indicating success</returns>
139 public DataResponse AddProfile(SimProfileData profile) 139 public DataResponse AddProfile(SimProfileData profile)
140 { 140 {
141 if (database.insertRow(profile)) 141 if (database.insertRow(profile))
142 { 142 {
143 return DataResponse.RESPONSE_OK; 143 return DataResponse.RESPONSE_OK;
144 } 144 }
145 else 145 else
146 { 146 {
147 return DataResponse.RESPONSE_ERROR; 147 return DataResponse.RESPONSE_ERROR;
148 } 148 }
149 } 149 }
150 150
151 /// <summary> 151 /// <summary>
152 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. 152 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
153 /// </summary> 153 /// </summary>
154 /// <param name="uuid">The UUID of the challenger</param> 154 /// <param name="uuid">The UUID of the challenger</param>
155 /// <param name="handle">The attempted regionHandle of the challenger</param> 155 /// <param name="handle">The attempted regionHandle of the challenger</param>
156 /// <param name="authkey">The secret</param> 156 /// <param name="authkey">The secret</param>
157 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> 157 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
158 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) 158 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
159 { 159 {
160 bool throwHissyFit = false; // Should be true by 1.0 160 bool throwHissyFit = false; // Should be true by 1.0
161 161
162 if (throwHissyFit) 162 if (throwHissyFit)
163 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); 163 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
164 164
165 SimProfileData data = GetProfileByLLUUID(uuid); 165 SimProfileData data = GetProfileByLLUUID(uuid);
166 166
167 return (handle == data.regionHandle && authkey == data.regionSecret); 167 return (handle == data.regionHandle && authkey == data.regionSecret);
168 } 168 }
169 169
170 /// <summary> 170 /// <summary>
171 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region 171 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
172 /// </summary> 172 /// </summary>
173 /// <remarks>This requires a security audit.</remarks> 173 /// <remarks>This requires a security audit.</remarks>
174 /// <param name="uuid"></param> 174 /// <param name="uuid"></param>
175 /// <param name="handle"></param> 175 /// <param name="handle"></param>
176 /// <param name="authhash"></param> 176 /// <param name="authhash"></param>
177 /// <param name="challenge"></param> 177 /// <param name="challenge"></param>
178 /// <returns></returns> 178 /// <returns></returns>
179 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) 179 public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
180 { 180 {
181 SHA512Managed HashProvider = new SHA512Managed(); 181 SHA512Managed HashProvider = new SHA512Managed();
182 ASCIIEncoding TextProvider = new ASCIIEncoding(); 182 ASCIIEncoding TextProvider = new ASCIIEncoding();
183 183
184 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); 184 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
185 byte[] hash = HashProvider.ComputeHash(stream); 185 byte[] hash = HashProvider.ComputeHash(stream);
186 186
187 return false; 187 return false;
188 } 188 }
189 189
190 public ReservationData GetReservationAtPoint(uint x, uint y) 190 public ReservationData GetReservationAtPoint(uint x, uint y)
191 { 191 {
192 return null; 192 return null;
193 } 193 }
194 } 194 }
195 195
196 196
197} 197}
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
index c9931ab..a69611a 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
@@ -1,206 +1,206 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Data.SQLite; 31using System.Data.SQLite;
32using libsecondlife; 32using libsecondlife;
33 33
34namespace OpenSim.Framework.Data.SQLite 34namespace OpenSim.Framework.Data.SQLite
35{ 35{
36 class SQLiteManager 36 class SQLiteManager
37 { 37 {
38 IDbConnection dbcon; 38 IDbConnection dbcon;
39 39
40 /// <summary> 40 /// <summary>
41 /// Initialises and creates a new SQLite connection and maintains it. 41 /// Initialises and creates a new SQLite connection and maintains it.
42 /// </summary> 42 /// </summary>
43 /// <param name="hostname">The SQLite server being connected to</param> 43 /// <param name="hostname">The SQLite server being connected to</param>
44 /// <param name="database">The name of the SQLite database being used</param> 44 /// <param name="database">The name of the SQLite database being used</param>
45 /// <param name="username">The username logging into the database</param> 45 /// <param name="username">The username logging into the database</param>
46 /// <param name="password">The password for the user logging in</param> 46 /// <param name="password">The password for the user logging in</param>
47 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> 47 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
48 public SQLiteManager(string hostname, string database, string username, string password, string cpooling) 48 public SQLiteManager(string hostname, string database, string username, string password, string cpooling)
49 { 49 {
50 try 50 try
51 { 51 {
52 string connectionString = "URI=file:GridServerSqlite.db;"; 52 string connectionString = "URI=file:GridServerSqlite.db;";
53 dbcon = new SQLiteConnection(connectionString); 53 dbcon = new SQLiteConnection(connectionString);
54 54
55 dbcon.Open(); 55 dbcon.Open();
56 } 56 }
57 catch (Exception e) 57 catch (Exception e)
58 { 58 {
59 throw new Exception("Error initialising SQLite Database: " + e.ToString()); 59 throw new Exception("Error initialising SQLite Database: " + e.ToString());
60 } 60 }
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Shuts down the database connection 64 /// Shuts down the database connection
65 /// </summary> 65 /// </summary>
66 public void Close() 66 public void Close()
67 { 67 {
68 dbcon.Close(); 68 dbcon.Close();
69 dbcon = null; 69 dbcon = null;
70 } 70 }
71 71
72 /// <summary> 72 /// <summary>
73 /// Runs a query with protection against SQL Injection by using parameterised input. 73 /// Runs a query with protection against SQL Injection by using parameterised input.
74 /// </summary> 74 /// </summary>
75 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> 75 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
76 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> 76 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
77 /// <returns>A SQLite DB Command</returns> 77 /// <returns>A SQLite DB Command</returns>
78 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 78 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
79 { 79 {
80 SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); 80 SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand();
81 dbcommand.CommandText = sql; 81 dbcommand.CommandText = sql;
82 foreach (KeyValuePair<string, string> param in parameters) 82 foreach (KeyValuePair<string, string> param in parameters)
83 { 83 {
84 SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); 84 SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value);
85 dbcommand.Parameters.Add(paramx); 85 dbcommand.Parameters.Add(paramx);
86 } 86 }
87 87
88 return (IDbCommand)dbcommand; 88 return (IDbCommand)dbcommand;
89 } 89 }
90 90
91 /// <summary> 91 /// <summary>
92 /// Reads a region row from a database reader 92 /// Reads a region row from a database reader
93 /// </summary> 93 /// </summary>
94 /// <param name="reader">An active database reader</param> 94 /// <param name="reader">An active database reader</param>
95 /// <returns>A region profile</returns> 95 /// <returns>A region profile</returns>
96 public SimProfileData getRow(IDataReader reader) 96 public SimProfileData getRow(IDataReader reader)
97 { 97 {
98 SimProfileData retval = new SimProfileData(); 98 SimProfileData retval = new SimProfileData();
99 99
100 if (reader.Read()) 100 if (reader.Read())
101 { 101 {
102 // Region Main 102 // Region Main
103 retval.regionHandle = (ulong)reader["regionHandle"]; 103 retval.regionHandle = (ulong)reader["regionHandle"];
104 retval.regionName = (string)reader["regionName"]; 104 retval.regionName = (string)reader["regionName"];
105 retval.UUID = new LLUUID((string)reader["uuid"]); 105 retval.UUID = new LLUUID((string)reader["uuid"]);
106 106
107 // Secrets 107 // Secrets
108 retval.regionRecvKey = (string)reader["regionRecvKey"]; 108 retval.regionRecvKey = (string)reader["regionRecvKey"];
109 retval.regionSecret = (string)reader["regionSecret"]; 109 retval.regionSecret = (string)reader["regionSecret"];
110 retval.regionSendKey = (string)reader["regionSendKey"]; 110 retval.regionSendKey = (string)reader["regionSendKey"];
111 111
112 // Region Server 112 // Region Server
113 retval.regionDataURI = (string)reader["regionDataURI"]; 113 retval.regionDataURI = (string)reader["regionDataURI"];
114 retval.regionOnline = false; // Needs to be pinged before this can be set. 114 retval.regionOnline = false; // Needs to be pinged before this can be set.
115 retval.serverIP = (string)reader["serverIP"]; 115 retval.serverIP = (string)reader["serverIP"];
116 retval.serverPort = (uint)reader["serverPort"]; 116 retval.serverPort = (uint)reader["serverPort"];
117 retval.serverURI = (string)reader["serverURI"]; 117 retval.serverURI = (string)reader["serverURI"];
118 118
119 // Location 119 // Location
120 retval.regionLocX = (uint)((int)reader["locX"]); 120 retval.regionLocX = (uint)((int)reader["locX"]);
121 retval.regionLocY = (uint)((int)reader["locY"]); 121 retval.regionLocY = (uint)((int)reader["locY"]);
122 retval.regionLocZ = (uint)((int)reader["locZ"]); 122 retval.regionLocZ = (uint)((int)reader["locZ"]);
123 123
124 // Neighbours - 0 = No Override 124 // Neighbours - 0 = No Override
125 retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; 125 retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"];
126 retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; 126 retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"];
127 retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; 127 retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"];
128 retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; 128 retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"];
129 129
130 // Assets 130 // Assets
131 retval.regionAssetURI = (string)reader["regionAssetURI"]; 131 retval.regionAssetURI = (string)reader["regionAssetURI"];
132 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 132 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
133 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 133 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
134 134
135 // Userserver 135 // Userserver
136 retval.regionUserURI = (string)reader["regionUserURI"]; 136 retval.regionUserURI = (string)reader["regionUserURI"];
137 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 137 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
138 retval.regionUserSendKey = (string)reader["regionUserSendKey"]; 138 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
139 } 139 }
140 else 140 else
141 { 141 {
142 throw new Exception("No rows to return"); 142 throw new Exception("No rows to return");
143 } 143 }
144 return retval; 144 return retval;
145 } 145 }
146 146
147 /// <summary> 147 /// <summary>
148 /// Inserts a new region into the database 148 /// Inserts a new region into the database
149 /// </summary> 149 /// </summary>
150 /// <param name="profile">The region to insert</param> 150 /// <param name="profile">The region to insert</param>
151 /// <returns>Success?</returns> 151 /// <returns>Success?</returns>
152 public bool insertRow(SimProfileData profile) 152 public bool insertRow(SimProfileData profile)
153 { 153 {
154 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 154 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
155 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 155 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
156 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; 156 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
157 157
158 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 158 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
159 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 159 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
160 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; 160 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
161 161
162 Dictionary<string, string> parameters = new Dictionary<string, string>(); 162 Dictionary<string, string> parameters = new Dictionary<string, string>();
163 163
164 parameters["regionHandle"] = profile.regionHandle.ToString(); 164 parameters["regionHandle"] = profile.regionHandle.ToString();
165 parameters["regionName"] = profile.regionName; 165 parameters["regionName"] = profile.regionName;
166 parameters["uuid"] = profile.UUID.ToString(); 166 parameters["uuid"] = profile.UUID.ToString();
167 parameters["regionRecvKey"] = profile.regionRecvKey; 167 parameters["regionRecvKey"] = profile.regionRecvKey;
168 parameters["regionSendKey"] = profile.regionSendKey; 168 parameters["regionSendKey"] = profile.regionSendKey;
169 parameters["regionDataURI"] = profile.regionDataURI; 169 parameters["regionDataURI"] = profile.regionDataURI;
170 parameters["serverIP"] = profile.serverIP; 170 parameters["serverIP"] = profile.serverIP;
171 parameters["serverPort"] = profile.serverPort.ToString(); 171 parameters["serverPort"] = profile.serverPort.ToString();
172 parameters["serverURI"] = profile.serverURI; 172 parameters["serverURI"] = profile.serverURI;
173 parameters["locX"] = profile.regionLocX.ToString(); 173 parameters["locX"] = profile.regionLocX.ToString();
174 parameters["locY"] = profile.regionLocY.ToString(); 174 parameters["locY"] = profile.regionLocY.ToString();
175 parameters["locZ"] = profile.regionLocZ.ToString(); 175 parameters["locZ"] = profile.regionLocZ.ToString();
176 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); 176 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
177 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); 177 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
178 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); 178 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
179 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); 179 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
180 parameters["regionAssetURI"] = profile.regionAssetURI; 180 parameters["regionAssetURI"] = profile.regionAssetURI;
181 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; 181 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
182 parameters["regionAssetSendKey"] = profile.regionAssetSendKey; 182 parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
183 parameters["regionUserURI"] = profile.regionUserURI; 183 parameters["regionUserURI"] = profile.regionUserURI;
184 parameters["regionUserRecvKey"] = profile.regionUserRecvKey; 184 parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
185 parameters["regionUserSendKey"] = profile.regionUserSendKey; 185 parameters["regionUserSendKey"] = profile.regionUserSendKey;
186 186
187 bool returnval = false; 187 bool returnval = false;
188 188
189 try 189 try
190 { 190 {
191 IDbCommand result = Query(sql, parameters); 191 IDbCommand result = Query(sql, parameters);
192 192
193 if (result.ExecuteNonQuery() == 1) 193 if (result.ExecuteNonQuery() == 1)
194 returnval = true; 194 returnval = true;
195 195
196 result.Dispose(); 196 result.Dispose();
197 } 197 }
198 catch (Exception) 198 catch (Exception)
199 { 199 {
200 return false; 200 return false;
201 } 201 }
202 202
203 return returnval; 203 return returnval;
204 } 204 }
205 } 205 }
206} 206}
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
index 5a17d20..c96353b 100644
--- a/OpenSim/Framework/Data/GridData.cs
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -1,111 +1,111 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Data 30namespace OpenSim.Framework.Data
31{ 31{
32 public enum DataResponse 32 public enum DataResponse
33 { 33 {
34 RESPONSE_OK, 34 RESPONSE_OK,
35 RESPONSE_AUTHREQUIRED, 35 RESPONSE_AUTHREQUIRED,
36 RESPONSE_INVALIDCREDENTIALS, 36 RESPONSE_INVALIDCREDENTIALS,
37 RESPONSE_ERROR 37 RESPONSE_ERROR
38 } 38 }
39 39
40 /// <summary> 40 /// <summary>
41 /// A standard grid interface 41 /// A standard grid interface
42 /// </summary> 42 /// </summary>
43 public interface IGridData 43 public interface IGridData
44 { 44 {
45 /// <summary> 45 /// <summary>
46 /// Returns a sim profile from a regionHandle 46 /// Returns a sim profile from a regionHandle
47 /// </summary> 47 /// </summary>
48 /// <param name="regionHandle">A 64bit Region Handle</param> 48 /// <param name="regionHandle">A 64bit Region Handle</param>
49 /// <returns>A simprofile</returns> 49 /// <returns>A simprofile</returns>
50 SimProfileData GetProfileByHandle(ulong regionHandle); 50 SimProfileData GetProfileByHandle(ulong regionHandle);
51 51
52 /// <summary> 52 /// <summary>
53 /// Returns a sim profile from a UUID 53 /// Returns a sim profile from a UUID
54 /// </summary> 54 /// </summary>
55 /// <param name="UUID">A 128bit UUID</param> 55 /// <param name="UUID">A 128bit UUID</param>
56 /// <returns>A sim profile</returns> 56 /// <returns>A sim profile</returns>
57 SimProfileData GetProfileByLLUUID(LLUUID UUID); 57 SimProfileData GetProfileByLLUUID(LLUUID UUID);
58 58
59 /// <summary> 59 /// <summary>
60 /// Returns all profiles within the specified range 60 /// Returns all profiles within the specified range
61 /// </summary> 61 /// </summary>
62 /// <param name="Xmin">Minimum sim coordinate (X)</param> 62 /// <param name="Xmin">Minimum sim coordinate (X)</param>
63 /// <param name="Ymin">Minimum sim coordinate (Y)</param> 63 /// <param name="Ymin">Minimum sim coordinate (Y)</param>
64 /// <param name="Xmax">Maximum sim coordinate (X)</param> 64 /// <param name="Xmax">Maximum sim coordinate (X)</param>
65 /// <param name="Ymin">Maximum sim coordinate (Y)</param> 65 /// <param name="Ymin">Maximum sim coordinate (Y)</param>
66 /// <returns>An array containing all the sim profiles in the specified range</returns> 66 /// <returns>An array containing all the sim profiles in the specified range</returns>
67 SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 67 SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
68 68
69 /// <summary> 69 /// <summary>
70 /// Authenticates a sim by use of it's recv key. 70 /// Authenticates a sim by use of it's recv key.
71 /// WARNING: Insecure 71 /// WARNING: Insecure
72 /// </summary> 72 /// </summary>
73 /// <param name="UUID">The UUID sent by the sim</param> 73 /// <param name="UUID">The UUID sent by the sim</param>
74 /// <param name="regionHandle">The regionhandle sent by the sim</param> 74 /// <param name="regionHandle">The regionhandle sent by the sim</param>
75 /// <param name="simrecvkey">The recieving key sent by the sim</param> 75 /// <param name="simrecvkey">The recieving key sent by the sim</param>
76 /// <returns>Whether the sim has been authenticated</returns> 76 /// <returns>Whether the sim has been authenticated</returns>
77 bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey); 77 bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
78 78
79 /// <summary> 79 /// <summary>
80 /// Initialises the interface 80 /// Initialises the interface
81 /// </summary> 81 /// </summary>
82 void Initialise(); 82 void Initialise();
83 83
84 /// <summary> 84 /// <summary>
85 /// Closes the interface 85 /// Closes the interface
86 /// </summary> 86 /// </summary>
87 void Close(); 87 void Close();
88 88
89 /// <summary> 89 /// <summary>
90 /// The plugin being loaded 90 /// The plugin being loaded
91 /// </summary> 91 /// </summary>
92 /// <returns>A string containing the plugin name</returns> 92 /// <returns>A string containing the plugin name</returns>
93 string getName(); 93 string getName();
94 94
95 /// <summary> 95 /// <summary>
96 /// The plugins version 96 /// The plugins version
97 /// </summary> 97 /// </summary>
98 /// <returns>A string containing the plugin version</returns> 98 /// <returns>A string containing the plugin version</returns>
99 string getVersion(); 99 string getVersion();
100 100
101 /// <summary> 101 /// <summary>
102 /// Adds a new profile to the database 102 /// Adds a new profile to the database
103 /// </summary> 103 /// </summary>
104 /// <param name="profile">The profile to add</param> 104 /// <param name="profile">The profile to add</param>
105 /// <returns>RESPONSE_OK if successful, error if not.</returns> 105 /// <returns>RESPONSE_OK if successful, error if not.</returns>
106 DataResponse AddProfile(SimProfileData profile); 106 DataResponse AddProfile(SimProfileData profile);
107 107
108 ReservationData GetReservationAtPoint(uint x, uint y); 108 ReservationData GetReservationAtPoint(uint x, uint y);
109 109
110 } 110 }
111} 111}
diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs
index 059fef5..a827c0c 100644
--- a/OpenSim/Framework/Data/ILogData.cs
+++ b/OpenSim/Framework/Data/ILogData.cs
@@ -1,90 +1,90 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Data 28namespace OpenSim.Framework.Data
29{ 29{
30 /// <summary> 30 /// <summary>
31 /// The severity of an individual log message 31 /// The severity of an individual log message
32 /// </summary> 32 /// </summary>
33 public enum LogSeverity : int 33 public enum LogSeverity : int
34 { 34 {
35 /// <summary> 35 /// <summary>
36 /// Critical: systems failure 36 /// Critical: systems failure
37 /// </summary> 37 /// </summary>
38 CRITICAL = 1, 38 CRITICAL = 1,
39 /// <summary> 39 /// <summary>
40 /// Major: warning prior to systems failure 40 /// Major: warning prior to systems failure
41 /// </summary> 41 /// </summary>
42 MAJOR = 2, 42 MAJOR = 2,
43 /// <summary> 43 /// <summary>
44 /// Medium: an individual non-critical task failed 44 /// Medium: an individual non-critical task failed
45 /// </summary> 45 /// </summary>
46 MEDIUM = 3, 46 MEDIUM = 3,
47 /// <summary> 47 /// <summary>
48 /// Low: Informational warning 48 /// Low: Informational warning
49 /// </summary> 49 /// </summary>
50 LOW = 4, 50 LOW = 4,
51 /// <summary> 51 /// <summary>
52 /// Info: Information 52 /// Info: Information
53 /// </summary> 53 /// </summary>
54 INFO = 5, 54 INFO = 5,
55 /// <summary> 55 /// <summary>
56 /// Verbose: Debug Information 56 /// Verbose: Debug Information
57 /// </summary> 57 /// </summary>
58 VERBOSE = 6 58 VERBOSE = 6
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// An interface to a LogData storage system 62 /// An interface to a LogData storage system
63 /// </summary> 63 /// </summary>
64 public interface ILogData 64 public interface ILogData
65 { 65 {
66 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); 66 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage);
67 /// <summary> 67 /// <summary>
68 /// Initialises the interface 68 /// Initialises the interface
69 /// </summary> 69 /// </summary>
70 void Initialise(); 70 void Initialise();
71 71
72 /// <summary> 72 /// <summary>
73 /// Closes the interface 73 /// Closes the interface
74 /// </summary> 74 /// </summary>
75 void Close(); 75 void Close();
76 76
77 /// <summary> 77 /// <summary>
78 /// The plugin being loaded 78 /// The plugin being loaded
79 /// </summary> 79 /// </summary>
80 /// <returns>A string containing the plugin name</returns> 80 /// <returns>A string containing the plugin name</returns>
81 string getName(); 81 string getName();
82 82
83 /// <summary> 83 /// <summary>
84 /// The plugins version 84 /// The plugins version
85 /// </summary> 85 /// </summary>
86 /// <returns>A string containing the plugin version</returns> 86 /// <returns>A string containing the plugin version</returns>
87 string getVersion(); 87 string getVersion();
88 } 88 }
89 89
90} 90}
diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs
index 2b52fd1..5dcb2fd 100644
--- a/OpenSim/Framework/Data/IniConfig.cs
+++ b/OpenSim/Framework/Data/IniConfig.cs
@@ -1,96 +1,96 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.IO; 28using System.IO;
29using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
30/* 30/*
31 Taken from public code listing at by Alex Pinsker 31 Taken from public code listing at by Alex Pinsker
32 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html 32 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
33 */ 33 */
34 34
35namespace OpenSim.Framework.Data 35namespace OpenSim.Framework.Data
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Parse settings from ini-like files 38 /// Parse settings from ini-like files
39 /// </summary> 39 /// </summary>
40 public class IniFile 40 public class IniFile
41 { 41 {
42 static IniFile() 42 static IniFile()
43 { 43 {
44 _iniKeyValuePatternRegex = new Regex( 44 _iniKeyValuePatternRegex = new Regex(
45 @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]* 45 @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]*
46 # key part (surrounding whitespace stripped) 46 # key part (surrounding whitespace stripped)
47 \= 47 \=
48 (\s)*(?<Value>([^\n^\s]+(\n){0,1}))) 48 (\s)*(?<Value>([^\n^\s]+(\n){0,1})))
49 # value part (surrounding whitespace stripped) 49 # value part (surrounding whitespace stripped)
50 ", 50 ",
51 RegexOptions.IgnorePatternWhitespace | 51 RegexOptions.IgnorePatternWhitespace |
52 RegexOptions.Compiled | 52 RegexOptions.Compiled |
53 RegexOptions.CultureInvariant); 53 RegexOptions.CultureInvariant);
54 } 54 }
55 static private Regex _iniKeyValuePatternRegex; 55 static private Regex _iniKeyValuePatternRegex;
56 56
57 public IniFile(string iniFileName) 57 public IniFile(string iniFileName)
58 { 58 {
59 _iniFileName = iniFileName; 59 _iniFileName = iniFileName;
60 } 60 }
61 61
62 public string ParseFileReadValue(string key) 62 public string ParseFileReadValue(string key)
63 { 63 {
64 using (StreamReader reader = 64 using (StreamReader reader =
65 new StreamReader(_iniFileName)) 65 new StreamReader(_iniFileName))
66 { 66 {
67 do 67 do
68 { 68 {
69 string line = reader.ReadLine(); 69 string line = reader.ReadLine();
70 Match match = 70 Match match =
71 _iniKeyValuePatternRegex.Match(line); 71 _iniKeyValuePatternRegex.Match(line);
72 if (match.Success) 72 if (match.Success)
73 { 73 {
74 string currentKey = 74 string currentKey =
75 match.Groups["Key"].Value as string; 75 match.Groups["Key"].Value as string;
76 if (currentKey != null && 76 if (currentKey != null &&
77 currentKey.Trim().CompareTo(key) == 0) 77 currentKey.Trim().CompareTo(key) == 0)
78 { 78 {
79 string value = 79 string value =
80 match.Groups["Value"].Value as string; 80 match.Groups["Value"].Value as string;
81 return value; 81 return value;
82 } 82 }
83 } 83 }
84 84
85 } 85 }
86 while (reader.Peek() != -1); 86 while (reader.Peek() != -1);
87 } 87 }
88 return null; 88 return null;
89 } 89 }
90 90
91 public string IniFileName 91 public string IniFileName
92 { 92 {
93 get { return _iniFileName; } 93 get { return _iniFileName; }
94 } private string _iniFileName; 94 } private string _iniFileName;
95 } 95 }
96} 96}
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index 7253cc7..f6aeb58 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -1,197 +1,197 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Data 31namespace OpenSim.Framework.Data
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Inventory Item - contains all the properties associated with an individual inventory piece. 34 /// Inventory Item - contains all the properties associated with an individual inventory piece.
35 /// </summary> 35 /// </summary>
36 public class InventoryItemBase 36 public class InventoryItemBase
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// A UUID containing the ID for the inventory item itself 39 /// A UUID containing the ID for the inventory item itself
40 /// </summary> 40 /// </summary>
41 public LLUUID inventoryID; 41 public LLUUID inventoryID;
42 /// <summary> 42 /// <summary>
43 /// The UUID of the associated asset on the asset server 43 /// The UUID of the associated asset on the asset server
44 /// </summary> 44 /// </summary>
45 public LLUUID assetID; 45 public LLUUID assetID;
46 /// <summary> 46 /// <summary>
47 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) 47 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
48 /// </summary> 48 /// </summary>
49 public int type; 49 public int type;
50 /// <summary> 50 /// <summary>
51 /// The folder this item is contained in 51 /// The folder this item is contained in
52 /// </summary> 52 /// </summary>
53 public LLUUID parentFolderID; 53 public LLUUID parentFolderID;
54 /// <summary> 54 /// <summary>
55 /// The owner of this inventory item 55 /// The owner of this inventory item
56 /// </summary> 56 /// </summary>
57 public LLUUID avatarID; 57 public LLUUID avatarID;
58 /// <summary> 58 /// <summary>
59 /// The creator of this item 59 /// The creator of this item
60 /// </summary> 60 /// </summary>
61 public LLUUID creatorsID; 61 public LLUUID creatorsID;
62 /// <summary> 62 /// <summary>
63 /// The name of the inventory item (must be less than 64 characters) 63 /// The name of the inventory item (must be less than 64 characters)
64 /// </summary> 64 /// </summary>
65 public string inventoryName; 65 public string inventoryName;
66 /// <summary> 66 /// <summary>
67 /// The description of the inventory item (must be less than 64 characters) 67 /// The description of the inventory item (must be less than 64 characters)
68 /// </summary> 68 /// </summary>
69 public string inventoryDescription; 69 public string inventoryDescription;
70 /// <summary> 70 /// <summary>
71 /// A mask containing the permissions for the next owner (cannot be enforced) 71 /// A mask containing the permissions for the next owner (cannot be enforced)
72 /// </summary> 72 /// </summary>
73 public uint inventoryNextPermissions; 73 public uint inventoryNextPermissions;
74 /// <summary> 74 /// <summary>
75 /// A mask containing permissions for the current owner (cannot be enforced) 75 /// A mask containing permissions for the current owner (cannot be enforced)
76 /// </summary> 76 /// </summary>
77 public uint inventoryCurrentPermissions; 77 public uint inventoryCurrentPermissions;
78 } 78 }
79 79
80 /// <summary> 80 /// <summary>
81 /// A Class for folders which contain users inventory 81 /// A Class for folders which contain users inventory
82 /// </summary> 82 /// </summary>
83 public class InventoryFolderBase 83 public class InventoryFolderBase
84 { 84 {
85 /// <summary> 85 /// <summary>
86 /// The name of the folder (64 characters or less) 86 /// The name of the folder (64 characters or less)
87 /// </summary> 87 /// </summary>
88 public string name; 88 public string name;
89 /// <summary> 89 /// <summary>
90 /// The agent who's inventory this is contained by 90 /// The agent who's inventory this is contained by
91 /// </summary> 91 /// </summary>
92 public LLUUID agentID; 92 public LLUUID agentID;
93 /// <summary> 93 /// <summary>
94 /// The folder this folder is contained in 94 /// The folder this folder is contained in
95 /// </summary> 95 /// </summary>
96 public LLUUID parentID; 96 public LLUUID parentID;
97 /// <summary> 97 /// <summary>
98 /// The UUID for this folder 98 /// The UUID for this folder
99 /// </summary> 99 /// </summary>
100 public LLUUID folderID; 100 public LLUUID folderID;
101 /// <summary> 101 /// <summary>
102 /// Tyep of Items normally stored in this folder 102 /// Tyep of Items normally stored in this folder
103 /// </summary> 103 /// </summary>
104 public ushort type; 104 public ushort type;
105 /// <summary> 105 /// <summary>
106 /// 106 ///
107 /// </summary> 107 /// </summary>
108 public ushort version; 108 public ushort version;
109 } 109 }
110 110
111 /// <summary> 111 /// <summary>
112 /// An interface for accessing inventory data from a storage server 112 /// An interface for accessing inventory data from a storage server
113 /// </summary> 113 /// </summary>
114 public interface IInventoryData 114 public interface IInventoryData
115 { 115 {
116 /// <summary> 116 /// <summary>
117 /// Initialises the interface 117 /// Initialises the interface
118 /// </summary> 118 /// </summary>
119 void Initialise(); 119 void Initialise();
120 120
121 /// <summary> 121 /// <summary>
122 /// Closes the interface 122 /// Closes the interface
123 /// </summary> 123 /// </summary>
124 void Close(); 124 void Close();
125 125
126 /// <summary> 126 /// <summary>
127 /// The plugin being loaded 127 /// The plugin being loaded
128 /// </summary> 128 /// </summary>
129 /// <returns>A string containing the plugin name</returns> 129 /// <returns>A string containing the plugin name</returns>
130 string getName(); 130 string getName();
131 131
132 /// <summary> 132 /// <summary>
133 /// The plugins version 133 /// The plugins version
134 /// </summary> 134 /// </summary>
135 /// <returns>A string containing the plugin version</returns> 135 /// <returns>A string containing the plugin version</returns>
136 string getVersion(); 136 string getVersion();
137 137
138 /// <summary> 138 /// <summary>
139 /// Returns a list of inventory items contained within the specified folder 139 /// Returns a list of inventory items contained within the specified folder
140 /// </summary> 140 /// </summary>
141 /// <param name="folderID">The UUID of the target folder</param> 141 /// <param name="folderID">The UUID of the target folder</param>
142 /// <returns>A List of InventoryItemBase items</returns> 142 /// <returns>A List of InventoryItemBase items</returns>
143 List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); 143 List<InventoryItemBase> getInventoryInFolder(LLUUID folderID);
144 144
145 /// <summary> 145 /// <summary>
146 /// Returns a list of folders in the users inventory root. 146 /// Returns a list of folders in the users inventory root.
147 /// </summary> 147 /// </summary>
148 /// <param name="user">The UUID of the user who is having inventory being returned</param> 148 /// <param name="user">The UUID of the user who is having inventory being returned</param>
149 /// <returns>A list of folders</returns> 149 /// <returns>A list of folders</returns>
150 List<InventoryFolderBase> getUserRootFolders(LLUUID user); 150 List<InventoryFolderBase> getUserRootFolders(LLUUID user);
151 151
152 /// <summary> 152 /// <summary>
153 /// Returns a list of inventory folders contained in the folder 'parentID' 153 /// Returns a list of inventory folders contained in the folder 'parentID'
154 /// </summary> 154 /// </summary>
155 /// <param name="parentID">The folder to get subfolders for</param> 155 /// <param name="parentID">The folder to get subfolders for</param>
156 /// <returns>A list of inventory folders</returns> 156 /// <returns>A list of inventory folders</returns>
157 List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); 157 List<InventoryFolderBase> getInventoryFolders(LLUUID parentID);
158 158
159 /// <summary> 159 /// <summary>
160 /// Returns an inventory item by its UUID 160 /// Returns an inventory item by its UUID
161 /// </summary> 161 /// </summary>
162 /// <param name="item">The UUID of the item to be returned</param> 162 /// <param name="item">The UUID of the item to be returned</param>
163 /// <returns>A class containing item information</returns> 163 /// <returns>A class containing item information</returns>
164 InventoryItemBase getInventoryItem(LLUUID item); 164 InventoryItemBase getInventoryItem(LLUUID item);
165 165
166 /// <summary> 166 /// <summary>
167 /// Returns a specified inventory folder by its UUID 167 /// Returns a specified inventory folder by its UUID
168 /// </summary> 168 /// </summary>
169 /// <param name="folder">The UUID of the folder to be returned</param> 169 /// <param name="folder">The UUID of the folder to be returned</param>
170 /// <returns>A class containing folder information</returns> 170 /// <returns>A class containing folder information</returns>
171 InventoryFolderBase getInventoryFolder(LLUUID folder); 171 InventoryFolderBase getInventoryFolder(LLUUID folder);
172 172
173 /// <summary> 173 /// <summary>
174 /// Creates a new inventory item based on item 174 /// Creates a new inventory item based on item
175 /// </summary> 175 /// </summary>
176 /// <param name="item">The item to be created</param> 176 /// <param name="item">The item to be created</param>
177 void addInventoryItem(InventoryItemBase item); 177 void addInventoryItem(InventoryItemBase item);
178 178
179 /// <summary> 179 /// <summary>
180 /// Updates an inventory item with item (updates based on ID) 180 /// Updates an inventory item with item (updates based on ID)
181 /// </summary> 181 /// </summary>
182 /// <param name="item">The updated item</param> 182 /// <param name="item">The updated item</param>
183 void updateInventoryItem(InventoryItemBase item); 183 void updateInventoryItem(InventoryItemBase item);
184 184
185 /// <summary> 185 /// <summary>
186 /// Adds a new folder specified by folder 186 /// Adds a new folder specified by folder
187 /// </summary> 187 /// </summary>
188 /// <param name="folder">The inventory folder</param> 188 /// <param name="folder">The inventory folder</param>
189 void addInventoryFolder(InventoryFolderBase folder); 189 void addInventoryFolder(InventoryFolderBase folder);
190 190
191 /// <summary> 191 /// <summary>
192 /// Updates a folder based on its ID with folder 192 /// Updates a folder based on its ID with folder
193 /// </summary> 193 /// </summary>
194 /// <param name="folder">The inventory folder</param> 194 /// <param name="folder">The inventory folder</param>
195 void updateInventoryFolder(InventoryFolderBase folder); 195 void updateInventoryFolder(InventoryFolderBase folder);
196 } 196 }
197} 197}
diff --git a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs
index f9260a1..556d589 100644
--- a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data")] 6[assembly: AssemblyTitle("OpenSim.Framework.Data")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data")] 10[assembly: AssemblyProduct("OpenSim.Framework.Data")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] 21[assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs
index 0078df0..8344d6c 100644
--- a/OpenSim/Framework/Data/ReservationData.cs
+++ b/OpenSim/Framework/Data/ReservationData.cs
@@ -1,47 +1,47 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Data 30namespace OpenSim.Framework.Data
31{ 31{
32 public class ReservationData 32 public class ReservationData
33 { 33 {
34 public LLUUID userUUID = new LLUUID(); 34 public LLUUID userUUID = new LLUUID();
35 public int reservationMinX = 0; 35 public int reservationMinX = 0;
36 public int reservationMinY = 0; 36 public int reservationMinY = 0;
37 public int reservationMaxX = 65536; 37 public int reservationMaxX = 65536;
38 public int reservationMaxY = 65536; 38 public int reservationMaxY = 65536;
39 39
40 public string reservationName = ""; 40 public string reservationName = "";
41 public string reservationCompany = ""; 41 public string reservationCompany = "";
42 public bool status = true; 42 public bool status = true;
43 43
44 public string gridSendKey = ""; 44 public string gridSendKey = "";
45 public string gridRecvKey = ""; 45 public string gridRecvKey = "";
46 } 46 }
47} 47}
diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs
index b920cab..c963455 100644
--- a/OpenSim/Framework/Data/SimProfileData.cs
+++ b/OpenSim/Framework/Data/SimProfileData.cs
@@ -1,192 +1,192 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using Nwc.XmlRpc; 29using Nwc.XmlRpc;
30 30
31using System; 31using System;
32using System.Collections; 32using System.Collections;
33 33
34namespace OpenSim.Framework.Data 34namespace OpenSim.Framework.Data
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// A class which contains information known to the grid server about a region 37 /// A class which contains information known to the grid server about a region
38 /// </summary> 38 /// </summary>
39 public class SimProfileData 39 public class SimProfileData
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// The name of the region 42 /// The name of the region
43 /// </summary> 43 /// </summary>
44 public string regionName = ""; 44 public string regionName = "";
45 45
46 /// <summary> 46 /// <summary>
47 /// A 64-bit number combining map position into a (mostly) unique ID 47 /// A 64-bit number combining map position into a (mostly) unique ID
48 /// </summary> 48 /// </summary>
49 public ulong regionHandle; 49 public ulong regionHandle;
50 50
51 /// <summary> 51 /// <summary>
52 /// OGS/OpenSim Specific ID for a region 52 /// OGS/OpenSim Specific ID for a region
53 /// </summary> 53 /// </summary>
54 public LLUUID UUID; 54 public LLUUID UUID;
55 55
56 /// <summary> 56 /// <summary>
57 /// Coordinates of the region 57 /// Coordinates of the region
58 /// </summary> 58 /// </summary>
59 public uint regionLocX; 59 public uint regionLocX;
60 public uint regionLocY; 60 public uint regionLocY;
61 public uint regionLocZ; // Reserved (round-robin, layers, etc) 61 public uint regionLocZ; // Reserved (round-robin, layers, etc)
62 62
63 /// <summary> 63 /// <summary>
64 /// Authentication secrets 64 /// Authentication secrets
65 /// </summary> 65 /// </summary>
66 /// <remarks>Not very secure, needs improvement.</remarks> 66 /// <remarks>Not very secure, needs improvement.</remarks>
67 public string regionSendKey = ""; 67 public string regionSendKey = "";
68 public string regionRecvKey = ""; 68 public string regionRecvKey = "";
69 public string regionSecret = ""; 69 public string regionSecret = "";
70 70
71 /// <summary> 71 /// <summary>
72 /// Whether the region is online 72 /// Whether the region is online
73 /// </summary> 73 /// </summary>
74 public bool regionOnline; 74 public bool regionOnline;
75 75
76 /// <summary> 76 /// <summary>
77 /// Information about the server that the region is currently hosted on 77 /// Information about the server that the region is currently hosted on
78 /// </summary> 78 /// </summary>
79 public string serverIP = ""; 79 public string serverIP = "";
80 public uint serverPort; 80 public uint serverPort;
81 public string serverURI = ""; 81 public string serverURI = "";
82 82
83 public uint httpPort; 83 public uint httpPort;
84 public uint remotingPort; 84 public uint remotingPort;
85 public string httpServerURI = ""; 85 public string httpServerURI = "";
86 86
87 /// <summary> 87 /// <summary>
88 /// Set of optional overrides. Can be used to create non-eulicidean spaces. 88 /// Set of optional overrides. Can be used to create non-eulicidean spaces.
89 /// </summary> 89 /// </summary>
90 public ulong regionNorthOverrideHandle; 90 public ulong regionNorthOverrideHandle;
91 public ulong regionSouthOverrideHandle; 91 public ulong regionSouthOverrideHandle;
92 public ulong regionEastOverrideHandle; 92 public ulong regionEastOverrideHandle;
93 public ulong regionWestOverrideHandle; 93 public ulong regionWestOverrideHandle;
94 94
95 /// <summary> 95 /// <summary>
96 /// Optional: URI Location of the region database 96 /// Optional: URI Location of the region database
97 /// </summary> 97 /// </summary>
98 /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> 98 /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
99 public string regionDataURI = ""; 99 public string regionDataURI = "";
100 100
101 /// <summary> 101 /// <summary>
102 /// Region Asset Details 102 /// Region Asset Details
103 /// </summary> 103 /// </summary>
104 public string regionAssetURI = ""; 104 public string regionAssetURI = "";
105 public string regionAssetSendKey = ""; 105 public string regionAssetSendKey = "";
106 public string regionAssetRecvKey = ""; 106 public string regionAssetRecvKey = "";
107 107
108 /// <summary> 108 /// <summary>
109 /// Region Userserver Details 109 /// Region Userserver Details
110 /// </summary> 110 /// </summary>
111 public string regionUserURI = ""; 111 public string regionUserURI = "";
112 public string regionUserSendKey = ""; 112 public string regionUserSendKey = "";
113 public string regionUserRecvKey = ""; 113 public string regionUserRecvKey = "";
114 114
115 /// <summary> 115 /// <summary>
116 /// Region Map Texture Asset 116 /// Region Map Texture Asset
117 /// </summary> 117 /// </summary>
118 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); 118 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006");
119 119
120 /// <summary> 120 /// <summary>
121 /// Get Sim profile data from grid server when in grid mode 121 /// Get Sim profile data from grid server when in grid mode
122 /// </summary> 122 /// </summary>
123 /// <param name="region_uuid"></param> 123 /// <param name="region_uuid"></param>
124 /// <param name="gridserver_url"></param> 124 /// <param name="gridserver_url"></param>
125 /// <param name="?"></param> 125 /// <param name="?"></param>
126 /// <returns></returns> 126 /// <returns></returns>
127 public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) 127 public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
128 { 128 {
129 Hashtable requestData = new Hashtable(); 129 Hashtable requestData = new Hashtable();
130 requestData["region_uuid"] = region_uuid.UUID.ToString(); 130 requestData["region_uuid"] = region_uuid.UUID.ToString();
131 requestData["authkey"] = gridserver_sendkey; 131 requestData["authkey"] = gridserver_sendkey;
132 ArrayList SendParams = new ArrayList(); 132 ArrayList SendParams = new ArrayList();
133 SendParams.Add(requestData); 133 SendParams.Add(requestData);
134 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 134 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
135 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); 135 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
136 136
137 Hashtable responseData = (Hashtable)GridResp.Value; 137 Hashtable responseData = (Hashtable)GridResp.Value;
138 138
139 if (responseData.ContainsKey("error")) 139 if (responseData.ContainsKey("error"))
140 { 140 {
141 return null; 141 return null;
142 } 142 }
143 143
144 SimProfileData simData = new SimProfileData(); 144 SimProfileData simData = new SimProfileData();
145 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); 145 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
146 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); 146 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
147 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); 147 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256));
148 simData.serverIP = (string)responseData["sim_ip"]; 148 simData.serverIP = (string)responseData["sim_ip"];
149 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); 149 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
150 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); 150 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
151 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 151 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
152 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; 152 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
153 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; 153 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
154 simData.UUID = new LLUUID((string)responseData["region_UUID"]); 154 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
155 simData.regionName = (string)responseData["region_name"]; 155 simData.regionName = (string)responseData["region_name"];
156 156
157 return simData; 157 return simData;
158 } 158 }
159 public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) 159 public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
160 { 160 {
161 Hashtable requestData = new Hashtable(); 161 Hashtable requestData = new Hashtable();
162 requestData["region_handle"] = region_handle.ToString(); 162 requestData["region_handle"] = region_handle.ToString();
163 requestData["authkey"] = gridserver_sendkey; 163 requestData["authkey"] = gridserver_sendkey;
164 ArrayList SendParams = new ArrayList(); 164 ArrayList SendParams = new ArrayList();
165 SendParams.Add(requestData); 165 SendParams.Add(requestData);
166 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 166 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
167 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); 167 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
168 168
169 Hashtable responseData = (Hashtable)GridResp.Value; 169 Hashtable responseData = (Hashtable)GridResp.Value;
170 170
171 if (responseData.ContainsKey("error")) 171 if (responseData.ContainsKey("error"))
172 { 172 {
173 return null; 173 return null;
174 } 174 }
175 175
176 SimProfileData simData = new SimProfileData(); 176 SimProfileData simData = new SimProfileData();
177 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); 177 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
178 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); 178 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
179 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); 179 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256));
180 simData.serverIP = (string)responseData["sim_ip"]; 180 simData.serverIP = (string)responseData["sim_ip"];
181 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); 181 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
182 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); 182 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
183 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 183 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
184 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; 184 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
185 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; 185 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
186 simData.UUID = new LLUUID((string)responseData["region_UUID"]); 186 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
187 simData.regionName = (string)responseData["region_name"]; 187 simData.regionName = (string)responseData["region_name"];
188 188
189 return simData; 189 return simData;
190 } 190 }
191 } 191 }
192} 192}
diff --git a/OpenSim/Framework/Data/UserData.cs b/OpenSim/Framework/Data/UserData.cs
index c65f9fd..d849e12 100644
--- a/OpenSim/Framework/Data/UserData.cs
+++ b/OpenSim/Framework/Data/UserData.cs
@@ -1,128 +1,128 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Data 30namespace OpenSim.Framework.Data
31{ 31{
32 /// <summary> 32 /// <summary>
33 /// An interface for connecting to user storage servers. 33 /// An interface for connecting to user storage servers.
34 /// </summary> 34 /// </summary>
35 public interface IUserData 35 public interface IUserData
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Returns a user profile from a database via their UUID 38 /// Returns a user profile from a database via their UUID
39 /// </summary> 39 /// </summary>
40 /// <param name="user">The accounts UUID</param> 40 /// <param name="user">The accounts UUID</param>
41 /// <returns>The user data profile</returns> 41 /// <returns>The user data profile</returns>
42 UserProfileData getUserByUUID(LLUUID user); 42 UserProfileData getUserByUUID(LLUUID user);
43 43
44 /// <summary> 44 /// <summary>
45 /// Returns a users profile by searching their username 45 /// Returns a users profile by searching their username
46 /// </summary> 46 /// </summary>
47 /// <param name="name">The users username</param> 47 /// <param name="name">The users username</param>
48 /// <returns>The user data profile</returns> 48 /// <returns>The user data profile</returns>
49 UserProfileData getUserByName(string name); 49 UserProfileData getUserByName(string name);
50 50
51 /// <summary> 51 /// <summary>
52 /// Returns a users profile by searching their username parts 52 /// Returns a users profile by searching their username parts
53 /// </summary> 53 /// </summary>
54 /// <param name="fname">Account firstname</param> 54 /// <param name="fname">Account firstname</param>
55 /// <param name="lname">Account lastname</param> 55 /// <param name="lname">Account lastname</param>
56 /// <returns>The user data profile</returns> 56 /// <returns>The user data profile</returns>
57 UserProfileData getUserByName(string fname, string lname); 57 UserProfileData getUserByName(string fname, string lname);
58 58
59 /// <summary> 59 /// <summary>
60 /// Returns the current agent for a user searching by it's UUID 60 /// Returns the current agent for a user searching by it's UUID
61 /// </summary> 61 /// </summary>
62 /// <param name="user">The users UUID</param> 62 /// <param name="user">The users UUID</param>
63 /// <returns>The current agent session</returns> 63 /// <returns>The current agent session</returns>
64 UserAgentData getAgentByUUID(LLUUID user); 64 UserAgentData getAgentByUUID(LLUUID user);
65 65
66 /// <summary> 66 /// <summary>
67 /// Returns the current session agent for a user searching by username 67 /// Returns the current session agent for a user searching by username
68 /// </summary> 68 /// </summary>
69 /// <param name="name">The users account name</param> 69 /// <param name="name">The users account name</param>
70 /// <returns>The current agent session</returns> 70 /// <returns>The current agent session</returns>
71 UserAgentData getAgentByName(string name); 71 UserAgentData getAgentByName(string name);
72 72
73 /// <summary> 73 /// <summary>
74 /// Returns the current session agent for a user searching by username parts 74 /// Returns the current session agent for a user searching by username parts
75 /// </summary> 75 /// </summary>
76 /// <param name="fname">The users first account name</param> 76 /// <param name="fname">The users first account name</param>
77 /// <param name="lname">The users account surname</param> 77 /// <param name="lname">The users account surname</param>
78 /// <returns>The current agent session</returns> 78 /// <returns>The current agent session</returns>
79 UserAgentData getAgentByName(string fname, string lname); 79 UserAgentData getAgentByName(string fname, string lname);
80 80
81 /// <summary> 81 /// <summary>
82 /// Adds a new User profile to the database 82 /// Adds a new User profile to the database
83 /// </summary> 83 /// </summary>
84 /// <param name="user">UserProfile to add</param> 84 /// <param name="user">UserProfile to add</param>
85 void addNewUserProfile(UserProfileData user); 85 void addNewUserProfile(UserProfileData user);
86 86
87 /// <summary> 87 /// <summary>
88 /// Adds a new agent to the database 88 /// Adds a new agent to the database
89 /// </summary> 89 /// </summary>
90 /// <param name="agent">The agent to add</param> 90 /// <param name="agent">The agent to add</param>
91 void addNewUserAgent(UserAgentData agent); 91 void addNewUserAgent(UserAgentData agent);
92 92
93 /// <summary> 93 /// <summary>
94 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) 94 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
95 /// </summary> 95 /// </summary>
96 /// <param name="from">The account to transfer from</param> 96 /// <param name="from">The account to transfer from</param>
97 /// <param name="to">The account to transfer to</param> 97 /// <param name="to">The account to transfer to</param>
98 /// <param name="amount">The amount to transfer</param> 98 /// <param name="amount">The amount to transfer</param>
99 /// <returns>Successful?</returns> 99 /// <returns>Successful?</returns>
100 bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); 100 bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount);
101 101
102 /// <summary> 102 /// <summary>
103 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. 103 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
104 /// </summary> 104 /// </summary>
105 /// <param name="from">User to transfer from</param> 105 /// <param name="from">User to transfer from</param>
106 /// <param name="to">User to transfer to</param> 106 /// <param name="to">User to transfer to</param>
107 /// <param name="inventory">Specified inventory item</param> 107 /// <param name="inventory">Specified inventory item</param>
108 /// <returns>Successful?</returns> 108 /// <returns>Successful?</returns>
109 bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); 109 bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
110 110
111 /// <summary> 111 /// <summary>
112 /// Returns the plugin version 112 /// Returns the plugin version
113 /// </summary> 113 /// </summary>
114 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns> 114 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
115 string getVersion(); 115 string getVersion();
116 116
117 /// <summary> 117 /// <summary>
118 /// Returns the plugin name 118 /// Returns the plugin name
119 /// </summary> 119 /// </summary>
120 /// <returns>Plugin name, eg MySQL User Provider</returns> 120 /// <returns>Plugin name, eg MySQL User Provider</returns>
121 string getName(); 121 string getName();
122 122
123 /// <summary> 123 /// <summary>
124 /// Initialises the plugin (artificial constructor) 124 /// Initialises the plugin (artificial constructor)
125 /// </summary> 125 /// </summary>
126 void Initialise(); 126 void Initialise();
127 } 127 }
128} 128}
diff --git a/OpenSim/Framework/Data/UserProfileData.cs b/OpenSim/Framework/Data/UserProfileData.cs
index bb7d48c..88f956f 100644
--- a/OpenSim/Framework/Data/UserProfileData.cs
+++ b/OpenSim/Framework/Data/UserProfileData.cs
@@ -1,180 +1,180 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Data 31namespace OpenSim.Framework.Data
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Information about a particular user known to the userserver 34 /// Information about a particular user known to the userserver
35 /// </summary> 35 /// </summary>
36 public class UserProfileData 36 public class UserProfileData
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// The ID value for this user 39 /// The ID value for this user
40 /// </summary> 40 /// </summary>
41 public LLUUID UUID; 41 public LLUUID UUID;
42 42
43 /// <summary> 43 /// <summary>
44 /// The first component of a users account name 44 /// The first component of a users account name
45 /// </summary> 45 /// </summary>
46 public string username; 46 public string username;
47 /// <summary> 47 /// <summary>
48 /// The second component of a users account name 48 /// The second component of a users account name
49 /// </summary> 49 /// </summary>
50 public string surname; 50 public string surname;
51 51
52 /// <summary> 52 /// <summary>
53 /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) 53 /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt)
54 /// </summary> 54 /// </summary>
55 /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> 55 /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks>
56 public string passwordHash; 56 public string passwordHash;
57 /// <summary> 57 /// <summary>
58 /// The salt used for the users hash, should be 32 bytes or longer 58 /// The salt used for the users hash, should be 32 bytes or longer
59 /// </summary> 59 /// </summary>
60 public string passwordSalt; 60 public string passwordSalt;
61 61
62 /// <summary> 62 /// <summary>
63 /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into 63 /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
64 /// </summary> 64 /// </summary>
65 public ulong homeRegion; 65 public ulong homeRegion;
66 /// <summary> 66 /// <summary>
67 /// The coordinates inside the region of the home location 67 /// The coordinates inside the region of the home location
68 /// </summary> 68 /// </summary>
69 public LLVector3 homeLocation; 69 public LLVector3 homeLocation;
70 /// <summary> 70 /// <summary>
71 /// Where the user will be looking when they rez. 71 /// Where the user will be looking when they rez.
72 /// </summary> 72 /// </summary>
73 public LLVector3 homeLookAt; 73 public LLVector3 homeLookAt;
74 74
75 /// <summary> 75 /// <summary>
76 /// A UNIX Timestamp (seconds since epoch) for the users creation 76 /// A UNIX Timestamp (seconds since epoch) for the users creation
77 /// </summary> 77 /// </summary>
78 public int created; 78 public int created;
79 /// <summary> 79 /// <summary>
80 /// A UNIX Timestamp for the users last login date / time 80 /// A UNIX Timestamp for the users last login date / time
81 /// </summary> 81 /// </summary>
82 public int lastLogin; 82 public int lastLogin;
83 83
84 /// <summary> 84 /// <summary>
85 /// A URI to the users inventory server, used for foreigners and large grids 85 /// A URI to the users inventory server, used for foreigners and large grids
86 /// </summary> 86 /// </summary>
87 public string userInventoryURI; 87 public string userInventoryURI;
88 /// <summary> 88 /// <summary>
89 /// A URI to the users asset server, used for foreigners and large grids. 89 /// A URI to the users asset server, used for foreigners and large grids.
90 /// </summary> 90 /// </summary>
91 public string userAssetURI; 91 public string userAssetURI;
92 92
93 /// <summary> 93 /// <summary>
94 /// A uint mask containing the "I can do" fields of the users profile 94 /// A uint mask containing the "I can do" fields of the users profile
95 /// </summary> 95 /// </summary>
96 public uint profileCanDoMask; 96 public uint profileCanDoMask;
97 /// <summary> 97 /// <summary>
98 /// A uint mask containing the "I want to do" part of the users profile 98 /// A uint mask containing the "I want to do" part of the users profile
99 /// </summary> 99 /// </summary>
100 public uint profileWantDoMask; // Profile window "I want to" mask 100 public uint profileWantDoMask; // Profile window "I want to" mask
101 101
102 /// <summary> 102 /// <summary>
103 /// The about text listed in a users profile. 103 /// The about text listed in a users profile.
104 /// </summary> 104 /// </summary>
105 public string profileAboutText; 105 public string profileAboutText;
106 /// <summary> 106 /// <summary>
107 /// The first life about text listed in a users profile 107 /// The first life about text listed in a users profile
108 /// </summary> 108 /// </summary>
109 public string profileFirstText; 109 public string profileFirstText;
110 110
111 /// <summary> 111 /// <summary>
112 /// The profile image for an avatar stored on the asset server 112 /// The profile image for an avatar stored on the asset server
113 /// </summary> 113 /// </summary>
114 public LLUUID profileImage; 114 public LLUUID profileImage;
115 /// <summary> 115 /// <summary>
116 /// The profile image for the users first life tab 116 /// The profile image for the users first life tab
117 /// </summary> 117 /// </summary>
118 public LLUUID profileFirstImage; 118 public LLUUID profileFirstImage;
119 /// <summary> 119 /// <summary>
120 /// The users last registered agent (filled in on the user server) 120 /// The users last registered agent (filled in on the user server)
121 /// </summary> 121 /// </summary>
122 public UserAgentData currentAgent; 122 public UserAgentData currentAgent;
123 } 123 }
124 124
125 /// <summary> 125 /// <summary>
126 /// Information about a users session 126 /// Information about a users session
127 /// </summary> 127 /// </summary>
128 public class UserAgentData 128 public class UserAgentData
129 { 129 {
130 /// <summary> 130 /// <summary>
131 /// The UUID of the users avatar (not the agent!) 131 /// The UUID of the users avatar (not the agent!)
132 /// </summary> 132 /// </summary>
133 public LLUUID UUID; 133 public LLUUID UUID;
134 /// <summary> 134 /// <summary>
135 /// The IP address of the user 135 /// The IP address of the user
136 /// </summary> 136 /// </summary>
137 public string agentIP = String.Empty; 137 public string agentIP = String.Empty;
138 /// <summary> 138 /// <summary>
139 /// The port of the user 139 /// The port of the user
140 /// </summary> 140 /// </summary>
141 public uint agentPort; 141 public uint agentPort;
142 /// <summary> 142 /// <summary>
143 /// Is the user online? 143 /// Is the user online?
144 /// </summary> 144 /// </summary>
145 public bool agentOnline; 145 public bool agentOnline;
146 /// <summary> 146 /// <summary>
147 /// The session ID for the user (also the agent ID) 147 /// The session ID for the user (also the agent ID)
148 /// </summary> 148 /// </summary>
149 public LLUUID sessionID; 149 public LLUUID sessionID;
150 /// <summary> 150 /// <summary>
151 /// The "secure" session ID for the user 151 /// The "secure" session ID for the user
152 /// </summary> 152 /// </summary>
153 /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> 153 /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
154 public LLUUID secureSessionID; 154 public LLUUID secureSessionID;
155 /// <summary> 155 /// <summary>
156 /// The region the user logged into initially 156 /// The region the user logged into initially
157 /// </summary> 157 /// </summary>
158 public LLUUID regionID; 158 public LLUUID regionID;
159 /// <summary> 159 /// <summary>
160 /// A unix timestamp from when the user logged in 160 /// A unix timestamp from when the user logged in
161 /// </summary> 161 /// </summary>
162 public int loginTime; 162 public int loginTime;
163 /// <summary> 163 /// <summary>
164 /// When this agent expired and logged out, 0 if still online 164 /// When this agent expired and logged out, 0 if still online
165 /// </summary> 165 /// </summary>
166 public int logoutTime; 166 public int logoutTime;
167 /// <summary> 167 /// <summary>
168 /// Current region the user is logged into 168 /// Current region the user is logged into
169 /// </summary> 169 /// </summary>
170 public LLUUID currentRegion; 170 public LLUUID currentRegion;
171 /// <summary> 171 /// <summary>
172 /// Region handle of the current region the user is in 172 /// Region handle of the current region the user is in
173 /// </summary> 173 /// </summary>
174 public ulong currentHandle; 174 public ulong currentHandle;
175 /// <summary> 175 /// <summary>
176 /// The position of the user within the region 176 /// The position of the user within the region
177 /// </summary> 177 /// </summary>
178 public LLVector3 currentPos; 178 public LLVector3 currentPos;
179 } 179 }
180} 180}
diff --git a/OpenSim/Framework/General/AgentInventory.cs b/OpenSim/Framework/General/AgentInventory.cs
index e45a0cd..0aeb0b3 100644
--- a/OpenSim/Framework/General/AgentInventory.cs
+++ b/OpenSim/Framework/General/AgentInventory.cs
@@ -1,265 +1,265 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework.Types; 31using OpenSim.Framework.Types;
32using OpenSim.Framework.Utilities; 32using OpenSim.Framework.Utilities;
33 33
34namespace OpenSim.Framework.Inventory 34namespace OpenSim.Framework.Inventory
35{ 35{
36 public class AgentInventory 36 public class AgentInventory
37 { 37 {
38 //Holds the local copy of Inventory info for a agent 38 //Holds the local copy of Inventory info for a agent
39 public Dictionary<LLUUID, InventoryFolder> InventoryFolders; 39 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
40 public Dictionary<LLUUID, InventoryItem> InventoryItems; 40 public Dictionary<LLUUID, InventoryItem> InventoryItems;
41 public InventoryFolder InventoryRoot; 41 public InventoryFolder InventoryRoot;
42 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server 42 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
43 public LLUUID AgentID; 43 public LLUUID AgentID;
44 public AvatarWearable[] Wearables; 44 public AvatarWearable[] Wearables;
45 45
46 public AgentInventory() 46 public AgentInventory()
47 { 47 {
48 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>(); 48 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
49 InventoryItems = new Dictionary<LLUUID, InventoryItem>(); 49 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
50 this.Initialise(); 50 this.Initialise();
51 } 51 }
52 52
53 public virtual void Initialise() 53 public virtual void Initialise()
54 { 54 {
55 Wearables = new AvatarWearable[13]; //should be 12 of these 55 Wearables = new AvatarWearable[13]; //should be 12 of these
56 for (int i = 0; i < 13; i++) 56 for (int i = 0; i < 13; i++)
57 { 57 {
58 Wearables[i] = new AvatarWearable(); 58 Wearables[i] = new AvatarWearable();
59 } 59 }
60 60
61 } 61 }
62 62
63 public bool CreateNewFolder(LLUUID folderID, ushort type) 63 public bool CreateNewFolder(LLUUID folderID, ushort type)
64 { 64 {
65 InventoryFolder Folder = new InventoryFolder(); 65 InventoryFolder Folder = new InventoryFolder();
66 Folder.FolderID = folderID; 66 Folder.FolderID = folderID;
67 Folder.OwnerID = this.AgentID; 67 Folder.OwnerID = this.AgentID;
68 Folder.DefaultType = type; 68 Folder.DefaultType = type;
69 this.InventoryFolders.Add(Folder.FolderID, Folder); 69 this.InventoryFolders.Add(Folder.FolderID, Folder);
70 return (true); 70 return (true);
71 } 71 }
72 72
73 public void CreateRootFolder(LLUUID newAgentID, bool createTextures) 73 public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
74 { 74 {
75 this.AgentID = newAgentID; 75 this.AgentID = newAgentID;
76 InventoryRoot = new InventoryFolder(); 76 InventoryRoot = new InventoryFolder();
77 InventoryRoot.FolderID = LLUUID.Random(); 77 InventoryRoot.FolderID = LLUUID.Random();
78 InventoryRoot.ParentID = new LLUUID(); 78 InventoryRoot.ParentID = new LLUUID();
79 InventoryRoot.Version = 1; 79 InventoryRoot.Version = 1;
80 InventoryRoot.DefaultType = 8; 80 InventoryRoot.DefaultType = 8;
81 InventoryRoot.OwnerID = this.AgentID; 81 InventoryRoot.OwnerID = this.AgentID;
82 InventoryRoot.FolderName = "My Inventory"; 82 InventoryRoot.FolderName = "My Inventory";
83 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); 83 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
84 InventoryRoot.OwnerID = this.AgentID; 84 InventoryRoot.OwnerID = this.AgentID;
85 if (createTextures) 85 if (createTextures)
86 { 86 {
87 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); 87 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
88 } 88 }
89 } 89 }
90 90
91 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName) 91 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
92 { 92 {
93 InventoryFolder Folder = new InventoryFolder(); 93 InventoryFolder Folder = new InventoryFolder();
94 Folder.FolderID = folderID; 94 Folder.FolderID = folderID;
95 Folder.OwnerID = this.AgentID; 95 Folder.OwnerID = this.AgentID;
96 Folder.DefaultType = type; 96 Folder.DefaultType = type;
97 Folder.FolderName = folderName; 97 Folder.FolderName = folderName;
98 this.InventoryFolders.Add(Folder.FolderID, Folder); 98 this.InventoryFolders.Add(Folder.FolderID, Folder);
99 99
100 return (true); 100 return (true);
101 } 101 }
102 102
103 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) 103 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
104 { 104 {
105 if (!this.InventoryFolders.ContainsKey(folderID)) 105 if (!this.InventoryFolders.ContainsKey(folderID))
106 { 106 {
107 System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); 107 System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
108 InventoryFolder Folder = new InventoryFolder(); 108 InventoryFolder Folder = new InventoryFolder();
109 Folder.FolderID = folderID; 109 Folder.FolderID = folderID;
110 Folder.OwnerID = this.AgentID; 110 Folder.OwnerID = this.AgentID;
111 Folder.DefaultType = type; 111 Folder.DefaultType = type;
112 Folder.FolderName = folderName; 112 Folder.FolderName = folderName;
113 Folder.ParentID = parent; 113 Folder.ParentID = parent;
114 this.InventoryFolders.Add(Folder.FolderID, Folder); 114 this.InventoryFolders.Add(Folder.FolderID, Folder);
115 } 115 }
116 116
117 return (true); 117 return (true);
118 } 118 }
119 119
120 public bool HasFolder(LLUUID folderID) 120 public bool HasFolder(LLUUID folderID)
121 { 121 {
122 if (this.InventoryFolders.ContainsKey(folderID)) 122 if (this.InventoryFolders.ContainsKey(folderID))
123 { 123 {
124 return true; 124 return true;
125 } 125 }
126 return false; 126 return false;
127 } 127 }
128 128
129 public LLUUID GetFolderID(string folderName) 129 public LLUUID GetFolderID(string folderName)
130 { 130 {
131 foreach (InventoryFolder inv in this.InventoryFolders.Values) 131 foreach (InventoryFolder inv in this.InventoryFolders.Values)
132 { 132 {
133 if (inv.FolderName == folderName) 133 if (inv.FolderName == folderName)
134 { 134 {
135 return inv.FolderID; 135 return inv.FolderID;
136 } 136 }
137 } 137 }
138 138
139 return LLUUID.Zero; 139 return LLUUID.Zero;
140 } 140 }
141 141
142 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) 142 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
143 { 143 {
144 if(this.InventoryItems.ContainsKey(itemID)) 144 if(this.InventoryItems.ContainsKey(itemID))
145 { 145 {
146 InventoryItem Item = this.InventoryItems[itemID]; 146 InventoryItem Item = this.InventoryItems[itemID];
147 Item.AssetID = asset.FullID; 147 Item.AssetID = asset.FullID;
148 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); 148 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated());
149 //TODO need to update the rest of the info 149 //TODO need to update the rest of the info
150 } 150 }
151 return true; 151 return true;
152 } 152 }
153 153
154 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) 154 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
155 { 155 {
156 System.Console.WriteLine("updating inventory item details"); 156 System.Console.WriteLine("updating inventory item details");
157 if (this.InventoryItems.ContainsKey(itemID)) 157 if (this.InventoryItems.ContainsKey(itemID))
158 { 158 {
159 System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name)); 159 System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name));
160 InventoryItem Item = this.InventoryItems[itemID]; 160 InventoryItem Item = this.InventoryItems[itemID];
161 Item.Name = Util.FieldToString(packet.Name); 161 Item.Name = Util.FieldToString(packet.Name);
162 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); 162 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
163 //TODO need to update the rest of the info 163 //TODO need to update the rest of the info
164 } 164 }
165 return true; 165 return true;
166 } 166 }
167 167
168 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) 168 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
169 { 169 {
170 if (this.InventoryFolders.ContainsKey(folderID)) 170 if (this.InventoryFolders.ContainsKey(folderID))
171 { 171 {
172 LLUUID NewItemID = LLUUID.Random(); 172 LLUUID NewItemID = LLUUID.Random();
173 173
174 InventoryItem Item = new InventoryItem(); 174 InventoryItem Item = new InventoryItem();
175 Item.FolderID = folderID; 175 Item.FolderID = folderID;
176 Item.OwnerID = AgentID; 176 Item.OwnerID = AgentID;
177 Item.AssetID = asset.FullID; 177 Item.AssetID = asset.FullID;
178 Item.ItemID = NewItemID; 178 Item.ItemID = NewItemID;
179 Item.Type = asset.Type; 179 Item.Type = asset.Type;
180 Item.Name = asset.Name; 180 Item.Name = asset.Name;
181 Item.Description = asset.Description; 181 Item.Description = asset.Description;
182 Item.InvType = asset.InvType; 182 Item.InvType = asset.InvType;
183 this.InventoryItems.Add(Item.ItemID, Item); 183 this.InventoryItems.Add(Item.ItemID, Item);
184 InventoryFolder Folder = InventoryFolders[Item.FolderID]; 184 InventoryFolder Folder = InventoryFolders[Item.FolderID];
185 Folder.Items.Add(Item); 185 Folder.Items.Add(Item);
186 return (Item.ItemID); 186 return (Item.ItemID);
187 } 187 }
188 else 188 else
189 { 189 {
190 return (null); 190 return (null);
191 } 191 }
192 } 192 }
193 193
194 public bool DeleteFromInventory(LLUUID itemID) 194 public bool DeleteFromInventory(LLUUID itemID)
195 { 195 {
196 bool res = false; 196 bool res = false;
197 if (this.InventoryItems.ContainsKey(itemID)) 197 if (this.InventoryItems.ContainsKey(itemID))
198 { 198 {
199 InventoryItem item = this.InventoryItems[itemID]; 199 InventoryItem item = this.InventoryItems[itemID];
200 this.InventoryItems.Remove(itemID); 200 this.InventoryItems.Remove(itemID);
201 foreach (InventoryFolder fold in InventoryFolders.Values) 201 foreach (InventoryFolder fold in InventoryFolders.Values)
202 { 202 {
203 if (fold.Items.Contains(item)) 203 if (fold.Items.Contains(item))
204 { 204 {
205 fold.Items.Remove(item); 205 fold.Items.Remove(item);
206 break; 206 break;
207 } 207 }
208 } 208 }
209 res = true; 209 res = true;
210 210
211 } 211 }
212 return res; 212 return res;
213 } 213 }
214 } 214 }
215 215
216 public class InventoryFolder 216 public class InventoryFolder
217 { 217 {
218 public List<InventoryItem> Items; 218 public List<InventoryItem> Items;
219 //public List<InventoryFolder> Subfolders; 219 //public List<InventoryFolder> Subfolders;
220 public LLUUID FolderID; 220 public LLUUID FolderID;
221 public LLUUID OwnerID; 221 public LLUUID OwnerID;
222 public LLUUID ParentID = LLUUID.Zero; 222 public LLUUID ParentID = LLUUID.Zero;
223 public string FolderName; 223 public string FolderName;
224 public ushort DefaultType; 224 public ushort DefaultType;
225 public ushort Version; 225 public ushort Version;
226 226
227 public InventoryFolder() 227 public InventoryFolder()
228 { 228 {
229 Items = new List<InventoryItem>(); 229 Items = new List<InventoryItem>();
230 //Subfolders = new List<InventoryFolder>(); 230 //Subfolders = new List<InventoryFolder>();
231 } 231 }
232 232
233 } 233 }
234 234
235 public class InventoryItem 235 public class InventoryItem
236 { 236 {
237 public LLUUID FolderID; 237 public LLUUID FolderID;
238 public LLUUID OwnerID; 238 public LLUUID OwnerID;
239 public LLUUID ItemID; 239 public LLUUID ItemID;
240 public LLUUID AssetID; 240 public LLUUID AssetID;
241 public LLUUID CreatorID; 241 public LLUUID CreatorID;
242 public sbyte InvType; 242 public sbyte InvType;
243 public sbyte Type; 243 public sbyte Type;
244 public string Name =""; 244 public string Name ="";
245 public string Description; 245 public string Description;
246 246
247 public InventoryItem() 247 public InventoryItem()
248 { 248 {
249 this.CreatorID = LLUUID.Zero; 249 this.CreatorID = LLUUID.Zero;
250 } 250 }
251 251
252 public string ExportString() 252 public string ExportString()
253 { 253 {
254 string typ = "notecard"; 254 string typ = "notecard";
255 string result = ""; 255 string result = "";
256 result += "\tinv_object\t0\n\t{\n"; 256 result += "\tinv_object\t0\n\t{\n";
257 result += "\t\tobj_id\t%s\n"; 257 result += "\t\tobj_id\t%s\n";
258 result += "\t\tparent_id\t"+ ItemID.ToString() +"\n"; 258 result += "\t\tparent_id\t"+ ItemID.ToString() +"\n";
259 result += "\t\ttype\t"+ typ +"\n"; 259 result += "\t\ttype\t"+ typ +"\n";
260 result += "\t\tname\t" + Name+"|\n"; 260 result += "\t\tname\t" + Name+"|\n";
261 result += "\t}\n"; 261 result += "\t}\n";
262 return result; 262 return result;
263 } 263 }
264 } 264 }
265} 265}
diff --git a/OpenSim/Framework/General/AuthenticateSessionBase.cs b/OpenSim/Framework/General/AuthenticateSessionBase.cs
index 71616e3..2d02286 100644
--- a/OpenSim/Framework/General/AuthenticateSessionBase.cs
+++ b/OpenSim/Framework/General/AuthenticateSessionBase.cs
@@ -1,130 +1,130 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework.Types; 31using OpenSim.Framework.Types;
32 32
33namespace OpenSim.Framework 33namespace OpenSim.Framework
34{ 34{
35 public class AuthenticateSessionsBase 35 public class AuthenticateSessionsBase
36 { 36 {
37 public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); 37 public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
38 38
39 public AuthenticateSessionsBase() 39 public AuthenticateSessionsBase()
40 { 40 {
41 41
42 } 42 }
43 43
44 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) 44 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
45 { 45 {
46 AgentCircuitData validcircuit = null; 46 AgentCircuitData validcircuit = null;
47 if (this.AgentCircuits.ContainsKey(circuitcode)) 47 if (this.AgentCircuits.ContainsKey(circuitcode))
48 { 48 {
49 validcircuit = this.AgentCircuits[circuitcode]; 49 validcircuit = this.AgentCircuits[circuitcode];
50 } 50 }
51 AuthenticateResponse user = new AuthenticateResponse(); 51 AuthenticateResponse user = new AuthenticateResponse();
52 if (validcircuit == null) 52 if (validcircuit == null)
53 { 53 {
54 //don't have this circuit code in our list 54 //don't have this circuit code in our list
55 user.Authorised = false; 55 user.Authorised = false;
56 return (user); 56 return (user);
57 } 57 }
58 58
59 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) 59 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
60 { 60 {
61 user.Authorised = true; 61 user.Authorised = true;
62 user.LoginInfo = new Login(); 62 user.LoginInfo = new Login();
63 user.LoginInfo.Agent = agentID; 63 user.LoginInfo.Agent = agentID;
64 user.LoginInfo.Session = sessionID; 64 user.LoginInfo.Session = sessionID;
65 user.LoginInfo.SecureSession = validcircuit.SecureSessionID; 65 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
66 user.LoginInfo.First = validcircuit.firstname; 66 user.LoginInfo.First = validcircuit.firstname;
67 user.LoginInfo.Last = validcircuit.lastname; 67 user.LoginInfo.Last = validcircuit.lastname;
68 user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; 68 user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder;
69 user.LoginInfo.BaseFolder = validcircuit.BaseFolder; 69 user.LoginInfo.BaseFolder = validcircuit.BaseFolder;
70 } 70 }
71 else 71 else
72 { 72 {
73 // Invalid 73 // Invalid
74 user.Authorised = false; 74 user.Authorised = false;
75 } 75 }
76 76
77 return (user); 77 return (user);
78 } 78 }
79 79
80 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) 80 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
81 { 81 {
82 if (this.AgentCircuits.ContainsKey(circuitCode)) 82 if (this.AgentCircuits.ContainsKey(circuitCode))
83 { 83 {
84 this.AgentCircuits[circuitCode] = agentData; 84 this.AgentCircuits[circuitCode] = agentData;
85 } 85 }
86 else 86 else
87 { 87 {
88 this.AgentCircuits.Add(circuitCode, agentData); 88 this.AgentCircuits.Add(circuitCode, agentData);
89 } 89 }
90 } 90 }
91 91
92 public LLVector3 GetPosition(uint circuitCode) 92 public LLVector3 GetPosition(uint circuitCode)
93 { 93 {
94 LLVector3 vec = new LLVector3(); 94 LLVector3 vec = new LLVector3();
95 if (this.AgentCircuits.ContainsKey(circuitCode)) 95 if (this.AgentCircuits.ContainsKey(circuitCode))
96 { 96 {
97 vec = this.AgentCircuits[circuitCode].startpos; 97 vec = this.AgentCircuits[circuitCode].startpos;
98 } 98 }
99 return vec; 99 return vec;
100 } 100 }
101 101
102 public void UpdateAgentData(AgentCircuitData agentData) 102 public void UpdateAgentData(AgentCircuitData agentData)
103 { 103 {
104 if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) 104 if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode))
105 { 105 {
106 this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; 106 this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname;
107 this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; 107 this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname;
108 this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; 108 this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos;
109 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); 109 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
110 } 110 }
111 } 111 }
112 112
113 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) 113 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
114 { 114 {
115 if (this.AgentCircuits.ContainsKey(circuitcode)) 115 if (this.AgentCircuits.ContainsKey(circuitcode))
116 { 116 {
117 this.AgentCircuits[circuitcode].child = childstatus; 117 this.AgentCircuits[circuitcode].child = childstatus;
118 } 118 }
119 } 119 }
120 120
121 public bool GetAgentChildStatus(uint circuitcode) 121 public bool GetAgentChildStatus(uint circuitcode)
122 { 122 {
123 if (this.AgentCircuits.ContainsKey(circuitcode)) 123 if (this.AgentCircuits.ContainsKey(circuitcode))
124 { 124 {
125 return this.AgentCircuits[circuitcode].child; 125 return this.AgentCircuits[circuitcode].child;
126 } 126 }
127 return false; 127 return false;
128 } 128 }
129 } 129 }
130} \ No newline at end of file 130} \ No newline at end of file
diff --git a/OpenSim/Framework/General/BlockingQueue.cs b/OpenSim/Framework/General/BlockingQueue.cs
index 0cc8124..e263d71 100644
--- a/OpenSim/Framework/General/BlockingQueue.cs
+++ b/OpenSim/Framework/General/BlockingQueue.cs
@@ -1,58 +1,58 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Threading; 29using System.Threading;
30 30
31namespace OpenSim.Framework.Utilities 31namespace OpenSim.Framework.Utilities
32{ 32{
33 public class BlockingQueue<T> 33 public class BlockingQueue<T>
34 { 34 {
35 private Queue<T> _queue = new Queue<T>(); 35 private Queue<T> _queue = new Queue<T>();
36 private object _queueSync = new object(); 36 private object _queueSync = new object();
37 37
38 public void Enqueue(T value) 38 public void Enqueue(T value)
39 { 39 {
40 lock (_queueSync) 40 lock (_queueSync)
41 { 41 {
42 _queue.Enqueue(value); 42 _queue.Enqueue(value);
43 Monitor.Pulse(_queueSync); 43 Monitor.Pulse(_queueSync);
44 } 44 }
45 } 45 }
46 46
47 public T Dequeue() 47 public T Dequeue()
48 { 48 {
49 lock (_queueSync) 49 lock (_queueSync)
50 { 50 {
51 if (_queue.Count < 1) 51 if (_queue.Count < 1)
52 Monitor.Wait(_queueSync); 52 Monitor.Wait(_queueSync);
53 53
54 return _queue.Dequeue(); 54 return _queue.Dequeue();
55 } 55 }
56 } 56 }
57 } 57 }
58} 58}
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs
index b560ca8..0e45d03 100644
--- a/OpenSim/Framework/General/ClientManager.cs
+++ b/OpenSim/Framework/General/ClientManager.cs
@@ -1,36 +1,36 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Interfaces; 4using OpenSim.Framework.Interfaces;
5 5
6namespace OpenSim.Framework 6namespace OpenSim.Framework
7{ 7{
8 public delegate void ForEachClientDelegate( IClientAPI client ); 8 public delegate void ForEachClientDelegate( IClientAPI client );
9 public class ClientManager 9 public class ClientManager
10 { 10 {
11 private Dictionary<uint, IClientAPI> m_clients; 11 private Dictionary<uint, IClientAPI> m_clients;
12 12
13 public void ForEachClient(ForEachClientDelegate whatToDo) 13 public void ForEachClient(ForEachClientDelegate whatToDo)
14 { 14 {
15 foreach (IClientAPI client in m_clients.Values) 15 foreach (IClientAPI client in m_clients.Values)
16 { 16 {
17 whatToDo(client); 17 whatToDo(client);
18 } 18 }
19 } 19 }
20 20
21 public ClientManager() 21 public ClientManager()
22 { 22 {
23 m_clients = new Dictionary<uint, IClientAPI>(); 23 m_clients = new Dictionary<uint, IClientAPI>();
24 } 24 }
25 25
26 public void Remove(uint id) 26 public void Remove(uint id)
27 { 27 {
28 m_clients.Remove(id); 28 m_clients.Remove(id);
29 } 29 }
30 30
31 public void Add(uint id, IClientAPI client ) 31 public void Add(uint id, IClientAPI client )
32 { 32 {
33 m_clients.Add( id, client ); 33 m_clients.Add( id, client );
34 } 34 }
35 } 35 }
36} 36}
diff --git a/OpenSim/Framework/General/IRegionCommsListener.cs b/OpenSim/Framework/General/IRegionCommsListener.cs
index 32444f9..81da5d4 100644
--- a/OpenSim/Framework/General/IRegionCommsListener.cs
+++ b/OpenSim/Framework/General/IRegionCommsListener.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework.Types; 31using OpenSim.Framework.Types;
32 32
33namespace OpenSim.Framework 33namespace OpenSim.Framework
34{ 34{
35 public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); 35 public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
36 public delegate void UpdateNeighbours(List<RegionInfo> neighbours); 36 public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
37 public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position); 37 public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position);
38 38
39 public interface IRegionCommsListener 39 public interface IRegionCommsListener
40 { 40 {
41 event ExpectUserDelegate OnExpectUser; 41 event ExpectUserDelegate OnExpectUser;
42 event GenericCall2 OnExpectChildAgent; 42 event GenericCall2 OnExpectChildAgent;
43 event AgentCrossing OnAvatarCrossingIntoRegion; 43 event AgentCrossing OnAvatarCrossingIntoRegion;
44 event UpdateNeighbours OnNeighboursUpdate; 44 event UpdateNeighbours OnNeighboursUpdate;
45 } 45 }
46} 46}
diff --git a/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs b/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs
index 508485b..7c49785 100644
--- a/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs
+++ b/OpenSim/Framework/General/Interfaces/AuthenticateResponse.cs
@@ -1,43 +1,43 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework.Types; 28using OpenSim.Framework.Types;
29 29
30namespace OpenSim.Framework.Interfaces 30namespace OpenSim.Framework.Interfaces
31{ 31{
32 public class AuthenticateResponse 32 public class AuthenticateResponse
33 { 33 {
34 public bool Authorised; 34 public bool Authorised;
35 public Login LoginInfo; 35 public Login LoginInfo;
36 36
37 public AuthenticateResponse() 37 public AuthenticateResponse()
38 { 38 {
39 39
40 } 40 }
41 41
42 } 42 }
43} 43}
diff --git a/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs b/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs
index 2c379dd..57aa0c0 100644
--- a/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs
+++ b/OpenSim/Framework/General/Interfaces/Config/IGenericConfig.cs
@@ -1,38 +1,38 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Interfaces 28namespace OpenSim.Framework.Interfaces
29{ 29{
30 public interface IGenericConfig 30 public interface IGenericConfig
31 { 31 {
32 void LoadData(); 32 void LoadData();
33 string GetAttribute(string attributeName); 33 string GetAttribute(string attributeName);
34 bool SetAttribute(string attributeName, string attributeValue); 34 bool SetAttribute(string attributeName, string attributeValue);
35 void Commit(); 35 void Commit();
36 void Close(); 36 void Close();
37 } 37 }
38} 38}
diff --git a/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs b/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs
index 81dc293..20cc320 100644
--- a/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs
+++ b/OpenSim/Framework/General/Interfaces/Config/IGridConfig.cs
@@ -1,59 +1,59 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29//using OpenSim.world; 29//using OpenSim.world;
30 30
31namespace OpenSim.Framework.Interfaces 31namespace OpenSim.Framework.Interfaces
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// </summary> 34 /// </summary>
35 35
36 36
37 public abstract class GridConfig 37 public abstract class GridConfig
38 { 38 {
39 public string GridOwner; 39 public string GridOwner;
40 public string DefaultStartupMsg; 40 public string DefaultStartupMsg;
41 public string DefaultAssetServer; 41 public string DefaultAssetServer;
42 public string AssetSendKey; 42 public string AssetSendKey;
43 public string AssetRecvKey; 43 public string AssetRecvKey;
44 public string DefaultUserServer; 44 public string DefaultUserServer;
45 public string UserSendKey; 45 public string UserSendKey;
46 public string UserRecvKey; 46 public string UserRecvKey;
47 public string SimSendKey; 47 public string SimSendKey;
48 public string SimRecvKey; 48 public string SimRecvKey;
49 49
50 50
51 public abstract void InitConfig(); 51 public abstract void InitConfig();
52 52
53 } 53 }
54 54
55 public interface IGridConfig 55 public interface IGridConfig
56 { 56 {
57 GridConfig GetConfigObject(); 57 GridConfig GetConfigObject();
58 } 58 }
59} 59}
diff --git a/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs b/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs
index ae6cedb..a17804a 100644
--- a/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs
+++ b/OpenSim/Framework/General/Interfaces/Config/IUserConfig.cs
@@ -1,53 +1,53 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29//using OpenSim.world; 29//using OpenSim.world;
30 30
31namespace OpenSim.Framework.Interfaces 31namespace OpenSim.Framework.Interfaces
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// </summary> 34 /// </summary>
35 35
36 36
37 public abstract class UserConfig 37 public abstract class UserConfig
38 { 38 {
39 public string DefaultStartupMsg; 39 public string DefaultStartupMsg;
40 public string GridServerURL; 40 public string GridServerURL;
41 public string GridSendKey; 41 public string GridSendKey;
42 public string GridRecvKey; 42 public string GridRecvKey;
43 43
44 44
45 public abstract void InitConfig(); 45 public abstract void InitConfig();
46 46
47 } 47 }
48 48
49 public interface IUserConfig 49 public interface IUserConfig
50 { 50 {
51 UserConfig GetConfigObject(); 51 UserConfig GetConfigObject();
52 } 52 }
53} 53}
diff --git a/OpenSim/Framework/General/Interfaces/IAssetServer.cs b/OpenSim/Framework/General/Interfaces/IAssetServer.cs
index ab60dd7..cbb5c36 100644
--- a/OpenSim/Framework/General/Interfaces/IAssetServer.cs
+++ b/OpenSim/Framework/General/Interfaces/IAssetServer.cs
@@ -1,64 +1,64 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Types; 29using OpenSim.Framework.Types;
30 30
31namespace OpenSim.Framework.Interfaces 31namespace OpenSim.Framework.Interfaces
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Description of IAssetServer. 34 /// Description of IAssetServer.
35 /// </summary> 35 /// </summary>
36 36
37 public interface IAssetServer 37 public interface IAssetServer
38 { 38 {
39 void SetReceiver(IAssetReceiver receiver); 39 void SetReceiver(IAssetReceiver receiver);
40 void RequestAsset(LLUUID assetID, bool isTexture); 40 void RequestAsset(LLUUID assetID, bool isTexture);
41 void UpdateAsset(AssetBase asset); 41 void UpdateAsset(AssetBase asset);
42 void UploadNewAsset(AssetBase asset); 42 void UploadNewAsset(AssetBase asset);
43 void SetServerInfo(string ServerUrl, string ServerKey); 43 void SetServerInfo(string ServerUrl, string ServerKey);
44 void Close(); 44 void Close();
45 } 45 }
46 46
47 // could change to delegate? 47 // could change to delegate?
48 public interface IAssetReceiver 48 public interface IAssetReceiver
49 { 49 {
50 void AssetReceived(AssetBase asset, bool IsTexture); 50 void AssetReceived(AssetBase asset, bool IsTexture);
51 void AssetNotFound(AssetBase asset); 51 void AssetNotFound(AssetBase asset);
52 } 52 }
53 53
54 public interface IAssetPlugin 54 public interface IAssetPlugin
55 { 55 {
56 IAssetServer GetAssetServer(); 56 IAssetServer GetAssetServer();
57 } 57 }
58 58
59 public struct ARequest 59 public struct ARequest
60 { 60 {
61 public LLUUID AssetID; 61 public LLUUID AssetID;
62 public bool IsTexture; 62 public bool IsTexture;
63 } 63 }
64} 64}
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index bd258a3..0606e43 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -1,195 +1,195 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Net; 29using System.Net;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using OpenSim.Framework.Data; 33using OpenSim.Framework.Data;
34 34
35namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
36{ 36{
37 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 37 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list 38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list
39 public delegate void RezObject(AssetBase primAsset, LLVector3 pos); 39 public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west); 40 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west);
41 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); 41 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
42 public delegate void StartAnim(LLUUID animID, int seq); 42 public delegate void StartAnim(LLUUID animID, int seq);
43 public delegate void LinkObjects(uint parent, List<uint> children); 43 public delegate void LinkObjects(uint parent, List<uint> children);
44 public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); 44 public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY);
45 public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); 45 public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags);
46 46
47 public delegate void GenericCall(IClientAPI remoteClient); 47 public delegate void GenericCall(IClientAPI remoteClient);
48 public delegate void GenericCall2(); 48 public delegate void GenericCall2();
49 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. 49 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
50 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); 50 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
51 public delegate void GenericCall5(IClientAPI remoteClient, bool status); 51 public delegate void GenericCall5(IClientAPI remoteClient, bool status);
52 public delegate void GenericCall6(LLUUID uid); 52 public delegate void GenericCall6(LLUUID uid);
53 public delegate void GenericCall7(uint localID, string message); 53 public delegate void GenericCall7(uint localID, string message);
54 54
55 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); 55 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
56 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); 56 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
57 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); 57 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
58 public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); 58 public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient);
59 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); 59 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
60 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); 60 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient);
61 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 61 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
62 public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 62 public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
63 public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); 63 public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
64 public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); 64 public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags);
65 public delegate void StatusChange(bool status); 65 public delegate void StatusChange(bool status);
66 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); 66 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
67 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 67 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
68 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); 68 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
69 69
70 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); 70 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);
71 public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); 71 public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
72 public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); 72 public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
73 public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); 73 public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
74 public delegate void ParcelSelectObjects(int parcel_local_id, int request_type, IClientAPI remote_client); 74 public delegate void ParcelSelectObjects(int parcel_local_id, int request_type, IClientAPI remote_client);
75 public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); 75 public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
76 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); 76 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
77 77
78 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); 78 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
79 79
80 public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); 80 public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
81 81
82 82
83 83
84 public interface IClientAPI 84 public interface IClientAPI
85 { 85 {
86 event ImprovedInstantMessage OnInstantMessage; 86 event ImprovedInstantMessage OnInstantMessage;
87 event ChatFromViewer OnChatFromViewer; 87 event ChatFromViewer OnChatFromViewer;
88 event RezObject OnRezObject; 88 event RezObject OnRezObject;
89 event ModifyTerrain OnModifyTerrain; 89 event ModifyTerrain OnModifyTerrain;
90 event SetAppearance OnSetAppearance; 90 event SetAppearance OnSetAppearance;
91 event StartAnim OnStartAnim; 91 event StartAnim OnStartAnim;
92 event LinkObjects OnLinkObjects; 92 event LinkObjects OnLinkObjects;
93 event RequestMapBlocks OnRequestMapBlocks; 93 event RequestMapBlocks OnRequestMapBlocks;
94 event TeleportLocationRequest OnTeleportLocationRequest; 94 event TeleportLocationRequest OnTeleportLocationRequest;
95 95
96 event GenericCall4 OnDeRezObject; 96 event GenericCall4 OnDeRezObject;
97 event GenericCall OnRegionHandShakeReply; 97 event GenericCall OnRegionHandShakeReply;
98 event GenericCall OnRequestWearables; 98 event GenericCall OnRequestWearables;
99 event GenericCall2 OnCompleteMovementToRegion; 99 event GenericCall2 OnCompleteMovementToRegion;
100 event UpdateAgent OnAgentUpdate; 100 event UpdateAgent OnAgentUpdate;
101 event GenericCall OnRequestAvatarsData; 101 event GenericCall OnRequestAvatarsData;
102 event AddNewPrim OnAddPrim; 102 event AddNewPrim OnAddPrim;
103 event ObjectDuplicate OnObjectDuplicate; 103 event ObjectDuplicate OnObjectDuplicate;
104 event UpdateVector OnGrapObject; 104 event UpdateVector OnGrapObject;
105 event ObjectSelect OnDeGrapObject; 105 event ObjectSelect OnDeGrapObject;
106 event MoveObject OnGrapUpdate; 106 event MoveObject OnGrapUpdate;
107 107
108 event UpdateShape OnUpdatePrimShape; 108 event UpdateShape OnUpdatePrimShape;
109 event ObjectSelect OnObjectSelect; 109 event ObjectSelect OnObjectSelect;
110 event ObjectDeselect OnObjectDeselect; 110 event ObjectDeselect OnObjectDeselect;
111 event GenericCall7 OnObjectDescription; 111 event GenericCall7 OnObjectDescription;
112 event GenericCall7 OnObjectName; 112 event GenericCall7 OnObjectName;
113 event UpdatePrimFlags OnUpdatePrimFlags; 113 event UpdatePrimFlags OnUpdatePrimFlags;
114 event UpdatePrimTexture OnUpdatePrimTexture; 114 event UpdatePrimTexture OnUpdatePrimTexture;
115 event UpdateVector OnUpdatePrimGroupPosition; 115 event UpdateVector OnUpdatePrimGroupPosition;
116 event UpdateVector OnUpdatePrimSinglePosition; 116 event UpdateVector OnUpdatePrimSinglePosition;
117 event UpdatePrimRotation OnUpdatePrimGroupRotation; 117 event UpdatePrimRotation OnUpdatePrimGroupRotation;
118 event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 118 event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
119 event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 119 event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
120 event UpdateVector OnUpdatePrimScale; 120 event UpdateVector OnUpdatePrimScale;
121 event StatusChange OnChildAgentStatus; 121 event StatusChange OnChildAgentStatus;
122 event GenericCall2 OnStopMovement; 122 event GenericCall2 OnStopMovement;
123 event NewAvatar OnNewAvatar; 123 event NewAvatar OnNewAvatar;
124 event GenericCall6 OnRemoveAvatar; 124 event GenericCall6 OnRemoveAvatar;
125 125
126 event UUIDNameRequest OnNameFromUUIDRequest; 126 event UUIDNameRequest OnNameFromUUIDRequest;
127 127
128 event ParcelPropertiesRequest OnParcelPropertiesRequest; 128 event ParcelPropertiesRequest OnParcelPropertiesRequest;
129 event ParcelDivideRequest OnParcelDivideRequest; 129 event ParcelDivideRequest OnParcelDivideRequest;
130 event ParcelJoinRequest OnParcelJoinRequest; 130 event ParcelJoinRequest OnParcelJoinRequest;
131 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 131 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
132 event ParcelSelectObjects OnParcelSelectObjects; 132 event ParcelSelectObjects OnParcelSelectObjects;
133 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 133 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
134 event EstateOwnerMessageRequest OnEstateOwnerMessage; 134 event EstateOwnerMessageRequest OnEstateOwnerMessage;
135 135
136 LLVector3 StartPos 136 LLVector3 StartPos
137 { 137 {
138 get; 138 get;
139 set; 139 set;
140 } 140 }
141 141
142 LLUUID AgentId 142 LLUUID AgentId
143 { 143 {
144 get; 144 get;
145 } 145 }
146 146
147 string FirstName 147 string FirstName
148 { 148 {
149 get; 149 get;
150 } 150 }
151 151
152 string LastName 152 string LastName
153 { 153 {
154 get; 154 get;
155 } 155 }
156 156
157 void OutPacket(Packet newPack); 157 void OutPacket(Packet newPack);
158 void SendWearables(AvatarWearable[] wearables); 158 void SendWearables(AvatarWearable[] wearables);
159 void SendStartPingCheck(byte seq); 159 void SendStartPingCheck(byte seq);
160 void SendKillObject(ulong regionHandle, uint avatarLocalID); 160 void SendKillObject(ulong regionHandle, uint avatarLocalID);
161 void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId); 161 void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId);
162 void SendRegionHandshake(RegionInfo regionInfo); 162 void SendRegionHandshake(RegionInfo regionInfo);
163 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 163 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
164 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 164 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
165 void SendInstantMessage(string message, LLUUID target, string fromName); 165 void SendInstantMessage(string message, LLUUID target, string fromName);
166 void SendLayerData(float[] map); 166 void SendLayerData(float[] map);
167 void SendLayerData(int px, int py, float[] map); 167 void SendLayerData(int px, int py, float[] map);
168 void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); 168 void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look);
169 void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint ); 169 void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint );
170 AgentCircuitData RequestClientInfo(); 170 AgentCircuitData RequestClientInfo();
171 void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint ); 171 void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint );
172 void SendMapBlock(List<MapBlockData> mapBlocks); 172 void SendMapBlock(List<MapBlockData> mapBlocks);
173 void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); 173 void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags);
174 void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags); 174 void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags);
175 void SendTeleportCancel(); 175 void SendTeleportCancel();
176 void SendTeleportLocationStart(); 176 void SendTeleportLocationStart();
177 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); 177 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
178 178
179 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry); 179 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry);
180 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity); 180 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity);
181 181
182 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); 182 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
183 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags); 183 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags);
184 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags); 184 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags);
185 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); 185 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
186 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); 186 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
187 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); 187 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation);
188 188
189 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); 189 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
190 void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); 190 void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
191 void SendNameReply(LLUUID profileId, string firstname, string lastname); 191 void SendNameReply(LLUUID profileId, string firstname, string lastname);
192 192
193 193
194 } 194 }
195} 195}
diff --git a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs b/OpenSim/Framework/General/Interfaces/ILocalStorage.cs
index 7093121..c7c0b5f 100644
--- a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs
+++ b/OpenSim/Framework/General/Interfaces/ILocalStorage.cs
@@ -1,71 +1,71 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Types; 30using OpenSim.Framework.Types;
31 31
32namespace OpenSim.Framework.Interfaces 32namespace OpenSim.Framework.Interfaces
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// ILocalStorage. Really hacked together right now needs cleaning up 35 /// ILocalStorage. Really hacked together right now needs cleaning up
36 /// </summary> 36 /// </summary>
37 [System.Obsolete("Redundant, use IRegionDataStore instead")] 37 [System.Obsolete("Redundant, use IRegionDataStore instead")]
38 public interface ILocalStorage 38 public interface ILocalStorage
39 { 39 {
40 void Initialise(string datastore); 40 void Initialise(string datastore);
41 41
42 void StorePrim(PrimData prim); 42 void StorePrim(PrimData prim);
43 void RemovePrim(LLUUID primID); 43 void RemovePrim(LLUUID primID);
44 void LoadPrimitives(ILocalStorageReceiver receiver); 44 void LoadPrimitives(ILocalStorageReceiver receiver);
45 45
46 [System.Obsolete("Use DataStorage instead")] 46 [System.Obsolete("Use DataStorage instead")]
47 float[] LoadWorld(); 47 float[] LoadWorld();
48 [System.Obsolete("Use DataStorage instead")] 48 [System.Obsolete("Use DataStorage instead")]
49 void SaveMap(float[] heightmap); 49 void SaveMap(float[] heightmap);
50 50
51 void SaveParcels(ParcelData[] parcels); 51 void SaveParcels(ParcelData[] parcels);
52 void SaveParcel(ParcelData parcel); 52 void SaveParcel(ParcelData parcel);
53 void RemoveParcel(ParcelData parcel); 53 void RemoveParcel(ParcelData parcel);
54 void RemoveAllParcels(); 54 void RemoveAllParcels();
55 void LoadParcels(ILocalStorageParcelReceiver recv); 55 void LoadParcels(ILocalStorageParcelReceiver recv);
56 56
57 void ShutDown(); 57 void ShutDown();
58 } 58 }
59 59
60 public interface ILocalStorageReceiver 60 public interface ILocalStorageReceiver
61 { 61 {
62 void PrimFromStorage(PrimData prim); 62 void PrimFromStorage(PrimData prim);
63 } 63 }
64 64
65 public interface ILocalStorageParcelReceiver 65 public interface ILocalStorageParcelReceiver
66 { 66 {
67 void ParcelFromStorage(ParcelData data); 67 void ParcelFromStorage(ParcelData data);
68 void NoParcelDataFromStorage(); 68 void NoParcelDataFromStorage();
69 } 69 }
70} 70}
71 71
diff --git a/OpenSim/Framework/General/Interfaces/IUserServer.cs b/OpenSim/Framework/General/Interfaces/IUserServer.cs
index b3700d2..ca5816d 100644
--- a/OpenSim/Framework/General/Interfaces/IUserServer.cs
+++ b/OpenSim/Framework/General/Interfaces/IUserServer.cs
@@ -1,39 +1,39 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Inventory; 29using OpenSim.Framework.Inventory;
30 30
31namespace OpenSim.Framework.Interfaces 31namespace OpenSim.Framework.Interfaces
32{ 32{
33 public interface IUserServer 33 public interface IUserServer
34 { 34 {
35 AgentInventory RequestAgentsInventory(LLUUID agentID); 35 AgentInventory RequestAgentsInventory(LLUUID agentID);
36 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); 36 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
37 bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory); 37 bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
38 } 38 }
39} 39}
diff --git a/OpenSim/Framework/General/Interfaces/IWorld.cs b/OpenSim/Framework/General/Interfaces/IWorld.cs
index 204c01b..a474636 100644
--- a/OpenSim/Framework/General/Interfaces/IWorld.cs
+++ b/OpenSim/Framework/General/Interfaces/IWorld.cs
@@ -1,42 +1,42 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Types; 29using OpenSim.Framework.Types;
30 30
31namespace OpenSim.Framework.Interfaces 31namespace OpenSim.Framework.Interfaces
32{ 32{
33 public interface IWorld 33 public interface IWorld
34 { 34 {
35 void AddNewClient(IClientAPI client, bool child); 35 void AddNewClient(IClientAPI client, bool child);
36 void RemoveClient(LLUUID agentID); 36 void RemoveClient(LLUUID agentID);
37 37
38 RegionInfo RegionInfo { get; } 38 RegionInfo RegionInfo { get; }
39 object SyncRoot { get; } 39 object SyncRoot { get; }
40 uint NextLocalId { get; } 40 uint NextLocalId { get; }
41 } 41 }
42} 42}
diff --git a/OpenSim/Framework/General/NpcClientBase.cs b/OpenSim/Framework/General/NpcClientBase.cs
index 44d6d3c..044431b 100644
--- a/OpenSim/Framework/General/NpcClientBase.cs
+++ b/OpenSim/Framework/General/NpcClientBase.cs
@@ -1,127 +1,127 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using System.Net; 2using System.Net;
3using OpenSim.Framework.Interfaces; 3using OpenSim.Framework.Interfaces;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6using libsecondlife; 6using libsecondlife;
7using libsecondlife.Packets; 7using libsecondlife.Packets;
8 8
9 9
10namespace OpenSim.Framework 10namespace OpenSim.Framework
11{ 11{
12 public class NpcClientBase :IClientAPI 12 public class NpcClientBase :IClientAPI
13 { 13 {
14 public event ImprovedInstantMessage OnInstantMessage; 14 public event ImprovedInstantMessage OnInstantMessage;
15 public event ChatFromViewer OnChatFromViewer; 15 public event ChatFromViewer OnChatFromViewer;
16 public event RezObject OnRezObject; 16 public event RezObject OnRezObject;
17 public event ModifyTerrain OnModifyTerrain; 17 public event ModifyTerrain OnModifyTerrain;
18 public event SetAppearance OnSetAppearance; 18 public event SetAppearance OnSetAppearance;
19 public event StartAnim OnStartAnim; 19 public event StartAnim OnStartAnim;
20 public event LinkObjects OnLinkObjects; 20 public event LinkObjects OnLinkObjects;
21 public event RequestMapBlocks OnRequestMapBlocks; 21 public event RequestMapBlocks OnRequestMapBlocks;
22 public event TeleportLocationRequest OnTeleportLocationRequest; 22 public event TeleportLocationRequest OnTeleportLocationRequest;
23 23
24 public event GenericCall4 OnDeRezObject; 24 public event GenericCall4 OnDeRezObject;
25 public event GenericCall OnRegionHandShakeReply; 25 public event GenericCall OnRegionHandShakeReply;
26 public event GenericCall OnRequestWearables; 26 public event GenericCall OnRequestWearables;
27 public event GenericCall2 OnCompleteMovementToRegion; 27 public event GenericCall2 OnCompleteMovementToRegion;
28 public event UpdateAgent OnAgentUpdate; 28 public event UpdateAgent OnAgentUpdate;
29 public event GenericCall OnRequestAvatarsData; 29 public event GenericCall OnRequestAvatarsData;
30 public event AddNewPrim OnAddPrim; 30 public event AddNewPrim OnAddPrim;
31 public event ObjectDuplicate OnObjectDuplicate; 31 public event ObjectDuplicate OnObjectDuplicate;
32 public event UpdateVector OnGrapObject; 32 public event UpdateVector OnGrapObject;
33 public event ObjectSelect OnDeGrapObject; 33 public event ObjectSelect OnDeGrapObject;
34 public event MoveObject OnGrapUpdate; 34 public event MoveObject OnGrapUpdate;
35 35
36 public event UpdateShape OnUpdatePrimShape; 36 public event UpdateShape OnUpdatePrimShape;
37 public event ObjectSelect OnObjectSelect; 37 public event ObjectSelect OnObjectSelect;
38 public event GenericCall7 OnObjectDescription; 38 public event GenericCall7 OnObjectDescription;
39 public event GenericCall7 OnObjectName; 39 public event GenericCall7 OnObjectName;
40 public event UpdatePrimFlags OnUpdatePrimFlags; 40 public event UpdatePrimFlags OnUpdatePrimFlags;
41 public event UpdatePrimTexture OnUpdatePrimTexture; 41 public event UpdatePrimTexture OnUpdatePrimTexture;
42 public event UpdateVector OnUpdatePrimGroupPosition; 42 public event UpdateVector OnUpdatePrimGroupPosition;
43 public event UpdateVector OnUpdatePrimSinglePosition; 43 public event UpdateVector OnUpdatePrimSinglePosition;
44 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 44 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
45 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 45 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
46 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 46 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
47 public event UpdateVector OnUpdatePrimScale; 47 public event UpdateVector OnUpdatePrimScale;
48 public event StatusChange OnChildAgentStatus; 48 public event StatusChange OnChildAgentStatus;
49 public event GenericCall2 OnStopMovement; 49 public event GenericCall2 OnStopMovement;
50 public event NewAvatar OnNewAvatar; 50 public event NewAvatar OnNewAvatar;
51 public event GenericCall6 OnRemoveAvatar; 51 public event GenericCall6 OnRemoveAvatar;
52 52
53 public event UUIDNameRequest OnNameFromUUIDRequest; 53 public event UUIDNameRequest OnNameFromUUIDRequest;
54 54
55 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 55 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
56 public event ParcelDivideRequest OnParcelDivideRequest; 56 public event ParcelDivideRequest OnParcelDivideRequest;
57 public event ParcelJoinRequest OnParcelJoinRequest; 57 public event ParcelJoinRequest OnParcelJoinRequest;
58 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 58 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
59 public event ParcelSelectObjects OnParcelSelectObjects; 59 public event ParcelSelectObjects OnParcelSelectObjects;
60 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 60 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
61 public event ObjectDeselect OnObjectDeselect; 61 public event ObjectDeselect OnObjectDeselect;
62 62
63 63
64 public event EstateOwnerMessageRequest OnEstateOwnerMessage; 64 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
65 65
66 public virtual LLVector3 StartPos 66 public virtual LLVector3 StartPos
67 { 67 {
68 get { return new LLVector3(); } 68 get { return new LLVector3(); }
69 set { } 69 set { }
70 } 70 }
71 71
72 public virtual LLUUID AgentId 72 public virtual LLUUID AgentId
73 { 73 {
74 get { return LLUUID.Random(); } 74 get { return LLUUID.Random(); }
75 } 75 }
76 76
77 public virtual string FirstName 77 public virtual string FirstName
78 { 78 {
79 get { return ""; } 79 get { return ""; }
80 } 80 }
81 81
82 public virtual string LastName 82 public virtual string LastName
83 { 83 {
84 get { return ""; } 84 get { return ""; }
85 } 85 }
86 86
87 public NpcClientBase() 87 public NpcClientBase()
88 { 88 {
89 } 89 }
90 90
91 public virtual void OutPacket(Packet newPack){} 91 public virtual void OutPacket(Packet newPack){}
92 public virtual void SendWearables(AvatarWearable[] wearables){} 92 public virtual void SendWearables(AvatarWearable[] wearables){}
93 public virtual void SendStartPingCheck(byte seq){} 93 public virtual void SendStartPingCheck(byte seq){}
94 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID){} 94 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID){}
95 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){} 95 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){}
96 public virtual void SendRegionHandshake(RegionInfo regionInfo){} 96 public virtual void SendRegionHandshake(RegionInfo regionInfo){}
97 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} 97 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
98 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} 98 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
99 public virtual void SendInstantMessage(string message, LLUUID target, string fromName){} 99 public virtual void SendInstantMessage(string message, LLUUID target, string fromName){}
100 public virtual void SendLayerData(float[] map){} 100 public virtual void SendLayerData(float[] map){}
101 public virtual void SendLayerData(int px, int py, float[] map){} 101 public virtual void SendLayerData(int px, int py, float[] map){}
102 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look){} 102 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look){}
103 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint){} 103 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint){}
104 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } 104 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); }
105 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint){} 105 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint){}
106 public virtual void SendMapBlock(List<MapBlockData> mapBlocks){} 106 public virtual void SendMapBlock(List<MapBlockData> mapBlocks){}
107 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags){} 107 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags){}
108 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags){} 108 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags){}
109 public virtual void SendTeleportCancel(){} 109 public virtual void SendTeleportCancel(){}
110 public virtual void SendTeleportLocationStart(){} 110 public virtual void SendTeleportLocationStart(){}
111 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){} 111 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){}
112 112
113 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){} 113 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){}
114 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity){} 114 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity){}
115 115
116 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){} 116 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){}
117 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags){} 117 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags){}
118 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags){} 118 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags){}
119 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){} 119 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){}
120 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){} 120 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){}
121 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){} 121 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){}
122 122
123 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} 123 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
124 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){} 124 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){}
125 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} 125 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
126 } 126 }
127} 127}
diff --git a/OpenSim/Framework/General/Properties/AssemblyInfo.cs b/OpenSim/Framework/General/Properties/AssemblyInfo.cs
index 004040b..655cffc 100644
--- a/OpenSim/Framework/General/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/General/Properties/AssemblyInfo.cs
@@ -1,31 +1,31 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.FrameWork")] 6[assembly: AssemblyTitle("OpenSim.FrameWork")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.FrameWork")] 10[assembly: AssemblyProduct("OpenSim.FrameWork")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] 21[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30[assembly: AssemblyVersion("1.0.0.0")] 30[assembly: AssemblyVersion("1.0.0.0")]
31[assembly: AssemblyFileVersion("1.0.0.0")] 31[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/General/RegionCommsListener.cs b/OpenSim/Framework/General/RegionCommsListener.cs
index 4d6b59c..f5b8272 100644
--- a/OpenSim/Framework/General/RegionCommsListener.cs
+++ b/OpenSim/Framework/General/RegionCommsListener.cs
@@ -1,103 +1,103 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Interfaces; 29using OpenSim.Framework.Interfaces;
30using OpenSim.Framework.Types; 30using OpenSim.Framework.Types;
31 31
32using System.Collections.Generic; 32using System.Collections.Generic;
33 33
34namespace OpenSim.Framework 34namespace OpenSim.Framework
35{ 35{
36 public class RegionCommsListener :IRegionCommsListener 36 public class RegionCommsListener :IRegionCommsListener
37 { 37 {
38 public event ExpectUserDelegate OnExpectUser; 38 public event ExpectUserDelegate OnExpectUser;
39 public event GenericCall2 OnExpectChildAgent; 39 public event GenericCall2 OnExpectChildAgent;
40 public event AgentCrossing OnAvatarCrossingIntoRegion; 40 public event AgentCrossing OnAvatarCrossingIntoRegion;
41 public event UpdateNeighbours OnNeighboursUpdate; 41 public event UpdateNeighbours OnNeighboursUpdate;
42 42
43 /// <summary> 43 /// <summary>
44 /// 44 ///
45 /// </summary> 45 /// </summary>
46 /// <param name="agent"></param> 46 /// <param name="agent"></param>
47 /// <returns></returns> 47 /// <returns></returns>
48 public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) 48 public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
49 { 49 {
50 if(OnExpectUser != null) 50 if(OnExpectUser != null)
51 { 51 {
52 52
53 OnExpectUser(regionHandle, agent); 53 OnExpectUser(regionHandle, agent);
54 return true; 54 return true;
55 } 55 }
56 56
57 return false; 57 return false;
58 } 58 }
59 59
60 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 60 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
61 { 61 {
62 if (OnAvatarCrossingIntoRegion != null) 62 if (OnAvatarCrossingIntoRegion != null)
63 { 63 {
64 OnAvatarCrossingIntoRegion(regionHandle, agentID, position); 64 OnAvatarCrossingIntoRegion(regionHandle, agentID, position);
65 return true; 65 return true;
66 } 66 }
67 return false; 67 return false;
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// 71 ///
72 /// </summary> 72 /// </summary>
73 /// <remarks>TODO: Doesnt take any args??</remarks> 73 /// <remarks>TODO: Doesnt take any args??</remarks>
74 /// <returns></returns> 74 /// <returns></returns>
75 public virtual bool TriggerExpectChildAgent() 75 public virtual bool TriggerExpectChildAgent()
76 { 76 {
77 if (OnExpectChildAgent != null) 77 if (OnExpectChildAgent != null)
78 { 78 {
79 OnExpectChildAgent(); 79 OnExpectChildAgent();
80 return true; 80 return true;
81 } 81 }
82 82
83 return false; 83 return false;
84 } 84 }
85 85
86 /// <summary> 86 /// <summary>
87 /// 87 ///
88 /// </summary> 88 /// </summary>
89 /// <remarks>Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me</remarks> 89 /// <remarks>Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me</remarks>
90 /// <param name="neighbours"></param> 90 /// <param name="neighbours"></param>
91 /// <returns></returns> 91 /// <returns></returns>
92 public virtual bool TriggerOnNeighboursUpdate(List<RegionInfo> neighbours) 92 public virtual bool TriggerOnNeighboursUpdate(List<RegionInfo> neighbours)
93 { 93 {
94 if (OnNeighboursUpdate != null) 94 if (OnNeighboursUpdate != null)
95 { 95 {
96 OnNeighboursUpdate(neighbours); 96 OnNeighboursUpdate(neighbours);
97 return true; 97 return true;
98 } 98 }
99 99
100 return false; 100 return false;
101 } 101 }
102 } 102 }
103} 103}
diff --git a/OpenSim/Framework/General/Remoting.cs b/OpenSim/Framework/General/Remoting.cs
index df32db2..0e94b90 100644
--- a/OpenSim/Framework/General/Remoting.cs
+++ b/OpenSim/Framework/General/Remoting.cs
@@ -1,135 +1,135 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Security.Cryptography; 29using System.Security.Cryptography;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// NEEDS AUDIT. 35 /// NEEDS AUDIT.
36 /// </summary> 36 /// </summary>
37 /// <remarks> 37 /// <remarks>
38 /// Suggested implementation 38 /// Suggested implementation
39 /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para> 39 /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para>
40 /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para> 40 /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
41 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para> 41 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
42 /// <para>Both hosts should be performing these operations for this to be effective.</para> 42 /// <para>Both hosts should be performing these operations for this to be effective.</para>
43 /// </remarks> 43 /// </remarks>
44 class RemoteDigest 44 class RemoteDigest
45 { 45 {
46 private byte[] currentHash; 46 private byte[] currentHash;
47 private byte[] secret; 47 private byte[] secret;
48 48
49 private SHA512Managed SHA512; 49 private SHA512Managed SHA512;
50 50
51 /// <summary> 51 /// <summary>
52 /// Initialises a new RemoteDigest authentication mechanism 52 /// Initialises a new RemoteDigest authentication mechanism
53 /// </summary> 53 /// </summary>
54 /// <remarks>Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting</remarks> 54 /// <remarks>Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting</remarks>
55 /// <param name="sharedSecret">The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)</param> 55 /// <param name="sharedSecret">The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)</param>
56 /// <param name="salt">Binary salt - some common value - to be decided what</param> 56 /// <param name="salt">Binary salt - some common value - to be decided what</param>
57 /// <param name="challenge">The challenge key provided by the third party</param> 57 /// <param name="challenge">The challenge key provided by the third party</param>
58 public RemoteDigest(string sharedSecret, byte[] salt, string challenge) 58 public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
59 { 59 {
60 SHA512 = new SHA512Managed(); 60 SHA512 = new SHA512Managed();
61 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt); 61 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt);
62 secret = RFC2898.GetBytes(512); 62 secret = RFC2898.GetBytes(512);
63 ASCIIEncoding ASCII = new ASCIIEncoding(); 63 ASCIIEncoding ASCII = new ASCIIEncoding();
64 64
65 currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge))); 65 currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
66 } 66 }
67 67
68 /// <summary> 68 /// <summary>
69 /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented. 69 /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
70 /// </summary> 70 /// </summary>
71 /// <param name="data">The incoming data</param> 71 /// <param name="data">The incoming data</param>
72 /// <param name="digest">The remote digest</param> 72 /// <param name="digest">The remote digest</param>
73 /// <returns></returns> 73 /// <returns></returns>
74 public bool Authenticate(byte[] data, byte[] digest) 74 public bool Authenticate(byte[] data, byte[] digest)
75 { 75 {
76 byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); 76 byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
77 if (digest == newHash) 77 if (digest == newHash)
78 { 78 {
79 currentHash = newHash; 79 currentHash = newHash;
80 return true; 80 return true;
81 } 81 }
82 else 82 else
83 { 83 {
84 throw new Exception("Hash comparison failed. Key resync required."); 84 throw new Exception("Hash comparison failed. Key resync required.");
85 } 85 }
86 } 86 }
87 87
88 /// <summary> 88 /// <summary>
89 /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message. 89 /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
90 /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the 90 /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
91 /// hashes will get out of sync and throw an exception when validation is attempted. 91 /// hashes will get out of sync and throw an exception when validation is attempted.
92 /// </summary> 92 /// </summary>
93 /// <param name="data">The outgoing data</param> 93 /// <param name="data">The outgoing data</param>
94 /// <returns>The local digest</returns> 94 /// <returns>The local digest</returns>
95 public byte[] Sign(byte[] data) 95 public byte[] Sign(byte[] data)
96 { 96 {
97 currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); 97 currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
98 return currentHash; 98 return currentHash;
99 } 99 }
100 100
101 /// <summary> 101 /// <summary>
102 /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator. 102 /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator.
103 /// </summary> 103 /// </summary>
104 /// <returns>A 128-character hexadecimal string containing the challenge.</returns> 104 /// <returns>A 128-character hexadecimal string containing the challenge.</returns>
105 public static string GenerateChallenge() 105 public static string GenerateChallenge()
106 { 106 {
107 RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider(); 107 RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
108 byte[] bytes = new byte[64]; 108 byte[] bytes = new byte[64];
109 RNG.GetBytes(bytes); 109 RNG.GetBytes(bytes);
110 110
111 StringBuilder sb = new StringBuilder(bytes.Length * 2); 111 StringBuilder sb = new StringBuilder(bytes.Length * 2);
112 foreach (byte b in bytes) 112 foreach (byte b in bytes)
113 { 113 {
114 sb.AppendFormat("{0:x2}", b); 114 sb.AppendFormat("{0:x2}", b);
115 } 115 }
116 return sb.ToString(); 116 return sb.ToString();
117 } 117 }
118 118
119 /// <summary> 119 /// <summary>
120 /// Helper function, merges two byte arrays 120 /// Helper function, merges two byte arrays
121 /// </summary> 121 /// </summary>
122 /// <remarks>Sourced from MSDN Forum</remarks> 122 /// <remarks>Sourced from MSDN Forum</remarks>
123 /// <param name="a">A</param> 123 /// <param name="a">A</param>
124 /// <param name="b">B</param> 124 /// <param name="b">B</param>
125 /// <returns>C</returns> 125 /// <returns>C</returns>
126 private byte[] AppendArrays(byte[] a, byte[] b) 126 private byte[] AppendArrays(byte[] a, byte[] b)
127 { 127 {
128 byte[] c = new byte[a.Length + b.Length]; 128 byte[] c = new byte[a.Length + b.Length];
129 Buffer.BlockCopy(a, 0, c, 0, a.Length); 129 Buffer.BlockCopy(a, 0, c, 0, a.Length);
130 Buffer.BlockCopy(b, 0, c, a.Length, b.Length); 130 Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
131 return c; 131 return c;
132 } 132 }
133 133
134 } 134 }
135} 135}
diff --git a/OpenSim/Framework/General/Types/AgentCiruitData.cs b/OpenSim/Framework/General/Types/AgentCiruitData.cs
index ed9ee3c..36bb26d 100644
--- a/OpenSim/Framework/General/Types/AgentCiruitData.cs
+++ b/OpenSim/Framework/General/Types/AgentCiruitData.cs
@@ -1,49 +1,49 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using System; 29using System;
30 30
31namespace OpenSim.Framework.Types 31namespace OpenSim.Framework.Types
32{ 32{
33 [Serializable] 33 [Serializable]
34 public class AgentCircuitData 34 public class AgentCircuitData
35 { 35 {
36 public AgentCircuitData() { } 36 public AgentCircuitData() { }
37 public LLUUID AgentID; 37 public LLUUID AgentID;
38 public LLUUID SessionID; 38 public LLUUID SessionID;
39 public LLUUID SecureSessionID; 39 public LLUUID SecureSessionID;
40 public LLVector3 startpos; 40 public LLVector3 startpos;
41 public string firstname; 41 public string firstname;
42 public string lastname; 42 public string lastname;
43 public uint circuitcode; 43 public uint circuitcode;
44 public bool child; 44 public bool child;
45 public LLUUID InventoryFolder; 45 public LLUUID InventoryFolder;
46 public LLUUID BaseFolder; 46 public LLUUID BaseFolder;
47 public string CapsPath = ""; 47 public string CapsPath = "";
48 } 48 }
49} 49}
diff --git a/OpenSim/Framework/General/Types/AgentWearable.cs b/OpenSim/Framework/General/Types/AgentWearable.cs
index 6152b7d..404df0d 100644
--- a/OpenSim/Framework/General/Types/AgentWearable.cs
+++ b/OpenSim/Framework/General/Types/AgentWearable.cs
@@ -1,57 +1,57 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Types 30namespace OpenSim.Framework.Types
31{ 31{
32 public class AvatarWearable 32 public class AvatarWearable
33 { 33 {
34 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); 34 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
35 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); 35 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
36 36
37 public AvatarWearable() 37 public AvatarWearable()
38 { 38 {
39 39
40 } 40 }
41 41
42 public static AvatarWearable[] DefaultWearables 42 public static AvatarWearable[] DefaultWearables
43 { 43 {
44 get 44 get
45 { 45 {
46 AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these 46 AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these
47 for (int i = 0; i < 13; i++) 47 for (int i = 0; i < 13; i++)
48 { 48 {
49 defaultWearables[i] = new AvatarWearable(); 49 defaultWearables[i] = new AvatarWearable();
50 } 50 }
51 defaultWearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 51 defaultWearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
52 defaultWearables[0].ItemID = LLUUID.Random(); 52 defaultWearables[0].ItemID = LLUUID.Random();
53 return defaultWearables; 53 return defaultWearables;
54 } 54 }
55 } 55 }
56 } 56 }
57} 57}
diff --git a/OpenSim/Framework/General/Types/AssetBase.cs b/OpenSim/Framework/General/Types/AssetBase.cs
index c203f51..181e1e3 100644
--- a/OpenSim/Framework/General/Types/AssetBase.cs
+++ b/OpenSim/Framework/General/Types/AssetBase.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Types 30namespace OpenSim.Framework.Types
31{ 31{
32 public class AssetBase 32 public class AssetBase
33 { 33 {
34 public byte[] Data; 34 public byte[] Data;
35 public LLUUID FullID; 35 public LLUUID FullID;
36 public sbyte Type; 36 public sbyte Type;
37 public sbyte InvType; 37 public sbyte InvType;
38 public string Name; 38 public string Name;
39 public string Description; 39 public string Description;
40 40
41 public AssetBase() 41 public AssetBase()
42 { 42 {
43 43
44 } 44 }
45 } 45 }
46} 46}
diff --git a/OpenSim/Framework/General/Types/AssetLandmark.cs b/OpenSim/Framework/General/Types/AssetLandmark.cs
index 8aa872e..7cec6f6 100644
--- a/OpenSim/Framework/General/Types/AssetLandmark.cs
+++ b/OpenSim/Framework/General/Types/AssetLandmark.cs
@@ -1,59 +1,59 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Text; 28using System.Text;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Types 31namespace OpenSim.Framework.Types
32{ 32{
33 public class AssetLandmark : AssetBase 33 public class AssetLandmark : AssetBase
34 { 34 {
35 public int Version; 35 public int Version;
36 public LLVector3 Position; 36 public LLVector3 Position;
37 public LLUUID RegionID; 37 public LLUUID RegionID;
38 38
39 public AssetLandmark(AssetBase a) 39 public AssetLandmark(AssetBase a)
40 { 40 {
41 this.Data = a.Data; 41 this.Data = a.Data;
42 this.FullID = a.FullID; 42 this.FullID = a.FullID;
43 this.Type = a.Type; 43 this.Type = a.Type;
44 this.InvType = a.InvType; 44 this.InvType = a.InvType;
45 this.Name = a.Name; 45 this.Name = a.Name;
46 this.Description = a.Description; 46 this.Description = a.Description;
47 InternData(); 47 InternData();
48 } 48 }
49 49
50 private void InternData() 50 private void InternData()
51 { 51 {
52 string temp = Encoding.UTF8.GetString(Data).Trim(); 52 string temp = Encoding.UTF8.GetString(Data).Trim();
53 string[] parts = temp.Split('\n'); 53 string[] parts = temp.Split('\n');
54 int.TryParse(parts[0].Substring(17, 1), out Version); 54 int.TryParse(parts[0].Substring(17, 1), out Version);
55 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); 55 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
56 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); 56 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
57 } 57 }
58 } 58 }
59} 59}
diff --git a/OpenSim/Framework/General/Types/AssetStorage.cs b/OpenSim/Framework/General/Types/AssetStorage.cs
index 3681336..d49e9e8 100644
--- a/OpenSim/Framework/General/Types/AssetStorage.cs
+++ b/OpenSim/Framework/General/Types/AssetStorage.cs
@@ -1,47 +1,47 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Types 30namespace OpenSim.Framework.Types
31{ 31{
32 public class AssetStorage 32 public class AssetStorage
33 { 33 {
34 34
35 public AssetStorage() { 35 public AssetStorage() {
36 } 36 }
37 37
38 public AssetStorage(LLUUID assetUUID) { 38 public AssetStorage(LLUUID assetUUID) {
39 UUID=assetUUID; 39 UUID=assetUUID;
40 } 40 }
41 41
42 public byte[] Data; 42 public byte[] Data;
43 public sbyte Type; 43 public sbyte Type;
44 public string Name; 44 public string Name;
45 public LLUUID UUID; 45 public LLUUID UUID;
46 } 46 }
47} 47}
diff --git a/OpenSim/Framework/General/Types/EstateSettings.cs b/OpenSim/Framework/General/Types/EstateSettings.cs
index 436b109..25b3b18 100644
--- a/OpenSim/Framework/General/Types/EstateSettings.cs
+++ b/OpenSim/Framework/General/Types/EstateSettings.cs
@@ -1,93 +1,93 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Types 31namespace OpenSim.Framework.Types
32{ 32{
33 public class EstateSettings 33 public class EstateSettings
34 { 34 {
35 //Settings to this island 35 //Settings to this island
36 public float billableFactor = (float)0.0; 36 public float billableFactor = (float)0.0;
37 public uint estateID = 0; 37 public uint estateID = 0;
38 public uint parentEstateID = 0; 38 public uint parentEstateID = 0;
39 39
40 public byte maxAgents = 40; 40 public byte maxAgents = 40;
41 public float objectBonusFactor = (float)1.0; 41 public float objectBonusFactor = (float)1.0;
42 42
43 public int redirectGridX = 0; //?? 43 public int redirectGridX = 0; //??
44 public int redirectGridY = 0; //?? 44 public int redirectGridY = 0; //??
45 public Simulator.RegionFlags regionFlags = Simulator.RegionFlags.None; //Booleam values of various region settings 45 public Simulator.RegionFlags regionFlags = Simulator.RegionFlags.None; //Booleam values of various region settings
46 public Simulator.SimAccess simAccess = Simulator.SimAccess.Mature; //Is sim PG, Mature, etc? Mature by default. 46 public Simulator.SimAccess simAccess = Simulator.SimAccess.Mature; //Is sim PG, Mature, etc? Mature by default.
47 public float sunHour = 0; 47 public float sunHour = 0;
48 48
49 public float terrainRaiseLimit = 0; 49 public float terrainRaiseLimit = 0;
50 public float terrainLowerLimit = 0; 50 public float terrainLowerLimit = 0;
51 51
52 public bool useFixedSun = false; 52 public bool useFixedSun = false;
53 public int pricePerMeter = 1; 53 public int pricePerMeter = 1;
54 54
55 public ushort regionWaterHeight = 20; 55 public ushort regionWaterHeight = 20;
56 public bool regionAllowTerraform = true; 56 public bool regionAllowTerraform = true;
57 57
58 // Region Information 58 // Region Information
59 // Low resolution 'base' textures. No longer used. 59 // Low resolution 'base' textures. No longer used.
60 public LLUUID terrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default 60 public LLUUID terrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default
61 public LLUUID terrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default 61 public LLUUID terrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default
62 public LLUUID terrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default 62 public LLUUID terrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default
63 public LLUUID terrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default 63 public LLUUID terrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default
64 64
65 // Higher resolution terrain textures 65 // Higher resolution terrain textures
66 public LLUUID terrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); 66 public LLUUID terrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
67 public LLUUID terrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); 67 public LLUUID terrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
68 public LLUUID terrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); 68 public LLUUID terrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
69 public LLUUID terrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); 69 public LLUUID terrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
70 70
71 // First quad - each point is bilinearly interpolated at each meter of terrain 71 // First quad - each point is bilinearly interpolated at each meter of terrain
72 public float terrainStartHeight0 = 10.0f; 72 public float terrainStartHeight0 = 10.0f;
73 public float terrainStartHeight1 = 10.0f; 73 public float terrainStartHeight1 = 10.0f;
74 public float terrainStartHeight2 = 10.0f; 74 public float terrainStartHeight2 = 10.0f;
75 public float terrainStartHeight3 = 10.0f; 75 public float terrainStartHeight3 = 10.0f;
76 76
77 // Second quad - also bilinearly interpolated. 77 // Second quad - also bilinearly interpolated.
78 // Terrain texturing is done that: 78 // Terrain texturing is done that:
79 // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] 79 // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
80 public float terrainHeightRange0 = 60.0f; //00 80 public float terrainHeightRange0 = 60.0f; //00
81 public float terrainHeightRange1 = 60.0f; //01 81 public float terrainHeightRange1 = 60.0f; //01
82 public float terrainHeightRange2 = 60.0f; //10 82 public float terrainHeightRange2 = 60.0f; //10
83 public float terrainHeightRange3 = 60.0f; //11 83 public float terrainHeightRange3 = 60.0f; //11
84 84
85 // Terrain Default (Must be in F32 Format!) 85 // Terrain Default (Must be in F32 Format!)
86 public string terrainFile = "default.r32"; 86 public string terrainFile = "default.r32";
87 public double terrainMultiplier = 60.0; 87 public double terrainMultiplier = 60.0;
88 public float waterHeight = (float)20.0; 88 public float waterHeight = (float)20.0;
89 89
90 public LLUUID terrainImageID = LLUUID.Zero; // the assetID that is the current Map image for this region 90 public LLUUID terrainImageID = LLUUID.Zero; // the assetID that is the current Map image for this region
91 91
92 } 92 }
93} 93}
diff --git a/OpenSim/Framework/General/Types/Login.cs b/OpenSim/Framework/General/Types/Login.cs
index d54c019..3aaf613 100644
--- a/OpenSim/Framework/General/Types/Login.cs
+++ b/OpenSim/Framework/General/Types/Login.cs
@@ -1,49 +1,49 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Types 30namespace OpenSim.Framework.Types
31{ 31{
32 public class Login 32 public class Login
33 { 33 {
34 public string First = "Test"; 34 public string First = "Test";
35 public string Last = "User"; 35 public string Last = "User";
36 public LLUUID Agent; 36 public LLUUID Agent;
37 public LLUUID Session; 37 public LLUUID Session;
38 public LLUUID SecureSession = LLUUID.Zero; 38 public LLUUID SecureSession = LLUUID.Zero;
39 public LLUUID InventoryFolder; 39 public LLUUID InventoryFolder;
40 public LLUUID BaseFolder; 40 public LLUUID BaseFolder;
41 public uint CircuitCode; 41 public uint CircuitCode;
42 public string CapsPath =""; 42 public string CapsPath ="";
43 43
44 public Login() 44 public Login()
45 { 45 {
46 46
47 } 47 }
48 } 48 }
49} 49}
diff --git a/OpenSim/Framework/General/Types/MapBlockData.cs b/OpenSim/Framework/General/Types/MapBlockData.cs
index fbb3b73..212ce4b 100644
--- a/OpenSim/Framework/General/Types/MapBlockData.cs
+++ b/OpenSim/Framework/General/Types/MapBlockData.cs
@@ -1,23 +1,23 @@
1using System; 1using System;
2using libsecondlife; 2using libsecondlife;
3 3
4namespace OpenSim.Framework.Types 4namespace OpenSim.Framework.Types
5{ 5{
6 public class MapBlockData 6 public class MapBlockData
7 { 7 {
8 public uint Flags; 8 public uint Flags;
9 public ushort X; 9 public ushort X;
10 public ushort Y; 10 public ushort Y;
11 public byte Agents; 11 public byte Agents;
12 public byte Access; 12 public byte Access;
13 public byte WaterHeight; 13 public byte WaterHeight;
14 public LLUUID MapImageId; 14 public LLUUID MapImageId;
15 public String Name; 15 public String Name;
16 public uint RegionFlags; 16 public uint RegionFlags;
17 17
18 public MapBlockData() 18 public MapBlockData()
19 { 19 {
20 20
21 } 21 }
22 } 22 }
23} 23}
diff --git a/OpenSim/Framework/General/Types/NeighbourInfo.cs b/OpenSim/Framework/General/Types/NeighbourInfo.cs
index bb67981..7e83ffc 100644
--- a/OpenSim/Framework/General/Types/NeighbourInfo.cs
+++ b/OpenSim/Framework/General/Types/NeighbourInfo.cs
@@ -1,42 +1,42 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Types 28namespace OpenSim.Framework.Types
29{ 29{
30 public class NeighbourInfo 30 public class NeighbourInfo
31 { 31 {
32 public NeighbourInfo() 32 public NeighbourInfo()
33 { 33 {
34 } 34 }
35 35
36 public ulong regionhandle; 36 public ulong regionhandle;
37 public uint RegionLocX; 37 public uint RegionLocX;
38 public uint RegionLocY; 38 public uint RegionLocY;
39 public string sim_ip; 39 public string sim_ip;
40 public uint sim_port; 40 public uint sim_port;
41 } 41 }
42} 42}
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
index 900354c..6259d7b 100644
--- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs
+++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs
@@ -1,219 +1,219 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31 31
32namespace OpenSim.Framework.Types 32namespace OpenSim.Framework.Types
33{ 33{
34 public class NetworkServersInfo 34 public class NetworkServersInfo
35 { 35 {
36 public string AssetURL = "http://127.0.0.1:8003/"; 36 public string AssetURL = "http://127.0.0.1:8003/";
37 public string AssetSendKey = ""; 37 public string AssetSendKey = "";
38 38
39 public string GridURL = ""; 39 public string GridURL = "";
40 public string GridSendKey = ""; 40 public string GridSendKey = "";
41 public string GridRecvKey = ""; 41 public string GridRecvKey = "";
42 public string UserURL = ""; 42 public string UserURL = "";
43 public string UserSendKey = ""; 43 public string UserSendKey = "";
44 public string UserRecvKey = ""; 44 public string UserRecvKey = "";
45 public bool isSandbox; 45 public bool isSandbox;
46 46
47 public uint DefaultHomeLocX = 1000; 47 public uint DefaultHomeLocX = 1000;
48 public uint DefaultHomeLocY = 1000; 48 public uint DefaultHomeLocY = 1000;
49 49
50 public int HttpListenerPort = 9000; 50 public int HttpListenerPort = 9000;
51 public int RemotingListenerPort = 8895; 51 public int RemotingListenerPort = 8895;
52 52
53 public void InitConfig(bool sandboxMode, IGenericConfig configData) 53 public void InitConfig(bool sandboxMode, IGenericConfig configData)
54 { 54 {
55 this.isSandbox = sandboxMode; 55 this.isSandbox = sandboxMode;
56 56
57 try 57 try
58 { 58 {
59 string attri = ""; 59 string attri = "";
60 60
61 attri = ""; 61 attri = "";
62 attri = configData.GetAttribute("HttpListenerPort"); 62 attri = configData.GetAttribute("HttpListenerPort");
63 if (attri == "") 63 if (attri == "")
64 { 64 {
65 string location = MainLog.Instance.CmdPrompt("Http Listener Port", "9000"); 65 string location = MainLog.Instance.CmdPrompt("Http Listener Port", "9000");
66 configData.SetAttribute("HttpListenerPort", location); 66 configData.SetAttribute("HttpListenerPort", location);
67 this.HttpListenerPort = Convert.ToInt32(location); 67 this.HttpListenerPort = Convert.ToInt32(location);
68 } 68 }
69 else 69 else
70 { 70 {
71 this.HttpListenerPort = Convert.ToInt32(attri); 71 this.HttpListenerPort = Convert.ToInt32(attri);
72 } 72 }
73 73
74 attri = ""; 74 attri = "";
75 attri = configData.GetAttribute("RemotingListenerPort"); 75 attri = configData.GetAttribute("RemotingListenerPort");
76 if (attri == "") 76 if (attri == "")
77 { 77 {
78 string location = MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895"); 78 string location = MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895");
79 configData.SetAttribute("RemotingListenerPort", location); 79 configData.SetAttribute("RemotingListenerPort", location);
80 this.RemotingListenerPort = Convert.ToInt32(location); 80 this.RemotingListenerPort = Convert.ToInt32(location);
81 } 81 }
82 else 82 else
83 { 83 {
84 this.RemotingListenerPort = Convert.ToInt32(attri); 84 this.RemotingListenerPort = Convert.ToInt32(attri);
85 } 85 }
86 86
87 if (sandboxMode) 87 if (sandboxMode)
88 { 88 {
89 // default home location X 89 // default home location X
90 attri = ""; 90 attri = "";
91 attri = configData.GetAttribute("DefaultLocationX"); 91 attri = configData.GetAttribute("DefaultLocationX");
92 if (attri == "") 92 if (attri == "")
93 { 93 {
94 string location = MainLog.Instance.CmdPrompt("Default Home Location X", "1000"); 94 string location = MainLog.Instance.CmdPrompt("Default Home Location X", "1000");
95 configData.SetAttribute("DefaultLocationX", location); 95 configData.SetAttribute("DefaultLocationX", location);
96 this.DefaultHomeLocX = (uint)Convert.ToUInt32(location); 96 this.DefaultHomeLocX = (uint)Convert.ToUInt32(location);
97 } 97 }
98 else 98 else
99 { 99 {
100 this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri); 100 this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri);
101 } 101 }
102 102
103 // default home location Y 103 // default home location Y
104 attri = ""; 104 attri = "";
105 attri = configData.GetAttribute("DefaultLocationY"); 105 attri = configData.GetAttribute("DefaultLocationY");
106 if (attri == "") 106 if (attri == "")
107 { 107 {
108 string location = MainLog.Instance.CmdPrompt("Default Home Location Y", "1000"); 108 string location = MainLog.Instance.CmdPrompt("Default Home Location Y", "1000");
109 configData.SetAttribute("DefaultLocationY", location); 109 configData.SetAttribute("DefaultLocationY", location);
110 this.DefaultHomeLocY = (uint)Convert.ToUInt32(location); 110 this.DefaultHomeLocY = (uint)Convert.ToUInt32(location);
111 } 111 }
112 else 112 else
113 { 113 {
114 this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri); 114 this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri);
115 } 115 }
116 } 116 }
117 if (!isSandbox) 117 if (!isSandbox)
118 { 118 {
119 //Grid Server 119 //Grid Server
120 attri = ""; 120 attri = "";
121 attri = configData.GetAttribute("GridServerURL"); 121 attri = configData.GetAttribute("GridServerURL");
122 if (attri == "") 122 if (attri == "")
123 { 123 {
124 this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); 124 this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/");
125 configData.SetAttribute("GridServerURL", this.GridURL); 125 configData.SetAttribute("GridServerURL", this.GridURL);
126 } 126 }
127 else 127 else
128 { 128 {
129 this.GridURL = attri; 129 this.GridURL = attri;
130 } 130 }
131 131
132 //Grid Send Key 132 //Grid Send Key
133 attri = ""; 133 attri = "";
134 attri = configData.GetAttribute("GridSendKey"); 134 attri = configData.GetAttribute("GridSendKey");
135 if (attri == "") 135 if (attri == "")
136 { 136 {
137 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server", "null"); 137 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server", "null");
138 configData.SetAttribute("GridSendKey", this.GridSendKey); 138 configData.SetAttribute("GridSendKey", this.GridSendKey);
139 } 139 }
140 else 140 else
141 { 141 {
142 this.GridSendKey = attri; 142 this.GridSendKey = attri;
143 } 143 }
144 144
145 //Grid Receive Key 145 //Grid Receive Key
146 attri = ""; 146 attri = "";
147 attri = configData.GetAttribute("GridRecvKey"); 147 attri = configData.GetAttribute("GridRecvKey");
148 if (attri == "") 148 if (attri == "")
149 { 149 {
150 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server", "null"); 150 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server", "null");
151 configData.SetAttribute("GridRecvKey", this.GridRecvKey); 151 configData.SetAttribute("GridRecvKey", this.GridRecvKey);
152 } 152 }
153 else 153 else
154 { 154 {
155 this.GridRecvKey = attri; 155 this.GridRecvKey = attri;
156 } 156 }
157 157
158 //Grid Server 158 //Grid Server
159 attri = ""; 159 attri = "";
160 attri = configData.GetAttribute("UserServerURL"); 160 attri = configData.GetAttribute("UserServerURL");
161 if (attri == "") 161 if (attri == "")
162 { 162 {
163 this.UserURL= MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/"); 163 this.UserURL= MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/");
164 configData.SetAttribute("UserServerURL", this.UserURL); 164 configData.SetAttribute("UserServerURL", this.UserURL);
165 } 165 }
166 else 166 else
167 { 167 {
168 this.UserURL = attri; 168 this.UserURL = attri;
169 } 169 }
170 170
171 //Grid Send Key 171 //Grid Send Key
172 attri = ""; 172 attri = "";
173 attri = configData.GetAttribute("UserSendKey"); 173 attri = configData.GetAttribute("UserSendKey");
174 if (attri == "") 174 if (attri == "")
175 { 175 {
176 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server", "null"); 176 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server", "null");
177 configData.SetAttribute("UserSendKey", this.UserSendKey); 177 configData.SetAttribute("UserSendKey", this.UserSendKey);
178 } 178 }
179 else 179 else
180 { 180 {
181 this.UserSendKey = attri; 181 this.UserSendKey = attri;
182 } 182 }
183 183
184 //Grid Receive Key 184 //Grid Receive Key
185 attri = ""; 185 attri = "";
186 attri = configData.GetAttribute("UserRecvKey"); 186 attri = configData.GetAttribute("UserRecvKey");
187 if (attri == "") 187 if (attri == "")
188 { 188 {
189 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server", "null"); 189 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server", "null");
190 configData.SetAttribute("UserRecvKey", this.UserRecvKey); 190 configData.SetAttribute("UserRecvKey", this.UserRecvKey);
191 } 191 }
192 else 192 else
193 { 193 {
194 this.UserRecvKey = attri; 194 this.UserRecvKey = attri;
195 } 195 }
196 196
197 attri = ""; 197 attri = "";
198 attri = configData.GetAttribute("AssetServerURL"); 198 attri = configData.GetAttribute("AssetServerURL");
199 if (attri == "") 199 if (attri == "")
200 { 200 {
201 this.AssetURL = MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); 201 this.AssetURL = MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/");
202 configData.SetAttribute("AssetServerURL", this.GridURL); 202 configData.SetAttribute("AssetServerURL", this.GridURL);
203 } 203 }
204 else 204 else
205 { 205 {
206 this.AssetURL = attri; 206 this.AssetURL = attri;
207 } 207 }
208 208
209 } 209 }
210 configData.Commit(); 210 configData.Commit();
211 } 211 }
212 catch (Exception e) 212 catch (Exception e)
213 { 213 {
214 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); 214 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
215 MainLog.Instance.Warn(e.ToString()); 215 MainLog.Instance.Warn(e.ToString());
216 } 216 }
217 } 217 }
218 } 218 }
219} 219}
diff --git a/OpenSim/Framework/General/Types/ParcelData.cs b/OpenSim/Framework/General/Types/ParcelData.cs
index 17de655..5626299 100644
--- a/OpenSim/Framework/General/Types/ParcelData.cs
+++ b/OpenSim/Framework/General/Types/ParcelData.cs
@@ -1,120 +1,120 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Framework.Types 30namespace OpenSim.Framework.Types
31{ 31{
32 32
33 public class ParcelData 33 public class ParcelData
34 { 34 {
35 public byte[] parcelBitmapByteArray = new byte[512]; 35 public byte[] parcelBitmapByteArray = new byte[512];
36 public string parcelName = "Your Parcel"; 36 public string parcelName = "Your Parcel";
37 public string parcelDesc = ""; 37 public string parcelDesc = "";
38 public LLUUID ownerID = new LLUUID(); 38 public LLUUID ownerID = new LLUUID();
39 public bool isGroupOwned = false; 39 public bool isGroupOwned = false;
40 public LLVector3 AABBMin = new LLVector3(); 40 public LLVector3 AABBMin = new LLVector3();
41 public LLVector3 AABBMax = new LLVector3(); 41 public LLVector3 AABBMax = new LLVector3();
42 public int area = 0; 42 public int area = 0;
43 public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned 43 public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned
44 public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID 44 public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID
45 public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category 45 public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
46 public int claimDate = 0; //Unemplemented 46 public int claimDate = 0; //Unemplemented
47 public int claimPrice = 0; //Unemplemented 47 public int claimPrice = 0; //Unemplemented
48 public LLUUID groupID = new LLUUID(); //Unemplemented 48 public LLUUID groupID = new LLUUID(); //Unemplemented
49 public int groupPrims = 0; 49 public int groupPrims = 0;
50 public int otherPrims = 0; 50 public int otherPrims = 0;
51 public int ownerPrims = 0; 51 public int ownerPrims = 0;
52 public int selectedPrims = 0; 52 public int selectedPrims = 0;
53 public int simwidePrims = 0; 53 public int simwidePrims = 0;
54 public int simwideArea = 0; 54 public int simwideArea = 0;
55 public int salePrice = 0; //Unemeplemented. Parcels price. 55 public int salePrice = 0; //Unemeplemented. Parcels price.
56 public Parcel.ParcelStatus parcelStatus = Parcel.ParcelStatus.Leased; 56 public Parcel.ParcelStatus parcelStatus = Parcel.ParcelStatus.Leased;
57 public uint parcelFlags = (uint)Parcel.ParcelFlags.AllowFly | (uint)Parcel.ParcelFlags.AllowLandmark | (uint)Parcel.ParcelFlags.AllowAllObjectEntry | (uint)Parcel.ParcelFlags.AllowDeedToGroup | (uint)Parcel.ParcelFlags.AllowTerraform | (uint)Parcel.ParcelFlags.CreateObjects | (uint)Parcel.ParcelFlags.AllowOtherScripts; 57 public uint parcelFlags = (uint)Parcel.ParcelFlags.AllowFly | (uint)Parcel.ParcelFlags.AllowLandmark | (uint)Parcel.ParcelFlags.AllowAllObjectEntry | (uint)Parcel.ParcelFlags.AllowDeedToGroup | (uint)Parcel.ParcelFlags.AllowTerraform | (uint)Parcel.ParcelFlags.CreateObjects | (uint)Parcel.ParcelFlags.AllowOtherScripts;
58 public byte landingType = 0; 58 public byte landingType = 0;
59 public byte mediaAutoScale = 0; 59 public byte mediaAutoScale = 0;
60 public LLUUID mediaID = LLUUID.Zero; 60 public LLUUID mediaID = LLUUID.Zero;
61 public int localID = 0; 61 public int localID = 0;
62 public LLUUID globalID = new LLUUID(); 62 public LLUUID globalID = new LLUUID();
63 63
64 public string mediaURL = ""; 64 public string mediaURL = "";
65 public string musicURL = ""; 65 public string musicURL = "";
66 public float passHours = 0; 66 public float passHours = 0;
67 public int passPrice = 0; 67 public int passPrice = 0;
68 public LLUUID snapshotID = LLUUID.Zero; 68 public LLUUID snapshotID = LLUUID.Zero;
69 public LLVector3 userLocation = new LLVector3(); 69 public LLVector3 userLocation = new LLVector3();
70 public LLVector3 userLookAt = new LLVector3(); 70 public LLVector3 userLookAt = new LLVector3();
71 71
72 public ParcelData() 72 public ParcelData()
73 { 73 {
74 globalID = LLUUID.Random(); 74 globalID = LLUUID.Random();
75 } 75 }
76 76
77 public ParcelData Copy() 77 public ParcelData Copy()
78 { 78 {
79 ParcelData parcelData = new ParcelData(); 79 ParcelData parcelData = new ParcelData();
80 80
81 parcelData.AABBMax = this.AABBMax; 81 parcelData.AABBMax = this.AABBMax;
82 parcelData.AABBMin = this.AABBMin; 82 parcelData.AABBMin = this.AABBMin;
83 parcelData.area = this.area; 83 parcelData.area = this.area;
84 parcelData.auctionID = this.auctionID; 84 parcelData.auctionID = this.auctionID;
85 parcelData.authBuyerID = this.authBuyerID; 85 parcelData.authBuyerID = this.authBuyerID;
86 parcelData.category = this.category; 86 parcelData.category = this.category;
87 parcelData.claimDate = this.claimDate; 87 parcelData.claimDate = this.claimDate;
88 parcelData.claimPrice = this.claimPrice; 88 parcelData.claimPrice = this.claimPrice;
89 parcelData.globalID = this.globalID; 89 parcelData.globalID = this.globalID;
90 parcelData.groupID = this.groupID; 90 parcelData.groupID = this.groupID;
91 parcelData.groupPrims = this.groupPrims; 91 parcelData.groupPrims = this.groupPrims;
92 parcelData.otherPrims = this.otherPrims; 92 parcelData.otherPrims = this.otherPrims;
93 parcelData.ownerPrims = this.ownerPrims; 93 parcelData.ownerPrims = this.ownerPrims;
94 parcelData.selectedPrims = this.selectedPrims; 94 parcelData.selectedPrims = this.selectedPrims;
95 parcelData.isGroupOwned = this.isGroupOwned; 95 parcelData.isGroupOwned = this.isGroupOwned;
96 parcelData.localID = this.localID; 96 parcelData.localID = this.localID;
97 parcelData.landingType = this.landingType; 97 parcelData.landingType = this.landingType;
98 parcelData.mediaAutoScale = this.mediaAutoScale; 98 parcelData.mediaAutoScale = this.mediaAutoScale;
99 parcelData.mediaID = this.mediaID; 99 parcelData.mediaID = this.mediaID;
100 parcelData.mediaURL = this.mediaURL; 100 parcelData.mediaURL = this.mediaURL;
101 parcelData.musicURL = this.musicURL; 101 parcelData.musicURL = this.musicURL;
102 parcelData.ownerID = this.ownerID; 102 parcelData.ownerID = this.ownerID;
103 parcelData.parcelBitmapByteArray = (byte[])this.parcelBitmapByteArray.Clone(); 103 parcelData.parcelBitmapByteArray = (byte[])this.parcelBitmapByteArray.Clone();
104 parcelData.parcelDesc = this.parcelDesc; 104 parcelData.parcelDesc = this.parcelDesc;
105 parcelData.parcelFlags = this.parcelFlags; 105 parcelData.parcelFlags = this.parcelFlags;
106 parcelData.parcelName = this.parcelName; 106 parcelData.parcelName = this.parcelName;
107 parcelData.parcelStatus = this.parcelStatus; 107 parcelData.parcelStatus = this.parcelStatus;
108 parcelData.passHours = this.passHours; 108 parcelData.passHours = this.passHours;
109 parcelData.passPrice = this.passPrice; 109 parcelData.passPrice = this.passPrice;
110 parcelData.salePrice = this.salePrice; 110 parcelData.salePrice = this.salePrice;
111 parcelData.snapshotID = this.snapshotID; 111 parcelData.snapshotID = this.snapshotID;
112 parcelData.userLocation = this.userLocation; 112 parcelData.userLocation = this.userLocation;
113 parcelData.userLookAt = this.userLookAt; 113 parcelData.userLookAt = this.userLookAt;
114 114
115 return parcelData; 115 return parcelData;
116 116
117 } 117 }
118 } 118 }
119 119
120} 120}
diff --git a/OpenSim/Framework/General/Types/PrimData.cs b/OpenSim/Framework/General/Types/PrimData.cs
index ff81bcd..6b8fa3a 100644
--- a/OpenSim/Framework/General/Types/PrimData.cs
+++ b/OpenSim/Framework/General/Types/PrimData.cs
@@ -1,228 +1,228 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Types 31namespace OpenSim.Framework.Types
32{ 32{
33 public class PrimData 33 public class PrimData
34 { 34 {
35 private const uint FULL_MASK_PERMISSIONS = 2147483647; 35 private const uint FULL_MASK_PERMISSIONS = 2147483647;
36 36
37 public LLUUID OwnerID; 37 public LLUUID OwnerID;
38 public byte PCode; 38 public byte PCode;
39 public ushort PathBegin; 39 public ushort PathBegin;
40 public ushort PathEnd; 40 public ushort PathEnd;
41 public byte PathScaleX; 41 public byte PathScaleX;
42 public byte PathScaleY; 42 public byte PathScaleY;
43 public byte PathShearX; 43 public byte PathShearX;
44 public byte PathShearY; 44 public byte PathShearY;
45 public sbyte PathSkew; 45 public sbyte PathSkew;
46 public ushort ProfileBegin; 46 public ushort ProfileBegin;
47 public ushort ProfileEnd; 47 public ushort ProfileEnd;
48 public LLVector3 Scale; 48 public LLVector3 Scale;
49 public byte PathCurve; 49 public byte PathCurve;
50 public byte ProfileCurve; 50 public byte ProfileCurve;
51 public uint ParentID = 0; 51 public uint ParentID = 0;
52 public ushort ProfileHollow; 52 public ushort ProfileHollow;
53 public sbyte PathRadiusOffset; 53 public sbyte PathRadiusOffset;
54 public byte PathRevolutions; 54 public byte PathRevolutions;
55 public sbyte PathTaperX; 55 public sbyte PathTaperX;
56 public sbyte PathTaperY; 56 public sbyte PathTaperY;
57 public sbyte PathTwist; 57 public sbyte PathTwist;
58 public sbyte PathTwistBegin; 58 public sbyte PathTwistBegin;
59 public byte[] TextureEntry; // a LL textureEntry in byte[] format 59 public byte[] TextureEntry; // a LL textureEntry in byte[] format
60 60
61 public Int32 CreationDate; 61 public Int32 CreationDate;
62 public uint OwnerMask = FULL_MASK_PERMISSIONS; 62 public uint OwnerMask = FULL_MASK_PERMISSIONS;
63 public uint NextOwnerMask = FULL_MASK_PERMISSIONS; 63 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
64 public uint GroupMask = FULL_MASK_PERMISSIONS; 64 public uint GroupMask = FULL_MASK_PERMISSIONS;
65 public uint EveryoneMask = FULL_MASK_PERMISSIONS; 65 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
66 public uint BaseMask = FULL_MASK_PERMISSIONS; 66 public uint BaseMask = FULL_MASK_PERMISSIONS;
67 67
68 //following only used during prim storage 68 //following only used during prim storage
69 public LLVector3 Position; 69 public LLVector3 Position;
70 public LLQuaternion Rotation = new LLQuaternion(0, 1, 0, 0); 70 public LLQuaternion Rotation = new LLQuaternion(0, 1, 0, 0);
71 public uint LocalID; 71 public uint LocalID;
72 public LLUUID FullID; 72 public LLUUID FullID;
73 73
74 public PrimData() 74 public PrimData()
75 { 75 {
76 76
77 } 77 }
78 78
79 public PrimData(byte[] data) 79 public PrimData(byte[] data)
80 { 80 {
81 int i = 0; 81 int i = 0;
82 82
83 this.OwnerID = new LLUUID(data, i); i += 16; 83 this.OwnerID = new LLUUID(data, i); i += 16;
84 this.PCode = data[i++]; 84 this.PCode = data[i++];
85 this.PathBegin = (ushort)(data[i++] + (data[i++] << 8)); 85 this.PathBegin = (ushort)(data[i++] + (data[i++] << 8));
86 this.PathEnd = (ushort)(data[i++] + (data[i++] << 8)); 86 this.PathEnd = (ushort)(data[i++] + (data[i++] << 8));
87 this.PathScaleX = data[i++]; 87 this.PathScaleX = data[i++];
88 this.PathScaleY = data[i++]; 88 this.PathScaleY = data[i++];
89 this.PathShearX = data[i++]; 89 this.PathShearX = data[i++];
90 this.PathShearY = data[i++]; 90 this.PathShearY = data[i++];
91 this.PathSkew = (sbyte)data[i++]; 91 this.PathSkew = (sbyte)data[i++];
92 this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8)); 92 this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8));
93 this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8)); 93 this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8));
94 this.Scale = new LLVector3(data, i); i += 12; 94 this.Scale = new LLVector3(data, i); i += 12;
95 this.PathCurve = data[i++]; 95 this.PathCurve = data[i++];
96 this.ProfileCurve = data[i++]; 96 this.ProfileCurve = data[i++];
97 this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 97 this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
98 this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8)); 98 this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8));
99 this.PathRadiusOffset = (sbyte)data[i++]; 99 this.PathRadiusOffset = (sbyte)data[i++];
100 this.PathRevolutions = data[i++]; 100 this.PathRevolutions = data[i++];
101 this.PathTaperX = (sbyte)data[i++]; 101 this.PathTaperX = (sbyte)data[i++];
102 this.PathTaperY = (sbyte)data[i++]; 102 this.PathTaperY = (sbyte)data[i++];
103 this.PathTwist = (sbyte)data[i++]; 103 this.PathTwist = (sbyte)data[i++];
104 this.PathTwistBegin = (sbyte)data[i++]; 104 this.PathTwistBegin = (sbyte)data[i++];
105 ushort length = (ushort)(data[i++] + (data[i++] << 8)); 105 ushort length = (ushort)(data[i++] + (data[i++] << 8));
106 this.TextureEntry = new byte[length]; 106 this.TextureEntry = new byte[length];
107 Array.Copy(data, i, TextureEntry, 0, length); i += length; 107 Array.Copy(data, i, TextureEntry, 0, length); i += length;
108 this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 108 this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
109 this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 109 this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
110 this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 110 this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
111 this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 111 this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
112 this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 112 this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
113 this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 113 this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
114 this.Position = new LLVector3(data, i); i += 12; 114 this.Position = new LLVector3(data, i); i += 12;
115 this.Rotation = new LLQuaternion(data, i, true); i += 12; 115 this.Rotation = new LLQuaternion(data, i, true); i += 12;
116 this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); 116 this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
117 this.FullID = new LLUUID(data, i); i += 16; 117 this.FullID = new LLUUID(data, i); i += 16;
118 118
119 } 119 }
120 120
121 public byte[] ToBytes() 121 public byte[] ToBytes()
122 { 122 {
123 int i = 0; 123 int i = 0;
124 byte[] bytes = new byte[126 + TextureEntry.Length]; 124 byte[] bytes = new byte[126 + TextureEntry.Length];
125 Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; 125 Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
126 bytes[i++] = this.PCode; 126 bytes[i++] = this.PCode;
127 bytes[i++] = (byte)(this.PathBegin % 256); 127 bytes[i++] = (byte)(this.PathBegin % 256);
128 bytes[i++] = (byte)((this.PathBegin >> 8) % 256); 128 bytes[i++] = (byte)((this.PathBegin >> 8) % 256);
129 bytes[i++] = (byte)(this.PathEnd % 256); 129 bytes[i++] = (byte)(this.PathEnd % 256);
130 bytes[i++] = (byte)((this.PathEnd >> 8) % 256); 130 bytes[i++] = (byte)((this.PathEnd >> 8) % 256);
131 bytes[i++] = this.PathScaleX; 131 bytes[i++] = this.PathScaleX;
132 bytes[i++] = this.PathScaleY; 132 bytes[i++] = this.PathScaleY;
133 bytes[i++] = this.PathShearX; 133 bytes[i++] = this.PathShearX;
134 bytes[i++] = this.PathShearY; 134 bytes[i++] = this.PathShearY;
135 bytes[i++] = (byte)this.PathSkew; 135 bytes[i++] = (byte)this.PathSkew;
136 bytes[i++] = (byte)(this.ProfileBegin % 256); 136 bytes[i++] = (byte)(this.ProfileBegin % 256);
137 bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256); 137 bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256);
138 bytes[i++] = (byte)(this.ProfileEnd % 256); 138 bytes[i++] = (byte)(this.ProfileEnd % 256);
139 bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256); 139 bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256);
140 Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; 140 Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
141 bytes[i++] = this.PathCurve; 141 bytes[i++] = this.PathCurve;
142 bytes[i++] = this.ProfileCurve; 142 bytes[i++] = this.ProfileCurve;
143 bytes[i++] = (byte)(ParentID % 256); 143 bytes[i++] = (byte)(ParentID % 256);
144 bytes[i++] = (byte)((ParentID >> 8) % 256); 144 bytes[i++] = (byte)((ParentID >> 8) % 256);
145 bytes[i++] = (byte)((ParentID >> 16) % 256); 145 bytes[i++] = (byte)((ParentID >> 16) % 256);
146 bytes[i++] = (byte)((ParentID >> 24) % 256); 146 bytes[i++] = (byte)((ParentID >> 24) % 256);
147 bytes[i++] = (byte)(this.ProfileHollow % 256); 147 bytes[i++] = (byte)(this.ProfileHollow % 256);
148 bytes[i++] = (byte)((this.ProfileHollow >> 8) % 256); 148 bytes[i++] = (byte)((this.ProfileHollow >> 8) % 256);
149 bytes[i++] = ((byte)this.PathRadiusOffset); 149 bytes[i++] = ((byte)this.PathRadiusOffset);
150 bytes[i++] = this.PathRevolutions; 150 bytes[i++] = this.PathRevolutions;
151 bytes[i++] = ((byte)this.PathTaperX); 151 bytes[i++] = ((byte)this.PathTaperX);
152 bytes[i++] = ((byte)this.PathTaperY); 152 bytes[i++] = ((byte)this.PathTaperY);
153 bytes[i++] = ((byte)this.PathTwist); 153 bytes[i++] = ((byte)this.PathTwist);
154 bytes[i++] = ((byte)this.PathTwistBegin); 154 bytes[i++] = ((byte)this.PathTwistBegin);
155 bytes[i++] = (byte)(TextureEntry.Length % 256); 155 bytes[i++] = (byte)(TextureEntry.Length % 256);
156 bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256); 156 bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
157 Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; 157 Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
158 bytes[i++] = (byte)(this.CreationDate % 256); 158 bytes[i++] = (byte)(this.CreationDate % 256);
159 bytes[i++] = (byte)((this.CreationDate >> 8) % 256); 159 bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
160 bytes[i++] = (byte)((this.CreationDate >> 16) % 256); 160 bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
161 bytes[i++] = (byte)((this.CreationDate >> 24) % 256); 161 bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
162 bytes[i++] = (byte)(this.OwnerMask % 256); 162 bytes[i++] = (byte)(this.OwnerMask % 256);
163 bytes[i++] = (byte)((this.OwnerMask >> 8) % 256); 163 bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
164 bytes[i++] = (byte)((this.OwnerMask >> 16) % 256); 164 bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
165 bytes[i++] = (byte)((this.OwnerMask >> 24) % 256); 165 bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
166 bytes[i++] = (byte)(this.NextOwnerMask % 256); 166 bytes[i++] = (byte)(this.NextOwnerMask % 256);
167 bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256); 167 bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
168 bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256); 168 bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
169 bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256); 169 bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
170 bytes[i++] = (byte)(this.GroupMask % 256); 170 bytes[i++] = (byte)(this.GroupMask % 256);
171 bytes[i++] = (byte)((this.GroupMask >> 8) % 256); 171 bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
172 bytes[i++] = (byte)((this.GroupMask >> 16) % 256); 172 bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
173 bytes[i++] = (byte)((this.GroupMask >> 24) % 256); 173 bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
174 bytes[i++] = (byte)(this.EveryoneMask % 256); 174 bytes[i++] = (byte)(this.EveryoneMask % 256);
175 bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256); 175 bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
176 bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256); 176 bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
177 bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256); 177 bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
178 bytes[i++] = (byte)(this.BaseMask % 256); 178 bytes[i++] = (byte)(this.BaseMask % 256);
179 bytes[i++] = (byte)((this.BaseMask >> 8) % 256); 179 bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
180 bytes[i++] = (byte)((this.BaseMask >> 16) % 256); 180 bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
181 bytes[i++] = (byte)((this.BaseMask >> 24) % 256); 181 bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
182 Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12; 182 Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
183 if (this.Rotation == new LLQuaternion(0, 0, 0, 0)) 183 if (this.Rotation == new LLQuaternion(0, 0, 0, 0))
184 { 184 {
185 this.Rotation = new LLQuaternion(0, 1, 0, 0); 185 this.Rotation = new LLQuaternion(0, 1, 0, 0);
186 } 186 }
187 Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12; 187 Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
188 bytes[i++] = (byte)(this.LocalID % 256); 188 bytes[i++] = (byte)(this.LocalID % 256);
189 bytes[i++] = (byte)((this.LocalID >> 8) % 256); 189 bytes[i++] = (byte)((this.LocalID >> 8) % 256);
190 bytes[i++] = (byte)((this.LocalID >> 16) % 256); 190 bytes[i++] = (byte)((this.LocalID >> 16) % 256);
191 bytes[i++] = (byte)((this.LocalID >> 24) % 256); 191 bytes[i++] = (byte)((this.LocalID >> 24) % 256);
192 Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; 192 Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
193 193
194 return bytes; 194 return bytes;
195 } 195 }
196 196
197 public static PrimData DefaultCube() 197 public static PrimData DefaultCube()
198 { 198 {
199 PrimData primData = new PrimData(); 199 PrimData primData = new PrimData();
200 primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 200 primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
201 primData.FullID = LLUUID.Random(); 201 primData.FullID = LLUUID.Random();
202 primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f); 202 primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
203 primData.Rotation = new LLQuaternion(0, 0, 0, 1); 203 primData.Rotation = new LLQuaternion(0, 0, 0, 1);
204 primData.PCode = 9; 204 primData.PCode = 9;
205 primData.ParentID = 0; 205 primData.ParentID = 0;
206 primData.PathBegin = 0; 206 primData.PathBegin = 0;
207 primData.PathEnd = 0; 207 primData.PathEnd = 0;
208 primData.PathScaleX = 0; 208 primData.PathScaleX = 0;
209 primData.PathScaleY = 0; 209 primData.PathScaleY = 0;
210 primData.PathShearX = 0; 210 primData.PathShearX = 0;
211 primData.PathShearY = 0; 211 primData.PathShearY = 0;
212 primData.PathSkew = 0; 212 primData.PathSkew = 0;
213 primData.ProfileBegin = 0; 213 primData.ProfileBegin = 0;
214 primData.ProfileEnd = 0; 214 primData.ProfileEnd = 0;
215 primData.PathCurve = 16; 215 primData.PathCurve = 16;
216 primData.ProfileCurve = 1; 216 primData.ProfileCurve = 1;
217 primData.ProfileHollow = 0; 217 primData.ProfileHollow = 0;
218 primData.PathRadiusOffset = 0; 218 primData.PathRadiusOffset = 0;
219 primData.PathRevolutions = 0; 219 primData.PathRevolutions = 0;
220 primData.PathTaperX = 0; 220 primData.PathTaperX = 0;
221 primData.PathTaperY = 0; 221 primData.PathTaperY = 0;
222 primData.PathTwist = 0; 222 primData.PathTwist = 0;
223 primData.PathTwistBegin = 0; 223 primData.PathTwistBegin = 0;
224 224
225 return primData; 225 return primData;
226 } 226 }
227 } 227 }
228} 228}
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
index a085a44..e058c07 100644
--- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
@@ -1,109 +1,109 @@
1using libsecondlife; 1using libsecondlife;
2using libsecondlife.Packets; 2using libsecondlife.Packets;
3 3
4namespace OpenSim.Framework.Types 4namespace OpenSim.Framework.Types
5{ 5{
6 public enum ShapeType 6 public enum ShapeType
7 { 7 {
8 Box, 8 Box,
9 Sphere, 9 Sphere,
10 Ring, 10 Ring,
11 Tube, 11 Tube,
12 Torus, 12 Torus,
13 Prism, 13 Prism,
14 Scuplted, 14 Scuplted,
15 Cylinder, 15 Cylinder,
16 Foliage, 16 Foliage,
17 Unknown 17 Unknown
18 } 18 }
19 19
20 public class PrimitiveBaseShape 20 public class PrimitiveBaseShape
21 { 21 {
22 private ShapeType type = ShapeType.Unknown; 22 private ShapeType type = ShapeType.Unknown;
23 23
24 public byte PCode; 24 public byte PCode;
25 public ushort PathBegin; 25 public ushort PathBegin;
26 public ushort PathEnd; 26 public ushort PathEnd;
27 public byte PathScaleX; 27 public byte PathScaleX;
28 public byte PathScaleY; 28 public byte PathScaleY;
29 public byte PathShearX; 29 public byte PathShearX;
30 public byte PathShearY; 30 public byte PathShearY;
31 public sbyte PathSkew; 31 public sbyte PathSkew;
32 public ushort ProfileBegin; 32 public ushort ProfileBegin;
33 public ushort ProfileEnd; 33 public ushort ProfileEnd;
34 public LLVector3 Scale; 34 public LLVector3 Scale;
35 public byte PathCurve; 35 public byte PathCurve;
36 public byte ProfileCurve; 36 public byte ProfileCurve;
37 public ushort ProfileHollow; 37 public ushort ProfileHollow;
38 public sbyte PathRadiusOffset; 38 public sbyte PathRadiusOffset;
39 public byte PathRevolutions; 39 public byte PathRevolutions;
40 public sbyte PathTaperX; 40 public sbyte PathTaperX;
41 public sbyte PathTaperY; 41 public sbyte PathTaperY;
42 public sbyte PathTwist; 42 public sbyte PathTwist;
43 public sbyte PathTwistBegin; 43 public sbyte PathTwistBegin;
44 public byte[] TextureEntry; // a LL textureEntry in byte[] format 44 public byte[] TextureEntry; // a LL textureEntry in byte[] format
45 45
46 public ShapeType PrimType 46 public ShapeType PrimType
47 { 47 {
48 get 48 get
49 { 49 {
50 return this.type; 50 return this.type;
51 } 51 }
52 } 52 }
53 53
54 public LLVector3 PrimScale 54 public LLVector3 PrimScale
55 { 55 {
56 get 56 get
57 { 57 {
58 return this.Scale; 58 return this.Scale;
59 } 59 }
60 } 60 }
61 61
62 public PrimitiveBaseShape() 62 public PrimitiveBaseShape()
63 { 63 {
64 64
65 } 65 }
66 66
67 //void returns need to change of course 67 //void returns need to change of course
68 public void GetMesh() 68 public void GetMesh()
69 { 69 {
70 70
71 } 71 }
72 72
73 public PrimitiveBaseShape Copy() 73 public PrimitiveBaseShape Copy()
74 { 74 {
75 return (PrimitiveBaseShape) this.MemberwiseClone(); 75 return (PrimitiveBaseShape) this.MemberwiseClone();
76 } 76 }
77 77
78 public static PrimitiveBaseShape DefaultBox() 78 public static PrimitiveBaseShape DefaultBox()
79 { 79 {
80 PrimitiveBaseShape primShape = new PrimitiveBaseShape(); 80 PrimitiveBaseShape primShape = new PrimitiveBaseShape();
81 81
82 primShape.type = ShapeType.Box; 82 primShape.type = ShapeType.Box;
83 primShape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); 83 primShape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
84 primShape.PCode = 9; 84 primShape.PCode = 9;
85 primShape.PathBegin = 0; 85 primShape.PathBegin = 0;
86 primShape.PathEnd = 0; 86 primShape.PathEnd = 0;
87 primShape.PathScaleX = 0; 87 primShape.PathScaleX = 0;
88 primShape.PathScaleY = 0; 88 primShape.PathScaleY = 0;
89 primShape.PathShearX = 0; 89 primShape.PathShearX = 0;
90 primShape.PathShearY = 0; 90 primShape.PathShearY = 0;
91 primShape.PathSkew = 0; 91 primShape.PathSkew = 0;
92 primShape.ProfileBegin = 0; 92 primShape.ProfileBegin = 0;
93 primShape.ProfileEnd = 0; 93 primShape.ProfileEnd = 0;
94 primShape.PathCurve = 16; 94 primShape.PathCurve = 16;
95 primShape.ProfileCurve = 1; 95 primShape.ProfileCurve = 1;
96 primShape.ProfileHollow = 0; 96 primShape.ProfileHollow = 0;
97 primShape.PathRadiusOffset = 0; 97 primShape.PathRadiusOffset = 0;
98 primShape.PathRevolutions = 0; 98 primShape.PathRevolutions = 0;
99 primShape.PathTaperX = 0; 99 primShape.PathTaperX = 0;
100 primShape.PathTaperY = 0; 100 primShape.PathTaperY = 0;
101 primShape.PathTwist = 0; 101 primShape.PathTwist = 0;
102 primShape.PathTwistBegin = 0; 102 primShape.PathTwistBegin = 0;
103 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); 103 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
104 primShape.TextureEntry = ntex.ToBytes(); 104 primShape.TextureEntry = ntex.ToBytes();
105 105
106 return primShape; 106 return primShape;
107 } 107 }
108 } 108 }
109} 109}
diff --git a/OpenSim/Framework/General/Types/RegionHandle.cs b/OpenSim/Framework/General/Types/RegionHandle.cs
index 4a055ad..d90acc6 100644
--- a/OpenSim/Framework/General/Types/RegionHandle.cs
+++ b/OpenSim/Framework/General/Types/RegionHandle.cs
@@ -1,121 +1,121 @@
1using System; 1using System;
2using System.Net; 2using System.Net;
3 3
4namespace OpenSim.Framework.Types 4namespace OpenSim.Framework.Types
5{ 5{
6 /// <summary> 6 /// <summary>
7 /// A class for manipulating RegionHandle coordinates 7 /// A class for manipulating RegionHandle coordinates
8 /// </summary> 8 /// </summary>
9 class RegionHandle 9 class RegionHandle
10 { 10 {
11 private UInt64 handle; 11 private UInt64 handle;
12 12
13 /// <summary> 13 /// <summary>
14 /// Initialises a new grid-aware RegionHandle 14 /// Initialises a new grid-aware RegionHandle
15 /// </summary> 15 /// </summary>
16 /// <param name="ip">IP Address of the Grid Server for this region</param> 16 /// <param name="ip">IP Address of the Grid Server for this region</param>
17 /// <param name="x">Grid X Coordinate</param> 17 /// <param name="x">Grid X Coordinate</param>
18 /// <param name="y">Grid Y Coordinate</param> 18 /// <param name="y">Grid Y Coordinate</param>
19 public RegionHandle(string ip, short x, short y) 19 public RegionHandle(string ip, short x, short y)
20 { 20 {
21 IPAddress addr = IPAddress.Parse(ip); 21 IPAddress addr = IPAddress.Parse(ip);
22 22
23 if (addr.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) 23 if (addr.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
24 throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); 24 throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address");
25 25
26 uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); 26 uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0);
27 27
28 // Split the IP address in half 28 // Split the IP address in half
29 short a = (short)((baseHandle << 16) & 0xFFFF); 29 short a = (short)((baseHandle << 16) & 0xFFFF);
30 short b = (short)((baseHandle << 0) & 0xFFFF); 30 short b = (short)((baseHandle << 0) & 0xFFFF);
31 31
32 // Raise the bounds a little 32 // Raise the bounds a little
33 uint nx = (uint)x; 33 uint nx = (uint)x;
34 uint ny = (uint)y; 34 uint ny = (uint)y;
35 35
36 // Multiply grid coords to get region coords 36 // Multiply grid coords to get region coords
37 nx *= 256; 37 nx *= 256;
38 ny *= 256; 38 ny *= 256;
39 39
40 // Stuff the IP address in too 40 // Stuff the IP address in too
41 nx = (uint)a << 16; 41 nx = (uint)a << 16;
42 ny = (uint)b << 16; 42 ny = (uint)b << 16;
43 43
44 handle = ((UInt64)nx << 32) | (uint)ny; 44 handle = ((UInt64)nx << 32) | (uint)ny;
45 } 45 }
46 46
47 /// <summary> 47 /// <summary>
48 /// Initialises a new RegionHandle that is not inter-grid aware 48 /// Initialises a new RegionHandle that is not inter-grid aware
49 /// </summary> 49 /// </summary>
50 /// <param name="x">Grid X Coordinate</param> 50 /// <param name="x">Grid X Coordinate</param>
51 /// <param name="y">Grid Y Coordinate</param> 51 /// <param name="y">Grid Y Coordinate</param>
52 public RegionHandle(uint x, uint y) 52 public RegionHandle(uint x, uint y)
53 { 53 {
54 handle = ((x * 256) << 32) | (y * 256); 54 handle = ((x * 256) << 32) | (y * 256);
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
58 /// Initialises a new RegionHandle from an existing value 58 /// Initialises a new RegionHandle from an existing value
59 /// </summary> 59 /// </summary>
60 /// <param name="Region">A U64 RegionHandle</param> 60 /// <param name="Region">A U64 RegionHandle</param>
61 public RegionHandle(UInt64 Region) 61 public RegionHandle(UInt64 Region)
62 { 62 {
63 handle = Region; 63 handle = Region;
64 } 64 }
65 65
66 /// <summary> 66 /// <summary>
67 /// Returns the Grid Masked RegionHandle - For use in Teleport packets and other packets where sending the grid IP address may be handy. 67 /// Returns the Grid Masked RegionHandle - For use in Teleport packets and other packets where sending the grid IP address may be handy.
68 /// </summary> 68 /// </summary>
69 /// <remarks>Do not use for SimulatorEnable packets. The client will choke.</remarks> 69 /// <remarks>Do not use for SimulatorEnable packets. The client will choke.</remarks>
70 /// <returns>Region Handle including IP Address encoding</returns> 70 /// <returns>Region Handle including IP Address encoding</returns>
71 public UInt64 getTeleportHandle() 71 public UInt64 getTeleportHandle()
72 { 72 {
73 return handle; 73 return handle;
74 } 74 }
75 75
76 /// <summary> 76 /// <summary>
77 /// Returns a RegionHandle which may be used for SimulatorEnable packets. Removes the IP address encoding and returns the lower bounds. 77 /// Returns a RegionHandle which may be used for SimulatorEnable packets. Removes the IP address encoding and returns the lower bounds.
78 /// </summary> 78 /// </summary>
79 /// <returns>A U64 RegionHandle for use in SimulatorEnable packets.</returns> 79 /// <returns>A U64 RegionHandle for use in SimulatorEnable packets.</returns>
80 public UInt64 getNeighbourHandle() 80 public UInt64 getNeighbourHandle()
81 { 81 {
82 UInt64 mask = 0x0000FFFF0000FFFF; 82 UInt64 mask = 0x0000FFFF0000FFFF;
83 83
84 return handle | mask; 84 return handle | mask;
85 } 85 }
86 86
87 /// <summary> 87 /// <summary>
88 /// Returns the IP Address of the GridServer from a Grid-Encoded RegionHandle 88 /// Returns the IP Address of the GridServer from a Grid-Encoded RegionHandle
89 /// </summary> 89 /// </summary>
90 /// <returns>Grid Server IP Address</returns> 90 /// <returns>Grid Server IP Address</returns>
91 public IPAddress getGridIP() 91 public IPAddress getGridIP()
92 { 92 {
93 uint a = (uint)((handle >> 16) & 0xFFFF); 93 uint a = (uint)((handle >> 16) & 0xFFFF);
94 uint b = (uint)((handle >> 48) & 0xFFFF); 94 uint b = (uint)((handle >> 48) & 0xFFFF);
95 95
96 return new IPAddress((long)(a << 16) | (long)b); 96 return new IPAddress((long)(a << 16) | (long)b);
97 } 97 }
98 98
99 /// <summary> 99 /// <summary>
100 /// Returns the X Coordinate from a Grid-Encoded RegionHandle 100 /// Returns the X Coordinate from a Grid-Encoded RegionHandle
101 /// </summary> 101 /// </summary>
102 /// <returns>X Coordinate</returns> 102 /// <returns>X Coordinate</returns>
103 public uint getGridX() 103 public uint getGridX()
104 { 104 {
105 uint x = (uint)((handle >> 32) & 0xFFFF); 105 uint x = (uint)((handle >> 32) & 0xFFFF);
106 106
107 return x; 107 return x;
108 } 108 }
109 109
110 /// <summary> 110 /// <summary>
111 /// Returns the Y Coordinate from a Grid-Encoded RegionHandle 111 /// Returns the Y Coordinate from a Grid-Encoded RegionHandle
112 /// </summary> 112 /// </summary>
113 /// <returns>Y Coordinate</returns> 113 /// <returns>Y Coordinate</returns>
114 public uint getGridY() 114 public uint getGridY()
115 { 115 {
116 uint y = (uint)((handle >> 0) & 0xFFFF); 116 uint y = (uint)((handle >> 0) & 0xFFFF);
117 117
118 return y; 118 return y;
119 } 119 }
120 } 120 }
121} 121}
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs
index cfc0925..a216b52 100644
--- a/OpenSim/Framework/General/Types/RegionInfo.cs
+++ b/OpenSim/Framework/General/Types/RegionInfo.cs
@@ -1,342 +1,342 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Globalization; 29using System.Globalization;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36 36
37namespace OpenSim.Framework.Types 37namespace OpenSim.Framework.Types
38{ 38{
39 public class RegionInfo 39 public class RegionInfo
40 { 40 {
41 public LLUUID SimUUID = new LLUUID(); 41 public LLUUID SimUUID = new LLUUID();
42 public string RegionName = ""; 42 public string RegionName = "";
43 43
44 private IPEndPoint m_internalEndPoint; 44 private IPEndPoint m_internalEndPoint;
45 public IPEndPoint InternalEndPoint 45 public IPEndPoint InternalEndPoint
46 { 46 {
47 get 47 get
48 { 48 {
49 return m_internalEndPoint; 49 return m_internalEndPoint;
50 } 50 }
51 } 51 }
52 52
53 public IPEndPoint ExternalEndPoint 53 public IPEndPoint ExternalEndPoint
54 { 54 {
55 get 55 get
56 { 56 {
57 // Old one defaults to IPv6 57 // Old one defaults to IPv6
58 //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port ); 58 //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port );
59 59
60 // New method favors IPv4 60 // New method favors IPv4
61 IPAddress ia = null; 61 IPAddress ia = null;
62 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) 62 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
63 { 63 {
64 if (ia == null) 64 if (ia == null)
65 ia = Adr; 65 ia = Adr;
66 66
67 if (Adr.AddressFamily == AddressFamily.InterNetwork) 67 if (Adr.AddressFamily == AddressFamily.InterNetwork)
68 { 68 {
69 ia = Adr; 69 ia = Adr;
70 break; 70 break;
71 } 71 }
72 72
73 } 73 }
74 74
75 return new IPEndPoint(ia, m_internalEndPoint.Port); 75 return new IPEndPoint(ia, m_internalEndPoint.Port);
76 } 76 }
77 } 77 }
78 78
79 private string m_externalHostName; 79 private string m_externalHostName;
80 public string ExternalHostName 80 public string ExternalHostName
81 { 81 {
82 get 82 get
83 { 83 {
84 return m_externalHostName; 84 return m_externalHostName;
85 } 85 }
86 } 86 }
87 87
88 private uint? m_regionLocX; 88 private uint? m_regionLocX;
89 public uint RegionLocX 89 public uint RegionLocX
90 { 90 {
91 get 91 get
92 { 92 {
93 return m_regionLocX.Value; 93 return m_regionLocX.Value;
94 } 94 }
95 } 95 }
96 96
97 private uint? m_regionLocY; 97 private uint? m_regionLocY;
98 public uint RegionLocY 98 public uint RegionLocY
99 { 99 {
100 get 100 get
101 { 101 {
102 return m_regionLocY.Value; 102 return m_regionLocY.Value;
103 } 103 }
104 } 104 }
105 105
106 private ulong? m_regionHandle; 106 private ulong? m_regionHandle;
107 public ulong RegionHandle 107 public ulong RegionHandle
108 { 108 {
109 get 109 get
110 { 110 {
111 if (!m_regionHandle.HasValue) 111 if (!m_regionHandle.HasValue)
112 { 112 {
113 m_regionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); 113 m_regionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
114 } 114 }
115 115
116 return m_regionHandle.Value; 116 return m_regionHandle.Value;
117 } 117 }
118 } 118 }
119 119
120 // Only used for remote regions , ie ones not in the current instance 120 // Only used for remote regions , ie ones not in the current instance
121 private uint m_remotingPort; 121 private uint m_remotingPort;
122 public uint RemotingPort 122 public uint RemotingPort
123 { 123 {
124 get 124 get
125 { 125 {
126 return m_remotingPort; 126 return m_remotingPort;
127 } 127 }
128 set 128 set
129 { 129 {
130 m_remotingPort = value; 130 m_remotingPort = value;
131 } 131 }
132 } 132 }
133 public string RemotingAddress; 133 public string RemotingAddress;
134 134
135 public string DataStore = ""; 135 public string DataStore = "";
136 public bool isSandbox = false; 136 public bool isSandbox = false;
137 137
138 public LLUUID MasterAvatarAssignedUUID = new LLUUID(); 138 public LLUUID MasterAvatarAssignedUUID = new LLUUID();
139 public string MasterAvatarFirstName = ""; 139 public string MasterAvatarFirstName = "";
140 public string MasterAvatarLastName = ""; 140 public string MasterAvatarLastName = "";
141 public string MasterAvatarSandboxPassword = ""; 141 public string MasterAvatarSandboxPassword = "";
142 142
143 public EstateSettings estateSettings; 143 public EstateSettings estateSettings;
144 144
145 public RegionInfo() 145 public RegionInfo()
146 { 146 {
147 estateSettings = new EstateSettings(); 147 estateSettings = new EstateSettings();
148 } 148 }
149 149
150 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 150 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
151 : this() 151 : this()
152 { 152 {
153 m_regionLocX = regionLocX; 153 m_regionLocX = regionLocX;
154 m_regionLocY = regionLocY; 154 m_regionLocY = regionLocY;
155 155
156 m_internalEndPoint = internalEndPoint; 156 m_internalEndPoint = internalEndPoint;
157 m_externalHostName = externalUri; 157 m_externalHostName = externalUri;
158 } 158 }
159 159
160 public void InitConfig(bool sandboxMode, IGenericConfig configData) 160 public void InitConfig(bool sandboxMode, IGenericConfig configData)
161 { 161 {
162 this.isSandbox = sandboxMode; 162 this.isSandbox = sandboxMode;
163 try 163 try
164 { 164 {
165 string attri = ""; 165 string attri = "";
166 166
167 // Sim UUID 167 // Sim UUID
168 string simId = configData.GetAttribute("SimUUID"); 168 string simId = configData.GetAttribute("SimUUID");
169 if (String.IsNullOrEmpty( simId )) 169 if (String.IsNullOrEmpty( simId ))
170 { 170 {
171 this.SimUUID = LLUUID.Random(); 171 this.SimUUID = LLUUID.Random();
172 } 172 }
173 else 173 else
174 { 174 {
175 this.SimUUID = new LLUUID(simId); 175 this.SimUUID = new LLUUID(simId);
176 } 176 }
177 configData.SetAttribute("SimUUID", this.SimUUID.ToString()); 177 configData.SetAttribute("SimUUID", this.SimUUID.ToString());
178 178
179 this.RegionName = GetString(configData, "SimName", "OpenSim test", "Region Name"); 179 this.RegionName = GetString(configData, "SimName", "OpenSim test", "Region Name");
180 180
181 //m_regionLocX = (uint) GetInt(configData, "SimLocationX", 1000, "Grid Location X"); 181 //m_regionLocX = (uint) GetInt(configData, "SimLocationX", 1000, "Grid Location X");
182 182
183 attri = ""; 183 attri = "";
184 attri = configData.GetAttribute("SimLocationX"); 184 attri = configData.GetAttribute("SimLocationX");
185 if (attri == "") 185 if (attri == "")
186 { 186 {
187 string location = MainLog.Instance.CmdPrompt("Grid Location X", "1000"); 187 string location = MainLog.Instance.CmdPrompt("Grid Location X", "1000");
188 configData.SetAttribute("SimLocationX", location); 188 configData.SetAttribute("SimLocationX", location);
189 m_regionLocX = (uint)Convert.ToUInt32(location); 189 m_regionLocX = (uint)Convert.ToUInt32(location);
190 } 190 }
191 else 191 else
192 { 192 {
193 m_regionLocX = (uint)Convert.ToUInt32(attri); 193 m_regionLocX = (uint)Convert.ToUInt32(attri);
194 } 194 }
195 // Sim/Grid location Y 195 // Sim/Grid location Y
196 attri = ""; 196 attri = "";
197 attri = configData.GetAttribute("SimLocationY"); 197 attri = configData.GetAttribute("SimLocationY");
198 if (attri == "") 198 if (attri == "")
199 { 199 {
200 string location = MainLog.Instance.CmdPrompt("Grid Location Y", "1000"); 200 string location = MainLog.Instance.CmdPrompt("Grid Location Y", "1000");
201 configData.SetAttribute("SimLocationY", location); 201 configData.SetAttribute("SimLocationY", location);
202 m_regionLocY = (uint)Convert.ToUInt32(location); 202 m_regionLocY = (uint)Convert.ToUInt32(location);
203 } 203 }
204 else 204 else
205 { 205 {
206 m_regionLocY = (uint)Convert.ToUInt32(attri); 206 m_regionLocY = (uint)Convert.ToUInt32(attri);
207 } 207 }
208 208
209 m_regionHandle = null; 209 m_regionHandle = null;
210 210
211 this.DataStore = GetString(configData, "Datastore", "localworld.yap", "Filename for local storage"); 211 this.DataStore = GetString(configData, "Datastore", "localworld.yap", "Filename for local storage");
212 212
213 IPAddress internalAddress = GetIPAddress(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections"); 213 IPAddress internalAddress = GetIPAddress(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections");
214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections"); 214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections");
215 m_internalEndPoint = new IPEndPoint(internalAddress, internalPort); 215 m_internalEndPoint = new IPEndPoint(internalAddress, internalPort);
216 216
217 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name"); 217 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name");
218 218
219 estateSettings.terrainFile = 219 estateSettings.terrainFile =
220 GetString(configData, "TerrainFile", "default.r32", "GENERAL SETTING: Default Terrain File"); 220 GetString(configData, "TerrainFile", "default.r32", "GENERAL SETTING: Default Terrain File");
221 221
222 attri = ""; 222 attri = "";
223 attri = configData.GetAttribute("TerrainMultiplier"); 223 attri = configData.GetAttribute("TerrainMultiplier");
224 if (attri == "") 224 if (attri == "")
225 { 225 {
226 string re = MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); 226 string re = MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0");
227 this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); 227 this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture);
228 configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString()); 228 configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString());
229 } 229 }
230 else 230 else
231 { 231 {
232 this.estateSettings.terrainMultiplier = Convert.ToDouble(attri); 232 this.estateSettings.terrainMultiplier = Convert.ToDouble(attri);
233 } 233 }
234 234
235 attri = ""; 235 attri = "";
236 attri = configData.GetAttribute("MasterAvatarFirstName"); 236 attri = configData.GetAttribute("MasterAvatarFirstName");
237 if (attri == "") 237 if (attri == "")
238 { 238 {
239 this.MasterAvatarFirstName = MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test"); 239 this.MasterAvatarFirstName = MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test");
240 240
241 configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName); 241 configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName);
242 } 242 }
243 else 243 else
244 { 244 {
245 this.MasterAvatarFirstName = attri; 245 this.MasterAvatarFirstName = attri;
246 } 246 }
247 247
248 attri = ""; 248 attri = "";
249 attri = configData.GetAttribute("MasterAvatarLastName"); 249 attri = configData.GetAttribute("MasterAvatarLastName");
250 if (attri == "") 250 if (attri == "")
251 { 251 {
252 this.MasterAvatarLastName = MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User"); 252 this.MasterAvatarLastName = MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User");
253 253
254 configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName); 254 configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName);
255 } 255 }
256 else 256 else
257 { 257 {
258 this.MasterAvatarLastName = attri; 258 this.MasterAvatarLastName = attri;
259 } 259 }
260 260
261 if (isSandbox) //Sandbox Mode Specific Settings 261 if (isSandbox) //Sandbox Mode Specific Settings
262 { 262 {
263 attri = ""; 263 attri = "";
264 attri = configData.GetAttribute("MasterAvatarSandboxPassword"); 264 attri = configData.GetAttribute("MasterAvatarSandboxPassword");
265 if (attri == "") 265 if (attri == "")
266 { 266 {
267 this.MasterAvatarSandboxPassword = MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test"); 267 this.MasterAvatarSandboxPassword = MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test");
268 268
269 //Should I store this? 269 //Should I store this?
270 configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword); 270 configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword);
271 } 271 }
272 else 272 else
273 { 273 {
274 this.MasterAvatarSandboxPassword = attri; 274 this.MasterAvatarSandboxPassword = attri;
275 } 275 }
276 } 276 }
277 277
278 configData.Commit(); 278 configData.Commit();
279 } 279 }
280 catch (Exception e) 280 catch (Exception e)
281 { 281 {
282 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); 282 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
283 MainLog.Instance.Warn(e.ToString()); 283 MainLog.Instance.Warn(e.ToString());
284 } 284 }
285 285
286 MainLog.Instance.Verbose("Sim settings loaded:"); 286 MainLog.Instance.Verbose("Sim settings loaded:");
287 MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated()); 287 MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated());
288 MainLog.Instance.Verbose("Name: " + this.RegionName); 288 MainLog.Instance.Verbose("Name: " + this.RegionName);
289 MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); 289 MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
290 MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString()); 290 MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString());
291 MainLog.Instance.Verbose("Listening on IP end point: " + m_internalEndPoint.ToString() ); 291 MainLog.Instance.Verbose("Listening on IP end point: " + m_internalEndPoint.ToString() );
292 MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString()); 292 MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString());
293 293
294 } 294 }
295 295
296 private uint GetInt(IGenericConfig configData, string p, int p_3, string p_4) 296 private uint GetInt(IGenericConfig configData, string p, int p_3, string p_4)
297 { 297 {
298 throw new Exception("The method or operation is not implemented."); 298 throw new Exception("The method or operation is not implemented.");
299 } 299 }
300 300
301 private string GetString(IGenericConfig configData, string attrName, string defaultvalue, string prompt) 301 private string GetString(IGenericConfig configData, string attrName, string defaultvalue, string prompt)
302 { 302 {
303 string s = configData.GetAttribute(attrName); 303 string s = configData.GetAttribute(attrName);
304 304
305 if (String.IsNullOrEmpty( s )) 305 if (String.IsNullOrEmpty( s ))
306 { 306 {
307 s = MainLog.Instance.CmdPrompt(prompt, defaultvalue); 307 s = MainLog.Instance.CmdPrompt(prompt, defaultvalue);
308 configData.SetAttribute(attrName, s ); 308 configData.SetAttribute(attrName, s );
309 } 309 }
310 return s; 310 return s;
311 } 311 }
312 312
313 private IPAddress GetIPAddress(IGenericConfig configData, string attrName, string defaultvalue, string prompt) 313 private IPAddress GetIPAddress(IGenericConfig configData, string attrName, string defaultvalue, string prompt)
314 { 314 {
315 string addressStr = configData.GetAttribute(attrName); 315 string addressStr = configData.GetAttribute(attrName);
316 316
317 IPAddress address; 317 IPAddress address;
318 318
319 if (!IPAddress.TryParse(addressStr, out address)) 319 if (!IPAddress.TryParse(addressStr, out address))
320 { 320 {
321 address = MainLog.Instance.CmdPromptIPAddress(prompt, defaultvalue); 321 address = MainLog.Instance.CmdPromptIPAddress(prompt, defaultvalue);
322 configData.SetAttribute(attrName, address.ToString()); 322 configData.SetAttribute(attrName, address.ToString());
323 } 323 }
324 return address; 324 return address;
325 } 325 }
326 326
327 private int GetIPPort(IGenericConfig configData, string attrName, string defaultvalue, string prompt) 327 private int GetIPPort(IGenericConfig configData, string attrName, string defaultvalue, string prompt)
328 { 328 {
329 string portStr = configData.GetAttribute(attrName); 329 string portStr = configData.GetAttribute(attrName);
330 330
331 int port; 331 int port;
332 332
333 if (!int.TryParse(portStr, out port)) 333 if (!int.TryParse(portStr, out port))
334 { 334 {
335 port = MainLog.Instance.CmdPromptIPPort(prompt, defaultvalue); 335 port = MainLog.Instance.CmdPromptIPPort(prompt, defaultvalue);
336 configData.SetAttribute(attrName, port.ToString()); 336 configData.SetAttribute(attrName, port.ToString());
337 } 337 }
338 338
339 return port; 339 return port;
340 } 340 }
341 } 341 }
342} 342}
diff --git a/OpenSim/Framework/General/Types/UUID.cs b/OpenSim/Framework/General/Types/UUID.cs
index 9cde18e..9e9654d 100644
--- a/OpenSim/Framework/General/Types/UUID.cs
+++ b/OpenSim/Framework/General/Types/UUID.cs
@@ -1,127 +1,127 @@
1using System; 1using System;
2using libsecondlife; 2using libsecondlife;
3 3
4namespace OpenSim.Framework.Types 4namespace OpenSim.Framework.Types
5{ 5{
6 class UUID 6 class UUID
7 { 7 {
8 public LLUUID llUUID; 8 public LLUUID llUUID;
9 9
10 public UUID(string uuid) 10 public UUID(string uuid)
11 { 11 {
12 llUUID = new LLUUID(uuid); 12 llUUID = new LLUUID(uuid);
13 } 13 }
14 14
15 public UUID(byte[] uuid) 15 public UUID(byte[] uuid)
16 { 16 {
17 llUUID = new LLUUID(uuid, 0); 17 llUUID = new LLUUID(uuid, 0);
18 } 18 }
19 19
20 public UUID(byte[] uuid, int offset) 20 public UUID(byte[] uuid, int offset)
21 { 21 {
22 llUUID = new LLUUID(uuid, offset); 22 llUUID = new LLUUID(uuid, offset);
23 } 23 }
24 24
25 public UUID() 25 public UUID()
26 { 26 {
27 llUUID = LLUUID.Zero; 27 llUUID = LLUUID.Zero;
28 } 28 }
29 29
30 public UUID(ulong uuid) 30 public UUID(ulong uuid)
31 { 31 {
32 llUUID = new LLUUID(uuid); 32 llUUID = new LLUUID(uuid);
33 } 33 }
34 34
35 public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) 35 public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth)
36 { 36 {
37 byte[] uuid = new byte[16]; 37 byte[] uuid = new byte[16];
38 38
39 byte[] n = BitConverter.GetBytes(first); 39 byte[] n = BitConverter.GetBytes(first);
40 n.CopyTo(uuid, 0); 40 n.CopyTo(uuid, 0);
41 n = BitConverter.GetBytes(second); 41 n = BitConverter.GetBytes(second);
42 n.CopyTo(uuid, 4); 42 n.CopyTo(uuid, 4);
43 n = BitConverter.GetBytes(third); 43 n = BitConverter.GetBytes(third);
44 n.CopyTo(uuid, 8); 44 n.CopyTo(uuid, 8);
45 n = BitConverter.GetBytes(fourth); 45 n = BitConverter.GetBytes(fourth);
46 n.CopyTo(uuid, 12); 46 n.CopyTo(uuid, 12);
47 47
48 llUUID = new LLUUID(uuid,0); 48 llUUID = new LLUUID(uuid,0);
49 } 49 }
50 50
51 public override string ToString() 51 public override string ToString()
52 { 52 {
53 return llUUID.ToString(); 53 return llUUID.ToString();
54 } 54 }
55 55
56 public string ToStringHyphenated() 56 public string ToStringHyphenated()
57 { 57 {
58 return llUUID.ToStringHyphenated(); 58 return llUUID.ToStringHyphenated();
59 } 59 }
60 60
61 public byte[] GetBytes() 61 public byte[] GetBytes()
62 { 62 {
63 return llUUID.GetBytes(); 63 return llUUID.GetBytes();
64 } 64 }
65 65
66 public UInt32[] GetInts() 66 public UInt32[] GetInts()
67 { 67 {
68 UInt32[] ints = new UInt32[4]; 68 UInt32[] ints = new UInt32[4];
69 ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); 69 ints[0] = BitConverter.ToUInt32(llUUID.Data, 0);
70 ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); 70 ints[1] = BitConverter.ToUInt32(llUUID.Data, 4);
71 ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); 71 ints[2] = BitConverter.ToUInt32(llUUID.Data, 8);
72 ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); 72 ints[3] = BitConverter.ToUInt32(llUUID.Data, 12);
73 73
74 return ints; 74 return ints;
75 } 75 }
76 76
77 public LLUUID GetLLUUID() 77 public LLUUID GetLLUUID()
78 { 78 {
79 return llUUID; 79 return llUUID;
80 } 80 }
81 81
82 public uint CRC() 82 public uint CRC()
83 { 83 {
84 return llUUID.CRC(); 84 return llUUID.CRC();
85 } 85 }
86 86
87 public override int GetHashCode() 87 public override int GetHashCode()
88 { 88 {
89 return llUUID.GetHashCode(); 89 return llUUID.GetHashCode();
90 } 90 }
91 91
92 public void Combine(UUID other) 92 public void Combine(UUID other)
93 { 93 {
94 llUUID.Combine(other.GetLLUUID()); 94 llUUID.Combine(other.GetLLUUID());
95 } 95 }
96 96
97 public void Combine(LLUUID other) 97 public void Combine(LLUUID other)
98 { 98 {
99 llUUID.Combine(other); 99 llUUID.Combine(other);
100 } 100 }
101 101
102 public override bool Equals(Object other) 102 public override bool Equals(Object other)
103 { 103 {
104 return llUUID.Equals(other); 104 return llUUID.Equals(other);
105 } 105 }
106 106
107 public static bool operator ==(UUID a, UUID b) 107 public static bool operator ==(UUID a, UUID b)
108 { 108 {
109 return a.llUUID.Equals(b.GetLLUUID()); 109 return a.llUUID.Equals(b.GetLLUUID());
110 } 110 }
111 111
112 public static bool operator !=(UUID a, UUID b) 112 public static bool operator !=(UUID a, UUID b)
113 { 113 {
114 return !a.llUUID.Equals(b.GetLLUUID()); 114 return !a.llUUID.Equals(b.GetLLUUID());
115 } 115 }
116 116
117 public static bool operator ==(UUID a, LLUUID b) 117 public static bool operator ==(UUID a, LLUUID b)
118 { 118 {
119 return a.Equals(b); 119 return a.Equals(b);
120 } 120 }
121 121
122 public static bool operator !=(UUID a, LLUUID b) 122 public static bool operator !=(UUID a, LLUUID b)
123 { 123 {
124 return !a.Equals(b); 124 return !a.Equals(b);
125 } 125 }
126 } 126 }
127} 127}
diff --git a/OpenSim/Framework/General/UserProfile.cs b/OpenSim/Framework/General/UserProfile.cs
index 243208a..ec5a485 100644
--- a/OpenSim/Framework/General/UserProfile.cs
+++ b/OpenSim/Framework/General/UserProfile.cs
@@ -1,87 +1,87 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Security.Cryptography; 29using System.Security.Cryptography;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework.Inventory; 31using OpenSim.Framework.Inventory;
32 32
33namespace OpenSim.Framework.User 33namespace OpenSim.Framework.User
34{ 34{
35 public class UserProfile 35 public class UserProfile
36 { 36 {
37 37
38 public string firstname; 38 public string firstname;
39 public string lastname; 39 public string lastname;
40 public ulong homeregionhandle; 40 public ulong homeregionhandle;
41 public LLVector3 homepos; 41 public LLVector3 homepos;
42 public LLVector3 homelookat; 42 public LLVector3 homelookat;
43 43
44 public bool IsGridGod = false; 44 public bool IsGridGod = false;
45 public bool IsLocal = true; // will be used in future for visitors from foreign grids 45 public bool IsLocal = true; // will be used in future for visitors from foreign grids
46 public string AssetURL; 46 public string AssetURL;
47 public string MD5passwd; 47 public string MD5passwd;
48 48
49 public LLUUID CurrentSessionID; 49 public LLUUID CurrentSessionID;
50 public LLUUID CurrentSecureSessionID; 50 public LLUUID CurrentSecureSessionID;
51 public LLUUID UUID; 51 public LLUUID UUID;
52 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes 52 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
53 53
54 public AgentInventory Inventory; 54 public AgentInventory Inventory;
55 55
56 public UserProfile() 56 public UserProfile()
57 { 57 {
58 Circuits = new Dictionary<LLUUID, uint>(); 58 Circuits = new Dictionary<LLUUID, uint>();
59 Inventory = new AgentInventory(); 59 Inventory = new AgentInventory();
60 homeregionhandle = Helpers.UIntsToLong((1000 * 256), (1000 * 256)); 60 homeregionhandle = Helpers.UIntsToLong((1000 * 256), (1000 * 256));
61 homepos = new LLVector3(); 61 homepos = new LLVector3();
62 homelookat = new LLVector3(); 62 homelookat = new LLVector3();
63 } 63 }
64 64
65 public void InitSessionData() 65 public void InitSessionData()
66 { 66 {
67 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); 67 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
68 68
69 byte[] randDataS = new byte[16]; 69 byte[] randDataS = new byte[16];
70 byte[] randDataSS = new byte[16]; 70 byte[] randDataSS = new byte[16];
71 71
72 rand.GetBytes(randDataS); 72 rand.GetBytes(randDataS);
73 rand.GetBytes(randDataSS); 73 rand.GetBytes(randDataSS);
74 74
75 CurrentSecureSessionID = new LLUUID(randDataSS,0); 75 CurrentSecureSessionID = new LLUUID(randDataSS,0);
76 CurrentSessionID = new LLUUID(randDataS,0); 76 CurrentSessionID = new LLUUID(randDataS,0);
77 77
78 } 78 }
79 79
80 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID) 80 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
81 { 81 {
82 if (this.Circuits.ContainsKey(regionUUID) == false) 82 if (this.Circuits.ContainsKey(regionUUID) == false)
83 this.Circuits.Add(regionUUID, circuitCode); 83 this.Circuits.Add(regionUUID, circuitCode);
84 } 84 }
85 85
86 } 86 }
87} 87}
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs
index 13e3af2..3333ced 100644
--- a/OpenSim/Framework/General/Util.cs
+++ b/OpenSim/Framework/General/Util.cs
@@ -1,184 +1,184 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Security.Cryptography; 29using System.Security.Cryptography;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32 32
33namespace OpenSim.Framework.Utilities 33namespace OpenSim.Framework.Utilities
34{ 34{
35 public class Util 35 public class Util
36 { 36 {
37 private static Random randomClass = new Random(); 37 private static Random randomClass = new Random();
38 private static uint nextXferID = 5000; 38 private static uint nextXferID = 5000;
39 private static object XferLock = new object(); 39 private static object XferLock = new object();
40 40
41 public static ulong UIntsToLong(uint X, uint Y) 41 public static ulong UIntsToLong(uint X, uint Y)
42 { 42 {
43 return Helpers.UIntsToLong(X, Y); 43 return Helpers.UIntsToLong(X, Y);
44 } 44 }
45 45
46 public static Random RandomClass 46 public static Random RandomClass
47 { 47 {
48 get 48 get
49 { 49 {
50 return randomClass; 50 return randomClass;
51 } 51 }
52 } 52 }
53 53
54 public static uint GetNextXferID() 54 public static uint GetNextXferID()
55 { 55 {
56 uint id = 0; 56 uint id = 0;
57 lock(XferLock) 57 lock(XferLock)
58 { 58 {
59 id = nextXferID; 59 id = nextXferID;
60 nextXferID++; 60 nextXferID++;
61 } 61 }
62 return id; 62 return id;
63 } 63 }
64 64
65 public static int UnixTimeSinceEpoch() 65 public static int UnixTimeSinceEpoch()
66 { 66 {
67 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 67 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
68 int timestamp = (int)t.TotalSeconds; 68 int timestamp = (int)t.TotalSeconds;
69 return timestamp; 69 return timestamp;
70 } 70 }
71 71
72 public static string Md5Hash(string pass) 72 public static string Md5Hash(string pass)
73 { 73 {
74 MD5 md5 = MD5CryptoServiceProvider.Create(); 74 MD5 md5 = MD5CryptoServiceProvider.Create();
75 byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass)); 75 byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass));
76 StringBuilder sb = new StringBuilder(); 76 StringBuilder sb = new StringBuilder();
77 for (int i = 0; i < dataMd5.Length; i++) 77 for (int i = 0; i < dataMd5.Length; i++)
78 sb.AppendFormat("{0:x2}", dataMd5[i]); 78 sb.AppendFormat("{0:x2}", dataMd5[i]);
79 return sb.ToString(); 79 return sb.ToString();
80 } 80 }
81 81
82 public static string GetRandomCapsPath() 82 public static string GetRandomCapsPath()
83 { 83 {
84 LLUUID caps = LLUUID.Random(); 84 LLUUID caps = LLUUID.Random();
85 string capsPath = caps.ToStringHyphenated(); 85 string capsPath = caps.ToStringHyphenated();
86 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 86 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
87 return capsPath; 87 return capsPath;
88 } 88 }
89 89
90 //public static int fast_distance2d(int x, int y) 90 //public static int fast_distance2d(int x, int y)
91 //{ 91 //{
92 // x = System.Math.Abs(x); 92 // x = System.Math.Abs(x);
93 // y = System.Math.Abs(y); 93 // y = System.Math.Abs(y);
94 94
95 // int min = System.Math.Min(x, y); 95 // int min = System.Math.Min(x, y);
96 96
97 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); 97 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
98 //} 98 //}
99 99
100 public static string FieldToString(byte[] bytes) 100 public static string FieldToString(byte[] bytes)
101 { 101 {
102 return FieldToString(bytes, String.Empty); 102 return FieldToString(bytes, String.Empty);
103 } 103 }
104 104
105 /// <summary> 105 /// <summary>
106 /// Convert a variable length field (byte array) to a string, with a 106 /// Convert a variable length field (byte array) to a string, with a
107 /// field name prepended to each line of the output 107 /// field name prepended to each line of the output
108 /// </summary> 108 /// </summary>
109 /// <remarks>If the byte array has unprintable characters in it, a 109 /// <remarks>If the byte array has unprintable characters in it, a
110 /// hex dump will be put in the string instead</remarks> 110 /// hex dump will be put in the string instead</remarks>
111 /// <param name="bytes">The byte array to convert to a string</param> 111 /// <param name="bytes">The byte array to convert to a string</param>
112 /// <param name="fieldName">A field name to prepend to each line of output</param> 112 /// <param name="fieldName">A field name to prepend to each line of output</param>
113 /// <returns>An ASCII string or a string containing a hex dump, minus 113 /// <returns>An ASCII string or a string containing a hex dump, minus
114 /// the null terminator</returns> 114 /// the null terminator</returns>
115 public static string FieldToString(byte[] bytes, string fieldName) 115 public static string FieldToString(byte[] bytes, string fieldName)
116 { 116 {
117 // Check for a common case 117 // Check for a common case
118 if (bytes.Length == 0) return String.Empty; 118 if (bytes.Length == 0) return String.Empty;
119 119
120 StringBuilder output = new StringBuilder(); 120 StringBuilder output = new StringBuilder();
121 bool printable = true; 121 bool printable = true;
122 122
123 for (int i = 0; i < bytes.Length; ++i) 123 for (int i = 0; i < bytes.Length; ++i)
124 { 124 {
125 // Check if there are any unprintable characters in the array 125 // Check if there are any unprintable characters in the array
126 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 126 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
127 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) 127 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
128 { 128 {
129 printable = false; 129 printable = false;
130 break; 130 break;
131 } 131 }
132 } 132 }
133 133
134 if (printable) 134 if (printable)
135 { 135 {
136 if (fieldName.Length > 0) 136 if (fieldName.Length > 0)
137 { 137 {
138 output.Append(fieldName); 138 output.Append(fieldName);
139 output.Append(": "); 139 output.Append(": ");
140 } 140 }
141 141
142 if (bytes[bytes.Length - 1] == 0x00) 142 if (bytes[bytes.Length - 1] == 0x00)
143 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); 143 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
144 else 144 else
145 output.Append(UTF8Encoding.UTF8.GetString(bytes)); 145 output.Append(UTF8Encoding.UTF8.GetString(bytes));
146 } 146 }
147 else 147 else
148 { 148 {
149 for (int i = 0; i < bytes.Length; i += 16) 149 for (int i = 0; i < bytes.Length; i += 16)
150 { 150 {
151 if (i != 0) 151 if (i != 0)
152 output.Append(Environment.NewLine); 152 output.Append(Environment.NewLine);
153 if (fieldName.Length > 0) 153 if (fieldName.Length > 0)
154 { 154 {
155 output.Append(fieldName); 155 output.Append(fieldName);
156 output.Append(": "); 156 output.Append(": ");
157 } 157 }
158 158
159 for (int j = 0; j < 16; j++) 159 for (int j = 0; j < 16; j++)
160 { 160 {
161 if ((i + j) < bytes.Length) 161 if ((i + j) < bytes.Length)
162 output.Append(String.Format("{0:X2} ", bytes[i + j])); 162 output.Append(String.Format("{0:X2} ", bytes[i + j]));
163 else 163 else
164 output.Append(" "); 164 output.Append(" ");
165 } 165 }
166 166
167 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) 167 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
168 { 168 {
169 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) 169 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
170 output.Append((char)bytes[i + j]); 170 output.Append((char)bytes[i + j]);
171 else 171 else
172 output.Append("."); 172 output.Append(".");
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 return output.ToString(); 177 return output.ToString();
178 } 178 }
179 public Util() 179 public Util()
180 { 180 {
181 181
182 } 182 }
183 } 183 }
184} 184}
diff --git a/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs b/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs
index fcffd67..28779ee 100644
--- a/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.GenericConfig")] 6[assembly: AssemblyTitle("OpenSim.GenericConfig")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.GenericConfig")] 10[assembly: AssemblyProduct("OpenSim.GenericConfig")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("285a3047-f165-46c8-8767-b51428738a09")] 21[assembly: Guid("285a3047-f165-46c8-8767-b51428738a09")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs b/OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs
index 7fa085d..2ed8d28 100644
--- a/OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs
+++ b/OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs
@@ -1,122 +1,122 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Xml; 30using System.Xml;
31using OpenSim.Framework.Interfaces; 31using OpenSim.Framework.Interfaces;
32 32
33namespace OpenSim.GenericConfig 33namespace OpenSim.GenericConfig
34{ 34{
35 public class XmlConfig : IGenericConfig 35 public class XmlConfig : IGenericConfig
36 { 36 {
37 private XmlDocument doc; 37 private XmlDocument doc;
38 private XmlNode rootNode; 38 private XmlNode rootNode;
39 private XmlNode configNode; 39 private XmlNode configNode;
40 private string fileName; 40 private string fileName;
41 private bool createdFile = false; 41 private bool createdFile = false;
42 42
43 public XmlConfig(string filename) 43 public XmlConfig(string filename)
44 { 44 {
45 fileName = filename; 45 fileName = filename;
46 } 46 }
47 47
48 public void LoadData() 48 public void LoadData()
49 { 49 {
50 doc = new XmlDocument(); 50 doc = new XmlDocument();
51 51
52 if (File.Exists(fileName)) 52 if (File.Exists(fileName))
53 { 53 {
54 XmlTextReader reader = new XmlTextReader(fileName); 54 XmlTextReader reader = new XmlTextReader(fileName);
55 reader.WhitespaceHandling = WhitespaceHandling.None; 55 reader.WhitespaceHandling = WhitespaceHandling.None;
56 doc.Load(reader); 56 doc.Load(reader);
57 reader.Close(); 57 reader.Close();
58 } 58 }
59 else 59 else
60 { 60 {
61 createdFile = true; 61 createdFile = true;
62 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); 62 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
63 doc.AppendChild(rootNode); 63 doc.AppendChild(rootNode);
64 configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); 64 configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
65 rootNode.AppendChild(configNode); 65 rootNode.AppendChild(configNode);
66 } 66 }
67 67
68 68
69 rootNode = doc.FirstChild; 69 rootNode = doc.FirstChild;
70 if (rootNode.Name != "Root") 70 if (rootNode.Name != "Root")
71 throw new Exception("Error: Invalid .xml File. Missing <Root>"); 71 throw new Exception("Error: Invalid .xml File. Missing <Root>");
72 72
73 configNode = rootNode.FirstChild; 73 configNode = rootNode.FirstChild;
74 if (configNode.Name != "Config") 74 if (configNode.Name != "Config")
75 throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); 75 throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
76 76
77 if (createdFile) 77 if (createdFile)
78 { 78 {
79 this.Commit(); 79 this.Commit();
80 } 80 }
81 } 81 }
82 82
83 public string GetAttribute(string attributeName) 83 public string GetAttribute(string attributeName)
84 { 84 {
85 string result = ""; 85 string result = "";
86 if (configNode.Attributes[attributeName] != null) 86 if (configNode.Attributes[attributeName] != null)
87 { 87 {
88 result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; 88 result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value;
89 } 89 }
90 return result; 90 return result;
91 } 91 }
92 92
93 public bool SetAttribute(string attributeName, string attributeValue) 93 public bool SetAttribute(string attributeName, string attributeValue)
94 { 94 {
95 if (configNode.Attributes[attributeName] != null) 95 if (configNode.Attributes[attributeName] != null)
96 { 96 {
97 ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; 97 ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
98 } 98 }
99 else 99 else
100 { 100 {
101 XmlAttribute attri; 101 XmlAttribute attri;
102 attri = doc.CreateAttribute(attributeName); 102 attri = doc.CreateAttribute(attributeName);
103 attri.Value = attributeValue; 103 attri.Value = attributeValue;
104 configNode.Attributes.Append(attri); 104 configNode.Attributes.Append(attri);
105 } 105 }
106 return true; 106 return true;
107 } 107 }
108 108
109 public void Commit() 109 public void Commit()
110 { 110 {
111 doc.Save(fileName); 111 doc.Save(fileName);
112 } 112 }
113 113
114 public void Close() 114 public void Close()
115 { 115 {
116 configNode = null; 116 configNode = null;
117 rootNode = null; 117 rootNode = null;
118 doc = null; 118 doc = null;
119 } 119 }
120 120
121 } 121 }
122} 122}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index f790477..4b3b3de 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -1,224 +1,224 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Net; 32using System.Net;
33using System.Text; 33using System.Text;
34using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
35using System.Threading; 35using System.Threading;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38 38
39namespace OpenSim.Framework.Servers 39namespace OpenSim.Framework.Servers
40{ 40{
41 public class BaseHttpServer 41 public class BaseHttpServer
42 { 42 {
43 protected Thread m_workerThread; 43 protected Thread m_workerThread;
44 protected HttpListener m_httpListener; 44 protected HttpListener m_httpListener;
45 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); 45 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
46 protected Dictionary<string, IStreamHandler> m_streamHandlers = new Dictionary<string, IStreamHandler>(); 46 protected Dictionary<string, IStreamHandler> m_streamHandlers = new Dictionary<string, IStreamHandler>();
47 protected int m_port; 47 protected int m_port;
48 protected bool m_firstcaps = true; 48 protected bool m_firstcaps = true;
49 49
50 public BaseHttpServer(int port) 50 public BaseHttpServer(int port)
51 { 51 {
52 m_port = port; 52 m_port = port;
53 } 53 }
54 54
55 public void AddStreamHandler( IStreamHandler handler) 55 public void AddStreamHandler( IStreamHandler handler)
56 { 56 {
57 string httpMethod = handler.HttpMethod; 57 string httpMethod = handler.HttpMethod;
58 string path = handler.Path; 58 string path = handler.Path;
59 59
60 string handlerKey = GetHandlerKey(httpMethod, path); 60 string handlerKey = GetHandlerKey(httpMethod, path);
61 m_streamHandlers.Add(handlerKey, handler); 61 m_streamHandlers.Add(handlerKey, handler);
62 } 62 }
63 63
64 private static string GetHandlerKey(string httpMethod, string path) 64 private static string GetHandlerKey(string httpMethod, string path)
65 { 65 {
66 return httpMethod + ":" + path; 66 return httpMethod + ":" + path;
67 } 67 }
68 68
69 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) 69 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
70 { 70 {
71 if (!this.m_rpcHandlers.ContainsKey(method)) 71 if (!this.m_rpcHandlers.ContainsKey(method))
72 { 72 {
73 this.m_rpcHandlers.Add(method, handler); 73 this.m_rpcHandlers.Add(method, handler);
74 return true; 74 return true;
75 } 75 }
76 76
77 //must already have a handler for that path so return false 77 //must already have a handler for that path so return false
78 return false; 78 return false;
79 } 79 }
80 80
81 81
82 public virtual void HandleRequest(Object stateinfo) 82 public virtual void HandleRequest(Object stateinfo)
83 { 83 {
84 HttpListenerContext context = (HttpListenerContext)stateinfo; 84 HttpListenerContext context = (HttpListenerContext)stateinfo;
85 85
86 HttpListenerRequest request = context.Request; 86 HttpListenerRequest request = context.Request;
87 HttpListenerResponse response = context.Response; 87 HttpListenerResponse response = context.Response;
88 88
89 response.KeepAlive = false; 89 response.KeepAlive = false;
90 response.SendChunked = false; 90 response.SendChunked = false;
91 91
92 string path = request.RawUrl; 92 string path = request.RawUrl;
93 string handlerKey = GetHandlerKey( request.HttpMethod, path ); 93 string handlerKey = GetHandlerKey( request.HttpMethod, path );
94 94
95 IStreamHandler streamHandler; 95 IStreamHandler streamHandler;
96 96
97 if (TryGetStreamHandler( handlerKey, out streamHandler)) 97 if (TryGetStreamHandler( handlerKey, out streamHandler))
98 { 98 {
99 byte[] buffer = streamHandler.Handle(path, request.InputStream); 99 byte[] buffer = streamHandler.Handle(path, request.InputStream);
100 request.InputStream.Close(); 100 request.InputStream.Close();
101 101
102 response.ContentType = streamHandler.ContentType; 102 response.ContentType = streamHandler.ContentType;
103 response.ContentLength64 = buffer.LongLength; 103 response.ContentLength64 = buffer.LongLength;
104 response.OutputStream.Write(buffer, 0, buffer.Length); 104 response.OutputStream.Write(buffer, 0, buffer.Length);
105 response.OutputStream.Close(); 105 response.OutputStream.Close();
106 } 106 }
107 else 107 else
108 { 108 {
109 HandleXmlRpcRequests(request, response); 109 HandleXmlRpcRequests(request, response);
110 } 110 }
111 } 111 }
112 112
113 private bool TryGetStreamHandler(string handlerKey, out IStreamHandler streamHandler) 113 private bool TryGetStreamHandler(string handlerKey, out IStreamHandler streamHandler)
114 { 114 {
115 string bestMatch = null; 115 string bestMatch = null;
116 116
117 foreach (string pattern in m_streamHandlers.Keys) 117 foreach (string pattern in m_streamHandlers.Keys)
118 { 118 {
119 if (handlerKey.StartsWith(pattern)) 119 if (handlerKey.StartsWith(pattern))
120 { 120 {
121 if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) 121 if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
122 { 122 {
123 bestMatch = pattern; 123 bestMatch = pattern;
124 } 124 }
125 } 125 }
126 } 126 }
127 127
128 if (String.IsNullOrEmpty(bestMatch)) 128 if (String.IsNullOrEmpty(bestMatch))
129 { 129 {
130 streamHandler = null; 130 streamHandler = null;
131 return false; 131 return false;
132 } 132 }
133 else 133 else
134 { 134 {
135 streamHandler = m_streamHandlers[bestMatch]; 135 streamHandler = m_streamHandlers[bestMatch];
136 return true; 136 return true;
137 } 137 }
138 } 138 }
139 139
140 private void HandleXmlRpcRequests(HttpListenerRequest request, HttpListenerResponse response) 140 private void HandleXmlRpcRequests(HttpListenerRequest request, HttpListenerResponse response)
141 { 141 {
142 Stream requestStream = request.InputStream; 142 Stream requestStream = request.InputStream;
143 143
144 Encoding encoding = Encoding.UTF8; 144 Encoding encoding = Encoding.UTF8;
145 StreamReader reader = new StreamReader(requestStream, encoding); 145 StreamReader reader = new StreamReader(requestStream, encoding);
146 146
147 string requestBody = reader.ReadToEnd(); 147 string requestBody = reader.ReadToEnd();
148 reader.Close(); 148 reader.Close();
149 requestStream.Close(); 149 requestStream.Close();
150 150
151 XmlRpcRequest xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); 151 XmlRpcRequest xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
152 152
153 string methodName = xmlRprcRequest.MethodName; 153 string methodName = xmlRprcRequest.MethodName;
154 154
155 XmlRpcResponse xmlRpcResponse; 155 XmlRpcResponse xmlRpcResponse;
156 156
157 XmlRpcMethod method; 157 XmlRpcMethod method;
158 if (this.m_rpcHandlers.TryGetValue(methodName, out method)) 158 if (this.m_rpcHandlers.TryGetValue(methodName, out method))
159 { 159 {
160 xmlRpcResponse = method(xmlRprcRequest); 160 xmlRpcResponse = method(xmlRprcRequest);
161 } 161 }
162 else 162 else
163 { 163 {
164 xmlRpcResponse = new XmlRpcResponse(); 164 xmlRpcResponse = new XmlRpcResponse();
165 Hashtable unknownMethodError = new Hashtable(); 165 Hashtable unknownMethodError = new Hashtable();
166 unknownMethodError["reason"] = "XmlRequest"; ; 166 unknownMethodError["reason"] = "XmlRequest"; ;
167 unknownMethodError["message"] = "Unknown Rpc Request ["+methodName+"]"; 167 unknownMethodError["message"] = "Unknown Rpc Request ["+methodName+"]";
168 unknownMethodError["login"] = "false"; 168 unknownMethodError["login"] = "false";
169 xmlRpcResponse.Value = unknownMethodError; 169 xmlRpcResponse.Value = unknownMethodError;
170 } 170 }
171 171
172 response.AddHeader("Content-type", "text/xml"); 172 response.AddHeader("Content-type", "text/xml");
173 173
174 string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); 174 string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
175 175
176 byte[] buffer = Encoding.UTF8.GetBytes(responseString); 176 byte[] buffer = Encoding.UTF8.GetBytes(responseString);
177 177
178 response.SendChunked = false; 178 response.SendChunked = false;
179 response.ContentLength64 = buffer.Length; 179 response.ContentLength64 = buffer.Length;
180 response.ContentEncoding = Encoding.UTF8; 180 response.ContentEncoding = Encoding.UTF8;
181 181
182 response.OutputStream.Write(buffer, 0, buffer.Length); 182 response.OutputStream.Write(buffer, 0, buffer.Length);
183 response.OutputStream.Close(); 183 response.OutputStream.Close();
184 } 184 }
185 185
186 public void Start() 186 public void Start()
187 { 187 {
188 MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server"); 188 MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server");
189 189
190 m_workerThread = new Thread(new ThreadStart(StartHTTP)); 190 m_workerThread = new Thread(new ThreadStart(StartHTTP));
191 m_workerThread.IsBackground = true; 191 m_workerThread.IsBackground = true;
192 m_workerThread.Start(); 192 m_workerThread.Start();
193 } 193 }
194 194
195 private void StartHTTP() 195 private void StartHTTP()
196 { 196 {
197 try 197 try
198 { 198 {
199 MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK"); 199 MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK");
200 m_httpListener = new HttpListener(); 200 m_httpListener = new HttpListener();
201 201
202 m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); 202 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
203 m_httpListener.Start(); 203 m_httpListener.Start();
204 204
205 HttpListenerContext context; 205 HttpListenerContext context;
206 while (true) 206 while (true)
207 { 207 {
208 context = m_httpListener.GetContext(); 208 context = m_httpListener.GetContext();
209 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); 209 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
210 } 210 }
211 } 211 }
212 catch (Exception e) 212 catch (Exception e)
213 { 213 {
214 MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message); 214 MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message);
215 } 215 }
216 } 216 }
217 217
218 218
219 public void RemoveStreamHandler(string httpMethod, string path) 219 public void RemoveStreamHandler(string httpMethod, string path)
220 { 220 {
221 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); 221 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path));
222 } 222 }
223 } 223 }
224} 224}
diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs
index 0d9c674..0c714e6 100644
--- a/OpenSim/Framework/Servers/BaseStreamHandler.cs
+++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5 5
6namespace OpenSim.Framework.Servers 6namespace OpenSim.Framework.Servers
7{ 7{
8 public abstract class BaseStreamHandler : IStreamHandler 8 public abstract class BaseStreamHandler : IStreamHandler
9 { 9 {
10 virtual public string ContentType 10 virtual public string ContentType
11 { 11 {
12 get { return "application/xml"; } 12 get { return "application/xml"; }
13 } 13 }
14 14
15 private string m_httpMethod; 15 private string m_httpMethod;
16 virtual public string HttpMethod 16 virtual public string HttpMethod
17 { 17 {
18 get { return m_httpMethod; } 18 get { return m_httpMethod; }
19 } 19 }
20 20
21 private string m_path; 21 private string m_path;
22 virtual public string Path 22 virtual public string Path
23 { 23 {
24 get { return m_path; } 24 get { return m_path; }
25 } 25 }
26 26
27 protected string GetParam( string path ) 27 protected string GetParam( string path )
28 { 28 {
29 return path.Substring( m_path.Length ); 29 return path.Substring( m_path.Length );
30 } 30 }
31 31
32 public abstract byte[] Handle(string path, Stream request); 32 public abstract byte[] Handle(string path, Stream request);
33 33
34 protected BaseStreamHandler(string httpMethod, string path) 34 protected BaseStreamHandler(string httpMethod, string path)
35 { 35 {
36 m_httpMethod = httpMethod; 36 m_httpMethod = httpMethod;
37 m_path = path; 37 m_path = path;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
index 7d4e4ce..6e512f6 100644
--- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs
+++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
@@ -1,49 +1,49 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5 5
6namespace OpenSim.Framework.Servers 6namespace OpenSim.Framework.Servers
7{ 7{
8 public delegate string BinaryMethod(byte[] data, string path, string param); 8 public delegate string BinaryMethod(byte[] data, string path, string param);
9 9
10 public class BinaryStreamHandler : BaseStreamHandler 10 public class BinaryStreamHandler : BaseStreamHandler
11 { 11 {
12 BinaryMethod m_method; 12 BinaryMethod m_method;
13 13
14 override public byte[] Handle(string path, Stream request) 14 override public byte[] Handle(string path, Stream request)
15 { 15 {
16 byte[] data = ReadFully(request); 16 byte[] data = ReadFully(request);
17 string param = GetParam(path); 17 string param = GetParam(path);
18 string responseString = m_method(data, path, param); 18 string responseString = m_method(data, path, param);
19 19
20 return Encoding.UTF8.GetBytes(responseString); 20 return Encoding.UTF8.GetBytes(responseString);
21 } 21 }
22 22
23 public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) 23 public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod)
24 : base(httpMethod, path) 24 : base(httpMethod, path)
25 { 25 {
26 m_method = binaryMethod; 26 m_method = binaryMethod;
27 } 27 }
28 28
29 private byte[] ReadFully(Stream stream) 29 private byte[] ReadFully(Stream stream)
30 { 30 {
31 byte[] buffer = new byte[32768]; 31 byte[] buffer = new byte[32768];
32 using (MemoryStream ms = new MemoryStream()) 32 using (MemoryStream ms = new MemoryStream())
33 { 33 {
34 while (true) 34 while (true)
35 { 35 {
36 int read = stream.Read(buffer, 0, buffer.Length); 36 int read = stream.Read(buffer, 0, buffer.Length);
37 37
38 if (read <= 0) 38 if (read <= 0)
39 { 39 {
40 return ms.ToArray(); 40 return ms.ToArray();
41 } 41 }
42 42
43 ms.Write(buffer, 0, read); 43 ms.Write(buffer, 0, read);
44 } 44 }
45 } 45 }
46 } 46 }
47 } 47 }
48 48
49} 49}
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs
index 89ec095..b1fa5cd 100644
--- a/OpenSim/Framework/Servers/CheckSumServer.cs
+++ b/OpenSim/Framework/Servers/CheckSumServer.cs
@@ -1,127 +1,127 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{/* 29{/*
30 public class CheckSumServer : UDPServerBase 30 public class CheckSumServer : UDPServerBase
31 { 31 {
32 //protected ConsoleBase m_log; 32 //protected ConsoleBase m_log;
33 33
34 public CheckSumServer(int port) 34 public CheckSumServer(int port)
35 : base(port) 35 : base(port)
36 { 36 {
37 } 37 }
38 38
39 protected override void OnReceivedData(IAsyncResult result) 39 protected override void OnReceivedData(IAsyncResult result)
40 { 40 {
41 ipeSender = new IPEndPoint(IPAddress.Any, 0); 41 ipeSender = new IPEndPoint(IPAddress.Any, 0);
42 epSender = (EndPoint)ipeSender; 42 epSender = (EndPoint)ipeSender;
43 Packet packet = null; 43 Packet packet = null;
44 int numBytes = Server.EndReceiveFrom(result, ref epSender); 44 int numBytes = Server.EndReceiveFrom(result, ref epSender);
45 int packetEnd = numBytes - 1; 45 int packetEnd = numBytes - 1;
46 46
47 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); 47 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
48 48
49 if (packet.Type == PacketType.SecuredTemplateChecksumRequest) 49 if (packet.Type == PacketType.SecuredTemplateChecksumRequest)
50 { 50 {
51 SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet; 51 SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet;
52 TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket(); 52 TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket();
53 checkreply.DataBlock.Checksum = 3220703154;//180572585; 53 checkreply.DataBlock.Checksum = 3220703154;//180572585;
54 checkreply.DataBlock.Flags = 0; 54 checkreply.DataBlock.Flags = 0;
55 checkreply.DataBlock.MajorVersion = 1; 55 checkreply.DataBlock.MajorVersion = 1;
56 checkreply.DataBlock.MinorVersion = 15; 56 checkreply.DataBlock.MinorVersion = 15;
57 checkreply.DataBlock.PatchVersion = 0; 57 checkreply.DataBlock.PatchVersion = 0;
58 checkreply.DataBlock.ServerVersion = 0; 58 checkreply.DataBlock.ServerVersion = 0;
59 checkreply.TokenBlock.Token = checksum.TokenBlock.Token; 59 checkreply.TokenBlock.Token = checksum.TokenBlock.Token;
60 this.SendPacket(checkreply, epSender); 60 this.SendPacket(checkreply, epSender);
61 61
62 /* 62 /*
63 //if we wanted to echo the the checksum/ version from the client (so that any client worked) 63 //if we wanted to echo the the checksum/ version from the client (so that any client worked)
64 SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket(); 64 SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket();
65 checkrequest.TokenBlock.Token = checksum.TokenBlock.Token; 65 checkrequest.TokenBlock.Token = checksum.TokenBlock.Token;
66 this.SendPacket(checkrequest, epSender); 66 this.SendPacket(checkrequest, epSender);
67 67
68 } 68 }
69 else if (packet.Type == PacketType.TemplateChecksumReply) 69 else if (packet.Type == PacketType.TemplateChecksumReply)
70 { 70 {
71 //echo back the client checksum reply (Hegemon's method) 71 //echo back the client checksum reply (Hegemon's method)
72 TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet; 72 TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet;
73 TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket(); 73 TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket();
74 checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum; 74 checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum;
75 checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags; 75 checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags;
76 checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion; 76 checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion;
77 checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion; 77 checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion;
78 checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion; 78 checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion;
79 checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion; 79 checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion;
80 checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token; 80 checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token;
81 this.SendPacket(checkreply2, epSender); 81 this.SendPacket(checkreply2, epSender);
82 } 82 }
83 else 83 else
84 { 84 {
85 } 85 }
86 86
87 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 87 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
88 } 88 }
89 89
90 private void SendPacket(Packet Pack, EndPoint endp) 90 private void SendPacket(Packet Pack, EndPoint endp)
91 { 91 {
92 if (!Pack.Header.Resent) 92 if (!Pack.Header.Resent)
93 { 93 {
94 Pack.Header.Sequence = 1; 94 Pack.Header.Sequence = 1;
95 } 95 }
96 96
97 byte[] ZeroOutBuffer = new byte[4096]; 97 byte[] ZeroOutBuffer = new byte[4096];
98 byte[] sendbuffer; 98 byte[] sendbuffer;
99 sendbuffer = Pack.ToBytes(); 99 sendbuffer = Pack.ToBytes();
100 100
101 try 101 try
102 { 102 {
103 if (Pack.Header.Zerocoded) 103 if (Pack.Header.Zerocoded)
104 { 104 {
105 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 105 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
106 this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp); 106 this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp);
107 } 107 }
108 else 108 else
109 { 109 {
110 this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp); 110 this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp);
111 } 111 }
112 } 112 }
113 catch (Exception) 113 catch (Exception)
114 { 114 {
115 OpenSim.Framework.Console.MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection "); 115 OpenSim.Framework.Console.MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection ");
116 116
117 } 117 }
118 } 118 }
119 119
120 private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp) 120 private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp)
121 { 121 {
122 this.Server.SendTo(buffer, size, flags, endp); 122 this.Server.SendTo(buffer, size, flags, endp);
123 } 123 }
124 * } 124 * }
125 */ 125 */
126 126
127} \ No newline at end of file 127} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs
index 6cab40d..8858c99 100644
--- a/OpenSim/Framework/Servers/IStreamHandler.cs
+++ b/OpenSim/Framework/Servers/IStreamHandler.cs
@@ -1,22 +1,22 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5 5
6namespace OpenSim.Framework.Servers 6namespace OpenSim.Framework.Servers
7{ 7{
8 public interface IStreamHandler 8 public interface IStreamHandler
9 { 9 {
10 // Handle request stream, return byte array 10 // Handle request stream, return byte array
11 byte[] Handle(string path, Stream request ); 11 byte[] Handle(string path, Stream request );
12 12
13 // Return response content type 13 // Return response content type
14 string ContentType { get; } 14 string ContentType { get; }
15 15
16 // Return required http method 16 // Return required http method
17 string HttpMethod { get;} 17 string HttpMethod { get;}
18 18
19 // Return path 19 // Return path
20 string Path { get; } 20 string Path { get; }
21 } 21 }
22} 22}
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index c6cb230..0c2624b 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -1,31 +1,31 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod( string request, string path, string param ); 30 public delegate string RestMethod( string request, string path, string param );
31} 31}
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs
index 1b3b41c..6753a06 100644
--- a/OpenSim/Framework/Servers/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/RestStreamHandler.cs
@@ -1,31 +1,31 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5 5
6namespace OpenSim.Framework.Servers 6namespace OpenSim.Framework.Servers
7{ 7{
8 public class RestStreamHandler : BaseStreamHandler 8 public class RestStreamHandler : BaseStreamHandler
9 { 9 {
10 RestMethod m_restMethod; 10 RestMethod m_restMethod;
11 11
12 override public byte[] Handle(string path, Stream request ) 12 override public byte[] Handle(string path, Stream request )
13 { 13 {
14 Encoding encoding = Encoding.UTF8; 14 Encoding encoding = Encoding.UTF8;
15 StreamReader streamReader = new StreamReader(request, encoding); 15 StreamReader streamReader = new StreamReader(request, encoding);
16 16
17 string requestBody = streamReader.ReadToEnd(); 17 string requestBody = streamReader.ReadToEnd();
18 streamReader.Close(); 18 streamReader.Close();
19 19
20 string param = GetParam(path); 20 string param = GetParam(path);
21 string responseString = m_restMethod(requestBody, path, param ); 21 string responseString = m_restMethod(requestBody, path, param );
22 22
23 return Encoding.UTF8.GetBytes(responseString); 23 return Encoding.UTF8.GetBytes(responseString);
24 } 24 }
25 25
26 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path ) 26 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path )
27 { 27 {
28 m_restMethod = restMethod; 28 m_restMethod = restMethod;
29 } 29 }
30 } 30 }
31} 31}
diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs
index 508eb9d..8113207 100644
--- a/OpenSim/Framework/Servers/UDPServerBase.cs
+++ b/OpenSim/Framework/Servers/UDPServerBase.cs
@@ -1,87 +1,87 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Net; 29using System.Net;
30using System.Net.Sockets; 30using System.Net.Sockets;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32 32
33namespace OpenSim.Framework.Servers 33namespace OpenSim.Framework.Servers
34{ 34{
35 public class UDPServerBase 35 public class UDPServerBase
36 { 36 {
37 public Socket Server; 37 public Socket Server;
38 protected IPEndPoint ServerIncoming; 38 protected IPEndPoint ServerIncoming;
39 protected byte[] RecvBuffer = new byte[4096]; 39 protected byte[] RecvBuffer = new byte[4096];
40 protected byte[] ZeroBuffer = new byte[8192]; 40 protected byte[] ZeroBuffer = new byte[8192];
41 protected IPEndPoint ipeSender; 41 protected IPEndPoint ipeSender;
42 protected EndPoint epSender; 42 protected EndPoint epSender;
43 protected AsyncCallback ReceivedData; 43 protected AsyncCallback ReceivedData;
44 protected int listenPort; 44 protected int listenPort;
45 45
46 public UDPServerBase(int port) 46 public UDPServerBase(int port)
47 { 47 {
48 listenPort = port; 48 listenPort = port;
49 } 49 }
50 50
51 protected virtual void OnReceivedData(IAsyncResult result) 51 protected virtual void OnReceivedData(IAsyncResult result)
52 { 52 {
53 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 53 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
54 epSender = (EndPoint)ipeSender; 54 epSender = (EndPoint)ipeSender;
55 Packet packet = null; 55 Packet packet = null;
56 int numBytes = Server.EndReceiveFrom(result, ref epSender); 56 int numBytes = Server.EndReceiveFrom(result, ref epSender);
57 int packetEnd = numBytes - 1; 57 int packetEnd = numBytes - 1;
58 58
59 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); 59 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
60 60
61 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 61 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
62 } 62 }
63 63
64 protected virtual void AddNewClient(Packet packet) 64 protected virtual void AddNewClient(Packet packet)
65 { 65 {
66 } 66 }
67 67
68 public virtual void ServerListener() 68 public virtual void ServerListener()
69 { 69 {
70 70
71 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); 71 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort);
72 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 72 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
73 Server.Bind(ServerIncoming); 73 Server.Bind(ServerIncoming);
74 74
75 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 75 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
76 epSender = (EndPoint)ipeSender; 76 epSender = (EndPoint)ipeSender;
77 ReceivedData = new AsyncCallback(this.OnReceivedData); 77 ReceivedData = new AsyncCallback(this.OnReceivedData);
78 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 78 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
79 } 79 }
80 80
81 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 81 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
82 { 82 {
83 83
84 } 84 }
85 } 85 }
86} 86}
87 87
diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs
index b76ac51..b8abecf 100644
--- a/OpenSim/Framework/Servers/XmlRpcMethod.cs
+++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs
@@ -1,33 +1,33 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Nwc.XmlRpc; 28using Nwc.XmlRpc;
29 29
30namespace OpenSim.Framework.Servers 30namespace OpenSim.Framework.Servers
31{ 31{
32 public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request ); 32 public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request );
33} 33}
diff --git a/OpenSim/Framework/UserManager/LoginResponse.cs b/OpenSim/Framework/UserManager/LoginResponse.cs
index abcbd48..d3dfd5b 100644
--- a/OpenSim/Framework/UserManager/LoginResponse.cs
+++ b/OpenSim/Framework/UserManager/LoginResponse.cs
@@ -1,643 +1,643 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using libsecondlife; 3using libsecondlife;
4using Nwc.XmlRpc; 4using Nwc.XmlRpc;
5using OpenSim.Framework.Console; 5using OpenSim.Framework.Console;
6 6
7namespace OpenSim.Framework.UserManagement 7namespace OpenSim.Framework.UserManagement
8{ 8{
9 9
10 /// <summary> 10 /// <summary>
11 /// A temp class to handle login response. 11 /// A temp class to handle login response.
12 /// Should make use of UserProfileManager where possible. 12 /// Should make use of UserProfileManager where possible.
13 /// </summary> 13 /// </summary>
14 14
15 public class LoginResponse 15 public class LoginResponse
16 { 16 {
17 private Hashtable loginFlagsHash; 17 private Hashtable loginFlagsHash;
18 private Hashtable globalTexturesHash; 18 private Hashtable globalTexturesHash;
19 private Hashtable loginError; 19 private Hashtable loginError;
20 private Hashtable eventCategoriesHash; 20 private Hashtable eventCategoriesHash;
21 private Hashtable uiConfigHash; 21 private Hashtable uiConfigHash;
22 private Hashtable classifiedCategoriesHash; 22 private Hashtable classifiedCategoriesHash;
23 23
24 private ArrayList loginFlags; 24 private ArrayList loginFlags;
25 private ArrayList globalTextures; 25 private ArrayList globalTextures;
26 private ArrayList eventCategories; 26 private ArrayList eventCategories;
27 private ArrayList uiConfig; 27 private ArrayList uiConfig;
28 private ArrayList classifiedCategories; 28 private ArrayList classifiedCategories;
29 private ArrayList inventoryRoot; 29 private ArrayList inventoryRoot;
30 private ArrayList initialOutfit; 30 private ArrayList initialOutfit;
31 private ArrayList agentInventory; 31 private ArrayList agentInventory;
32 32
33 private UserInfo userProfile; 33 private UserInfo userProfile;
34 34
35 private LLUUID agentID; 35 private LLUUID agentID;
36 private LLUUID sessionID; 36 private LLUUID sessionID;
37 private LLUUID secureSessionID; 37 private LLUUID secureSessionID;
38 38
39 // Login Flags 39 // Login Flags
40 private string dst; 40 private string dst;
41 private string stipendSinceLogin; 41 private string stipendSinceLogin;
42 private string gendered; 42 private string gendered;
43 private string everLoggedIn; 43 private string everLoggedIn;
44 private string login; 44 private string login;
45 private int simPort; 45 private int simPort;
46 private string simAddress; 46 private string simAddress;
47 private string agentAccess; 47 private string agentAccess;
48 private Int32 circuitCode; 48 private Int32 circuitCode;
49 private uint regionX; 49 private uint regionX;
50 private uint regionY; 50 private uint regionY;
51 51
52 // Login 52 // Login
53 private string firstname; 53 private string firstname;
54 private string lastname; 54 private string lastname;
55 55
56 // Global Textures 56 // Global Textures
57 private string sunTexture; 57 private string sunTexture;
58 private string cloudTexture; 58 private string cloudTexture;
59 private string moonTexture; 59 private string moonTexture;
60 60
61 // Error Flags 61 // Error Flags
62 private string errorReason; 62 private string errorReason;
63 private string errorMessage; 63 private string errorMessage;
64 64
65 // Response 65 // Response
66 private XmlRpcResponse xmlRpcResponse; 66 private XmlRpcResponse xmlRpcResponse;
67 private XmlRpcResponse defaultXmlRpcResponse; 67 private XmlRpcResponse defaultXmlRpcResponse;
68 68
69 private string welcomeMessage; 69 private string welcomeMessage;
70 private string startLocation; 70 private string startLocation;
71 private string allowFirstLife; 71 private string allowFirstLife;
72 private string home; 72 private string home;
73 private string seedCapability; 73 private string seedCapability;
74 private string lookAt; 74 private string lookAt;
75 75
76 public LoginResponse() 76 public LoginResponse()
77 { 77 {
78 this.loginFlags = new ArrayList(); 78 this.loginFlags = new ArrayList();
79 this.globalTextures = new ArrayList(); 79 this.globalTextures = new ArrayList();
80 this.eventCategories = new ArrayList(); 80 this.eventCategories = new ArrayList();
81 this.uiConfig = new ArrayList(); 81 this.uiConfig = new ArrayList();
82 this.classifiedCategories = new ArrayList(); 82 this.classifiedCategories = new ArrayList();
83 83
84 this.loginError = new Hashtable(); 84 this.loginError = new Hashtable();
85 this.eventCategoriesHash = new Hashtable(); 85 this.eventCategoriesHash = new Hashtable();
86 this.classifiedCategoriesHash = new Hashtable(); 86 this.classifiedCategoriesHash = new Hashtable();
87 this.uiConfigHash = new Hashtable(); 87 this.uiConfigHash = new Hashtable();
88 88
89 this.defaultXmlRpcResponse = new XmlRpcResponse(); 89 this.defaultXmlRpcResponse = new XmlRpcResponse();
90 this.userProfile = new UserInfo(); 90 this.userProfile = new UserInfo();
91 this.inventoryRoot = new ArrayList(); 91 this.inventoryRoot = new ArrayList();
92 this.initialOutfit = new ArrayList(); 92 this.initialOutfit = new ArrayList();
93 this.agentInventory = new ArrayList(); 93 this.agentInventory = new ArrayList();
94 94
95 this.xmlRpcResponse = new XmlRpcResponse(); 95 this.xmlRpcResponse = new XmlRpcResponse();
96 this.defaultXmlRpcResponse = new XmlRpcResponse(); 96 this.defaultXmlRpcResponse = new XmlRpcResponse();
97 97
98 this.SetDefaultValues(); 98 this.SetDefaultValues();
99 } // LoginServer 99 } // LoginServer
100 100
101 public void SetDefaultValues() 101 public void SetDefaultValues()
102 { 102 {
103 this.DST = "N"; 103 this.DST = "N";
104 this.StipendSinceLogin = "N"; 104 this.StipendSinceLogin = "N";
105 this.Gendered = "Y"; 105 this.Gendered = "Y";
106 this.EverLoggedIn = "Y"; 106 this.EverLoggedIn = "Y";
107 this.login = "false"; 107 this.login = "false";
108 this.firstname = "Test"; 108 this.firstname = "Test";
109 this.lastname = "User"; 109 this.lastname = "User";
110 this.agentAccess = "M"; 110 this.agentAccess = "M";
111 this.startLocation = "last"; 111 this.startLocation = "last";
112 this.allowFirstLife = "Y"; 112 this.allowFirstLife = "Y";
113 113
114 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; 114 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
115 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 115 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
116 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 116 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
117 117
118 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; 118 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
119 this.ErrorReason = "key"; 119 this.ErrorReason = "key";
120 this.welcomeMessage = "Welcome to OpenSim!"; 120 this.welcomeMessage = "Welcome to OpenSim!";
121 this.seedCapability = ""; 121 this.seedCapability = "";
122 this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; 122 this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}";
123 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; 123 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
124 this.RegionX = (uint)255232; 124 this.RegionX = (uint)255232;
125 this.RegionY = (uint)254976; 125 this.RegionY = (uint)254976;
126 126
127 // Classifieds; 127 // Classifieds;
128 this.AddClassifiedCategory((Int32)1, "Shopping"); 128 this.AddClassifiedCategory((Int32)1, "Shopping");
129 this.AddClassifiedCategory((Int32)2, "Land Rental"); 129 this.AddClassifiedCategory((Int32)2, "Land Rental");
130 this.AddClassifiedCategory((Int32)3, "Property Rental"); 130 this.AddClassifiedCategory((Int32)3, "Property Rental");
131 this.AddClassifiedCategory((Int32)4, "Special Attraction"); 131 this.AddClassifiedCategory((Int32)4, "Special Attraction");
132 this.AddClassifiedCategory((Int32)5, "New Products"); 132 this.AddClassifiedCategory((Int32)5, "New Products");
133 this.AddClassifiedCategory((Int32)6, "Employment"); 133 this.AddClassifiedCategory((Int32)6, "Employment");
134 this.AddClassifiedCategory((Int32)7, "Wanted"); 134 this.AddClassifiedCategory((Int32)7, "Wanted");
135 this.AddClassifiedCategory((Int32)8, "Service"); 135 this.AddClassifiedCategory((Int32)8, "Service");
136 this.AddClassifiedCategory((Int32)9, "Personal"); 136 this.AddClassifiedCategory((Int32)9, "Personal");
137 137
138 138
139 this.SessionID = LLUUID.Random(); 139 this.SessionID = LLUUID.Random();
140 this.SecureSessionID = LLUUID.Random(); 140 this.SecureSessionID = LLUUID.Random();
141 this.AgentID = LLUUID.Random(); 141 this.AgentID = LLUUID.Random();
142 142
143 Hashtable InitialOutfitHash = new Hashtable(); 143 Hashtable InitialOutfitHash = new Hashtable();
144 InitialOutfitHash["folder_name"] = "Nightclub Female"; 144 InitialOutfitHash["folder_name"] = "Nightclub Female";
145 InitialOutfitHash["gender"] = "female"; 145 InitialOutfitHash["gender"] = "female";
146 this.initialOutfit.Add(InitialOutfitHash); 146 this.initialOutfit.Add(InitialOutfitHash);
147 147
148 148
149 } // SetDefaultValues 149 } // SetDefaultValues
150 150
151 #region Login Failure Methods 151 #region Login Failure Methods
152 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) 152 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
153 { 153 {
154 // Overwrite any default values; 154 // Overwrite any default values;
155 this.xmlRpcResponse = new XmlRpcResponse(); 155 this.xmlRpcResponse = new XmlRpcResponse();
156 156
157 // Ensure Login Failed message/reason; 157 // Ensure Login Failed message/reason;
158 this.ErrorMessage = message; 158 this.ErrorMessage = message;
159 this.ErrorReason = reason; 159 this.ErrorReason = reason;
160 160
161 this.loginError["reason"] = this.ErrorReason; 161 this.loginError["reason"] = this.ErrorReason;
162 this.loginError["message"] = this.ErrorMessage; 162 this.loginError["message"] = this.ErrorMessage;
163 this.loginError["login"] = login; 163 this.loginError["login"] = login;
164 this.xmlRpcResponse.Value = this.loginError; 164 this.xmlRpcResponse.Value = this.loginError;
165 return (this.xmlRpcResponse); 165 return (this.xmlRpcResponse);
166 } // GenerateResponse 166 } // GenerateResponse
167 167
168 public XmlRpcResponse CreateFailedResponse() 168 public XmlRpcResponse CreateFailedResponse()
169 { 169 {
170 return (this.CreateLoginFailedResponse()); 170 return (this.CreateLoginFailedResponse());
171 } // CreateErrorConnectingToGridResponse() 171 } // CreateErrorConnectingToGridResponse()
172 172
173 public XmlRpcResponse CreateLoginFailedResponse() 173 public XmlRpcResponse CreateLoginFailedResponse()
174 { 174 {
175 return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); 175 return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false"));
176 } // LoginFailedResponse 176 } // LoginFailedResponse
177 177
178 public XmlRpcResponse CreateAlreadyLoggedInResponse() 178 public XmlRpcResponse CreateAlreadyLoggedInResponse()
179 { 179 {
180 return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); 180 return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false"));
181 } // CreateAlreadyLoggedInResponse() 181 } // CreateAlreadyLoggedInResponse()
182 182
183 public XmlRpcResponse CreateDeadRegionResponse() 183 public XmlRpcResponse CreateDeadRegionResponse()
184 { 184 {
185 return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); 185 return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false"));
186 } 186 }
187 187
188 public XmlRpcResponse CreateGridErrorResponse() 188 public XmlRpcResponse CreateGridErrorResponse()
189 { 189 {
190 return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); 190 return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false"));
191 } 191 }
192 192
193 #endregion 193 #endregion
194 194
195 public XmlRpcResponse ToXmlRpcResponse() 195 public XmlRpcResponse ToXmlRpcResponse()
196 { 196 {
197 try 197 try
198 { 198 {
199 199
200 Hashtable responseData = new Hashtable(); 200 Hashtable responseData = new Hashtable();
201 201
202 this.loginFlagsHash = new Hashtable(); 202 this.loginFlagsHash = new Hashtable();
203 this.loginFlagsHash["daylight_savings"] = this.DST; 203 this.loginFlagsHash["daylight_savings"] = this.DST;
204 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; 204 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
205 this.loginFlagsHash["gendered"] = this.Gendered; 205 this.loginFlagsHash["gendered"] = this.Gendered;
206 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; 206 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
207 this.loginFlags.Add(this.loginFlagsHash); 207 this.loginFlags.Add(this.loginFlagsHash);
208 208
209 responseData["first_name"] = this.Firstname; 209 responseData["first_name"] = this.Firstname;
210 responseData["last_name"] = this.Lastname; 210 responseData["last_name"] = this.Lastname;
211 responseData["agent_access"] = this.agentAccess; 211 responseData["agent_access"] = this.agentAccess;
212 212
213 this.globalTexturesHash = new Hashtable(); 213 this.globalTexturesHash = new Hashtable();
214 this.globalTexturesHash["sun_texture_id"] = this.SunTexture; 214 this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
215 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; 215 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
216 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; 216 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
217 this.globalTextures.Add(this.globalTexturesHash); 217 this.globalTextures.Add(this.globalTexturesHash);
218 this.eventCategories.Add(this.eventCategoriesHash); 218 this.eventCategories.Add(this.eventCategoriesHash);
219 219
220 this.AddToUIConfig("allow_first_life", this.allowFirstLife); 220 this.AddToUIConfig("allow_first_life", this.allowFirstLife);
221 this.uiConfig.Add(this.uiConfigHash); 221 this.uiConfig.Add(this.uiConfigHash);
222 222
223 responseData["sim_port"] =(Int32) this.SimPort; 223 responseData["sim_port"] =(Int32) this.SimPort;
224 responseData["sim_ip"] = this.SimAddress; 224 responseData["sim_ip"] = this.SimAddress;
225 225
226 MainLog.Instance.Warn("SIM IP: " + responseData["sim_ip"] + "; SIM PORT: " + responseData["sim_port"]); 226 MainLog.Instance.Warn("SIM IP: " + responseData["sim_ip"] + "; SIM PORT: " + responseData["sim_port"]);
227 227
228 responseData["agent_id"] = this.AgentID.ToStringHyphenated(); 228 responseData["agent_id"] = this.AgentID.ToStringHyphenated();
229 responseData["session_id"] = this.SessionID.ToStringHyphenated(); 229 responseData["session_id"] = this.SessionID.ToStringHyphenated();
230 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); 230 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
231 responseData["circuit_code"] = this.CircuitCode; 231 responseData["circuit_code"] = this.CircuitCode;
232 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 232 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
233 responseData["login-flags"] = this.loginFlags; 233 responseData["login-flags"] = this.loginFlags;
234 responseData["global-textures"] = this.globalTextures; 234 responseData["global-textures"] = this.globalTextures;
235 responseData["seed_capability"] = this.seedCapability; 235 responseData["seed_capability"] = this.seedCapability;
236 236
237 responseData["event_categories"] = this.eventCategories; 237 responseData["event_categories"] = this.eventCategories;
238 responseData["event_notifications"] = new ArrayList(); // todo 238 responseData["event_notifications"] = new ArrayList(); // todo
239 responseData["classified_categories"] = this.classifiedCategories; 239 responseData["classified_categories"] = this.classifiedCategories;
240 responseData["ui-config"] = this.uiConfig; 240 responseData["ui-config"] = this.uiConfig;
241 241
242 responseData["inventory-skeleton"] = this.agentInventory; 242 responseData["inventory-skeleton"] = this.agentInventory;
243 responseData["inventory-skel-lib"] = new ArrayList(); // todo 243 responseData["inventory-skel-lib"] = new ArrayList(); // todo
244 responseData["inventory-root"] = this.inventoryRoot; 244 responseData["inventory-root"] = this.inventoryRoot;
245 responseData["gestures"] = new ArrayList(); // todo 245 responseData["gestures"] = new ArrayList(); // todo
246 responseData["inventory-lib-owner"] = new ArrayList(); // todo 246 responseData["inventory-lib-owner"] = new ArrayList(); // todo
247 responseData["initial-outfit"] = this.initialOutfit; 247 responseData["initial-outfit"] = this.initialOutfit;
248 responseData["start_location"] = this.startLocation; 248 responseData["start_location"] = this.startLocation;
249 responseData["seed_capability"] = this.seedCapability; 249 responseData["seed_capability"] = this.seedCapability;
250 responseData["home"] = this.home; 250 responseData["home"] = this.home;
251 responseData["look_at"] = this.lookAt; 251 responseData["look_at"] = this.lookAt;
252 responseData["message"] = this.welcomeMessage; 252 responseData["message"] = this.welcomeMessage;
253 responseData["region_x"] = (Int32)this.RegionX * 256; 253 responseData["region_x"] = (Int32)this.RegionX * 256;
254 responseData["region_y"] = (Int32)this.RegionY * 256; 254 responseData["region_y"] = (Int32)this.RegionY * 256;
255 255
256 //responseData["inventory-lib-root"] = new ArrayList(); // todo 256 //responseData["inventory-lib-root"] = new ArrayList(); // todo
257 //responseData["buddy-list"] = new ArrayList(); // todo 257 //responseData["buddy-list"] = new ArrayList(); // todo
258 258
259 responseData["login"] = "true"; 259 responseData["login"] = "true";
260 this.xmlRpcResponse.Value = responseData; 260 this.xmlRpcResponse.Value = responseData;
261 261
262 return (this.xmlRpcResponse); 262 return (this.xmlRpcResponse);
263 } 263 }
264 catch (Exception e) 264 catch (Exception e)
265 { 265 {
266 MainLog.Instance.WriteLine( 266 MainLog.Instance.WriteLine(
267 LogPriority.LOW, 267 LogPriority.LOW,
268 "LoginResponse: Error creating XML-RPC Response: " + e.Message 268 "LoginResponse: Error creating XML-RPC Response: " + e.Message
269 ); 269 );
270 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); 270 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
271 271
272 } 272 }
273 273
274 } // ToXmlRpcResponse 274 } // ToXmlRpcResponse
275 275
276 public void SetEventCategories(string category, string value) 276 public void SetEventCategories(string category, string value)
277 { 277 {
278 this.eventCategoriesHash[category] = value; 278 this.eventCategoriesHash[category] = value;
279 } // SetEventCategories 279 } // SetEventCategories
280 280
281 public void AddToUIConfig(string itemName, string item) 281 public void AddToUIConfig(string itemName, string item)
282 { 282 {
283 this.uiConfigHash[itemName] = item; 283 this.uiConfigHash[itemName] = item;
284 } // SetUIConfig 284 } // SetUIConfig
285 285
286 public void AddClassifiedCategory(Int32 ID, string categoryName) 286 public void AddClassifiedCategory(Int32 ID, string categoryName)
287 { 287 {
288 this.classifiedCategoriesHash["category_name"] = categoryName; 288 this.classifiedCategoriesHash["category_name"] = categoryName;
289 this.classifiedCategoriesHash["category_id"] = ID; 289 this.classifiedCategoriesHash["category_id"] = ID;
290 this.classifiedCategories.Add(this.classifiedCategoriesHash); 290 this.classifiedCategories.Add(this.classifiedCategoriesHash);
291 // this.classifiedCategoriesHash.Clear(); 291 // this.classifiedCategoriesHash.Clear();
292 } // SetClassifiedCategory 292 } // SetClassifiedCategory
293 293
294 #region Properties 294 #region Properties
295 public string Login 295 public string Login
296 { 296 {
297 get 297 get
298 { 298 {
299 return this.login; 299 return this.login;
300 } 300 }
301 set 301 set
302 { 302 {
303 this.login = value; 303 this.login = value;
304 } 304 }
305 } // Login 305 } // Login
306 306
307 public string DST 307 public string DST
308 { 308 {
309 get 309 get
310 { 310 {
311 return this.dst; 311 return this.dst;
312 } 312 }
313 set 313 set
314 { 314 {
315 this.dst = value; 315 this.dst = value;
316 } 316 }
317 } // DST 317 } // DST
318 318
319 public string StipendSinceLogin 319 public string StipendSinceLogin
320 { 320 {
321 get 321 get
322 { 322 {
323 return this.stipendSinceLogin; 323 return this.stipendSinceLogin;
324 } 324 }
325 set 325 set
326 { 326 {
327 this.stipendSinceLogin = value; 327 this.stipendSinceLogin = value;
328 } 328 }
329 } // StipendSinceLogin 329 } // StipendSinceLogin
330 330
331 public string Gendered 331 public string Gendered
332 { 332 {
333 get 333 get
334 { 334 {
335 return this.gendered; 335 return this.gendered;
336 } 336 }
337 set 337 set
338 { 338 {
339 this.gendered = value; 339 this.gendered = value;
340 } 340 }
341 } // Gendered 341 } // Gendered
342 342
343 public string EverLoggedIn 343 public string EverLoggedIn
344 { 344 {
345 get 345 get
346 { 346 {
347 return this.everLoggedIn; 347 return this.everLoggedIn;
348 } 348 }
349 set 349 set
350 { 350 {
351 this.everLoggedIn = value; 351 this.everLoggedIn = value;
352 } 352 }
353 } // EverLoggedIn 353 } // EverLoggedIn
354 354
355 public int SimPort 355 public int SimPort
356 { 356 {
357 get 357 get
358 { 358 {
359 return this.simPort; 359 return this.simPort;
360 } 360 }
361 set 361 set
362 { 362 {
363 this.simPort = value; 363 this.simPort = value;
364 } 364 }
365 } // SimPort 365 } // SimPort
366 366
367 public string SimAddress 367 public string SimAddress
368 { 368 {
369 get 369 get
370 { 370 {
371 return this.simAddress; 371 return this.simAddress;
372 } 372 }
373 set 373 set
374 { 374 {
375 this.simAddress = value; 375 this.simAddress = value;
376 } 376 }
377 } // SimAddress 377 } // SimAddress
378 378
379 public LLUUID AgentID 379 public LLUUID AgentID
380 { 380 {
381 get 381 get
382 { 382 {
383 return this.agentID; 383 return this.agentID;
384 } 384 }
385 set 385 set
386 { 386 {
387 this.agentID = value; 387 this.agentID = value;
388 } 388 }
389 } // AgentID 389 } // AgentID
390 390
391 public LLUUID SessionID 391 public LLUUID SessionID
392 { 392 {
393 get 393 get
394 { 394 {
395 return this.sessionID; 395 return this.sessionID;
396 } 396 }
397 set 397 set
398 { 398 {
399 this.sessionID = value; 399 this.sessionID = value;
400 } 400 }
401 } // SessionID 401 } // SessionID
402 402
403 public LLUUID SecureSessionID 403 public LLUUID SecureSessionID
404 { 404 {
405 get 405 get
406 { 406 {
407 return this.secureSessionID; 407 return this.secureSessionID;
408 } 408 }
409 set 409 set
410 { 410 {
411 this.secureSessionID = value; 411 this.secureSessionID = value;
412 } 412 }
413 } // SecureSessionID 413 } // SecureSessionID
414 414
415 public Int32 CircuitCode 415 public Int32 CircuitCode
416 { 416 {
417 get 417 get
418 { 418 {
419 return this.circuitCode; 419 return this.circuitCode;
420 } 420 }
421 set 421 set
422 { 422 {
423 this.circuitCode = value; 423 this.circuitCode = value;
424 } 424 }
425 } // CircuitCode 425 } // CircuitCode
426 426
427 public uint RegionX 427 public uint RegionX
428 { 428 {
429 get 429 get
430 { 430 {
431 return this.regionX; 431 return this.regionX;
432 } 432 }
433 set 433 set
434 { 434 {
435 this.regionX = value; 435 this.regionX = value;
436 } 436 }
437 } // RegionX 437 } // RegionX
438 438
439 public uint RegionY 439 public uint RegionY
440 { 440 {
441 get 441 get
442 { 442 {
443 return this.regionY; 443 return this.regionY;
444 } 444 }
445 set 445 set
446 { 446 {
447 this.regionY = value; 447 this.regionY = value;
448 } 448 }
449 } // RegionY 449 } // RegionY
450 450
451 public string SunTexture 451 public string SunTexture
452 { 452 {
453 get 453 get
454 { 454 {
455 return this.sunTexture; 455 return this.sunTexture;
456 } 456 }
457 set 457 set
458 { 458 {
459 this.sunTexture = value; 459 this.sunTexture = value;
460 } 460 }
461 } // SunTexture 461 } // SunTexture
462 462
463 public string CloudTexture 463 public string CloudTexture
464 { 464 {
465 get 465 get
466 { 466 {
467 return this.cloudTexture; 467 return this.cloudTexture;
468 } 468 }
469 set 469 set
470 { 470 {
471 this.cloudTexture = value; 471 this.cloudTexture = value;
472 } 472 }
473 } // CloudTexture 473 } // CloudTexture
474 474
475 public string MoonTexture 475 public string MoonTexture
476 { 476 {
477 get 477 get
478 { 478 {
479 return this.moonTexture; 479 return this.moonTexture;
480 } 480 }
481 set 481 set
482 { 482 {
483 this.moonTexture = value; 483 this.moonTexture = value;
484 } 484 }
485 } // MoonTexture 485 } // MoonTexture
486 486
487 public string Firstname 487 public string Firstname
488 { 488 {
489 get 489 get
490 { 490 {
491 return this.firstname; 491 return this.firstname;
492 } 492 }
493 set 493 set
494 { 494 {
495 this.firstname = value; 495 this.firstname = value;
496 } 496 }
497 } // Firstname 497 } // Firstname
498 498
499 public string Lastname 499 public string Lastname
500 { 500 {
501 get 501 get
502 { 502 {
503 return this.lastname; 503 return this.lastname;
504 } 504 }
505 set 505 set
506 { 506 {
507 this.lastname = value; 507 this.lastname = value;
508 } 508 }
509 } // Lastname 509 } // Lastname
510 510
511 public string AgentAccess 511 public string AgentAccess
512 { 512 {
513 get 513 get
514 { 514 {
515 return this.agentAccess; 515 return this.agentAccess;
516 } 516 }
517 set 517 set
518 { 518 {
519 this.agentAccess = value; 519 this.agentAccess = value;
520 } 520 }
521 } 521 }
522 522
523 public string StartLocation 523 public string StartLocation
524 { 524 {
525 get 525 get
526 { 526 {
527 return this.startLocation; 527 return this.startLocation;
528 } 528 }
529 set 529 set
530 { 530 {
531 this.startLocation = value; 531 this.startLocation = value;
532 } 532 }
533 } // StartLocation 533 } // StartLocation
534 534
535 public string LookAt 535 public string LookAt
536 { 536 {
537 get 537 get
538 { 538 {
539 return this.lookAt; 539 return this.lookAt;
540 } 540 }
541 set 541 set
542 { 542 {
543 this.lookAt = value; 543 this.lookAt = value;
544 } 544 }
545 } 545 }
546 546
547 public string SeedCapability 547 public string SeedCapability
548 { 548 {
549 get 549 get
550 { 550 {
551 return this.seedCapability; 551 return this.seedCapability;
552 } 552 }
553 set 553 set
554 { 554 {
555 this.seedCapability = value; 555 this.seedCapability = value;
556 } 556 }
557 } // SeedCapability 557 } // SeedCapability
558 558
559 public string ErrorReason 559 public string ErrorReason
560 { 560 {
561 get 561 get
562 { 562 {
563 return this.errorReason; 563 return this.errorReason;
564 } 564 }
565 set 565 set
566 { 566 {
567 this.errorReason = value; 567 this.errorReason = value;
568 } 568 }
569 } // ErrorReason 569 } // ErrorReason
570 570
571 public string ErrorMessage 571 public string ErrorMessage
572 { 572 {
573 get 573 get
574 { 574 {
575 return this.errorMessage; 575 return this.errorMessage;
576 } 576 }
577 set 577 set
578 { 578 {
579 this.errorMessage = value; 579 this.errorMessage = value;
580 } 580 }
581 } // ErrorMessage 581 } // ErrorMessage
582 582
583 public ArrayList InventoryRoot 583 public ArrayList InventoryRoot
584 { 584 {
585 get 585 get
586 { 586 {
587 return this.inventoryRoot; 587 return this.inventoryRoot;
588 } 588 }
589 set 589 set
590 { 590 {
591 this.inventoryRoot = value; 591 this.inventoryRoot = value;
592 } 592 }
593 } 593 }
594 594
595 public ArrayList InventorySkeleton 595 public ArrayList InventorySkeleton
596 { 596 {
597 get 597 get
598 { 598 {
599 return this.agentInventory; 599 return this.agentInventory;
600 } 600 }
601 set 601 set
602 { 602 {
603 this.agentInventory = value; 603 this.agentInventory = value;
604 } 604 }
605 } 605 }
606 606
607 public string Home 607 public string Home
608 { 608 {
609 get 609 get
610 { 610 {
611 return this.home; 611 return this.home;
612 } 612 }
613 set 613 set
614 { 614 {
615 this.home = value; 615 this.home = value;
616 } 616 }
617 } 617 }
618 618
619 public string Message 619 public string Message
620 { 620 {
621 get 621 get
622 { 622 {
623 return this.welcomeMessage; 623 return this.welcomeMessage;
624 } 624 }
625 set 625 set
626 { 626 {
627 this.welcomeMessage = value; 627 this.welcomeMessage = value;
628 } 628 }
629 } 629 }
630 #endregion 630 #endregion
631 631
632 632
633 public class UserInfo 633 public class UserInfo
634 { 634 {
635 public string firstname; 635 public string firstname;
636 public string lastname; 636 public string lastname;
637 public ulong homeregionhandle; 637 public ulong homeregionhandle;
638 public LLVector3 homepos; 638 public LLVector3 homepos;
639 public LLVector3 homelookat; 639 public LLVector3 homelookat;
640 } 640 }
641 } 641 }
642} 642}
643 643
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs
index 4e688f7..fe45d1b 100644
--- a/OpenSim/Framework/UserManager/UserManagerBase.cs
+++ b/OpenSim/Framework/UserManager/UserManagerBase.cs
@@ -1,631 +1,631 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Security.Cryptography; 32using System.Security.Cryptography;
33using libsecondlife; 33using libsecondlife;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Inventory; 38using OpenSim.Framework.Inventory;
39using OpenSim.Framework.Utilities; 39using OpenSim.Framework.Utilities;
40 40
41namespace OpenSim.Framework.UserManagement 41namespace OpenSim.Framework.UserManagement
42{ 42{
43 public abstract class UserManagerBase 43 public abstract class UserManagerBase
44 { 44 {
45 public UserConfig _config; 45 public UserConfig _config;
46 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); 46 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
47 47
48 /// <summary> 48 /// <summary>
49 /// Adds a new user server plugin - user servers will be requested in the order they were loaded. 49 /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
50 /// </summary> 50 /// </summary>
51 /// <param name="FileName">The filename to the user server plugin DLL</param> 51 /// <param name="FileName">The filename to the user server plugin DLL</param>
52 public void AddPlugin(string FileName) 52 public void AddPlugin(string FileName)
53 { 53 {
54 MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName); 54 MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName);
55 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 55 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
56 56
57 MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 57 MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
58 foreach (Type pluginType in pluginAssembly.GetTypes()) 58 foreach (Type pluginType in pluginAssembly.GetTypes())
59 { 59 {
60 if (!pluginType.IsAbstract) 60 if (!pluginType.IsAbstract)
61 { 61 {
62 Type typeInterface = pluginType.GetInterface("IUserData", true); 62 Type typeInterface = pluginType.GetInterface("IUserData", true);
63 63
64 if (typeInterface != null) 64 if (typeInterface != null)
65 { 65 {
66 IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 66 IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
67 plug.Initialise(); 67 plug.Initialise();
68 this._plugins.Add(plug.getName(), plug); 68 this._plugins.Add(plug.getName(), plug);
69 MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); 69 MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface");
70 } 70 }
71 71
72 typeInterface = null; 72 typeInterface = null;
73 } 73 }
74 } 74 }
75 75
76 pluginAssembly = null; 76 pluginAssembly = null;
77 } 77 }
78 78
79 #region Get UserProfile 79 #region Get UserProfile
80 /// <summary> 80 /// <summary>
81 /// Loads a user profile from a database by UUID 81 /// Loads a user profile from a database by UUID
82 /// </summary> 82 /// </summary>
83 /// <param name="uuid">The target UUID</param> 83 /// <param name="uuid">The target UUID</param>
84 /// <returns>A user profile</returns> 84 /// <returns>A user profile</returns>
85 public UserProfileData getUserProfile(LLUUID uuid) 85 public UserProfileData getUserProfile(LLUUID uuid)
86 { 86 {
87 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 87 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
88 { 88 {
89 try 89 try
90 { 90 {
91 UserProfileData profile = plugin.Value.getUserByUUID(uuid); 91 UserProfileData profile = plugin.Value.getUserByUUID(uuid);
92 profile.currentAgent = getUserAgent(profile.UUID); 92 profile.currentAgent = getUserAgent(profile.UUID);
93 return profile; 93 return profile;
94 } 94 }
95 catch (Exception e) 95 catch (Exception e)
96 { 96 {
97 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 97 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
98 } 98 }
99 } 99 }
100 100
101 return null; 101 return null;
102 } 102 }
103 103
104 104
105 /// <summary> 105 /// <summary>
106 /// Loads a user profile by name 106 /// Loads a user profile by name
107 /// </summary> 107 /// </summary>
108 /// <param name="name">The target name</param> 108 /// <param name="name">The target name</param>
109 /// <returns>A user profile</returns> 109 /// <returns>A user profile</returns>
110 public UserProfileData getUserProfile(string name) 110 public UserProfileData getUserProfile(string name)
111 { 111 {
112 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 112 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
113 { 113 {
114 try 114 try
115 { 115 {
116 UserProfileData profile = plugin.Value.getUserByName(name); 116 UserProfileData profile = plugin.Value.getUserByName(name);
117 profile.currentAgent = getUserAgent(profile.UUID); 117 profile.currentAgent = getUserAgent(profile.UUID);
118 return profile; 118 return profile;
119 } 119 }
120 catch (Exception e) 120 catch (Exception e)
121 { 121 {
122 System.Console.WriteLine("EEK!"); 122 System.Console.WriteLine("EEK!");
123 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 123 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
124 } 124 }
125 } 125 }
126 126
127 return null; 127 return null;
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
131 /// Loads a user profile by name 131 /// Loads a user profile by name
132 /// </summary> 132 /// </summary>
133 /// <param name="fname">First name</param> 133 /// <param name="fname">First name</param>
134 /// <param name="lname">Last name</param> 134 /// <param name="lname">Last name</param>
135 /// <returns>A user profile</returns> 135 /// <returns>A user profile</returns>
136 public UserProfileData getUserProfile(string fname, string lname) 136 public UserProfileData getUserProfile(string fname, string lname)
137 { 137 {
138 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 138 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
139 { 139 {
140 try 140 try
141 { 141 {
142 UserProfileData profile = plugin.Value.getUserByName(fname,lname); 142 UserProfileData profile = plugin.Value.getUserByName(fname,lname);
143 143
144 profile.currentAgent = getUserAgent(profile.UUID); 144 profile.currentAgent = getUserAgent(profile.UUID);
145 145
146 return profile; 146 return profile;
147 } 147 }
148 catch (Exception e) 148 catch (Exception e)
149 { 149 {
150 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 150 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
151 } 151 }
152 } 152 }
153 153
154 return null; 154 return null;
155 } 155 }
156 #endregion 156 #endregion
157 157
158 #region Get UserAgent 158 #region Get UserAgent
159 /// <summary> 159 /// <summary>
160 /// Loads a user agent by uuid (not called directly) 160 /// Loads a user agent by uuid (not called directly)
161 /// </summary> 161 /// </summary>
162 /// <param name="uuid">The agents UUID</param> 162 /// <param name="uuid">The agents UUID</param>
163 /// <returns>Agent profiles</returns> 163 /// <returns>Agent profiles</returns>
164 public UserAgentData getUserAgent(LLUUID uuid) 164 public UserAgentData getUserAgent(LLUUID uuid)
165 { 165 {
166 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 166 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
167 { 167 {
168 try 168 try
169 { 169 {
170 return plugin.Value.getAgentByUUID(uuid); 170 return plugin.Value.getAgentByUUID(uuid);
171 } 171 }
172 catch (Exception e) 172 catch (Exception e)
173 { 173 {
174 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 174 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
175 } 175 }
176 } 176 }
177 177
178 return null; 178 return null;
179 } 179 }
180 180
181 /// <summary> 181 /// <summary>
182 /// Loads a user agent by name (not called directly) 182 /// Loads a user agent by name (not called directly)
183 /// </summary> 183 /// </summary>
184 /// <param name="name">The agents name</param> 184 /// <param name="name">The agents name</param>
185 /// <returns>A user agent</returns> 185 /// <returns>A user agent</returns>
186 public UserAgentData getUserAgent(string name) 186 public UserAgentData getUserAgent(string name)
187 { 187 {
188 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 188 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
189 { 189 {
190 try 190 try
191 { 191 {
192 return plugin.Value.getAgentByName(name); 192 return plugin.Value.getAgentByName(name);
193 } 193 }
194 catch (Exception e) 194 catch (Exception e)
195 { 195 {
196 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 196 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
197 } 197 }
198 } 198 }
199 199
200 return null; 200 return null;
201 } 201 }
202 202
203 /// <summary> 203 /// <summary>
204 /// Loads a user agent by name (not called directly) 204 /// Loads a user agent by name (not called directly)
205 /// </summary> 205 /// </summary>
206 /// <param name="fname">The agents firstname</param> 206 /// <param name="fname">The agents firstname</param>
207 /// <param name="lname">The agents lastname</param> 207 /// <param name="lname">The agents lastname</param>
208 /// <returns>A user agent</returns> 208 /// <returns>A user agent</returns>
209 public UserAgentData getUserAgent(string fname, string lname) 209 public UserAgentData getUserAgent(string fname, string lname)
210 { 210 {
211 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 211 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
212 { 212 {
213 try 213 try
214 { 214 {
215 return plugin.Value.getAgentByName(fname,lname); 215 return plugin.Value.getAgentByName(fname,lname);
216 } 216 }
217 catch (Exception e) 217 catch (Exception e)
218 { 218 {
219 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 219 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
220 } 220 }
221 } 221 }
222 222
223 return null; 223 return null;
224 } 224 }
225 225
226 #endregion 226 #endregion
227 227
228 #region CreateAgent 228 #region CreateAgent
229 /// <summary> 229 /// <summary>
230 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB 230 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
231 /// </summary> 231 /// </summary>
232 /// <param name="profile">The users profile</param> 232 /// <param name="profile">The users profile</param>
233 /// <param name="request">The users loginrequest</param> 233 /// <param name="request">The users loginrequest</param>
234 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 234 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
235 { 235 {
236 Hashtable requestData = (Hashtable)request.Params[0]; 236 Hashtable requestData = (Hashtable)request.Params[0];
237 237
238 UserAgentData agent = new UserAgentData(); 238 UserAgentData agent = new UserAgentData();
239 239
240 // User connection 240 // User connection
241 agent.agentOnline = true; 241 agent.agentOnline = true;
242 242
243 // Generate sessions 243 // Generate sessions
244 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); 244 RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
245 byte[] randDataS = new byte[16]; 245 byte[] randDataS = new byte[16];
246 byte[] randDataSS = new byte[16]; 246 byte[] randDataSS = new byte[16];
247 rand.GetBytes(randDataS); 247 rand.GetBytes(randDataS);
248 rand.GetBytes(randDataSS); 248 rand.GetBytes(randDataSS);
249 249
250 agent.secureSessionID = new LLUUID(randDataSS, 0); 250 agent.secureSessionID = new LLUUID(randDataSS, 0);
251 agent.sessionID = new LLUUID(randDataS, 0); 251 agent.sessionID = new LLUUID(randDataS, 0);
252 252
253 // Profile UUID 253 // Profile UUID
254 agent.UUID = profile.UUID; 254 agent.UUID = profile.UUID;
255 255
256 // Current position (from Home) 256 // Current position (from Home)
257 agent.currentHandle = profile.homeRegion; 257 agent.currentHandle = profile.homeRegion;
258 agent.currentPos = profile.homeLocation; 258 agent.currentPos = profile.homeLocation;
259 259
260 // If user specified additional start, use that 260 // If user specified additional start, use that
261 if (requestData.ContainsKey("start")) 261 if (requestData.ContainsKey("start"))
262 { 262 {
263 string startLoc = ((string)requestData["start"]).Trim(); 263 string startLoc = ((string)requestData["start"]).Trim();
264 if (!(startLoc == "last" || startLoc == "home")) 264 if (!(startLoc == "last" || startLoc == "home"))
265 { 265 {
266 // Format: uri:Ahern&162&213&34 266 // Format: uri:Ahern&162&213&34
267 try 267 try
268 { 268 {
269 string[] parts = startLoc.Remove(0, 4).Split('&'); 269 string[] parts = startLoc.Remove(0, 4).Split('&');
270 string region = parts[0]; 270 string region = parts[0];
271 271
272 //////////////////////////////////////////////////// 272 ////////////////////////////////////////////////////
273 //SimProfile SimInfo = new SimProfile(); 273 //SimProfile SimInfo = new SimProfile();
274 //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); 274 //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
275 } 275 }
276 catch (Exception) 276 catch (Exception)
277 { 277 {
278 278
279 } 279 }
280 } 280 }
281 } 281 }
282 282
283 // What time did the user login? 283 // What time did the user login?
284 agent.loginTime = Util.UnixTimeSinceEpoch(); 284 agent.loginTime = Util.UnixTimeSinceEpoch();
285 agent.logoutTime = 0; 285 agent.logoutTime = 0;
286 286
287 // Current location 287 // Current location
288 agent.regionID = new LLUUID(); // Fill in later 288 agent.regionID = new LLUUID(); // Fill in later
289 agent.currentRegion = new LLUUID(); // Fill in later 289 agent.currentRegion = new LLUUID(); // Fill in later
290 290
291 profile.currentAgent = agent; 291 profile.currentAgent = agent;
292 } 292 }
293 293
294 /// <summary> 294 /// <summary>
295 /// Saves a target agent to the database 295 /// Saves a target agent to the database
296 /// </summary> 296 /// </summary>
297 /// <param name="profile">The users profile</param> 297 /// <param name="profile">The users profile</param>
298 /// <returns>Successful?</returns> 298 /// <returns>Successful?</returns>
299 public bool CommitAgent(ref UserProfileData profile) 299 public bool CommitAgent(ref UserProfileData profile)
300 { 300 {
301 // Saves the agent to database 301 // Saves the agent to database
302 return true; 302 return true;
303 } 303 }
304 304
305 #endregion 305 #endregion
306 306
307 /// <summary> 307 /// <summary>
308 /// Checks a user against it's password hash 308 /// Checks a user against it's password hash
309 /// </summary> 309 /// </summary>
310 /// <param name="profile">The users profile</param> 310 /// <param name="profile">The users profile</param>
311 /// <param name="password">The supplied password</param> 311 /// <param name="password">The supplied password</param>
312 /// <returns>Authenticated?</returns> 312 /// <returns>Authenticated?</returns>
313 public virtual bool AuthenticateUser(UserProfileData profile, string password) 313 public virtual bool AuthenticateUser(UserProfileData profile, string password)
314 { 314 {
315 MainLog.Instance.Verbose( 315 MainLog.Instance.Verbose(
316 "Authenticating " + profile.username + " " + profile.surname); 316 "Authenticating " + profile.username + " " + profile.surname);
317 317
318 password = password.Remove(0, 3); //remove $1$ 318 password = password.Remove(0, 3); //remove $1$
319 319
320 string s = Util.Md5Hash(password + ":" + profile.passwordSalt); 320 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
321 321
322 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 322 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
323 } 323 }
324 324
325 #region Xml Response 325 #region Xml Response
326 326
327 /// <summary> 327 /// <summary>
328 /// 328 ///
329 /// </summary> 329 /// </summary>
330 /// <param name="firstname"></param> 330 /// <param name="firstname"></param>
331 /// <param name="lastname"></param> 331 /// <param name="lastname"></param>
332 /// <returns></returns> 332 /// <returns></returns>
333 public virtual UserProfileData GetTheUser(string firstname, string lastname) 333 public virtual UserProfileData GetTheUser(string firstname, string lastname)
334 { 334 {
335 return getUserProfile(firstname, lastname); 335 return getUserProfile(firstname, lastname);
336 } 336 }
337 337
338 /// <summary> 338 /// <summary>
339 /// 339 ///
340 /// </summary> 340 /// </summary>
341 /// <returns></returns> 341 /// <returns></returns>
342 public virtual string GetMessage() 342 public virtual string GetMessage()
343 { 343 {
344 return _config.DefaultStartupMsg; 344 return _config.DefaultStartupMsg;
345 } 345 }
346 346
347 /// <summary> 347 /// <summary>
348 /// Customises the login response and fills in missing values. 348 /// Customises the login response and fills in missing values.
349 /// </summary> 349 /// </summary>
350 /// <param name="response">The existing response</param> 350 /// <param name="response">The existing response</param>
351 /// <param name="theUser">The user profile</param> 351 /// <param name="theUser">The user profile</param>
352 public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser); 352 public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser);
353 353
354 /// <summary> 354 /// <summary>
355 /// Main user login function 355 /// Main user login function
356 /// </summary> 356 /// </summary>
357 /// <param name="request">The XMLRPC request</param> 357 /// <param name="request">The XMLRPC request</param>
358 /// <returns>The response to send</returns> 358 /// <returns>The response to send</returns>
359 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 359 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
360 { 360 {
361 361
362 System.Console.WriteLine("Attempting login now..."); 362 System.Console.WriteLine("Attempting login now...");
363 XmlRpcResponse response = new XmlRpcResponse(); 363 XmlRpcResponse response = new XmlRpcResponse();
364 Hashtable requestData = (Hashtable)request.Params[0]; 364 Hashtable requestData = (Hashtable)request.Params[0];
365 365
366 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); 366 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
367 bool GoodLogin = false; 367 bool GoodLogin = false;
368 string firstname = ""; 368 string firstname = "";
369 string lastname = ""; 369 string lastname = "";
370 string passwd = ""; 370 string passwd = "";
371 371
372 UserProfileData userProfile; 372 UserProfileData userProfile;
373 LoginResponse logResponse = new LoginResponse(); 373 LoginResponse logResponse = new LoginResponse();
374 374
375 if (GoodXML) 375 if (GoodXML)
376 { 376 {
377 firstname = (string)requestData["first"]; 377 firstname = (string)requestData["first"];
378 lastname = (string)requestData["last"]; 378 lastname = (string)requestData["last"];
379 passwd = (string)requestData["passwd"]; 379 passwd = (string)requestData["passwd"];
380 380
381 userProfile = GetTheUser(firstname, lastname); 381 userProfile = GetTheUser(firstname, lastname);
382 if (userProfile == null) 382 if (userProfile == null)
383 return logResponse.CreateLoginFailedResponse(); 383 return logResponse.CreateLoginFailedResponse();
384 384
385 GoodLogin = AuthenticateUser(userProfile, passwd); 385 GoodLogin = AuthenticateUser(userProfile, passwd);
386 } 386 }
387 else 387 else
388 { 388 {
389 return logResponse.CreateGridErrorResponse(); 389 return logResponse.CreateGridErrorResponse();
390 } 390 }
391 391
392 if (!GoodLogin) 392 if (!GoodLogin)
393 { 393 {
394 return logResponse.CreateLoginFailedResponse(); 394 return logResponse.CreateLoginFailedResponse();
395 } 395 }
396 else 396 else
397 { 397 {
398 // If we already have a session... 398 // If we already have a session...
399 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) 399 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
400 { 400 {
401 // Reject the login 401 // Reject the login
402 return logResponse.CreateAlreadyLoggedInResponse(); 402 return logResponse.CreateAlreadyLoggedInResponse();
403 } 403 }
404 // Otherwise... 404 // Otherwise...
405 // Create a new agent session 405 // Create a new agent session
406 CreateAgent( userProfile, request); 406 CreateAgent( userProfile, request);
407 407
408 try 408 try
409 { 409 {
410 410
411 LLUUID AgentID = userProfile.UUID; 411 LLUUID AgentID = userProfile.UUID;
412 412
413 // Inventory Library Section 413 // Inventory Library Section
414 ArrayList AgentInventoryArray = new ArrayList(); 414 ArrayList AgentInventoryArray = new ArrayList();
415 Hashtable TempHash; 415 Hashtable TempHash;
416 416
417 AgentInventory Library = new AgentInventory(); 417 AgentInventory Library = new AgentInventory();
418 Library.CreateRootFolder(AgentID, true); 418 Library.CreateRootFolder(AgentID, true);
419 419
420 foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) 420 foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values)
421 { 421 {
422 TempHash = new Hashtable(); 422 TempHash = new Hashtable();
423 TempHash["name"] = InvFolder.FolderName; 423 TempHash["name"] = InvFolder.FolderName;
424 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 424 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
425 TempHash["version"] = (Int32)InvFolder.Version; 425 TempHash["version"] = (Int32)InvFolder.Version;
426 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 426 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
427 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 427 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
428 AgentInventoryArray.Add(TempHash); 428 AgentInventoryArray.Add(TempHash);
429 } 429 }
430 430
431 Hashtable InventoryRootHash = new Hashtable(); 431 Hashtable InventoryRootHash = new Hashtable();
432 InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); 432 InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated();
433 ArrayList InventoryRoot = new ArrayList(); 433 ArrayList InventoryRoot = new ArrayList();
434 InventoryRoot.Add(InventoryRootHash); 434 InventoryRoot.Add(InventoryRootHash);
435 435
436 // Circuit Code 436 // Circuit Code
437 uint circode = (uint)(Util.RandomClass.Next()); 437 uint circode = (uint)(Util.RandomClass.Next());
438 438
439 logResponse.Lastname = userProfile.surname; 439 logResponse.Lastname = userProfile.surname;
440 logResponse.Firstname = userProfile.username; 440 logResponse.Firstname = userProfile.username;
441 logResponse.AgentID = AgentID.ToStringHyphenated(); 441 logResponse.AgentID = AgentID.ToStringHyphenated();
442 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); 442 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
443 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 443 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
444 logResponse.InventoryRoot = InventoryRoot; 444 logResponse.InventoryRoot = InventoryRoot;
445 logResponse.InventorySkeleton = AgentInventoryArray; 445 logResponse.InventorySkeleton = AgentInventoryArray;
446 logResponse.CircuitCode = (Int32)circode; 446 logResponse.CircuitCode = (Int32)circode;
447 //logResponse.RegionX = 0; //overwritten 447 //logResponse.RegionX = 0; //overwritten
448 //logResponse.RegionY = 0; //overwritten 448 //logResponse.RegionY = 0; //overwritten
449 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 449 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
450 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; 450 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
451 //logResponse.SimAddress = "127.0.0.1"; //overwritten 451 //logResponse.SimAddress = "127.0.0.1"; //overwritten
452 //logResponse.SimPort = 0; //overwritten 452 //logResponse.SimPort = 0; //overwritten
453 logResponse.Message = this.GetMessage(); 453 logResponse.Message = this.GetMessage();
454 454
455 try 455 try
456 { 456 {
457 this.CustomiseResponse( logResponse, userProfile); 457 this.CustomiseResponse( logResponse, userProfile);
458 } 458 }
459 catch (Exception e) 459 catch (Exception e)
460 { 460 {
461 System.Console.WriteLine(e.ToString()); 461 System.Console.WriteLine(e.ToString());
462 return logResponse.CreateDeadRegionResponse(); 462 return logResponse.CreateDeadRegionResponse();
463 //return logResponse.ToXmlRpcResponse(); 463 //return logResponse.ToXmlRpcResponse();
464 } 464 }
465 CommitAgent(ref userProfile); 465 CommitAgent(ref userProfile);
466 return logResponse.ToXmlRpcResponse(); 466 return logResponse.ToXmlRpcResponse();
467 467
468 } 468 }
469 469
470 catch (Exception E) 470 catch (Exception E)
471 { 471 {
472 System.Console.WriteLine(E.ToString()); 472 System.Console.WriteLine(E.ToString());
473 } 473 }
474 //} 474 //}
475 } 475 }
476 return response; 476 return response;
477 477
478 } 478 }
479 479
480 #endregion 480 #endregion
481 481
482 /// <summary> 482 /// <summary>
483 /// Deletes an active agent session 483 /// Deletes an active agent session
484 /// </summary> 484 /// </summary>
485 /// <param name="request">The request</param> 485 /// <param name="request">The request</param>
486 /// <param name="path">The path (eg /bork/narf/test)</param> 486 /// <param name="path">The path (eg /bork/narf/test)</param>
487 /// <param name="param">Parameters sent</param> 487 /// <param name="param">Parameters sent</param>
488 /// <returns>Success "OK" else error</returns> 488 /// <returns>Success "OK" else error</returns>
489 public string RestDeleteUserSessionMethod(string request, string path, string param) 489 public string RestDeleteUserSessionMethod(string request, string path, string param)
490 { 490 {
491 // TODO! Important! 491 // TODO! Important!
492 492
493 return "OK"; 493 return "OK";
494 } 494 }
495 495
496 /// <summary> 496 /// <summary>
497 /// 497 ///
498 /// </summary> 498 /// </summary>
499 /// <param name="user"></param> 499 /// <param name="user"></param>
500 public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) 500 public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
501 { 501 {
502 UserProfileData user = new UserProfileData(); 502 UserProfileData user = new UserProfileData();
503 user.homeLocation = new LLVector3(128, 128, 100); 503 user.homeLocation = new LLVector3(128, 128, 100);
504 user.UUID = LLUUID.Random(); 504 user.UUID = LLUUID.Random();
505 user.username = firstName; 505 user.username = firstName;
506 user.surname = lastName; 506 user.surname = lastName;
507 user.passwordHash = pass; 507 user.passwordHash = pass;
508 user.passwordSalt = ""; 508 user.passwordSalt = "";
509 user.created = Util.UnixTimeSinceEpoch(); 509 user.created = Util.UnixTimeSinceEpoch();
510 user.homeLookAt = new LLVector3(100, 100, 100); 510 user.homeLookAt = new LLVector3(100, 100, 100);
511 user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); 511 user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256));
512 512
513 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 513 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
514 { 514 {
515 try 515 try
516 { 516 {
517 plugin.Value.addNewUserProfile(user); 517 plugin.Value.addNewUserProfile(user);
518 518
519 } 519 }
520 catch (Exception e) 520 catch (Exception e)
521 { 521 {
522 MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); 522 MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")");
523 } 523 }
524 } 524 }
525 } 525 }
526 526
527 /// <summary> 527 /// <summary>
528 /// Returns an error message that the user could not be found in the database 528 /// Returns an error message that the user could not be found in the database
529 /// </summary> 529 /// </summary>
530 /// <returns>XML string consisting of a error element containing individual error(s)</returns> 530 /// <returns>XML string consisting of a error element containing individual error(s)</returns>
531 public XmlRpcResponse CreateUnknownUserErrorResponse() 531 public XmlRpcResponse CreateUnknownUserErrorResponse()
532 { 532 {
533 XmlRpcResponse response = new XmlRpcResponse(); 533 XmlRpcResponse response = new XmlRpcResponse();
534 Hashtable responseData = new Hashtable(); 534 Hashtable responseData = new Hashtable();
535 responseData["error_type"] = "unknown_user"; 535 responseData["error_type"] = "unknown_user";
536 responseData["error_desc"] = "The user requested is not in the database"; 536 responseData["error_desc"] = "The user requested is not in the database";
537 537
538 response.Value = responseData; 538 response.Value = responseData;
539 return response; 539 return response;
540 } 540 }
541 541
542 /// <summary> 542 /// <summary>
543 /// Converts a user profile to an XML element which can be returned 543 /// Converts a user profile to an XML element which can be returned
544 /// </summary> 544 /// </summary>
545 /// <param name="profile">The user profile</param> 545 /// <param name="profile">The user profile</param>
546 /// <returns>A string containing an XML Document of the user profile</returns> 546 /// <returns>A string containing an XML Document of the user profile</returns>
547 public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) 547 public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile)
548 { 548 {
549 XmlRpcResponse response = new XmlRpcResponse(); 549 XmlRpcResponse response = new XmlRpcResponse();
550 Hashtable responseData = new Hashtable(); 550 Hashtable responseData = new Hashtable();
551 551
552 // Account information 552 // Account information
553 responseData["firstname"] = profile.username; 553 responseData["firstname"] = profile.username;
554 responseData["lastname"] = profile.surname; 554 responseData["lastname"] = profile.surname;
555 responseData["uuid"] = profile.UUID.ToStringHyphenated(); 555 responseData["uuid"] = profile.UUID.ToStringHyphenated();
556 // Server Information 556 // Server Information
557 responseData["server_inventory"] = profile.userInventoryURI; 557 responseData["server_inventory"] = profile.userInventoryURI;
558 responseData["server_asset"] = profile.userAssetURI; 558 responseData["server_asset"] = profile.userAssetURI;
559 // Profile Information 559 // Profile Information
560 responseData["profile_about"] = profile.profileAboutText; 560 responseData["profile_about"] = profile.profileAboutText;
561 responseData["profile_firstlife_about"] = profile.profileFirstText; 561 responseData["profile_firstlife_about"] = profile.profileFirstText;
562 responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated(); 562 responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated();
563 responseData["profile_can_do"] = profile.profileCanDoMask.ToString(); 563 responseData["profile_can_do"] = profile.profileCanDoMask.ToString();
564 responseData["profile_want_do"] = profile.profileWantDoMask.ToString(); 564 responseData["profile_want_do"] = profile.profileWantDoMask.ToString();
565 responseData["profile_image"] = profile.profileImage.ToStringHyphenated(); 565 responseData["profile_image"] = profile.profileImage.ToStringHyphenated();
566 responseData["profile_created"] = profile.created.ToString(); 566 responseData["profile_created"] = profile.created.ToString();
567 responseData["profile_lastlogin"] = profile.lastLogin.ToString(); 567 responseData["profile_lastlogin"] = profile.lastLogin.ToString();
568 // Home region information 568 // Home region information
569 responseData["home_coordinates_x"] = profile.homeLocation.X.ToString(); 569 responseData["home_coordinates_x"] = profile.homeLocation.X.ToString();
570 responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString(); 570 responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString();
571 responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString(); 571 responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString();
572 572
573 responseData["home_region"] = profile.homeRegion.ToString(); 573 responseData["home_region"] = profile.homeRegion.ToString();
574 574
575 responseData["home_look_x"] = profile.homeLookAt.X.ToString(); 575 responseData["home_look_x"] = profile.homeLookAt.X.ToString();
576 responseData["home_look_y"] = profile.homeLookAt.Y.ToString(); 576 responseData["home_look_y"] = profile.homeLookAt.Y.ToString();
577 responseData["home_look_z"] = profile.homeLookAt.Z.ToString(); 577 responseData["home_look_z"] = profile.homeLookAt.Z.ToString();
578 response.Value = responseData; 578 response.Value = responseData;
579 579
580 return response; 580 return response;
581 } 581 }
582 582
583 #region XMLRPC User Methods 583 #region XMLRPC User Methods
584 //should most likely move out of here and into the grid's userserver sub class 584 //should most likely move out of here and into the grid's userserver sub class
585 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) 585 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
586 { 586 {
587 XmlRpcResponse response = new XmlRpcResponse(); 587 XmlRpcResponse response = new XmlRpcResponse();
588 Hashtable requestData = (Hashtable)request.Params[0]; 588 Hashtable requestData = (Hashtable)request.Params[0];
589 UserProfileData userProfile; 589 UserProfileData userProfile;
590 if (requestData.Contains("avatar_name")) 590 if (requestData.Contains("avatar_name"))
591 { 591 {
592 userProfile = getUserProfile((string)requestData["avatar_name"]); 592 userProfile = getUserProfile((string)requestData["avatar_name"]);
593 if (userProfile == null) 593 if (userProfile == null)
594 { 594 {
595 return CreateUnknownUserErrorResponse(); 595 return CreateUnknownUserErrorResponse();
596 } 596 }
597 } 597 }
598 else 598 else
599 { 599 {
600 return CreateUnknownUserErrorResponse(); 600 return CreateUnknownUserErrorResponse();
601 } 601 }
602 602
603 return ProfileToXmlRPCResponse(userProfile); 603 return ProfileToXmlRPCResponse(userProfile);
604 } 604 }
605 605
606 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) 606 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request)
607 { 607 {
608 XmlRpcResponse response = new XmlRpcResponse(); 608 XmlRpcResponse response = new XmlRpcResponse();
609 Hashtable requestData = (Hashtable)request.Params[0]; 609 Hashtable requestData = (Hashtable)request.Params[0];
610 UserProfileData userProfile; 610 UserProfileData userProfile;
611 System.Console.WriteLine("METHOD BY UUID CALLED"); 611 System.Console.WriteLine("METHOD BY UUID CALLED");
612 if (requestData.Contains("avatar_uuid")) 612 if (requestData.Contains("avatar_uuid"))
613 { 613 {
614 userProfile = getUserProfile((LLUUID)requestData["avatar_uuid"]); 614 userProfile = getUserProfile((LLUUID)requestData["avatar_uuid"]);
615 if (userProfile == null) 615 if (userProfile == null)
616 { 616 {
617 return CreateUnknownUserErrorResponse(); 617 return CreateUnknownUserErrorResponse();
618 } 618 }
619 } 619 }
620 else 620 else
621 { 621 {
622 return CreateUnknownUserErrorResponse(); 622 return CreateUnknownUserErrorResponse();
623 } 623 }
624 624
625 625
626 return ProfileToXmlRPCResponse(userProfile); 626 return ProfileToXmlRPCResponse(userProfile);
627 } 627 }
628 #endregion 628 #endregion
629 629
630 } 630 }
631} 631}
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 4126ff4..5093f4d 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -1,406 +1,406 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32using Db4objects.Db4o; 32using Db4objects.Db4o;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37 37
38namespace OpenSim.Grid.AssetServer 38namespace OpenSim.Grid.AssetServer
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// An asset server 41 /// An asset server
42 /// </summary> 42 /// </summary>
43 public class OpenAsset_Main : conscmd_callback 43 public class OpenAsset_Main : conscmd_callback
44 { 44 {
45 private IObjectContainer db; 45 private IObjectContainer db;
46 46
47 public static OpenAsset_Main assetserver; 47 public static OpenAsset_Main assetserver;
48 48
49 private LogBase m_console; 49 private LogBase m_console;
50 50
51 [STAThread] 51 [STAThread]
52 public static void Main(string[] args) 52 public static void Main(string[] args)
53 { 53 {
54 Console.WriteLine("Starting...\n"); 54 Console.WriteLine("Starting...\n");
55 55
56 assetserver = new OpenAsset_Main(); 56 assetserver = new OpenAsset_Main();
57 assetserver.Startup(); 57 assetserver.Startup();
58 58
59 assetserver.Work(); 59 assetserver.Work();
60 } 60 }
61 61
62 private void Work() 62 private void Work()
63 { 63 {
64 m_console.Notice("Enter help for a list of commands"); 64 m_console.Notice("Enter help for a list of commands");
65 65
66 while (true) 66 while (true)
67 { 67 {
68 m_console.MainLogPrompt(); 68 m_console.MainLogPrompt();
69 } 69 }
70 } 70 }
71 71
72 private OpenAsset_Main() 72 private OpenAsset_Main()
73 { 73 {
74 m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); 74 m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false);
75 MainLog.Instance = m_console; 75 MainLog.Instance = m_console;
76 } 76 }
77 77
78 public void Startup() 78 public void Startup()
79 { 79 {
80 m_console.Verbose("Main.cs:Startup() - Setting up asset DB"); 80 m_console.Verbose("Main.cs:Startup() - Setting up asset DB");
81 setupDB(); 81 setupDB();
82 82
83 m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); 83 m_console.Verbose("Main.cs:Startup() - Starting HTTP process");
84 BaseHttpServer httpServer = new BaseHttpServer(8003); 84 BaseHttpServer httpServer = new BaseHttpServer(8003);
85 85
86 httpServer.AddStreamHandler( new GetAssetStreamHandler(this)); 86 httpServer.AddStreamHandler( new GetAssetStreamHandler(this));
87 httpServer.AddStreamHandler(new PostAssetStreamHandler( this )); 87 httpServer.AddStreamHandler(new PostAssetStreamHandler( this ));
88 88
89 //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); 89 //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);
90 //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); 90 //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod);
91 91
92 httpServer.Start(); 92 httpServer.Start();
93 93
94 } 94 }
95 95
96 //public string AssetPostMethod(string requestBody, string path, string param) 96 //public string AssetPostMethod(string requestBody, string path, string param)
97 //{ 97 //{
98 // AssetBase asset = new AssetBase(); 98 // AssetBase asset = new AssetBase();
99 // asset.Name = ""; 99 // asset.Name = "";
100 // asset.FullID = new LLUUID(param); 100 // asset.FullID = new LLUUID(param);
101 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); 101 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
102 // byte[] buffer = Windows1252Encoding.GetBytes(requestBody); 102 // byte[] buffer = Windows1252Encoding.GetBytes(requestBody);
103 // asset.Data = buffer; 103 // asset.Data = buffer;
104 // AssetStorage store = new AssetStorage(); 104 // AssetStorage store = new AssetStorage();
105 // store.Data = asset.Data; 105 // store.Data = asset.Data;
106 // store.Name = asset.Name; 106 // store.Name = asset.Name;
107 // store.UUID = asset.FullID; 107 // store.UUID = asset.FullID;
108 // db.Set(store); 108 // db.Set(store);
109 // db.Commit(); 109 // db.Commit();
110 // return ""; 110 // return "";
111 //} 111 //}
112 112
113 //public string AssetGetMethod(string request, string path, string param) 113 //public string AssetGetMethod(string request, string path, string param)
114 //{ 114 //{
115 // Console.WriteLine("got a request " + param); 115 // Console.WriteLine("got a request " + param);
116 // byte[] assetdata = GetAssetData(new LLUUID(param), false); 116 // byte[] assetdata = GetAssetData(new LLUUID(param), false);
117 // if (assetdata != null) 117 // if (assetdata != null)
118 // { 118 // {
119 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); 119 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
120 // string ret = Windows1252Encoding.GetString(assetdata); 120 // string ret = Windows1252Encoding.GetString(assetdata);
121 // //string ret = System.Text.Encoding.Unicode.GetString(assetdata); 121 // //string ret = System.Text.Encoding.Unicode.GetString(assetdata);
122 122
123 // return ret; 123 // return ret;
124 124
125 // } 125 // }
126 // else 126 // else
127 // { 127 // {
128 // return ""; 128 // return "";
129 // } 129 // }
130 130
131 //} 131 //}
132 132
133 public byte[] GetAssetData(LLUUID assetID, bool isTexture) 133 public byte[] GetAssetData(LLUUID assetID, bool isTexture)
134 { 134 {
135 bool found = false; 135 bool found = false;
136 AssetStorage foundAsset = null; 136 AssetStorage foundAsset = null;
137 137
138 IObjectSet result = db.Get(new AssetStorage(assetID)); 138 IObjectSet result = db.Get(new AssetStorage(assetID));
139 if (result.Count > 0) 139 if (result.Count > 0)
140 { 140 {
141 foundAsset = (AssetStorage)result.Next(); 141 foundAsset = (AssetStorage)result.Next();
142 found = true; 142 found = true;
143 } 143 }
144 144
145 if (found) 145 if (found)
146 { 146 {
147 return foundAsset.Data; 147 return foundAsset.Data;
148 } 148 }
149 else 149 else
150 { 150 {
151 return null; 151 return null;
152 } 152 }
153 } 153 }
154 154
155 public void setupDB() 155 public void setupDB()
156 { 156 {
157 bool yapfile = File.Exists("gridassets.yap"); 157 bool yapfile = File.Exists("gridassets.yap");
158 try 158 try
159 { 159 {
160 db = Db4oFactory.OpenFile("gridassets.yap"); 160 db = Db4oFactory.OpenFile("gridassets.yap");
161 MainLog.Instance.Verbose("Main.cs:setupDB() - creation"); 161 MainLog.Instance.Verbose("Main.cs:setupDB() - creation");
162 } 162 }
163 catch (Exception e) 163 catch (Exception e)
164 { 164 {
165 db.Close(); 165 db.Close();
166 MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured"); 166 MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured");
167 MainLog.Instance.Warn(e.ToString()); 167 MainLog.Instance.Warn(e.ToString());
168 } 168 }
169 if (!yapfile) 169 if (!yapfile)
170 { 170 {
171 this.LoadDB(); 171 this.LoadDB();
172 } 172 }
173 } 173 }
174 174
175 public void LoadDB() 175 public void LoadDB()
176 { 176 {
177 try 177 try
178 { 178 {
179 179
180 Console.WriteLine("setting up Asset database"); 180 Console.WriteLine("setting up Asset database");
181 181
182 AssetBase Image = new AssetBase(); 182 AssetBase Image = new AssetBase();
183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); 183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
184 Image.Name = "Bricks"; 184 Image.Name = "Bricks";
185 this.LoadAsset(Image, true, "bricks.jp2"); 185 this.LoadAsset(Image, true, "bricks.jp2");
186 AssetStorage store = new AssetStorage(); 186 AssetStorage store = new AssetStorage();
187 store.Data = Image.Data; 187 store.Data = Image.Data;
188 store.Name = Image.Name; 188 store.Name = Image.Name;
189 store.UUID = Image.FullID; 189 store.UUID = Image.FullID;
190 db.Set(store); 190 db.Set(store);
191 db.Commit(); 191 db.Commit();
192 192
193 Image = new AssetBase(); 193 Image = new AssetBase();
194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); 194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
195 Image.Name = "Plywood"; 195 Image.Name = "Plywood";
196 this.LoadAsset(Image, true, "plywood.jp2"); 196 this.LoadAsset(Image, true, "plywood.jp2");
197 store = new AssetStorage(); 197 store = new AssetStorage();
198 store.Data = Image.Data; 198 store.Data = Image.Data;
199 store.Name = Image.Name; 199 store.Name = Image.Name;
200 store.UUID = Image.FullID; 200 store.UUID = Image.FullID;
201 db.Set(store); 201 db.Set(store);
202 db.Commit(); 202 db.Commit();
203 203
204 Image = new AssetBase(); 204 Image = new AssetBase();
205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); 205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
206 Image.Name = "Rocks"; 206 Image.Name = "Rocks";
207 this.LoadAsset(Image, true, "rocks.jp2"); 207 this.LoadAsset(Image, true, "rocks.jp2");
208 store = new AssetStorage(); 208 store = new AssetStorage();
209 store.Data = Image.Data; 209 store.Data = Image.Data;
210 store.Name = Image.Name; 210 store.Name = Image.Name;
211 store.UUID = Image.FullID; 211 store.UUID = Image.FullID;
212 db.Set(store); 212 db.Set(store);
213 db.Commit(); 213 db.Commit();
214 214
215 Image = new AssetBase(); 215 Image = new AssetBase();
216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); 216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
217 Image.Name = "Granite"; 217 Image.Name = "Granite";
218 this.LoadAsset(Image, true, "granite.jp2"); 218 this.LoadAsset(Image, true, "granite.jp2");
219 store = new AssetStorage(); 219 store = new AssetStorage();
220 store.Data = Image.Data; 220 store.Data = Image.Data;
221 store.Name = Image.Name; 221 store.Name = Image.Name;
222 store.UUID = Image.FullID; 222 store.UUID = Image.FullID;
223 db.Set(store); 223 db.Set(store);
224 db.Commit(); 224 db.Commit();
225 225
226 Image = new AssetBase(); 226 Image = new AssetBase();
227 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); 227 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
228 Image.Name = "Hardwood"; 228 Image.Name = "Hardwood";
229 this.LoadAsset(Image, true, "hardwood.jp2"); 229 this.LoadAsset(Image, true, "hardwood.jp2");
230 store = new AssetStorage(); 230 store = new AssetStorage();
231 store.Data = Image.Data; 231 store.Data = Image.Data;
232 store.Name = Image.Name; 232 store.Name = Image.Name;
233 store.UUID = Image.FullID; 233 store.UUID = Image.FullID;
234 db.Set(store); 234 db.Set(store);
235 db.Commit(); 235 db.Commit();
236 236
237 Image = new AssetBase(); 237 Image = new AssetBase();
238 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); 238 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
239 Image.Name = "Prim Base Texture"; 239 Image.Name = "Prim Base Texture";
240 this.LoadAsset(Image, true, "plywood.jp2"); 240 this.LoadAsset(Image, true, "plywood.jp2");
241 store = new AssetStorage(); 241 store = new AssetStorage();
242 store.Data = Image.Data; 242 store.Data = Image.Data;
243 store.Name = Image.Name; 243 store.Name = Image.Name;
244 store.UUID = Image.FullID; 244 store.UUID = Image.FullID;
245 db.Set(store); 245 db.Set(store);
246 db.Commit(); 246 db.Commit();
247 247
248 Image = new AssetBase(); 248 Image = new AssetBase();
249 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 249 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
250 Image.Name = "Shape"; 250 Image.Name = "Shape";
251 this.LoadAsset(Image, false, "base_shape.dat"); 251 this.LoadAsset(Image, false, "base_shape.dat");
252 store = new AssetStorage(); 252 store = new AssetStorage();
253 store.Data = Image.Data; 253 store.Data = Image.Data;
254 store.Name = Image.Name; 254 store.Name = Image.Name;
255 store.UUID = Image.FullID; 255 store.UUID = Image.FullID;
256 db.Set(store); 256 db.Set(store);
257 db.Commit(); 257 db.Commit();
258 } 258 }
259 catch (Exception e) 259 catch (Exception e)
260 { 260 {
261 Console.WriteLine(e.Message); 261 Console.WriteLine(e.Message);
262 } 262 }
263 } 263 }
264 264
265 private void LoadAsset(AssetBase info, bool image, string filename) 265 private void LoadAsset(AssetBase info, bool image, string filename)
266 { 266 {
267 267
268 268
269 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; 269 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
270 string fileName = Path.Combine(dataPath, filename); 270 string fileName = Path.Combine(dataPath, filename);
271 FileInfo fInfo = new FileInfo(fileName); 271 FileInfo fInfo = new FileInfo(fileName);
272 long numBytes = fInfo.Length; 272 long numBytes = fInfo.Length;
273 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 273 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
274 byte[] idata = new byte[numBytes]; 274 byte[] idata = new byte[numBytes];
275 BinaryReader br = new BinaryReader(fStream); 275 BinaryReader br = new BinaryReader(fStream);
276 idata = br.ReadBytes((int)numBytes); 276 idata = br.ReadBytes((int)numBytes);
277 br.Close(); 277 br.Close();
278 fStream.Close(); 278 fStream.Close();
279 info.Data = idata; 279 info.Data = idata;
280 //info.loaded=true; 280 //info.loaded=true;
281 } 281 }
282 282
283 /*private GridConfig LoadConfigDll(string dllName) 283 /*private GridConfig LoadConfigDll(string dllName)
284 { 284 {
285 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 285 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
286 GridConfig config = null; 286 GridConfig config = null;
287 287
288 foreach (Type pluginType in pluginAssembly.GetTypes()) 288 foreach (Type pluginType in pluginAssembly.GetTypes())
289 { 289 {
290 if (pluginType.IsPublic) 290 if (pluginType.IsPublic)
291 { 291 {
292 if (!pluginType.IsAbstract) 292 if (!pluginType.IsAbstract)
293 { 293 {
294 Type typeInterface = pluginType.GetInterface("IGridConfig", true); 294 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
295 295
296 if (typeInterface != null) 296 if (typeInterface != null)
297 { 297 {
298 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 298 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
299 config = plug.GetConfigObject(); 299 config = plug.GetConfigObject();
300 break; 300 break;
301 } 301 }
302 302
303 typeInterface = null; 303 typeInterface = null;
304 } 304 }
305 } 305 }
306 } 306 }
307 pluginAssembly = null; 307 pluginAssembly = null;
308 return config; 308 return config;
309 }*/ 309 }*/
310 310
311 public void CreateAsset(LLUUID assetId, byte[] assetData) 311 public void CreateAsset(LLUUID assetId, byte[] assetData)
312 { 312 {
313 AssetBase asset = new AssetBase(); 313 AssetBase asset = new AssetBase();
314 asset.Name = ""; 314 asset.Name = "";
315 asset.FullID = assetId; 315 asset.FullID = assetId;
316 asset.Data = assetData; 316 asset.Data = assetData;
317 317
318 AssetStorage store = new AssetStorage(); 318 AssetStorage store = new AssetStorage();
319 store.Data = asset.Data; 319 store.Data = asset.Data;
320 store.Name = asset.Name; 320 store.Name = asset.Name;
321 store.UUID = asset.FullID; 321 store.UUID = asset.FullID;
322 db.Set(store); 322 db.Set(store);
323 db.Commit(); 323 db.Commit();
324 } 324 }
325 325
326 public void RunCmd(string cmd, string[] cmdparams) 326 public void RunCmd(string cmd, string[] cmdparams)
327 { 327 {
328 switch (cmd) 328 switch (cmd)
329 { 329 {
330 case "help": 330 case "help":
331 m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); 331 m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)");
332 break; 332 break;
333 333
334 case "shutdown": 334 case "shutdown":
335 m_console.Close(); 335 m_console.Close();
336 Environment.Exit(0); 336 Environment.Exit(0);
337 break; 337 break;
338 } 338 }
339 } 339 }
340 340
341 public void Show(string ShowWhat) 341 public void Show(string ShowWhat)
342 { 342 {
343 } 343 }
344 } 344 }
345 345
346 public class GetAssetStreamHandler : BaseStreamHandler 346 public class GetAssetStreamHandler : BaseStreamHandler
347 { 347 {
348 OpenAsset_Main m_assetManager; 348 OpenAsset_Main m_assetManager;
349 349
350 override public byte[] Handle(string path, Stream request) 350 override public byte[] Handle(string path, Stream request)
351 { 351 {
352 string param = GetParam(path); 352 string param = GetParam(path);
353 353
354 byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false); 354 byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false);
355 if (assetdata != null) 355 if (assetdata != null)
356 { 356 {
357 return assetdata; 357 return assetdata;
358 } 358 }
359 else 359 else
360 { 360 {
361 return new byte[]{}; 361 return new byte[]{};
362 } 362 }
363 } 363 }
364 364
365 public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET") 365 public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET")
366 { 366 {
367 m_assetManager = assetManager; 367 m_assetManager = assetManager;
368 } 368 }
369 } 369 }
370 370
371 public class PostAssetStreamHandler : BaseStreamHandler 371 public class PostAssetStreamHandler : BaseStreamHandler
372 { 372 {
373 OpenAsset_Main m_assetManager; 373 OpenAsset_Main m_assetManager;
374 374
375 override public byte[] Handle(string path, Stream request) 375 override public byte[] Handle(string path, Stream request)
376 { 376 {
377 string param = GetParam(path); 377 string param = GetParam(path);
378 LLUUID assetId = new LLUUID(param); 378 LLUUID assetId = new LLUUID(param);
379 byte[] txBuffer = new byte[4096]; 379 byte[] txBuffer = new byte[4096];
380 380
381 using( BinaryReader binReader = new BinaryReader( request ) ) 381 using( BinaryReader binReader = new BinaryReader( request ) )
382 { 382 {
383 using (MemoryStream memoryStream = new MemoryStream(4096)) 383 using (MemoryStream memoryStream = new MemoryStream(4096))
384 { 384 {
385 int count; 385 int count;
386 while ((count = binReader.Read(txBuffer, 0, 4096)) > 0) 386 while ((count = binReader.Read(txBuffer, 0, 4096)) > 0)
387 { 387 {
388 memoryStream.Write(txBuffer, 0, count); 388 memoryStream.Write(txBuffer, 0, count);
389 } 389 }
390 390
391 byte[] assetData = memoryStream.ToArray(); 391 byte[] assetData = memoryStream.ToArray();
392 392
393 m_assetManager.CreateAsset(assetId, assetData); 393 m_assetManager.CreateAsset(assetId, assetData);
394 } 394 }
395 } 395 }
396 396
397 return new byte[]{}; 397 return new byte[]{};
398 } 398 }
399 399
400 public PostAssetStreamHandler( OpenAsset_Main assetManager ) 400 public PostAssetStreamHandler( OpenAsset_Main assetManager )
401 : base("/assets/", "POST") 401 : base("/assets/", "POST")
402 { 402 {
403 m_assetManager = assetManager; 403 m_assetManager = assetManager;
404 } 404 }
405 } 405 }
406} 406}
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
index dc39ce2..f9b48d5 100644
--- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
@@ -1,58 +1,58 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OGS-AssetServer")] 33[assembly: AssemblyTitle("OGS-AssetServer")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OGS-AssetServer")] 37[assembly: AssemblyProduct("OGS-AssetServer")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57[assembly: AssemblyVersion("1.0.0.0")] 57[assembly: AssemblyVersion("1.0.0.0")]
58[assembly: AssemblyFileVersion("1.0.0.0")] 58[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs
index 6c916a2..989df26 100644
--- a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs
+++ b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs
@@ -1,138 +1,138 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections; 28using System.Collections;
29using libsecondlife; 29using libsecondlife;
30using Nwc.XmlRpc; 30using Nwc.XmlRpc;
31using OpenSim.Framework.Servers; 31using OpenSim.Framework.Servers;
32 32
33namespace OpenSim.Framework.Manager 33namespace OpenSim.Framework.Manager
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Used to pass messages to the gridserver 36 /// Used to pass messages to the gridserver
37 /// </summary> 37 /// </summary>
38 /// <param name="param">Pass this argument</param> 38 /// <param name="param">Pass this argument</param>
39 public delegate void GridManagerCallback(string param); 39 public delegate void GridManagerCallback(string param);
40 40
41 /// <summary> 41 /// <summary>
42 /// Serverside listener for grid commands 42 /// Serverside listener for grid commands
43 /// </summary> 43 /// </summary>
44 public class GridManagementAgent 44 public class GridManagementAgent
45 { 45 {
46 /// <summary> 46 /// <summary>
47 /// Passes grid server messages 47 /// Passes grid server messages
48 /// </summary> 48 /// </summary>
49 private GridManagerCallback thecallback; 49 private GridManagerCallback thecallback;
50 50
51 /// <summary> 51 /// <summary>
52 /// Security keys 52 /// Security keys
53 /// </summary> 53 /// </summary>
54 private string sendkey; 54 private string sendkey;
55 private string recvkey; 55 private string recvkey;
56 56
57 /// <summary> 57 /// <summary>
58 /// Our component type 58 /// Our component type
59 /// </summary> 59 /// </summary>
60 private string component_type; 60 private string component_type;
61 61
62 /// <summary> 62 /// <summary>
63 /// List of active sessions 63 /// List of active sessions
64 /// </summary> 64 /// </summary>
65 private static ArrayList Sessions; 65 private static ArrayList Sessions;
66 66
67 /// <summary> 67 /// <summary>
68 /// Initialises a new GridManagementAgent 68 /// Initialises a new GridManagementAgent
69 /// </summary> 69 /// </summary>
70 /// <param name="app_httpd">HTTP Daemon for this server</param> 70 /// <param name="app_httpd">HTTP Daemon for this server</param>
71 /// <param name="component_type">What component type are we?</param> 71 /// <param name="component_type">What component type are we?</param>
72 /// <param name="sendkey">Security send key</param> 72 /// <param name="sendkey">Security send key</param>
73 /// <param name="recvkey">Security recieve key</param> 73 /// <param name="recvkey">Security recieve key</param>
74 /// <param name="thecallback">Message callback</param> 74 /// <param name="thecallback">Message callback</param>
75 public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) 75 public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
76 { 76 {
77 this.sendkey = sendkey; 77 this.sendkey = sendkey;
78 this.recvkey = recvkey; 78 this.recvkey = recvkey;
79 this.component_type = component_type; 79 this.component_type = component_type;
80 this.thecallback = thecallback; 80 this.thecallback = thecallback;
81 Sessions = new ArrayList(); 81 Sessions = new ArrayList();
82 82
83 app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); 83 app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod);
84 84
85 switch (component_type) 85 switch (component_type)
86 { 86 {
87 case "gridserver": 87 case "gridserver":
88 GridServerManager.sendkey = this.sendkey; 88 GridServerManager.sendkey = this.sendkey;
89 GridServerManager.recvkey = this.recvkey; 89 GridServerManager.recvkey = this.recvkey;
90 GridServerManager.thecallback = thecallback; 90 GridServerManager.thecallback = thecallback;
91 app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); 91 app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
92 break; 92 break;
93 } 93 }
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
97 /// Checks if a session exists 97 /// Checks if a session exists
98 /// </summary> 98 /// </summary>
99 /// <param name="sessionID">The session ID</param> 99 /// <param name="sessionID">The session ID</param>
100 /// <returns>Exists?</returns> 100 /// <returns>Exists?</returns>
101 public static bool SessionExists(LLUUID sessionID) 101 public static bool SessionExists(LLUUID sessionID)
102 { 102 {
103 return Sessions.Contains(sessionID); 103 return Sessions.Contains(sessionID);
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// Logs a new session to the grid manager 107 /// Logs a new session to the grid manager
108 /// </summary> 108 /// </summary>
109 /// <param name="request">the XMLRPC request</param> 109 /// <param name="request">the XMLRPC request</param>
110 /// <returns>An XMLRPC reply</returns> 110 /// <returns>An XMLRPC reply</returns>
111 public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 111 public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
112 { 112 {
113 XmlRpcResponse response = new XmlRpcResponse(); 113 XmlRpcResponse response = new XmlRpcResponse();
114 Hashtable requestData = (Hashtable)request.Params[0]; 114 Hashtable requestData = (Hashtable)request.Params[0];
115 Hashtable responseData = new Hashtable(); 115 Hashtable responseData = new Hashtable();
116 116
117 // TODO: Switch this over to using OpenSim.Framework.Data 117 // TODO: Switch this over to using OpenSim.Framework.Data
118 if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) 118 if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
119 { 119 {
120 response.IsFault = false; 120 response.IsFault = false;
121 LLUUID new_session = LLUUID.Random(); 121 LLUUID new_session = LLUUID.Random();
122 Sessions.Add(new_session); 122 Sessions.Add(new_session);
123 responseData["session_id"] = new_session.ToString(); 123 responseData["session_id"] = new_session.ToString();
124 responseData["msg"] = "Login OK"; 124 responseData["msg"] = "Login OK";
125 } 125 }
126 else 126 else
127 { 127 {
128 response.IsFault = true; 128 response.IsFault = true;
129 responseData["error"] = "Invalid username or password"; 129 responseData["error"] = "Invalid username or password";
130 } 130 }
131 131
132 response.Value = responseData; 132 response.Value = responseData;
133 return response; 133 return response;
134 134
135 } 135 }
136 136
137 } 137 }
138} 138}
diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs
index 67cd35d..729e42b 100644
--- a/OpenSim/Grid/Framework.Manager/GridServerManager.cs
+++ b/OpenSim/Grid/Framework.Manager/GridServerManager.cs
@@ -1,93 +1,93 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Threading; 31using System.Threading;
32using libsecondlife; 32using libsecondlife;
33using Nwc.XmlRpc; 33using Nwc.XmlRpc;
34 34
35namespace OpenSim.Framework.Manager { 35namespace OpenSim.Framework.Manager {
36 36
37 /// <summary> 37 /// <summary>
38 /// A remote management system for the grid server 38 /// A remote management system for the grid server
39 /// </summary> 39 /// </summary>
40 public class GridServerManager 40 public class GridServerManager
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// Triggers events from the grid manager 43 /// Triggers events from the grid manager
44 /// </summary> 44 /// </summary>
45 public static GridManagerCallback thecallback; 45 public static GridManagerCallback thecallback;
46 46
47 /// <summary> 47 /// <summary>
48 /// Security keys 48 /// Security keys
49 /// </summary> 49 /// </summary>
50 public static string sendkey; 50 public static string sendkey;
51 public static string recvkey; 51 public static string recvkey;
52 52
53 /// <summary> 53 /// <summary>
54 /// Disconnects the grid server and shuts it down 54 /// Disconnects the grid server and shuts it down
55 /// </summary> 55 /// </summary>
56 /// <param name="request">XmlRpc Request</param> 56 /// <param name="request">XmlRpc Request</param>
57 /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> 57 /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns>
58 public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) 58 public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
59 { 59 {
60 XmlRpcResponse response = new XmlRpcResponse(); 60 XmlRpcResponse response = new XmlRpcResponse();
61 Hashtable requestData = (Hashtable)request.Params[0]; 61 Hashtable requestData = (Hashtable)request.Params[0];
62 Hashtable responseData = new Hashtable(); 62 Hashtable responseData = new Hashtable();
63 63
64 if(requestData.ContainsKey("session_id")) { 64 if(requestData.ContainsKey("session_id")) {
65 if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { 65 if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) {
66 responseData["msg"]="Shutdown command accepted"; 66 responseData["msg"]="Shutdown command accepted";
67 (new Thread(new ThreadStart(ShutdownServer))).Start(); 67 (new Thread(new ThreadStart(ShutdownServer))).Start();
68 } else { 68 } else {
69 response.IsFault=true; 69 response.IsFault=true;
70 responseData["error"]="bad session ID"; 70 responseData["error"]="bad session ID";
71 } 71 }
72 } else { 72 } else {
73 response.IsFault=true; 73 response.IsFault=true;
74 responseData["error"]="no session ID"; 74 responseData["error"]="no session ID";
75 } 75 }
76 76
77 response.Value = responseData; 77 response.Value = responseData;
78 return response; 78 return response;
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Shuts down the grid server 82 /// Shuts down the grid server
83 /// </summary> 83 /// </summary>
84 public static void ShutdownServer() 84 public static void ShutdownServer()
85 { 85 {
86 Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); 86 Console.WriteLine("Shutting down the grid server - recieved a grid manager request");
87 Console.WriteLine("Terminating in three seconds..."); 87 Console.WriteLine("Terminating in three seconds...");
88 Thread.Sleep(3000); 88 Thread.Sleep(3000);
89 thecallback("shutdown"); 89 thecallback("shutdown");
90 } 90 }
91 } 91 }
92} 92}
93 93
diff --git a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs
index 39c9e8f..4aa58f8 100644
--- a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("GridConfig")] 36[assembly: AssemblyTitle("GridConfig")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("GridConfig")] 40[assembly: AssemblyProduct("GridConfig")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
index 4acf81d..7d7690b 100644
--- a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
+++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
@@ -1,160 +1,160 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31using OpenSim.Framework.Interfaces; 31using OpenSim.Framework.Interfaces;
32 32
33namespace OpenGrid.Config.GridConfigDb4o 33namespace OpenGrid.Config.GridConfigDb4o
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// A grid configuration interface for returning the DB4o Config Provider 36 /// A grid configuration interface for returning the DB4o Config Provider
37 /// </summary> 37 /// </summary>
38 public class Db40ConfigPlugin: IGridConfig 38 public class Db40ConfigPlugin: IGridConfig
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// Loads and returns a configuration objeect 41 /// Loads and returns a configuration objeect
42 /// </summary> 42 /// </summary>
43 /// <returns>A grid configuration object</returns> 43 /// <returns>A grid configuration object</returns>
44 public GridConfig GetConfigObject() 44 public GridConfig GetConfigObject()
45 { 45 {
46 MainLog.Instance.Verbose("Loading Db40Config dll"); 46 MainLog.Instance.Verbose("Loading Db40Config dll");
47 return ( new DbGridConfig()); 47 return ( new DbGridConfig());
48 } 48 }
49 } 49 }
50 50
51 /// <summary> 51 /// <summary>
52 /// A DB4o based Gridserver configuration object 52 /// A DB4o based Gridserver configuration object
53 /// </summary> 53 /// </summary>
54 public class DbGridConfig : GridConfig 54 public class DbGridConfig : GridConfig
55 { 55 {
56 /// <summary> 56 /// <summary>
57 /// The DB4o Database 57 /// The DB4o Database
58 /// </summary> 58 /// </summary>
59 private IObjectContainer db; 59 private IObjectContainer db;
60 60
61 /// <summary> 61 /// <summary>
62 /// User configuration for the Grid Config interfaces 62 /// User configuration for the Grid Config interfaces
63 /// </summary> 63 /// </summary>
64 public void LoadDefaults() { 64 public void LoadDefaults() {
65 MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 65 MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
66 66
67 // About the grid options 67 // About the grid options
68 this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); 68 this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team");
69 69
70 // Asset Options 70 // Asset Options
71 this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); 71 this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/");
72 this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); 72 this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null");
73 this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); 73 this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null");
74 74
75 // User Server Options 75 // User Server Options
76 this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); 76 this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/");
77 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); 77 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null");
78 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); 78 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null");
79 79
80 // Region Server Options 80 // Region Server Options
81 this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); 81 this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null");
82 this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); 82 this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null");
83 } 83 }
84 84
85 /// <summary> 85 /// <summary>
86 /// Initialises a new configuration object 86 /// Initialises a new configuration object
87 /// </summary> 87 /// </summary>
88 public override void InitConfig() { 88 public override void InitConfig() {
89 try { 89 try {
90 // Perform Db4o initialisation 90 // Perform Db4o initialisation
91 db = Db4oFactory.OpenFile("opengrid.yap"); 91 db = Db4oFactory.OpenFile("opengrid.yap");
92 92
93 // Locate the grid configuration object 93 // Locate the grid configuration object
94 IObjectSet result = db.Get(typeof(DbGridConfig)); 94 IObjectSet result = db.Get(typeof(DbGridConfig));
95 // Found? 95 // Found?
96 if(result.Count==1) { 96 if(result.Count==1) {
97 MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); 97 MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
98 foreach (DbGridConfig cfg in result) { 98 foreach (DbGridConfig cfg in result) {
99 // Import each setting into this class 99 // Import each setting into this class
100 // Grid Settings 100 // Grid Settings
101 this.GridOwner=cfg.GridOwner; 101 this.GridOwner=cfg.GridOwner;
102 // Asset Settings 102 // Asset Settings
103 this.DefaultAssetServer=cfg.DefaultAssetServer; 103 this.DefaultAssetServer=cfg.DefaultAssetServer;
104 this.AssetSendKey=cfg.AssetSendKey; 104 this.AssetSendKey=cfg.AssetSendKey;
105 this.AssetRecvKey=cfg.AssetRecvKey; 105 this.AssetRecvKey=cfg.AssetRecvKey;
106 // User Settings 106 // User Settings
107 this.DefaultUserServer=cfg.DefaultUserServer; 107 this.DefaultUserServer=cfg.DefaultUserServer;
108 this.UserSendKey=cfg.UserSendKey; 108 this.UserSendKey=cfg.UserSendKey;
109 this.UserRecvKey=cfg.UserRecvKey; 109 this.UserRecvKey=cfg.UserRecvKey;
110 // Region Settings 110 // Region Settings
111 this.SimSendKey=cfg.SimSendKey; 111 this.SimSendKey=cfg.SimSendKey;
112 this.SimRecvKey=cfg.SimRecvKey; 112 this.SimRecvKey=cfg.SimRecvKey;
113 } 113 }
114 // Create a new configuration object from this class 114 // Create a new configuration object from this class
115 } else { 115 } else {
116 MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 116 MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
117 117
118 // Load default settings into this class 118 // Load default settings into this class
119 LoadDefaults(); 119 LoadDefaults();
120 120
121 // Saves to the database file... 121 // Saves to the database file...
122 MainLog.Instance.Verbose( "Writing out default settings to local database"); 122 MainLog.Instance.Verbose( "Writing out default settings to local database");
123 db.Set(this); 123 db.Set(this);
124 124
125 // Closes file locks 125 // Closes file locks
126 db.Close(); 126 db.Close();
127 } 127 }
128 } catch(Exception e) { 128 } catch(Exception e) {
129 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); 129 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
130 MainLog.Instance.Warn(e.ToString()); 130 MainLog.Instance.Warn(e.ToString());
131 } 131 }
132 132
133 // Grid Settings 133 // Grid Settings
134 MainLog.Instance.Verbose("Grid settings loaded:"); 134 MainLog.Instance.Verbose("Grid settings loaded:");
135 MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); 135 MainLog.Instance.Verbose("Grid owner: " + this.GridOwner);
136 136
137 // Asset Settings 137 // Asset Settings
138 MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); 138 MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer);
139 MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); 139 MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey);
140 MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); 140 MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey);
141 141
142 // User Settings 142 // User Settings
143 MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); 143 MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer);
144 MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); 144 MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey);
145 MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); 145 MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey);
146 146
147 // Region Settings 147 // Region Settings
148 MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); 148 MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey);
149 MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); 149 MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey);
150 } 150 }
151 151
152 /// <summary> 152 /// <summary>
153 /// Closes down the database and releases filesystem locks 153 /// Closes down the database and releases filesystem locks
154 /// </summary> 154 /// </summary>
155 public void Shutdown() { 155 public void Shutdown() {
156 db.Close(); 156 db.Close();
157 } 157 }
158 } 158 }
159 159
160} 160}
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 64b51b4..22bffa0 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -1,710 +1,710 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33using libsecondlife; 33using libsecondlife;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Utilities; 38using OpenSim.Framework.Utilities;
39 39
40namespace OpenSim.Grid.GridServer 40namespace OpenSim.Grid.GridServer
41{ 41{
42 class GridManager 42 class GridManager
43 { 43 {
44 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 44 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
45 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); 45 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
46 46
47 public GridConfig config; 47 public GridConfig config;
48 48
49 /// <summary> 49 /// <summary>
50 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. 50 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
51 /// </summary> 51 /// </summary>
52 /// <param name="FileName">The filename to the grid server plugin DLL</param> 52 /// <param name="FileName">The filename to the grid server plugin DLL</param>
53 public void AddPlugin(string FileName) 53 public void AddPlugin(string FileName)
54 { 54 {
55 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); 55 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName);
56 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 56 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
57 57
58 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 58 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
59 foreach (Type pluginType in pluginAssembly.GetTypes()) 59 foreach (Type pluginType in pluginAssembly.GetTypes())
60 { 60 {
61 if (!pluginType.IsAbstract) 61 if (!pluginType.IsAbstract)
62 { 62 {
63 // Regions go here 63 // Regions go here
64 Type typeInterface = pluginType.GetInterface("IGridData", true); 64 Type typeInterface = pluginType.GetInterface("IGridData", true);
65 65
66 if (typeInterface != null) 66 if (typeInterface != null)
67 { 67 {
68 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
69 plug.Initialise(); 69 plug.Initialise();
70 this._plugins.Add(plug.getName(), plug); 70 this._plugins.Add(plug.getName(), plug);
71 MainLog.Instance.Verbose("Storage: Added IGridData Interface"); 71 MainLog.Instance.Verbose("Storage: Added IGridData Interface");
72 } 72 }
73 73
74 typeInterface = null; 74 typeInterface = null;
75 75
76 // Logs go here 76 // Logs go here
77 typeInterface = pluginType.GetInterface("ILogData", true); 77 typeInterface = pluginType.GetInterface("ILogData", true);
78 78
79 if (typeInterface != null) 79 if (typeInterface != null)
80 { 80 {
81 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 81 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
82 plug.Initialise(); 82 plug.Initialise();
83 this._logplugins.Add(plug.getName(), plug); 83 this._logplugins.Add(plug.getName(), plug);
84 MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); 84 MainLog.Instance.Verbose( "Storage: Added ILogData Interface");
85 } 85 }
86 86
87 typeInterface = null; 87 typeInterface = null;
88 } 88 }
89 } 89 }
90 90
91 pluginAssembly = null; 91 pluginAssembly = null;
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
95 /// Logs a piece of information to the database 95 /// Logs a piece of information to the database
96 /// </summary> 96 /// </summary>
97 /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> 97 /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param>
98 /// <param name="method">Which method is being called?</param> 98 /// <param name="method">Which method is being called?</param>
99 /// <param name="args">What arguments are being passed?</param> 99 /// <param name="args">What arguments are being passed?</param>
100 /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> 100 /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param>
101 /// <param name="message">The message to log</param> 101 /// <param name="message">The message to log</param>
102 private void logToDB(string target, string method, string args, int priority, string message) 102 private void logToDB(string target, string method, string args, int priority, string message)
103 { 103 {
104 foreach (KeyValuePair<string, ILogData> kvp in _logplugins) 104 foreach (KeyValuePair<string, ILogData> kvp in _logplugins)
105 { 105 {
106 try 106 try
107 { 107 {
108 kvp.Value.saveLog("Gridserver", target, method, args, priority, message); 108 kvp.Value.saveLog("Gridserver", target, method, args, priority, message);
109 } 109 }
110 catch (Exception) 110 catch (Exception)
111 { 111 {
112 MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key); 112 MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key);
113 } 113 }
114 } 114 }
115 } 115 }
116 116
117 /// <summary> 117 /// <summary>
118 /// Returns a region by argument 118 /// Returns a region by argument
119 /// </summary> 119 /// </summary>
120 /// <param name="uuid">A UUID key of the region to return</param> 120 /// <param name="uuid">A UUID key of the region to return</param>
121 /// <returns>A SimProfileData for the region</returns> 121 /// <returns>A SimProfileData for the region</returns>
122 public SimProfileData getRegion(LLUUID uuid) 122 public SimProfileData getRegion(LLUUID uuid)
123 { 123 {
124 foreach(KeyValuePair<string,IGridData> kvp in _plugins) { 124 foreach(KeyValuePair<string,IGridData> kvp in _plugins) {
125 try 125 try
126 { 126 {
127 return kvp.Value.GetProfileByLLUUID(uuid); 127 return kvp.Value.GetProfileByLLUUID(uuid);
128 } 128 }
129 catch (Exception e) 129 catch (Exception e)
130 { 130 {
131 MainLog.Instance.Warn("Message from Storage: " + e.Message); 131 MainLog.Instance.Warn("Message from Storage: " + e.Message);
132 } 132 }
133 } 133 }
134 return null; 134 return null;
135 } 135 }
136 136
137 /// <summary> 137 /// <summary>
138 /// Returns a region by argument 138 /// Returns a region by argument
139 /// </summary> 139 /// </summary>
140 /// <param name="uuid">A regionHandle of the region to return</param> 140 /// <param name="uuid">A regionHandle of the region to return</param>
141 /// <returns>A SimProfileData for the region</returns> 141 /// <returns>A SimProfileData for the region</returns>
142 public SimProfileData getRegion(ulong handle) 142 public SimProfileData getRegion(ulong handle)
143 { 143 {
144 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 144 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
145 { 145 {
146 try 146 try
147 { 147 {
148 return kvp.Value.GetProfileByHandle(handle); 148 return kvp.Value.GetProfileByHandle(handle);
149 } 149 }
150 catch 150 catch
151 { 151 {
152 MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); 152 MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
153 } 153 }
154 } 154 }
155 return null; 155 return null;
156 } 156 }
157 157
158 public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) 158 public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
159 { 159 {
160 Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>(); 160 Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>();
161 161
162 SimProfileData[] neighbours; 162 SimProfileData[] neighbours;
163 163
164 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 164 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
165 { 165 {
166 try 166 try
167 { 167 {
168 neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); 168 neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
169 foreach (SimProfileData neighbour in neighbours) 169 foreach (SimProfileData neighbour in neighbours)
170 { 170 {
171 regions[neighbour.regionHandle] = neighbour; 171 regions[neighbour.regionHandle] = neighbour;
172 } 172 }
173 } 173 }
174 catch 174 catch
175 { 175 {
176 MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); 176 MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key);
177 } 177 }
178 } 178 }
179 179
180 return regions; 180 return regions;
181 } 181 }
182 182
183 183
184 184
185 /// <summary> 185 /// <summary>
186 /// Returns a XML String containing a list of the neighbouring regions 186 /// Returns a XML String containing a list of the neighbouring regions
187 /// </summary> 187 /// </summary>
188 /// <param name="reqhandle">The regionhandle for the center sim</param> 188 /// <param name="reqhandle">The regionhandle for the center sim</param>
189 /// <returns>An XML string containing neighbour entities</returns> 189 /// <returns>An XML string containing neighbour entities</returns>
190 public string GetXMLNeighbours(ulong reqhandle) 190 public string GetXMLNeighbours(ulong reqhandle)
191 { 191 {
192 string response = ""; 192 string response = "";
193 SimProfileData central_region = getRegion(reqhandle); 193 SimProfileData central_region = getRegion(reqhandle);
194 SimProfileData neighbour; 194 SimProfileData neighbour;
195 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 195 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
196 { 196 {
197 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) 197 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null)
198 { 198 {
199 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); 199 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256));
200 response += "<neighbour>"; 200 response += "<neighbour>";
201 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 201 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
202 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 202 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
203 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; 203 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
204 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; 204 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
205 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; 205 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
206 response += "</neighbour>"; 206 response += "</neighbour>";
207 207
208 } 208 }
209 } 209 }
210 return response; 210 return response;
211 } 211 }
212 212
213 /// <summary> 213 /// <summary>
214 /// Performed when a region connects to the grid server initially. 214 /// Performed when a region connects to the grid server initially.
215 /// </summary> 215 /// </summary>
216 /// <param name="request">The XMLRPC Request</param> 216 /// <param name="request">The XMLRPC Request</param>
217 /// <returns>Startup parameters</returns> 217 /// <returns>Startup parameters</returns>
218 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) 218 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
219 { 219 {
220 220
221 XmlRpcResponse response = new XmlRpcResponse(); 221 XmlRpcResponse response = new XmlRpcResponse();
222 Hashtable responseData = new Hashtable(); 222 Hashtable responseData = new Hashtable();
223 response.Value = responseData; 223 response.Value = responseData;
224 224
225 SimProfileData TheSim = null; 225 SimProfileData TheSim = null;
226 Hashtable requestData = (Hashtable)request.Params[0]; 226 Hashtable requestData = (Hashtable)request.Params[0];
227 227
228 if (requestData.ContainsKey("UUID")) 228 if (requestData.ContainsKey("UUID"))
229 { 229 {
230 TheSim = getRegion(new LLUUID((string)requestData["UUID"])); 230 TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
231 231
232 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); 232 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
233 } 233 }
234 else if (requestData.ContainsKey("region_handle")) 234 else if (requestData.ContainsKey("region_handle"))
235 { 235 {
236 236
237 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); 237 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
238 logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); 238 logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
239 } 239 }
240 else 240 else
241 { 241 {
242 responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; 242 responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you";
243 return response; 243 return response;
244 } 244 }
245 245
246 if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? 246 if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
247 { 247 {
248 //NEW REGION 248 //NEW REGION
249 TheSim = new SimProfileData(); 249 TheSim = new SimProfileData();
250 250
251 TheSim.regionRecvKey = config.SimRecvKey; 251 TheSim.regionRecvKey = config.SimRecvKey;
252 TheSim.regionSendKey = config.SimSendKey; 252 TheSim.regionSendKey = config.SimSendKey;
253 TheSim.regionSecret = config.SimRecvKey; 253 TheSim.regionSecret = config.SimRecvKey;
254 TheSim.regionDataURI = ""; 254 TheSim.regionDataURI = "";
255 TheSim.regionAssetURI = config.DefaultAssetServer; 255 TheSim.regionAssetURI = config.DefaultAssetServer;
256 TheSim.regionAssetRecvKey = config.AssetRecvKey; 256 TheSim.regionAssetRecvKey = config.AssetRecvKey;
257 TheSim.regionAssetSendKey = config.AssetSendKey; 257 TheSim.regionAssetSendKey = config.AssetSendKey;
258 TheSim.regionUserURI = config.DefaultUserServer; 258 TheSim.regionUserURI = config.DefaultUserServer;
259 TheSim.regionUserSendKey = config.UserSendKey; 259 TheSim.regionUserSendKey = config.UserSendKey;
260 TheSim.regionUserRecvKey = config.UserRecvKey; 260 TheSim.regionUserRecvKey = config.UserRecvKey;
261 261
262 TheSim.serverIP = (string)requestData["sim_ip"]; 262 TheSim.serverIP = (string)requestData["sim_ip"];
263 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); 263 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
264 TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); 264 TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
265 TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); 265 TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
266 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); 266 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
267 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); 267 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
268 TheSim.regionLocZ = 0; 268 TheSim.regionLocZ = 0;
269 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); 269 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
270 270
271 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 271 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
272 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle); 272 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle);
273 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; 273 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
274 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; 274 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
275 275
276 Console.WriteLine("NEW SIM: " + TheSim.serverURI); 276 Console.WriteLine("NEW SIM: " + TheSim.serverURI);
277 TheSim.regionName = (string)requestData["sim_name"]; 277 TheSim.regionName = (string)requestData["sim_name"];
278 TheSim.UUID = new LLUUID((string)requestData["UUID"]); 278 TheSim.UUID = new LLUUID((string)requestData["UUID"]);
279 279
280 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 280 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
281 { 281 {
282 try 282 try
283 { 283 {
284 DataResponse insertResponse = kvp.Value.AddProfile(TheSim); 284 DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
285 switch(insertResponse) 285 switch(insertResponse)
286 { 286 {
287 case DataResponse.RESPONSE_OK: 287 case DataResponse.RESPONSE_OK:
288 OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName); 288 OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName);
289 break; 289 break;
290 case DataResponse.RESPONSE_ERROR: 290 case DataResponse.RESPONSE_ERROR:
291 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName); 291 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName);
292 break; 292 break;
293 case DataResponse.RESPONSE_INVALIDCREDENTIALS: 293 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
294 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName); 294 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName);
295 break; 295 break;
296 case DataResponse.RESPONSE_AUTHREQUIRED: 296 case DataResponse.RESPONSE_AUTHREQUIRED:
297 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName); 297 OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName);
298 break; 298 break;
299 } 299 }
300 300
301 } 301 }
302 catch (Exception e) 302 catch (Exception e)
303 { 303 {
304 OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); 304 OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
305 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); 305 OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString());
306 } 306 }
307 } 307 }
308 308
309 309
310 if (getRegion(TheSim.regionHandle) == null) 310 if (getRegion(TheSim.regionHandle) == null)
311 { 311 {
312 responseData["error"] = "Unable to add new region"; 312 responseData["error"] = "Unable to add new region";
313 return response; 313 return response;
314 } 314 }
315 } 315 }
316 316
317 317
318 ArrayList SimNeighboursData = new ArrayList(); 318 ArrayList SimNeighboursData = new ArrayList();
319 319
320 SimProfileData neighbour; 320 SimProfileData neighbour;
321 Hashtable NeighbourBlock; 321 Hashtable NeighbourBlock;
322 322
323 bool fastMode = false; // Only compatible with MySQL right now 323 bool fastMode = false; // Only compatible with MySQL right now
324 324
325 if (fastMode) 325 if (fastMode)
326 { 326 {
327 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); 327 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
328 328
329 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) 329 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
330 { 330 {
331 NeighbourBlock = new Hashtable(); 331 NeighbourBlock = new Hashtable();
332 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); 332 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
333 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); 333 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
334 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); 334 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
335 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); 335 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
336 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); 336 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
337 337
338 if (aSim.Value.UUID != TheSim.UUID) 338 if (aSim.Value.UUID != TheSim.UUID)
339 SimNeighboursData.Add(NeighbourBlock); 339 SimNeighboursData.Add(NeighbourBlock);
340 } 340 }
341 } 341 }
342 else 342 else
343 { 343 {
344 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 344 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
345 { 345 {
346 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) 346 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
347 { 347 {
348 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); 348 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
349 349
350 NeighbourBlock = new Hashtable(); 350 NeighbourBlock = new Hashtable();
351 NeighbourBlock["sim_ip"] = neighbour.serverIP; 351 NeighbourBlock["sim_ip"] = neighbour.serverIP;
352 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); 352 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
353 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); 353 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
354 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); 354 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
355 NeighbourBlock["UUID"] = neighbour.UUID.ToString(); 355 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
356 356
357 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); 357 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
358 } 358 }
359 } 359 }
360 } 360 }
361 361
362 responseData["UUID"] = TheSim.UUID.ToString(); 362 responseData["UUID"] = TheSim.UUID.ToString();
363 responseData["region_locx"] = TheSim.regionLocX.ToString(); 363 responseData["region_locx"] = TheSim.regionLocX.ToString();
364 responseData["region_locy"] = TheSim.regionLocY.ToString(); 364 responseData["region_locy"] = TheSim.regionLocY.ToString();
365 responseData["regionname"] = TheSim.regionName; 365 responseData["regionname"] = TheSim.regionName;
366 responseData["estate_id"] = "1"; 366 responseData["estate_id"] = "1";
367 responseData["neighbours"] = SimNeighboursData; 367 responseData["neighbours"] = SimNeighboursData;
368 368
369 responseData["sim_ip"] = TheSim.serverIP; 369 responseData["sim_ip"] = TheSim.serverIP;
370 responseData["sim_port"] = TheSim.serverPort.ToString(); 370 responseData["sim_port"] = TheSim.serverPort.ToString();
371 responseData["asset_url"] = TheSim.regionAssetURI; 371 responseData["asset_url"] = TheSim.regionAssetURI;
372 responseData["asset_sendkey"] = TheSim.regionAssetSendKey; 372 responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
373 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; 373 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
374 responseData["user_url"] = TheSim.regionUserURI; 374 responseData["user_url"] = TheSim.regionUserURI;
375 responseData["user_sendkey"] = TheSim.regionUserSendKey; 375 responseData["user_sendkey"] = TheSim.regionUserSendKey;
376 responseData["user_recvkey"] = TheSim.regionUserRecvKey; 376 responseData["user_recvkey"] = TheSim.regionUserRecvKey;
377 responseData["authkey"] = TheSim.regionSecret; 377 responseData["authkey"] = TheSim.regionSecret;
378 378
379 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) 379 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
380 responseData["data_uri"] = TheSim.regionDataURI; 380 responseData["data_uri"] = TheSim.regionDataURI;
381 381
382 382
383 return response; 383 return response;
384 } 384 }
385 385
386 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 386 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
387 { 387 {
388 Hashtable requestData = (Hashtable)request.Params[0]; 388 Hashtable requestData = (Hashtable)request.Params[0];
389 Hashtable responseData = new Hashtable(); 389 Hashtable responseData = new Hashtable();
390 SimProfileData simData = null; 390 SimProfileData simData = null;
391 if (requestData.ContainsKey("region_UUID")) 391 if (requestData.ContainsKey("region_UUID"))
392 { 392 {
393 simData = getRegion(new LLUUID((string)requestData["region_UUID"])); 393 simData = getRegion(new LLUUID((string)requestData["region_UUID"]));
394 } 394 }
395 else if (requestData.ContainsKey("region_handle")) 395 else if (requestData.ContainsKey("region_handle"))
396 { 396 {
397 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); 397 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]);
398 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); 398 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
399 } 399 }
400 400
401 if (simData == null) 401 if (simData == null)
402 { 402 {
403 //Sim does not exist 403 //Sim does not exist
404 Console.WriteLine("region not found"); 404 Console.WriteLine("region not found");
405 responseData["error"] = "Sim does not exist"; 405 responseData["error"] = "Sim does not exist";
406 } 406 }
407 else 407 else
408 { 408 {
409 Console.WriteLine("found region"); 409 Console.WriteLine("found region");
410 responseData["sim_ip"] = simData.serverIP; 410 responseData["sim_ip"] = simData.serverIP;
411 responseData["sim_port"] = simData.serverPort.ToString(); 411 responseData["sim_port"] = simData.serverPort.ToString();
412 responseData["http_port"] = simData.httpPort.ToString(); 412 responseData["http_port"] = simData.httpPort.ToString();
413 responseData["remoting_port"] = simData.remotingPort.ToString(); 413 responseData["remoting_port"] = simData.remotingPort.ToString();
414 responseData["region_locx"] = simData.regionLocX.ToString() ; 414 responseData["region_locx"] = simData.regionLocX.ToString() ;
415 responseData["region_locy"] = simData.regionLocY.ToString(); 415 responseData["region_locy"] = simData.regionLocY.ToString();
416 responseData["region_UUID"] = simData.UUID.UUID.ToString(); 416 responseData["region_UUID"] = simData.UUID.UUID.ToString();
417 responseData["region_name"] = simData.regionName; 417 responseData["region_name"] = simData.regionName;
418 } 418 }
419 419
420 XmlRpcResponse response = new XmlRpcResponse(); 420 XmlRpcResponse response = new XmlRpcResponse();
421 response.Value = responseData; 421 response.Value = responseData;
422 return response; 422 return response;
423 } 423 }
424 424
425 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) 425 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
426 { 426 {
427 int xmin=980, ymin=980, xmax=1020, ymax=1020; 427 int xmin=980, ymin=980, xmax=1020, ymax=1020;
428 428
429 Hashtable requestData = (Hashtable)request.Params[0]; 429 Hashtable requestData = (Hashtable)request.Params[0];
430 if (requestData.ContainsKey("xmin")) 430 if (requestData.ContainsKey("xmin"))
431 { 431 {
432 xmin = (Int32)requestData["xmin"]; 432 xmin = (Int32)requestData["xmin"];
433 } 433 }
434 if (requestData.ContainsKey("ymin")) 434 if (requestData.ContainsKey("ymin"))
435 { 435 {
436 ymin = (Int32)requestData["ymin"]; 436 ymin = (Int32)requestData["ymin"];
437 } 437 }
438 if (requestData.ContainsKey("xmax")) 438 if (requestData.ContainsKey("xmax"))
439 { 439 {
440 xmax = (Int32)requestData["xmax"]; 440 xmax = (Int32)requestData["xmax"];
441 } 441 }
442 if (requestData.ContainsKey("ymax")) 442 if (requestData.ContainsKey("ymax"))
443 { 443 {
444 ymax = (Int32)requestData["ymax"]; 444 ymax = (Int32)requestData["ymax"];
445 } 445 }
446 446
447 XmlRpcResponse response = new XmlRpcResponse(); 447 XmlRpcResponse response = new XmlRpcResponse();
448 Hashtable responseData = new Hashtable(); 448 Hashtable responseData = new Hashtable();
449 response.Value = responseData; 449 response.Value = responseData;
450 IList simProfileList = new ArrayList(); 450 IList simProfileList = new ArrayList();
451 451
452 bool fastMode = false; // MySQL Only 452 bool fastMode = false; // MySQL Only
453 453
454 if (fastMode) 454 if (fastMode)
455 { 455 {
456 Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); 456 Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
457 457
458 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) 458 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
459 { 459 {
460 Hashtable simProfileBlock = new Hashtable(); 460 Hashtable simProfileBlock = new Hashtable();
461 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 461 simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
462 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 462 simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
463 System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); 463 System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString());
464 simProfileBlock["name"] = aSim.Value.regionName; 464 simProfileBlock["name"] = aSim.Value.regionName;
465 simProfileBlock["access"] = 21; 465 simProfileBlock["access"] = 21;
466 simProfileBlock["region-flags"] = 512; 466 simProfileBlock["region-flags"] = 512;
467 simProfileBlock["water-height"] = 0; 467 simProfileBlock["water-height"] = 0;
468 simProfileBlock["agents"] = 1; 468 simProfileBlock["agents"] = 1;
469 simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); 469 simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString();
470 470
471 // For Sugilite compatibility 471 // For Sugilite compatibility
472 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); 472 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
473 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); 473 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
474 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); 474 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
475 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); 475 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
476 simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated(); 476 simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated();
477 477
478 simProfileList.Add(simProfileBlock); 478 simProfileList.Add(simProfileBlock);
479 } 479 }
480 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); 480 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode");
481 } 481 }
482 else 482 else
483 { 483 {
484 SimProfileData simProfile; 484 SimProfileData simProfile;
485 for (int x = xmin; x < xmax+1; x++) 485 for (int x = xmin; x < xmax+1; x++)
486 { 486 {
487 for (int y = ymin; y < ymax+1; y++) 487 for (int y = ymin; y < ymax+1; y++)
488 { 488 {
489 ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); 489 ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256));
490 simProfile = getRegion(regHandle); 490 simProfile = getRegion(regHandle);
491 if (simProfile != null) 491 if (simProfile != null)
492 { 492 {
493 Hashtable simProfileBlock = new Hashtable(); 493 Hashtable simProfileBlock = new Hashtable();
494 simProfileBlock["x"] = x; 494 simProfileBlock["x"] = x;
495 simProfileBlock["y"] = y; 495 simProfileBlock["y"] = y;
496 simProfileBlock["name"] = simProfile.regionName; 496 simProfileBlock["name"] = simProfile.regionName;
497 simProfileBlock["access"] = 0; 497 simProfileBlock["access"] = 0;
498 simProfileBlock["region-flags"] = 0; 498 simProfileBlock["region-flags"] = 0;
499 simProfileBlock["water-height"] = 20; 499 simProfileBlock["water-height"] = 20;
500 simProfileBlock["agents"] = 1; 500 simProfileBlock["agents"] = 1;
501 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated(); 501 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated();
502 502
503 // For Sugilite compatibility 503 // For Sugilite compatibility
504 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); 504 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
505 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); 505 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
506 simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); 506 simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
507 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); 507 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
508 simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated(); 508 simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated();
509 509
510 simProfileList.Add(simProfileBlock); 510 simProfileList.Add(simProfileBlock);
511 } 511 }
512 } 512 }
513 } 513 }
514 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); 514 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode");
515 } 515 }
516 516
517 responseData["sim-profiles"] = simProfileList; 517 responseData["sim-profiles"] = simProfileList;
518 518
519 return response; 519 return response;
520 } 520 }
521 521
522 522
523 523
524 /// <summary> 524 /// <summary>
525 /// Performs a REST Get Operation 525 /// Performs a REST Get Operation
526 /// </summary> 526 /// </summary>
527 /// <param name="request"></param> 527 /// <param name="request"></param>
528 /// <param name="path"></param> 528 /// <param name="path"></param>
529 /// <param name="param"></param> 529 /// <param name="param"></param>
530 /// <returns></returns> 530 /// <returns></returns>
531 public string RestGetRegionMethod(string request, string path, string param) 531 public string RestGetRegionMethod(string request, string path, string param)
532 { 532 {
533 return RestGetSimMethod("", "/sims/", param); 533 return RestGetSimMethod("", "/sims/", param);
534 } 534 }
535 535
536 /// <summary> 536 /// <summary>
537 /// Performs a REST Set Operation 537 /// Performs a REST Set Operation
538 /// </summary> 538 /// </summary>
539 /// <param name="request"></param> 539 /// <param name="request"></param>
540 /// <param name="path"></param> 540 /// <param name="path"></param>
541 /// <param name="param"></param> 541 /// <param name="param"></param>
542 /// <returns></returns> 542 /// <returns></returns>
543 public string RestSetRegionMethod(string request, string path, string param) 543 public string RestSetRegionMethod(string request, string path, string param)
544 { 544 {
545 return RestSetSimMethod("", "/sims/", param); 545 return RestSetSimMethod("", "/sims/", param);
546 } 546 }
547 547
548 /// <summary> 548 /// <summary>
549 /// Returns information about a sim via a REST Request 549 /// Returns information about a sim via a REST Request
550 /// </summary> 550 /// </summary>
551 /// <param name="request"></param> 551 /// <param name="request"></param>
552 /// <param name="path"></param> 552 /// <param name="path"></param>
553 /// <param name="param"></param> 553 /// <param name="param"></param>
554 /// <returns>Information about the sim in XML</returns> 554 /// <returns>Information about the sim in XML</returns>
555 public string RestGetSimMethod(string request, string path, string param) 555 public string RestGetSimMethod(string request, string path, string param)
556 { 556 {
557 string respstring = String.Empty; 557 string respstring = String.Empty;
558 558
559 SimProfileData TheSim; 559 SimProfileData TheSim;
560 LLUUID UUID = new LLUUID(param); 560 LLUUID UUID = new LLUUID(param);
561 TheSim = getRegion(UUID); 561 TheSim = getRegion(UUID);
562 562
563 if (!(TheSim == null)) 563 if (!(TheSim == null))
564 { 564 {
565 respstring = "<Root>"; 565 respstring = "<Root>";
566 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; 566 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
567 respstring += "<sim>"; 567 respstring += "<sim>";
568 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; 568 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
569 respstring += "<regionname>" + TheSim.regionName + "</regionname>"; 569 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
570 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; 570 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>";
571 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; 571 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
572 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; 572 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
573 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; 573 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
574 respstring += "<estate_id>1</estate_id>"; 574 respstring += "<estate_id>1</estate_id>";
575 respstring += "</sim>"; 575 respstring += "</sim>";
576 respstring += "</Root>"; 576 respstring += "</Root>";
577 } 577 }
578 578
579 return respstring; 579 return respstring;
580 } 580 }
581 581
582 /// <summary> 582 /// <summary>
583 /// Creates or updates a sim via a REST Method Request 583 /// Creates or updates a sim via a REST Method Request
584 /// BROKEN with SQL Update 584 /// BROKEN with SQL Update
585 /// </summary> 585 /// </summary>
586 /// <param name="request"></param> 586 /// <param name="request"></param>
587 /// <param name="path"></param> 587 /// <param name="path"></param>
588 /// <param name="param"></param> 588 /// <param name="param"></param>
589 /// <returns>"OK" or an error</returns> 589 /// <returns>"OK" or an error</returns>
590 public string RestSetSimMethod(string request, string path, string param) 590 public string RestSetSimMethod(string request, string path, string param)
591 { 591 {
592 Console.WriteLine("Processing region update via REST method"); 592 Console.WriteLine("Processing region update via REST method");
593 SimProfileData TheSim; 593 SimProfileData TheSim;
594 TheSim = getRegion(new LLUUID(param)); 594 TheSim = getRegion(new LLUUID(param));
595 if ((TheSim) == null) 595 if ((TheSim) == null)
596 { 596 {
597 TheSim = new SimProfileData(); 597 TheSim = new SimProfileData();
598 LLUUID UUID = new LLUUID(param); 598 LLUUID UUID = new LLUUID(param);
599 TheSim.UUID = UUID; 599 TheSim.UUID = UUID;
600 TheSim.regionRecvKey = config.SimRecvKey; 600 TheSim.regionRecvKey = config.SimRecvKey;
601 } 601 }
602 602
603 XmlDocument doc = new XmlDocument(); 603 XmlDocument doc = new XmlDocument();
604 doc.LoadXml(request); 604 doc.LoadXml(request);
605 XmlNode rootnode = doc.FirstChild; 605 XmlNode rootnode = doc.FirstChild;
606 XmlNode authkeynode = rootnode.ChildNodes[0]; 606 XmlNode authkeynode = rootnode.ChildNodes[0];
607 if (authkeynode.Name != "authkey") 607 if (authkeynode.Name != "authkey")
608 { 608 {
609 return "ERROR! bad XML - expected authkey tag"; 609 return "ERROR! bad XML - expected authkey tag";
610 } 610 }
611 611
612 XmlNode simnode = rootnode.ChildNodes[1]; 612 XmlNode simnode = rootnode.ChildNodes[1];
613 if (simnode.Name != "sim") 613 if (simnode.Name != "sim")
614 { 614 {
615 return "ERROR! bad XML - expected sim tag"; 615 return "ERROR! bad XML - expected sim tag";
616 } 616 }
617 617
618 //TheSim.regionSendKey = Cfg; 618 //TheSim.regionSendKey = Cfg;
619 TheSim.regionRecvKey = config.SimRecvKey; 619 TheSim.regionRecvKey = config.SimRecvKey;
620 TheSim.regionSendKey = config.SimSendKey; 620 TheSim.regionSendKey = config.SimSendKey;
621 TheSim.regionSecret = config.SimRecvKey; 621 TheSim.regionSecret = config.SimRecvKey;
622 TheSim.regionDataURI = ""; 622 TheSim.regionDataURI = "";
623 TheSim.regionAssetURI = config.DefaultAssetServer; 623 TheSim.regionAssetURI = config.DefaultAssetServer;
624 TheSim.regionAssetRecvKey = config.AssetRecvKey; 624 TheSim.regionAssetRecvKey = config.AssetRecvKey;
625 TheSim.regionAssetSendKey = config.AssetSendKey; 625 TheSim.regionAssetSendKey = config.AssetSendKey;
626 TheSim.regionUserURI = config.DefaultUserServer; 626 TheSim.regionUserURI = config.DefaultUserServer;
627 TheSim.regionUserSendKey = config.UserSendKey; 627 TheSim.regionUserSendKey = config.UserSendKey;
628 TheSim.regionUserRecvKey = config.UserRecvKey; 628 TheSim.regionUserRecvKey = config.UserRecvKey;
629 629
630 630
631 for (int i = 0; i < simnode.ChildNodes.Count; i++) 631 for (int i = 0; i < simnode.ChildNodes.Count; i++)
632 { 632 {
633 switch (simnode.ChildNodes[i].Name) 633 switch (simnode.ChildNodes[i].Name)
634 { 634 {
635 case "regionname": 635 case "regionname":
636 TheSim.regionName = simnode.ChildNodes[i].InnerText; 636 TheSim.regionName = simnode.ChildNodes[i].InnerText;
637 break; 637 break;
638 638
639 case "sim_ip": 639 case "sim_ip":
640 TheSim.serverIP = simnode.ChildNodes[i].InnerText; 640 TheSim.serverIP = simnode.ChildNodes[i].InnerText;
641 break; 641 break;
642 642
643 case "sim_port": 643 case "sim_port":
644 TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); 644 TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
645 break; 645 break;
646 646
647 case "region_locx": 647 case "region_locx":
648 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 648 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
649 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 649 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
650 break; 650 break;
651 651
652 case "region_locy": 652 case "region_locy":
653 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 653 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
654 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 654 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
655 break; 655 break;
656 } 656 }
657 } 657 }
658 658
659 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; 659 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
660 660
661 bool requirePublic = false; 661 bool requirePublic = false;
662 bool requireValid = true; 662 bool requireValid = true;
663 663
664 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) 664 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
665 { 665 {
666 return "ERROR! Servers must register with public addresses."; 666 return "ERROR! Servers must register with public addresses.";
667 } 667 }
668 668
669 if (requireValid && (TheSim.serverIP.StartsWith("0."))) 669 if (requireValid && (TheSim.serverIP.StartsWith("0.")))
670 { 670 {
671 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; 671 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
672 } 672 }
673 673
674 674
675 try 675 try
676 { 676 {
677 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); 677 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
678 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 678 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
679 { 679 {
680 try 680 try
681 { 681 {
682 //Check reservations 682 //Check reservations
683 ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); 683 ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY);
684 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) 684 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
685 { 685 {
686 kvp.Value.AddProfile(TheSim); 686 kvp.Value.AddProfile(TheSim);
687 MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); 687 MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")");
688 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); 688 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid.");
689 } 689 }
690 else 690 else
691 { 691 {
692 MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); 692 MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
693 return "Unable to update region (RestSetSimMethod): Incorrect auth key."; 693 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
694 } 694 }
695 } 695 }
696 catch (Exception e) 696 catch (Exception e)
697 { 697 {
698 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); 698 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString());
699 } 699 }
700 } 700 }
701 return "OK"; 701 return "OK";
702 } 702 }
703 catch (Exception e) 703 catch (Exception e)
704 { 704 {
705 return "ERROR! Could not save to database! (" + e.ToString() + ")"; 705 return "ERROR! Could not save to database! (" + e.ToString() + ")";
706 } 706 }
707 } 707 }
708 708
709 } 709 }
710} 710}
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index dc5e4fa..09aeab5 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -1,258 +1,258 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using System.Timers; 32using System.Timers;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.GenericConfig; 36using OpenSim.GenericConfig;
37using Timer=System.Timers.Timer; 37using Timer=System.Timers.Timer;
38 38
39namespace OpenSim.Grid.GridServer 39namespace OpenSim.Grid.GridServer
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// </summary> 42 /// </summary>
43 public class OpenGrid_Main : conscmd_callback 43 public class OpenGrid_Main : conscmd_callback
44 { 44 {
45 private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll"; 45 private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll";
46 private string GridDll = "OpenSim.Framework.Data.MySQL.dll"; 46 private string GridDll = "OpenSim.Framework.Data.MySQL.dll";
47 public GridConfig Cfg; 47 public GridConfig Cfg;
48 48
49 public static OpenGrid_Main thegrid; 49 public static OpenGrid_Main thegrid;
50 protected IGenericConfig localXMLConfig; 50 protected IGenericConfig localXMLConfig;
51 51
52 public static bool setuponly; 52 public static bool setuponly;
53 53
54 //public LLUUID highestUUID; 54 //public LLUUID highestUUID;
55 55
56 // private SimProfileManager m_simProfileManager; 56 // private SimProfileManager m_simProfileManager;
57 57
58 private GridManager m_gridManager; 58 private GridManager m_gridManager;
59 59
60 private LogBase m_console; 60 private LogBase m_console;
61 61
62 [STAThread] 62 [STAThread]
63 public static void Main(string[] args) 63 public static void Main(string[] args)
64 { 64 {
65 if (args.Length > 0) 65 if (args.Length > 0)
66 { 66 {
67 if (args[0] == "-setuponly") setuponly = true; 67 if (args[0] == "-setuponly") setuponly = true;
68 } 68 }
69 Console.WriteLine("Starting...\n"); 69 Console.WriteLine("Starting...\n");
70 70
71 thegrid = new OpenGrid_Main(); 71 thegrid = new OpenGrid_Main();
72 thegrid.Startup(); 72 thegrid.Startup();
73 73
74 thegrid.Work(); 74 thegrid.Work();
75 } 75 }
76 76
77 private void Work() 77 private void Work()
78 { 78 {
79 m_console.Notice("Enter help for a list of commands\n"); 79 m_console.Notice("Enter help for a list of commands\n");
80 80
81 while (true) 81 while (true)
82 { 82 {
83 m_console.MainLogPrompt(); 83 m_console.MainLogPrompt();
84 } 84 }
85 } 85 }
86 86
87 private OpenGrid_Main() 87 private OpenGrid_Main()
88 { 88 {
89 m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); 89 m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
90 MainLog.Instance = m_console; 90 MainLog.Instance = m_console;
91 91
92 92
93 } 93 }
94 94
95 public void managercallback(string cmd) 95 public void managercallback(string cmd)
96 { 96 {
97 switch (cmd) 97 switch (cmd)
98 { 98 {
99 case "shutdown": 99 case "shutdown":
100 RunCmd("shutdown", new string[0]); 100 RunCmd("shutdown", new string[0]);
101 break; 101 break;
102 } 102 }
103 } 103 }
104 104
105 105
106 public void Startup() 106 public void Startup()
107 { 107 {
108 this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); 108 this.localXMLConfig = new XmlConfig("GridServerConfig.xml");
109 this.localXMLConfig.LoadData(); 109 this.localXMLConfig.LoadData();
110 this.ConfigDB(this.localXMLConfig); 110 this.ConfigDB(this.localXMLConfig);
111 this.localXMLConfig.Close(); 111 this.localXMLConfig.Close();
112 112
113 m_console.Verbose( "Main.cs:Startup() - Loading configuration"); 113 m_console.Verbose( "Main.cs:Startup() - Loading configuration");
114 Cfg = this.LoadConfigDll(this.ConfigDll); 114 Cfg = this.LoadConfigDll(this.ConfigDll);
115 Cfg.InitConfig(); 115 Cfg.InitConfig();
116 if (setuponly) Environment.Exit(0); 116 if (setuponly) Environment.Exit(0);
117 117
118 m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); 118 m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server");
119 m_gridManager = new GridManager(); 119 m_gridManager = new GridManager();
120 m_gridManager.AddPlugin(GridDll); // Made of win 120 m_gridManager.AddPlugin(GridDll); // Made of win
121 m_gridManager.config = Cfg; 121 m_gridManager.config = Cfg;
122 122
123 m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); 123 m_console.Verbose( "Main.cs:Startup() - Starting HTTP process");
124 BaseHttpServer httpServer = new BaseHttpServer(8001); 124 BaseHttpServer httpServer = new BaseHttpServer(8001);
125 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 125 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
126 126
127 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); 127 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
128 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); 128 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod);
129 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); 129 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
130 130
131 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); 131 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod ));
132 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); 132 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod ));
133 133
134 httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); 134 httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod ));
135 httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); 135 httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod ));
136 136
137 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); 137 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
138 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); 138 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
139 //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); 139 //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
140 //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); 140 //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
141 141
142 httpServer.Start(); 142 httpServer.Start();
143 143
144 m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); 144 m_console.Verbose( "Main.cs:Startup() - Starting sim status checker");
145 145
146 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 146 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
147 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 147 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
148 simCheckTimer.Enabled = true; 148 simCheckTimer.Enabled = true;
149 } 149 }
150 150
151 private GridConfig LoadConfigDll(string dllName) 151 private GridConfig LoadConfigDll(string dllName)
152 { 152 {
153 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 153 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
154 GridConfig config = null; 154 GridConfig config = null;
155 155
156 foreach (Type pluginType in pluginAssembly.GetTypes()) 156 foreach (Type pluginType in pluginAssembly.GetTypes())
157 { 157 {
158 if (pluginType.IsPublic) 158 if (pluginType.IsPublic)
159 { 159 {
160 if (!pluginType.IsAbstract) 160 if (!pluginType.IsAbstract)
161 { 161 {
162 Type typeInterface = pluginType.GetInterface("IGridConfig", true); 162 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
163 163
164 if (typeInterface != null) 164 if (typeInterface != null)
165 { 165 {
166 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 166 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
167 config = plug.GetConfigObject(); 167 config = plug.GetConfigObject();
168 break; 168 break;
169 } 169 }
170 170
171 typeInterface = null; 171 typeInterface = null;
172 } 172 }
173 } 173 }
174 } 174 }
175 pluginAssembly = null; 175 pluginAssembly = null;
176 return config; 176 return config;
177 } 177 }
178 178
179 public void CheckSims(object sender, ElapsedEventArgs e) 179 public void CheckSims(object sender, ElapsedEventArgs e)
180 { 180 {
181 /* 181 /*
182 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) 182 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
183 { 183 {
184 string SimResponse = ""; 184 string SimResponse = "";
185 try 185 try
186 { 186 {
187 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); 187 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
188 CheckSim.Method = "GET"; 188 CheckSim.Method = "GET";
189 CheckSim.ContentType = "text/plaintext"; 189 CheckSim.ContentType = "text/plaintext";
190 CheckSim.ContentLength = 0; 190 CheckSim.ContentLength = 0;
191 191
192 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); 192 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
193 stOut.Write(""); 193 stOut.Write("");
194 stOut.Close(); 194 stOut.Close();
195 195
196 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); 196 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
197 SimResponse = stIn.ReadToEnd(); 197 SimResponse = stIn.ReadToEnd();
198 stIn.Close(); 198 stIn.Close();
199 } 199 }
200 catch 200 catch
201 { 201 {
202 } 202 }
203 203
204 if (SimResponse == "OK") 204 if (SimResponse == "OK")
205 { 205 {
206 m_simProfileManager.SimProfiles[sim.UUID].online = true; 206 m_simProfileManager.SimProfiles[sim.UUID].online = true;
207 } 207 }
208 else 208 else
209 { 209 {
210 m_simProfileManager.SimProfiles[sim.UUID].online = false; 210 m_simProfileManager.SimProfiles[sim.UUID].online = false;
211 } 211 }
212 } 212 }
213 */ 213 */
214 } 214 }
215 215
216 public void RunCmd(string cmd, string[] cmdparams) 216 public void RunCmd(string cmd, string[] cmdparams)
217 { 217 {
218 switch (cmd) 218 switch (cmd)
219 { 219 {
220 case "help": 220 case "help":
221 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); 221 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
222 break; 222 break;
223 223
224 case "shutdown": 224 case "shutdown":
225 m_console.Close(); 225 m_console.Close();
226 Environment.Exit(0); 226 Environment.Exit(0);
227 break; 227 break;
228 } 228 }
229 } 229 }
230 230
231 public void Show(string ShowWhat) 231 public void Show(string ShowWhat)
232 { 232 {
233 } 233 }
234 234
235 private void ConfigDB(IGenericConfig configData) 235 private void ConfigDB(IGenericConfig configData)
236 { 236 {
237 try 237 try
238 { 238 {
239 string attri = ""; 239 string attri = "";
240 attri = configData.GetAttribute("DataBaseProvider"); 240 attri = configData.GetAttribute("DataBaseProvider");
241 if (attri == "") 241 if (attri == "")
242 { 242 {
243 GridDll = "OpenSim.Framework.Data.DB4o.dll"; 243 GridDll = "OpenSim.Framework.Data.DB4o.dll";
244 configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); 244 configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
245 } 245 }
246 else 246 else
247 { 247 {
248 GridDll = attri; 248 GridDll = attri;
249 } 249 }
250 configData.Commit(); 250 configData.Commit();
251 } 251 }
252 catch 252 catch
253 { 253 {
254 254
255 } 255 }
256 } 256 }
257 } 257 }
258} 258}
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 62a68a8..1eeac93 100644
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
@@ -1,58 +1,58 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OGS-GridServer")] 33[assembly: AssemblyTitle("OGS-GridServer")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OGS-GridServer")] 37[assembly: AssemblyProduct("OGS-GridServer")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57[assembly: AssemblyVersion("1.0.0.0")] 57[assembly: AssemblyVersion("1.0.0.0")]
58[assembly: AssemblyFileVersion("1.0.0.0")] 58[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index 9ca9b5e..0685088 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -1,125 +1,125 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenGrid.Framework.Data; 32using OpenGrid.Framework.Data;
33using libsecondlife; 33using libsecondlife;
34using System.Reflection; 34using System.Reflection;
35 35
36using System.Xml; 36using System.Xml;
37using Nwc.XmlRpc; 37using Nwc.XmlRpc;
38using OpenSim.Framework.Sims; 38using OpenSim.Framework.Sims;
39using OpenSim.Framework.Inventory; 39using OpenSim.Framework.Inventory;
40using OpenSim.Framework.Utilities; 40using OpenSim.Framework.Utilities;
41 41
42using System.Security.Cryptography; 42using System.Security.Cryptography;
43 43
44namespace OpenGridServices.InventoryServer 44namespace OpenGridServices.InventoryServer
45{ 45{
46 class InventoryManager 46 class InventoryManager
47 { 47 {
48 Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); 48 Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
49 49
50 /// <summary> 50 /// <summary>
51 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. 51 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
52 /// </summary> 52 /// </summary>
53 /// <param name="FileName">The filename to the inventory server plugin DLL</param> 53 /// <param name="FileName">The filename to the inventory server plugin DLL</param>
54 public void AddPlugin(string FileName) 54 public void AddPlugin(string FileName)
55 { 55 {
56 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName); 56 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName);
57 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 57 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
58 58
59 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 59 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
60 foreach (Type pluginType in pluginAssembly.GetTypes()) 60 foreach (Type pluginType in pluginAssembly.GetTypes())
61 { 61 {
62 if (!pluginType.IsAbstract) 62 if (!pluginType.IsAbstract)
63 { 63 {
64 Type typeInterface = pluginType.GetInterface("IInventoryData", true); 64 Type typeInterface = pluginType.GetInterface("IInventoryData", true);
65 65
66 if (typeInterface != null) 66 if (typeInterface != null)
67 { 67 {
68 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
69 plug.Initialise(); 69 plug.Initialise();
70 this._plugins.Add(plug.getName(), plug); 70 this._plugins.Add(plug.getName(), plug);
71 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface"); 71 OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface");
72 } 72 }
73 73
74 typeInterface = null; 74 typeInterface = null;
75 } 75 }
76 } 76 }
77 77
78 pluginAssembly = null; 78 pluginAssembly = null;
79 } 79 }
80 80
81 public List<InventoryFolderBase> getRootFolders(LLUUID user) 81 public List<InventoryFolderBase> getRootFolders(LLUUID user)
82 { 82 {
83 foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) 83 foreach (KeyValuePair<string, IInventoryData> kvp in _plugins)
84 { 84 {
85 try 85 try
86 { 86 {
87 return kvp.Value.getUserRootFolders(user); 87 return kvp.Value.getUserRootFolders(user);
88 } 88 }
89 catch (Exception e) 89 catch (Exception e)
90 { 90 {
91 OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); 91 OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
92 } 92 }
93 } 93 }
94 return null; 94 return null;
95 } 95 }
96 96
97 public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) 97 public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
98 { 98 {
99 XmlRpcResponse response = new XmlRpcResponse(); 99 XmlRpcResponse response = new XmlRpcResponse();
100 Hashtable requestData = (Hashtable)request.Params[0]; 100 Hashtable requestData = (Hashtable)request.Params[0];
101 101
102 Hashtable responseData = new Hashtable(); 102 Hashtable responseData = new Hashtable();
103 103
104 // Stuff happens here 104 // Stuff happens here
105 105
106 if (requestData.ContainsKey("Access-type")) 106 if (requestData.ContainsKey("Access-type"))
107 { 107 {
108 if (requestData["access-type"] == "rootfolders") 108 if (requestData["access-type"] == "rootfolders")
109 { 109 {
110// responseData["rootfolders"] = 110// responseData["rootfolders"] =
111 } 111 }
112 } 112 }
113 else 113 else
114 { 114 {
115 responseData["error"] = "No access-type specified."; 115 responseData["error"] = "No access-type specified.";
116 } 116 }
117 117
118 118
119 // Stuff stops happening here 119 // Stuff stops happening here
120 120
121 response.Value = responseData; 121 response.Value = responseData;
122 return response; 122 return response;
123 } 123 }
124 } 124 }
125} 125}
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index f479a79..e1276a9 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -1,87 +1,87 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.IO; 32using System.IO;
33using System.Text; 33using System.Text;
34using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework.User; 35using OpenSim.Framework.User;
36using OpenSim.Framework.Sims; 36using OpenSim.Framework.Sims;
37using OpenSim.Framework.Inventory; 37using OpenSim.Framework.Inventory;
38using OpenSim.Framework.Interfaces; 38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40using OpenSim.Servers; 40using OpenSim.Servers;
41using OpenSim.Framework.Utilities; 41using OpenSim.Framework.Utilities;
42 42
43namespace OpenGridServices.InventoryServer 43namespace OpenGridServices.InventoryServer
44{ 44{
45 public class OpenInventory_Main : BaseServer, conscmd_callback 45 public class OpenInventory_Main : BaseServer, conscmd_callback
46 { 46 {
47 ConsoleBase m_console; 47 ConsoleBase m_console;
48 InventoryManager m_inventoryManager; 48 InventoryManager m_inventoryManager;
49 49
50 public static void Main(string[] args) 50 public static void Main(string[] args)
51 { 51 {
52 } 52 }
53 53
54 public OpenInventory_Main() 54 public OpenInventory_Main()
55 { 55 {
56 m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); 56 m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
57 MainConsole.Instance = m_console; 57 MainConsole.Instance = m_console;
58 } 58 }
59 59
60 public void Startup() 60 public void Startup()
61 { 61 {
62 MainConsole.Instance.Notice("Initialising inventory manager..."); 62 MainConsole.Instance.Notice("Initialising inventory manager...");
63 m_inventoryManager = new InventoryManager(); 63 m_inventoryManager = new InventoryManager();
64 64
65 MainConsole.Instance.Notice("Starting HTTP server"); 65 MainConsole.Instance.Notice("Starting HTTP server");
66 BaseHttpServer httpServer = new BaseHttpServer(8004); 66 BaseHttpServer httpServer = new BaseHttpServer(8004);
67 67
68 httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); 68 httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
69 //httpServer.AddRestHandler("GET","/rootfolders/",Rest 69 //httpServer.AddRestHandler("GET","/rootfolders/",Rest
70 } 70 }
71 71
72 public void RunCmd(string cmd, string[] cmdparams) 72 public void RunCmd(string cmd, string[] cmdparams)
73 { 73 {
74 switch (cmd) 74 switch (cmd)
75 { 75 {
76 case "shutdown": 76 case "shutdown":
77 m_console.Close(); 77 m_console.Close();
78 Environment.Exit(0); 78 Environment.Exit(0);
79 break; 79 break;
80 } 80 }
81 } 81 }
82 82
83 public void Show(string ShowWhat) 83 public void Show(string ShowWhat)
84 { 84 {
85 } 85 }
86 } 86 }
87} 87}
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
index 83685fc..be47385 100644
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
+++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
@@ -1,33 +1,33 @@
1using System; 1using System;
2using System.Threading; 2using System.Threading;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5 5
6namespace OpenGridServices.Manager 6namespace OpenGridServices.Manager
7{ 7{
8 public class BlockingQueue<T> 8 public class BlockingQueue<T>
9 { 9 {
10 private Queue<T> _queue = new Queue<T>(); 10 private Queue<T> _queue = new Queue<T>();
11 private object _queueSync = new object(); 11 private object _queueSync = new object();
12 12
13 public void Enqueue(T value) 13 public void Enqueue(T value)
14 { 14 {
15 lock (_queueSync) 15 lock (_queueSync)
16 { 16 {
17 _queue.Enqueue(value); 17 _queue.Enqueue(value);
18 Monitor.Pulse(_queueSync); 18 Monitor.Pulse(_queueSync);
19 } 19 }
20 } 20 }
21 21
22 public T Dequeue() 22 public T Dequeue()
23 { 23 {
24 lock (_queueSync) 24 lock (_queueSync)
25 { 25 {
26 if (_queue.Count < 1) 26 if (_queue.Count < 1)
27 Monitor.Wait(_queueSync); 27 Monitor.Wait(_queueSync);
28 28
29 return _queue.Dequeue(); 29 return _queue.Dequeue();
30 } 30 }
31 } 31 }
32 } 32 }
33} 33}
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs
index 5bf7ff9..5646be4 100644
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs
+++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs
@@ -1,133 +1,133 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6 6
7namespace OpenSim.Framework.Utilities 7namespace OpenSim.Framework.Utilities
8{ 8{
9 public class Util 9 public class Util
10 { 10 {
11 private static Random randomClass = new Random(); 11 private static Random randomClass = new Random();
12 private static uint nextXferID = 5000; 12 private static uint nextXferID = 5000;
13 private static object XferLock = new object(); 13 private static object XferLock = new object();
14 14
15 public static ulong UIntsToLong(uint X, uint Y) 15 public static ulong UIntsToLong(uint X, uint Y)
16 { 16 {
17 return Helpers.UIntsToLong(X, Y); 17 return Helpers.UIntsToLong(X, Y);
18 } 18 }
19 19
20 public static Random RandomClass 20 public static Random RandomClass
21 { 21 {
22 get 22 get
23 { 23 {
24 return randomClass; 24 return randomClass;
25 } 25 }
26 } 26 }
27 27
28 public static uint GetNextXferID() 28 public static uint GetNextXferID()
29 { 29 {
30 uint id = 0; 30 uint id = 0;
31 lock(XferLock) 31 lock(XferLock)
32 { 32 {
33 id = nextXferID; 33 id = nextXferID;
34 nextXferID++; 34 nextXferID++;
35 } 35 }
36 return id; 36 return id;
37 } 37 }
38 38
39 //public static int fast_distance2d(int x, int y) 39 //public static int fast_distance2d(int x, int y)
40 //{ 40 //{
41 // x = System.Math.Abs(x); 41 // x = System.Math.Abs(x);
42 // y = System.Math.Abs(y); 42 // y = System.Math.Abs(y);
43 43
44 // int min = System.Math.Min(x, y); 44 // int min = System.Math.Min(x, y);
45 45
46 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); 46 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
47 //} 47 //}
48 48
49 public static string FieldToString(byte[] bytes) 49 public static string FieldToString(byte[] bytes)
50 { 50 {
51 return FieldToString(bytes, String.Empty); 51 return FieldToString(bytes, String.Empty);
52 } 52 }
53 53
54 /// <summary> 54 /// <summary>
55 /// Convert a variable length field (byte array) to a string, with a 55 /// Convert a variable length field (byte array) to a string, with a
56 /// field name prepended to each line of the output 56 /// field name prepended to each line of the output
57 /// </summary> 57 /// </summary>
58 /// <remarks>If the byte array has unprintable characters in it, a 58 /// <remarks>If the byte array has unprintable characters in it, a
59 /// hex dump will be put in the string instead</remarks> 59 /// hex dump will be put in the string instead</remarks>
60 /// <param name="bytes">The byte array to convert to a string</param> 60 /// <param name="bytes">The byte array to convert to a string</param>
61 /// <param name="fieldName">A field name to prepend to each line of output</param> 61 /// <param name="fieldName">A field name to prepend to each line of output</param>
62 /// <returns>An ASCII string or a string containing a hex dump, minus 62 /// <returns>An ASCII string or a string containing a hex dump, minus
63 /// the null terminator</returns> 63 /// the null terminator</returns>
64 public static string FieldToString(byte[] bytes, string fieldName) 64 public static string FieldToString(byte[] bytes, string fieldName)
65 { 65 {
66 // Check for a common case 66 // Check for a common case
67 if (bytes.Length == 0) return String.Empty; 67 if (bytes.Length == 0) return String.Empty;
68 68
69 StringBuilder output = new StringBuilder(); 69 StringBuilder output = new StringBuilder();
70 bool printable = true; 70 bool printable = true;
71 71
72 for (int i = 0; i < bytes.Length; ++i) 72 for (int i = 0; i < bytes.Length; ++i)
73 { 73 {
74 // Check if there are any unprintable characters in the array 74 // Check if there are any unprintable characters in the array
75 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 75 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
76 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) 76 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
77 { 77 {
78 printable = false; 78 printable = false;
79 break; 79 break;
80 } 80 }
81 } 81 }
82 82
83 if (printable) 83 if (printable)
84 { 84 {
85 if (fieldName.Length > 0) 85 if (fieldName.Length > 0)
86 { 86 {
87 output.Append(fieldName); 87 output.Append(fieldName);
88 output.Append(": "); 88 output.Append(": ");
89 } 89 }
90 90
91 if (bytes[bytes.Length - 1] == 0x00) 91 if (bytes[bytes.Length - 1] == 0x00)
92 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); 92 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
93 else 93 else
94 output.Append(UTF8Encoding.UTF8.GetString(bytes)); 94 output.Append(UTF8Encoding.UTF8.GetString(bytes));
95 } 95 }
96 else 96 else
97 { 97 {
98 for (int i = 0; i < bytes.Length; i += 16) 98 for (int i = 0; i < bytes.Length; i += 16)
99 { 99 {
100 if (i != 0) 100 if (i != 0)
101 output.Append(Environment.NewLine); 101 output.Append(Environment.NewLine);
102 if (fieldName.Length > 0) 102 if (fieldName.Length > 0)
103 { 103 {
104 output.Append(fieldName); 104 output.Append(fieldName);
105 output.Append(": "); 105 output.Append(": ");
106 } 106 }
107 107
108 for (int j = 0; j < 16; j++) 108 for (int j = 0; j < 16; j++)
109 { 109 {
110 if ((i + j) < bytes.Length) 110 if ((i + j) < bytes.Length)
111 output.Append(String.Format("{0:X2} ", bytes[i + j])); 111 output.Append(String.Format("{0:X2} ", bytes[i + j]));
112 else 112 else
113 output.Append(" "); 113 output.Append(" ");
114 } 114 }
115 115
116 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) 116 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
117 { 117 {
118 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) 118 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
119 output.Append((char)bytes[i + j]); 119 output.Append((char)bytes[i + j]);
120 else 120 else
121 output.Append("."); 121 output.Append(".");
122 } 122 }
123 } 123 }
124 } 124 }
125 125
126 return output.ToString(); 126 return output.ToString();
127 } 127 }
128 public Util() 128 public Util()
129 { 129 {
130 130
131 } 131 }
132 } 132 }
133} 133}
diff --git a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs
index 15298e8..885bada 100644
--- a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("UserConfig")] 36[assembly: AssemblyTitle("UserConfig")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("UserConfig")] 40[assembly: AssemblyProduct("UserConfig")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
index c7f8255..170f34b 100644
--- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
+++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
@@ -1,95 +1,95 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31using OpenSim.Framework.Interfaces; 31using OpenSim.Framework.Interfaces;
32 32
33namespace OpenUser.Config.UserConfigDb4o 33namespace OpenUser.Config.UserConfigDb4o
34{ 34{
35 public class Db4oConfigPlugin: IUserConfig 35 public class Db4oConfigPlugin: IUserConfig
36 { 36 {
37 public UserConfig GetConfigObject() 37 public UserConfig GetConfigObject()
38 { 38 {
39 MainLog.Instance.Verbose("Loading Db40Config dll"); 39 MainLog.Instance.Verbose("Loading Db40Config dll");
40 return ( new DbUserConfig()); 40 return ( new DbUserConfig());
41 } 41 }
42 } 42 }
43 43
44 public class DbUserConfig : UserConfig 44 public class DbUserConfig : UserConfig
45 { 45 {
46 private IObjectContainer db; 46 private IObjectContainer db;
47 47
48 public void LoadDefaults() { 48 public void LoadDefaults() {
49 MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 49 MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
50 50
51 this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); 51 this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS");
52 52
53 this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); 53 this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/");
54 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); 54 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null");
55 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); 55 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null");
56 } 56 }
57 57
58 public override void InitConfig() { 58 public override void InitConfig() {
59 try { 59 try {
60 db = Db4oFactory.OpenFile("openuser.yap"); 60 db = Db4oFactory.OpenFile("openuser.yap");
61 IObjectSet result = db.Get(typeof(DbUserConfig)); 61 IObjectSet result = db.Get(typeof(DbUserConfig));
62 if(result.Count==1) { 62 if(result.Count==1) {
63 MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); 63 MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading");
64 foreach (DbUserConfig cfg in result) { 64 foreach (DbUserConfig cfg in result) {
65 this.GridServerURL=cfg.GridServerURL; 65 this.GridServerURL=cfg.GridServerURL;
66 this.GridSendKey=cfg.GridSendKey; 66 this.GridSendKey=cfg.GridSendKey;
67 this.GridRecvKey=cfg.GridRecvKey; 67 this.GridRecvKey=cfg.GridRecvKey;
68 this.DefaultStartupMsg=cfg.DefaultStartupMsg; 68 this.DefaultStartupMsg=cfg.DefaultStartupMsg;
69 } 69 }
70 } else { 70 } else {
71 MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 71 MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
72 LoadDefaults(); 72 LoadDefaults();
73 MainLog.Instance.Verbose("Writing out default settings to local database"); 73 MainLog.Instance.Verbose("Writing out default settings to local database");
74 db.Set(this); 74 db.Set(this);
75 db.Close(); 75 db.Close();
76 } 76 }
77 } catch(Exception e) { 77 } catch(Exception e) {
78 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); 78 MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured");
79 MainLog.Instance.Warn(e.ToString()); 79 MainLog.Instance.Warn(e.ToString());
80 } 80 }
81 81
82 MainLog.Instance.Verbose("User settings loaded:"); 82 MainLog.Instance.Verbose("User settings loaded:");
83 MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); 83 MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg);
84 MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL); 84 MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL);
85 MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey); 85 MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey);
86 MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); 86 MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey);
87 } 87 }
88 88
89 89
90 public void Shutdown() { 90 public void Shutdown() {
91 db.Close(); 91 db.Close();
92 } 92 }
93 } 93 }
94 94
95} 95}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index c792918..9bdf8d7 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -1,214 +1,214 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Framework.User; 36using OpenSim.Framework.User;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38using OpenSim.GenericConfig; 38using OpenSim.GenericConfig;
39 39
40namespace OpenSim.Grid.UserServer 40namespace OpenSim.Grid.UserServer
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// </summary> 43 /// </summary>
44 public class OpenUser_Main : conscmd_callback 44 public class OpenUser_Main : conscmd_callback
45 { 45 {
46 private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; 46 private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll";
47 private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; 47 private string StorageDll = "OpenSim.Framework.Data.MySQL.dll";
48 private UserConfig Cfg; 48 private UserConfig Cfg;
49 protected IGenericConfig localXMLConfig; 49 protected IGenericConfig localXMLConfig;
50 50
51 public UserManager m_userManager; 51 public UserManager m_userManager;
52 52
53 public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); 53 public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
54 54
55 LogBase m_console; 55 LogBase m_console;
56 56
57 [STAThread] 57 [STAThread]
58 public static void Main(string[] args) 58 public static void Main(string[] args)
59 { 59 {
60 Console.WriteLine("Launching UserServer..."); 60 Console.WriteLine("Launching UserServer...");
61 61
62 OpenUser_Main userserver = new OpenUser_Main(); 62 OpenUser_Main userserver = new OpenUser_Main();
63 63
64 userserver.Startup(); 64 userserver.Startup();
65 userserver.Work(); 65 userserver.Work();
66 } 66 }
67 67
68 private OpenUser_Main() 68 private OpenUser_Main()
69 { 69 {
70 m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); 70 m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false);
71 MainLog.Instance = m_console; 71 MainLog.Instance = m_console;
72 } 72 }
73 73
74 private void Work() 74 private void Work()
75 { 75 {
76 m_console.Notice("Enter help for a list of commands\n"); 76 m_console.Notice("Enter help for a list of commands\n");
77 77
78 while (true) 78 while (true)
79 { 79 {
80 m_console.MainLogPrompt(); 80 m_console.MainLogPrompt();
81 } 81 }
82 } 82 }
83 83
84 public void Startup() 84 public void Startup()
85 { 85 {
86 this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); 86 this.localXMLConfig = new XmlConfig("UserServerConfig.xml");
87 this.localXMLConfig.LoadData(); 87 this.localXMLConfig.LoadData();
88 this.ConfigDB(this.localXMLConfig); 88 this.ConfigDB(this.localXMLConfig);
89 this.localXMLConfig.Close(); 89 this.localXMLConfig.Close();
90 90
91 MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); 91 MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration");
92 Cfg = this.LoadConfigDll(this.ConfigDll); 92 Cfg = this.LoadConfigDll(this.ConfigDll);
93 Cfg.InitConfig(); 93 Cfg.InitConfig();
94 94
95 MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); 95 MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection");
96 m_userManager = new UserManager(); 96 m_userManager = new UserManager();
97 m_userManager._config = Cfg; 97 m_userManager._config = Cfg;
98 m_userManager.AddPlugin(StorageDll); 98 m_userManager.AddPlugin(StorageDll);
99 99
100 MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); 100 MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
101 BaseHttpServer httpServer = new BaseHttpServer(8002); 101 BaseHttpServer httpServer = new BaseHttpServer(8002);
102 102
103 httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); 103 httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod);
104 104
105 httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); 105 httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
106 httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); 106 httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
107 107
108 httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); 108 httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod ));
109 109
110 httpServer.Start(); 110 httpServer.Start();
111 m_console.Status("Userserver 0.3 - Startup complete"); 111 m_console.Status("Userserver 0.3 - Startup complete");
112 } 112 }
113 113
114 114
115 public void do_create(string what) 115 public void do_create(string what)
116 { 116 {
117 switch (what) 117 switch (what)
118 { 118 {
119 case "user": 119 case "user":
120 string tempfirstname; 120 string tempfirstname;
121 string templastname; 121 string templastname;
122 string tempMD5Passwd; 122 string tempMD5Passwd;
123 uint regX = 1000; 123 uint regX = 1000;
124 uint regY = 1000; 124 uint regY = 1000;
125 125
126 tempfirstname = m_console.CmdPrompt("First name"); 126 tempfirstname = m_console.CmdPrompt("First name");
127 templastname = m_console.CmdPrompt("Last name"); 127 templastname = m_console.CmdPrompt("Last name");
128 tempMD5Passwd = m_console.PasswdPrompt("Password"); 128 tempMD5Passwd = m_console.PasswdPrompt("Password");
129 regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); 129 regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
130 regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); 130 regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
131 131
132 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 132 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
133 133
134 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 134 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
135 break; 135 break;
136 } 136 }
137 } 137 }
138 138
139 public void RunCmd(string cmd, string[] cmdparams) 139 public void RunCmd(string cmd, string[] cmdparams)
140 { 140 {
141 switch (cmd) 141 switch (cmd)
142 { 142 {
143 case "help": 143 case "help":
144 m_console.Notice("create user - create a new user"); 144 m_console.Notice("create user - create a new user");
145 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); 145 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
146 break; 146 break;
147 147
148 case "create": 148 case "create":
149 do_create(cmdparams[0]); 149 do_create(cmdparams[0]);
150 break; 150 break;
151 151
152 case "shutdown": 152 case "shutdown":
153 m_console.Close(); 153 m_console.Close();
154 Environment.Exit(0); 154 Environment.Exit(0);
155 break; 155 break;
156 } 156 }
157 } 157 }
158 158
159 private void ConfigDB(IGenericConfig configData) 159 private void ConfigDB(IGenericConfig configData)
160 { 160 {
161 try 161 try
162 { 162 {
163 string attri = ""; 163 string attri = "";
164 attri = configData.GetAttribute("DataBaseProvider"); 164 attri = configData.GetAttribute("DataBaseProvider");
165 if (attri == "") 165 if (attri == "")
166 { 166 {
167 StorageDll = "OpenSim.Framework.Data.DB4o.dll"; 167 StorageDll = "OpenSim.Framework.Data.DB4o.dll";
168 configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); 168 configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll");
169 } 169 }
170 else 170 else
171 { 171 {
172 StorageDll = attri; 172 StorageDll = attri;
173 } 173 }
174 configData.Commit(); 174 configData.Commit();
175 } 175 }
176 catch 176 catch
177 { 177 {
178 178
179 } 179 }
180 } 180 }
181 181
182 private UserConfig LoadConfigDll(string dllName) 182 private UserConfig LoadConfigDll(string dllName)
183 { 183 {
184 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 184 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
185 UserConfig config = null; 185 UserConfig config = null;
186 186
187 foreach (Type pluginType in pluginAssembly.GetTypes()) 187 foreach (Type pluginType in pluginAssembly.GetTypes())
188 { 188 {
189 if (pluginType.IsPublic) 189 if (pluginType.IsPublic)
190 { 190 {
191 if (!pluginType.IsAbstract) 191 if (!pluginType.IsAbstract)
192 { 192 {
193 Type typeInterface = pluginType.GetInterface("IUserConfig", true); 193 Type typeInterface = pluginType.GetInterface("IUserConfig", true);
194 194
195 if (typeInterface != null) 195 if (typeInterface != null)
196 { 196 {
197 IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 197 IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
198 config = plug.GetConfigObject(); 198 config = plug.GetConfigObject();
199 break; 199 break;
200 } 200 }
201 201
202 typeInterface = null; 202 typeInterface = null;
203 } 203 }
204 } 204 }
205 } 205 }
206 pluginAssembly = null; 206 pluginAssembly = null;
207 return config; 207 return config;
208 } 208 }
209 209
210 public void Show(string ShowWhat) 210 public void Show(string ShowWhat)
211 { 211 {
212 } 212 }
213 } 213 }
214} 214}
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
index a0a6f3c..877f02f 100644
--- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
@@ -1,31 +1,31 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OGS-UserServer")] 6[assembly: AssemblyTitle("OGS-UserServer")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OGS-UserServer")] 10[assembly: AssemblyProduct("OGS-UserServer")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] 21[assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30[assembly: AssemblyVersion("1.0.0.0")] 30[assembly: AssemblyVersion("1.0.0.0")]
31[assembly: AssemblyFileVersion("1.0.0.0")] 31[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index f5275e2..bb7d673 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -1,100 +1,100 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using Nwc.XmlRpc; 30using Nwc.XmlRpc;
31using OpenSim.Framework.Data; 31using OpenSim.Framework.Data;
32using OpenSim.Framework.UserManagement; 32using OpenSim.Framework.UserManagement;
33using OpenSim.Framework.Utilities; 33using OpenSim.Framework.Utilities;
34 34
35namespace OpenSim.Grid.UserServer 35namespace OpenSim.Grid.UserServer
36{ 36{
37 public class UserManager : UserManagerBase 37 public class UserManager : UserManagerBase
38 { 38 {
39 public UserManager() 39 public UserManager()
40 { 40 {
41 } 41 }
42 42
43 /// <summary> 43 /// <summary>
44 /// Customises the login response and fills in missing values. 44 /// Customises the login response and fills in missing values.
45 /// </summary> 45 /// </summary>
46 /// <param name="response">The existing response</param> 46 /// <param name="response">The existing response</param>
47 /// <param name="theUser">The user profile</param> 47 /// <param name="theUser">The user profile</param>
48 public override void CustomiseResponse( LoginResponse response, UserProfileData theUser) 48 public override void CustomiseResponse( LoginResponse response, UserProfileData theUser)
49 { 49 {
50 // Load information from the gridserver 50 // Load information from the gridserver
51 SimProfileData SimInfo = new SimProfileData(); 51 SimProfileData SimInfo = new SimProfileData();
52 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); 52 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
53 53
54 // Customise the response 54 // Customise the response
55 // Home Location 55 // Home Location
56 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + 56 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
57 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 57 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
58 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 58 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
59 59
60 // Destination 60 // Destination
61 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); 61 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
62 response.SimAddress = SimInfo.serverIP; 62 response.SimAddress = SimInfo.serverIP;
63 response.SimPort = (Int32)SimInfo.serverPort; 63 response.SimPort = (Int32)SimInfo.serverPort;
64 response.RegionX = SimInfo.regionLocX; 64 response.RegionX = SimInfo.regionLocX;
65 response.RegionY = SimInfo.regionLocY; 65 response.RegionY = SimInfo.regionLocY;
66 66
67 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI 67 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
68 string capsPath = Util.GetRandomCapsPath(); 68 string capsPath = Util.GetRandomCapsPath();
69 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; 69 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
70 70
71 // Notify the target of an incoming user 71 // Notify the target of an incoming user
72 Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")"); 72 Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")");
73 73
74 // Prepare notification 74 // Prepare notification
75 Hashtable SimParams = new Hashtable(); 75 Hashtable SimParams = new Hashtable();
76 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); 76 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
77 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); 77 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
78 SimParams["firstname"] = theUser.username; 78 SimParams["firstname"] = theUser.username;
79 SimParams["lastname"] = theUser.surname; 79 SimParams["lastname"] = theUser.surname;
80 SimParams["agent_id"] = theUser.UUID.ToString(); 80 SimParams["agent_id"] = theUser.UUID.ToString();
81 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 81 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
82 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 82 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
83 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 83 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
84 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 84 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
85 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); 85 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
86 SimParams["caps_path"] = capsPath; 86 SimParams["caps_path"] = capsPath;
87 ArrayList SendParams = new ArrayList(); 87 ArrayList SendParams = new ArrayList();
88 SendParams.Add(SimParams); 88 SendParams.Add(SimParams);
89 89
90 // Update agent with target sim 90 // Update agent with target sim
91 theUser.currentAgent.currentRegion = SimInfo.UUID; 91 theUser.currentAgent.currentRegion = SimInfo.UUID;
92 theUser.currentAgent.currentHandle = SimInfo.regionHandle; 92 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
93 93
94 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); 94 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
95 // Send 95 // Send
96 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 96 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
97 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); 97 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000);
98 } 98 }
99 } 99 }
100} 100}
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 10beaff..666be33 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -1,125 +1,125 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim 32namespace OpenSim
33{ 33{
34 public class Application 34 public class Application
35 { 35 {
36 //could move our main function into OpenSimMain and kill this class 36 //could move our main function into OpenSimMain and kill this class
37 [STAThread] 37 [STAThread]
38 public static void Main(string[] args) 38 public static void Main(string[] args)
39 { 39 {
40 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); 40 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
41 Console.WriteLine("Starting...\n"); 41 Console.WriteLine("Starting...\n");
42 42
43 bool sandBoxMode = false; 43 bool sandBoxMode = false;
44 bool startLoginServer = false; 44 bool startLoginServer = false;
45 string physicsEngine = "basicphysics"; 45 string physicsEngine = "basicphysics";
46 bool allowFlying = false; 46 bool allowFlying = false;
47 bool userAccounts = false; 47 bool userAccounts = false;
48 bool gridLocalAsset = false; 48 bool gridLocalAsset = false;
49 bool useConfigFile = false; 49 bool useConfigFile = false;
50 bool silent = false; 50 bool silent = false;
51 string configFile = "simconfig.xml"; 51 string configFile = "simconfig.xml";
52 52
53 for (int i = 0; i < args.Length; i++) 53 for (int i = 0; i < args.Length; i++)
54 { 54 {
55 if (args[i] == "-sandbox") 55 if (args[i] == "-sandbox")
56 { 56 {
57 sandBoxMode = true; 57 sandBoxMode = true;
58 startLoginServer = true; 58 startLoginServer = true;
59 } 59 }
60 /* 60 /*
61 if (args[i] == "-loginserver") 61 if (args[i] == "-loginserver")
62 { 62 {
63 startLoginServer = true; 63 startLoginServer = true;
64 }*/ 64 }*/
65 if (args[i] == "-accounts") 65 if (args[i] == "-accounts")
66 { 66 {
67 userAccounts = true; 67 userAccounts = true;
68 } 68 }
69 if (args[i] == "-realphysx") 69 if (args[i] == "-realphysx")
70 { 70 {
71 physicsEngine = "RealPhysX"; 71 physicsEngine = "RealPhysX";
72 allowFlying = true; 72 allowFlying = true;
73 } 73 }
74 if (args[i] == "-bulletX") 74 if (args[i] == "-bulletX")
75 { 75 {
76 physicsEngine = "BulletXEngine"; 76 physicsEngine = "BulletXEngine";
77 allowFlying = true; 77 allowFlying = true;
78 } 78 }
79 if (args[i] == "-ode") 79 if (args[i] == "-ode")
80 { 80 {
81 physicsEngine = "OpenDynamicsEngine"; 81 physicsEngine = "OpenDynamicsEngine";
82 allowFlying = true; 82 allowFlying = true;
83 } 83 }
84 if (args[i] == "-localasset") 84 if (args[i] == "-localasset")
85 { 85 {
86 gridLocalAsset = true; 86 gridLocalAsset = true;
87 } 87 }
88 if (args[i] == "-configfile") 88 if (args[i] == "-configfile")
89 { 89 {
90 useConfigFile = true; 90 useConfigFile = true;
91 } 91 }
92 if (args[i] == "-noverbose") 92 if (args[i] == "-noverbose")
93 { 93 {
94 silent = true; 94 silent = true;
95 } 95 }
96 if (args[i] == "-config") 96 if (args[i] == "-config")
97 { 97 {
98 try 98 try
99 { 99 {
100 i++; 100 i++;
101 configFile = args[i]; 101 configFile = args[i];
102 } 102 }
103 catch (Exception e) 103 catch (Exception e)
104 { 104 {
105 Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")"); 105 Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")");
106 } 106 }
107 } 107 }
108 } 108 }
109 109
110 OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile); 110 OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile);
111 // OpenSimRoot.Instance.Application = sim; 111 // OpenSimRoot.Instance.Application = sim;
112 sim.m_sandbox = sandBoxMode; 112 sim.m_sandbox = sandBoxMode;
113 sim.user_accounts = userAccounts; 113 sim.user_accounts = userAccounts;
114 sim.gridLocalAsset = gridLocalAsset; 114 sim.gridLocalAsset = gridLocalAsset;
115 ScenePresence.PhysicsEngineFlying = allowFlying; 115 ScenePresence.PhysicsEngineFlying = allowFlying;
116 116
117 sim.StartUp(); 117 sim.StartUp();
118 118
119 while (true) 119 while (true)
120 { 120 {
121 MainLog.Instance.MainLogPrompt(); 121 MainLog.Instance.MainLogPrompt();
122 } 122 }
123 } 123 }
124 } 124 }
125} 125}
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 99164f1..08d7619 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -1,496 +1,496 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Assets; 32using OpenSim.Assets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.GenericConfig; 40using OpenSim.GenericConfig;
41using OpenSim.Physics.Manager; 41using OpenSim.Physics.Manager;
42using OpenSim.Region.Caches; 42using OpenSim.Region.Caches;
43using OpenSim.Region.ClientStack; 43using OpenSim.Region.ClientStack;
44using OpenSim.Region.Communications.Local; 44using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1; 45using OpenSim.Region.Communications.OGS1;
46using OpenSim.Region.Environment.Scenes; 46using OpenSim.Region.Environment.Scenes;
47using OpenSim.Region.Environment; 47using OpenSim.Region.Environment;
48using System.Text; 48using System.Text;
49 49
50namespace OpenSim 50namespace OpenSim
51{ 51{
52 52
53 public class OpenSimMain : RegionApplicationBase, conscmd_callback 53 public class OpenSimMain : RegionApplicationBase, conscmd_callback
54 { 54 {
55 protected CommunicationsManager commsManager; 55 protected CommunicationsManager commsManager;
56 // private CheckSumServer checkServer; 56 // private CheckSumServer checkServer;
57 57
58 private bool m_silent; 58 private bool m_silent;
59 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; 59 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log";
60 60
61 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) 61 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
62 { 62 {
63 this.configFileSetup = useConfigFile; 63 this.configFileSetup = useConfigFile;
64 m_sandbox = sandBoxMode; 64 m_sandbox = sandBoxMode;
65 m_loginserver = startLoginServer; 65 m_loginserver = startLoginServer;
66 m_physicsEngine = physicsEngine; 66 m_physicsEngine = physicsEngine;
67 m_config = configFile; 67 m_config = configFile;
68 m_silent = silent; 68 m_silent = silent;
69 } 69 }
70 70
71 /// <summary> 71 /// <summary>
72 /// Performs initialisation of the world, such as loading configuration from disk. 72 /// Performs initialisation of the world, such as loading configuration from disk.
73 /// </summary> 73 /// </summary>
74 public override void StartUp() 74 public override void StartUp()
75 { 75 {
76 this.serversData = new NetworkServersInfo(); 76 this.serversData = new NetworkServersInfo();
77 77
78 this.localConfig = new XmlConfig(m_config); 78 this.localConfig = new XmlConfig(m_config);
79 this.localConfig.LoadData(); 79 this.localConfig.LoadData();
80 80
81 if (this.configFileSetup) 81 if (this.configFileSetup)
82 { 82 {
83 this.SetupFromConfigFile(this.localConfig); 83 this.SetupFromConfigFile(this.localConfig);
84 } 84 }
85 85
86 m_log = new LogBase(m_logFilename, "Region", this, m_silent); 86 m_log = new LogBase(m_logFilename, "Region", this, m_silent);
87 MainLog.Instance = m_log; 87 MainLog.Instance = m_log;
88 88
89 m_log.Verbose("Main.cs:Startup() - Loading configuration"); 89 m_log.Verbose("Main.cs:Startup() - Loading configuration");
90 this.serversData.InitConfig(this.m_sandbox, this.localConfig); 90 this.serversData.InitConfig(this.m_sandbox, this.localConfig);
91 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change 91 this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
92 92
93 ScenePresence.LoadTextureFile("avatar-texture.dat"); 93 ScenePresence.LoadTextureFile("avatar-texture.dat");
94 94
95 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 95 ClientView.TerrainManager = new TerrainManager(new SecondLife());
96 96
97 this.SetupHttpListener(); 97 this.SetupHttpListener();
98 98
99 if (m_sandbox) 99 if (m_sandbox)
100 { 100 {
101 this.SetupLocalGridServers(); 101 this.SetupLocalGridServers();
102 // this.checkServer = new CheckSumServer(12036); 102 // this.checkServer = new CheckSumServer(12036);
103 // this.checkServer.ServerListener(); 103 // this.checkServer.ServerListener();
104 } 104 }
105 else 105 else
106 { 106 {
107 this.SetupRemoteGridServers(); 107 this.SetupRemoteGridServers();
108 } 108 }
109 109
110 startuptime = DateTime.Now; 110 startuptime = DateTime.Now;
111 111
112 this.physManager = new PhysicsManager(); 112 this.physManager = new PhysicsManager();
113 this.physManager.LoadPlugins(); 113 this.physManager.LoadPlugins();
114 114
115 this.SetupScene(); 115 this.SetupScene();
116 116
117 m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); 117 m_log.Verbose("Main.cs:Startup() - Initialising HTTP server");
118 118
119 //Start http server 119 //Start http server
120 m_log.Verbose("Main.cs:Startup() - Starting HTTP server"); 120 m_log.Verbose("Main.cs:Startup() - Starting HTTP server");
121 httpServer.Start(); 121 httpServer.Start();
122 122
123 // Start UDP servers 123 // Start UDP servers
124 for (int i = 0; i < m_udpServer.Count; i++) 124 for (int i = 0; i < m_udpServer.Count; i++)
125 { 125 {
126 this.m_udpServer[i].ServerListener(); 126 this.m_udpServer[i].ServerListener();
127 } 127 }
128 128
129 } 129 }
130 130
131 # region Setup methods 131 # region Setup methods
132 protected override void SetupLocalGridServers() 132 protected override void SetupLocalGridServers()
133 { 133 {
134 try 134 try
135 { 135 {
136 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); 136 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey);
137 InventoryCache = new InventoryCache(); 137 InventoryCache = new InventoryCache();
138 this.commsManager = new CommunicationsLocal(this.serversData, httpServer); 138 this.commsManager = new CommunicationsLocal(this.serversData, httpServer);
139 } 139 }
140 catch (Exception e) 140 catch (Exception e)
141 { 141 {
142 m_log.Error(e.Message + "\nSorry, could not setup local cache"); 142 m_log.Error(e.Message + "\nSorry, could not setup local cache");
143 Environment.Exit(1); 143 Environment.Exit(1);
144 } 144 }
145 145
146 } 146 }
147 147
148 protected override void SetupRemoteGridServers() 148 protected override void SetupRemoteGridServers()
149 { 149 {
150 try 150 try
151 { 151 {
152 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); 152 AssetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey);
153 InventoryCache = new InventoryCache(); 153 InventoryCache = new InventoryCache();
154 this.commsManager = new CommunicationsOGS1(this.serversData, httpServer); 154 this.commsManager = new CommunicationsOGS1(this.serversData, httpServer);
155 } 155 }
156 catch (Exception e) 156 catch (Exception e)
157 { 157 {
158 m_log.Error(e.Message + "\nSorry, could not setup remote cache"); 158 m_log.Error(e.Message + "\nSorry, could not setup remote cache");
159 Environment.Exit(1); 159 Environment.Exit(1);
160 } 160 }
161 } 161 }
162 162
163 protected override void SetupScene() 163 protected override void SetupScene()
164 { 164 {
165 IGenericConfig regionConfig; 165 IGenericConfig regionConfig;
166 Scene scene; 166 Scene scene;
167 UDPServer udpServer; 167 UDPServer udpServer;
168 RegionInfo regionDat = new RegionInfo(); 168 RegionInfo regionDat = new RegionInfo();
169 AuthenticateSessionsBase authenBase; 169 AuthenticateSessionsBase authenBase;
170 170
171 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); 171 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions");
172 string[] configFiles = Directory.GetFiles(path, "*.xml"); 172 string[] configFiles = Directory.GetFiles(path, "*.xml");
173 173
174 if (configFiles.Length == 0) 174 if (configFiles.Length == 0)
175 { 175 {
176 string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); 176 string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions");
177 string path3 = Path.Combine(path2, "default.xml"); 177 string path3 = Path.Combine(path2, "default.xml");
178 Console.WriteLine("Creating default region config file"); 178 Console.WriteLine("Creating default region config file");
179 //TODO create default region 179 //TODO create default region
180 IGenericConfig defaultConfig = new XmlConfig(path3); 180 IGenericConfig defaultConfig = new XmlConfig(path3);
181 defaultConfig.LoadData(); 181 defaultConfig.LoadData();
182 defaultConfig.Commit(); 182 defaultConfig.Commit();
183 defaultConfig.Close(); 183 defaultConfig.Close();
184 defaultConfig = null; 184 defaultConfig = null;
185 configFiles = Directory.GetFiles(path, "*.xml"); 185 configFiles = Directory.GetFiles(path, "*.xml");
186 } 186 }
187 187
188 for (int i = 0; i < configFiles.Length; i++) 188 for (int i = 0; i < configFiles.Length; i++)
189 { 189 {
190 regionDat = new RegionInfo(); 190 regionDat = new RegionInfo();
191 if (m_sandbox) 191 if (m_sandbox)
192 { 192 {
193 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal(); 193 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); // new AuthenticateSessionsLocal();
194 this.AuthenticateSessionsHandler.Add(authen); 194 this.AuthenticateSessionsHandler.Add(authen);
195 authenBase = authen; 195 authenBase = authen;
196 } 196 }
197 else 197 else
198 { 198 {
199 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); //new AuthenticateSessionsRemote(); 199 AuthenticateSessionsBase authen = new AuthenticateSessionsBase(); //new AuthenticateSessionsRemote();
200 this.AuthenticateSessionsHandler.Add(authen); 200 this.AuthenticateSessionsHandler.Add(authen);
201 authenBase = authen; 201 authenBase = authen;
202 } 202 }
203 Console.WriteLine("Loading region config file"); 203 Console.WriteLine("Loading region config file");
204 regionConfig = new XmlConfig(configFiles[i]); 204 regionConfig = new XmlConfig(configFiles[i]);
205 regionConfig.LoadData(); 205 regionConfig.LoadData();
206 regionDat.InitConfig(this.m_sandbox, regionConfig); 206 regionDat.InitConfig(this.m_sandbox, regionConfig);
207 regionConfig.Close(); 207 regionConfig.Close();
208 208
209 udpServer = new UDPServer(regionDat.InternalEndPoint.Port, this.AssetCache, this.InventoryCache, this.m_log, authenBase); 209 udpServer = new UDPServer(regionDat.InternalEndPoint.Port, this.AssetCache, this.InventoryCache, this.m_log, authenBase);
210 210
211 m_udpServer.Add(udpServer); 211 m_udpServer.Add(udpServer);
212 this.regionData.Add(regionDat); 212 this.regionData.Add(regionDat);
213 213
214 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName); 214 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName);
215 215
216 scene = new Scene( regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer); 216 scene = new Scene( regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer);
217 this.m_localWorld.Add(scene); 217 this.m_localWorld.Add(scene);
218 218
219 udpServer.LocalWorld = scene; 219 udpServer.LocalWorld = scene;
220 220
221 scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. 221 scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
222 scene.LoadWorldMap(); 222 scene.LoadWorldMap();
223 223
224 m_log.Verbose("Main.cs:Startup() - Starting up messaging system"); 224 m_log.Verbose("Main.cs:Startup() - Starting up messaging system");
225 scene.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); 225 scene.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
226 scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D()); 226 scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D());
227 scene.LoadPrimsFromStorage(); 227 scene.LoadPrimsFromStorage();
228 228
229 //Master Avatar Setup 229 //Master Avatar Setup
230 UserProfileData masterAvatar = commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); 230 UserProfileData masterAvatar = commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword);
231 if (masterAvatar != null) 231 if (masterAvatar != null)
232 { 232 {
233 m_log.Notice("Parcels - Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); 233 m_log.Notice("Parcels - Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]");
234 scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; 234 scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
235 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager); 235 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager);
236 } 236 }
237 else 237 else
238 { 238 {
239 m_log.Notice("Parcels - No master avatar found, using null."); 239 m_log.Notice("Parcels - No master avatar found, using null.");
240 scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; 240 scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero;
241 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager); 241 scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager);
242 } 242 }
243 scene.performParcelPrimCountUpdate(); 243 scene.performParcelPrimCountUpdate();
244 scene.StartTimer(); 244 scene.StartTimer();
245 } 245 }
246 } 246 }
247 247
248 private class SimStatusHandler : IStreamHandler 248 private class SimStatusHandler : IStreamHandler
249 { 249 {
250 public byte[] Handle(string path, Stream request) 250 public byte[] Handle(string path, Stream request)
251 { 251 {
252 return Encoding.UTF8.GetBytes("OK"); 252 return Encoding.UTF8.GetBytes("OK");
253 } 253 }
254 254
255 public string ContentType 255 public string ContentType
256 { 256 {
257 get { return "text/plain"; } 257 get { return "text/plain"; }
258 } 258 }
259 259
260 public string HttpMethod 260 public string HttpMethod
261 { 261 {
262 get { return "GET"; } 262 get { return "GET"; }
263 } 263 }
264 264
265 public string Path 265 public string Path
266 { 266 {
267 get { return "/simstatus/"; } 267 get { return "/simstatus/"; }
268 } 268 }
269 } 269 }
270 270
271 protected override void SetupHttpListener() 271 protected override void SetupHttpListener()
272 { 272 {
273 httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); 273 httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort);
274 274
275 if (!this.m_sandbox) 275 if (!this.m_sandbox)
276 { 276 {
277 httpServer.AddStreamHandler( new SimStatusHandler() ); 277 httpServer.AddStreamHandler( new SimStatusHandler() );
278 } 278 }
279 } 279 }
280 280
281 protected override void ConnectToRemoteGridServer() 281 protected override void ConnectToRemoteGridServer()
282 { 282 {
283 283
284 } 284 }
285 285
286 #endregion 286 #endregion
287 287
288 private void SetupFromConfigFile(IGenericConfig configData) 288 private void SetupFromConfigFile(IGenericConfig configData)
289 { 289 {
290 // Log filename 290 // Log filename
291 string attri = ""; 291 string attri = "";
292 attri = configData.GetAttribute("LogFilename"); 292 attri = configData.GetAttribute("LogFilename");
293 if (String.IsNullOrEmpty(attri)) 293 if (String.IsNullOrEmpty(attri))
294 { 294 {
295 } 295 }
296 else 296 else
297 { 297 {
298 m_logFilename = attri; 298 m_logFilename = attri;
299 } 299 }
300 300
301 // SandBoxMode 301 // SandBoxMode
302 attri = ""; 302 attri = "";
303 attri = configData.GetAttribute("SandBox"); 303 attri = configData.GetAttribute("SandBox");
304 if ((attri == "") || ((attri != "false") && (attri != "true"))) 304 if ((attri == "") || ((attri != "false") && (attri != "true")))
305 { 305 {
306 this.m_sandbox = false; 306 this.m_sandbox = false;
307 configData.SetAttribute("SandBox", "false"); 307 configData.SetAttribute("SandBox", "false");
308 } 308 }
309 else 309 else
310 { 310 {
311 this.m_sandbox = Convert.ToBoolean(attri); 311 this.m_sandbox = Convert.ToBoolean(attri);
312 } 312 }
313 313
314 // LoginServer 314 // LoginServer
315 attri = ""; 315 attri = "";
316 attri = configData.GetAttribute("LoginServer"); 316 attri = configData.GetAttribute("LoginServer");
317 if ((attri == "") || ((attri != "false") && (attri != "true"))) 317 if ((attri == "") || ((attri != "false") && (attri != "true")))
318 { 318 {
319 this.m_loginserver = false; 319 this.m_loginserver = false;
320 configData.SetAttribute("LoginServer", "false"); 320 configData.SetAttribute("LoginServer", "false");
321 } 321 }
322 else 322 else
323 { 323 {
324 this.m_loginserver = Convert.ToBoolean(attri); 324 this.m_loginserver = Convert.ToBoolean(attri);
325 } 325 }
326 326
327 // Sandbox User accounts 327 // Sandbox User accounts
328 attri = ""; 328 attri = "";
329 attri = configData.GetAttribute("UserAccount"); 329 attri = configData.GetAttribute("UserAccount");
330 if ((attri == "") || ((attri != "false") && (attri != "true"))) 330 if ((attri == "") || ((attri != "false") && (attri != "true")))
331 { 331 {
332 this.user_accounts = false; 332 this.user_accounts = false;
333 configData.SetAttribute("UserAccounts", "false"); 333 configData.SetAttribute("UserAccounts", "false");
334 } 334 }
335 else if (attri == "true") 335 else if (attri == "true")
336 { 336 {
337 this.user_accounts = Convert.ToBoolean(attri); 337 this.user_accounts = Convert.ToBoolean(attri);
338 } 338 }
339 339
340 // Grid mode hack to use local asset server 340 // Grid mode hack to use local asset server
341 attri = ""; 341 attri = "";
342 attri = configData.GetAttribute("LocalAssets"); 342 attri = configData.GetAttribute("LocalAssets");
343 if ((attri == "") || ((attri != "false") && (attri != "true"))) 343 if ((attri == "") || ((attri != "false") && (attri != "true")))
344 { 344 {
345 this.gridLocalAsset = false; 345 this.gridLocalAsset = false;
346 configData.SetAttribute("LocalAssets", "false"); 346 configData.SetAttribute("LocalAssets", "false");
347 } 347 }
348 else if (attri == "true") 348 else if (attri == "true")
349 { 349 {
350 this.gridLocalAsset = Convert.ToBoolean(attri); 350 this.gridLocalAsset = Convert.ToBoolean(attri);
351 } 351 }
352 352
353 353
354 attri = ""; 354 attri = "";
355 attri = configData.GetAttribute("PhysicsEngine"); 355 attri = configData.GetAttribute("PhysicsEngine");
356 switch (attri) 356 switch (attri)
357 { 357 {
358 default: 358 default:
359 m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); 359 m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
360 Environment.Exit(1); 360 Environment.Exit(1);
361 break; 361 break;
362 362
363 case "": 363 case "":
364 this.m_physicsEngine = "basicphysics"; 364 this.m_physicsEngine = "basicphysics";
365 configData.SetAttribute("PhysicsEngine", "basicphysics"); 365 configData.SetAttribute("PhysicsEngine", "basicphysics");
366 ScenePresence.PhysicsEngineFlying = false; 366 ScenePresence.PhysicsEngineFlying = false;
367 break; 367 break;
368 368
369 case "basicphysics": 369 case "basicphysics":
370 this.m_physicsEngine = "basicphysics"; 370 this.m_physicsEngine = "basicphysics";
371 configData.SetAttribute("PhysicsEngine", "basicphysics"); 371 configData.SetAttribute("PhysicsEngine", "basicphysics");
372 ScenePresence.PhysicsEngineFlying = false; 372 ScenePresence.PhysicsEngineFlying = false;
373 break; 373 break;
374 374
375 case "RealPhysX": 375 case "RealPhysX":
376 this.m_physicsEngine = "RealPhysX"; 376 this.m_physicsEngine = "RealPhysX";
377 ScenePresence.PhysicsEngineFlying = true; 377 ScenePresence.PhysicsEngineFlying = true;
378 break; 378 break;
379 379
380 case "OpenDynamicsEngine": 380 case "OpenDynamicsEngine":
381 this.m_physicsEngine = "OpenDynamicsEngine"; 381 this.m_physicsEngine = "OpenDynamicsEngine";
382 ScenePresence.PhysicsEngineFlying = true; 382 ScenePresence.PhysicsEngineFlying = true;
383 break; 383 break;
384 384
385 case "BulletXEngine": 385 case "BulletXEngine":
386 this.m_physicsEngine = "BulletXEngine"; 386 this.m_physicsEngine = "BulletXEngine";
387 ScenePresence.PhysicsEngineFlying = true; 387 ScenePresence.PhysicsEngineFlying = true;
388 break; 388 break;
389 } 389 }
390 390
391 configData.Commit(); 391 configData.Commit();
392 392
393 } 393 }
394 394
395 /// <summary> 395 /// <summary>
396 /// Performs any last-minute sanity checking and shuts down the region server 396 /// Performs any last-minute sanity checking and shuts down the region server
397 /// </summary> 397 /// </summary>
398 public virtual void Shutdown() 398 public virtual void Shutdown()
399 { 399 {
400 m_log.Verbose("Main.cs:Shutdown() - Closing all threads"); 400 m_log.Verbose("Main.cs:Shutdown() - Closing all threads");
401 m_log.Verbose("Main.cs:Shutdown() - Killing listener thread"); 401 m_log.Verbose("Main.cs:Shutdown() - Killing listener thread");
402 m_log.Verbose("Main.cs:Shutdown() - Killing clients"); 402 m_log.Verbose("Main.cs:Shutdown() - Killing clients");
403 // IMPLEMENT THIS 403 // IMPLEMENT THIS
404 m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating"); 404 m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating");
405 for (int i = 0; i < m_localWorld.Count; i++) 405 for (int i = 0; i < m_localWorld.Count; i++)
406 { 406 {
407 ((Scene)m_localWorld[i]).Close(); 407 ((Scene)m_localWorld[i]).Close();
408 } 408 }
409 m_log.Close(); 409 m_log.Close();
410 Environment.Exit(0); 410 Environment.Exit(0);
411 } 411 }
412 412
413 #region Console Commands 413 #region Console Commands
414 /// <summary> 414 /// <summary>
415 /// Runs commands issued by the server console from the operator 415 /// Runs commands issued by the server console from the operator
416 /// </summary> 416 /// </summary>
417 /// <param name="command">The first argument of the parameter (the command)</param> 417 /// <param name="command">The first argument of the parameter (the command)</param>
418 /// <param name="cmdparams">Additional arguments passed to the command</param> 418 /// <param name="cmdparams">Additional arguments passed to the command</param>
419 public void RunCmd(string command, string[] cmdparams) 419 public void RunCmd(string command, string[] cmdparams)
420 { 420 {
421 switch (command) 421 switch (command)
422 { 422 {
423 case "help": 423 case "help":
424 m_log.Error("show users - show info about connected users"); 424 m_log.Error("show users - show info about connected users");
425 m_log.Error("quit - disconnect all clients and shutdown"); 425 m_log.Error("quit - disconnect all clients and shutdown");
426 break; 426 break;
427 427
428 case "show": 428 case "show":
429 if (cmdparams.Length > 0) 429 if (cmdparams.Length > 0)
430 { 430 {
431 Show(cmdparams[0]); 431 Show(cmdparams[0]);
432 } 432 }
433 break; 433 break;
434 434
435 case "terrain": 435 case "terrain":
436 string result = ""; 436 string result = "";
437 for (int i = 0; i < m_localWorld.Count; i++) 437 for (int i = 0; i < m_localWorld.Count; i++)
438 { 438 {
439 if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName)) 439 if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName))
440 { 440 {
441 m_log.Error(result); 441 m_log.Error(result);
442 } 442 }
443 } 443 }
444 break; 444 break;
445 case "script": 445 case "script":
446 for (int i = 0; i < m_localWorld.Count; i++) 446 for (int i = 0; i < m_localWorld.Count; i++)
447 { 447 {
448 ((Scene)m_localWorld[i]).SendCommandToScripts(cmdparams); 448 ((Scene)m_localWorld[i]).SendCommandToScripts(cmdparams);
449 } 449 }
450 break; 450 break;
451 451
452 case "quit": 452 case "quit":
453 case "shutdown": 453 case "shutdown":
454 Shutdown(); 454 Shutdown();
455 break; 455 break;
456 456
457 default: 457 default:
458 m_log.Error("Unknown command"); 458 m_log.Error("Unknown command");
459 break; 459 break;
460 } 460 }
461 } 461 }
462 462
463 /// <summary> 463 /// <summary>
464 /// Outputs to the console information about the region 464 /// Outputs to the console information about the region
465 /// </summary> 465 /// </summary>
466 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> 466 /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param>
467 public void Show(string ShowWhat) 467 public void Show(string ShowWhat)
468 { 468 {
469 switch (ShowWhat) 469 switch (ShowWhat)
470 { 470 {
471 case "uptime": 471 case "uptime":
472 m_log.Error("OpenSim has been running since " + startuptime.ToString()); 472 m_log.Error("OpenSim has been running since " + startuptime.ToString());
473 m_log.Error("That is " + (DateTime.Now - startuptime).ToString()); 473 m_log.Error("That is " + (DateTime.Now - startuptime).ToString());
474 break; 474 break;
475 case "users": 475 case "users":
476 ScenePresence TempAv; 476 ScenePresence TempAv;
477 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 477 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"));
478 for (int i = 0; i < m_localWorld.Count; i++) 478 for (int i = 0; i < m_localWorld.Count; i++)
479 { 479 {
480 foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) 480 foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys)
481 { 481 {
482 if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") 482 if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar")
483 { 483 {
484 TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; 484 TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID];
485 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); 485 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName);
486 } 486 }
487 } 487 }
488 } 488 }
489 break; 489 break;
490 } 490 }
491 } 491 }
492 #endregion 492 #endregion
493 } 493 }
494 494
495 495
496} 496}
diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs
index 2c720a3..6952d24 100644
--- a/OpenSim/Region/Application/VersionInfo.cs
+++ b/OpenSim/Region/Application/VersionInfo.cs
@@ -1,36 +1,36 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim 28namespace OpenSim
29{ 29{
30 /// <summary> 30 /// <summary>
31 /// </summary> 31 /// </summary>
32 public class VersionInfo 32 public class VersionInfo
33 { 33 {
34 public static string Version = "0.3, SVN build "; 34 public static string Version = "0.3, SVN build ";
35 } 35 }
36} 36}
diff --git a/OpenSim/Region/Caches/AssetCache.cs b/OpenSim/Region/Caches/AssetCache.cs
index 453edbe..8deb0a1 100644
--- a/OpenSim/Region/Caches/AssetCache.cs
+++ b/OpenSim/Region/Caches/AssetCache.cs
@@ -1,669 +1,669 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37 37
38namespace OpenSim.Region.Caches 38namespace OpenSim.Region.Caches
39{ 39{
40 public delegate void DownloadComplete(AssetCache.TextureSender sender); 40 public delegate void DownloadComplete(AssetCache.TextureSender sender);
41 41
42 /// <summary> 42 /// <summary>
43 /// Manages local cache of assets and their sending to viewers. 43 /// Manages local cache of assets and their sending to viewers.
44 /// </summary> 44 /// </summary>
45 public class AssetCache : IAssetReceiver 45 public class AssetCache : IAssetReceiver
46 { 46 {
47 public Dictionary<LLUUID, AssetInfo> Assets; 47 public Dictionary<LLUUID, AssetInfo> Assets;
48 public Dictionary<LLUUID, TextureImage> Textures; 48 public Dictionary<LLUUID, TextureImage> Textures;
49 49
50 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers 50 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
51 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent 51 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
52 52
53 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server 53 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
54 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server 54 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
55 55
56 public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); 56 public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>();
57 private IAssetServer _assetServer; 57 private IAssetServer _assetServer;
58 private Thread _assetCacheThread; 58 private Thread _assetCacheThread;
59 private LLUUID[] textureList = new LLUUID[5]; 59 private LLUUID[] textureList = new LLUUID[5];
60 60
61 /// <summary> 61 /// <summary>
62 /// 62 ///
63 /// </summary> 63 /// </summary>
64 public AssetCache(IAssetServer assetServer) 64 public AssetCache(IAssetServer assetServer)
65 { 65 {
66 Console.WriteLine("Creating Asset cache"); 66 Console.WriteLine("Creating Asset cache");
67 _assetServer = assetServer; 67 _assetServer = assetServer;
68 _assetServer.SetReceiver(this); 68 _assetServer.SetReceiver(this);
69 Assets = new Dictionary<LLUUID, AssetInfo>(); 69 Assets = new Dictionary<LLUUID, AssetInfo>();
70 Textures = new Dictionary<LLUUID, TextureImage>(); 70 Textures = new Dictionary<LLUUID, TextureImage>();
71 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); 71 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
72 this._assetCacheThread.IsBackground = true; 72 this._assetCacheThread.IsBackground = true;
73 this._assetCacheThread.Start(); 73 this._assetCacheThread.Start();
74 74
75 } 75 }
76 76
77 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) 77 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey)
78 { 78 {
79 Console.WriteLine("Creating Asset cache"); 79 Console.WriteLine("Creating Asset cache");
80 _assetServer = this.LoadAssetDll(assetServerDLLName); 80 _assetServer = this.LoadAssetDll(assetServerDLLName);
81 _assetServer.SetServerInfo(assetServerURL, assetServerKey); 81 _assetServer.SetServerInfo(assetServerURL, assetServerKey);
82 _assetServer.SetReceiver(this); 82 _assetServer.SetReceiver(this);
83 Assets = new Dictionary<LLUUID, AssetInfo>(); 83 Assets = new Dictionary<LLUUID, AssetInfo>();
84 Textures = new Dictionary<LLUUID, TextureImage>(); 84 Textures = new Dictionary<LLUUID, TextureImage>();
85 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); 85 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
86 this._assetCacheThread.IsBackground = true; 86 this._assetCacheThread.IsBackground = true;
87 this._assetCacheThread.Start(); 87 this._assetCacheThread.Start();
88 88
89 } 89 }
90 90
91 /// <summary> 91 /// <summary>
92 /// 92 ///
93 /// </summary> 93 /// </summary>
94 public void RunAssetManager() 94 public void RunAssetManager()
95 { 95 {
96 while (true) 96 while (true)
97 { 97 {
98 try 98 try
99 { 99 {
100 //Console.WriteLine("Asset cache loop"); 100 //Console.WriteLine("Asset cache loop");
101 this.ProcessAssetQueue(); 101 this.ProcessAssetQueue();
102 this.ProcessTextureQueue(); 102 this.ProcessTextureQueue();
103 Thread.Sleep(500); 103 Thread.Sleep(500);
104 } 104 }
105 catch (Exception e) 105 catch (Exception e)
106 { 106 {
107 Console.WriteLine(e.Message); 107 Console.WriteLine(e.Message);
108 } 108 }
109 } 109 }
110 } 110 }
111 111
112 public void LoadDefaultTextureSet() 112 public void LoadDefaultTextureSet()
113 { 113 {
114 //hack: so we can give each user a set of textures 114 //hack: so we can give each user a set of textures
115 textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); 115 textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001");
116 textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); 116 textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002");
117 textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003"); 117 textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003");
118 textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004"); 118 textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004");
119 textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005"); 119 textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005");
120 120
121 for (int i = 0; i < textureList.Length; i++) 121 for (int i = 0; i < textureList.Length; i++)
122 { 122 {
123 this._assetServer.RequestAsset(textureList[i], true); 123 this._assetServer.RequestAsset(textureList[i], true);
124 } 124 }
125 125
126 } 126 }
127 127
128 public AssetBase[] CreateNewInventorySet(LLUUID agentID) 128 public AssetBase[] CreateNewInventorySet(LLUUID agentID)
129 { 129 {
130 AssetBase[] inventorySet = new AssetBase[this.textureList.Length]; 130 AssetBase[] inventorySet = new AssetBase[this.textureList.Length];
131 for (int i = 0; i < textureList.Length; i++) 131 for (int i = 0; i < textureList.Length; i++)
132 { 132 {
133 if (this.Textures.ContainsKey(textureList[i])) 133 if (this.Textures.ContainsKey(textureList[i]))
134 { 134 {
135 inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]); 135 inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
136 TextureImage image = new TextureImage(inventorySet[i]); 136 TextureImage image = new TextureImage(inventorySet[i]);
137 this.Textures.Add(image.FullID, image); 137 this.Textures.Add(image.FullID, image);
138 this._assetServer.UploadNewAsset(image); //save the asset to the asset server 138 this._assetServer.UploadNewAsset(image); //save the asset to the asset server
139 } 139 }
140 } 140 }
141 return inventorySet; 141 return inventorySet;
142 } 142 }
143 143
144 public AssetBase GetAsset(LLUUID assetID) 144 public AssetBase GetAsset(LLUUID assetID)
145 { 145 {
146 AssetBase asset = null; 146 AssetBase asset = null;
147 if (this.Textures.ContainsKey(assetID)) 147 if (this.Textures.ContainsKey(assetID))
148 { 148 {
149 asset = this.Textures[assetID]; 149 asset = this.Textures[assetID];
150 } 150 }
151 else if (this.Assets.ContainsKey(assetID)) 151 else if (this.Assets.ContainsKey(assetID))
152 { 152 {
153 asset = this.Assets[assetID]; 153 asset = this.Assets[assetID];
154 } 154 }
155 return asset; 155 return asset;
156 } 156 }
157 157
158 public void AddAsset(AssetBase asset) 158 public void AddAsset(AssetBase asset)
159 { 159 {
160 // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); 160 // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
161 if (asset.Type == 0) 161 if (asset.Type == 0)
162 { 162 {
163 //Console.WriteLine("which is a texture"); 163 //Console.WriteLine("which is a texture");
164 if (!this.Textures.ContainsKey(asset.FullID)) 164 if (!this.Textures.ContainsKey(asset.FullID))
165 { //texture 165 { //texture
166 TextureImage textur = new TextureImage(asset); 166 TextureImage textur = new TextureImage(asset);
167 this.Textures.Add(textur.FullID, textur); 167 this.Textures.Add(textur.FullID, textur);
168 this._assetServer.UploadNewAsset(asset); 168 this._assetServer.UploadNewAsset(asset);
169 } 169 }
170 } 170 }
171 else 171 else
172 { 172 {
173 if (!this.Assets.ContainsKey(asset.FullID)) 173 if (!this.Assets.ContainsKey(asset.FullID))
174 { 174 {
175 AssetInfo assetInf = new AssetInfo(asset); 175 AssetInfo assetInf = new AssetInfo(asset);
176 this.Assets.Add(assetInf.FullID, assetInf); 176 this.Assets.Add(assetInf.FullID, assetInf);
177 this._assetServer.UploadNewAsset(asset); 177 this._assetServer.UploadNewAsset(asset);
178 } 178 }
179 } 179 }
180 } 180 }
181 181
182 /// <summary> 182 /// <summary>
183 /// 183 ///
184 /// </summary> 184 /// </summary>
185 private void ProcessTextureQueue() 185 private void ProcessTextureQueue()
186 { 186 {
187 if (this.TextureRequests.Count == 0) 187 if (this.TextureRequests.Count == 0)
188 { 188 {
189 //no requests waiting 189 //no requests waiting
190 return; 190 return;
191 } 191 }
192 int num; 192 int num;
193 num = this.TextureRequests.Count; 193 num = this.TextureRequests.Count;
194 194
195 AssetRequest req; 195 AssetRequest req;
196 for (int i = 0; i < num; i++) 196 for (int i = 0; i < num; i++)
197 { 197 {
198 req = (AssetRequest)this.TextureRequests[i]; 198 req = (AssetRequest)this.TextureRequests[i];
199 if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) 199 if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID))
200 { 200 {
201 TextureSender sender = new TextureSender(req); 201 TextureSender sender = new TextureSender(req);
202 sender.OnComplete += this.TextureSent; 202 sender.OnComplete += this.TextureSent;
203 lock (this.SendingTextures) 203 lock (this.SendingTextures)
204 { 204 {
205 this.SendingTextures.Add(req.ImageInfo.FullID, sender); 205 this.SendingTextures.Add(req.ImageInfo.FullID, sender);
206 } 206 }
207 } 207 }
208 208
209 } 209 }
210 210
211 this.TextureRequests.Clear(); 211 this.TextureRequests.Clear();
212 } 212 }
213 213
214 /// <summary> 214 /// <summary>
215 /// Event handler, called by a TextureSender object to say that texture has been sent 215 /// Event handler, called by a TextureSender object to say that texture has been sent
216 /// </summary> 216 /// </summary>
217 /// <param name="sender"></param> 217 /// <param name="sender"></param>
218 public void TextureSent(TextureSender sender) 218 public void TextureSent(TextureSender sender)
219 { 219 {
220 if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) 220 if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID))
221 { 221 {
222 lock (this.SendingTextures) 222 lock (this.SendingTextures)
223 { 223 {
224 this.SendingTextures.Remove(sender.request.ImageInfo.FullID); 224 this.SendingTextures.Remove(sender.request.ImageInfo.FullID);
225 } 225 }
226 } 226 }
227 } 227 }
228 228
229 public void AssetReceived(AssetBase asset, bool IsTexture) 229 public void AssetReceived(AssetBase asset, bool IsTexture)
230 { 230 {
231 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server 231 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
232 { 232 {
233 //check if it is a texture or not 233 //check if it is a texture or not
234 //then add to the correct cache list 234 //then add to the correct cache list
235 //then check for waiting requests for this asset/texture (in the Requested lists) 235 //then check for waiting requests for this asset/texture (in the Requested lists)
236 //and move those requests into the Requests list. 236 //and move those requests into the Requests list.
237 if (IsTexture) 237 if (IsTexture)
238 { 238 {
239 TextureImage image = new TextureImage(asset); 239 TextureImage image = new TextureImage(asset);
240 this.Textures.Add(image.FullID, image); 240 this.Textures.Add(image.FullID, image);
241 if (this.RequestedTextures.ContainsKey(image.FullID)) 241 if (this.RequestedTextures.ContainsKey(image.FullID))
242 { 242 {
243 AssetRequest req = this.RequestedTextures[image.FullID]; 243 AssetRequest req = this.RequestedTextures[image.FullID];
244 req.ImageInfo = image; 244 req.ImageInfo = image;
245 if (image.Data.LongLength > 600) 245 if (image.Data.LongLength > 600)
246 { 246 {
247 //over 600 bytes so split up file 247 //over 600 bytes so split up file
248 req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000; 248 req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000;
249 } 249 }
250 else 250 else
251 { 251 {
252 req.NumPackets = 1; 252 req.NumPackets = 1;
253 } 253 }
254 this.RequestedTextures.Remove(image.FullID); 254 this.RequestedTextures.Remove(image.FullID);
255 this.TextureRequests.Add(req); 255 this.TextureRequests.Add(req);
256 } 256 }
257 } 257 }
258 else 258 else
259 { 259 {
260 AssetInfo assetInf = new AssetInfo(asset); 260 AssetInfo assetInf = new AssetInfo(asset);
261 this.Assets.Add(assetInf.FullID, assetInf); 261 this.Assets.Add(assetInf.FullID, assetInf);
262 if (this.RequestedAssets.ContainsKey(assetInf.FullID)) 262 if (this.RequestedAssets.ContainsKey(assetInf.FullID))
263 { 263 {
264 AssetRequest req = this.RequestedAssets[assetInf.FullID]; 264 AssetRequest req = this.RequestedAssets[assetInf.FullID];
265 req.AssetInf = assetInf; 265 req.AssetInf = assetInf;
266 if (assetInf.Data.LongLength > 600) 266 if (assetInf.Data.LongLength > 600)
267 { 267 {
268 //over 600 bytes so split up file 268 //over 600 bytes so split up file
269 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; 269 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
270 } 270 }
271 else 271 else
272 { 272 {
273 req.NumPackets = 1; 273 req.NumPackets = 1;
274 } 274 }
275 this.RequestedAssets.Remove(assetInf.FullID); 275 this.RequestedAssets.Remove(assetInf.FullID);
276 this.AssetRequests.Add(req); 276 this.AssetRequests.Add(req);
277 } 277 }
278 } 278 }
279 } 279 }
280 } 280 }
281 281
282 public void AssetNotFound(AssetBase asset) 282 public void AssetNotFound(AssetBase asset)
283 { 283 {
284 //the asset server had no knowledge of requested asset 284 //the asset server had no knowledge of requested asset
285 285
286 } 286 }
287 287
288 #region Assets 288 #region Assets
289 /// <summary> 289 /// <summary>
290 /// 290 ///
291 /// </summary> 291 /// </summary>
292 /// <param name="userInfo"></param> 292 /// <param name="userInfo"></param>
293 /// <param name="transferRequest"></param> 293 /// <param name="transferRequest"></param>
294 public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest) 294 public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest)
295 { 295 {
296 LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); 296 LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
297 //check to see if asset is in local cache, if not we need to request it from asset server. 297 //check to see if asset is in local cache, if not we need to request it from asset server.
298 298
299 if (!this.Assets.ContainsKey(requestID)) 299 if (!this.Assets.ContainsKey(requestID))
300 { 300 {
301 //not found asset 301 //not found asset
302 // so request from asset server 302 // so request from asset server
303 if (!this.RequestedAssets.ContainsKey(requestID)) 303 if (!this.RequestedAssets.ContainsKey(requestID))
304 { 304 {
305 AssetRequest request = new AssetRequest(); 305 AssetRequest request = new AssetRequest();
306 request.RequestUser = userInfo; 306 request.RequestUser = userInfo;
307 request.RequestAssetID = requestID; 307 request.RequestAssetID = requestID;
308 request.TransferRequestID = transferRequest.TransferInfo.TransferID; 308 request.TransferRequestID = transferRequest.TransferInfo.TransferID;
309 this.RequestedAssets.Add(requestID, request); 309 this.RequestedAssets.Add(requestID, request);
310 this._assetServer.RequestAsset(requestID, false); 310 this._assetServer.RequestAsset(requestID, false);
311 } 311 }
312 return; 312 return;
313 } 313 }
314 //it is in our cache 314 //it is in our cache
315 AssetInfo asset = this.Assets[requestID]; 315 AssetInfo asset = this.Assets[requestID];
316 316
317 //work out how many packets it should be sent in 317 //work out how many packets it should be sent in
318 // and add to the AssetRequests list 318 // and add to the AssetRequests list
319 AssetRequest req = new AssetRequest(); 319 AssetRequest req = new AssetRequest();
320 req.RequestUser = userInfo; 320 req.RequestUser = userInfo;
321 req.RequestAssetID = requestID; 321 req.RequestAssetID = requestID;
322 req.TransferRequestID = transferRequest.TransferInfo.TransferID; 322 req.TransferRequestID = transferRequest.TransferInfo.TransferID;
323 req.AssetInf = asset; 323 req.AssetInf = asset;
324 324
325 if (asset.Data.LongLength > 600) 325 if (asset.Data.LongLength > 600)
326 { 326 {
327 //over 600 bytes so split up file 327 //over 600 bytes so split up file
328 req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; 328 req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000;
329 } 329 }
330 else 330 else
331 { 331 {
332 req.NumPackets = 1; 332 req.NumPackets = 1;
333 } 333 }
334 334
335 this.AssetRequests.Add(req); 335 this.AssetRequests.Add(req);
336 } 336 }
337 337
338 /// <summary> 338 /// <summary>
339 /// 339 ///
340 /// </summary> 340 /// </summary>
341 private void ProcessAssetQueue() 341 private void ProcessAssetQueue()
342 { 342 {
343 if (this.AssetRequests.Count == 0) 343 if (this.AssetRequests.Count == 0)
344 { 344 {
345 //no requests waiting 345 //no requests waiting
346 return; 346 return;
347 } 347 }
348 int num; 348 int num;
349 349
350 if (this.AssetRequests.Count < 5) 350 if (this.AssetRequests.Count < 5)
351 { 351 {
352 //lower than 5 so do all of them 352 //lower than 5 so do all of them
353 num = this.AssetRequests.Count; 353 num = this.AssetRequests.Count;
354 } 354 }
355 else 355 else
356 { 356 {
357 num = 5; 357 num = 5;
358 } 358 }
359 AssetRequest req; 359 AssetRequest req;
360 for (int i = 0; i < num; i++) 360 for (int i = 0; i < num; i++)
361 { 361 {
362 req = (AssetRequest)this.AssetRequests[i]; 362 req = (AssetRequest)this.AssetRequests[i];
363 363
364 TransferInfoPacket Transfer = new TransferInfoPacket(); 364 TransferInfoPacket Transfer = new TransferInfoPacket();
365 Transfer.TransferInfo.ChannelType = 2; 365 Transfer.TransferInfo.ChannelType = 2;
366 Transfer.TransferInfo.Status = 0; 366 Transfer.TransferInfo.Status = 0;
367 Transfer.TransferInfo.TargetType = 0; 367 Transfer.TransferInfo.TargetType = 0;
368 Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); 368 Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes();
369 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; 369 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length;
370 Transfer.TransferInfo.TransferID = req.TransferRequestID; 370 Transfer.TransferInfo.TransferID = req.TransferRequestID;
371 req.RequestUser.OutPacket(Transfer); 371 req.RequestUser.OutPacket(Transfer);
372 372
373 if (req.NumPackets == 1) 373 if (req.NumPackets == 1)
374 { 374 {
375 TransferPacketPacket TransferPacket = new TransferPacketPacket(); 375 TransferPacketPacket TransferPacket = new TransferPacketPacket();
376 TransferPacket.TransferData.Packet = 0; 376 TransferPacket.TransferData.Packet = 0;
377 TransferPacket.TransferData.ChannelType = 2; 377 TransferPacket.TransferData.ChannelType = 2;
378 TransferPacket.TransferData.TransferID = req.TransferRequestID; 378 TransferPacket.TransferData.TransferID = req.TransferRequestID;
379 TransferPacket.TransferData.Data = req.AssetInf.Data; 379 TransferPacket.TransferData.Data = req.AssetInf.Data;
380 TransferPacket.TransferData.Status = 1; 380 TransferPacket.TransferData.Status = 1;
381 req.RequestUser.OutPacket(TransferPacket); 381 req.RequestUser.OutPacket(TransferPacket);
382 } 382 }
383 else 383 else
384 { 384 {
385 //more than one packet so split file up , for now it can't be bigger than 2000 bytes 385 //more than one packet so split file up , for now it can't be bigger than 2000 bytes
386 TransferPacketPacket TransferPacket = new TransferPacketPacket(); 386 TransferPacketPacket TransferPacket = new TransferPacketPacket();
387 TransferPacket.TransferData.Packet = 0; 387 TransferPacket.TransferData.Packet = 0;
388 TransferPacket.TransferData.ChannelType = 2; 388 TransferPacket.TransferData.ChannelType = 2;
389 TransferPacket.TransferData.TransferID = req.TransferRequestID; 389 TransferPacket.TransferData.TransferID = req.TransferRequestID;
390 byte[] chunk = new byte[1000]; 390 byte[] chunk = new byte[1000];
391 Array.Copy(req.AssetInf.Data, chunk, 1000); 391 Array.Copy(req.AssetInf.Data, chunk, 1000);
392 TransferPacket.TransferData.Data = chunk; 392 TransferPacket.TransferData.Data = chunk;
393 TransferPacket.TransferData.Status = 0; 393 TransferPacket.TransferData.Status = 0;
394 req.RequestUser.OutPacket(TransferPacket); 394 req.RequestUser.OutPacket(TransferPacket);
395 395
396 TransferPacket = new TransferPacketPacket(); 396 TransferPacket = new TransferPacketPacket();
397 TransferPacket.TransferData.Packet = 1; 397 TransferPacket.TransferData.Packet = 1;
398 TransferPacket.TransferData.ChannelType = 2; 398 TransferPacket.TransferData.ChannelType = 2;
399 TransferPacket.TransferData.TransferID = req.TransferRequestID; 399 TransferPacket.TransferData.TransferID = req.TransferRequestID;
400 byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)]; 400 byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)];
401 Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); 401 Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length);
402 TransferPacket.TransferData.Data = chunk1; 402 TransferPacket.TransferData.Data = chunk1;
403 TransferPacket.TransferData.Status = 1; 403 TransferPacket.TransferData.Status = 1;
404 req.RequestUser.OutPacket(TransferPacket); 404 req.RequestUser.OutPacket(TransferPacket);
405 } 405 }
406 406
407 } 407 }
408 408
409 //remove requests that have been completed 409 //remove requests that have been completed
410 for (int i = 0; i < num; i++) 410 for (int i = 0; i < num; i++)
411 { 411 {
412 this.AssetRequests.RemoveAt(0); 412 this.AssetRequests.RemoveAt(0);
413 } 413 }
414 414
415 } 415 }
416 416
417 public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset) 417 public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset)
418 { 418 {
419 AssetInfo newAsset = new AssetInfo(); 419 AssetInfo newAsset = new AssetInfo();
420 newAsset.Data = new byte[sourceAsset.Data.Length]; 420 newAsset.Data = new byte[sourceAsset.Data.Length];
421 Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length); 421 Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length);
422 newAsset.FullID = LLUUID.Random(); 422 newAsset.FullID = LLUUID.Random();
423 newAsset.Type = sourceAsset.Type; 423 newAsset.Type = sourceAsset.Type;
424 newAsset.InvType = sourceAsset.InvType; 424 newAsset.InvType = sourceAsset.InvType;
425 return (newAsset); 425 return (newAsset);
426 } 426 }
427 #endregion 427 #endregion
428 428
429 #region Textures 429 #region Textures
430 /// <summary> 430 /// <summary>
431 /// 431 ///
432 /// </summary> 432 /// </summary>
433 /// <param name="userInfo"></param> 433 /// <param name="userInfo"></param>
434 /// <param name="imageID"></param> 434 /// <param name="imageID"></param>
435 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID) 435 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID)
436 { 436 {
437 //Console.WriteLine("texture request for " + imageID.ToStringHyphenated()); 437 //Console.WriteLine("texture request for " + imageID.ToStringHyphenated());
438 //check to see if texture is in local cache, if not request from asset server 438 //check to see if texture is in local cache, if not request from asset server
439 if (!this.Textures.ContainsKey(imageID)) 439 if (!this.Textures.ContainsKey(imageID))
440 { 440 {
441 if (!this.RequestedTextures.ContainsKey(imageID)) 441 if (!this.RequestedTextures.ContainsKey(imageID))
442 { 442 {
443 //not is cache so request from asset server 443 //not is cache so request from asset server
444 AssetRequest request = new AssetRequest(); 444 AssetRequest request = new AssetRequest();
445 request.RequestUser = userInfo; 445 request.RequestUser = userInfo;
446 request.RequestAssetID = imageID; 446 request.RequestAssetID = imageID;
447 request.IsTextureRequest = true; 447 request.IsTextureRequest = true;
448 this.RequestedTextures.Add(imageID, request); 448 this.RequestedTextures.Add(imageID, request);
449 this._assetServer.RequestAsset(imageID, true); 449 this._assetServer.RequestAsset(imageID, true);
450 } 450 }
451 return; 451 return;
452 } 452 }
453 453
454 //Console.WriteLine("texture already in cache"); 454 //Console.WriteLine("texture already in cache");
455 TextureImage imag = this.Textures[imageID]; 455 TextureImage imag = this.Textures[imageID];
456 AssetRequest req = new AssetRequest(); 456 AssetRequest req = new AssetRequest();
457 req.RequestUser = userInfo; 457 req.RequestUser = userInfo;
458 req.RequestAssetID = imageID; 458 req.RequestAssetID = imageID;
459 req.IsTextureRequest = true; 459 req.IsTextureRequest = true;
460 req.ImageInfo = imag; 460 req.ImageInfo = imag;
461 461
462 if (imag.Data.LongLength > 600) 462 if (imag.Data.LongLength > 600)
463 { 463 {
464 //over 600 bytes so split up file 464 //over 600 bytes so split up file
465 req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000; 465 req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000;
466 } 466 }
467 else 467 else
468 { 468 {
469 req.NumPackets = 1; 469 req.NumPackets = 1;
470 } 470 }
471 this.TextureRequests.Add(req); 471 this.TextureRequests.Add(req);
472 } 472 }
473 473
474 public TextureImage CloneImage(LLUUID newOwner, TextureImage source) 474 public TextureImage CloneImage(LLUUID newOwner, TextureImage source)
475 { 475 {
476 TextureImage newImage = new TextureImage(); 476 TextureImage newImage = new TextureImage();
477 newImage.Data = new byte[source.Data.Length]; 477 newImage.Data = new byte[source.Data.Length];
478 Array.Copy(source.Data, newImage.Data, source.Data.Length); 478 Array.Copy(source.Data, newImage.Data, source.Data.Length);
479 //newImage.filename = source.filename; 479 //newImage.filename = source.filename;
480 newImage.FullID = LLUUID.Random(); 480 newImage.FullID = LLUUID.Random();
481 newImage.Name = source.Name; 481 newImage.Name = source.Name;
482 return (newImage); 482 return (newImage);
483 } 483 }
484 #endregion 484 #endregion
485 485
486 private IAssetServer LoadAssetDll(string dllName) 486 private IAssetServer LoadAssetDll(string dllName)
487 { 487 {
488 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 488 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
489 IAssetServer server = null; 489 IAssetServer server = null;
490 490
491 foreach (Type pluginType in pluginAssembly.GetTypes()) 491 foreach (Type pluginType in pluginAssembly.GetTypes())
492 { 492 {
493 if (pluginType.IsPublic) 493 if (pluginType.IsPublic)
494 { 494 {
495 if (!pluginType.IsAbstract) 495 if (!pluginType.IsAbstract)
496 { 496 {
497 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); 497 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
498 498
499 if (typeInterface != null) 499 if (typeInterface != null)
500 { 500 {
501 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 501 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
502 server = plug.GetAssetServer(); 502 server = plug.GetAssetServer();
503 break; 503 break;
504 } 504 }
505 505
506 typeInterface = null; 506 typeInterface = null;
507 } 507 }
508 } 508 }
509 } 509 }
510 pluginAssembly = null; 510 pluginAssembly = null;
511 return server; 511 return server;
512 } 512 }
513 513
514 public class AssetRequest 514 public class AssetRequest
515 { 515 {
516 public IClientAPI RequestUser; 516 public IClientAPI RequestUser;
517 public LLUUID RequestAssetID; 517 public LLUUID RequestAssetID;
518 public AssetInfo AssetInf; 518 public AssetInfo AssetInf;
519 public TextureImage ImageInfo; 519 public TextureImage ImageInfo;
520 public LLUUID TransferRequestID; 520 public LLUUID TransferRequestID;
521 public long DataPointer = 0; 521 public long DataPointer = 0;
522 public int NumPackets = 0; 522 public int NumPackets = 0;
523 public int PacketCounter = 0; 523 public int PacketCounter = 0;
524 public bool IsTextureRequest; 524 public bool IsTextureRequest;
525 //public bool AssetInCache; 525 //public bool AssetInCache;
526 //public int TimeRequested; 526 //public int TimeRequested;
527 527
528 public AssetRequest() 528 public AssetRequest()
529 { 529 {
530 530
531 } 531 }
532 } 532 }
533 533
534 public class AssetInfo : AssetBase 534 public class AssetInfo : AssetBase
535 { 535 {
536 public AssetInfo() 536 public AssetInfo()
537 { 537 {
538 538
539 } 539 }
540 540
541 public AssetInfo(AssetBase aBase) 541 public AssetInfo(AssetBase aBase)
542 { 542 {
543 Data = aBase.Data; 543 Data = aBase.Data;
544 FullID = aBase.FullID; 544 FullID = aBase.FullID;
545 Type = aBase.Type; 545 Type = aBase.Type;
546 InvType = aBase.InvType; 546 InvType = aBase.InvType;
547 Name = aBase.Name; 547 Name = aBase.Name;
548 Description = aBase.Description; 548 Description = aBase.Description;
549 } 549 }
550 } 550 }
551 551
552 public class TextureImage : AssetBase 552 public class TextureImage : AssetBase
553 { 553 {
554 public TextureImage() 554 public TextureImage()
555 { 555 {
556 556
557 } 557 }
558 558
559 public TextureImage(AssetBase aBase) 559 public TextureImage(AssetBase aBase)
560 { 560 {
561 Data = aBase.Data; 561 Data = aBase.Data;
562 FullID = aBase.FullID; 562 FullID = aBase.FullID;
563 Type = aBase.Type; 563 Type = aBase.Type;
564 InvType = aBase.InvType; 564 InvType = aBase.InvType;
565 Name = aBase.Name; 565 Name = aBase.Name;
566 Description = aBase.Description; 566 Description = aBase.Description;
567 } 567 }
568 } 568 }
569 569
570 public class TextureSender 570 public class TextureSender
571 { 571 {
572 public AssetRequest request; 572 public AssetRequest request;
573 public event DownloadComplete OnComplete; 573 public event DownloadComplete OnComplete;
574 Thread m_thread; 574 Thread m_thread;
575 public TextureSender(AssetRequest req) 575 public TextureSender(AssetRequest req)
576 { 576 {
577 request = req; 577 request = req;
578 //Console.WriteLine("creating worker thread for texture " + req.ImageInfo.FullID.ToStringHyphenated()); 578 //Console.WriteLine("creating worker thread for texture " + req.ImageInfo.FullID.ToStringHyphenated());
579 //Console.WriteLine("texture data length is " + req.ImageInfo.Data.Length); 579 //Console.WriteLine("texture data length is " + req.ImageInfo.Data.Length);
580 // Console.WriteLine("in " + req.NumPackets + " packets"); 580 // Console.WriteLine("in " + req.NumPackets + " packets");
581 //ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object()); 581 //ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object());
582 582
583 //need some sort of custom threadpool here, as using the .net one, overloads it and stops the handling of incoming packets etc 583 //need some sort of custom threadpool here, as using the .net one, overloads it and stops the handling of incoming packets etc
584 //but don't really want to create a thread for every texture download 584 //but don't really want to create a thread for every texture download
585 m_thread = new Thread(new ThreadStart(SendTexture)); 585 m_thread = new Thread(new ThreadStart(SendTexture));
586 m_thread.IsBackground = true; 586 m_thread.IsBackground = true;
587 m_thread.Start(); 587 m_thread.Start();
588 } 588 }
589 589
590 public void SendTexture() 590 public void SendTexture()
591 { 591 {
592 //Console.WriteLine("starting to send sending texture " + request.ImageInfo.FullID.ToStringHyphenated()); 592 //Console.WriteLine("starting to send sending texture " + request.ImageInfo.FullID.ToStringHyphenated());
593 while (request.PacketCounter != request.NumPackets) 593 while (request.PacketCounter != request.NumPackets)
594 { 594 {
595 SendPacket(); 595 SendPacket();
596 Thread.Sleep(500); 596 Thread.Sleep(500);
597 } 597 }
598 598
599 //Console.WriteLine("finished sending texture " + request.ImageInfo.FullID.ToStringHyphenated()); 599 //Console.WriteLine("finished sending texture " + request.ImageInfo.FullID.ToStringHyphenated());
600 if (OnComplete != null) 600 if (OnComplete != null)
601 { 601 {
602 OnComplete(this); 602 OnComplete(this);
603 } 603 }
604 } 604 }
605 605
606 public void SendPacket() 606 public void SendPacket()
607 { 607 {
608 AssetRequest req = request; 608 AssetRequest req = request;
609 // Console.WriteLine("sending " + req.ImageInfo.FullID); 609 // Console.WriteLine("sending " + req.ImageInfo.FullID);
610 610
611 // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) 611 // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
612 if (req.PacketCounter == 0) 612 if (req.PacketCounter == 0)
613 { 613 {
614 //first time for this request so send imagedata packet 614 //first time for this request so send imagedata packet
615 if (req.NumPackets == 1) 615 if (req.NumPackets == 1)
616 { 616 {
617 //only one packet so send whole file 617 //only one packet so send whole file
618 ImageDataPacket im = new ImageDataPacket(); 618 ImageDataPacket im = new ImageDataPacket();
619 im.ImageID.Packets = 1; 619 im.ImageID.Packets = 1;
620 im.ImageID.ID = req.ImageInfo.FullID; 620 im.ImageID.ID = req.ImageInfo.FullID;
621 im.ImageID.Size = (uint)req.ImageInfo.Data.Length; 621 im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
622 im.ImageData.Data = req.ImageInfo.Data; 622 im.ImageData.Data = req.ImageInfo.Data;
623 im.ImageID.Codec = 2; 623 im.ImageID.Codec = 2;
624 req.RequestUser.OutPacket(im); 624 req.RequestUser.OutPacket(im);
625 req.PacketCounter++; 625 req.PacketCounter++;
626 //req.ImageInfo.l= time; 626 //req.ImageInfo.l= time;
627 //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID); 627 //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID);
628 // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); 628 // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
629 } 629 }
630 else 630 else
631 { 631 {
632 //more than one packet so split file up 632 //more than one packet so split file up
633 ImageDataPacket im = new ImageDataPacket(); 633 ImageDataPacket im = new ImageDataPacket();
634 im.ImageID.Packets = (ushort)req.NumPackets; 634 im.ImageID.Packets = (ushort)req.NumPackets;
635 im.ImageID.ID = req.ImageInfo.FullID; 635 im.ImageID.ID = req.ImageInfo.FullID;
636 im.ImageID.Size = (uint)req.ImageInfo.Data.Length; 636 im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
637 im.ImageData.Data = new byte[600]; 637 im.ImageData.Data = new byte[600];
638 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); 638 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
639 im.ImageID.Codec = 2; 639 im.ImageID.Codec = 2;
640 req.RequestUser.OutPacket(im); 640 req.RequestUser.OutPacket(im);
641 req.PacketCounter++; 641 req.PacketCounter++;
642 //req.ImageInfo.last_used = time; 642 //req.ImageInfo.last_used = time;
643 //System.Console.WriteLine("sent first packet of texture: 643 //System.Console.WriteLine("sent first packet of texture:
644 // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); 644 // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated());
645 } 645 }
646 } 646 }
647 else 647 else
648 { 648 {
649 //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated()); 649 //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated());
650 //send imagepacket 650 //send imagepacket
651 //more than one packet so split file up 651 //more than one packet so split file up
652 ImagePacketPacket im = new ImagePacketPacket(); 652 ImagePacketPacket im = new ImagePacketPacket();
653 im.ImageID.Packet = (ushort)req.PacketCounter; 653 im.ImageID.Packet = (ushort)req.PacketCounter;
654 im.ImageID.ID = req.ImageInfo.FullID; 654 im.ImageID.ID = req.ImageInfo.FullID;
655 int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1); 655 int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
656 if (size > 1000) size = 1000; 656 if (size > 1000) size = 1000;
657 im.ImageData.Data = new byte[size]; 657 im.ImageData.Data = new byte[size];
658 Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size); 658 Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
659 req.RequestUser.OutPacket(im); 659 req.RequestUser.OutPacket(im);
660 req.PacketCounter++; 660 req.PacketCounter++;
661 //req.ImageInfo.last_used = time; 661 //req.ImageInfo.last_used = time;
662 //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); 662 //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
663 } 663 }
664 664
665 } 665 }
666 } 666 }
667 } 667 }
668} 668}
669 669
diff --git a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs
index 8389415..4ba42b9 100644
--- a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Region.Caches")] 6[assembly: AssemblyTitle("OpenSim.Region.Caches")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Region.Caches")] 10[assembly: AssemblyProduct("OpenSim.Region.Caches")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("2b15ddbf-0341-49a6-85c0-cece268a4518")] 21[assembly: Guid("2b15ddbf-0341-49a6-85c0-cece268a4518")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs
index 7acbf8e..d2ef526 100644
--- a/OpenSim/Region/Capabilities/Caps.cs
+++ b/OpenSim/Region/Capabilities/Caps.cs
@@ -1,313 +1,313 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using System.IO; 32using System.IO;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Region.Caches; 37using OpenSim.Region.Caches;
38 38
39namespace OpenSim.Region.Capabilities 39namespace OpenSim.Region.Capabilities
40{ 40{
41 public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); 41 public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data);
42 42
43 public class Caps 43 public class Caps
44 { 44 {
45 private string m_httpListenerHostName; 45 private string m_httpListenerHostName;
46 private int m_httpListenPort; 46 private int m_httpListenPort;
47 private string m_capsObjectPath = "00001-"; 47 private string m_capsObjectPath = "00001-";
48 private string m_requestPath = "0000/"; 48 private string m_requestPath = "0000/";
49 private string m_mapLayerPath = "0001/"; 49 private string m_mapLayerPath = "0001/";
50 private string m_newInventory = "0002/"; 50 private string m_newInventory = "0002/";
51 // private string m_requestTexture = "0003/"; 51 // private string m_requestTexture = "0003/";
52 //private string eventQueue = "0100/"; 52 //private string eventQueue = "0100/";
53 private BaseHttpServer httpListener; 53 private BaseHttpServer httpListener;
54 private LLUUID agentID; 54 private LLUUID agentID;
55 private AssetCache assetCache; 55 private AssetCache assetCache;
56 private int eventQueueCount = 1; 56 private int eventQueueCount = 1;
57 private Queue<string> CapsEventQueue = new Queue<string>(); 57 private Queue<string> CapsEventQueue = new Queue<string>();
58 58
59 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) 59 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent)
60 { 60 {
61 assetCache = assetCach; 61 assetCache = assetCach;
62 m_capsObjectPath = capsPath; 62 m_capsObjectPath = capsPath;
63 httpListener = httpServer; 63 httpListener = httpServer;
64 m_httpListenerHostName = httpListen; 64 m_httpListenerHostName = httpListen;
65 m_httpListenPort = httpPort; 65 m_httpListenPort = httpPort;
66 agentID = agent; 66 agentID = agent;
67 } 67 }
68 68
69 /// <summary> 69 /// <summary>
70 /// 70 ///
71 /// </summary> 71 /// </summary>
72 public void RegisterHandlers() 72 public void RegisterHandlers()
73 { 73 {
74 Console.WriteLine("registering CAPS handlers"); 74 Console.WriteLine("registering CAPS handlers");
75 string capsBase = "/CAPS/" + m_capsObjectPath; 75 string capsBase = "/CAPS/" + m_capsObjectPath;
76 76
77 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); 77 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer ));
78 httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); 78 httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest));
79 79
80 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 80 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
81 // AddLegacyCapsHandler( httpListener, eventQueue, ProcessEventQueue); 81 // AddLegacyCapsHandler( httpListener, eventQueue, ProcessEventQueue);
82 // AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture); 82 // AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture);
83 } 83 }
84 84
85 [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] 85 [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")]
86 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) 86 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
87 { 87 {
88 string capsBase = "/CAPS/" + m_capsObjectPath; 88 string capsBase = "/CAPS/" + m_capsObjectPath;
89 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 89 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
90 } 90 }
91 91
92 /// <summary> 92 /// <summary>
93 /// 93 ///
94 /// </summary> 94 /// </summary>
95 /// <param name="request"></param> 95 /// <param name="request"></param>
96 /// <param name="path"></param> 96 /// <param name="path"></param>
97 /// <param name="param"></param> 97 /// <param name="param"></param>
98 /// <returns></returns> 98 /// <returns></returns>
99 public string CapsRequest(string request, string path, string param) 99 public string CapsRequest(string request, string path, string param)
100 { 100 {
101 // Console.WriteLine("caps request " + request); 101 // Console.WriteLine("caps request " + request);
102 string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); 102 string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities());
103 return result; 103 return result;
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// 107 ///
108 /// </summary> 108 /// </summary>
109 /// <returns></returns> 109 /// <returns></returns>
110 protected LLSDCapsDetails GetCapabilities() 110 protected LLSDCapsDetails GetCapabilities()
111 { 111 {
112 LLSDCapsDetails caps = new LLSDCapsDetails(); 112 LLSDCapsDetails caps = new LLSDCapsDetails();
113 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 113 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
114 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 114 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
115 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 115 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
116 //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; 116 //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
117 // caps.ChatSessionRequest = capsBaseUrl + m_requestTexture; 117 // caps.ChatSessionRequest = capsBaseUrl + m_requestTexture;
118 return caps; 118 return caps;
119 } 119 }
120 120
121 /// <summary> 121 /// <summary>
122 /// 122 ///
123 /// </summary> 123 /// </summary>
124 /// <param name="mapReq"></param> 124 /// <param name="mapReq"></param>
125 /// <returns></returns> 125 /// <returns></returns>
126 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) 126 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
127 { 127 {
128 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 128 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
129 mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); 129 mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse());
130 return mapResponse; 130 return mapResponse;
131 } 131 }
132 132
133 /// <summary> 133 /// <summary>
134 /// 134 ///
135 /// </summary> 135 /// </summary>
136 /// <returns></returns> 136 /// <returns></returns>
137 protected LLSDMapLayer GetLLSDMapLayerResponse() 137 protected LLSDMapLayer GetLLSDMapLayerResponse()
138 { 138 {
139 LLSDMapLayer mapLayer = new LLSDMapLayer(); 139 LLSDMapLayer mapLayer = new LLSDMapLayer();
140 mapLayer.Right = 5000; 140 mapLayer.Right = 5000;
141 mapLayer.Top = 5000; 141 mapLayer.Top = 5000;
142 mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); 142 mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
143 return mapLayer; 143 return mapLayer;
144 } 144 }
145 145
146 /// <summary> 146 /// <summary>
147 /// 147 ///
148 /// </summary> 148 /// </summary>
149 /// <param name="request"></param> 149 /// <param name="request"></param>
150 /// <param name="path"></param> 150 /// <param name="path"></param>
151 /// <param name="param"></param> 151 /// <param name="param"></param>
152 /// <returns></returns> 152 /// <returns></returns>
153 public string RequestTexture(string request, string path, string param) 153 public string RequestTexture(string request, string path, string param)
154 { 154 {
155 Console.WriteLine("texture request " + request); 155 Console.WriteLine("texture request " + request);
156 // Needs implementing (added to remove compiler warning) 156 // Needs implementing (added to remove compiler warning)
157 return ""; 157 return "";
158 } 158 }
159 159
160 #region EventQueue (Currently not enabled) 160 #region EventQueue (Currently not enabled)
161 /// <summary> 161 /// <summary>
162 /// 162 ///
163 /// </summary> 163 /// </summary>
164 /// <param name="request"></param> 164 /// <param name="request"></param>
165 /// <param name="path"></param> 165 /// <param name="path"></param>
166 /// <param name="param"></param> 166 /// <param name="param"></param>
167 /// <returns></returns> 167 /// <returns></returns>
168 public string ProcessEventQueue(string request, string path, string param) 168 public string ProcessEventQueue(string request, string path, string param)
169 { 169 {
170 string res = ""; 170 string res = "";
171 171
172 if (this.CapsEventQueue.Count > 0) 172 if (this.CapsEventQueue.Count > 0)
173 { 173 {
174 lock (this.CapsEventQueue) 174 lock (this.CapsEventQueue)
175 { 175 {
176 string item = CapsEventQueue.Dequeue(); 176 string item = CapsEventQueue.Dequeue();
177 res = item; 177 res = item;
178 } 178 }
179 } 179 }
180 else 180 else
181 { 181 {
182 res = this.CreateEmptyEventResponse(); 182 res = this.CreateEmptyEventResponse();
183 } 183 }
184 return res; 184 return res;
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// 188 ///
189 /// </summary> 189 /// </summary>
190 /// <param name="caps"></param> 190 /// <param name="caps"></param>
191 /// <param name="ipAddressPort"></param> 191 /// <param name="ipAddressPort"></param>
192 /// <returns></returns> 192 /// <returns></returns>
193 public string CreateEstablishAgentComms(string caps, string ipAddressPort) 193 public string CreateEstablishAgentComms(string caps, string ipAddressPort)
194 { 194 {
195 LLSDCapEvent eventItem = new LLSDCapEvent(); 195 LLSDCapEvent eventItem = new LLSDCapEvent();
196 eventItem.id = eventQueueCount; 196 eventItem.id = eventQueueCount;
197 //should be creating a EstablishAgentComms item, but there isn't a class for it yet 197 //should be creating a EstablishAgentComms item, but there isn't a class for it yet
198 eventItem.events.Array.Add(new LLSDEmpty()); 198 eventItem.events.Array.Add(new LLSDEmpty());
199 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 199 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
200 eventQueueCount++; 200 eventQueueCount++;
201 201
202 this.CapsEventQueue.Enqueue(res); 202 this.CapsEventQueue.Enqueue(res);
203 return res; 203 return res;
204 } 204 }
205 205
206 /// <summary> 206 /// <summary>
207 /// 207 ///
208 /// </summary> 208 /// </summary>
209 /// <returns></returns> 209 /// <returns></returns>
210 public string CreateEmptyEventResponse() 210 public string CreateEmptyEventResponse()
211 { 211 {
212 LLSDCapEvent eventItem = new LLSDCapEvent(); 212 LLSDCapEvent eventItem = new LLSDCapEvent();
213 eventItem.id = eventQueueCount; 213 eventItem.id = eventQueueCount;
214 eventItem.events.Array.Add(new LLSDEmpty()); 214 eventItem.events.Array.Add(new LLSDEmpty());
215 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 215 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
216 eventQueueCount++; 216 eventQueueCount++;
217 return res; 217 return res;
218 } 218 }
219 #endregion 219 #endregion
220 220
221 /// <summary> 221 /// <summary>
222 /// 222 ///
223 /// </summary> 223 /// </summary>
224 /// <param name="llsdRequest"></param> 224 /// <param name="llsdRequest"></param>
225 /// <returns></returns> 225 /// <returns></returns>
226 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 226 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
227 { 227 {
228 string capsBase = "/CAPS/" + m_capsObjectPath; 228 string capsBase = "/CAPS/" + m_capsObjectPath;
229 LLUUID newAsset = LLUUID.Random(); 229 LLUUID newAsset = LLUUID.Random();
230 LLUUID newInvItem = LLUUID.Random(); 230 LLUUID newInvItem = LLUUID.Random();
231 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 231 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
232 232
233 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); 233 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, capsBase + uploaderPath, this.httpListener);
234 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 234 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
235 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 235 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
236 236
237 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 237 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
238 uploadResponse.uploader = uploaderURL; 238 uploadResponse.uploader = uploaderURL;
239 uploadResponse.state = "upload"; 239 uploadResponse.state = "upload";
240 uploader.OnUpLoad += this.UploadCompleteHandler; 240 uploader.OnUpLoad += this.UploadCompleteHandler;
241 return uploadResponse; 241 return uploadResponse;
242 } 242 }
243 243
244 /// <summary> 244 /// <summary>
245 /// 245 ///
246 /// </summary> 246 /// </summary>
247 /// <param name="assetID"></param> 247 /// <param name="assetID"></param>
248 /// <param name="inventoryItem"></param> 248 /// <param name="inventoryItem"></param>
249 /// <param name="data"></param> 249 /// <param name="data"></param>
250 public void UploadCompleteHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) 250 public void UploadCompleteHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data)
251 { 251 {
252 AssetBase asset; 252 AssetBase asset;
253 asset = new AssetBase(); 253 asset = new AssetBase();
254 asset.FullID = assetID; 254 asset.FullID = assetID;
255 asset.Type = 0; 255 asset.Type = 0;
256 asset.InvType = 0; 256 asset.InvType = 0;
257 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); 257 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
258 asset.Data = data; 258 asset.Data = data;
259 this.assetCache.AddAsset(asset); 259 this.assetCache.AddAsset(asset);
260 } 260 }
261 261
262 public class AssetUploader 262 public class AssetUploader
263 { 263 {
264 public event UpLoadedTexture OnUpLoad; 264 public event UpLoadedTexture OnUpLoad;
265 265
266 private string uploaderPath = ""; 266 private string uploaderPath = "";
267 private LLUUID newAssetID; 267 private LLUUID newAssetID;
268 private LLUUID inventoryItemID; 268 private LLUUID inventoryItemID;
269 private BaseHttpServer httpListener; 269 private BaseHttpServer httpListener;
270 270
271 /// <summary> 271 /// <summary>
272 /// 272 ///
273 /// </summary> 273 /// </summary>
274 /// <param name="assetID"></param> 274 /// <param name="assetID"></param>
275 /// <param name="inventoryItem"></param> 275 /// <param name="inventoryItem"></param>
276 /// <param name="path"></param> 276 /// <param name="path"></param>
277 /// <param name="httpServer"></param> 277 /// <param name="httpServer"></param>
278 public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) 278 public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer)
279 { 279 {
280 newAssetID = assetID; 280 newAssetID = assetID;
281 inventoryItemID = inventoryItem; 281 inventoryItemID = inventoryItem;
282 uploaderPath = path; 282 uploaderPath = path;
283 httpListener = httpServer; 283 httpListener = httpServer;
284 } 284 }
285 285
286 /// <summary> 286 /// <summary>
287 /// 287 ///
288 /// </summary> 288 /// </summary>
289 /// <param name="data"></param> 289 /// <param name="data"></param>
290 /// <param name="path"></param> 290 /// <param name="path"></param>
291 /// <param name="param"></param> 291 /// <param name="param"></param>
292 /// <returns></returns> 292 /// <returns></returns>
293 public string uploaderCaps(byte[] data, string path, string param) 293 public string uploaderCaps(byte[] data, string path, string param)
294 { 294 {
295 LLUUID inv = this.inventoryItemID; 295 LLUUID inv = this.inventoryItemID;
296 string res = ""; 296 string res = "";
297 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 297 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
298 uploadComplete.new_asset = newAssetID.ToStringHyphenated(); 298 uploadComplete.new_asset = newAssetID.ToStringHyphenated();
299 uploadComplete.new_inventory_item = inv; 299 uploadComplete.new_inventory_item = inv;
300 uploadComplete.state = "complete"; 300 uploadComplete.state = "complete";
301 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 301 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
302 302
303 httpListener.RemoveStreamHandler("POST", uploaderPath); 303 httpListener.RemoveStreamHandler("POST", uploaderPath);
304 304
305 if (OnUpLoad != null) 305 if (OnUpLoad != null)
306 { 306 {
307 OnUpLoad(newAssetID, inv, data); 307 OnUpLoad(newAssetID, inv, data);
308 } 308 }
309 return res; 309 return res;
310 } 310 }
311 } 311 }
312 } 312 }
313} 313}
diff --git a/OpenSim/Region/Capabilities/LLSDArray.cs b/OpenSim/Region/Capabilities/LLSDArray.cs
index e04849f..d3e1979 100644
--- a/OpenSim/Region/Capabilities/LLSDArray.cs
+++ b/OpenSim/Region/Capabilities/LLSDArray.cs
@@ -1,42 +1,42 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections; 28using System.Collections;
29 29
30namespace OpenSim.Region.Capabilities 30namespace OpenSim.Region.Capabilities
31{ 31{
32 [LLSDType("ARRAY")] 32 [LLSDType("ARRAY")]
33 public class LLSDArray 33 public class LLSDArray
34 { 34 {
35 public ArrayList Array = new ArrayList(); 35 public ArrayList Array = new ArrayList();
36 36
37 public LLSDArray() 37 public LLSDArray()
38 { 38 {
39 39
40 } 40 }
41 } 41 }
42} 42}
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs
index 1b78353..5718b8f 100644
--- a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs
+++ b/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs
@@ -1,44 +1,44 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace OpenSim.Region.Capabilities
31{ 31{
32 [LLSDType("MAP")] 32 [LLSDType("MAP")]
33 public class LLSDAssetUploadComplete 33 public class LLSDAssetUploadComplete
34 { 34 {
35 public string new_asset = ""; 35 public string new_asset = "";
36 public LLUUID new_inventory_item = LLUUID.Zero; 36 public LLUUID new_inventory_item = LLUUID.Zero;
37 public string state = ""; 37 public string state = "";
38 38
39 public LLSDAssetUploadComplete() 39 public LLSDAssetUploadComplete()
40 { 40 {
41 41
42 } 42 }
43 } 43 }
44} 44}
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs
index 7ef77cb..0096fb1 100644
--- a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs
+++ b/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs
@@ -1,21 +1,21 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5 5
6namespace OpenSim.Region.Capabilities 6namespace OpenSim.Region.Capabilities
7{ 7{
8 [LLSDMap] 8 [LLSDMap]
9 public class LLSDAssetUploadRequest 9 public class LLSDAssetUploadRequest
10 { 10 {
11 public string asset_type = ""; 11 public string asset_type = "";
12 public string description = ""; 12 public string description = "";
13 public LLUUID folder_id = LLUUID.Zero; 13 public LLUUID folder_id = LLUUID.Zero;
14 public string inventory_type = ""; 14 public string inventory_type = "";
15 public string name = ""; 15 public string name = "";
16 16
17 public LLSDAssetUploadRequest() 17 public LLSDAssetUploadRequest()
18 { 18 {
19 } 19 }
20 } 20 }
21} 21}
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs
index 1a620ae..2a2a5d1 100644
--- a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs
+++ b/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs
@@ -1,18 +1,18 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Capabilities 5namespace OpenSim.Region.Capabilities
6{ 6{
7 [LLSDMap] 7 [LLSDMap]
8 public class LLSDAssetUploadResponse 8 public class LLSDAssetUploadResponse
9 { 9 {
10 public string uploader = ""; 10 public string uploader = "";
11 public string state = ""; 11 public string state = "";
12 12
13 public LLSDAssetUploadResponse() 13 public LLSDAssetUploadResponse()
14 { 14 {
15 15
16 } 16 }
17 } 17 }
18} 18}
diff --git a/OpenSim/Region/Capabilities/LLSDCapEvent.cs b/OpenSim/Region/Capabilities/LLSDCapEvent.cs
index 51b4fe0..2c2689b 100644
--- a/OpenSim/Region/Capabilities/LLSDCapEvent.cs
+++ b/OpenSim/Region/Capabilities/LLSDCapEvent.cs
@@ -1,41 +1,41 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Region.Capabilities 28namespace OpenSim.Region.Capabilities
29{ 29{
30 [LLSDType("MAP")] 30 [LLSDType("MAP")]
31 public class LLSDCapEvent 31 public class LLSDCapEvent
32 { 32 {
33 public int id = 0; 33 public int id = 0;
34 public LLSDArray events = new LLSDArray(); 34 public LLSDArray events = new LLSDArray();
35 35
36 public LLSDCapEvent() 36 public LLSDCapEvent()
37 { 37 {
38 38
39 } 39 }
40 } 40 }
41} 41}
diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
index ecb2328..132b8f7 100644
--- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
@@ -1,17 +1,17 @@
1namespace OpenSim.Region.Capabilities 1namespace OpenSim.Region.Capabilities
2{ 2{
3 [LLSDType("MAP")] 3 [LLSDType("MAP")]
4 public class LLSDCapsDetails 4 public class LLSDCapsDetails
5 { 5 {
6 public string MapLayer = ""; 6 public string MapLayer = "";
7 public string NewFileAgentInventory = ""; 7 public string NewFileAgentInventory = "";
8 //public string EventQueueGet = ""; 8 //public string EventQueueGet = "";
9 //public string RequestTextureDownload = ""; 9 //public string RequestTextureDownload = "";
10 //public string ChatSessionRequest = ""; 10 //public string ChatSessionRequest = "";
11 11
12 public LLSDCapsDetails() 12 public LLSDCapsDetails()
13 { 13 {
14 14
15 } 15 }
16 } 16 }
17} 17}
diff --git a/OpenSim/Region/Capabilities/LLSDEmpty.cs b/OpenSim/Region/Capabilities/LLSDEmpty.cs
index d79c09e..ca27c9d 100644
--- a/OpenSim/Region/Capabilities/LLSDEmpty.cs
+++ b/OpenSim/Region/Capabilities/LLSDEmpty.cs
@@ -1,38 +1,38 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Region.Capabilities 28namespace OpenSim.Region.Capabilities
29{ 29{
30 [LLSDType("MAP")] 30 [LLSDType("MAP")]
31 public class LLSDEmpty 31 public class LLSDEmpty
32 { 32 {
33 public LLSDEmpty() 33 public LLSDEmpty()
34 { 34 {
35 35
36 } 36 }
37 } 37 }
38} 38}
diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs
index 19ef0c9..efeb9b1 100644
--- a/OpenSim/Region/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Region/Capabilities/LLSDHelpers.cs
@@ -1,164 +1,164 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33using libsecondlife; 33using libsecondlife;
34 34
35namespace OpenSim.Region.Capabilities 35namespace OpenSim.Region.Capabilities
36{ 36{
37 public class LLSDHelpers 37 public class LLSDHelpers
38 { 38 {
39 public static string SerialiseLLSDReply(object obj) 39 public static string SerialiseLLSDReply(object obj)
40 { 40 {
41 StringWriter sw = new StringWriter(); 41 StringWriter sw = new StringWriter();
42 XmlTextWriter writer = new XmlTextWriter(sw); 42 XmlTextWriter writer = new XmlTextWriter(sw);
43 writer.Formatting = Formatting.None; 43 writer.Formatting = Formatting.None;
44 writer.WriteStartElement(String.Empty, "llsd", String.Empty); 44 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
45 SerializeLLSDType(writer, obj); 45 SerializeLLSDType(writer, obj);
46 writer.WriteEndElement(); 46 writer.WriteEndElement();
47 writer.Close(); 47 writer.Close();
48 return sw.ToString(); 48 return sw.ToString();
49 } 49 }
50 50
51 public static void SerializeLLSDType(XmlTextWriter writer, object obj) 51 public static void SerializeLLSDType(XmlTextWriter writer, object obj)
52 { 52 {
53 Type myType = obj.GetType(); 53 Type myType = obj.GetType();
54 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 54 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false);
55 if (llsdattributes.Length > 0) 55 if (llsdattributes.Length > 0)
56 { 56 {
57 switch (llsdattributes[0].ObjectType) 57 switch (llsdattributes[0].ObjectType)
58 { 58 {
59 case "MAP": 59 case "MAP":
60 writer.WriteStartElement(String.Empty, "map", String.Empty); 60 writer.WriteStartElement(String.Empty, "map", String.Empty);
61 FieldInfo[] fields = myType.GetFields(); 61 FieldInfo[] fields = myType.GetFields();
62 for (int i = 0; i < fields.Length; i++) 62 for (int i = 0; i < fields.Length; i++)
63 { 63 {
64 object fieldValue = fields[i].GetValue(obj); 64 object fieldValue = fields[i].GetValue(obj);
65 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); 65 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false);
66 if (fieldAttributes.Length > 0) 66 if (fieldAttributes.Length > 0)
67 { 67 {
68 writer.WriteStartElement(String.Empty, "key", String.Empty); 68 writer.WriteStartElement(String.Empty, "key", String.Empty);
69 writer.WriteString(fields[i].Name); 69 writer.WriteString(fields[i].Name);
70 writer.WriteEndElement(); 70 writer.WriteEndElement();
71 SerializeLLSDType(writer, fieldValue); 71 SerializeLLSDType(writer, fieldValue);
72 } 72 }
73 else 73 else
74 { 74 {
75 writer.WriteStartElement(String.Empty, "key", String.Empty); 75 writer.WriteStartElement(String.Empty, "key", String.Empty);
76 writer.WriteString(fields[i].Name); 76 writer.WriteString(fields[i].Name);
77 writer.WriteEndElement(); 77 writer.WriteEndElement();
78 LLSD.LLSDWriteOne(writer, fieldValue); 78 LLSD.LLSDWriteOne(writer, fieldValue);
79 } 79 }
80 } 80 }
81 writer.WriteEndElement(); 81 writer.WriteEndElement();
82 break; 82 break;
83 case "ARRAY": 83 case "ARRAY":
84 // LLSDArray arrayObject = obj as LLSDArray; 84 // LLSDArray arrayObject = obj as LLSDArray;
85 // ArrayList a = arrayObject.Array; 85 // ArrayList a = arrayObject.Array;
86 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); 86 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj);
87 if (a != null) 87 if (a != null)
88 { 88 {
89 writer.WriteStartElement(String.Empty, "array", String.Empty); 89 writer.WriteStartElement(String.Empty, "array", String.Empty);
90 foreach (object item in a) 90 foreach (object item in a)
91 { 91 {
92 SerializeLLSDType(writer, item); 92 SerializeLLSDType(writer, item);
93 } 93 }
94 writer.WriteEndElement(); 94 writer.WriteEndElement();
95 } 95 }
96 break; 96 break;
97 } 97 }
98 } 98 }
99 else 99 else
100 { 100 {
101 LLSD.LLSDWriteOne(writer, obj); 101 LLSD.LLSDWriteOne(writer, obj);
102 } 102 }
103 } 103 }
104 104
105 public static object DeserialiseLLSDMap(Hashtable llsd, object obj) 105 public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
106 { 106 {
107 Type myType = obj.GetType(); 107 Type myType = obj.GetType();
108 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 108 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false);
109 if (llsdattributes.Length > 0) 109 if (llsdattributes.Length > 0)
110 { 110 {
111 switch (llsdattributes[0].ObjectType) 111 switch (llsdattributes[0].ObjectType)
112 { 112 {
113 case "MAP": 113 case "MAP":
114 IDictionaryEnumerator enumerator = llsd.GetEnumerator(); 114 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
115 while (enumerator.MoveNext()) 115 while (enumerator.MoveNext())
116 { 116 {
117 FieldInfo field = myType.GetField((string)enumerator.Key); 117 FieldInfo field = myType.GetField((string)enumerator.Key);
118 if (field != null) 118 if (field != null)
119 { 119 {
120 if (enumerator.Value is Hashtable) 120 if (enumerator.Value is Hashtable)
121 { 121 {
122 object fieldValue = field.GetValue(obj); 122 object fieldValue = field.GetValue(obj);
123 DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); 123 DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
124 } 124 }
125 else if (enumerator.Value is ArrayList) 125 else if (enumerator.Value is ArrayList)
126 { 126 {
127 object fieldValue = field.GetValue(obj); 127 object fieldValue = field.GetValue(obj);
128 fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); 128 fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value);
129 //TODO 129 //TODO
130 // the LLSD map/array types in the array need to be deserialised 130 // the LLSD map/array types in the array need to be deserialised
131 // but first we need to know the right class to deserialise them into. 131 // but first we need to know the right class to deserialise them into.
132 } 132 }
133 else 133 else
134 { 134 {
135 field.SetValue(obj, enumerator.Value); 135 field.SetValue(obj, enumerator.Value);
136 } 136 }
137 } 137 }
138 } 138 }
139 break; 139 break;
140 } 140 }
141 } 141 }
142 return obj; 142 return obj;
143 } 143 }
144 } 144 }
145 145
146 146
147 147
148 148
149 149
150 150
151 151
152 152
153 153
154 154
155 155
156 156
157 157
158 158
159 159
160 160
161 161
162 162
163 163
164} 164}
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayer.cs b/OpenSim/Region/Capabilities/LLSDMapLayer.cs
index 566d0e9..e0c006c 100644
--- a/OpenSim/Region/Capabilities/LLSDMapLayer.cs
+++ b/OpenSim/Region/Capabilities/LLSDMapLayer.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace OpenSim.Region.Capabilities
31{ 31{
32 [LLSDType("MAP")] 32 [LLSDType("MAP")]
33 public class LLSDMapLayer 33 public class LLSDMapLayer
34 { 34 {
35 public int Left = 0; 35 public int Left = 0;
36 public int Right = 0; 36 public int Right = 0;
37 public int Top = 0; 37 public int Top = 0;
38 public int Bottom = 0; 38 public int Bottom = 0;
39 public LLUUID ImageID = LLUUID.Zero; 39 public LLUUID ImageID = LLUUID.Zero;
40 40
41 public LLSDMapLayer() 41 public LLSDMapLayer()
42 { 42 {
43 43
44 } 44 }
45 } 45 }
46} 46}
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs
index ce746ae..8b9837b 100644
--- a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs
+++ b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs
@@ -1,41 +1,41 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Region.Capabilities 28namespace OpenSim.Region.Capabilities
29{ 29{
30 [LLSDType("MAP")] 30 [LLSDType("MAP")]
31 public class LLSDMapLayerResponse 31 public class LLSDMapLayerResponse
32 { 32 {
33 public LLSDMapRequest AgentData = new LLSDMapRequest(); 33 public LLSDMapRequest AgentData = new LLSDMapRequest();
34 public LLSDArray LayerData = new LLSDArray(); 34 public LLSDArray LayerData = new LLSDArray();
35 35
36 public LLSDMapLayerResponse() 36 public LLSDMapLayerResponse()
37 { 37 {
38 38
39 } 39 }
40 } 40 }
41} 41}
diff --git a/OpenSim/Region/Capabilities/LLSDMapRequest.cs b/OpenSim/Region/Capabilities/LLSDMapRequest.cs
index fb739cd..8ac7943 100644
--- a/OpenSim/Region/Capabilities/LLSDMapRequest.cs
+++ b/OpenSim/Region/Capabilities/LLSDMapRequest.cs
@@ -1,13 +1,13 @@
1namespace OpenSim.Region.Capabilities 1namespace OpenSim.Region.Capabilities
2{ 2{
3 [LLSDType("MAP")] 3 [LLSDType("MAP")]
4 public class LLSDMapRequest 4 public class LLSDMapRequest
5 { 5 {
6 public int Flags = 0; 6 public int Flags = 0;
7 7
8 public LLSDMapRequest() 8 public LLSDMapRequest()
9 { 9 {
10 10
11 } 11 }
12 } 12 }
13} 13}
diff --git a/OpenSim/Region/Capabilities/LLSDMethod.cs b/OpenSim/Region/Capabilities/LLSDMethod.cs
index 5f42f44..068d539 100644
--- a/OpenSim/Region/Capabilities/LLSDMethod.cs
+++ b/OpenSim/Region/Capabilities/LLSDMethod.cs
@@ -1,8 +1,8 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Capabilities 5namespace OpenSim.Region.Capabilities
6{ 6{
7 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); 7 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
8} 8}
diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
index 7d99b6e..d98e23f 100644
--- a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
@@ -1,42 +1,42 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Servers; 4using OpenSim.Framework.Servers;
5using System.IO; 5using System.IO;
6using System.Collections; 6using System.Collections;
7using libsecondlife; 7using libsecondlife;
8 8
9namespace OpenSim.Region.Capabilities 9namespace OpenSim.Region.Capabilities
10{ 10{
11 public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler 11 public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler
12 where TRequest : new() 12 where TRequest : new()
13 { 13 {
14 private LLSDMethod<TRequest, TResponse> m_method; 14 private LLSDMethod<TRequest, TResponse> m_method;
15 15
16 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) 16 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
17 : base(httpMethod, path ) 17 : base(httpMethod, path )
18 { 18 {
19 m_method = method; 19 m_method = method;
20 } 20 }
21 21
22 public override byte[] Handle(string path, Stream request) 22 public override byte[] Handle(string path, Stream request)
23 { 23 {
24 //Encoding encoding = Encoding.UTF8; 24 //Encoding encoding = Encoding.UTF8;
25 //StreamReader streamReader = new StreamReader(request, false); 25 //StreamReader streamReader = new StreamReader(request, false);
26 26
27 //string requestBody = streamReader.ReadToEnd(); 27 //string requestBody = streamReader.ReadToEnd();
28 //streamReader.Close(); 28 //streamReader.Close();
29 29
30 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); 30 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request );
31 TRequest llsdRequest = new TRequest(); 31 TRequest llsdRequest = new TRequest();
32 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 32 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
33 33
34 TResponse response = m_method(llsdRequest); 34 TResponse response = m_method(llsdRequest);
35 35
36 Encoding encoding = new UTF8Encoding(false); 36 Encoding encoding = new UTF8Encoding(false);
37 37
38 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); 38 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
39 39
40 } 40 }
41 } 41 }
42} 42}
diff --git a/OpenSim/Region/Capabilities/LLSDTest.cs b/OpenSim/Region/Capabilities/LLSDTest.cs
index f23e327..78ccf67 100644
--- a/OpenSim/Region/Capabilities/LLSDTest.cs
+++ b/OpenSim/Region/Capabilities/LLSDTest.cs
@@ -1,41 +1,41 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Region.Capabilities 28namespace OpenSim.Region.Capabilities
29{ 29{
30 [LLSDType("MAP")] 30 [LLSDType("MAP")]
31 public class LLSDTest 31 public class LLSDTest
32 { 32 {
33 public int Test1 = 20; 33 public int Test1 = 20;
34 public int Test2 = 10; 34 public int Test2 = 10;
35 35
36 public LLSDTest() 36 public LLSDTest()
37 { 37 {
38 38
39 } 39 }
40 } 40 }
41} 41}
diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Region/Capabilities/LLSDType.cs
index c58a937..04f4d9a 100644
--- a/OpenSim/Region/Capabilities/LLSDType.cs
+++ b/OpenSim/Region/Capabilities/LLSDType.cs
@@ -1,59 +1,59 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29 29
30namespace OpenSim.Region.Capabilities 30namespace OpenSim.Region.Capabilities
31{ 31{
32 [AttributeUsage(AttributeTargets.Class)] 32 [AttributeUsage(AttributeTargets.Class)]
33 public class LLSDType : Attribute 33 public class LLSDType : Attribute
34 { 34 {
35 protected string myType; 35 protected string myType;
36 36
37 public LLSDType(string type) 37 public LLSDType(string type)
38 { 38 {
39 myType = type; 39 myType = type;
40 40
41 } 41 }
42 42
43 public string ObjectType 43 public string ObjectType
44 { 44 {
45 get 45 get
46 { 46 {
47 return myType; 47 return myType;
48 } 48 }
49 } 49 }
50 } 50 }
51 51
52 [AttributeUsage(AttributeTargets.Class)] 52 [AttributeUsage(AttributeTargets.Class)]
53 public class LLSDMap : LLSDType 53 public class LLSDMap : LLSDType
54 { 54 {
55 public LLSDMap() : base( "MAP" ) 55 public LLSDMap() : base( "MAP" )
56 { 56 {
57 } 57 }
58 } 58 }
59} 59}
diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
index e2cfa46..1bb6c07 100644
--- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
+++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs
@@ -1,338 +1,338 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets; 33using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Inventory; 35using OpenSim.Framework.Inventory;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Region.ClientStack; 37using OpenSim.Region.ClientStack;
38 38
39namespace OpenSim.Assets 39namespace OpenSim.Assets
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// Description of InventoryManager. 42 /// Description of InventoryManager.
43 /// </summary> 43 /// </summary>
44 public class InventoryCache 44 public class InventoryCache
45 { 45 {
46 private Dictionary<LLUUID, AgentInventory> _agentsInventory; 46 private Dictionary<LLUUID, AgentInventory> _agentsInventory;
47 private List<UserServerRequest> _serverRequests; //list of requests made to user server. 47 private List<UserServerRequest> _serverRequests; //list of requests made to user server.
48 private Encoding _enc = Encoding.ASCII; 48 private Encoding _enc = Encoding.ASCII;
49 private const uint FULL_MASK_PERMISSIONS = 2147483647; 49 private const uint FULL_MASK_PERMISSIONS = 2147483647;
50 50
51 public InventoryCache() 51 public InventoryCache()
52 { 52 {
53 _agentsInventory = new Dictionary<LLUUID, AgentInventory>(); 53 _agentsInventory = new Dictionary<LLUUID, AgentInventory>();
54 _serverRequests = new List<UserServerRequest>(); 54 _serverRequests = new List<UserServerRequest>();
55 } 55 }
56 56
57 public void AddNewAgentsInventory(AgentInventory agentInventory) 57 public void AddNewAgentsInventory(AgentInventory agentInventory)
58 { 58 {
59 if (!this._agentsInventory.ContainsKey(agentInventory.AgentID)) 59 if (!this._agentsInventory.ContainsKey(agentInventory.AgentID))
60 { 60 {
61 this._agentsInventory.Add(agentInventory.AgentID, agentInventory); 61 this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
62 } 62 }
63 } 63 }
64 64
65 public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver) 65 public AgentInventory FetchAgentsInventory(LLUUID agentID, IUserServer userserver)
66 { 66 {
67 AgentInventory res = null; 67 AgentInventory res = null;
68 if (!this._agentsInventory.ContainsKey(agentID)) 68 if (!this._agentsInventory.ContainsKey(agentID))
69 { 69 {
70 res = userserver.RequestAgentsInventory(agentID); 70 res = userserver.RequestAgentsInventory(agentID);
71 this._agentsInventory.Add(agentID,res); 71 this._agentsInventory.Add(agentID,res);
72 } 72 }
73 return res; 73 return res;
74 } 74 }
75 75
76 public AgentInventory GetAgentsInventory(LLUUID agentID) 76 public AgentInventory GetAgentsInventory(LLUUID agentID)
77 { 77 {
78 if (this._agentsInventory.ContainsKey(agentID)) 78 if (this._agentsInventory.ContainsKey(agentID))
79 { 79 {
80 return this._agentsInventory[agentID]; 80 return this._agentsInventory[agentID];
81 } 81 }
82 82
83 return null; 83 return null;
84 } 84 }
85 85
86 public void ClientLeaving(LLUUID clientID, IUserServer userserver) 86 public void ClientLeaving(LLUUID clientID, IUserServer userserver)
87 { 87 {
88 if (this._agentsInventory.ContainsKey(clientID)) 88 if (this._agentsInventory.ContainsKey(clientID))
89 { 89 {
90 if (userserver != null) 90 if (userserver != null)
91 { 91 {
92 userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]); 92 userserver.UpdateAgentsInventory(clientID, this._agentsInventory[clientID]);
93 } 93 }
94 this._agentsInventory.Remove(clientID); 94 this._agentsInventory.Remove(clientID);
95 } 95 }
96 } 96 }
97 97
98 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID) 98 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID)
99 { 99 {
100 return this.CreateNewInventoryFolder(remoteClient, folderID, 0); 100 return this.CreateNewInventoryFolder(remoteClient, folderID, 0);
101 } 101 }
102 102
103 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type) 103 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type)
104 { 104 {
105 bool res = false; 105 bool res = false;
106 if (folderID != LLUUID.Zero) //don't create a folder with a zero id 106 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
107 { 107 {
108 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 108 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
109 { 109 {
110 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); 110 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type);
111 } 111 }
112 } 112 }
113 return res; 113 return res;
114 } 114 }
115 115
116 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent) 116 public bool CreateNewInventoryFolder(ClientView remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent)
117 { 117 {
118 bool res = false; 118 bool res = false;
119 if (folderID != LLUUID.Zero) //don't create a folder with a zero id 119 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
120 { 120 {
121 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 121 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
122 { 122 {
123 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent); 123 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent);
124 } 124 }
125 } 125 }
126 return res; 126 return res;
127 } 127 }
128 128
129 public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, AssetBase asset) 129 public LLUUID AddNewInventoryItem(ClientView remoteClient, LLUUID folderID, AssetBase asset)
130 { 130 {
131 LLUUID newItem = null; 131 LLUUID newItem = null;
132 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 132 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
133 { 133 {
134 newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset); 134 newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset);
135 if (newItem != null) 135 if (newItem != null)
136 { 136 {
137 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem]; 137 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem];
138 this.SendItemUpdateCreate(remoteClient, Item); 138 this.SendItemUpdateCreate(remoteClient, Item);
139 } 139 }
140 } 140 }
141 141
142 return newItem; 142 return newItem;
143 } 143 }
144 public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID) 144 public bool DeleteInventoryItem(ClientView remoteClient, LLUUID itemID)
145 { 145 {
146 bool res = false; 146 bool res = false;
147 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 147 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
148 { 148 {
149 res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID); 149 res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID);
150 if (res) 150 if (res)
151 { 151 {
152 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); 152 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
153 remove.AgentData.AgentID = remoteClient.AgentID; 153 remove.AgentData.AgentID = remoteClient.AgentID;
154 remove.AgentData.SessionID = remoteClient.SessionID; 154 remove.AgentData.SessionID = remoteClient.SessionID;
155 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; 155 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
156 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); 156 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
157 remove.InventoryData[0].ItemID = itemID; 157 remove.InventoryData[0].ItemID = itemID;
158 remoteClient.OutPacket(remove); 158 remoteClient.OutPacket(remove);
159 } 159 }
160 } 160 }
161 161
162 return res; 162 return res;
163 } 163 }
164 164
165 public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, AssetBase asset) 165 public bool UpdateInventoryItemAsset(ClientView remoteClient, LLUUID itemID, AssetBase asset)
166 { 166 {
167 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 167 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
168 { 168 {
169 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset); 169 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset);
170 if (res) 170 if (res)
171 { 171 {
172 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; 172 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
173 this.SendItemUpdateCreate(remoteClient, Item); 173 this.SendItemUpdateCreate(remoteClient, Item);
174 } 174 }
175 return res; 175 return res;
176 } 176 }
177 177
178 return false; 178 return false;
179 } 179 }
180 180
181 public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) 181 public bool UpdateInventoryItemDetails(ClientView remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
182 { 182 {
183 if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) 183 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
184 { 184 {
185 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet); 185 bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet);
186 if (res) 186 if (res)
187 { 187 {
188 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; 188 InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID];
189 this.SendItemUpdateCreate(remoteClient, Item); 189 this.SendItemUpdateCreate(remoteClient, Item);
190 } 190 }
191 return res; 191 return res;
192 } 192 }
193 193
194 return false; 194 return false;
195 } 195 }
196 196
197 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend) 197 public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend)
198 { 198 {
199 199
200 if (this._agentsInventory.ContainsKey(userInfo.AgentID)) 200 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
201 { 201 {
202 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; 202 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
203 if (FetchDescend.InventoryData.FetchItems) 203 if (FetchDescend.InventoryData.FetchItems)
204 { 204 {
205 if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID)) 205 if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID))
206 { 206 {
207 InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID]; 207 InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID];
208 InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); 208 InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
209 Descend.AgentData.AgentID = userInfo.AgentID; 209 Descend.AgentData.AgentID = userInfo.AgentID;
210 Descend.AgentData.OwnerID = Folder.OwnerID; 210 Descend.AgentData.OwnerID = Folder.OwnerID;
211 Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; 211 Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
212 Descend.AgentData.Descendents = Folder.Items.Count; 212 Descend.AgentData.Descendents = Folder.Items.Count;
213 Descend.AgentData.Version = Folder.Items.Count; 213 Descend.AgentData.Version = Folder.Items.Count;
214 214
215 215
216 Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; 216 Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
217 for (int i = 0; i < Folder.Items.Count; i++) 217 for (int i = 0; i < Folder.Items.Count; i++)
218 { 218 {
219 219
220 InventoryItem Item = Folder.Items[i]; 220 InventoryItem Item = Folder.Items[i];
221 Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); 221 Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
222 Descend.ItemData[i].ItemID = Item.ItemID; 222 Descend.ItemData[i].ItemID = Item.ItemID;
223 Descend.ItemData[i].AssetID = Item.AssetID; 223 Descend.ItemData[i].AssetID = Item.AssetID;
224 Descend.ItemData[i].CreatorID = Item.CreatorID; 224 Descend.ItemData[i].CreatorID = Item.CreatorID;
225 Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; 225 Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
226 Descend.ItemData[i].CreationDate = 1000; 226 Descend.ItemData[i].CreationDate = 1000;
227 Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0"); 227 Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0");
228 Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; 228 Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
229 Descend.ItemData[i].Flags = 1; 229 Descend.ItemData[i].Flags = 1;
230 Descend.ItemData[i].FolderID = Item.FolderID; 230 Descend.ItemData[i].FolderID = Item.FolderID;
231 Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 231 Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
232 Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; 232 Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
233 Descend.ItemData[i].InvType = Item.InvType; 233 Descend.ItemData[i].InvType = Item.InvType;
234 Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0"); 234 Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0");
235 Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; 235 Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
236 Descend.ItemData[i].OwnerID = Item.OwnerID; 236 Descend.ItemData[i].OwnerID = Item.OwnerID;
237 Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; 237 Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
238 Descend.ItemData[i].SalePrice = 100; 238 Descend.ItemData[i].SalePrice = 100;
239 Descend.ItemData[i].SaleType = 0; 239 Descend.ItemData[i].SaleType = 0;
240 Descend.ItemData[i].Type = Item.Type; 240 Descend.ItemData[i].Type = Item.Type;
241 Descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 241 Descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
242 } 242 }
243 243
244 userInfo.OutPacket(Descend); 244 userInfo.OutPacket(Descend);
245 245
246 } 246 }
247 } 247 }
248 else 248 else
249 { 249 {
250 Console.WriteLine("fetch subfolders"); 250 Console.WriteLine("fetch subfolders");
251 } 251 }
252 } 252 }
253 } 253 }
254 254
255 public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems) 255 public void FetchInventory(ClientView userInfo, FetchInventoryPacket FetchItems)
256 { 256 {
257 if (this._agentsInventory.ContainsKey(userInfo.AgentID)) 257 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
258 { 258 {
259 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; 259 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
260 260
261 for (int i = 0; i < FetchItems.InventoryData.Length; i++) 261 for (int i = 0; i < FetchItems.InventoryData.Length; i++)
262 { 262 {
263 if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID)) 263 if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID))
264 { 264 {
265 InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID]; 265 InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID];
266 FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); 266 FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
267 InventoryReply.AgentData.AgentID = userInfo.AgentID; 267 InventoryReply.AgentData.AgentID = userInfo.AgentID;
268 InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 268 InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
269 InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); 269 InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
270 InventoryReply.InventoryData[0].ItemID = Item.ItemID; 270 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
271 InventoryReply.InventoryData[0].AssetID = Item.AssetID; 271 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
272 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; 272 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
273 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; 273 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
274 InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 274 InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
275 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); 275 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
276 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; 276 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
277 InventoryReply.InventoryData[0].Flags = 0; 277 InventoryReply.InventoryData[0].Flags = 0;
278 InventoryReply.InventoryData[0].FolderID = Item.FolderID; 278 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
279 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 279 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
280 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; 280 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
281 InventoryReply.InventoryData[0].InvType = Item.InvType; 281 InventoryReply.InventoryData[0].InvType = Item.InvType;
282 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); 282 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
283 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; 283 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
284 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; 284 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
285 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; 285 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
286 InventoryReply.InventoryData[0].SalePrice = 100; 286 InventoryReply.InventoryData[0].SalePrice = 100;
287 InventoryReply.InventoryData[0].SaleType = 0; 287 InventoryReply.InventoryData[0].SaleType = 0;
288 InventoryReply.InventoryData[0].Type = Item.Type; 288 InventoryReply.InventoryData[0].Type = Item.Type;
289 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 289 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
290 userInfo.OutPacket(InventoryReply); 290 userInfo.OutPacket(InventoryReply);
291 } 291 }
292 } 292 }
293 } 293 }
294 } 294 }
295 295
296 private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item) 296 private void SendItemUpdateCreate(ClientView remoteClient, InventoryItem Item)
297 { 297 {
298 298
299 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); 299 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
300 InventoryReply.AgentData.AgentID = remoteClient.AgentID; 300 InventoryReply.AgentData.AgentID = remoteClient.AgentID;
301 InventoryReply.AgentData.SimApproved = true; 301 InventoryReply.AgentData.SimApproved = true;
302 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; 302 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
303 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); 303 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
304 InventoryReply.InventoryData[0].ItemID = Item.ItemID; 304 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
305 InventoryReply.InventoryData[0].AssetID = Item.AssetID; 305 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
306 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; 306 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
307 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; 307 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
308 InventoryReply.InventoryData[0].CreationDate = 1000; 308 InventoryReply.InventoryData[0].CreationDate = 1000;
309 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); 309 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
310 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; 310 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
311 InventoryReply.InventoryData[0].Flags = 0; 311 InventoryReply.InventoryData[0].Flags = 0;
312 InventoryReply.InventoryData[0].FolderID = Item.FolderID; 312 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
313 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 313 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
314 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; 314 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
315 InventoryReply.InventoryData[0].InvType = Item.InvType; 315 InventoryReply.InventoryData[0].InvType = Item.InvType;
316 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); 316 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
317 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; 317 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
318 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; 318 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
319 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; 319 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
320 InventoryReply.InventoryData[0].SalePrice = 100; 320 InventoryReply.InventoryData[0].SalePrice = 100;
321 InventoryReply.InventoryData[0].SaleType = 0; 321 InventoryReply.InventoryData[0].SaleType = 0;
322 InventoryReply.InventoryData[0].Type = Item.Type; 322 InventoryReply.InventoryData[0].Type = Item.Type;
323 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 323 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
324 324
325 remoteClient.OutPacket(InventoryReply); 325 remoteClient.OutPacket(InventoryReply);
326 } 326 }
327 } 327 }
328 328
329 329
330 330
331 public class UserServerRequest 331 public class UserServerRequest
332 { 332 {
333 public UserServerRequest() 333 public UserServerRequest()
334 { 334 {
335 335
336 } 336 }
337 } 337 }
338} 338}
diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
index f4e537c..e3ad9d0 100644
--- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
+++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
@@ -1,40 +1,40 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Net.Sockets; 28using System.Net.Sockets;
29 29
30namespace OpenSim.Region.ClientStack 30namespace OpenSim.Region.ClientStack
31{ 31{
32 32
33 public interface ClientStackNetworkHandler 33 public interface ClientStackNetworkHandler
34 { 34 {
35 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); 35 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
36 void RemoveClientCircuit(uint circuitcode); 36 void RemoveClientCircuit(uint circuitcode);
37 void RegisterPacketServer(PacketServer server); 37 void RegisterPacketServer(PacketServer server);
38 } 38 }
39 39
40} 40}
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 33e34c1..2ac1000 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -1,1180 +1,1180 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Text; 31using System.Text;
32using Axiom.Math; 32using Axiom.Math;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types; 37using OpenSim.Framework.Types;
38using OpenSim.Framework.Data; 38using OpenSim.Framework.Data;
39 39
40namespace OpenSim.Region.ClientStack 40namespace OpenSim.Region.ClientStack
41{ 41{
42 partial class ClientView 42 partial class ClientView
43 { 43 {
44 public event ImprovedInstantMessage OnInstantMessage; 44 public event ImprovedInstantMessage OnInstantMessage;
45 public event ChatFromViewer OnChatFromViewer; 45 public event ChatFromViewer OnChatFromViewer;
46 public event RezObject OnRezObject; 46 public event RezObject OnRezObject;
47 public event GenericCall4 OnDeRezObject; 47 public event GenericCall4 OnDeRezObject;
48 public event ModifyTerrain OnModifyTerrain; 48 public event ModifyTerrain OnModifyTerrain;
49 public event GenericCall OnRegionHandShakeReply; 49 public event GenericCall OnRegionHandShakeReply;
50 public event GenericCall OnRequestWearables; 50 public event GenericCall OnRequestWearables;
51 public event SetAppearance OnSetAppearance; 51 public event SetAppearance OnSetAppearance;
52 public event GenericCall2 OnCompleteMovementToRegion; 52 public event GenericCall2 OnCompleteMovementToRegion;
53 public event UpdateAgent OnAgentUpdate; 53 public event UpdateAgent OnAgentUpdate;
54 public event StartAnim OnStartAnim; 54 public event StartAnim OnStartAnim;
55 public event GenericCall OnRequestAvatarsData; 55 public event GenericCall OnRequestAvatarsData;
56 public event LinkObjects OnLinkObjects; 56 public event LinkObjects OnLinkObjects;
57 public event UpdateVector OnGrapObject; 57 public event UpdateVector OnGrapObject;
58 public event ObjectSelect OnDeGrapObject; 58 public event ObjectSelect OnDeGrapObject;
59 public event ObjectDuplicate OnObjectDuplicate; 59 public event ObjectDuplicate OnObjectDuplicate;
60 public event MoveObject OnGrapUpdate; 60 public event MoveObject OnGrapUpdate;
61 public event AddNewPrim OnAddPrim; 61 public event AddNewPrim OnAddPrim;
62 public event UpdateShape OnUpdatePrimShape; 62 public event UpdateShape OnUpdatePrimShape;
63 public event ObjectSelect OnObjectSelect; 63 public event ObjectSelect OnObjectSelect;
64 public event ObjectDeselect OnObjectDeselect; 64 public event ObjectDeselect OnObjectDeselect;
65 public event GenericCall7 OnObjectDescription; 65 public event GenericCall7 OnObjectDescription;
66 public event GenericCall7 OnObjectName; 66 public event GenericCall7 OnObjectName;
67 public event UpdatePrimFlags OnUpdatePrimFlags; 67 public event UpdatePrimFlags OnUpdatePrimFlags;
68 public event UpdatePrimTexture OnUpdatePrimTexture; 68 public event UpdatePrimTexture OnUpdatePrimTexture;
69 public event UpdateVector OnUpdatePrimGroupPosition; 69 public event UpdateVector OnUpdatePrimGroupPosition;
70 public event UpdateVector OnUpdatePrimSinglePosition; 70 public event UpdateVector OnUpdatePrimSinglePosition;
71 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 71 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
72 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 72 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
73 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 73 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
74 public event UpdateVector OnUpdatePrimScale; 74 public event UpdateVector OnUpdatePrimScale;
75 public event StatusChange OnChildAgentStatus; 75 public event StatusChange OnChildAgentStatus;
76 public event GenericCall2 OnStopMovement; 76 public event GenericCall2 OnStopMovement;
77 public event NewAvatar OnNewAvatar; 77 public event NewAvatar OnNewAvatar;
78 public event GenericCall6 OnRemoveAvatar; 78 public event GenericCall6 OnRemoveAvatar;
79 public event RequestMapBlocks OnRequestMapBlocks; 79 public event RequestMapBlocks OnRequestMapBlocks;
80 public event TeleportLocationRequest OnTeleportLocationRequest; 80 public event TeleportLocationRequest OnTeleportLocationRequest;
81 81
82 public event UUIDNameRequest OnNameFromUUIDRequest; 82 public event UUIDNameRequest OnNameFromUUIDRequest;
83 83
84 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 84 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
85 public event ParcelDivideRequest OnParcelDivideRequest; 85 public event ParcelDivideRequest OnParcelDivideRequest;
86 public event ParcelJoinRequest OnParcelJoinRequest; 86 public event ParcelJoinRequest OnParcelJoinRequest;
87 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 87 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
88 public event ParcelSelectObjects OnParcelSelectObjects; 88 public event ParcelSelectObjects OnParcelSelectObjects;
89 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 89 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
90 public event EstateOwnerMessageRequest OnEstateOwnerMessage; 90 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
91 91
92 /// <summary> 92 /// <summary>
93 /// 93 ///
94 /// </summary> 94 /// </summary>
95 public LLVector3 StartPos 95 public LLVector3 StartPos
96 { 96 {
97 get 97 get
98 { 98 {
99 return startpos; 99 return startpos;
100 } 100 }
101 set 101 set
102 { 102 {
103 startpos = value; 103 startpos = value;
104 } 104 }
105 } 105 }
106 106
107 /// <summary> 107 /// <summary>
108 /// 108 ///
109 /// </summary> 109 /// </summary>
110 public LLUUID AgentId 110 public LLUUID AgentId
111 { 111 {
112 get 112 get
113 { 113 {
114 return this.AgentID; 114 return this.AgentID;
115 } 115 }
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
119 /// 119 ///
120 /// </summary> 120 /// </summary>
121 public string FirstName 121 public string FirstName
122 { 122 {
123 get 123 get
124 { 124 {
125 return this.firstName; 125 return this.firstName;
126 } 126 }
127 127
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
131 /// 131 ///
132 /// </summary> 132 /// </summary>
133 public string LastName 133 public string LastName
134 { 134 {
135 get 135 get
136 { 136 {
137 return this.lastName; 137 return this.lastName;
138 } 138 }
139 } 139 }
140 140
141 #region World/Avatar to Client 141 #region World/Avatar to Client
142 142
143 /// <summary> 143 /// <summary>
144 /// 144 ///
145 /// </summary> 145 /// </summary>
146 /// <param name="regionInfo"></param> 146 /// <param name="regionInfo"></param>
147 public void SendRegionHandshake(RegionInfo regionInfo) 147 public void SendRegionHandshake(RegionInfo regionInfo)
148 { 148 {
149 Encoding _enc = Encoding.ASCII; 149 Encoding _enc = Encoding.ASCII;
150 RegionHandshakePacket handshake = new RegionHandshakePacket(); 150 RegionHandshakePacket handshake = new RegionHandshakePacket();
151 151
152 handshake.RegionInfo.BillableFactor = regionInfo.estateSettings.billableFactor; 152 handshake.RegionInfo.BillableFactor = regionInfo.estateSettings.billableFactor;
153 handshake.RegionInfo.IsEstateManager = false; 153 handshake.RegionInfo.IsEstateManager = false;
154 handshake.RegionInfo.TerrainHeightRange00 = regionInfo.estateSettings.terrainHeightRange0; 154 handshake.RegionInfo.TerrainHeightRange00 = regionInfo.estateSettings.terrainHeightRange0;
155 handshake.RegionInfo.TerrainHeightRange01 = regionInfo.estateSettings.terrainHeightRange1; 155 handshake.RegionInfo.TerrainHeightRange01 = regionInfo.estateSettings.terrainHeightRange1;
156 handshake.RegionInfo.TerrainHeightRange10 = regionInfo.estateSettings.terrainHeightRange2; 156 handshake.RegionInfo.TerrainHeightRange10 = regionInfo.estateSettings.terrainHeightRange2;
157 handshake.RegionInfo.TerrainHeightRange11 = regionInfo.estateSettings.terrainHeightRange3; 157 handshake.RegionInfo.TerrainHeightRange11 = regionInfo.estateSettings.terrainHeightRange3;
158 handshake.RegionInfo.TerrainStartHeight00 = regionInfo.estateSettings.terrainStartHeight0; 158 handshake.RegionInfo.TerrainStartHeight00 = regionInfo.estateSettings.terrainStartHeight0;
159 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.estateSettings.terrainStartHeight1; 159 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.estateSettings.terrainStartHeight1;
160 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.estateSettings.terrainStartHeight2; 160 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.estateSettings.terrainStartHeight2;
161 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.estateSettings.terrainStartHeight3; 161 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.estateSettings.terrainStartHeight3;
162 handshake.RegionInfo.SimAccess = (byte)regionInfo.estateSettings.simAccess; 162 handshake.RegionInfo.SimAccess = (byte)regionInfo.estateSettings.simAccess;
163 handshake.RegionInfo.WaterHeight = regionInfo.estateSettings.waterHeight; 163 handshake.RegionInfo.WaterHeight = regionInfo.estateSettings.waterHeight;
164 164
165 165
166 handshake.RegionInfo.RegionFlags = (uint)regionInfo.estateSettings.regionFlags; 166 handshake.RegionInfo.RegionFlags = (uint)regionInfo.estateSettings.regionFlags;
167 167
168 handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); 168 handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0");
169 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; 169 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID;
170 handshake.RegionInfo.TerrainBase0 = regionInfo.estateSettings.terrainBase0; 170 handshake.RegionInfo.TerrainBase0 = regionInfo.estateSettings.terrainBase0;
171 handshake.RegionInfo.TerrainBase1 = regionInfo.estateSettings.terrainBase1; 171 handshake.RegionInfo.TerrainBase1 = regionInfo.estateSettings.terrainBase1;
172 handshake.RegionInfo.TerrainBase2 = regionInfo.estateSettings.terrainBase2; 172 handshake.RegionInfo.TerrainBase2 = regionInfo.estateSettings.terrainBase2;
173 handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3; 173 handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3;
174 handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0; 174 handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0;
175 handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1; 175 handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1;
176 handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2; 176 handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2;
177 handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3; 177 handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3;
178 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? 178 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
179 179
180 this.OutPacket(handshake); 180 this.OutPacket(handshake);
181 } 181 }
182 182
183 /// <summary> 183 /// <summary>
184 /// 184 ///
185 /// </summary> 185 /// </summary>
186 /// <param name="regInfo"></param> 186 /// <param name="regInfo"></param>
187 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) 187 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
188 { 188 {
189 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 189 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
190 mov.AgentData.SessionID = this.SessionID; 190 mov.AgentData.SessionID = this.SessionID;
191 mov.AgentData.AgentID = this.AgentID; 191 mov.AgentData.AgentID = this.AgentID;
192 mov.Data.RegionHandle = regInfo.RegionHandle; 192 mov.Data.RegionHandle = regInfo.RegionHandle;
193 mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this 193 mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this
194 194
195 if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) 195 if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0))
196 { 196 {
197 mov.Data.Position = this.startpos; 197 mov.Data.Position = this.startpos;
198 } 198 }
199 else 199 else
200 { 200 {
201 mov.Data.Position = pos; 201 mov.Data.Position = pos;
202 } 202 }
203 mov.Data.LookAt = look; 203 mov.Data.LookAt = look;
204 204
205 OutPacket(mov); 205 OutPacket(mov);
206 } 206 }
207 207
208 /// <summary> 208 /// <summary>
209 /// 209 ///
210 /// </summary> 210 /// </summary>
211 /// <param name="message"></param> 211 /// <param name="message"></param>
212 /// <param name="type"></param> 212 /// <param name="type"></param>
213 /// <param name="fromPos"></param> 213 /// <param name="fromPos"></param>
214 /// <param name="fromName"></param> 214 /// <param name="fromName"></param>
215 /// <param name="fromAgentID"></param> 215 /// <param name="fromAgentID"></param>
216 public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 216 public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
217 { 217 {
218 SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID); 218 SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
219 } 219 }
220 220
221 /// <summary> 221 /// <summary>
222 /// 222 ///
223 /// </summary> 223 /// </summary>
224 /// <param name="message"></param> 224 /// <param name="message"></param>
225 /// <param name="type"></param> 225 /// <param name="type"></param>
226 /// <param name="fromPos"></param> 226 /// <param name="fromPos"></param>
227 /// <param name="fromName"></param> 227 /// <param name="fromName"></param>
228 /// <param name="fromAgentID"></param> 228 /// <param name="fromAgentID"></param>
229 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 229 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
230 { 230 {
231 Encoding enc = Encoding.ASCII; 231 Encoding enc = Encoding.ASCII;
232 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); 232 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
233 reply.ChatData.Audible = 1; 233 reply.ChatData.Audible = 1;
234 reply.ChatData.Message = message; 234 reply.ChatData.Message = message;
235 reply.ChatData.ChatType = type; 235 reply.ChatData.ChatType = type;
236 reply.ChatData.SourceType = 1; 236 reply.ChatData.SourceType = 1;
237 reply.ChatData.Position = fromPos; 237 reply.ChatData.Position = fromPos;
238 reply.ChatData.FromName = enc.GetBytes(fromName + "\0"); 238 reply.ChatData.FromName = enc.GetBytes(fromName + "\0");
239 reply.ChatData.OwnerID = fromAgentID; 239 reply.ChatData.OwnerID = fromAgentID;
240 reply.ChatData.SourceID = fromAgentID; 240 reply.ChatData.SourceID = fromAgentID;
241 241
242 this.OutPacket(reply); 242 this.OutPacket(reply);
243 } 243 }
244 244
245 /// <summary> 245 /// <summary>
246 /// 246 ///
247 /// </summary> 247 /// </summary>
248 /// <remarks>TODO</remarks> 248 /// <remarks>TODO</remarks>
249 /// <param name="message"></param> 249 /// <param name="message"></param>
250 /// <param name="target"></param> 250 /// <param name="target"></param>
251 public void SendInstantMessage(string message, LLUUID target, string fromName) 251 public void SendInstantMessage(string message, LLUUID target, string fromName)
252 { 252 {
253 if (message != "typing") 253 if (message != "typing")
254 { 254 {
255 Encoding enc = Encoding.ASCII; 255 Encoding enc = Encoding.ASCII;
256 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); 256 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
257 msg.AgentData.AgentID = this.AgentID; 257 msg.AgentData.AgentID = this.AgentID;
258 msg.AgentData.SessionID = this.SessionID; 258 msg.AgentData.SessionID = this.SessionID;
259 msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); 259 msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0");
260 msg.MessageBlock.Dialog = 0; 260 msg.MessageBlock.Dialog = 0;
261 msg.MessageBlock.FromGroup = false; 261 msg.MessageBlock.FromGroup = false;
262 msg.MessageBlock.ID = target.Combine(this.SecureSessionID); 262 msg.MessageBlock.ID = target.Combine(this.SecureSessionID);
263 msg.MessageBlock.Offline = 0; 263 msg.MessageBlock.Offline = 0;
264 msg.MessageBlock.ParentEstateID = 0; 264 msg.MessageBlock.ParentEstateID = 0;
265 msg.MessageBlock.Position = new LLVector3(); 265 msg.MessageBlock.Position = new LLVector3();
266 msg.MessageBlock.RegionID = new LLUUID(); 266 msg.MessageBlock.RegionID = new LLUUID();
267 msg.MessageBlock.Timestamp = 0; 267 msg.MessageBlock.Timestamp = 0;
268 msg.MessageBlock.ToAgentID = target; 268 msg.MessageBlock.ToAgentID = target;
269 msg.MessageBlock.Message = enc.GetBytes(message + "\0"); 269 msg.MessageBlock.Message = enc.GetBytes(message + "\0");
270 msg.MessageBlock.BinaryBucket = new byte[0]; 270 msg.MessageBlock.BinaryBucket = new byte[0];
271 271
272 this.OutPacket(msg); 272 this.OutPacket(msg);
273 } 273 }
274 } 274 }
275 275
276 /// <summary> 276 /// <summary>
277 /// Send the region heightmap to the client 277 /// Send the region heightmap to the client
278 /// </summary> 278 /// </summary>
279 /// <param name="map">heightmap</param> 279 /// <param name="map">heightmap</param>
280 public virtual void SendLayerData(float[] map) 280 public virtual void SendLayerData(float[] map)
281 { 281 {
282 try 282 try
283 { 283 {
284 int[] patches = new int[4]; 284 int[] patches = new int[4];
285 285
286 for (int y = 0; y < 16; y++) 286 for (int y = 0; y < 16; y++)
287 { 287 {
288 for (int x = 0; x < 16; x = x + 4) 288 for (int x = 0; x < 16; x = x + 4)
289 { 289 {
290 patches[0] = x + 0 + y * 16; 290 patches[0] = x + 0 + y * 16;
291 patches[1] = x + 1 + y * 16; 291 patches[1] = x + 1 + y * 16;
292 patches[2] = x + 2 + y * 16; 292 patches[2] = x + 2 + y * 16;
293 patches[3] = x + 3 + y * 16; 293 patches[3] = x + 3 + y * 16;
294 294
295 Packet layerpack = TerrainManager.CreateLandPacket(map, patches); 295 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
296 OutPacket(layerpack); 296 OutPacket(layerpack);
297 } 297 }
298 } 298 }
299 } 299 }
300 catch (Exception e) 300 catch (Exception e)
301 { 301 {
302 MainLog.Instance.Warn("ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); 302 MainLog.Instance.Warn("ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString());
303 } 303 }
304 } 304 }
305 305
306 /// <summary> 306 /// <summary>
307 /// Sends a specified patch to a client 307 /// Sends a specified patch to a client
308 /// </summary> 308 /// </summary>
309 /// <param name="px">Patch coordinate (x) 0..16</param> 309 /// <param name="px">Patch coordinate (x) 0..16</param>
310 /// <param name="py">Patch coordinate (y) 0..16</param> 310 /// <param name="py">Patch coordinate (y) 0..16</param>
311 /// <param name="map">heightmap</param> 311 /// <param name="map">heightmap</param>
312 public void SendLayerData(int px, int py, float[] map) 312 public void SendLayerData(int px, int py, float[] map)
313 { 313 {
314 try 314 try
315 { 315 {
316 int[] patches = new int[1]; 316 int[] patches = new int[1];
317 int patchx, patchy; 317 int patchx, patchy;
318 patchx = px / 16; 318 patchx = px / 16;
319 patchy = py / 16; 319 patchy = py / 16;
320 320
321 patches[0] = patchx + 0 + patchy * 16; 321 patches[0] = patchx + 0 + patchy * 16;
322 322
323 Packet layerpack = TerrainManager.CreateLandPacket(map, patches); 323 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
324 OutPacket(layerpack); 324 OutPacket(layerpack);
325 } 325 }
326 catch (Exception e) 326 catch (Exception e)
327 { 327 {
328 MainLog.Instance.Warn("ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); 328 MainLog.Instance.Warn("ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
329 } 329 }
330 } 330 }
331 331
332 /// <summary> 332 /// <summary>
333 /// 333 ///
334 /// </summary> 334 /// </summary>
335 /// <param name="neighbourHandle"></param> 335 /// <param name="neighbourHandle"></param>
336 /// <param name="neighbourIP"></param> 336 /// <param name="neighbourIP"></param>
337 /// <param name="neighbourPort"></param> 337 /// <param name="neighbourPort"></param>
338 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) 338 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint)
339 { 339 {
340 IPAddress neighbourIP = neighbourEndPoint.Address; 340 IPAddress neighbourIP = neighbourEndPoint.Address;
341 ushort neighbourPort = (ushort)neighbourEndPoint.Port; 341 ushort neighbourPort = (ushort)neighbourEndPoint.Port;
342 342
343 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); 343 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
344 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 344 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
345 enablesimpacket.SimulatorInfo.Handle = neighbourHandle; 345 enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
346 346
347 byte[] byteIP = neighbourIP.GetAddressBytes(); 347 byte[] byteIP = neighbourIP.GetAddressBytes();
348 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; 348 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
349 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; 349 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
350 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; 350 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
351 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; 351 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
352 enablesimpacket.SimulatorInfo.Port = neighbourPort; 352 enablesimpacket.SimulatorInfo.Port = neighbourPort;
353 OutPacket(enablesimpacket); 353 OutPacket(enablesimpacket);
354 } 354 }
355 355
356 /// <summary> 356 /// <summary>
357 /// 357 ///
358 /// </summary> 358 /// </summary>
359 /// <returns></returns> 359 /// <returns></returns>
360 public AgentCircuitData RequestClientInfo() 360 public AgentCircuitData RequestClientInfo()
361 { 361 {
362 AgentCircuitData agentData = new AgentCircuitData(); 362 AgentCircuitData agentData = new AgentCircuitData();
363 agentData.AgentID = this.AgentId; 363 agentData.AgentID = this.AgentId;
364 agentData.SessionID = this.SessionID; 364 agentData.SessionID = this.SessionID;
365 agentData.SecureSessionID = this.SecureSessionID; 365 agentData.SecureSessionID = this.SecureSessionID;
366 agentData.circuitcode = this.CircuitCode; 366 agentData.circuitcode = this.CircuitCode;
367 agentData.child = false; 367 agentData.child = false;
368 agentData.firstname = this.firstName; 368 agentData.firstname = this.firstName;
369 agentData.lastname = this.lastName; 369 agentData.lastname = this.lastName;
370 370
371 return agentData; 371 return agentData;
372 } 372 }
373 373
374 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint) 374 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint)
375 { 375 {
376 LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); 376 LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10);
377 377
378 CrossedRegionPacket newSimPack = new CrossedRegionPacket(); 378 CrossedRegionPacket newSimPack = new CrossedRegionPacket();
379 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 379 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
380 newSimPack.AgentData.AgentID = this.AgentID; 380 newSimPack.AgentData.AgentID = this.AgentID;
381 newSimPack.AgentData.SessionID = this.SessionID; 381 newSimPack.AgentData.SessionID = this.SessionID;
382 newSimPack.Info = new CrossedRegionPacket.InfoBlock(); 382 newSimPack.Info = new CrossedRegionPacket.InfoBlock();
383 newSimPack.Info.Position = pos; 383 newSimPack.Info.Position = pos;
384 newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! 384 newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
385 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); 385 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock();
386 newSimPack.RegionData.RegionHandle = newRegionHandle; 386 newSimPack.RegionData.RegionHandle = newRegionHandle;
387 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); 387 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes();
388 newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; 388 newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
389 newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; 389 newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
390 newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; 390 newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
391 newSimPack.RegionData.SimIP += (uint)byteIP[0]; 391 newSimPack.RegionData.SimIP += (uint)byteIP[0];
392 newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; 392 newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port;
393 newSimPack.RegionData.SeedCapability = new byte[0]; 393 newSimPack.RegionData.SeedCapability = new byte[0];
394 394
395 this.OutPacket(newSimPack); 395 this.OutPacket(newSimPack);
396 //this.DowngradeClient(); 396 //this.DowngradeClient();
397 } 397 }
398 398
399 public void SendMapBlock(List<MapBlockData> mapBlocks) 399 public void SendMapBlock(List<MapBlockData> mapBlocks)
400 { 400 {
401 MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); 401 MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
402 mapReply.AgentData.AgentID = this.AgentID; 402 mapReply.AgentData.AgentID = this.AgentID;
403 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; 403 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
404 mapReply.AgentData.Flags = 0; 404 mapReply.AgentData.Flags = 0;
405 405
406 for (int i = 0; i < mapBlocks.Count; i++) 406 for (int i = 0; i < mapBlocks.Count; i++)
407 { 407 {
408 mapReply.Data[i] = new MapBlockReplyPacket.DataBlock(); 408 mapReply.Data[i] = new MapBlockReplyPacket.DataBlock();
409 mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId; 409 mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId;
410 mapReply.Data[i].X = mapBlocks[i].X; 410 mapReply.Data[i].X = mapBlocks[i].X;
411 mapReply.Data[i].Y = mapBlocks[i].Y; 411 mapReply.Data[i].Y = mapBlocks[i].Y;
412 mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight; 412 mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight;
413 mapReply.Data[i].Name = Helpers.StringToField(mapBlocks[i].Name); 413 mapReply.Data[i].Name = Helpers.StringToField(mapBlocks[i].Name);
414 mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags; 414 mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags;
415 mapReply.Data[i].Access = mapBlocks[i].Access; 415 mapReply.Data[i].Access = mapBlocks[i].Access;
416 mapReply.Data[i].Agents = mapBlocks[i].Agents; 416 mapReply.Data[i].Agents = mapBlocks[i].Agents;
417 } 417 }
418 this.OutPacket(mapReply); 418 this.OutPacket(mapReply);
419 } 419 }
420 420
421 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) 421 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
422 { 422 {
423 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 423 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
424 tpLocal.Info.AgentID = this.AgentID; 424 tpLocal.Info.AgentID = this.AgentID;
425 tpLocal.Info.TeleportFlags = flags; 425 tpLocal.Info.TeleportFlags = flags;
426 tpLocal.Info.LocationID = 2; 426 tpLocal.Info.LocationID = 2;
427 tpLocal.Info.LookAt = lookAt; 427 tpLocal.Info.LookAt = lookAt;
428 tpLocal.Info.Position = position; 428 tpLocal.Info.Position = position;
429 OutPacket(tpLocal); 429 OutPacket(tpLocal);
430 } 430 }
431 431
432 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags) 432 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags)
433 { 433 {
434 TeleportFinishPacket teleport = new TeleportFinishPacket(); 434 TeleportFinishPacket teleport = new TeleportFinishPacket();
435 teleport.Info.AgentID = this.AgentID; 435 teleport.Info.AgentID = this.AgentID;
436 teleport.Info.RegionHandle = regionHandle; 436 teleport.Info.RegionHandle = regionHandle;
437 teleport.Info.SimAccess = simAccess; 437 teleport.Info.SimAccess = simAccess;
438 teleport.Info.SeedCapability = new byte[0]; 438 teleport.Info.SeedCapability = new byte[0];
439 439
440 IPAddress oIP = newRegionEndPoint.Address; 440 IPAddress oIP = newRegionEndPoint.Address;
441 byte[] byteIP = oIP.GetAddressBytes(); 441 byte[] byteIP = oIP.GetAddressBytes();
442 uint ip = (uint)byteIP[3] << 24; 442 uint ip = (uint)byteIP[3] << 24;
443 ip += (uint)byteIP[2] << 16; 443 ip += (uint)byteIP[2] << 16;
444 ip += (uint)byteIP[1] << 8; 444 ip += (uint)byteIP[1] << 8;
445 ip += (uint)byteIP[0]; 445 ip += (uint)byteIP[0];
446 446
447 teleport.Info.SimIP = ip; 447 teleport.Info.SimIP = ip;
448 teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; 448 teleport.Info.SimPort = (ushort)newRegionEndPoint.Port;
449 teleport.Info.LocationID = 4; 449 teleport.Info.LocationID = 4;
450 teleport.Info.TeleportFlags = 1 << 4; 450 teleport.Info.TeleportFlags = 1 << 4;
451 OutPacket(teleport); 451 OutPacket(teleport);
452 } 452 }
453 453
454 /// <summary> 454 /// <summary>
455 /// 455 ///
456 /// </summary> 456 /// </summary>
457 public void SendTeleportCancel() 457 public void SendTeleportCancel()
458 { 458 {
459 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 459 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
460 tpCancel.Info.SessionID = this.SessionID; 460 tpCancel.Info.SessionID = this.SessionID;
461 tpCancel.Info.AgentID = this.AgentID; 461 tpCancel.Info.AgentID = this.AgentID;
462 462
463 OutPacket(tpCancel); 463 OutPacket(tpCancel);
464 } 464 }
465 465
466 /// <summary> 466 /// <summary>
467 /// 467 ///
468 /// </summary> 468 /// </summary>
469 public void SendTeleportLocationStart() 469 public void SendTeleportLocationStart()
470 { 470 {
471 TeleportStartPacket tpStart = new TeleportStartPacket(); 471 TeleportStartPacket tpStart = new TeleportStartPacket();
472 tpStart.Info.TeleportFlags = 16; // Teleport via location 472 tpStart.Info.TeleportFlags = 16; // Teleport via location
473 OutPacket(tpStart); 473 OutPacket(tpStart);
474 } 474 }
475 475
476 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) 476 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
477 { 477 {
478 MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); 478 MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket();
479 money.MoneyData.AgentID = this.AgentID; 479 money.MoneyData.AgentID = this.AgentID;
480 money.MoneyData.TransactionID = transaction; 480 money.MoneyData.TransactionID = transaction;
481 money.MoneyData.TransactionSuccess = success; 481 money.MoneyData.TransactionSuccess = success;
482 money.MoneyData.Description = description; 482 money.MoneyData.Description = description;
483 money.MoneyData.MoneyBalance = balance; 483 money.MoneyData.MoneyBalance = balance;
484 OutPacket(money); 484 OutPacket(money);
485 } 485 }
486 486
487 public void SendStartPingCheck(byte seq) 487 public void SendStartPingCheck(byte seq)
488 { 488 {
489 StartPingCheckPacket pc = new StartPingCheckPacket(); 489 StartPingCheckPacket pc = new StartPingCheckPacket();
490 pc.PingID.PingID = seq; 490 pc.PingID.PingID = seq;
491 OutPacket(pc); 491 OutPacket(pc);
492 } 492 }
493 493
494 public void SendKillObject(ulong regionHandle, uint avatarLocalID) 494 public void SendKillObject(ulong regionHandle, uint avatarLocalID)
495 { 495 {
496 KillObjectPacket kill = new KillObjectPacket(); 496 KillObjectPacket kill = new KillObjectPacket();
497 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 497 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
498 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 498 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
499 kill.ObjectData[0].ID = avatarLocalID; 499 kill.ObjectData[0].ID = avatarLocalID;
500 OutPacket(kill); 500 OutPacket(kill);
501 } 501 }
502 502
503 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) 503 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items)
504 { 504 {
505 Encoding enc = Encoding.ASCII; 505 Encoding enc = Encoding.ASCII;
506 uint FULL_MASK_PERMISSIONS = 2147483647; 506 uint FULL_MASK_PERMISSIONS = 2147483647;
507 InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); 507 InventoryDescendentsPacket descend = new InventoryDescendentsPacket();
508 descend.AgentData.AgentID = this.AgentId; 508 descend.AgentData.AgentID = this.AgentId;
509 descend.AgentData.OwnerID = ownerID; 509 descend.AgentData.OwnerID = ownerID;
510 descend.AgentData.FolderID = folderID; 510 descend.AgentData.FolderID = folderID;
511 descend.AgentData.Descendents = items.Count; 511 descend.AgentData.Descendents = items.Count;
512 descend.AgentData.Version = 0; 512 descend.AgentData.Version = 0;
513 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; 513 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
514 int i = 0; 514 int i = 0;
515 foreach (InventoryItemBase item in items) 515 foreach (InventoryItemBase item in items)
516 { 516 {
517 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); 517 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
518 descend.ItemData[i].ItemID = item.inventoryID; 518 descend.ItemData[i].ItemID = item.inventoryID;
519 descend.ItemData[i].AssetID = item.assetID; 519 descend.ItemData[i].AssetID = item.assetID;
520 descend.ItemData[i].CreatorID = item.creatorsID; 520 descend.ItemData[i].CreatorID = item.creatorsID;
521 descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; 521 descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
522 descend.ItemData[i].CreationDate = 1000; 522 descend.ItemData[i].CreationDate = 1000;
523 descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription+ "\0"); 523 descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription+ "\0");
524 descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; 524 descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
525 descend.ItemData[i].Flags = 1; 525 descend.ItemData[i].Flags = 1;
526 descend.ItemData[i].FolderID = item.parentFolderID; 526 descend.ItemData[i].FolderID = item.parentFolderID;
527 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 527 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
528 descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; 528 descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
529 descend.ItemData[i].InvType = (sbyte)item.type; 529 descend.ItemData[i].InvType = (sbyte)item.type;
530 descend.ItemData[i].Name = enc.GetBytes(item.inventoryName+ "\0"); 530 descend.ItemData[i].Name = enc.GetBytes(item.inventoryName+ "\0");
531 descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; 531 descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
532 descend.ItemData[i].OwnerID = item.avatarID; 532 descend.ItemData[i].OwnerID = item.avatarID;
533 descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; 533 descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
534 descend.ItemData[i].SalePrice = 0; 534 descend.ItemData[i].SalePrice = 0;
535 descend.ItemData[i].SaleType = 0; 535 descend.ItemData[i].SaleType = 0;
536 descend.ItemData[i].Type = (sbyte)item.type; 536 descend.ItemData[i].Type = (sbyte)item.type;
537 descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100,descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 537 descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100,descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
538 538
539 i++; 539 i++;
540 } 540 }
541 541
542 this.OutPacket(descend); 542 this.OutPacket(descend);
543 543
544 } 544 }
545 545
546 public void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) 546 public void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item)
547 { 547 {
548 Encoding enc = Encoding.ASCII; 548 Encoding enc = Encoding.ASCII;
549 uint FULL_MASK_PERMISSIONS = 2147483647; 549 uint FULL_MASK_PERMISSIONS = 2147483647;
550 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); 550 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket();
551 inventoryReply.AgentData.AgentID = this.AgentId; 551 inventoryReply.AgentData.AgentID = this.AgentId;
552 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 552 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
553 inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); 553 inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
554 inventoryReply.InventoryData[0].ItemID = item.inventoryID; 554 inventoryReply.InventoryData[0].ItemID = item.inventoryID;
555 inventoryReply.InventoryData[0].AssetID = item.assetID; 555 inventoryReply.InventoryData[0].AssetID = item.assetID;
556 inventoryReply.InventoryData[0].CreatorID = item.creatorsID; 556 inventoryReply.InventoryData[0].CreatorID = item.creatorsID;
557 inventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; 557 inventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
558 inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 558 inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
559 inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); 559 inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0");
560 inventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; 560 inventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
561 inventoryReply.InventoryData[0].Flags = 0; 561 inventoryReply.InventoryData[0].Flags = 0;
562 inventoryReply.InventoryData[0].FolderID = item.parentFolderID; 562 inventoryReply.InventoryData[0].FolderID = item.parentFolderID;
563 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 563 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
564 inventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; 564 inventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
565 inventoryReply.InventoryData[0].InvType = (sbyte)item.type; 565 inventoryReply.InventoryData[0].InvType = (sbyte)item.type;
566 inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); 566 inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0");
567 inventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; 567 inventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
568 inventoryReply.InventoryData[0].OwnerID = item.avatarID; 568 inventoryReply.InventoryData[0].OwnerID = item.avatarID;
569 inventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; 569 inventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
570 inventoryReply.InventoryData[0].SalePrice = 0; 570 inventoryReply.InventoryData[0].SalePrice = 0;
571 inventoryReply.InventoryData[0].SaleType = 0; 571 inventoryReply.InventoryData[0].SaleType = 0;
572 inventoryReply.InventoryData[0].Type = (sbyte)item.type; 572 inventoryReply.InventoryData[0].Type = (sbyte)item.type;
573 inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].GroupID, 100, inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 573 inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].GroupID, 100, inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
574 574
575 this.OutPacket(inventoryReply); 575 this.OutPacket(inventoryReply);
576 } 576 }
577 577
578 #region Appearance/ Wearables Methods 578 #region Appearance/ Wearables Methods
579 579
580 /// <summary> 580 /// <summary>
581 /// 581 ///
582 /// </summary> 582 /// </summary>
583 /// <param name="wearables"></param> 583 /// <param name="wearables"></param>
584 public void SendWearables(AvatarWearable[] wearables) 584 public void SendWearables(AvatarWearable[] wearables)
585 { 585 {
586 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); 586 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
587 aw.AgentData.AgentID = this.AgentID; 587 aw.AgentData.AgentID = this.AgentID;
588 aw.AgentData.SerialNum = 0; 588 aw.AgentData.SerialNum = 0;
589 aw.AgentData.SessionID = this.SessionID; 589 aw.AgentData.SessionID = this.SessionID;
590 590
591 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; 591 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
592 AgentWearablesUpdatePacket.WearableDataBlock awb; 592 AgentWearablesUpdatePacket.WearableDataBlock awb;
593 for (int i = 0; i < wearables.Length; i++) 593 for (int i = 0; i < wearables.Length; i++)
594 { 594 {
595 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 595 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
596 awb.WearableType = (byte)i; 596 awb.WearableType = (byte)i;
597 awb.AssetID = wearables[i].AssetID; 597 awb.AssetID = wearables[i].AssetID;
598 awb.ItemID = wearables[i].ItemID; 598 awb.ItemID = wearables[i].ItemID;
599 aw.WearableData[i] = awb; 599 aw.WearableData[i] = awb;
600 } 600 }
601 601
602 this.OutPacket(aw); 602 this.OutPacket(aw);
603 } 603 }
604 604
605 /// <summary> 605 /// <summary>
606 /// 606 ///
607 /// </summary> 607 /// </summary>
608 /// <param name="agentID"></param> 608 /// <param name="agentID"></param>
609 /// <param name="visualParams"></param> 609 /// <param name="visualParams"></param>
610 /// <param name="textureEntry"></param> 610 /// <param name="textureEntry"></param>
611 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) 611 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
612 { 612 {
613 AvatarAppearancePacket avp = new AvatarAppearancePacket(); 613 AvatarAppearancePacket avp = new AvatarAppearancePacket();
614 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 614 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
615 avp.ObjectData.TextureEntry = textureEntry; 615 avp.ObjectData.TextureEntry = textureEntry;
616 616
617 AvatarAppearancePacket.VisualParamBlock avblock = null; 617 AvatarAppearancePacket.VisualParamBlock avblock = null;
618 for (int i = 0; i < visualParams.Length; i++) 618 for (int i = 0; i < visualParams.Length; i++)
619 { 619 {
620 avblock = new AvatarAppearancePacket.VisualParamBlock(); 620 avblock = new AvatarAppearancePacket.VisualParamBlock();
621 avblock.ParamValue = visualParams[i]; 621 avblock.ParamValue = visualParams[i];
622 avp.VisualParam[i] = avblock; 622 avp.VisualParam[i] = avblock;
623 } 623 }
624 624
625 avp.Sender.IsTrial = false; 625 avp.Sender.IsTrial = false;
626 avp.Sender.ID = agentID; 626 avp.Sender.ID = agentID;
627 OutPacket(avp); 627 OutPacket(avp);
628 } 628 }
629 629
630 public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) 630 public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId)
631 { 631 {
632 AvatarAnimationPacket ani = new AvatarAnimationPacket(); 632 AvatarAnimationPacket ani = new AvatarAnimationPacket();
633 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; 633 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
634 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); 634 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
635 ani.AnimationSourceList[0].ObjectID = sourceAgentId; 635 ani.AnimationSourceList[0].ObjectID = sourceAgentId;
636 ani.Sender = new AvatarAnimationPacket.SenderBlock(); 636 ani.Sender = new AvatarAnimationPacket.SenderBlock();
637 ani.Sender.ID = sourceAgentId; 637 ani.Sender.ID = sourceAgentId;
638 ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; 638 ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1];
639 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); 639 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
640 ani.AnimationList[0].AnimID = animID; 640 ani.AnimationList[0].AnimID = animID;
641 ani.AnimationList[0].AnimSequenceID = seq; 641 ani.AnimationList[0].AnimSequenceID = seq;
642 this.OutPacket(ani); 642 this.OutPacket(ani);
643 } 643 }
644 644
645 #endregion 645 #endregion
646 646
647 #region Avatar Packet/data sending Methods 647 #region Avatar Packet/data sending Methods
648 648
649 /// <summary> 649 /// <summary>
650 /// send a objectupdate packet with information about the clients avatar 650 /// send a objectupdate packet with information about the clients avatar
651 /// </summary> 651 /// </summary>
652 /// <param name="regionInfo"></param> 652 /// <param name="regionInfo"></param>
653 /// <param name="firstName"></param> 653 /// <param name="firstName"></param>
654 /// <param name="lastName"></param> 654 /// <param name="lastName"></param>
655 /// <param name="avatarID"></param> 655 /// <param name="avatarID"></param>
656 /// <param name="avatarLocalID"></param> 656 /// <param name="avatarLocalID"></param>
657 /// <param name="Pos"></param> 657 /// <param name="Pos"></param>
658 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) 658 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry)
659 { 659 {
660 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 660 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
661 objupdate.RegionData.RegionHandle = regionHandle; 661 objupdate.RegionData.RegionHandle = regionHandle;
662 objupdate.RegionData.TimeDilation = 64096; 662 objupdate.RegionData.TimeDilation = 64096;
663 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 663 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
664 objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry); 664 objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry);
665 665
666 //give this avatar object a local id and assign the user a name 666 //give this avatar object a local id and assign the user a name
667 objupdate.ObjectData[0].ID = avatarLocalID; 667 objupdate.ObjectData[0].ID = avatarLocalID;
668 objupdate.ObjectData[0].FullID = avatarID; 668 objupdate.ObjectData[0].FullID = avatarID;
669 objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName ); 669 objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName );
670 LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); 670 LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
671 byte[] pb = pos2.GetBytes(); 671 byte[] pb = pos2.GetBytes();
672 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 672 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
673 673
674 OutPacket(objupdate); 674 OutPacket(objupdate);
675 675
676 } 676 }
677 677
678 /// <summary> 678 /// <summary>
679 /// 679 ///
680 /// </summary> 680 /// </summary>
681 /// <param name="regionHandle"></param> 681 /// <param name="regionHandle"></param>
682 /// <param name="timeDilation"></param> 682 /// <param name="timeDilation"></param>
683 /// <param name="localID"></param> 683 /// <param name="localID"></param>
684 /// <param name="position"></param> 684 /// <param name="position"></param>
685 /// <param name="velocity"></param> 685 /// <param name="velocity"></param>
686 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) 686 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity)
687 { 687 {
688 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity); 688 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity);
689 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 689 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
690 terse.RegionData.RegionHandle = regionHandle; 690 terse.RegionData.RegionHandle = regionHandle;
691 terse.RegionData.TimeDilation = timeDilation; 691 terse.RegionData.TimeDilation = timeDilation;
692 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 692 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
693 terse.ObjectData[0] = terseBlock; 693 terse.ObjectData[0] = terseBlock;
694 694
695 this.OutPacket(terse); 695 this.OutPacket(terse);
696 } 696 }
697 697
698 #endregion 698 #endregion
699 699
700 #region Primitive Packet/data Sending Methods 700 #region Primitive Packet/data Sending Methods
701 701
702 /// <summary> 702 /// <summary>
703 /// 703 ///
704 /// </summary> 704 /// </summary>
705 /// <param name="localID"></param> 705 /// <param name="localID"></param>
706 /// <param name="rotation"></param> 706 /// <param name="rotation"></param>
707 /// <param name="attachPoint"></param> 707 /// <param name="attachPoint"></param>
708 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) 708 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
709 { 709 {
710 ObjectAttachPacket attach = new ObjectAttachPacket(); 710 ObjectAttachPacket attach = new ObjectAttachPacket();
711 attach.AgentData.AgentID = this.AgentID; 711 attach.AgentData.AgentID = this.AgentID;
712 attach.AgentData.SessionID = this.SessionID; 712 attach.AgentData.SessionID = this.SessionID;
713 attach.AgentData.AttachmentPoint = attachPoint; 713 attach.AgentData.AttachmentPoint = attachPoint;
714 attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; 714 attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
715 attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); 715 attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
716 attach.ObjectData[0].ObjectLocalID = localID; 716 attach.ObjectData[0].ObjectLocalID = localID;
717 attach.ObjectData[0].Rotation = rotation; 717 attach.ObjectData[0].Rotation = rotation;
718 718
719 this.OutPacket(attach); 719 this.OutPacket(attach);
720 } 720 }
721 721
722 /// <summary> 722 /// <summary>
723 /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive 723 /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive
724 /// or big changes to a existing primitive. 724 /// or big changes to a existing primitive.
725 /// </summary> 725 /// </summary>
726 /// <param name="regionHandle"></param> 726 /// <param name="regionHandle"></param>
727 /// <param name="timeDilation"></param> 727 /// <param name="timeDilation"></param>
728 /// <param name="localID"></param> 728 /// <param name="localID"></param>
729 /// <param name="primData"></param> 729 /// <param name="primData"></param>
730 /// <param name="pos"></param> 730 /// <param name="pos"></param>
731 /// <param name="rotation"></param> 731 /// <param name="rotation"></param>
732 /// <param name="textureID"></param> 732 /// <param name="textureID"></param>
733 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) 733 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags)
734 { 734 {
735 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 735 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
736 outPacket.RegionData.RegionHandle = regionHandle; 736 outPacket.RegionData.RegionHandle = regionHandle;
737 outPacket.RegionData.TimeDilation = timeDilation; 737 outPacket.RegionData.TimeDilation = timeDilation;
738 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 738 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
739 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags); 739 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags);
740 outPacket.ObjectData[0].ID = localID; 740 outPacket.ObjectData[0].ID = localID;
741 outPacket.ObjectData[0].FullID = primData.FullID; 741 outPacket.ObjectData[0].FullID = primData.FullID;
742 byte[] pb = pos.GetBytes(); 742 byte[] pb = pos.GetBytes();
743 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 743 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
744 byte[] rot = rotation.GetBytes(); 744 byte[] rot = rotation.GetBytes();
745 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length); 745 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length);
746 OutPacket(outPacket); 746 OutPacket(outPacket);
747 } 747 }
748 748
749 /// <summary> 749 /// <summary>
750 /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive 750 /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive
751 /// or big changes to a existing primitive. 751 /// or big changes to a existing primitive.
752 /// Uses default rotation 752 /// Uses default rotation
753 /// </summary> 753 /// </summary>
754 /// <param name="primData"></param> 754 /// <param name="primData"></param>
755 /// <param name="pos"></param> 755 /// <param name="pos"></param>
756 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) 756 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags)
757 { 757 {
758 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 758 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
759 outPacket.RegionData.RegionHandle = regionHandle; 759 outPacket.RegionData.RegionHandle = regionHandle;
760 outPacket.RegionData.TimeDilation = timeDilation; 760 outPacket.RegionData.TimeDilation = timeDilation;
761 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 761 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
762 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags); 762 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags);
763 outPacket.ObjectData[0].ID = localID; 763 outPacket.ObjectData[0].ID = localID;
764 outPacket.ObjectData[0].FullID = primData.FullID; 764 outPacket.ObjectData[0].FullID = primData.FullID;
765 byte[] pb = pos.GetBytes(); 765 byte[] pb = pos.GetBytes();
766 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 766 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
767 767
768 OutPacket(outPacket); 768 OutPacket(outPacket);
769 } 769 }
770 770
771 771
772 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) 772 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID)
773 { 773 {
774 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 774 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
775 outPacket.RegionData.RegionHandle = regionHandle; 775 outPacket.RegionData.RegionHandle = regionHandle;
776 outPacket.RegionData.TimeDilation = timeDilation; 776 outPacket.RegionData.TimeDilation = timeDilation;
777 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 777 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
778 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); 778 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags);
779 outPacket.ObjectData[0].ID = localID; 779 outPacket.ObjectData[0].ID = localID;
780 outPacket.ObjectData[0].FullID = objectID; 780 outPacket.ObjectData[0].FullID = objectID;
781 outPacket.ObjectData[0].OwnerID = ownerID; 781 outPacket.ObjectData[0].OwnerID = ownerID;
782 outPacket.ObjectData[0].Text = enc.GetBytes(text); 782 outPacket.ObjectData[0].Text = enc.GetBytes(text);
783 outPacket.ObjectData[0].ParentID = parentID; 783 outPacket.ObjectData[0].ParentID = parentID;
784 byte[] pb = pos.GetBytes(); 784 byte[] pb = pos.GetBytes();
785 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 785 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
786 byte[] rot = rotation.GetBytes(); 786 byte[] rot = rotation.GetBytes();
787 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length); 787 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length);
788 OutPacket(outPacket); 788 OutPacket(outPacket);
789 } 789 }
790 790
791 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) 791 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID)
792 { 792 {
793 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 793 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
794 outPacket.RegionData.RegionHandle = regionHandle; 794 outPacket.RegionData.RegionHandle = regionHandle;
795 outPacket.RegionData.TimeDilation = timeDilation; 795 outPacket.RegionData.TimeDilation = timeDilation;
796 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 796 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
797 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); 797 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags);
798 outPacket.ObjectData[0].ID = localID; 798 outPacket.ObjectData[0].ID = localID;
799 outPacket.ObjectData[0].FullID = objectID; 799 outPacket.ObjectData[0].FullID = objectID;
800 outPacket.ObjectData[0].OwnerID = ownerID; 800 outPacket.ObjectData[0].OwnerID = ownerID;
801 outPacket.ObjectData[0].Text = enc.GetBytes(text); 801 outPacket.ObjectData[0].Text = enc.GetBytes(text);
802 outPacket.ObjectData[0].ParentID = parentID; 802 outPacket.ObjectData[0].ParentID = parentID;
803 byte[] pb = pos.GetBytes(); 803 byte[] pb = pos.GetBytes();
804 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 804 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
805 805
806 OutPacket(outPacket); 806 OutPacket(outPacket);
807 } 807 }
808 /// <summary> 808 /// <summary>
809 /// 809 ///
810 /// </summary> 810 /// </summary>
811 /// <param name="regionHandle"></param> 811 /// <param name="regionHandle"></param>
812 /// <param name="timeDilation"></param> 812 /// <param name="timeDilation"></param>
813 /// <param name="localID"></param> 813 /// <param name="localID"></param>
814 /// <param name="position"></param> 814 /// <param name="position"></param>
815 /// <param name="rotation"></param> 815 /// <param name="rotation"></param>
816 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) 816 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation)
817 { 817 {
818 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 818 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
819 terse.RegionData.RegionHandle = regionHandle; 819 terse.RegionData.RegionHandle = regionHandle;
820 terse.RegionData.TimeDilation = timeDilation; 820 terse.RegionData.TimeDilation = timeDilation;
821 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 821 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
822 terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); 822 terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation);
823 823
824 this.OutPacket(terse); 824 this.OutPacket(terse);
825 } 825 }
826 826
827 #endregion 827 #endregion
828 828
829 #endregion 829 #endregion
830 830
831 #region Helper Methods 831 #region Helper Methods
832 832
833 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity) 833 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity)
834 { 834 {
835 byte[] bytes = new byte[60]; 835 byte[] bytes = new byte[60];
836 int i = 0; 836 int i = 0;
837 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 837 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
838 838
839 dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; 839 dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry;
840 840
841 uint ID = localID; 841 uint ID = localID;
842 842
843 bytes[i++] = (byte)(ID % 256); 843 bytes[i++] = (byte)(ID % 256);
844 bytes[i++] = (byte)((ID >> 8) % 256); 844 bytes[i++] = (byte)((ID >> 8) % 256);
845 bytes[i++] = (byte)((ID >> 16) % 256); 845 bytes[i++] = (byte)((ID >> 16) % 256);
846 bytes[i++] = (byte)((ID >> 24) % 256); 846 bytes[i++] = (byte)((ID >> 24) % 256);
847 bytes[i++] = 0; 847 bytes[i++] = 0;
848 bytes[i++] = 1; 848 bytes[i++] = 1;
849 i += 14; 849 i += 14;
850 bytes[i++] = 128; 850 bytes[i++] = 128;
851 bytes[i++] = 63; 851 bytes[i++] = 63;
852 852
853 byte[] pb = pos.GetBytes(); 853 byte[] pb = pos.GetBytes();
854 Array.Copy(pb, 0, bytes, i, pb.Length); 854 Array.Copy(pb, 0, bytes, i, pb.Length);
855 i += 12; 855 i += 12;
856 ushort InternVelocityX; 856 ushort InternVelocityX;
857 ushort InternVelocityY; 857 ushort InternVelocityY;
858 ushort InternVelocityZ; 858 ushort InternVelocityZ;
859 Vector3 internDirec = new Vector3(0, 0, 0); 859 Vector3 internDirec = new Vector3(0, 0, 0);
860 860
861 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); 861 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z);
862 862
863 internDirec = internDirec / 128.0f; 863 internDirec = internDirec / 128.0f;
864 internDirec.x += 1; 864 internDirec.x += 1;
865 internDirec.y += 1; 865 internDirec.y += 1;
866 internDirec.z += 1; 866 internDirec.z += 1;
867 867
868 InternVelocityX = (ushort)(32768 * internDirec.x); 868 InternVelocityX = (ushort)(32768 * internDirec.x);
869 InternVelocityY = (ushort)(32768 * internDirec.y); 869 InternVelocityY = (ushort)(32768 * internDirec.y);
870 InternVelocityZ = (ushort)(32768 * internDirec.z); 870 InternVelocityZ = (ushort)(32768 * internDirec.z);
871 871
872 ushort ac = 32767; 872 ushort ac = 32767;
873 bytes[i++] = (byte)(InternVelocityX % 256); 873 bytes[i++] = (byte)(InternVelocityX % 256);
874 bytes[i++] = (byte)((InternVelocityX >> 8) % 256); 874 bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
875 bytes[i++] = (byte)(InternVelocityY % 256); 875 bytes[i++] = (byte)(InternVelocityY % 256);
876 bytes[i++] = (byte)((InternVelocityY >> 8) % 256); 876 bytes[i++] = (byte)((InternVelocityY >> 8) % 256);
877 bytes[i++] = (byte)(InternVelocityZ % 256); 877 bytes[i++] = (byte)(InternVelocityZ % 256);
878 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); 878 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);
879 879
880 //accel 880 //accel
881 bytes[i++] = (byte)(ac % 256); 881 bytes[i++] = (byte)(ac % 256);
882 bytes[i++] = (byte)((ac >> 8) % 256); 882 bytes[i++] = (byte)((ac >> 8) % 256);
883 bytes[i++] = (byte)(ac % 256); 883 bytes[i++] = (byte)(ac % 256);
884 bytes[i++] = (byte)((ac >> 8) % 256); 884 bytes[i++] = (byte)((ac >> 8) % 256);
885 bytes[i++] = (byte)(ac % 256); 885 bytes[i++] = (byte)(ac % 256);
886 bytes[i++] = (byte)((ac >> 8) % 256); 886 bytes[i++] = (byte)((ac >> 8) % 256);
887 887
888 //rot 888 //rot
889 bytes[i++] = (byte)(ac % 256); 889 bytes[i++] = (byte)(ac % 256);
890 bytes[i++] = (byte)((ac >> 8) % 256); 890 bytes[i++] = (byte)((ac >> 8) % 256);
891 bytes[i++] = (byte)(ac % 256); 891 bytes[i++] = (byte)(ac % 256);
892 bytes[i++] = (byte)((ac >> 8) % 256); 892 bytes[i++] = (byte)((ac >> 8) % 256);
893 bytes[i++] = (byte)(ac % 256); 893 bytes[i++] = (byte)(ac % 256);
894 bytes[i++] = (byte)((ac >> 8) % 256); 894 bytes[i++] = (byte)((ac >> 8) % 256);
895 bytes[i++] = (byte)(ac % 256); 895 bytes[i++] = (byte)(ac % 256);
896 bytes[i++] = (byte)((ac >> 8) % 256); 896 bytes[i++] = (byte)((ac >> 8) % 256);
897 897
898 //rotation vel 898 //rotation vel
899 bytes[i++] = (byte)(ac % 256); 899 bytes[i++] = (byte)(ac % 256);
900 bytes[i++] = (byte)((ac >> 8) % 256); 900 bytes[i++] = (byte)((ac >> 8) % 256);
901 bytes[i++] = (byte)(ac % 256); 901 bytes[i++] = (byte)(ac % 256);
902 bytes[i++] = (byte)((ac >> 8) % 256); 902 bytes[i++] = (byte)((ac >> 8) % 256);
903 bytes[i++] = (byte)(ac % 256); 903 bytes[i++] = (byte)(ac % 256);
904 bytes[i++] = (byte)((ac >> 8) % 256); 904 bytes[i++] = (byte)((ac >> 8) % 256);
905 905
906 dat.Data = bytes; 906 dat.Data = bytes;
907 return (dat); 907 return (dat);
908 } 908 }
909 909
910 /// <summary> 910 /// <summary>
911 /// 911 ///
912 /// </summary> 912 /// </summary>
913 /// <param name="localID"></param> 913 /// <param name="localID"></param>
914 /// <param name="position"></param> 914 /// <param name="position"></param>
915 /// <param name="rotation"></param> 915 /// <param name="rotation"></param>
916 /// <returns></returns> 916 /// <returns></returns>
917 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) 917 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation)
918 { 918 {
919 uint ID = localID; 919 uint ID = localID;
920 byte[] bytes = new byte[60]; 920 byte[] bytes = new byte[60];
921 921
922 int i = 0; 922 int i = 0;
923 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 923 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
924 dat.TextureEntry = new byte[0]; 924 dat.TextureEntry = new byte[0];
925 bytes[i++] = (byte)(ID % 256); 925 bytes[i++] = (byte)(ID % 256);
926 bytes[i++] = (byte)((ID >> 8) % 256); 926 bytes[i++] = (byte)((ID >> 8) % 256);
927 bytes[i++] = (byte)((ID >> 16) % 256); 927 bytes[i++] = (byte)((ID >> 16) % 256);
928 bytes[i++] = (byte)((ID >> 24) % 256); 928 bytes[i++] = (byte)((ID >> 24) % 256);
929 bytes[i++] = 0; 929 bytes[i++] = 0;
930 bytes[i++] = 0; 930 bytes[i++] = 0;
931 931
932 byte[] pb = position.GetBytes(); 932 byte[] pb = position.GetBytes();
933 Array.Copy(pb, 0, bytes, i, pb.Length); 933 Array.Copy(pb, 0, bytes, i, pb.Length);
934 i += 12; 934 i += 12;
935 ushort ac = 32767; 935 ushort ac = 32767;
936 936
937 //vel 937 //vel
938 bytes[i++] = (byte)(ac % 256); 938 bytes[i++] = (byte)(ac % 256);
939 bytes[i++] = (byte)((ac >> 8) % 256); 939 bytes[i++] = (byte)((ac >> 8) % 256);
940 bytes[i++] = (byte)(ac % 256); 940 bytes[i++] = (byte)(ac % 256);
941 bytes[i++] = (byte)((ac >> 8) % 256); 941 bytes[i++] = (byte)((ac >> 8) % 256);
942 bytes[i++] = (byte)(ac % 256); 942 bytes[i++] = (byte)(ac % 256);
943 bytes[i++] = (byte)((ac >> 8) % 256); 943 bytes[i++] = (byte)((ac >> 8) % 256);
944 944
945 //accel 945 //accel
946 bytes[i++] = (byte)(ac % 256); 946 bytes[i++] = (byte)(ac % 256);
947 bytes[i++] = (byte)((ac >> 8) % 256); 947 bytes[i++] = (byte)((ac >> 8) % 256);
948 bytes[i++] = (byte)(ac % 256); 948 bytes[i++] = (byte)(ac % 256);
949 bytes[i++] = (byte)((ac >> 8) % 256); 949 bytes[i++] = (byte)((ac >> 8) % 256);
950 bytes[i++] = (byte)(ac % 256); 950 bytes[i++] = (byte)(ac % 256);
951 bytes[i++] = (byte)((ac >> 8) % 256); 951 bytes[i++] = (byte)((ac >> 8) % 256);
952 952
953 ushort rw, rx, ry, rz; 953 ushort rw, rx, ry, rz;
954 rw = (ushort)(32768 * (rotation.W + 1)); 954 rw = (ushort)(32768 * (rotation.W + 1));
955 rx = (ushort)(32768 * (rotation.X + 1)); 955 rx = (ushort)(32768 * (rotation.X + 1));
956 ry = (ushort)(32768 * (rotation.Y + 1)); 956 ry = (ushort)(32768 * (rotation.Y + 1));
957 rz = (ushort)(32768 * (rotation.Z + 1)); 957 rz = (ushort)(32768 * (rotation.Z + 1));
958 958
959 //rot 959 //rot
960 bytes[i++] = (byte)(rx % 256); 960 bytes[i++] = (byte)(rx % 256);
961 bytes[i++] = (byte)((rx >> 8) % 256); 961 bytes[i++] = (byte)((rx >> 8) % 256);
962 bytes[i++] = (byte)(ry % 256); 962 bytes[i++] = (byte)(ry % 256);
963 bytes[i++] = (byte)((ry >> 8) % 256); 963 bytes[i++] = (byte)((ry >> 8) % 256);
964 bytes[i++] = (byte)(rz % 256); 964 bytes[i++] = (byte)(rz % 256);
965 bytes[i++] = (byte)((rz >> 8) % 256); 965 bytes[i++] = (byte)((rz >> 8) % 256);
966 bytes[i++] = (byte)(rw % 256); 966 bytes[i++] = (byte)(rw % 256);
967 bytes[i++] = (byte)((rw >> 8) % 256); 967 bytes[i++] = (byte)((rw >> 8) % 256);
968 968
969 //rotation vel 969 //rotation vel
970 bytes[i++] = (byte)(ac % 256); 970 bytes[i++] = (byte)(ac % 256);
971 bytes[i++] = (byte)((ac >> 8) % 256); 971 bytes[i++] = (byte)((ac >> 8) % 256);
972 bytes[i++] = (byte)(ac % 256); 972 bytes[i++] = (byte)(ac % 256);
973 bytes[i++] = (byte)((ac >> 8) % 256); 973 bytes[i++] = (byte)((ac >> 8) % 256);
974 bytes[i++] = (byte)(ac % 256); 974 bytes[i++] = (byte)(ac % 256);
975 bytes[i++] = (byte)((ac >> 8) % 256); 975 bytes[i++] = (byte)((ac >> 8) % 256);
976 976
977 dat.Data = bytes; 977 dat.Data = bytes;
978 return dat; 978 return dat;
979 } 979 }
980 980
981 981
982 /// <summary> 982 /// <summary>
983 /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) 983 /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive)
984 /// </summary> 984 /// </summary>
985 /// <param name="primData"></param> 985 /// <param name="primData"></param>
986 /// <returns></returns> 986 /// <returns></returns>
987 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimData primData, LLUUID textureID, uint flags) 987 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimData primData, LLUUID textureID, uint flags)
988 { 988 {
989 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); 989 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
990 this.SetDefaultPrimPacketValues(objupdate); 990 this.SetDefaultPrimPacketValues(objupdate);
991 objupdate.UpdateFlags = flags; 991 objupdate.UpdateFlags = flags;
992 this.SetPrimPacketShapeData(objupdate, primData, textureID); 992 this.SetPrimPacketShapeData(objupdate, primData, textureID);
993 993
994 return objupdate; 994 return objupdate;
995 } 995 }
996 996
997 /// <summary> 997 /// <summary>
998 /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) 998 /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive)
999 /// </summary> 999 /// </summary>
1000 /// <param name="primData"></param> 1000 /// <param name="primData"></param>
1001 /// <returns></returns> 1001 /// <returns></returns>
1002 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) 1002 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags)
1003 { 1003 {
1004 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); 1004 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
1005 this.SetDefaultPrimPacketValues(objupdate); 1005 this.SetDefaultPrimPacketValues(objupdate);
1006 objupdate.UpdateFlags = flags; 1006 objupdate.UpdateFlags = flags;
1007 this.SetPrimPacketShapeData(objupdate, primShape); 1007 this.SetPrimPacketShapeData(objupdate, primShape);
1008 1008
1009 return objupdate; 1009 return objupdate;
1010 } 1010 }
1011 1011
1012 1012
1013 /// <summary> 1013 /// <summary>
1014 /// Copy the data from a PrimData object to a ObjectUpdatePacket 1014 /// Copy the data from a PrimData object to a ObjectUpdatePacket
1015 /// </summary> 1015 /// </summary>
1016 /// <param name="objectData"></param> 1016 /// <param name="objectData"></param>
1017 /// <param name="primData"></param> 1017 /// <param name="primData"></param>
1018 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimData primData, LLUUID textureID) 1018 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimData primData, LLUUID textureID)
1019 { 1019 {
1020 LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID); 1020 LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID);
1021 objectData.TextureEntry = ntex.ToBytes(); 1021 objectData.TextureEntry = ntex.ToBytes();
1022 objectData.OwnerID = primData.OwnerID; 1022 objectData.OwnerID = primData.OwnerID;
1023 objectData.ParentID = primData.ParentID; 1023 objectData.ParentID = primData.ParentID;
1024 objectData.PCode = primData.PCode; 1024 objectData.PCode = primData.PCode;
1025 objectData.PathBegin = primData.PathBegin; 1025 objectData.PathBegin = primData.PathBegin;
1026 objectData.PathEnd = primData.PathEnd; 1026 objectData.PathEnd = primData.PathEnd;
1027 objectData.PathScaleX = primData.PathScaleX; 1027 objectData.PathScaleX = primData.PathScaleX;
1028 objectData.PathScaleY = primData.PathScaleY; 1028 objectData.PathScaleY = primData.PathScaleY;
1029 objectData.PathShearX = primData.PathShearX; 1029 objectData.PathShearX = primData.PathShearX;
1030 objectData.PathShearY = primData.PathShearY; 1030 objectData.PathShearY = primData.PathShearY;
1031 objectData.PathSkew = primData.PathSkew; 1031 objectData.PathSkew = primData.PathSkew;
1032 objectData.ProfileBegin = primData.ProfileBegin; 1032 objectData.ProfileBegin = primData.ProfileBegin;
1033 objectData.ProfileEnd = primData.ProfileEnd; 1033 objectData.ProfileEnd = primData.ProfileEnd;
1034 objectData.Scale = primData.Scale; 1034 objectData.Scale = primData.Scale;
1035 objectData.PathCurve = primData.PathCurve; 1035 objectData.PathCurve = primData.PathCurve;
1036 objectData.ProfileCurve = primData.ProfileCurve; 1036 objectData.ProfileCurve = primData.ProfileCurve;
1037 objectData.ProfileHollow = primData.ProfileHollow; 1037 objectData.ProfileHollow = primData.ProfileHollow;
1038 objectData.PathRadiusOffset = primData.PathRadiusOffset; 1038 objectData.PathRadiusOffset = primData.PathRadiusOffset;
1039 objectData.PathRevolutions = primData.PathRevolutions; 1039 objectData.PathRevolutions = primData.PathRevolutions;
1040 objectData.PathTaperX = primData.PathTaperX; 1040 objectData.PathTaperX = primData.PathTaperX;
1041 objectData.PathTaperY = primData.PathTaperY; 1041 objectData.PathTaperY = primData.PathTaperY;
1042 objectData.PathTwist = primData.PathTwist; 1042 objectData.PathTwist = primData.PathTwist;
1043 objectData.PathTwistBegin = primData.PathTwistBegin; 1043 objectData.PathTwistBegin = primData.PathTwistBegin;
1044 } 1044 }
1045 1045
1046 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) 1046 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData)
1047 { 1047 {
1048 1048
1049 objectData.TextureEntry = primData.TextureEntry; 1049 objectData.TextureEntry = primData.TextureEntry;
1050 objectData.PCode = primData.PCode; 1050 objectData.PCode = primData.PCode;
1051 objectData.PathBegin = primData.PathBegin; 1051 objectData.PathBegin = primData.PathBegin;
1052 objectData.PathEnd = primData.PathEnd; 1052 objectData.PathEnd = primData.PathEnd;
1053 objectData.PathScaleX = primData.PathScaleX; 1053 objectData.PathScaleX = primData.PathScaleX;
1054 objectData.PathScaleY = primData.PathScaleY; 1054 objectData.PathScaleY = primData.PathScaleY;
1055 objectData.PathShearX = primData.PathShearX; 1055 objectData.PathShearX = primData.PathShearX;
1056 objectData.PathShearY = primData.PathShearY; 1056 objectData.PathShearY = primData.PathShearY;
1057 objectData.PathSkew = primData.PathSkew; 1057 objectData.PathSkew = primData.PathSkew;
1058 objectData.ProfileBegin = primData.ProfileBegin; 1058 objectData.ProfileBegin = primData.ProfileBegin;
1059 objectData.ProfileEnd = primData.ProfileEnd; 1059 objectData.ProfileEnd = primData.ProfileEnd;
1060 objectData.Scale = primData.Scale; 1060 objectData.Scale = primData.Scale;
1061 objectData.PathCurve = primData.PathCurve; 1061 objectData.PathCurve = primData.PathCurve;
1062 objectData.ProfileCurve = primData.ProfileCurve; 1062 objectData.ProfileCurve = primData.ProfileCurve;
1063 objectData.ProfileHollow = primData.ProfileHollow; 1063 objectData.ProfileHollow = primData.ProfileHollow;
1064 objectData.PathRadiusOffset = primData.PathRadiusOffset; 1064 objectData.PathRadiusOffset = primData.PathRadiusOffset;
1065 objectData.PathRevolutions = primData.PathRevolutions; 1065 objectData.PathRevolutions = primData.PathRevolutions;
1066 objectData.PathTaperX = primData.PathTaperX; 1066 objectData.PathTaperX = primData.PathTaperX;
1067 objectData.PathTaperY = primData.PathTaperY; 1067 objectData.PathTaperY = primData.PathTaperY;
1068 objectData.PathTwist = primData.PathTwist; 1068 objectData.PathTwist = primData.PathTwist;
1069 objectData.PathTwistBegin = primData.PathTwistBegin; 1069 objectData.PathTwistBegin = primData.PathTwistBegin;
1070 } 1070 }
1071 1071
1072 /// <summary> 1072 /// <summary>
1073 /// Set some default values in a ObjectUpdatePacket 1073 /// Set some default values in a ObjectUpdatePacket
1074 /// </summary> 1074 /// </summary>
1075 /// <param name="objdata"></param> 1075 /// <param name="objdata"></param>
1076 protected void SetDefaultPrimPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) 1076 protected void SetDefaultPrimPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
1077 { 1077 {
1078 objdata.PSBlock = new byte[0]; 1078 objdata.PSBlock = new byte[0];
1079 objdata.ExtraParams = new byte[1]; 1079 objdata.ExtraParams = new byte[1];
1080 objdata.MediaURL = new byte[0]; 1080 objdata.MediaURL = new byte[0];
1081 objdata.NameValue = new byte[0]; 1081 objdata.NameValue = new byte[0];
1082 objdata.Text = new byte[0]; 1082 objdata.Text = new byte[0];
1083 objdata.TextColor = new byte[4]; 1083 objdata.TextColor = new byte[4];
1084 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); 1084 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
1085 objdata.JointPivot = new LLVector3(0, 0, 0); 1085 objdata.JointPivot = new LLVector3(0, 0, 0);
1086 objdata.Material = 3; 1086 objdata.Material = 3;
1087 objdata.TextureAnim = new byte[0]; 1087 objdata.TextureAnim = new byte[0];
1088 objdata.Sound = LLUUID.Zero; 1088 objdata.Sound = LLUUID.Zero;
1089 objdata.State = 0; 1089 objdata.State = 0;
1090 objdata.Data = new byte[0]; 1090 objdata.Data = new byte[0];
1091 1091
1092 objdata.ObjectData = new byte[60]; 1092 objdata.ObjectData = new byte[60];
1093 objdata.ObjectData[46] = 128; 1093 objdata.ObjectData[46] = 128;
1094 objdata.ObjectData[47] = 63; 1094 objdata.ObjectData[47] = 63;
1095 } 1095 }
1096 1096
1097 1097
1098 /// <summary> 1098 /// <summary>
1099 /// 1099 ///
1100 /// </summary> 1100 /// </summary>
1101 /// <returns></returns> 1101 /// <returns></returns>
1102 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) 1102 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry)
1103 { 1103 {
1104 ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); 1104 ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
1105 1105
1106 SetDefaultAvatarPacketValues(ref objdata); 1106 SetDefaultAvatarPacketValues(ref objdata);
1107 objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); 1107 objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
1108 objdata.PathCurve = 16; 1108 objdata.PathCurve = 16;
1109 objdata.ProfileCurve = 1; 1109 objdata.ProfileCurve = 1;
1110 objdata.PathScaleX = 100; 1110 objdata.PathScaleX = 100;
1111 objdata.PathScaleY = 100; 1111 objdata.PathScaleY = 100;
1112 objdata.ParentID = 0; 1112 objdata.ParentID = 0;
1113 objdata.OwnerID = LLUUID.Zero; 1113 objdata.OwnerID = LLUUID.Zero;
1114 objdata.Scale = new LLVector3(1, 1, 1); 1114 objdata.Scale = new LLVector3(1, 1, 1);
1115 objdata.PCode = 47; 1115 objdata.PCode = 47;
1116 if (textureEntry != null) 1116 if (textureEntry != null)
1117 { 1117 {
1118 objdata.TextureEntry = textureEntry; 1118 objdata.TextureEntry = textureEntry;
1119 } 1119 }
1120 Encoding enc = Encoding.ASCII; 1120 Encoding enc = Encoding.ASCII;
1121 LLVector3 pos = new LLVector3(objdata.ObjectData, 16); 1121 LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
1122 pos.X = 100f; 1122 pos.X = 100f;
1123 objdata.ID = 8880000; 1123 objdata.ID = 8880000;
1124 objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); 1124 objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
1125 LLVector3 pos2 = new LLVector3(100f, 100f, 23f); 1125 LLVector3 pos2 = new LLVector3(100f, 100f, 23f);
1126 //objdata.FullID=user.AgentID; 1126 //objdata.FullID=user.AgentID;
1127 byte[] pb = pos.GetBytes(); 1127 byte[] pb = pos.GetBytes();
1128 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); 1128 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
1129 1129
1130 return objdata; 1130 return objdata;
1131 } 1131 }
1132 1132
1133 /// <summary> 1133 /// <summary>
1134 /// 1134 ///
1135 /// </summary> 1135 /// </summary>
1136 /// <param name="objdata"></param> 1136 /// <param name="objdata"></param>
1137 protected void SetDefaultAvatarPacketValues(ref ObjectUpdatePacket.ObjectDataBlock objdata) 1137 protected void SetDefaultAvatarPacketValues(ref ObjectUpdatePacket.ObjectDataBlock objdata)
1138 { 1138 {
1139 objdata.PSBlock = new byte[0]; 1139 objdata.PSBlock = new byte[0];
1140 objdata.ExtraParams = new byte[1]; 1140 objdata.ExtraParams = new byte[1];
1141 objdata.MediaURL = new byte[0]; 1141 objdata.MediaURL = new byte[0];
1142 objdata.NameValue = new byte[0]; 1142 objdata.NameValue = new byte[0];
1143 objdata.Text = new byte[0]; 1143 objdata.Text = new byte[0];
1144 objdata.TextColor = new byte[4]; 1144 objdata.TextColor = new byte[4];
1145 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); 1145 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
1146 objdata.JointPivot = new LLVector3(0, 0, 0); 1146 objdata.JointPivot = new LLVector3(0, 0, 0);
1147 objdata.Material = 4; 1147 objdata.Material = 4;
1148 objdata.TextureAnim = new byte[0]; 1148 objdata.TextureAnim = new byte[0];
1149 objdata.Sound = LLUUID.Zero; 1149 objdata.Sound = LLUUID.Zero;
1150 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 1150 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
1151 objdata.TextureEntry = ntex.ToBytes(); 1151 objdata.TextureEntry = ntex.ToBytes();
1152 objdata.State = 0; 1152 objdata.State = 0;
1153 objdata.Data = new byte[0]; 1153 objdata.Data = new byte[0];
1154 1154
1155 objdata.ObjectData = new byte[76]; 1155 objdata.ObjectData = new byte[76];
1156 objdata.ObjectData[15] = 128; 1156 objdata.ObjectData[15] = 128;
1157 objdata.ObjectData[16] = 63; 1157 objdata.ObjectData[16] = 63;
1158 objdata.ObjectData[56] = 128; 1158 objdata.ObjectData[56] = 128;
1159 objdata.ObjectData[61] = 102; 1159 objdata.ObjectData[61] = 102;
1160 objdata.ObjectData[62] = 40; 1160 objdata.ObjectData[62] = 40;
1161 objdata.ObjectData[63] = 61; 1161 objdata.ObjectData[63] = 61;
1162 objdata.ObjectData[64] = 189; 1162 objdata.ObjectData[64] = 189;
1163 } 1163 }
1164 1164
1165 #endregion 1165 #endregion
1166 1166
1167 public void SendNameReply(LLUUID profileId, string firstname, string lastname) 1167 public void SendNameReply(LLUUID profileId, string firstname, string lastname)
1168 { 1168 {
1169 UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); 1169 UUIDNameReplyPacket packet = new UUIDNameReplyPacket();
1170 1170
1171 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; 1171 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
1172 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); 1172 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
1173 packet.UUIDNameBlock[0].ID = profileId; 1173 packet.UUIDNameBlock[0].ID = profileId;
1174 packet.UUIDNameBlock[0].FirstName = Helpers.StringToField( firstname ); 1174 packet.UUIDNameBlock[0].FirstName = Helpers.StringToField( firstname );
1175 packet.UUIDNameBlock[0].LastName = Helpers.StringToField( lastname ); 1175 packet.UUIDNameBlock[0].LastName = Helpers.StringToField( lastname );
1176 1176
1177 OutPacket( packet ); 1177 OutPacket( packet );
1178 } 1178 }
1179 } 1179 }
1180} 1180}
diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
index 60cd33a..109f7e6 100644
--- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
+++ b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
@@ -1,357 +1,357 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Assets; 32using OpenSim.Assets;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36using OpenSim.Region.Caches; 36using OpenSim.Region.Caches;
37 37
38namespace OpenSim.Region.ClientStack 38namespace OpenSim.Region.ClientStack
39{ 39{
40 partial class ClientView 40 partial class ClientView
41 { 41 {
42 public class AgentAssetUpload 42 public class AgentAssetUpload
43 { 43 {
44 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>(); 44 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
45 private ClientView ourClient; 45 private ClientView ourClient;
46 private AssetCache m_assetCache; 46 private AssetCache m_assetCache;
47 private InventoryCache m_inventoryCache; 47 private InventoryCache m_inventoryCache;
48 48
49 public AgentAssetUpload(ClientView client, AssetCache assetCache, InventoryCache inventoryCache) 49 public AgentAssetUpload(ClientView client, AssetCache assetCache, InventoryCache inventoryCache)
50 { 50 {
51 this.ourClient = client; 51 this.ourClient = client;
52 m_assetCache = assetCache; 52 m_assetCache = assetCache;
53 m_inventoryCache = inventoryCache; 53 m_inventoryCache = inventoryCache;
54 } 54 }
55 55
56 public void AddUpload(LLUUID transactionID, AssetBase asset) 56 public void AddUpload(LLUUID transactionID, AssetBase asset)
57 { 57 {
58 AssetTransaction upload = new AssetTransaction(); 58 AssetTransaction upload = new AssetTransaction();
59 lock (this.transactions) 59 lock (this.transactions)
60 { 60 {
61 upload.Asset = asset; 61 upload.Asset = asset;
62 upload.TransactionID = transactionID; 62 upload.TransactionID = transactionID;
63 this.transactions.Add(transactionID, upload); 63 this.transactions.Add(transactionID, upload);
64 } 64 }
65 if (upload.Asset.Data.Length > 2) 65 if (upload.Asset.Data.Length > 2)
66 { 66 {
67 //is complete 67 //is complete
68 upload.UploadComplete = true; 68 upload.UploadComplete = true;
69 AssetUploadCompletePacket response = new AssetUploadCompletePacket(); 69 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
70 response.AssetBlock.Type = asset.Type; 70 response.AssetBlock.Type = asset.Type;
71 response.AssetBlock.Success = true; 71 response.AssetBlock.Success = true;
72 response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID); 72 response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID);
73 this.ourClient.OutPacket(response); 73 this.ourClient.OutPacket(response);
74 m_assetCache.AddAsset(asset); 74 m_assetCache.AddAsset(asset);
75 } 75 }
76 else 76 else
77 { 77 {
78 upload.UploadComplete = false; 78 upload.UploadComplete = false;
79 upload.XferID = Util.GetNextXferID(); 79 upload.XferID = Util.GetNextXferID();
80 RequestXferPacket xfer = new RequestXferPacket(); 80 RequestXferPacket xfer = new RequestXferPacket();
81 xfer.XferID.ID = upload.XferID; 81 xfer.XferID.ID = upload.XferID;
82 xfer.XferID.VFileType = upload.Asset.Type; 82 xfer.XferID.VFileType = upload.Asset.Type;
83 xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID); 83 xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID);
84 xfer.XferID.FilePath = 0; 84 xfer.XferID.FilePath = 0;
85 xfer.XferID.Filename = new byte[0]; 85 xfer.XferID.Filename = new byte[0];
86 this.ourClient.OutPacket(xfer); 86 this.ourClient.OutPacket(xfer);
87 } 87 }
88 88
89 } 89 }
90 90
91 public AssetBase GetUpload(LLUUID transactionID) 91 public AssetBase GetUpload(LLUUID transactionID)
92 { 92 {
93 if (this.transactions.ContainsKey(transactionID)) 93 if (this.transactions.ContainsKey(transactionID))
94 { 94 {
95 return this.transactions[transactionID].Asset; 95 return this.transactions[transactionID].Asset;
96 } 96 }
97 97
98 return null; 98 return null;
99 } 99 }
100 100
101 public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) 101 public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
102 { 102 {
103 // Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString()); 103 // Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString());
104 AssetBase asset = null; 104 AssetBase asset = null;
105 if (pack.AssetBlock.Type == 0) 105 if (pack.AssetBlock.Type == 0)
106 { 106 {
107 107
108 //first packet for transaction 108 //first packet for transaction
109 asset = new AssetBase(); 109 asset = new AssetBase();
110 asset.FullID = assetID; 110 asset.FullID = assetID;
111 asset.Type = pack.AssetBlock.Type; 111 asset.Type = pack.AssetBlock.Type;
112 asset.InvType = asset.Type; 112 asset.InvType = asset.Type;
113 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); 113 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
114 asset.Data = pack.AssetBlock.AssetData; 114 asset.Data = pack.AssetBlock.AssetData;
115 115
116 116
117 } 117 }
118 else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7) 118 else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7)
119 { 119 {
120 120
121 asset = new AssetBase(); 121 asset = new AssetBase();
122 asset.FullID = assetID; 122 asset.FullID = assetID;
123 // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated()); 123 // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated());
124 asset.Type = pack.AssetBlock.Type; 124 asset.Type = pack.AssetBlock.Type;
125 asset.InvType = asset.Type; 125 asset.InvType = asset.Type;
126 asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); 126 asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000");
127 asset.Data = pack.AssetBlock.AssetData; 127 asset.Data = pack.AssetBlock.AssetData;
128 128
129 129
130 } 130 }
131 131
132 if (asset != null) 132 if (asset != null)
133 { 133 {
134 this.AddUpload(pack.AssetBlock.TransactionID, asset); 134 this.AddUpload(pack.AssetBlock.TransactionID, asset);
135 } 135 }
136 else 136 else
137 { 137 {
138 138
139 //currently we don't support this asset type 139 //currently we don't support this asset type
140 //so lets just tell the client that the upload is complete 140 //so lets just tell the client that the upload is complete
141 AssetUploadCompletePacket response = new AssetUploadCompletePacket(); 141 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
142 response.AssetBlock.Type = pack.AssetBlock.Type; 142 response.AssetBlock.Type = pack.AssetBlock.Type;
143 response.AssetBlock.Success = true; 143 response.AssetBlock.Success = true;
144 response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID); 144 response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID);
145 this.ourClient.OutPacket(response); 145 this.ourClient.OutPacket(response);
146 } 146 }
147 147
148 } 148 }
149 149
150 #region Xfer packet system for larger uploads 150 #region Xfer packet system for larger uploads
151 151
152 public void HandleXferPacket(SendXferPacketPacket xferPacket) 152 public void HandleXferPacket(SendXferPacketPacket xferPacket)
153 { 153 {
154 lock (this.transactions) 154 lock (this.transactions)
155 { 155 {
156 foreach (AssetTransaction trans in this.transactions.Values) 156 foreach (AssetTransaction trans in this.transactions.Values)
157 { 157 {
158 if (trans.XferID == xferPacket.XferID.ID) 158 if (trans.XferID == xferPacket.XferID.ID)
159 { 159 {
160 if (trans.Asset.Data.Length > 1) 160 if (trans.Asset.Data.Length > 1)
161 { 161 {
162 byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length]; 162 byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length];
163 Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length); 163 Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length);
164 Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length); 164 Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length);
165 trans.Asset.Data = newArray; 165 trans.Asset.Data = newArray;
166 } 166 }
167 else 167 else
168 { 168 {
169 byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4]; 169 byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4];
170 Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4); 170 Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4);
171 trans.Asset.Data = newArray; 171 trans.Asset.Data = newArray;
172 } 172 }
173 173
174 if ((xferPacket.XferID.Packet & 2147483648) != 0) 174 if ((xferPacket.XferID.Packet & 2147483648) != 0)
175 { 175 {
176 //end of transfer 176 //end of transfer
177 trans.UploadComplete = true; 177 trans.UploadComplete = true;
178 AssetUploadCompletePacket response = new AssetUploadCompletePacket(); 178 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
179 response.AssetBlock.Type = trans.Asset.Type; 179 response.AssetBlock.Type = trans.Asset.Type;
180 response.AssetBlock.Success = true; 180 response.AssetBlock.Success = true;
181 response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID); 181 response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID);
182 this.ourClient.OutPacket(response); 182 this.ourClient.OutPacket(response);
183 183
184 m_assetCache.AddAsset(trans.Asset); 184 m_assetCache.AddAsset(trans.Asset);
185 //check if we should add it to inventory 185 //check if we should add it to inventory
186 if (trans.AddToInventory) 186 if (trans.AddToInventory)
187 { 187 {
188 // m_assetCache.AddAsset(trans.Asset); 188 // m_assetCache.AddAsset(trans.Asset);
189 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); 189 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
190 } 190 }
191 191
192 192
193 } 193 }
194 break; 194 break;
195 } 195 }
196 196
197 } 197 }
198 } 198 }
199 199
200 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); 200 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
201 confirmXfer.XferID.ID = xferPacket.XferID.ID; 201 confirmXfer.XferID.ID = xferPacket.XferID.ID;
202 confirmXfer.XferID.Packet = xferPacket.XferID.Packet; 202 confirmXfer.XferID.Packet = xferPacket.XferID.Packet;
203 this.ourClient.OutPacket(confirmXfer); 203 this.ourClient.OutPacket(confirmXfer);
204 } 204 }
205 205
206 #endregion 206 #endregion
207 207
208 public AssetBase AddUploadToAssetCache(LLUUID transactionID) 208 public AssetBase AddUploadToAssetCache(LLUUID transactionID)
209 { 209 {
210 AssetBase asset = null; 210 AssetBase asset = null;
211 if (this.transactions.ContainsKey(transactionID)) 211 if (this.transactions.ContainsKey(transactionID))
212 { 212 {
213 AssetTransaction trans = this.transactions[transactionID]; 213 AssetTransaction trans = this.transactions[transactionID];
214 if (trans.UploadComplete) 214 if (trans.UploadComplete)
215 { 215 {
216 m_assetCache.AddAsset(trans.Asset); 216 m_assetCache.AddAsset(trans.Asset);
217 asset = trans.Asset; 217 asset = trans.Asset;
218 } 218 }
219 } 219 }
220 220
221 return asset; 221 return asset;
222 } 222 }
223 223
224 public void CreateInventoryItem(CreateInventoryItemPacket packet) 224 public void CreateInventoryItem(CreateInventoryItemPacket packet)
225 { 225 {
226 if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) 226 if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID))
227 { 227 {
228 AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; 228 AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID];
229 trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description); 229 trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description);
230 trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name); 230 trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name);
231 trans.Asset.Type = packet.InventoryBlock.Type; 231 trans.Asset.Type = packet.InventoryBlock.Type;
232 trans.Asset.InvType = packet.InventoryBlock.InvType; 232 trans.Asset.InvType = packet.InventoryBlock.InvType;
233 if (trans.UploadComplete) 233 if (trans.UploadComplete)
234 { 234 {
235 //already complete so we can add it to the inventory 235 //already complete so we can add it to the inventory
236 //m_assetCache.AddAsset(trans.Asset); 236 //m_assetCache.AddAsset(trans.Asset);
237 m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); 237 m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset);
238 } 238 }
239 else 239 else
240 { 240 {
241 trans.AddToInventory = true; 241 trans.AddToInventory = true;
242 trans.InventFolder = packet.InventoryBlock.FolderID; 242 trans.InventFolder = packet.InventoryBlock.FolderID;
243 } 243 }
244 } 244 }
245 } 245 }
246 246
247 private class AssetTransaction 247 private class AssetTransaction
248 { 248 {
249 public uint XferID; 249 public uint XferID;
250 public AssetBase Asset; 250 public AssetBase Asset;
251 public bool AddToInventory; 251 public bool AddToInventory;
252 public LLUUID InventFolder = LLUUID.Zero; 252 public LLUUID InventFolder = LLUUID.Zero;
253 public bool UploadComplete = false; 253 public bool UploadComplete = false;
254 public LLUUID TransactionID = LLUUID.Zero; 254 public LLUUID TransactionID = LLUUID.Zero;
255 255
256 public AssetTransaction() 256 public AssetTransaction()
257 { 257 {
258 258
259 } 259 }
260 } 260 }
261 261
262 //new class , not currently used. 262 //new class , not currently used.
263 public class AssetXferUploader 263 public class AssetXferUploader
264 { 264 {
265 private IClientAPI ourClient; 265 private IClientAPI ourClient;
266 266
267 public bool UploadComplete = false; 267 public bool UploadComplete = false;
268 268
269 public bool AddToInventory; 269 public bool AddToInventory;
270 public LLUUID InventFolder = LLUUID.Zero; 270 public LLUUID InventFolder = LLUUID.Zero;
271 271
272 public uint XferID; 272 public uint XferID;
273 public AssetBase Asset; 273 public AssetBase Asset;
274 public LLUUID TransactionID = LLUUID.Zero; 274 public LLUUID TransactionID = LLUUID.Zero;
275 275
276 276
277 public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data) 277 public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data)
278 { 278 {
279 ourClient = remoteClient; 279 ourClient = remoteClient;
280 Asset = new AssetBase(); 280 Asset = new AssetBase();
281 Asset.FullID = assetID; 281 Asset.FullID = assetID;
282 Asset.InvType = type; 282 Asset.InvType = type;
283 Asset.Type = type; 283 Asset.Type = type;
284 Asset.Data = data; 284 Asset.Data = data;
285 Asset.Name = "blank"; 285 Asset.Name = "blank";
286 Asset.Description = "empty"; 286 Asset.Description = "empty";
287 TransactionID = transaction; 287 TransactionID = transaction;
288 288
289 if (Asset.Data.Length > 2) 289 if (Asset.Data.Length > 2)
290 { 290 {
291 //data block should only have data in it, if there is no more data to be uploaded 291 //data block should only have data in it, if there is no more data to be uploaded
292 this.SendCompleteMessage(); 292 this.SendCompleteMessage();
293 } 293 }
294 else 294 else
295 { 295 {
296 this.ReqestStartXfer(); 296 this.ReqestStartXfer();
297 } 297 }
298 } 298 }
299 299
300 protected void SendCompleteMessage() 300 protected void SendCompleteMessage()
301 { 301 {
302 UploadComplete = true; 302 UploadComplete = true;
303 AssetUploadCompletePacket response = new AssetUploadCompletePacket(); 303 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
304 response.AssetBlock.Type = Asset.Type; 304 response.AssetBlock.Type = Asset.Type;
305 response.AssetBlock.Success = true; 305 response.AssetBlock.Success = true;
306 response.AssetBlock.UUID = Asset.FullID; 306 response.AssetBlock.UUID = Asset.FullID;
307 this.ourClient.OutPacket(response); 307 this.ourClient.OutPacket(response);
308 308
309 //TODO trigger event 309 //TODO trigger event
310 } 310 }
311 311
312 protected void ReqestStartXfer() 312 protected void ReqestStartXfer()
313 { 313 {
314 UploadComplete = false; 314 UploadComplete = false;
315 XferID = Util.GetNextXferID(); 315 XferID = Util.GetNextXferID();
316 RequestXferPacket xfer = new RequestXferPacket(); 316 RequestXferPacket xfer = new RequestXferPacket();
317 xfer.XferID.ID = XferID; 317 xfer.XferID.ID = XferID;
318 xfer.XferID.VFileType = Asset.Type; 318 xfer.XferID.VFileType = Asset.Type;
319 xfer.XferID.VFileID = Asset.FullID; 319 xfer.XferID.VFileID = Asset.FullID;
320 xfer.XferID.FilePath = 0; 320 xfer.XferID.FilePath = 0;
321 xfer.XferID.Filename = new byte[0]; 321 xfer.XferID.Filename = new byte[0];
322 this.ourClient.OutPacket(xfer); 322 this.ourClient.OutPacket(xfer);
323 } 323 }
324 324
325 public void HandleXferPacket(uint xferID, uint packetID, byte[] data) 325 public void HandleXferPacket(uint xferID, uint packetID, byte[] data)
326 { 326 {
327 if (XferID == xferID) 327 if (XferID == xferID)
328 { 328 {
329 if (Asset.Data.Length > 1) 329 if (Asset.Data.Length > 1)
330 { 330 {
331 byte[] newArray = new byte[Asset.Data.Length + data.Length]; 331 byte[] newArray = new byte[Asset.Data.Length + data.Length];
332 Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length); 332 Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length);
333 Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length); 333 Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length);
334 Asset.Data = newArray; 334 Asset.Data = newArray;
335 } 335 }
336 else 336 else
337 { 337 {
338 byte[] newArray = new byte[data.Length - 4]; 338 byte[] newArray = new byte[data.Length - 4];
339 Array.Copy(data, 4, newArray, 0, data.Length - 4); 339 Array.Copy(data, 4, newArray, 0, data.Length - 4);
340 Asset.Data = newArray; 340 Asset.Data = newArray;
341 } 341 }
342 342
343 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket(); 343 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
344 confirmXfer.XferID.ID = xferID; 344 confirmXfer.XferID.ID = xferID;
345 confirmXfer.XferID.Packet = packetID; 345 confirmXfer.XferID.Packet = packetID;
346 this.ourClient.OutPacket(confirmXfer); 346 this.ourClient.OutPacket(confirmXfer);
347 347
348 if ((packetID & 2147483648) != 0) 348 if ((packetID & 2147483648) != 0)
349 { 349 {
350 this.SendCompleteMessage(); 350 this.SendCompleteMessage();
351 } 351 }
352 } 352 }
353 } 353 }
354 } 354 }
355 } 355 }
356 } 356 }
357} 357}
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index e67807e..27265cf 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -1,236 +1,236 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using libsecondlife.Packets; 29using libsecondlife.Packets;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31 31
32namespace OpenSim.Region.ClientStack 32namespace OpenSim.Region.ClientStack
33{ 33{
34 public partial class ClientView 34 public partial class ClientView
35 { 35 {
36 protected virtual void RegisterLocalPacketHandlers() 36 protected virtual void RegisterLocalPacketHandlers()
37 { 37 {
38 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); 38 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
39 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); 39 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
40 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); 40 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
41 } 41 }
42 42
43 protected virtual bool Logout(ClientView simClient, Packet packet) 43 protected virtual bool Logout(ClientView simClient, Packet packet)
44 { 44 {
45 MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); 45 MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request");
46 //send reply to let the client logout 46 //send reply to let the client logout
47 LogoutReplyPacket logReply = new LogoutReplyPacket(); 47 LogoutReplyPacket logReply = new LogoutReplyPacket();
48 logReply.AgentData.AgentID = this.AgentID; 48 logReply.AgentData.AgentID = this.AgentID;
49 logReply.AgentData.SessionID = this.SessionID; 49 logReply.AgentData.SessionID = this.SessionID;
50 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; 50 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
51 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); 51 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
52 logReply.InventoryData[0].ItemID = LLUUID.Zero; 52 logReply.InventoryData[0].ItemID = LLUUID.Zero;
53 OutPacket(logReply); 53 OutPacket(logReply);
54 // 54 //
55 this.KillClient(); 55 this.KillClient();
56 return true; 56 return true;
57 } 57 }
58 58
59 protected bool AgentTextureCached(ClientView simclient, Packet packet) 59 protected bool AgentTextureCached(ClientView simclient, Packet packet)
60 { 60 {
61 // Console.WriteLine(packet.ToString()); 61 // Console.WriteLine(packet.ToString());
62 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; 62 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
63 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); 63 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
64 cachedresp.AgentData.AgentID = this.AgentID; 64 cachedresp.AgentData.AgentID = this.AgentID;
65 cachedresp.AgentData.SessionID = this.SessionID; 65 cachedresp.AgentData.SessionID = this.SessionID;
66 cachedresp.AgentData.SerialNum = this.cachedtextureserial; 66 cachedresp.AgentData.SerialNum = this.cachedtextureserial;
67 this.cachedtextureserial++; 67 this.cachedtextureserial++;
68 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; 68 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
69 for (int i = 0; i < chechedtex.WearableData.Length; i++) 69 for (int i = 0; i < chechedtex.WearableData.Length; i++)
70 { 70 {
71 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 71 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
72 cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex; 72 cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex;
73 cachedresp.WearableData[i].TextureID = LLUUID.Zero; 73 cachedresp.WearableData[i].TextureID = LLUUID.Zero;
74 cachedresp.WearableData[i].HostName = new byte[0]; 74 cachedresp.WearableData[i].HostName = new byte[0];
75 } 75 }
76 this.OutPacket(cachedresp); 76 this.OutPacket(cachedresp);
77 return true; 77 return true;
78 } 78 }
79 79
80 protected bool MultipleObjUpdate(ClientView simClient, Packet packet) 80 protected bool MultipleObjUpdate(ClientView simClient, Packet packet)
81 { 81 {
82 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; 82 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
83 //System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); 83 //System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
84 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 84 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
85 { 85 {
86 #region position 86 #region position
87 if (multipleupdate.ObjectData[i].Type == 9) //change position 87 if (multipleupdate.ObjectData[i].Type == 9) //change position
88 { 88 {
89 if (OnUpdatePrimGroupPosition != null) 89 if (OnUpdatePrimGroupPosition != null)
90 { 90 {
91 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 91 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
92 OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 92 OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
93 } 93 }
94 94
95 } 95 }
96 else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position 96 else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position
97 { 97 {
98 if (OnUpdatePrimSinglePosition != null) 98 if (OnUpdatePrimSinglePosition != null)
99 { 99 {
100 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 100 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
101 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 101 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
102 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 102 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
103 } 103 }
104 } 104 }
105 #endregion position 105 #endregion position
106 #region rotation 106 #region rotation
107 else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab 107 else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab
108 { 108 {
109 if (OnUpdatePrimSingleRotation != null) 109 if (OnUpdatePrimSingleRotation != null)
110 { 110 {
111 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 111 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
112 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 112 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
113 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 113 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
114 } 114 }
115 } 115 }
116 else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse 116 else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse
117 { 117 {
118 if (OnUpdatePrimSingleRotation != null) 118 if (OnUpdatePrimSingleRotation != null)
119 { 119 {
120 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); 120 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
121 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 121 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
122 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 122 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
123 } 123 }
124 } 124 }
125 else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab 125 else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab
126 { 126 {
127 if (OnUpdatePrimGroupRotation != null) 127 if (OnUpdatePrimGroupRotation != null)
128 { 128 {
129 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 129 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
130 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 130 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
131 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 131 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
132 } 132 }
133 } 133 }
134 else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse 134 else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse
135 { 135 {
136 if (OnUpdatePrimGroupMouseRotation != null) 136 if (OnUpdatePrimGroupMouseRotation != null)
137 { 137 {
138 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 138 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
139 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); 139 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
140 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 140 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
141 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 141 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
142 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); 142 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
143 } 143 }
144 } 144 }
145 #endregion 145 #endregion
146 #region scale 146 #region scale
147 else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab 147 else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab
148 { 148 {
149 if (OnUpdatePrimScale != null) 149 if (OnUpdatePrimScale != null)
150 { 150 {
151 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 151 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
152 //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 152 //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
153 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 153 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
154 } 154 }
155 } 155 }
156 else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse 156 else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse
157 { 157 {
158 if (OnUpdatePrimScale != null) 158 if (OnUpdatePrimScale != null)
159 { 159 {
160 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 160 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
161 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); 161 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
162 // OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 162 // OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
163 } 163 }
164 } 164 }
165 else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab 165 else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab
166 { 166 {
167 if (OnUpdatePrimScale != null) 167 if (OnUpdatePrimScale != null)
168 { 168 {
169 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 169 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
170 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 170 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
171 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 171 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
172 } 172 }
173 } 173 }
174 else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse 174 else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse
175 { 175 {
176 if (OnUpdatePrimScale != null) 176 if (OnUpdatePrimScale != null)
177 { 177 {
178 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 178 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
179 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 179 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
180 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 180 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
181 } 181 }
182 } 182 }
183 #endregion 183 #endregion
184 } 184 }
185 return true; 185 return true;
186 } 186 }
187 187
188 public void RequestMapLayer() 188 public void RequestMapLayer()
189 { 189 {
190 //should be getting the map layer from the grid server 190 //should be getting the map layer from the grid server
191 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) 191 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
192 MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); 192 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
193 mapReply.AgentData.AgentID = this.AgentID; 193 mapReply.AgentData.AgentID = this.AgentID;
194 mapReply.AgentData.Flags = 0; 194 mapReply.AgentData.Flags = 0;
195 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; 195 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
196 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); 196 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
197 mapReply.LayerData[0].Bottom = 0; 197 mapReply.LayerData[0].Bottom = 0;
198 mapReply.LayerData[0].Left = 0; 198 mapReply.LayerData[0].Left = 0;
199 mapReply.LayerData[0].Top = 30000; 199 mapReply.LayerData[0].Top = 30000;
200 mapReply.LayerData[0].Right = 30000; 200 mapReply.LayerData[0].Right = 30000;
201 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); 201 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
202 this.OutPacket(mapReply); 202 this.OutPacket(mapReply);
203 } 203 }
204 204
205 public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) 205 public void RequestMapBlocks(int minX, int minY, int maxX, int maxY)
206 { 206 {
207 /* 207 /*
208 IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY); 208 IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY);
209 MapBlockReplyPacket mbReply = new MapBlockReplyPacket(); 209 MapBlockReplyPacket mbReply = new MapBlockReplyPacket();
210 mbReply.AgentData.AgentID = this.AgentID; 210 mbReply.AgentData.AgentID = this.AgentID;
211 int len; 211 int len;
212 if (simMapProfiles == null) 212 if (simMapProfiles == null)
213 len = 0; 213 len = 0;
214 else 214 else
215 len = simMapProfiles.Count; 215 len = simMapProfiles.Count;
216 216
217 mbReply.Data = new MapBlockReplyPacket.DataBlock[len]; 217 mbReply.Data = new MapBlockReplyPacket.DataBlock[len];
218 int iii; 218 int iii;
219 for (iii = 0; iii < len; iii++) 219 for (iii = 0; iii < len; iii++)
220 { 220 {
221 Hashtable mp = (Hashtable)simMapProfiles[iii]; 221 Hashtable mp = (Hashtable)simMapProfiles[iii];
222 mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock(); 222 mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock();
223 mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]); 223 mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]);
224 mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]); 224 mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]);
225 mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]); 225 mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]);
226 mbReply.Data[iii].MapImageID = new LLUUID((string)mp["map-image-id"]); 226 mbReply.Data[iii].MapImageID = new LLUUID((string)mp["map-image-id"]);
227 mbReply.Data[iii].RegionFlags = System.Convert.ToUInt32(mp["region-flags"]); 227 mbReply.Data[iii].RegionFlags = System.Convert.ToUInt32(mp["region-flags"]);
228 mbReply.Data[iii].WaterHeight = System.Convert.ToByte(mp["water-height"]); 228 mbReply.Data[iii].WaterHeight = System.Convert.ToByte(mp["water-height"]);
229 mbReply.Data[iii].X = System.Convert.ToUInt16(mp["x"]); 229 mbReply.Data[iii].X = System.Convert.ToUInt16(mp["x"]);
230 mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]); 230 mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]);
231 } 231 }
232 this.OutPacket(mbReply); 232 this.OutPacket(mbReply);
233 */ 233 */
234 } 234 }
235 } 235 }
236} 236}
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index a8512a7..1f9110c 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -1,647 +1,647 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Inventory; 33using OpenSim.Framework.Inventory;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36 36
37namespace OpenSim.Region.ClientStack 37namespace OpenSim.Region.ClientStack
38{ 38{
39 public partial class ClientView 39 public partial class ClientView
40 { 40 {
41 protected override void ProcessInPacket(Packet Pack) 41 protected override void ProcessInPacket(Packet Pack)
42 { 42 {
43 ack_pack(Pack); 43 ack_pack(Pack);
44 if (debug) 44 if (debug)
45 { 45 {
46 if (Pack.Type != PacketType.AgentUpdate) 46 if (Pack.Type != PacketType.AgentUpdate)
47 { 47 {
48 Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString()); 48 Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString());
49 } 49 }
50 } 50 }
51 51
52 if (this.ProcessPacketMethod(Pack)) 52 if (this.ProcessPacketMethod(Pack))
53 { 53 {
54 //there is a handler registered that handled this packet type 54 //there is a handler registered that handled this packet type
55 return; 55 return;
56 } 56 }
57 else 57 else
58 { 58 {
59 Encoding _enc = Encoding.ASCII; 59 Encoding _enc = Encoding.ASCII;
60 60
61 switch (Pack.Type) 61 switch (Pack.Type)
62 { 62 {
63 case PacketType.ViewerEffect: 63 case PacketType.ViewerEffect:
64 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; 64 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
65 foreach (ClientView client in m_clientThreads.Values) 65 foreach (ClientView client in m_clientThreads.Values)
66 { 66 {
67 if (client.AgentID != this.AgentID) 67 if (client.AgentID != this.AgentID)
68 { 68 {
69 viewer.AgentData.AgentID = client.AgentID; 69 viewer.AgentData.AgentID = client.AgentID;
70 viewer.AgentData.SessionID = client.SessionID; 70 viewer.AgentData.SessionID = client.SessionID;
71 client.OutPacket(viewer); 71 client.OutPacket(viewer);
72 } 72 }
73 } 73 }
74 break; 74 break;
75 75
76 #region World/Avatar 76 #region World/Avatar
77 case PacketType.ChatFromViewer: 77 case PacketType.ChatFromViewer:
78 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; 78 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
79 if (Util.FieldToString(inchatpack.ChatData.Message) == "") 79 if (Util.FieldToString(inchatpack.ChatData.Message) == "")
80 { 80 {
81 //empty message so don't bother with it 81 //empty message so don't bother with it
82 break; 82 break;
83 } 83 }
84 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; 84 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
85 byte[] message = inchatpack.ChatData.Message; 85 byte[] message = inchatpack.ChatData.Message;
86 byte type = inchatpack.ChatData.Type; 86 byte type = inchatpack.ChatData.Type;
87 LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; 87 LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
88 LLUUID fromAgentID = AgentID; 88 LLUUID fromAgentID = AgentID;
89 if (OnChatFromViewer != null) 89 if (OnChatFromViewer != null)
90 { 90 {
91 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); 91 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
92 } 92 }
93 break; 93 break;
94 case PacketType.ImprovedInstantMessage: 94 case PacketType.ImprovedInstantMessage:
95 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 95 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
96 96
97 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 97 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
98 string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); 98 string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message);
99 99
100 if (OnInstantMessage != null) 100 if (OnInstantMessage != null)
101 { 101 {
102 this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID, 102 this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID,
103 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage); 103 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage);
104 } 104 }
105 break; 105 break;
106 case PacketType.RezObject: 106 case PacketType.RezObject:
107 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 107 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
108 AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); 108 AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
109 if (inven != null) 109 if (inven != null)
110 { 110 {
111 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) 111 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
112 { 112 {
113 AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); 113 AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
114 if (asset != null) 114 if (asset != null)
115 { 115 {
116 if (OnRezObject != null) 116 if (OnRezObject != null)
117 { 117 {
118 this.OnRezObject(asset, rezPacket.RezData.RayEnd); 118 this.OnRezObject(asset, rezPacket.RezData.RayEnd);
119 this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID); 119 this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID);
120 } 120 }
121 } 121 }
122 } 122 }
123 } 123 }
124 break; 124 break;
125 case PacketType.DeRezObject: 125 case PacketType.DeRezObject:
126 if (OnDeRezObject != null) 126 if (OnDeRezObject != null)
127 { 127 {
128 OnDeRezObject(Pack, this); 128 OnDeRezObject(Pack, this);
129 } 129 }
130 break; 130 break;
131 case PacketType.ModifyLand: 131 case PacketType.ModifyLand:
132 ModifyLandPacket modify = (ModifyLandPacket)Pack; 132 ModifyLandPacket modify = (ModifyLandPacket)Pack;
133 if (modify.ParcelData.Length > 0) 133 if (modify.ParcelData.Length > 0)
134 { 134 {
135 if (OnModifyTerrain != null) 135 if (OnModifyTerrain != null)
136 { 136 {
137 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, 137 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize,
138 modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); 138 modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West);
139 } 139 }
140 } 140 }
141 break; 141 break;
142 case PacketType.RegionHandshakeReply: 142 case PacketType.RegionHandshakeReply:
143 if (OnRegionHandShakeReply != null) 143 if (OnRegionHandShakeReply != null)
144 { 144 {
145 OnRegionHandShakeReply(this); 145 OnRegionHandShakeReply(this);
146 } 146 }
147 break; 147 break;
148 case PacketType.AgentWearablesRequest: 148 case PacketType.AgentWearablesRequest:
149 if (OnRequestWearables != null) 149 if (OnRequestWearables != null)
150 { 150 {
151 OnRequestWearables(this); 151 OnRequestWearables(this);
152 } 152 }
153 if (OnRequestAvatarsData != null) 153 if (OnRequestAvatarsData != null)
154 { 154 {
155 OnRequestAvatarsData(this); 155 OnRequestAvatarsData(this);
156 } 156 }
157 break; 157 break;
158 case PacketType.AgentSetAppearance: 158 case PacketType.AgentSetAppearance:
159 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; 159 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
160 if (OnSetAppearance != null) 160 if (OnSetAppearance != null)
161 { 161 {
162 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); 162 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
163 } 163 }
164 break; 164 break;
165 case PacketType.CompleteAgentMovement: 165 case PacketType.CompleteAgentMovement:
166 if (OnCompleteMovementToRegion != null) 166 if (OnCompleteMovementToRegion != null)
167 { 167 {
168 OnCompleteMovementToRegion(); 168 OnCompleteMovementToRegion();
169 } 169 }
170 break; 170 break;
171 case PacketType.AgentUpdate: 171 case PacketType.AgentUpdate:
172 if (OnAgentUpdate != null) 172 if (OnAgentUpdate != null)
173 { 173 {
174 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; 174 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
175 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); 175 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation);
176 } 176 }
177 break; 177 break;
178 case PacketType.AgentAnimation: 178 case PacketType.AgentAnimation:
179 if (!m_child) 179 if (!m_child)
180 { 180 {
181 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 181 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
182 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 182 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
183 { 183 {
184 if (AgentAni.AnimationList[i].StartAnim) 184 if (AgentAni.AnimationList[i].StartAnim)
185 { 185 {
186 if (OnStartAnim != null) 186 if (OnStartAnim != null)
187 { 187 {
188 OnStartAnim(AgentAni.AnimationList[i].AnimID, 1); 188 OnStartAnim(AgentAni.AnimationList[i].AnimID, 1);
189 } 189 }
190 } 190 }
191 } 191 }
192 } 192 }
193 break; 193 break;
194 194
195 #endregion 195 #endregion
196 196
197 #region Objects/Prims 197 #region Objects/Prims
198 case PacketType.ObjectLink: 198 case PacketType.ObjectLink:
199 // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); 199 // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
200 ObjectLinkPacket link = (ObjectLinkPacket)Pack; 200 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
201 uint parentprimid = 0; 201 uint parentprimid = 0;
202 List<uint> childrenprims = new List<uint>(); 202 List<uint> childrenprims = new List<uint>();
203 if (link.ObjectData.Length > 1) 203 if (link.ObjectData.Length > 1)
204 { 204 {
205 parentprimid = link.ObjectData[0].ObjectLocalID; 205 parentprimid = link.ObjectData[0].ObjectLocalID;
206 206
207 for (int i = 1; i < link.ObjectData.Length; i++) 207 for (int i = 1; i < link.ObjectData.Length; i++)
208 { 208 {
209 childrenprims.Add(link.ObjectData[i].ObjectLocalID); 209 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
210 } 210 }
211 } 211 }
212 if (OnLinkObjects != null) 212 if (OnLinkObjects != null)
213 { 213 {
214 OnLinkObjects(parentprimid, childrenprims); 214 OnLinkObjects(parentprimid, childrenprims);
215 } 215 }
216 break; 216 break;
217 case PacketType.ObjectAdd: 217 case PacketType.ObjectAdd:
218 if (OnAddPrim != null) 218 if (OnAddPrim != null)
219 { 219 {
220 ObjectAddPacket addPacket = (ObjectAddPacket) Pack ; 220 ObjectAddPacket addPacket = (ObjectAddPacket) Pack ;
221 221
222 PrimitiveBaseShape shape = new PrimitiveBaseShape(); 222 PrimitiveBaseShape shape = new PrimitiveBaseShape();
223 223
224 shape.PCode = addPacket.ObjectData.PCode; 224 shape.PCode = addPacket.ObjectData.PCode;
225 shape.PathBegin = addPacket.ObjectData.PathBegin; 225 shape.PathBegin = addPacket.ObjectData.PathBegin;
226 shape.PathEnd = addPacket.ObjectData.PathEnd; 226 shape.PathEnd = addPacket.ObjectData.PathEnd;
227 shape.PathScaleX = addPacket.ObjectData.PathScaleX; 227 shape.PathScaleX = addPacket.ObjectData.PathScaleX;
228 shape.PathScaleY = addPacket.ObjectData.PathScaleY; 228 shape.PathScaleY = addPacket.ObjectData.PathScaleY;
229 shape.PathShearX = addPacket.ObjectData.PathShearX; 229 shape.PathShearX = addPacket.ObjectData.PathShearX;
230 shape.PathShearY = addPacket.ObjectData.PathShearY; 230 shape.PathShearY = addPacket.ObjectData.PathShearY;
231 shape.PathSkew = addPacket.ObjectData.PathSkew; 231 shape.PathSkew = addPacket.ObjectData.PathSkew;
232 shape.ProfileBegin = addPacket.ObjectData.ProfileBegin; 232 shape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
233 shape.ProfileEnd = addPacket.ObjectData.ProfileEnd; 233 shape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
234 shape.Scale = addPacket.ObjectData.Scale; 234 shape.Scale = addPacket.ObjectData.Scale;
235 shape.PathCurve = addPacket.ObjectData.PathCurve; 235 shape.PathCurve = addPacket.ObjectData.PathCurve;
236 shape.ProfileCurve = addPacket.ObjectData.ProfileCurve; 236 shape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
237 shape.ProfileHollow = addPacket.ObjectData.ProfileHollow; 237 shape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
238 shape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; 238 shape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
239 shape.PathRevolutions = addPacket.ObjectData.PathRevolutions; 239 shape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
240 shape.PathTaperX = addPacket.ObjectData.PathTaperX; 240 shape.PathTaperX = addPacket.ObjectData.PathTaperX;
241 shape.PathTaperY = addPacket.ObjectData.PathTaperY; 241 shape.PathTaperY = addPacket.ObjectData.PathTaperY;
242 shape.PathTwist = addPacket.ObjectData.PathTwist; 242 shape.PathTwist = addPacket.ObjectData.PathTwist;
243 shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; 243 shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
244 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); 244 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
245 shape.TextureEntry = ntex.ToBytes(); 245 shape.TextureEntry = ntex.ToBytes();
246 246
247 OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); 247 OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape);
248 } 248 }
249 break; 249 break;
250 case PacketType.ObjectShape: 250 case PacketType.ObjectShape:
251 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; 251 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack;
252 for (int i = 0; i < shapePacket.ObjectData.Length; i++) 252 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
253 { 253 {
254 if (OnUpdatePrimShape != null) 254 if (OnUpdatePrimShape != null)
255 { 255 {
256 OnUpdatePrimShape(shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]); 256 OnUpdatePrimShape(shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]);
257 } 257 }
258 } 258 }
259 break; 259 break;
260 case PacketType.ObjectDuplicate: 260 case PacketType.ObjectDuplicate:
261 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; 261 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
262 for (int i = 0; i < dupe.ObjectData.Length; i++) 262 for (int i = 0; i < dupe.ObjectData.Length; i++)
263 { 263 {
264 if (OnObjectDuplicate != null) 264 if (OnObjectDuplicate != null)
265 { 265 {
266 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); 266 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags);
267 } 267 }
268 } 268 }
269 269
270 break; 270 break;
271 271
272 case PacketType.ObjectSelect: 272 case PacketType.ObjectSelect:
273 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 273 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
274 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 274 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
275 { 275 {
276 if (OnObjectSelect != null) 276 if (OnObjectSelect != null)
277 { 277 {
278 OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); 278 OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
279 } 279 }
280 } 280 }
281 break; 281 break;
282 case PacketType.ObjectDeselect: 282 case PacketType.ObjectDeselect:
283 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; 283 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
284 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 284 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
285 { 285 {
286 if (OnObjectDeselect != null) 286 if (OnObjectDeselect != null)
287 { 287 {
288 OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this); 288 OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this);
289 } 289 }
290 } 290 }
291 break; 291 break;
292 case PacketType.ObjectFlagUpdate: 292 case PacketType.ObjectFlagUpdate:
293 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 293 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
294 if (OnUpdatePrimFlags != null) 294 if (OnUpdatePrimFlags != null)
295 { 295 {
296 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); 296 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
297 } 297 }
298 break; 298 break;
299 case PacketType.ObjectImage: 299 case PacketType.ObjectImage:
300 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 300 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
301 for (int i = 0; i < imagePack.ObjectData.Length; i++) 301 for (int i = 0; i < imagePack.ObjectData.Length; i++)
302 { 302 {
303 if (OnUpdatePrimTexture != null) 303 if (OnUpdatePrimTexture != null)
304 { 304 {
305 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); 305 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this);
306 } 306 }
307 } 307 }
308 break; 308 break;
309 case PacketType.ObjectGrab: 309 case PacketType.ObjectGrab:
310 ObjectGrabPacket grap = (ObjectGrabPacket)Pack; 310 ObjectGrabPacket grap = (ObjectGrabPacket)Pack;
311 if (OnGrapObject != null) 311 if (OnGrapObject != null)
312 { 312 {
313 OnGrapObject(grap.ObjectData.LocalID, grap.ObjectData.GrabOffset, this); 313 OnGrapObject(grap.ObjectData.LocalID, grap.ObjectData.GrabOffset, this);
314 } 314 }
315 break; 315 break;
316 case PacketType.ObjectGrabUpdate: 316 case PacketType.ObjectGrabUpdate:
317 ObjectGrabUpdatePacket grapUpdate = (ObjectGrabUpdatePacket)Pack; 317 ObjectGrabUpdatePacket grapUpdate = (ObjectGrabUpdatePacket)Pack;
318 if (OnGrapUpdate != null) 318 if (OnGrapUpdate != null)
319 { 319 {
320 OnGrapUpdate(grapUpdate.ObjectData.ObjectID, grapUpdate.ObjectData.GrabOffsetInitial, grapUpdate.ObjectData.GrabPosition, this); 320 OnGrapUpdate(grapUpdate.ObjectData.ObjectID, grapUpdate.ObjectData.GrabOffsetInitial, grapUpdate.ObjectData.GrabPosition, this);
321 } 321 }
322 break; 322 break;
323 case PacketType.ObjectDeGrab: 323 case PacketType.ObjectDeGrab:
324 ObjectDeGrabPacket deGrap = (ObjectDeGrabPacket)Pack; 324 ObjectDeGrabPacket deGrap = (ObjectDeGrabPacket)Pack;
325 if (OnDeGrapObject != null) 325 if (OnDeGrapObject != null)
326 { 326 {
327 OnDeGrapObject(deGrap.ObjectData.LocalID, this); 327 OnDeGrapObject(deGrap.ObjectData.LocalID, this);
328 } 328 }
329 break; 329 break;
330 case PacketType.ObjectDescription: 330 case PacketType.ObjectDescription:
331 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; 331 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
332 for (int i = 0; i < objDes.ObjectData.Length; i++) 332 for (int i = 0; i < objDes.ObjectData.Length; i++)
333 { 333 {
334 if (OnObjectDescription != null) 334 if (OnObjectDescription != null)
335 { 335 {
336 OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); 336 OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description));
337 } 337 }
338 } 338 }
339 break; 339 break;
340 case PacketType.ObjectName: 340 case PacketType.ObjectName:
341 ObjectNamePacket objName = (ObjectNamePacket)Pack; 341 ObjectNamePacket objName = (ObjectNamePacket)Pack;
342 for (int i = 0; i < objName.ObjectData.Length; i++) 342 for (int i = 0; i < objName.ObjectData.Length; i++)
343 { 343 {
344 if (OnObjectName != null) 344 if (OnObjectName != null)
345 { 345 {
346 OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name)); 346 OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
347 } 347 }
348 } 348 }
349 break; 349 break;
350 case PacketType.ObjectPermissions: 350 case PacketType.ObjectPermissions:
351 //Console.WriteLine("permissions set " + Pack.ToString()); 351 //Console.WriteLine("permissions set " + Pack.ToString());
352 break; 352 break;
353 #endregion 353 #endregion
354 354
355 #region Inventory/Asset/Other related packets 355 #region Inventory/Asset/Other related packets
356 case PacketType.RequestImage: 356 case PacketType.RequestImage:
357 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 357 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
358 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 358 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
359 { 359 {
360 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); 360 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
361 } 361 }
362 break; 362 break;
363 case PacketType.TransferRequest: 363 case PacketType.TransferRequest:
364 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 364 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
365 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 365 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
366 m_assetCache.AddAssetRequest(this, transfer); 366 m_assetCache.AddAssetRequest(this, transfer);
367 break; 367 break;
368 case PacketType.AssetUploadRequest: 368 case PacketType.AssetUploadRequest:
369 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 369 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
370 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); 370 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
371 break; 371 break;
372 case PacketType.RequestXfer: 372 case PacketType.RequestXfer:
373 //Console.WriteLine(Pack.ToString()); 373 //Console.WriteLine(Pack.ToString());
374 break; 374 break;
375 case PacketType.SendXferPacket: 375 case PacketType.SendXferPacket:
376 this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); 376 this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
377 break; 377 break;
378 case PacketType.CreateInventoryFolder: 378 case PacketType.CreateInventoryFolder:
379 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 379 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
380 m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); 380 m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
381 //Console.WriteLine(Pack.ToString()); 381 //Console.WriteLine(Pack.ToString());
382 break; 382 break;
383 case PacketType.CreateInventoryItem: 383 case PacketType.CreateInventoryItem:
384 //Console.WriteLine(Pack.ToString()); 384 //Console.WriteLine(Pack.ToString());
385 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; 385 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
386 if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) 386 if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
387 { 387 {
388 this.UploadAssets.CreateInventoryItem(createItem); 388 this.UploadAssets.CreateInventoryItem(createItem);
389 } 389 }
390 else 390 else
391 { 391 {
392 // Console.Write(Pack.ToString()); 392 // Console.Write(Pack.ToString());
393 this.CreateInventoryItem(createItem); 393 this.CreateInventoryItem(createItem);
394 } 394 }
395 break; 395 break;
396 case PacketType.FetchInventory: 396 case PacketType.FetchInventory:
397 //Console.WriteLine("fetch item packet"); 397 //Console.WriteLine("fetch item packet");
398 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; 398 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
399 m_inventoryCache.FetchInventory(this, FetchInventory); 399 m_inventoryCache.FetchInventory(this, FetchInventory);
400 break; 400 break;
401 case PacketType.FetchInventoryDescendents: 401 case PacketType.FetchInventoryDescendents:
402 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 402 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
403 m_inventoryCache.FetchInventoryDescendents(this, Fetch); 403 m_inventoryCache.FetchInventoryDescendents(this, Fetch);
404 break; 404 break;
405 case PacketType.UpdateInventoryItem: 405 case PacketType.UpdateInventoryItem:
406 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 406 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
407 //Console.WriteLine(Pack.ToString()); 407 //Console.WriteLine(Pack.ToString());
408 for (int i = 0; i < update.InventoryData.Length; i++) 408 for (int i = 0; i < update.InventoryData.Length; i++)
409 { 409 {
410 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 410 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
411 { 411 {
412 AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); 412 AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
413 if (asset != null) 413 if (asset != null)
414 { 414 {
415 // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); 415 // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
416 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); 416 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
417 } 417 }
418 else 418 else
419 { 419 {
420 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); 420 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
421 if (asset != null) 421 if (asset != null)
422 { 422 {
423 //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); 423 //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
424 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); 424 m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
425 } 425 }
426 else 426 else
427 { 427 {
428 //Console.WriteLine("trying to update inventory item, but asset is null"); 428 //Console.WriteLine("trying to update inventory item, but asset is null");
429 } 429 }
430 } 430 }
431 } 431 }
432 else 432 else
433 { 433 {
434 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; 434 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
435 } 435 }
436 } 436 }
437 break; 437 break;
438 case PacketType.RequestTaskInventory: 438 case PacketType.RequestTaskInventory:
439 // Console.WriteLine(Pack.ToString()); 439 // Console.WriteLine(Pack.ToString());
440 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 440 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
441 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); 441 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
442 //bool foundent = false; 442 //bool foundent = false;
443 /* foreach (Entity ent in m_world.Entities.Values) 443 /* foreach (Entity ent in m_world.Entities.Values)
444 { 444 {
445 if (ent.localid == requesttask.InventoryData.LocalID) 445 if (ent.localid == requesttask.InventoryData.LocalID)
446 { 446 {
447 replytask.InventoryData.TaskID = ent.uuid; 447 replytask.InventoryData.TaskID = ent.uuid;
448 replytask.InventoryData.Serial = 0; 448 replytask.InventoryData.Serial = 0;
449 replytask.InventoryData.Filename = new byte[0]; 449 replytask.InventoryData.Filename = new byte[0];
450 foundent = true; 450 foundent = true;
451 } 451 }
452 } 452 }
453 if (foundent) 453 if (foundent)
454 { 454 {
455 this.OutPacket(replytask); 455 this.OutPacket(replytask);
456 }*/ 456 }*/
457 break; 457 break;
458 case PacketType.UpdateTaskInventory: 458 case PacketType.UpdateTaskInventory:
459 // Console.WriteLine(Pack.ToString()); 459 // Console.WriteLine(Pack.ToString());
460 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 460 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
461 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); 461 AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
462 /*if (myinventory != null) 462 /*if (myinventory != null)
463 { 463 {
464 if (updatetask.UpdateData.Key == 0) 464 if (updatetask.UpdateData.Key == 0)
465 { 465 {
466 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null) 466 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
467 { 467 {
468 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7) 468 if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
469 { 469 {
470 LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID; 470 LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
471 AssetBase assBase = this.m_assetCache.GetAsset(noteaid); 471 AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
472 if (assBase != null) 472 if (assBase != null)
473 { 473 {
474 foreach (Entity ent in m_world.Entities.Values) 474 foreach (Entity ent in m_world.Entities.Values)
475 { 475 {
476 if (ent.localid == updatetask.UpdateData.LocalID) 476 if (ent.localid == updatetask.UpdateData.LocalID)
477 { 477 {
478 if (ent is OpenSim.world.Primitive) 478 if (ent is OpenSim.world.Primitive)
479 { 479 {
480 this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); 480 this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
481 } 481 }
482 } 482 }
483 } 483 }
484 } 484 }
485 } 485 }
486 } 486 }
487 } 487 }
488 }*/ 488 }*/
489 break; 489 break;
490 case PacketType.MapLayerRequest: 490 case PacketType.MapLayerRequest:
491 this.RequestMapLayer(); 491 this.RequestMapLayer();
492 break; 492 break;
493 case PacketType.MapBlockRequest: 493 case PacketType.MapBlockRequest:
494 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; 494 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
495 if (OnRequestMapBlocks != null) 495 if (OnRequestMapBlocks != null)
496 { 496 {
497 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 497 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
498 } 498 }
499 break; 499 break;
500 case PacketType.TeleportLandmarkRequest: 500 case PacketType.TeleportLandmarkRequest:
501 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 501 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
502 502
503 TeleportStartPacket tpStart = new TeleportStartPacket(); 503 TeleportStartPacket tpStart = new TeleportStartPacket();
504 tpStart.Info.TeleportFlags = 8; // tp via lm 504 tpStart.Info.TeleportFlags = 8; // tp via lm
505 this.OutPacket(tpStart); 505 this.OutPacket(tpStart);
506 506
507 TeleportProgressPacket tpProgress = new TeleportProgressPacket(); 507 TeleportProgressPacket tpProgress = new TeleportProgressPacket();
508 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); 508 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
509 tpProgress.Info.TeleportFlags = 8; 509 tpProgress.Info.TeleportFlags = 8;
510 tpProgress.AgentData.AgentID = tpReq.Info.AgentID; 510 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
511 this.OutPacket(tpProgress); 511 this.OutPacket(tpProgress);
512 512
513 // Fetch landmark 513 // Fetch landmark
514 LLUUID lmid = tpReq.Info.LandmarkID; 514 LLUUID lmid = tpReq.Info.LandmarkID;
515 AssetBase lma = this.m_assetCache.GetAsset(lmid); 515 AssetBase lma = this.m_assetCache.GetAsset(lmid);
516 if (lma != null) 516 if (lma != null)
517 { 517 {
518 AssetLandmark lm = new AssetLandmark(lma); 518 AssetLandmark lm = new AssetLandmark(lma);
519 519
520 if (lm.RegionID == m_world.RegionInfo.SimUUID) 520 if (lm.RegionID == m_world.RegionInfo.SimUUID)
521 { 521 {
522 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 522 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
523 523
524 tpLocal.Info.AgentID = tpReq.Info.AgentID; 524 tpLocal.Info.AgentID = tpReq.Info.AgentID;
525 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 525 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
526 tpLocal.Info.LocationID = 2; 526 tpLocal.Info.LocationID = 2;
527 tpLocal.Info.Position = lm.Position; 527 tpLocal.Info.Position = lm.Position;
528 OutPacket(tpLocal); 528 OutPacket(tpLocal);
529 } 529 }
530 else 530 else
531 { 531 {
532 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 532 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
533 tpCancel.Info.AgentID = tpReq.Info.AgentID; 533 tpCancel.Info.AgentID = tpReq.Info.AgentID;
534 tpCancel.Info.SessionID = tpReq.Info.SessionID; 534 tpCancel.Info.SessionID = tpReq.Info.SessionID;
535 OutPacket(tpCancel); 535 OutPacket(tpCancel);
536 } 536 }
537 } 537 }
538 else 538 else
539 { 539 {
540 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); 540 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
541 541
542 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 542 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
543 tpCancel.Info.AgentID = tpReq.Info.AgentID; 543 tpCancel.Info.AgentID = tpReq.Info.AgentID;
544 tpCancel.Info.SessionID = tpReq.Info.SessionID; 544 tpCancel.Info.SessionID = tpReq.Info.SessionID;
545 OutPacket(tpCancel); 545 OutPacket(tpCancel);
546 } 546 }
547 break; 547 break;
548 case PacketType.TeleportLocationRequest: 548 case PacketType.TeleportLocationRequest:
549 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 549 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
550 // Console.WriteLine(tpLocReq.ToString()); 550 // Console.WriteLine(tpLocReq.ToString());
551 551
552 if (OnTeleportLocationRequest != null) 552 if (OnTeleportLocationRequest != null)
553 { 553 {
554 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); 554 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16);
555 } 555 }
556 else 556 else
557 { 557 {
558 //no event handler so cancel request 558 //no event handler so cancel request
559 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 559 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
560 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 560 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
561 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; 561 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
562 OutPacket(tpCancel); 562 OutPacket(tpCancel);
563 } 563 }
564 break; 564 break;
565 #endregion 565 #endregion
566 566
567 case PacketType.MoneyBalanceRequest: 567 case PacketType.MoneyBalanceRequest:
568 this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000); 568 this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000);
569 break; 569 break;
570 case PacketType.UUIDNameRequest: 570 case PacketType.UUIDNameRequest:
571 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; 571 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
572 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) 572 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
573 { 573 {
574 OnNameFromUUIDRequest(UUIDBlock.ID, this); 574 OnNameFromUUIDRequest(UUIDBlock.ID, this);
575 } 575 }
576 break; 576 break;
577 #region Parcel related packets 577 #region Parcel related packets
578 case PacketType.ParcelPropertiesRequest: 578 case PacketType.ParcelPropertiesRequest:
579 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; 579 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
580 if (OnParcelPropertiesRequest != null) 580 if (OnParcelPropertiesRequest != null)
581 { 581 {
582 OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); 582 OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this);
583 } 583 }
584 break; 584 break;
585 case PacketType.ParcelDivide: 585 case PacketType.ParcelDivide:
586 ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; 586 ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
587 if (OnParcelDivideRequest != null) 587 if (OnParcelDivideRequest != null)
588 { 588 {
589 OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this); 589 OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this);
590 } 590 }
591 break; 591 break;
592 case PacketType.ParcelJoin: 592 case PacketType.ParcelJoin:
593 ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; 593 ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
594 if (OnParcelJoinRequest != null) 594 if (OnParcelJoinRequest != null)
595 { 595 {
596 OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this); 596 OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
597 } 597 }
598 break; 598 break;
599 case PacketType.ParcelPropertiesUpdate: 599 case PacketType.ParcelPropertiesUpdate:
600 ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; 600 ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack;
601 if (OnParcelPropertiesUpdateRequest != null) 601 if (OnParcelPropertiesUpdateRequest != null)
602 { 602 {
603 OnParcelPropertiesUpdateRequest(updatePacket, this); 603 OnParcelPropertiesUpdateRequest(updatePacket, this);
604 604
605 } 605 }
606 break; 606 break;
607 case PacketType.ParcelSelectObjects: 607 case PacketType.ParcelSelectObjects:
608 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; 608 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
609 if (OnParcelSelectObjects != null) 609 if (OnParcelSelectObjects != null)
610 { 610 {
611 OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); 611 OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
612 } 612 }
613 break; 613 break;
614 614
615 case PacketType.ParcelObjectOwnersRequest: 615 case PacketType.ParcelObjectOwnersRequest:
616 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; 616 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
617 if (OnParcelObjectOwnerRequest != null) 617 if (OnParcelObjectOwnerRequest != null)
618 { 618 {
619 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 619 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
620 } 620 }
621 break; 621 break;
622 #endregion 622 #endregion
623 623
624 #region Estate Packets 624 #region Estate Packets
625 case PacketType.EstateOwnerMessage: 625 case PacketType.EstateOwnerMessage:
626 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 626 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
627 if (OnEstateOwnerMessage != null) 627 if (OnEstateOwnerMessage != null)
628 { 628 {
629 OnEstateOwnerMessage(messagePacket, this); 629 OnEstateOwnerMessage(messagePacket, this);
630 } 630 }
631 break; 631 break;
632 #endregion 632 #endregion
633 633
634 #region unimplemented handlers 634 #region unimplemented handlers
635 case PacketType.AgentIsNowWearing: 635 case PacketType.AgentIsNowWearing:
636 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; 636 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
637 //Console.WriteLine(Pack.ToString()); 637 //Console.WriteLine(Pack.ToString());
638 break; 638 break;
639 case PacketType.ObjectScale: 639 case PacketType.ObjectScale:
640 //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); 640 //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
641 break; 641 break;
642 #endregion 642 #endregion
643 } 643 }
644 } 644 }
645 } 645 }
646 } 646 }
647} 647}
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 0fe3884..9fddc7b 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -1,293 +1,293 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Text; 31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using libsecondlife; 34using libsecondlife;
35using libsecondlife.Packets; 35using libsecondlife.Packets;
36using OpenSim.Assets; 36using OpenSim.Assets;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
39using OpenSim.Framework.Interfaces; 39using OpenSim.Framework.Interfaces;
40using OpenSim.Framework.Inventory; 40using OpenSim.Framework.Inventory;
41using OpenSim.Framework.Types; 41using OpenSim.Framework.Types;
42using OpenSim.Framework.Utilities; 42using OpenSim.Framework.Utilities;
43using OpenSim.Region.Caches; 43using OpenSim.Region.Caches;
44using Timer=System.Timers.Timer; 44using Timer=System.Timers.Timer;
45 45
46namespace OpenSim.Region.ClientStack 46namespace OpenSim.Region.ClientStack
47{ 47{
48 public delegate bool PacketMethod(ClientView simClient, Packet packet); 48 public delegate bool PacketMethod(ClientView simClient, Packet packet);
49 49
50 /// <summary> 50 /// <summary>
51 /// Handles new client connections 51 /// Handles new client connections
52 /// Constructor takes a single Packet and authenticates everything 52 /// Constructor takes a single Packet and authenticates everything
53 /// </summary> 53 /// </summary>
54 public partial class ClientView : ClientViewBase, IClientAPI 54 public partial class ClientView : ClientViewBase, IClientAPI
55 { 55 {
56 public static TerrainManager TerrainManager; 56 public static TerrainManager TerrainManager;
57 57
58 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients 58 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
59 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance 59 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance
60 60
61 public LLUUID AgentID; 61 public LLUUID AgentID;
62 public LLUUID SessionID; 62 public LLUUID SessionID;
63 public LLUUID SecureSessionID = LLUUID.Zero; 63 public LLUUID SecureSessionID = LLUUID.Zero;
64 public string firstName; 64 public string firstName;
65 public string lastName; 65 public string lastName;
66 public bool m_child = false; 66 public bool m_child = false;
67 private UseCircuitCodePacket cirpack; 67 private UseCircuitCodePacket cirpack;
68 public Thread ClientThread; 68 public Thread ClientThread;
69 public LLVector3 startpos; 69 public LLVector3 startpos;
70 70
71 private AgentAssetUpload UploadAssets; 71 private AgentAssetUpload UploadAssets;
72 private LLUUID newAssetFolder = LLUUID.Zero; 72 private LLUUID newAssetFolder = LLUUID.Zero;
73 private bool debug = false; 73 private bool debug = false;
74 protected IWorld m_world; 74 protected IWorld m_world;
75 private Dictionary<uint, ClientView> m_clientThreads; 75 private Dictionary<uint, ClientView> m_clientThreads;
76 private AssetCache m_assetCache; 76 private AssetCache m_assetCache;
77 private InventoryCache m_inventoryCache; 77 private InventoryCache m_inventoryCache;
78 private int cachedtextureserial = 0; 78 private int cachedtextureserial = 0;
79 protected AuthenticateSessionsBase m_authenticateSessionsHandler; 79 protected AuthenticateSessionsBase m_authenticateSessionsHandler;
80 private Encoding enc = Encoding.ASCII; 80 private Encoding enc = Encoding.ASCII;
81 // Dead client detection vars 81 // Dead client detection vars
82 private Timer clientPingTimer; 82 private Timer clientPingTimer;
83 private int packetsReceived = 0; 83 private int packetsReceived = 0;
84 private int probesWithNoIngressPackets = 0; 84 private int probesWithNoIngressPackets = 0;
85 private int lastPacketsReceived = 0; 85 private int lastPacketsReceived = 0;
86 86
87 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) 87 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions )
88 { 88 {
89 m_world = world; 89 m_world = world;
90 m_clientThreads = clientThreads; 90 m_clientThreads = clientThreads;
91 m_assetCache = assetCache; 91 m_assetCache = assetCache;
92 92
93 m_networkServer = packServer; 93 m_networkServer = packServer;
94 m_inventoryCache = inventoryCache; 94 m_inventoryCache = inventoryCache;
95 m_authenticateSessionsHandler = authenSessions; 95 m_authenticateSessionsHandler = authenSessions;
96 96
97 MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); 97 MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request");
98 cirpack = initialcirpack; 98 cirpack = initialcirpack;
99 userEP = remoteEP; 99 userEP = remoteEP;
100 100
101 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); 101 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
102 102
103 PacketQueue = new BlockingQueue<QueItem>(); 103 PacketQueue = new BlockingQueue<QueItem>();
104 104
105 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); 105 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
106 AckTimer = new Timer(500); 106 AckTimer = new Timer(500);
107 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 107 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
108 AckTimer.Start(); 108 AckTimer.Start();
109 109
110 this.RegisterLocalPacketHandlers(); 110 this.RegisterLocalPacketHandlers();
111 111
112 ClientThread = new Thread(new ThreadStart(AuthUser)); 112 ClientThread = new Thread(new ThreadStart(AuthUser));
113 ClientThread.IsBackground = true; 113 ClientThread.IsBackground = true;
114 ClientThread.Start(); 114 ClientThread.Start();
115 } 115 }
116 116
117 # region Client Methods 117 # region Client Methods
118 118
119 public void KillClient() 119 public void KillClient()
120 { 120 {
121 clientPingTimer.Stop(); 121 clientPingTimer.Stop();
122 this.m_inventoryCache.ClientLeaving(this.AgentID, null); 122 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
123 m_world.RemoveClient(this.AgentId); 123 m_world.RemoveClient(this.AgentId);
124 124
125 m_clientThreads.Remove(this.CircuitCode); 125 m_clientThreads.Remove(this.CircuitCode);
126 m_networkServer.RemoveClientCircuit(this.CircuitCode); 126 m_networkServer.RemoveClientCircuit(this.CircuitCode);
127 this.ClientThread.Abort(); 127 this.ClientThread.Abort();
128 } 128 }
129 #endregion 129 #endregion
130 130
131 # region Packet Handling 131 # region Packet Handling
132 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) 132 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
133 { 133 {
134 bool result = false; 134 bool result = false;
135 lock (PacketHandlers) 135 lock (PacketHandlers)
136 { 136 {
137 if (!PacketHandlers.ContainsKey(packetType)) 137 if (!PacketHandlers.ContainsKey(packetType))
138 { 138 {
139 PacketHandlers.Add(packetType, handler); 139 PacketHandlers.Add(packetType, handler);
140 result = true; 140 result = true;
141 } 141 }
142 } 142 }
143 return result; 143 return result;
144 } 144 }
145 145
146 public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler) 146 public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler)
147 { 147 {
148 bool result = false; 148 bool result = false;
149 lock (m_packetHandlers) 149 lock (m_packetHandlers)
150 { 150 {
151 if (!m_packetHandlers.ContainsKey(packetType)) 151 if (!m_packetHandlers.ContainsKey(packetType))
152 { 152 {
153 m_packetHandlers.Add(packetType, handler); 153 m_packetHandlers.Add(packetType, handler);
154 result = true; 154 result = true;
155 } 155 }
156 } 156 }
157 return result; 157 return result;
158 } 158 }
159 159
160 protected virtual bool ProcessPacketMethod(Packet packet) 160 protected virtual bool ProcessPacketMethod(Packet packet)
161 { 161 {
162 bool result = false; 162 bool result = false;
163 bool found = false; 163 bool found = false;
164 PacketMethod method; 164 PacketMethod method;
165 if (m_packetHandlers.TryGetValue(packet.Type, out method)) 165 if (m_packetHandlers.TryGetValue(packet.Type, out method))
166 { 166 {
167 //there is a local handler for this packet type 167 //there is a local handler for this packet type
168 result = method(this, packet); 168 result = method(this, packet);
169 } 169 }
170 else 170 else
171 { 171 {
172 //there is not a local handler so see if there is a Global handler 172 //there is not a local handler so see if there is a Global handler
173 lock (PacketHandlers) 173 lock (PacketHandlers)
174 { 174 {
175 found = PacketHandlers.TryGetValue(packet.Type, out method); 175 found = PacketHandlers.TryGetValue(packet.Type, out method);
176 } 176 }
177 if (found) 177 if (found)
178 { 178 {
179 result = method(this, packet); 179 result = method(this, packet);
180 } 180 }
181 } 181 }
182 return result; 182 return result;
183 } 183 }
184 184
185 protected virtual void ClientLoop() 185 protected virtual void ClientLoop()
186 { 186 {
187 MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); 187 MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop");
188 while (true) 188 while (true)
189 { 189 {
190 QueItem nextPacket = PacketQueue.Dequeue(); 190 QueItem nextPacket = PacketQueue.Dequeue();
191 if (nextPacket.Incoming) 191 if (nextPacket.Incoming)
192 { 192 {
193 //is a incoming packet 193 //is a incoming packet
194 if (nextPacket.Packet.Type != PacketType.AgentUpdate) { 194 if (nextPacket.Packet.Type != PacketType.AgentUpdate) {
195 packetsReceived++; 195 packetsReceived++;
196 } 196 }
197 ProcessInPacket(nextPacket.Packet); 197 ProcessInPacket(nextPacket.Packet);
198 } 198 }
199 else 199 else
200 { 200 {
201 //is a out going packet 201 //is a out going packet
202 ProcessOutPacket(nextPacket.Packet); 202 ProcessOutPacket(nextPacket.Packet);
203 } 203 }
204 } 204 }
205 } 205 }
206 # endregion 206 # endregion
207 207
208 protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) 208 protected void CheckClientConnectivity(object sender, ElapsedEventArgs e)
209 { 209 {
210 if (packetsReceived == lastPacketsReceived) { 210 if (packetsReceived == lastPacketsReceived) {
211 probesWithNoIngressPackets++; 211 probesWithNoIngressPackets++;
212 if (probesWithNoIngressPackets > 30) { 212 if (probesWithNoIngressPackets > 30) {
213 this.KillClient(); 213 this.KillClient();
214 } else { 214 } else {
215 // this will normally trigger at least one packet (ping response) 215 // this will normally trigger at least one packet (ping response)
216 SendStartPingCheck(0); 216 SendStartPingCheck(0);
217 } 217 }
218 } else { 218 } else {
219 // Something received in the meantime - we can reset the counters 219 // Something received in the meantime - we can reset the counters
220 probesWithNoIngressPackets = 0; 220 probesWithNoIngressPackets = 0;
221 lastPacketsReceived = packetsReceived; 221 lastPacketsReceived = packetsReceived;
222 } 222 }
223 } 223 }
224 224
225 # region Setup 225 # region Setup
226 226
227 protected virtual void InitNewClient() 227 protected virtual void InitNewClient()
228 { 228 {
229 clientPingTimer = new Timer(1000); 229 clientPingTimer = new Timer(1000);
230 clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); 230 clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity);
231 clientPingTimer.Enabled = true; 231 clientPingTimer.Enabled = true;
232 232
233 MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 233 MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
234 this.m_world.AddNewClient(this, false); 234 this.m_world.AddNewClient(this, false);
235 } 235 }
236 236
237 protected virtual void AuthUser() 237 protected virtual void AuthUser()
238 { 238 {
239 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 239 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
240 AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 240 AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
241 if (!sessionInfo.Authorised) 241 if (!sessionInfo.Authorised)
242 { 242 {
243 //session/circuit not authorised 243 //session/circuit not authorised
244 MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); 244 MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
245 ClientThread.Abort(); 245 ClientThread.Abort();
246 } 246 }
247 else 247 else
248 { 248 {
249 MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); 249 MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
250 //session is authorised 250 //session is authorised
251 this.AgentID = cirpack.CircuitCode.ID; 251 this.AgentID = cirpack.CircuitCode.ID;
252 this.SessionID = cirpack.CircuitCode.SessionID; 252 this.SessionID = cirpack.CircuitCode.SessionID;
253 this.CircuitCode = cirpack.CircuitCode.Code; 253 this.CircuitCode = cirpack.CircuitCode.Code;
254 this.firstName = sessionInfo.LoginInfo.First; 254 this.firstName = sessionInfo.LoginInfo.First;
255 this.lastName = sessionInfo.LoginInfo.Last; 255 this.lastName = sessionInfo.LoginInfo.Last;
256 256
257 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) 257 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
258 { 258 {
259 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; 259 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
260 } 260 }
261 InitNewClient(); 261 InitNewClient();
262 262
263 ClientLoop(); 263 ClientLoop();
264 } 264 }
265 } 265 }
266 # endregion 266 # endregion
267 267
268 268
269 protected override void KillThread() 269 protected override void KillThread()
270 { 270 {
271 this.ClientThread.Abort(); 271 this.ClientThread.Abort();
272 } 272 }
273 273
274 #region Inventory Creation 274 #region Inventory Creation
275 private void SetupInventory(AuthenticateResponse sessionInfo) 275 private void SetupInventory(AuthenticateResponse sessionInfo)
276 { 276 {
277 277
278 } 278 }
279 private AgentInventory CreateInventory(LLUUID baseFolder) 279 private AgentInventory CreateInventory(LLUUID baseFolder)
280 { 280 {
281 AgentInventory inventory = null; 281 AgentInventory inventory = null;
282 282
283 return inventory; 283 return inventory;
284 } 284 }
285 285
286 private void CreateInventoryItem(CreateInventoryItemPacket packet) 286 private void CreateInventoryItem(CreateInventoryItemPacket packet)
287 { 287 {
288 288
289 } 289 }
290 #endregion 290 #endregion
291 291
292 } 292 }
293} 293}
diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs
index cc04bda..597cd7d 100644
--- a/OpenSim/Region/ClientStack/ClientViewBase.cs
+++ b/OpenSim/Region/ClientStack/ClientViewBase.cs
@@ -1,326 +1,326 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using System.Timers; 32using System.Timers;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Region.Environment; 37using OpenSim.Region.Environment;
38 38
39namespace OpenSim.Region.ClientStack 39namespace OpenSim.Region.ClientStack
40{ 40{
41 public class ClientViewBase 41 public class ClientViewBase
42 { 42 {
43 protected BlockingQueue<QueItem> PacketQueue; 43 protected BlockingQueue<QueItem> PacketQueue;
44 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 44 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
45 protected Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); 45 protected Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
46 46
47 protected Timer AckTimer; 47 protected Timer AckTimer;
48 protected uint Sequence = 0; 48 protected uint Sequence = 0;
49 protected object SequenceLock = new object(); 49 protected object SequenceLock = new object();
50 protected const int MAX_APPENDED_ACKS = 10; 50 protected const int MAX_APPENDED_ACKS = 10;
51 protected const int RESEND_TIMEOUT = 4000; 51 protected const int RESEND_TIMEOUT = 4000;
52 protected const int MAX_SEQUENCE = 0xFFFFFF; 52 protected const int MAX_SEQUENCE = 0xFFFFFF;
53 53
54 public uint CircuitCode; 54 public uint CircuitCode;
55 public EndPoint userEP; 55 public EndPoint userEP;
56 56
57 protected PacketServer m_networkServer; 57 protected PacketServer m_networkServer;
58 58
59 public ClientViewBase() 59 public ClientViewBase()
60 { 60 {
61 61
62 } 62 }
63 63
64 protected virtual void ProcessInPacket(Packet Pack) 64 protected virtual void ProcessInPacket(Packet Pack)
65 { 65 {
66 66
67 } 67 }
68 68
69 protected virtual void ProcessOutPacket(Packet Pack) 69 protected virtual void ProcessOutPacket(Packet Pack)
70 { 70 {
71 // Keep track of when this packet was sent out 71 // Keep track of when this packet was sent out
72 Pack.TickCount = System.Environment.TickCount; 72 Pack.TickCount = System.Environment.TickCount;
73 73
74 // Console.WriteLine(CircuitCode + ":OUT: " + Pack.Type.ToString()); 74 // Console.WriteLine(CircuitCode + ":OUT: " + Pack.Type.ToString());
75 75
76 if (!Pack.Header.Resent) 76 if (!Pack.Header.Resent)
77 { 77 {
78 // Set the sequence number 78 // Set the sequence number
79 lock (SequenceLock) 79 lock (SequenceLock)
80 { 80 {
81 if (Sequence >= MAX_SEQUENCE) 81 if (Sequence >= MAX_SEQUENCE)
82 Sequence = 1; 82 Sequence = 1;
83 else 83 else
84 Sequence++; 84 Sequence++;
85 Pack.Header.Sequence = Sequence; 85 Pack.Header.Sequence = Sequence;
86 } 86 }
87 87
88 if (Pack.Header.Reliable) //DIRTY HACK 88 if (Pack.Header.Reliable) //DIRTY HACK
89 { 89 {
90 lock (NeedAck) 90 lock (NeedAck)
91 { 91 {
92 if (!NeedAck.ContainsKey(Pack.Header.Sequence)) 92 if (!NeedAck.ContainsKey(Pack.Header.Sequence))
93 { 93 {
94 try 94 try
95 { 95 {
96 NeedAck.Add(Pack.Header.Sequence, Pack); 96 NeedAck.Add(Pack.Header.Sequence, Pack);
97 } 97 }
98 catch (Exception e) // HACKY 98 catch (Exception e) // HACKY
99 { 99 {
100 e.ToString(); 100 e.ToString();
101 // Ignore 101 // Ignore
102 // Seems to throw a exception here occasionally 102 // Seems to throw a exception here occasionally
103 // of 'duplicate key' despite being locked. 103 // of 'duplicate key' despite being locked.
104 // !?!?!? 104 // !?!?!?
105 } 105 }
106 } 106 }
107 else 107 else
108 { 108 {
109 // Client.Log("Attempted to add a duplicate sequence number (" + 109 // Client.Log("Attempted to add a duplicate sequence number (" +
110 // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + 110 // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " +
111 // packet.Type.ToString(), Helpers.LogLevel.Warning); 111 // packet.Type.ToString(), Helpers.LogLevel.Warning);
112 } 112 }
113 } 113 }
114 114
115 // Don't append ACKs to resent packets, in case that's what was causing the 115 // Don't append ACKs to resent packets, in case that's what was causing the
116 // delivery to fail 116 // delivery to fail
117 if (!Pack.Header.Resent) 117 if (!Pack.Header.Resent)
118 { 118 {
119 // Append any ACKs that need to be sent out to this packet 119 // Append any ACKs that need to be sent out to this packet
120 lock (PendingAcks) 120 lock (PendingAcks)
121 { 121 {
122 if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && 122 if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS &&
123 Pack.Type != PacketType.PacketAck && 123 Pack.Type != PacketType.PacketAck &&
124 Pack.Type != PacketType.LogoutRequest) 124 Pack.Type != PacketType.LogoutRequest)
125 { 125 {
126 Pack.Header.AckList = new uint[PendingAcks.Count]; 126 Pack.Header.AckList = new uint[PendingAcks.Count];
127 int i = 0; 127 int i = 0;
128 128
129 foreach (uint ack in PendingAcks.Values) 129 foreach (uint ack in PendingAcks.Values)
130 { 130 {
131 Pack.Header.AckList[i] = ack; 131 Pack.Header.AckList[i] = ack;
132 i++; 132 i++;
133 } 133 }
134 134
135 PendingAcks.Clear(); 135 PendingAcks.Clear();
136 Pack.Header.AppendedAcks = true; 136 Pack.Header.AppendedAcks = true;
137 } 137 }
138 } 138 }
139 } 139 }
140 } 140 }
141 } 141 }
142 142
143 byte[] ZeroOutBuffer = new byte[4096]; 143 byte[] ZeroOutBuffer = new byte[4096];
144 byte[] sendbuffer; 144 byte[] sendbuffer;
145 sendbuffer = Pack.ToBytes(); 145 sendbuffer = Pack.ToBytes();
146 146
147 try 147 try
148 { 148 {
149 if (Pack.Header.Zerocoded) 149 if (Pack.Header.Zerocoded)
150 { 150 {
151 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 151 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
152 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP); 152 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
153 } 153 }
154 else 154 else
155 { 155 {
156 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP); 156 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
157 } 157 }
158 } 158 }
159 catch (Exception) 159 catch (Exception)
160 { 160 {
161 MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); 161 MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
162 this.KillThread(); 162 this.KillThread();
163 } 163 }
164 164
165 } 165 }
166 166
167 public virtual void InPacket(Packet NewPack) 167 public virtual void InPacket(Packet NewPack)
168 { 168 {
169 // Handle appended ACKs 169 // Handle appended ACKs
170 if (NewPack.Header.AppendedAcks) 170 if (NewPack.Header.AppendedAcks)
171 { 171 {
172 lock (NeedAck) 172 lock (NeedAck)
173 { 173 {
174 foreach (uint ack in NewPack.Header.AckList) 174 foreach (uint ack in NewPack.Header.AckList)
175 { 175 {
176 NeedAck.Remove(ack); 176 NeedAck.Remove(ack);
177 } 177 }
178 } 178 }
179 } 179 }
180 180
181 // Handle PacketAck packets 181 // Handle PacketAck packets
182 if (NewPack.Type == PacketType.PacketAck) 182 if (NewPack.Type == PacketType.PacketAck)
183 { 183 {
184 PacketAckPacket ackPacket = (PacketAckPacket)NewPack; 184 PacketAckPacket ackPacket = (PacketAckPacket)NewPack;
185 185
186 lock (NeedAck) 186 lock (NeedAck)
187 { 187 {
188 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) 188 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
189 { 189 {
190 NeedAck.Remove(block.ID); 190 NeedAck.Remove(block.ID);
191 } 191 }
192 } 192 }
193 } 193 }
194 else if ((NewPack.Type == PacketType.StartPingCheck)) 194 else if ((NewPack.Type == PacketType.StartPingCheck))
195 { 195 {
196 //reply to pingcheck 196 //reply to pingcheck
197 StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack; 197 StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack;
198 CompletePingCheckPacket endPing = new CompletePingCheckPacket(); 198 CompletePingCheckPacket endPing = new CompletePingCheckPacket();
199 endPing.PingID.PingID = startPing.PingID.PingID; 199 endPing.PingID.PingID = startPing.PingID.PingID;
200 OutPacket(endPing); 200 OutPacket(endPing);
201 } 201 }
202 else 202 else
203 { 203 {
204 QueItem item = new QueItem(); 204 QueItem item = new QueItem();
205 item.Packet = NewPack; 205 item.Packet = NewPack;
206 item.Incoming = true; 206 item.Incoming = true;
207 this.PacketQueue.Enqueue(item); 207 this.PacketQueue.Enqueue(item);
208 } 208 }
209 209
210 } 210 }
211 211
212 public virtual void OutPacket(Packet NewPack) 212 public virtual void OutPacket(Packet NewPack)
213 { 213 {
214 QueItem item = new QueItem(); 214 QueItem item = new QueItem();
215 item.Packet = NewPack; 215 item.Packet = NewPack;
216 item.Incoming = false; 216 item.Incoming = false;
217 this.PacketQueue.Enqueue(item); 217 this.PacketQueue.Enqueue(item);
218 } 218 }
219 219
220 # region Low Level Packet Methods 220 # region Low Level Packet Methods
221 221
222 protected void ack_pack(Packet Pack) 222 protected void ack_pack(Packet Pack)
223 { 223 {
224 if (Pack.Header.Reliable) 224 if (Pack.Header.Reliable)
225 { 225 {
226 PacketAckPacket ack_it = new PacketAckPacket(); 226 PacketAckPacket ack_it = new PacketAckPacket();
227 ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; 227 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
228 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); 228 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
229 ack_it.Packets[0].ID = Pack.Header.Sequence; 229 ack_it.Packets[0].ID = Pack.Header.Sequence;
230 ack_it.Header.Reliable = false; 230 ack_it.Header.Reliable = false;
231 231
232 OutPacket(ack_it); 232 OutPacket(ack_it);
233 233
234 } 234 }
235 /* 235 /*
236 if (Pack.Header.Reliable) 236 if (Pack.Header.Reliable)
237 { 237 {
238 lock (PendingAcks) 238 lock (PendingAcks)
239 { 239 {
240 uint sequence = (uint)Pack.Header.Sequence; 240 uint sequence = (uint)Pack.Header.Sequence;
241 if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } 241 if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; }
242 } 242 }
243 }*/ 243 }*/
244 } 244 }
245 245
246 protected void ResendUnacked() 246 protected void ResendUnacked()
247 { 247 {
248 int now = System.Environment.TickCount; 248 int now = System.Environment.TickCount;
249 249
250 lock (NeedAck) 250 lock (NeedAck)
251 { 251 {
252 foreach (Packet packet in NeedAck.Values) 252 foreach (Packet packet in NeedAck.Values)
253 { 253 {
254 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) 254 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
255 { 255 {
256 MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + 256 MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " +
257 (now - packet.TickCount) + "ms have passed"); 257 (now - packet.TickCount) + "ms have passed");
258 258
259 packet.Header.Resent = true; 259 packet.Header.Resent = true;
260 OutPacket(packet); 260 OutPacket(packet);
261 } 261 }
262 } 262 }
263 } 263 }
264 } 264 }
265 265
266 protected void SendAcks() 266 protected void SendAcks()
267 { 267 {
268 lock (PendingAcks) 268 lock (PendingAcks)
269 { 269 {
270 if (PendingAcks.Count > 0) 270 if (PendingAcks.Count > 0)
271 { 271 {
272 if (PendingAcks.Count > 250) 272 if (PendingAcks.Count > 250)
273 { 273 {
274 // FIXME: Handle the odd case where we have too many pending ACKs queued up 274 // FIXME: Handle the odd case where we have too many pending ACKs queued up
275 MainLog.Instance.Verbose( "Too many ACKs queued up!"); 275 MainLog.Instance.Verbose( "Too many ACKs queued up!");
276 return; 276 return;
277 } 277 }
278 278
279 //OpenSim.Framework.Console.MainLog.Instance.WriteLine("Sending PacketAck"); 279 //OpenSim.Framework.Console.MainLog.Instance.WriteLine("Sending PacketAck");
280 280
281 281
282 int i = 0; 282 int i = 0;
283 PacketAckPacket acks = new PacketAckPacket(); 283 PacketAckPacket acks = new PacketAckPacket();
284 acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; 284 acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count];
285 285
286 foreach (uint ack in PendingAcks.Values) 286 foreach (uint ack in PendingAcks.Values)
287 { 287 {
288 acks.Packets[i] = new PacketAckPacket.PacketsBlock(); 288 acks.Packets[i] = new PacketAckPacket.PacketsBlock();
289 acks.Packets[i].ID = ack; 289 acks.Packets[i].ID = ack;
290 i++; 290 i++;
291 } 291 }
292 292
293 acks.Header.Reliable = false; 293 acks.Header.Reliable = false;
294 OutPacket(acks); 294 OutPacket(acks);
295 295
296 PendingAcks.Clear(); 296 PendingAcks.Clear();
297 } 297 }
298 } 298 }
299 } 299 }
300 300
301 protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) 301 protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
302 { 302 {
303 SendAcks(); 303 SendAcks();
304 ResendUnacked(); 304 ResendUnacked();
305 } 305 }
306 #endregion 306 #endregion
307 307
308 protected virtual void KillThread() 308 protected virtual void KillThread()
309 { 309 {
310 310
311 } 311 }
312 312
313 #region Nested Classes 313 #region Nested Classes
314 314
315 public class QueItem 315 public class QueItem
316 { 316 {
317 public QueItem() 317 public QueItem()
318 { 318 {
319 } 319 }
320 320
321 public Packet Packet; 321 public Packet Packet;
322 public bool Incoming; 322 public bool Incoming;
323 } 323 }
324 #endregion 324 #endregion
325 } 325 }
326} 326}
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index a88c682..466fdde 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -1,184 +1,184 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Net; 29using System.Net;
30using System.Net.Sockets; 30using System.Net.Sockets;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Assets; 32using OpenSim.Assets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Caches; 35using OpenSim.Region.Caches;
36 36
37namespace OpenSim.Region.ClientStack 37namespace OpenSim.Region.ClientStack
38{ 38{
39 public class PacketServer 39 public class PacketServer
40 { 40 {
41 private ClientStackNetworkHandler _networkHandler; 41 private ClientStackNetworkHandler _networkHandler;
42 private IWorld _localWorld; 42 private IWorld _localWorld;
43 public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>(); 43 public Dictionary<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>();
44 private ClientManager m_clientManager = new ClientManager(); 44 private ClientManager m_clientManager = new ClientManager();
45 public ClientManager ClientManager 45 public ClientManager ClientManager
46 { 46 {
47 get { return m_clientManager; } 47 get { return m_clientManager; }
48 } 48 }
49 49
50 public PacketServer(ClientStackNetworkHandler networkHandler) 50 public PacketServer(ClientStackNetworkHandler networkHandler)
51 { 51 {
52 _networkHandler = networkHandler; 52 _networkHandler = networkHandler;
53 _networkHandler.RegisterPacketServer(this); 53 _networkHandler.RegisterPacketServer(this);
54 } 54 }
55 55
56 public IWorld LocalWorld 56 public IWorld LocalWorld
57 { 57 {
58 set 58 set
59 { 59 {
60 this._localWorld = value; 60 this._localWorld = value;
61 } 61 }
62 } 62 }
63 63
64 /// <summary> 64 /// <summary>
65 /// 65 ///
66 /// </summary> 66 /// </summary>
67 /// <param name="circuitCode"></param> 67 /// <param name="circuitCode"></param>
68 /// <param name="packet"></param> 68 /// <param name="packet"></param>
69 public virtual void ClientInPacket(uint circuitCode, Packet packet) 69 public virtual void ClientInPacket(uint circuitCode, Packet packet)
70 { 70 {
71 if (this.ClientThreads.ContainsKey(circuitCode)) 71 if (this.ClientThreads.ContainsKey(circuitCode))
72 { 72 {
73 ClientThreads[circuitCode].InPacket(packet); 73 ClientThreads[circuitCode].InPacket(packet);
74 } 74 }
75 } 75 }
76 76
77 /// <summary> 77 /// <summary>
78 /// 78 ///
79 /// </summary> 79 /// </summary>
80 /// <param name="circuitCode"></param> 80 /// <param name="circuitCode"></param>
81 /// <returns></returns> 81 /// <returns></returns>
82 public virtual bool AddNewCircuitCodeClient(uint circuitCode) 82 public virtual bool AddNewCircuitCodeClient(uint circuitCode)
83 { 83 {
84 return false; 84 return false;
85 } 85 }
86 86
87 /// <summary> 87 /// <summary>
88 /// 88 ///
89 /// </summary> 89 /// </summary>
90 /// <param name="packet"></param> 90 /// <param name="packet"></param>
91 public virtual void SendPacketToAllClients(Packet packet) 91 public virtual void SendPacketToAllClients(Packet packet)
92 { 92 {
93 93
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
97 /// 97 ///
98 /// </summary> 98 /// </summary>
99 /// <param name="packet"></param> 99 /// <param name="packet"></param>
100 /// <param name="simClient"></param> 100 /// <param name="simClient"></param>
101 public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient) 101 public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient)
102 { 102 {
103 103
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// 107 ///
108 /// </summary> 108 /// </summary>
109 /// <param name="packetType"></param> 109 /// <param name="packetType"></param>
110 /// <param name="handler"></param> 110 /// <param name="handler"></param>
111 public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler) 111 public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler)
112 { 112 {
113 113
114 } 114 }
115 115
116 /// <summary> 116 /// <summary>
117 /// 117 ///
118 /// </summary> 118 /// </summary>
119 public virtual void RegisterClientPacketHandlers() 119 public virtual void RegisterClientPacketHandlers()
120 { 120 {
121 121
122 } 122 }
123 123
124 /// <summary> 124 /// <summary>
125 /// 125 ///
126 /// </summary> 126 /// </summary>
127 /// <param name="remoteEP"></param> 127 /// <param name="remoteEP"></param>
128 /// <param name="initialcirpack"></param> 128 /// <param name="initialcirpack"></param>
129 /// <param name="clientThreads"></param> 129 /// <param name="clientThreads"></param>
130 /// <param name="world"></param> 130 /// <param name="world"></param>
131 /// <param name="assetCache"></param> 131 /// <param name="assetCache"></param>
132 /// <param name="packServer"></param> 132 /// <param name="packServer"></param>
133 /// <param name="inventoryCache"></param> 133 /// <param name="inventoryCache"></param>
134 /// <param name="authenSessions"></param> 134 /// <param name="authenSessions"></param>
135 /// <returns></returns> 135 /// <returns></returns>
136 protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) 136 protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions)
137 { 137 {
138 return new ClientView(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions ); 138 return new ClientView(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions );
139 } 139 }
140 140
141 /// <summary> 141 /// <summary>
142 /// 142 ///
143 /// </summary> 143 /// </summary>
144 /// <param name="epSender"></param> 144 /// <param name="epSender"></param>
145 /// <param name="useCircuit"></param> 145 /// <param name="useCircuit"></param>
146 /// <param name="assetCache"></param> 146 /// <param name="assetCache"></param>
147 /// <param name="inventoryCache"></param> 147 /// <param name="inventoryCache"></param>
148 /// <param name="authenticateSessionsClass"></param> 148 /// <param name="authenticateSessionsClass"></param>
149 /// <returns></returns> 149 /// <returns></returns>
150 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass) 150 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass)
151 { 151 {
152 ClientView newuser = 152 ClientView newuser =
153 CreateNewClient(epSender, useCircuit, ClientThreads, _localWorld, assetCache, this, inventoryCache, 153 CreateNewClient(epSender, useCircuit, ClientThreads, _localWorld, assetCache, this, inventoryCache,
154 authenticateSessionsClass); 154 authenticateSessionsClass);
155 155
156 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 156 this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
157 this.m_clientManager.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); 157 this.m_clientManager.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser);
158 158
159 return true; 159 return true;
160 } 160 }
161 161
162 /// <summary> 162 /// <summary>
163 /// 163 ///
164 /// </summary> 164 /// </summary>
165 /// <param name="buffer"></param> 165 /// <param name="buffer"></param>
166 /// <param name="size"></param> 166 /// <param name="size"></param>
167 /// <param name="flags"></param> 167 /// <param name="flags"></param>
168 /// <param name="circuitcode"></param> 168 /// <param name="circuitcode"></param>
169 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 169 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
170 { 170 {
171 this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode); 171 this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
172 } 172 }
173 173
174 /// <summary> 174 /// <summary>
175 /// 175 ///
176 /// </summary> 176 /// </summary>
177 /// <param name="circuitcode"></param> 177 /// <param name="circuitcode"></param>
178 public virtual void RemoveClientCircuit(uint circuitcode) 178 public virtual void RemoveClientCircuit(uint circuitcode)
179 { 179 {
180 this._networkHandler.RemoveClientCircuit(circuitcode); 180 this._networkHandler.RemoveClientCircuit(circuitcode);
181 this.m_clientManager.Remove(circuitcode); 181 this.m_clientManager.Remove(circuitcode);
182 } 182 }
183 } 183 }
184} 184}
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 7ae74f8..ed7df17 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -1,118 +1,118 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using OpenSim.Assets; 31using OpenSim.Assets;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Physics.Manager; 37using OpenSim.Physics.Manager;
38using OpenSim.Region.Caches; 38using OpenSim.Region.Caches;
39using OpenSim.Region.Environment; 39using OpenSim.Region.Environment;
40 40
41namespace OpenSim.Region.ClientStack 41namespace OpenSim.Region.ClientStack
42{ 42{
43 public class RegionApplicationBase 43 public class RegionApplicationBase
44 { 44 {
45 protected IGenericConfig localConfig; 45 protected IGenericConfig localConfig;
46 protected PhysicsManager physManager; 46 protected PhysicsManager physManager;
47 protected AssetCache AssetCache; 47 protected AssetCache AssetCache;
48 protected InventoryCache InventoryCache; 48 protected InventoryCache InventoryCache;
49 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 49 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
50 protected DateTime startuptime; 50 protected DateTime startuptime;
51 protected NetworkServersInfo serversData; 51 protected NetworkServersInfo serversData;
52 52
53 public string m_physicsEngine; 53 public string m_physicsEngine;
54 public bool m_sandbox = false; 54 public bool m_sandbox = false;
55 public bool m_loginserver; 55 public bool m_loginserver;
56 public bool user_accounts = false; 56 public bool user_accounts = false;
57 public bool gridLocalAsset = false; 57 public bool gridLocalAsset = false;
58 protected bool configFileSetup = false; 58 protected bool configFileSetup = false;
59 public string m_config; 59 public string m_config;
60 60
61 protected List<UDPServer> m_udpServer = new List<UDPServer>(); 61 protected List<UDPServer> m_udpServer = new List<UDPServer>();
62 protected List<RegionInfo> regionData = new List<RegionInfo>(); 62 protected List<RegionInfo> regionData = new List<RegionInfo>();
63 protected List<IWorld> m_localWorld = new List<IWorld>(); 63 protected List<IWorld> m_localWorld = new List<IWorld>();
64 protected BaseHttpServer httpServer; 64 protected BaseHttpServer httpServer;
65 protected List<AuthenticateSessionsBase> AuthenticateSessionsHandler = new List<AuthenticateSessionsBase>(); 65 protected List<AuthenticateSessionsBase> AuthenticateSessionsHandler = new List<AuthenticateSessionsBase>();
66 66
67 protected LogBase m_log; 67 protected LogBase m_log;
68 68
69 public RegionApplicationBase() 69 public RegionApplicationBase()
70 { 70 {
71 71
72 } 72 }
73 73
74 public RegionApplicationBase(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) 74 public RegionApplicationBase(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
75 { 75 {
76 this.configFileSetup = useConfigFile; 76 this.configFileSetup = useConfigFile;
77 m_sandbox = sandBoxMode; 77 m_sandbox = sandBoxMode;
78 m_loginserver = startLoginServer; 78 m_loginserver = startLoginServer;
79 m_physicsEngine = physicsEngine; 79 m_physicsEngine = physicsEngine;
80 m_config = configFile; 80 m_config = configFile;
81 } 81 }
82 82
83 /*protected World m_localWorld; 83 /*protected World m_localWorld;
84 public World LocalWorld 84 public World LocalWorld
85 { 85 {
86 get { return m_localWorld; } 86 get { return m_localWorld; }
87 }*/ 87 }*/
88 88
89 /// <summary> 89 /// <summary>
90 /// Performs initialisation of the world, such as loading configuration from disk. 90 /// Performs initialisation of the world, such as loading configuration from disk.
91 /// </summary> 91 /// </summary>
92 public virtual void StartUp() 92 public virtual void StartUp()
93 { 93 {
94 } 94 }
95 95
96 protected virtual void SetupLocalGridServers() 96 protected virtual void SetupLocalGridServers()
97 { 97 {
98 } 98 }
99 99
100 protected virtual void SetupRemoteGridServers() 100 protected virtual void SetupRemoteGridServers()
101 { 101 {
102 102
103 } 103 }
104 104
105 protected virtual void SetupScene() 105 protected virtual void SetupScene()
106 { 106 {
107 } 107 }
108 108
109 protected virtual void SetupHttpListener() 109 protected virtual void SetupHttpListener()
110 { 110 {
111 } 111 }
112 112
113 protected virtual void ConnectToRemoteGridServer() 113 protected virtual void ConnectToRemoteGridServer()
114 { 114 {
115 115
116 } 116 }
117 } 117 }
118} 118}
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 6eea524..781f96a 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -1,196 +1,196 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Assets; 33using OpenSim.Assets;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Region.Caches; 37using OpenSim.Region.Caches;
38 38
39namespace OpenSim.Region.ClientStack 39namespace OpenSim.Region.ClientStack
40{ 40{
41 41
42 public class UDPServer : ClientStackNetworkHandler 42 public class UDPServer : ClientStackNetworkHandler
43 { 43 {
44 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 44 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
45 public Socket Server; 45 public Socket Server;
46 protected IPEndPoint ServerIncoming; 46 protected IPEndPoint ServerIncoming;
47 protected byte[] RecvBuffer = new byte[4096]; 47 protected byte[] RecvBuffer = new byte[4096];
48 protected byte[] ZeroBuffer = new byte[8192]; 48 protected byte[] ZeroBuffer = new byte[8192];
49 protected IPEndPoint ipeSender; 49 protected IPEndPoint ipeSender;
50 protected EndPoint epSender; 50 protected EndPoint epSender;
51 protected AsyncCallback ReceivedData; 51 protected AsyncCallback ReceivedData;
52 protected PacketServer _packetServer; 52 protected PacketServer _packetServer;
53 53
54 protected int listenPort; 54 protected int listenPort;
55 protected IWorld m_localWorld; 55 protected IWorld m_localWorld;
56 protected AssetCache m_assetCache; 56 protected AssetCache m_assetCache;
57 protected InventoryCache m_inventoryCache; 57 protected InventoryCache m_inventoryCache;
58 protected LogBase m_log; 58 protected LogBase m_log;
59 protected AuthenticateSessionsBase m_authenticateSessionsClass; 59 protected AuthenticateSessionsBase m_authenticateSessionsClass;
60 60
61 public PacketServer PacketServer 61 public PacketServer PacketServer
62 { 62 {
63 get 63 get
64 { 64 {
65 return _packetServer; 65 return _packetServer;
66 } 66 }
67 set 67 set
68 { 68 {
69 _packetServer = value; 69 _packetServer = value;
70 } 70 }
71 } 71 }
72 72
73 public IWorld LocalWorld 73 public IWorld LocalWorld
74 { 74 {
75 set 75 set
76 { 76 {
77 this.m_localWorld = value; 77 this.m_localWorld = value;
78 this._packetServer.LocalWorld = this.m_localWorld; 78 this._packetServer.LocalWorld = this.m_localWorld;
79 } 79 }
80 } 80 }
81 81
82 public UDPServer() 82 public UDPServer()
83 { 83 {
84 } 84 }
85 85
86 public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, LogBase console, AuthenticateSessionsBase authenticateClass) 86 public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, LogBase console, AuthenticateSessionsBase authenticateClass)
87 { 87 {
88 listenPort = port; 88 listenPort = port;
89 this.m_assetCache = assetCache; 89 this.m_assetCache = assetCache;
90 this.m_inventoryCache = inventoryCache; 90 this.m_inventoryCache = inventoryCache;
91 this.m_log = console; 91 this.m_log = console;
92 this.m_authenticateSessionsClass = authenticateClass; 92 this.m_authenticateSessionsClass = authenticateClass;
93 this.CreatePacketServer(); 93 this.CreatePacketServer();
94 94
95 } 95 }
96 96
97 protected virtual void CreatePacketServer() 97 protected virtual void CreatePacketServer()
98 { 98 {
99 PacketServer packetServer = new PacketServer(this); 99 PacketServer packetServer = new PacketServer(this);
100 } 100 }
101 101
102 protected virtual void OnReceivedData(IAsyncResult result) 102 protected virtual void OnReceivedData(IAsyncResult result)
103 { 103 {
104 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 104 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
105 epSender = (EndPoint)ipeSender; 105 epSender = (EndPoint)ipeSender;
106 Packet packet = null; 106 Packet packet = null;
107 int numBytes = Server.EndReceiveFrom(result, ref epSender); 107 int numBytes = Server.EndReceiveFrom(result, ref epSender);
108 int packetEnd = numBytes - 1; 108 int packetEnd = numBytes - 1;
109 109
110 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); 110 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
111 111
112 // do we already have a circuit for this endpoint 112 // do we already have a circuit for this endpoint
113 if (this.clientCircuits.ContainsKey(epSender)) 113 if (this.clientCircuits.ContainsKey(epSender))
114 { 114 {
115 //if so then send packet to the packetserver 115 //if so then send packet to the packetserver
116 this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet); 116 this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet);
117 } 117 }
118 else if (packet.Type == PacketType.UseCircuitCode) 118 else if (packet.Type == PacketType.UseCircuitCode)
119 { 119 {
120 // new client 120 // new client
121 this.AddNewClient(packet); 121 this.AddNewClient(packet);
122 } 122 }
123 else 123 else
124 { // invalid client 124 { // invalid client
125 m_log.Warn("UDPServer.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); 125 m_log.Warn("UDPServer.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
126 } 126 }
127 127
128 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 128 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
129 } 129 }
130 130
131 protected virtual void AddNewClient(Packet packet) 131 protected virtual void AddNewClient(Packet packet)
132 { 132 {
133 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 133 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
134 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 134 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
135 135
136 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass); 136 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass);
137 } 137 }
138 138
139 public void ServerListener() 139 public void ServerListener()
140 { 140 {
141 m_log.Status("UDPServer.cs:ServerListener() - Opening UDP socket on " + listenPort); 141 m_log.Status("UDPServer.cs:ServerListener() - Opening UDP socket on " + listenPort);
142 142
143 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); 143 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort);
144 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 144 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
145 Server.Bind(ServerIncoming); 145 Server.Bind(ServerIncoming);
146 146
147 m_log.Verbose("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); 147 m_log.Verbose("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen");
148 148
149 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 149 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
150 epSender = (EndPoint)ipeSender; 150 epSender = (EndPoint)ipeSender;
151 ReceivedData = new AsyncCallback(this.OnReceivedData); 151 ReceivedData = new AsyncCallback(this.OnReceivedData);
152 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 152 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
153 153
154 m_log.Verbose("UDPServer.cs:ServerListener() - Listening..."); 154 m_log.Verbose("UDPServer.cs:ServerListener() - Listening...");
155 155
156 } 156 }
157 157
158 public virtual void RegisterPacketServer(PacketServer server) 158 public virtual void RegisterPacketServer(PacketServer server)
159 { 159 {
160 this._packetServer = server; 160 this._packetServer = server;
161 } 161 }
162 162
163 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) 163 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender)
164 { 164 {
165 // find the endpoint for this circuit 165 // find the endpoint for this circuit
166 EndPoint sendto = null; 166 EndPoint sendto = null;
167 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) 167 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits)
168 { 168 {
169 if (p.Value == circuitcode) 169 if (p.Value == circuitcode)
170 { 170 {
171 sendto = p.Key; 171 sendto = p.Key;
172 break; 172 break;
173 } 173 }
174 } 174 }
175 if (sendto != null) 175 if (sendto != null)
176 { 176 {
177 //we found the endpoint so send the packet to it 177 //we found the endpoint so send the packet to it
178 this.Server.SendTo(buffer, size, flags, sendto); 178 this.Server.SendTo(buffer, size, flags, sendto);
179 } 179 }
180 } 180 }
181 181
182 public virtual void RemoveClientCircuit(uint circuitcode) 182 public virtual void RemoveClientCircuit(uint circuitcode)
183 { 183 {
184 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) 184 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits)
185 { 185 {
186 if (p.Value == circuitcode) 186 if (p.Value == circuitcode)
187 { 187 {
188 this.clientCircuits.Remove(p.Key); 188 this.clientCircuits.Remove(p.Key);
189 break; 189 break;
190 } 190 }
191 } 191 }
192 } 192 }
193 193
194 194
195 } 195 }
196} \ No newline at end of file 196} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index c47904d..3ce0cc5 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -1,55 +1,55 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework.Communications; 28using OpenSim.Framework.Communications;
29using OpenSim.Framework.Types; 29using OpenSim.Framework.Types;
30using OpenSim.Framework.Servers; 30using OpenSim.Framework.Servers;
31 31
32namespace OpenSim.Region.Communications.Local 32namespace OpenSim.Region.Communications.Local
33{ 33{
34 public class CommunicationsLocal : CommunicationsManager 34 public class CommunicationsLocal : CommunicationsManager
35 { 35 {
36 public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); 36 public LocalBackEndServices SandBoxServices = new LocalBackEndServices();
37 public LocalUserServices UserServices; 37 public LocalUserServices UserServices;
38 38
39 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) 39 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer )
40 : base(serversInfo, httpServer) 40 : base(serversInfo, httpServer)
41 { 41 {
42 UserServices = new LocalUserServices(this, serversInfo); 42 UserServices = new LocalUserServices(this, serversInfo);
43 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); 43 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
44 UserServer = UserServices; 44 UserServer = UserServices;
45 GridServer = SandBoxServices; 45 GridServer = SandBoxServices;
46 InterRegion = SandBoxServices; 46 InterRegion = SandBoxServices;
47 httpServer.AddXmlRPCHandler("login_to_simulator", UserServices.XmlRpcLoginMethod); 47 httpServer.AddXmlRPCHandler("login_to_simulator", UserServices.XmlRpcLoginMethod);
48 } 48 }
49 49
50 internal void InformRegionOfLogin(ulong regionHandle, Login login) 50 internal void InformRegionOfLogin(ulong regionHandle, Login login)
51 { 51 {
52 this.SandBoxServices.AddNewSession(regionHandle, login); 52 this.SandBoxServices.AddNewSession(regionHandle, login);
53 } 53 }
54 } 54 }
55} 55}
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index d0cd991..9322f3b 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -1,206 +1,206 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Communications; 31using OpenSim.Framework.Communications;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33 33
34namespace OpenSim.Region.Communications.Local 34namespace OpenSim.Region.Communications.Local
35{ 35{
36 36
37 public class LocalBackEndServices : IGridServices, IInterRegionCommunications 37 public class LocalBackEndServices : IGridServices, IInterRegionCommunications
38 { 38 {
39 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); 39 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>();
40 protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>(); 40 protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>();
41 41
42 public LocalBackEndServices() 42 public LocalBackEndServices()
43 { 43 {
44 44
45 } 45 }
46 46
47 /// <summary> 47 /// <summary>
48 /// Register a region method with the BackEnd Services. 48 /// Register a region method with the BackEnd Services.
49 /// </summary> 49 /// </summary>
50 /// <param name="regionInfo"></param> 50 /// <param name="regionInfo"></param>
51 /// <returns></returns> 51 /// <returns></returns>
52 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 52 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
53 { 53 {
54 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); 54 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
55 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) 55 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
56 { 56 {
57 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); 57 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
58 this.regions.Add(regionInfo.RegionHandle, regionInfo); 58 this.regions.Add(regionInfo.RegionHandle, regionInfo);
59 RegionCommsListener regionHost = new RegionCommsListener(); 59 RegionCommsListener regionHost = new RegionCommsListener();
60 this.regionHosts.Add(regionInfo.RegionHandle, regionHost); 60 this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
61 61
62 return regionHost; 62 return regionHost;
63 } 63 }
64 64
65 //already in our list of regions so for now lets return null 65 //already in our list of regions so for now lets return null
66 return null; 66 return null;
67 } 67 }
68 68
69 /// <summary> 69 /// <summary>
70 /// </summary> 70 /// </summary>
71 /// <param name="regionInfo"></param> 71 /// <param name="regionInfo"></param>
72 /// <returns></returns> 72 /// <returns></returns>
73 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) 73 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
74 { 74 {
75 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); 75 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
76 List<RegionInfo> neighbours = new List<RegionInfo>(); 76 List<RegionInfo> neighbours = new List<RegionInfo>();
77 77
78 foreach (RegionInfo reg in this.regions.Values) 78 foreach (RegionInfo reg in this.regions.Values)
79 { 79 {
80 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); 80 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
81 if (reg.RegionHandle != regionInfo.RegionHandle) 81 if (reg.RegionHandle != regionInfo.RegionHandle)
82 { 82 {
83 //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); 83 //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
84 if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) 84 if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
85 { 85 {
86 if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) 86 if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
87 { 87 {
88 neighbours.Add(reg); 88 neighbours.Add(reg);
89 } 89 }
90 } 90 }
91 } 91 }
92 } 92 }
93 return neighbours; 93 return neighbours;
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
97 /// 97 ///
98 /// </summary> 98 /// </summary>
99 /// <param name="regionHandle"></param> 99 /// <param name="regionHandle"></param>
100 /// <returns></returns> 100 /// <returns></returns>
101 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 101 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
102 { 102 {
103 if (this.regions.ContainsKey(regionHandle)) 103 if (this.regions.ContainsKey(regionHandle))
104 { 104 {
105 return this.regions[regionHandle]; 105 return this.regions[regionHandle];
106 } 106 }
107 return null; 107 return null;
108 } 108 }
109 109
110 /// <summary> 110 /// <summary>
111 /// 111 ///
112 /// </summary> 112 /// </summary>
113 /// <param name="minX"></param> 113 /// <param name="minX"></param>
114 /// <param name="minY"></param> 114 /// <param name="minY"></param>
115 /// <param name="maxX"></param> 115 /// <param name="maxX"></param>
116 /// <param name="maxY"></param> 116 /// <param name="maxY"></param>
117 /// <returns></returns> 117 /// <returns></returns>
118 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 118 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
119 { 119 {
120 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 120 List<MapBlockData> mapBlocks = new List<MapBlockData>();
121 foreach(RegionInfo regInfo in this.regions.Values) 121 foreach(RegionInfo regInfo in this.regions.Values)
122 { 122 {
123 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) 123 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
124 { 124 {
125 MapBlockData map = new MapBlockData(); 125 MapBlockData map = new MapBlockData();
126 map.Name = regInfo.RegionName; 126 map.Name = regInfo.RegionName;
127 map.X = (ushort)regInfo.RegionLocX; 127 map.X = (ushort)regInfo.RegionLocX;
128 map.Y = (ushort)regInfo.RegionLocY; 128 map.Y = (ushort)regInfo.RegionLocY;
129 map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; 129 map.WaterHeight =(byte) regInfo.estateSettings.waterHeight;
130 map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); 130 map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007");
131 map.Agents = 1; 131 map.Agents = 1;
132 map.RegionFlags = 72458694; 132 map.RegionFlags = 72458694;
133 map.Access = 13; 133 map.Access = 13;
134 mapBlocks.Add(map); 134 mapBlocks.Add(map);
135 } 135 }
136 } 136 }
137 return mapBlocks; 137 return mapBlocks;
138 } 138 }
139 139
140 /// <summary> 140 /// <summary>
141 /// </summary> 141 /// </summary>
142 /// <param name="regionHandle"></param> 142 /// <param name="regionHandle"></param>
143 /// <param name="agentData"></param> 143 /// <param name="agentData"></param>
144 /// <returns></returns> 144 /// <returns></returns>
145 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData 145 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
146 { 146 {
147 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); 147 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
148 if (this.regionHosts.ContainsKey(regionHandle)) 148 if (this.regionHosts.ContainsKey(regionHandle))
149 { 149 {
150 // Console.WriteLine("CommsManager- Informing a region to expect child agent"); 150 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
151 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); 151 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData);
152 return true; 152 return true;
153 } 153 }
154 return false; 154 return false;
155 } 155 }
156 156
157 /// <summary> 157 /// <summary>
158 /// 158 ///
159 /// </summary> 159 /// </summary>
160 /// <param name="regionHandle"></param> 160 /// <param name="regionHandle"></param>
161 /// <param name="agentID"></param> 161 /// <param name="agentID"></param>
162 /// <param name="position"></param> 162 /// <param name="position"></param>
163 /// <returns></returns> 163 /// <returns></returns>
164 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 164 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
165 { 165 {
166 if (this.regionHosts.ContainsKey(regionHandle)) 166 if (this.regionHosts.ContainsKey(regionHandle))
167 { 167 {
168 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); 168 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
169 this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); 169 this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
170 return true; 170 return true;
171 } 171 }
172 return false; 172 return false;
173 } 173 }
174 174
175 /// <summary> 175 /// <summary>
176 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session 176 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
177 /// </summary> 177 /// </summary>
178 /// <param name="regionHandle"></param> 178 /// <param name="regionHandle"></param>
179 /// <param name="loginData"></param> 179 /// <param name="loginData"></param>
180 /// <returns></returns> 180 /// <returns></returns>
181 public bool AddNewSession(ulong regionHandle, Login loginData) 181 public bool AddNewSession(ulong regionHandle, Login loginData)
182 { 182 {
183 AgentCircuitData agent = new AgentCircuitData(); 183 AgentCircuitData agent = new AgentCircuitData();
184 agent.AgentID = loginData.Agent; 184 agent.AgentID = loginData.Agent;
185 agent.firstname = loginData.First; 185 agent.firstname = loginData.First;
186 agent.lastname = loginData.Last; 186 agent.lastname = loginData.Last;
187 agent.SessionID = loginData.Session; 187 agent.SessionID = loginData.Session;
188 agent.SecureSessionID = loginData.SecureSession; 188 agent.SecureSessionID = loginData.SecureSession;
189 agent.circuitcode = loginData.CircuitCode; 189 agent.circuitcode = loginData.CircuitCode;
190 agent.BaseFolder = loginData.BaseFolder; 190 agent.BaseFolder = loginData.BaseFolder;
191 agent.InventoryFolder = loginData.InventoryFolder; 191 agent.InventoryFolder = loginData.InventoryFolder;
192 agent.startpos = new LLVector3(128, 128, 70); 192 agent.startpos = new LLVector3(128, 128, 70);
193 agent.CapsPath = loginData.CapsPath; 193 agent.CapsPath = loginData.CapsPath;
194 194
195 if (this.regionHosts.ContainsKey(regionHandle)) 195 if (this.regionHosts.ContainsKey(regionHandle))
196 { 196 {
197 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); 197 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
198 return true; 198 return true;
199 } 199 }
200 200
201 // region not found 201 // region not found
202 return false; 202 return false;
203 } 203 }
204 } 204 }
205} 205}
206 206
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index 592b36c..a4cefc4 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -1,142 +1,142 @@
1using System; 1using System;
2using libsecondlife; 2using libsecondlife;
3using OpenSim.Framework.Communications; 3using OpenSim.Framework.Communications;
4using OpenSim.Framework.Data; 4using OpenSim.Framework.Data;
5using OpenSim.Framework.Types; 5using OpenSim.Framework.Types;
6using OpenSim.Framework.UserManagement; 6using OpenSim.Framework.UserManagement;
7using OpenSim.Framework.Utilities; 7using OpenSim.Framework.Utilities;
8 8
9namespace OpenSim.Region.Communications.Local 9namespace OpenSim.Region.Communications.Local
10{ 10{
11 public class LocalUserServices : UserManagerBase, IUserServices 11 public class LocalUserServices : UserManagerBase, IUserServices
12 { 12 {
13 private CommunicationsLocal m_Parent; 13 private CommunicationsLocal m_Parent;
14 14
15 private NetworkServersInfo serversInfo; 15 private NetworkServersInfo serversInfo;
16 private uint defaultHomeX ; 16 private uint defaultHomeX ;
17 private uint defaultHomeY; 17 private uint defaultHomeY;
18 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData) 18 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData)
19 { 19 {
20 m_Parent = parent; 20 m_Parent = parent;
21 this.serversInfo = serversData; 21 this.serversInfo = serversData;
22 defaultHomeX = this.serversInfo.DefaultHomeLocX; 22 defaultHomeX = this.serversInfo.DefaultHomeLocX;
23 defaultHomeY = this.serversInfo.DefaultHomeLocY; 23 defaultHomeY = this.serversInfo.DefaultHomeLocY;
24 } 24 }
25 25
26 public UserProfileData GetUserProfile(string firstName, string lastName) 26 public UserProfileData GetUserProfile(string firstName, string lastName)
27 { 27 {
28 return GetUserProfile(firstName + " " + lastName); 28 return GetUserProfile(firstName + " " + lastName);
29 } 29 }
30 30
31 public UserProfileData GetUserProfile(string name) 31 public UserProfileData GetUserProfile(string name)
32 { 32 {
33 return this.getUserProfile(name); 33 return this.getUserProfile(name);
34 } 34 }
35 35
36 public UserProfileData GetUserProfile(LLUUID avatarID) 36 public UserProfileData GetUserProfile(LLUUID avatarID)
37 { 37 {
38 return this.getUserProfile(avatarID); 38 return this.getUserProfile(avatarID);
39 } 39 }
40 40
41 /// <summary> 41 /// <summary>
42 /// 42 ///
43 /// </summary> 43 /// </summary>
44 /// <returns></returns> 44 /// <returns></returns>
45 public override string GetMessage() 45 public override string GetMessage()
46 { 46 {
47 return "Welcome to OpenSim"; 47 return "Welcome to OpenSim";
48 } 48 }
49 49
50 public override UserProfileData GetTheUser(string firstname, string lastname) 50 public override UserProfileData GetTheUser(string firstname, string lastname)
51 { 51 {
52 UserProfileData profile = getUserProfile(firstname, lastname); 52 UserProfileData profile = getUserProfile(firstname, lastname);
53 if (profile != null) 53 if (profile != null)
54 { 54 {
55 55
56 return profile; 56 return profile;
57 } 57 }
58 58
59 //no current user account so make one 59 //no current user account so make one
60 Console.WriteLine("No User account found so creating a new one "); 60 Console.WriteLine("No User account found so creating a new one ");
61 this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 61 this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
62 62
63 profile = getUserProfile(firstname, lastname); 63 profile = getUserProfile(firstname, lastname);
64 64
65 return profile; 65 return profile;
66 } 66 }
67 67
68 public override bool AuthenticateUser(UserProfileData profile, string password) 68 public override bool AuthenticateUser(UserProfileData profile, string password)
69 { 69 {
70 //for now we will accept any password in sandbox mode 70 //for now we will accept any password in sandbox mode
71 Console.WriteLine("authorising user"); 71 Console.WriteLine("authorising user");
72 return true; 72 return true;
73 } 73 }
74 74
75 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) 75 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
76 { 76 {
77 ulong currentRegion = theUser.currentAgent.currentHandle; 77 ulong currentRegion = theUser.currentAgent.currentHandle;
78 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); 78 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
79 79
80 if (reg != null) 80 if (reg != null)
81 { 81 {
82 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + 82 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
83 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 83 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
84 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 84 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
85 string capsPath = Util.GetRandomCapsPath(); 85 string capsPath = Util.GetRandomCapsPath();
86 response.SimAddress = reg.ExternalEndPoint.Address.ToString(); 86 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
87 response.SimPort = (Int32)reg.ExternalEndPoint.Port; 87 response.SimPort = (Int32)reg.ExternalEndPoint.Port;
88 response.RegionX = reg.RegionLocX ; 88 response.RegionX = reg.RegionLocX ;
89 response.RegionY = reg.RegionLocY ; 89 response.RegionY = reg.RegionLocY ;
90 90
91 //following port needs changing as we don't want a http listener for every region (or do we?) 91 //following port needs changing as we don't want a http listener for every region (or do we?)
92 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; 92 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
93 theUser.currentAgent.currentRegion = reg.SimUUID; 93 theUser.currentAgent.currentRegion = reg.SimUUID;
94 theUser.currentAgent.currentHandle = reg.RegionHandle; 94 theUser.currentAgent.currentHandle = reg.RegionHandle;
95 95
96 Login _login = new Login(); 96 Login _login = new Login();
97 //copy data to login object 97 //copy data to login object
98 _login.First = response.Firstname; 98 _login.First = response.Firstname;
99 _login.Last = response.Lastname; 99 _login.Last = response.Lastname;
100 _login.Agent = response.AgentID; 100 _login.Agent = response.AgentID;
101 _login.Session = response.SessionID; 101 _login.Session = response.SessionID;
102 _login.SecureSession = response.SecureSessionID; 102 _login.SecureSession = response.SecureSessionID;
103 _login.CircuitCode = (uint)response.CircuitCode; 103 _login.CircuitCode = (uint)response.CircuitCode;
104 _login.CapsPath = capsPath; 104 _login.CapsPath = capsPath;
105 105
106 m_Parent.InformRegionOfLogin(currentRegion, _login); 106 m_Parent.InformRegionOfLogin(currentRegion, _login);
107 } 107 }
108 else 108 else
109 { 109 {
110 Console.WriteLine("not found region " + currentRegion); 110 Console.WriteLine("not found region " + currentRegion);
111 } 111 }
112 112
113 } 113 }
114 114
115 public UserProfileData SetupMasterUser(string firstName, string lastName) 115 public UserProfileData SetupMasterUser(string firstName, string lastName)
116 { 116 {
117 return SetupMasterUser(firstName, lastName, ""); 117 return SetupMasterUser(firstName, lastName, "");
118 } 118 }
119 119
120 public UserProfileData SetupMasterUser(string firstName, string lastName, string password) 120 public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
121 { 121 {
122 UserProfileData profile = getUserProfile(firstName, lastName); 122 UserProfileData profile = getUserProfile(firstName, lastName);
123 if (profile != null) 123 if (profile != null)
124 { 124 {
125 125
126 return profile; 126 return profile;
127 } 127 }
128 128
129 Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); 129 Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
130 this.AddUserProfile(firstName, lastName, password, defaultHomeX, defaultHomeY); 130 this.AddUserProfile(firstName, lastName, password, defaultHomeX, defaultHomeY);
131 131
132 profile = getUserProfile(firstName, lastName); 132 profile = getUserProfile(firstName, lastName);
133 133
134 if (profile == null) 134 if (profile == null)
135 { 135 {
136 Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here."); 136 Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here.");
137 } 137 }
138 138
139 return profile; 139 return profile;
140 } 140 }
141 } 141 }
142} 142}
diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs
index 9afb75e..ca64319 100644
--- a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Region.Communications.Local")] 6[assembly: AssemblyTitle("OpenSim.Region.Communications.Local")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenSim.Region.Communications.Local")] 10[assembly: AssemblyProduct("OpenSim.Region.Communications.Local")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] 21[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index cc05845..9df0901 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -1,18 +1,18 @@
1using OpenSim.Framework.Communications; 1using OpenSim.Framework.Communications;
2using OpenSim.Framework.Types; 2using OpenSim.Framework.Types;
3using OpenSim.Framework.Servers; 3using OpenSim.Framework.Servers;
4 4
5namespace OpenSim.Region.Communications.OGS1 5namespace OpenSim.Region.Communications.OGS1
6{ 6{
7 public class CommunicationsOGS1 : CommunicationsManager 7 public class CommunicationsOGS1 : CommunicationsManager
8 { 8 {
9 9
10 public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) :base(serversInfo, httpServer) 10 public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) :base(serversInfo, httpServer)
11 { 11 {
12 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); 12 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
13 GridServer = gridInterComms; 13 GridServer = gridInterComms;
14 InterRegion = gridInterComms; 14 InterRegion = gridInterComms;
15 UserServer = new OGS1UserServices(this); 15 UserServer = new OGS1UserServices(this);
16 } 16 }
17 } 17 }
18} 18}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index e5a73fd..3cb2889 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -1,431 +1,431 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Net; 4using System.Net;
5using System.Runtime.Remoting; 5using System.Runtime.Remoting;
6using System.Runtime.Remoting.Channels; 6using System.Runtime.Remoting.Channels;
7using System.Runtime.Remoting.Channels.Tcp; 7using System.Runtime.Remoting.Channels.Tcp;
8using libsecondlife; 8using libsecondlife;
9using Nwc.XmlRpc; 9using Nwc.XmlRpc;
10using OpenSim.Framework; 10using OpenSim.Framework;
11using OpenSim.Framework.Communications; 11using OpenSim.Framework.Communications;
12using OpenSim.Framework.Console; 12using OpenSim.Framework.Console;
13using OpenSim.Framework.Servers; 13using OpenSim.Framework.Servers;
14using OpenSim.Framework.Types; 14using OpenSim.Framework.Types;
15 15
16namespace OpenSim.Region.Communications.OGS1 16namespace OpenSim.Region.Communications.OGS1
17{ 17{
18 public class OGS1GridServices : IGridServices, IInterRegionCommunications 18 public class OGS1GridServices : IGridServices, IInterRegionCommunications
19 { 19 {
20 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>(); 20 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>();
21 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); 21 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>();
22 22
23 public BaseHttpServer httpListener; 23 public BaseHttpServer httpListener;
24 public NetworkServersInfo serversInfo; 24 public NetworkServersInfo serversInfo;
25 public BaseHttpServer httpServer; 25 public BaseHttpServer httpServer;
26 26
27 /// <summary> 27 /// <summary>
28 /// 28 ///
29 /// </summary> 29 /// </summary>
30 /// <param name="servers_info"></param> 30 /// <param name="servers_info"></param>
31 /// <param name="httpServe"></param> 31 /// <param name="httpServe"></param>
32 public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe) 32 public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe)
33 { 33 {
34 serversInfo = servers_info; 34 serversInfo = servers_info;
35 httpServer = httpServe; 35 httpServer = httpServe;
36 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); 36 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser);
37 this.StartRemoting(); 37 this.StartRemoting();
38 } 38 }
39 39
40 /// <summary> 40 /// <summary>
41 /// 41 ///
42 /// </summary> 42 /// </summary>
43 /// <param name="regionInfo"></param> 43 /// <param name="regionInfo"></param>
44 /// <returns></returns> 44 /// <returns></returns>
45 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 45 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
46 { 46 {
47 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) 47 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
48 { 48 {
49 this.regions.Add(regionInfo.RegionHandle, regionInfo); 49 this.regions.Add(regionInfo.RegionHandle, regionInfo);
50 } 50 }
51 51
52 Hashtable GridParams = new Hashtable(); 52 Hashtable GridParams = new Hashtable();
53 // Login / Authentication 53 // Login / Authentication
54 54
55 GridParams["authkey"] = serversInfo.GridSendKey; 55 GridParams["authkey"] = serversInfo.GridSendKey;
56 GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); 56 GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated();
57 GridParams["sim_ip"] = regionInfo.ExternalHostName; 57 GridParams["sim_ip"] = regionInfo.ExternalHostName;
58 GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); 58 GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString();
59 GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); 59 GridParams["region_locx"] = regionInfo.RegionLocX.ToString();
60 GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); 60 GridParams["region_locy"] = regionInfo.RegionLocY.ToString();
61 GridParams["sim_name"] = regionInfo.RegionName; 61 GridParams["sim_name"] = regionInfo.RegionName;
62 GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); 62 GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
63 GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString(); 63 GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString();
64 GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated(); 64 GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated();
65 65
66 // Package into an XMLRPC Request 66 // Package into an XMLRPC Request
67 ArrayList SendParams = new ArrayList(); 67 ArrayList SendParams = new ArrayList();
68 SendParams.Add(GridParams); 68 SendParams.Add(GridParams);
69 69
70 // Send Request 70 // Send Request
71 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); 71 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
72 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); 72 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
73 Hashtable GridRespData = (Hashtable)GridResp.Value; 73 Hashtable GridRespData = (Hashtable)GridResp.Value;
74 74
75 Hashtable griddatahash = GridRespData; 75 Hashtable griddatahash = GridRespData;
76 76
77 // Process Response 77 // Process Response
78 if (GridRespData.ContainsKey("error")) 78 if (GridRespData.ContainsKey("error"))
79 { 79 {
80 string errorstring = (string)GridRespData["error"]; 80 string errorstring = (string)GridRespData["error"];
81 MainLog.Instance.Error("Unable to connect to grid: " + errorstring); 81 MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
82 return null; 82 return null;
83 } 83 }
84 84
85 // Initialise the background listeners 85 // Initialise the background listeners
86 RegionCommsListener regListener = new RegionCommsListener(); 86 RegionCommsListener regListener = new RegionCommsListener();
87 if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) 87 if (!this.listeners.ContainsKey(regionInfo.RegionHandle))
88 { 88 {
89 this.listeners.Add(regionInfo.RegionHandle, regListener); 89 this.listeners.Add(regionInfo.RegionHandle, regListener);
90 } 90 }
91 else 91 else
92 { 92 {
93 listeners[regionInfo.RegionHandle] = regListener; 93 listeners[regionInfo.RegionHandle] = regListener;
94 } 94 }
95 95
96 return regListener; 96 return regListener;
97 } 97 }
98 98
99 /// <summary> 99 /// <summary>
100 /// 100 ///
101 /// </summary> 101 /// </summary>
102 /// <param name="regionInfo"></param> 102 /// <param name="regionInfo"></param>
103 /// <returns></returns> 103 /// <returns></returns>
104 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) 104 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
105 { 105 {
106 106
107 Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); 107 Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1);
108 108
109 List<RegionInfo> neighbours = new List<RegionInfo>(); 109 List<RegionInfo> neighbours = new List<RegionInfo>();
110 110
111 foreach (ArrayList a in respData.Values) 111 foreach (ArrayList a in respData.Values)
112 { 112 {
113 foreach (Hashtable n in a) 113 foreach (Hashtable n in a)
114 { 114 {
115 uint regX = Convert.ToUInt32(n["x"]); 115 uint regX = Convert.ToUInt32(n["x"]);
116 uint regY = Convert.ToUInt32(n["y"]); 116 uint regY = Convert.ToUInt32(n["y"]);
117 if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY)) 117 if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY))
118 { 118 {
119 string externalIpStr = (string)n["sim_ip"]; 119 string externalIpStr = (string)n["sim_ip"];
120 uint port = Convert.ToUInt32(n["sim_port"]); 120 uint port = Convert.ToUInt32(n["sim_port"]);
121 string externalUri = (string)n["sim_uri"]; 121 string externalUri = (string)n["sim_uri"];
122 122
123 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port); 123 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port);
124 string neighbourExternalUri = externalUri; 124 string neighbourExternalUri = externalUri;
125 RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr); 125 RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr);
126 126
127 //OGS1 127 //OGS1
128 //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally 128 //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally
129 129
130 neighbour.RegionName = (string)n["name"]; 130 neighbour.RegionName = (string)n["name"];
131 131
132 //OGS1+ 132 //OGS1+
133 neighbour.SimUUID = (string)n["uuid"]; 133 neighbour.SimUUID = (string)n["uuid"];
134 134
135 neighbours.Add(neighbour); 135 neighbours.Add(neighbour);
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 return neighbours; 140 return neighbours;
141 } 141 }
142 142
143 /// <summary> 143 /// <summary>
144 /// 144 ///
145 /// </summary> 145 /// </summary>
146 /// <param name="regionHandle"></param> 146 /// <param name="regionHandle"></param>
147 /// <returns></returns> 147 /// <returns></returns>
148 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 148 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
149 { 149 {
150 if (this.regions.ContainsKey(regionHandle)) 150 if (this.regions.ContainsKey(regionHandle))
151 { 151 {
152 return this.regions[regionHandle]; 152 return this.regions[regionHandle];
153 } 153 }
154 //TODO not a region in this instance so ask remote grid server 154 //TODO not a region in this instance so ask remote grid server
155 155
156 Hashtable requestData = new Hashtable(); 156 Hashtable requestData = new Hashtable();
157 requestData["region_handle"] = regionHandle.ToString(); 157 requestData["region_handle"] = regionHandle.ToString();
158 requestData["authkey"] = this.serversInfo.GridSendKey; 158 requestData["authkey"] = this.serversInfo.GridSendKey;
159 ArrayList SendParams = new ArrayList(); 159 ArrayList SendParams = new ArrayList();
160 SendParams.Add(requestData); 160 SendParams.Add(requestData);
161 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 161 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
162 XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); 162 XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000);
163 163
164 Hashtable responseData = (Hashtable)GridResp.Value; 164 Hashtable responseData = (Hashtable)GridResp.Value;
165 165
166 if (responseData.ContainsKey("error")) 166 if (responseData.ContainsKey("error"))
167 { 167 {
168 Console.WriteLine("error received from grid server" + responseData["error"]); 168 Console.WriteLine("error received from grid server" + responseData["error"]);
169 return null; 169 return null;
170 } 170 }
171 171
172 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 172 uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
173 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 173 uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
174 string internalIpStr = (string)responseData["sim_ip"]; 174 string internalIpStr = (string)responseData["sim_ip"];
175 uint port = Convert.ToUInt32(responseData["sim_port"]); 175 uint port = Convert.ToUInt32(responseData["sim_port"]);
176 string externalUri = (string)responseData["sim_uri"]; 176 string externalUri = (string)responseData["sim_uri"];
177 177
178 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); 178 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
179 string neighbourExternalUri = externalUri; 179 string neighbourExternalUri = externalUri;
180 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); 180 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
181 181
182 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 182 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
183 regionInfo.RemotingAddress = internalIpStr; 183 regionInfo.RemotingAddress = internalIpStr;
184 184
185 regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]); 185 regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]);
186 regionInfo.RegionName = (string)responseData["region_name"]; 186 regionInfo.RegionName = (string)responseData["region_name"];
187 187
188 return regionInfo; 188 return regionInfo;
189 } 189 }
190 190
191 /// <summary> 191 /// <summary>
192 /// 192 ///
193 /// </summary> 193 /// </summary>
194 /// <param name="minX"></param> 194 /// <param name="minX"></param>
195 /// <param name="minY"></param> 195 /// <param name="minY"></param>
196 /// <param name="maxX"></param> 196 /// <param name="maxX"></param>
197 /// <param name="maxY"></param> 197 /// <param name="maxY"></param>
198 /// <returns></returns> 198 /// <returns></returns>
199 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 199 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
200 { 200 {
201 Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY); 201 Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY);
202 202
203 List<MapBlockData> neighbours = new List<MapBlockData>(); 203 List<MapBlockData> neighbours = new List<MapBlockData>();
204 204
205 foreach (ArrayList a in respData.Values) 205 foreach (ArrayList a in respData.Values)
206 { 206 {
207 foreach (Hashtable n in a) 207 foreach (Hashtable n in a)
208 { 208 {
209 MapBlockData neighbour = new MapBlockData(); 209 MapBlockData neighbour = new MapBlockData();
210 210
211 neighbour.X = Convert.ToUInt16(n["x"]); 211 neighbour.X = Convert.ToUInt16(n["x"]);
212 neighbour.Y = Convert.ToUInt16(n["y"]); 212 neighbour.Y = Convert.ToUInt16(n["y"]);
213 213
214 neighbour.Name = (string)n["name"]; 214 neighbour.Name = (string)n["name"];
215 neighbour.Access = Convert.ToByte(n["access"]); 215 neighbour.Access = Convert.ToByte(n["access"]);
216 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); 216 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
217 neighbour.WaterHeight = Convert.ToByte(n["water-height"]); 217 neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
218 neighbour.MapImageId = new LLUUID((string)n["map-image-id"]); 218 neighbour.MapImageId = new LLUUID((string)n["map-image-id"]);
219 219
220 neighbours.Add(neighbour); 220 neighbours.Add(neighbour);
221 } 221 }
222 } 222 }
223 223
224 return neighbours; 224 return neighbours;
225 } 225 }
226 226
227 /// <summary> 227 /// <summary>
228 /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates 228 /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
229 /// </summary> 229 /// </summary>
230 /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks> 230 /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks>
231 /// <param name="minX">Minimum X value</param> 231 /// <param name="minX">Minimum X value</param>
232 /// <param name="minY">Minimum Y value</param> 232 /// <param name="minY">Minimum Y value</param>
233 /// <param name="maxX">Maximum X value</param> 233 /// <param name="maxX">Maximum X value</param>
234 /// <param name="maxY">Maximum Y value</param> 234 /// <param name="maxY">Maximum Y value</param>
235 /// <returns>Hashtable of hashtables containing map data elements</returns> 235 /// <returns>Hashtable of hashtables containing map data elements</returns>
236 private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) 236 private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
237 { 237 {
238 Hashtable param = new Hashtable(); 238 Hashtable param = new Hashtable();
239 param["xmin"] = minX; 239 param["xmin"] = minX;
240 param["ymin"] = minY; 240 param["ymin"] = minY;
241 param["xmax"] = maxX; 241 param["xmax"] = maxX;
242 param["ymax"] = maxY; 242 param["ymax"] = maxY;
243 IList parameters = new ArrayList(); 243 IList parameters = new ArrayList();
244 parameters.Add(param); 244 parameters.Add(param);
245 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); 245 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
246 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 3000); 246 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 3000);
247 Hashtable respData = (Hashtable)resp.Value; 247 Hashtable respData = (Hashtable)resp.Value;
248 return respData; 248 return respData;
249 } 249 }
250 250
251 // Grid Request Processing 251 // Grid Request Processing
252 /// <summary> 252 /// <summary>
253 /// 253 ///
254 /// </summary> 254 /// </summary>
255 /// <param name="request"></param> 255 /// <param name="request"></param>
256 /// <returns></returns> 256 /// <returns></returns>
257 public XmlRpcResponse ExpectUser(XmlRpcRequest request) 257 public XmlRpcResponse ExpectUser(XmlRpcRequest request)
258 { 258 {
259 Console.WriteLine("Expecting User..."); 259 Console.WriteLine("Expecting User...");
260 Hashtable requestData = (Hashtable)request.Params[0]; 260 Hashtable requestData = (Hashtable)request.Params[0];
261 AgentCircuitData agentData = new AgentCircuitData(); 261 AgentCircuitData agentData = new AgentCircuitData();
262 agentData.SessionID = new LLUUID((string)requestData["session_id"]); 262 agentData.SessionID = new LLUUID((string)requestData["session_id"]);
263 agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); 263 agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
264 agentData.firstname = (string)requestData["firstname"]; 264 agentData.firstname = (string)requestData["firstname"];
265 agentData.lastname = (string)requestData["lastname"]; 265 agentData.lastname = (string)requestData["lastname"];
266 agentData.AgentID = new LLUUID((string)requestData["agent_id"]); 266 agentData.AgentID = new LLUUID((string)requestData["agent_id"]);
267 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 267 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
268 agentData.CapsPath = (string)requestData["caps_path"]; 268 agentData.CapsPath = (string)requestData["caps_path"];
269 269
270 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 270 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
271 { 271 {
272 agentData.child = true; 272 agentData.child = true;
273 } 273 }
274 else 274 else
275 { 275 {
276 agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); 276 agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"]));
277 agentData.child = false; 277 agentData.child = false;
278 278
279 } 279 }
280 280
281 if (listeners.ContainsKey(Convert.ToUInt64((string)requestData["regionhandle"]))) 281 if (listeners.ContainsKey(Convert.ToUInt64((string)requestData["regionhandle"])))
282 { 282 {
283 this.listeners[Convert.ToUInt64((string)requestData["regionhandle"])].TriggerExpectUser(Convert.ToUInt64((string)requestData["regionhandle"]), agentData); 283 this.listeners[Convert.ToUInt64((string)requestData["regionhandle"])].TriggerExpectUser(Convert.ToUInt64((string)requestData["regionhandle"]), agentData);
284 } 284 }
285 else 285 else
286 { 286 {
287 MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); 287 MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString());
288 } 288 }
289 289
290 MainLog.Instance.Verbose("ExpectUser() - Welcoming new user..."); 290 MainLog.Instance.Verbose("ExpectUser() - Welcoming new user...");
291 291
292 return new XmlRpcResponse(); 292 return new XmlRpcResponse();
293 } 293 }
294 294
295 #region InterRegion Comms 295 #region InterRegion Comms
296 /// <summary> 296 /// <summary>
297 /// 297 ///
298 /// </summary> 298 /// </summary>
299 private void StartRemoting() 299 private void StartRemoting()
300 { 300 {
301 TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort); 301 TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort);
302 ChannelServices.RegisterChannel(ch, true); 302 ChannelServices.RegisterChannel(ch, true);
303 303
304 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); 304 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
305 RemotingConfiguration.RegisterWellKnownServiceType(wellType); 305 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
306 InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; 306 InterRegionSingleton.Instance.OnArrival += this.IncomingArrival;
307 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; 307 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
308 } 308 }
309 309
310 #region Methods called by regions in this instance 310 #region Methods called by regions in this instance
311 /// <summary> 311 /// <summary>
312 /// 312 ///
313 /// </summary> 313 /// </summary>
314 /// <param name="regionHandle"></param> 314 /// <param name="regionHandle"></param>
315 /// <param name="agentData"></param> 315 /// <param name="agentData"></param>
316 /// <returns></returns> 316 /// <returns></returns>
317 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 317 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
318 { 318 {
319 if (this.listeners.ContainsKey(regionHandle)) 319 if (this.listeners.ContainsKey(regionHandle))
320 { 320 {
321 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); 321 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
322 return true; 322 return true;
323 } 323 }
324 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 324 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
325 if (regInfo != null) 325 if (regInfo != null)
326 { 326 {
327 //don't want to be creating a new link to the remote instance every time like we are here 327 //don't want to be creating a new link to the remote instance every time like we are here
328 bool retValue = false; 328 bool retValue = false;
329 329
330 330
331 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 331 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
332 typeof(OGS1InterRegionRemoting), 332 typeof(OGS1InterRegionRemoting),
333 "tcp://"+ regInfo.RemotingAddress+":"+regInfo.RemotingPort+"/InterRegions"); 333 "tcp://"+ regInfo.RemotingAddress+":"+regInfo.RemotingPort+"/InterRegions");
334 if (remObject != null) 334 if (remObject != null)
335 { 335 {
336 336
337 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); 337 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
338 } 338 }
339 else 339 else
340 { 340 {
341 Console.WriteLine("remoting object not found"); 341 Console.WriteLine("remoting object not found");
342 } 342 }
343 remObject = null; 343 remObject = null;
344 344
345 345
346 return retValue; 346 return retValue;
347 } 347 }
348 348
349 return false; 349 return false;
350 } 350 }
351 351
352 /// <summary> 352 /// <summary>
353 /// 353 ///
354 /// </summary> 354 /// </summary>
355 /// <param name="regionHandle"></param> 355 /// <param name="regionHandle"></param>
356 /// <param name="agentID"></param> 356 /// <param name="agentID"></param>
357 /// <param name="position"></param> 357 /// <param name="position"></param>
358 /// <returns></returns> 358 /// <returns></returns>
359 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 359 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
360 { 360 {
361 if (this.listeners.ContainsKey(regionHandle)) 361 if (this.listeners.ContainsKey(regionHandle))
362 { 362 {
363 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); 363 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
364 return true; 364 return true;
365 } 365 }
366 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 366 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
367 if (regInfo != null) 367 if (regInfo != null)
368 { 368 {
369 bool retValue = false; 369 bool retValue = false;
370 370
371 371
372 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 372 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
373 typeof(OGS1InterRegionRemoting), 373 typeof(OGS1InterRegionRemoting),
374 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 374 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions");
375 if (remObject != null) 375 if (remObject != null)
376 { 376 {
377 377
378 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position); 378 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position);
379 } 379 }
380 else 380 else
381 { 381 {
382 Console.WriteLine("remoting object not found"); 382 Console.WriteLine("remoting object not found");
383 } 383 }
384 remObject = null; 384 remObject = null;
385 385
386 386
387 return retValue; 387 return retValue;
388 } 388 }
389 //TODO need to see if we know about where this region is and use .net remoting 389 //TODO need to see if we know about where this region is and use .net remoting
390 // to inform it. 390 // to inform it.
391 return false; 391 return false;
392 } 392 }
393 #endregion 393 #endregion
394 394
395 #region Methods triggered by calls from external instances 395 #region Methods triggered by calls from external instances
396 /// <summary> 396 /// <summary>
397 /// 397 ///
398 /// </summary> 398 /// </summary>
399 /// <param name="regionHandle"></param> 399 /// <param name="regionHandle"></param>
400 /// <param name="agentData"></param> 400 /// <param name="agentData"></param>
401 /// <returns></returns> 401 /// <returns></returns>
402 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) 402 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
403 { 403 {
404 if (this.listeners.ContainsKey(regionHandle)) 404 if (this.listeners.ContainsKey(regionHandle))
405 { 405 {
406 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); 406 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
407 return true; 407 return true;
408 } 408 }
409 return false; 409 return false;
410 } 410 }
411 411
412 /// <summary> 412 /// <summary>
413 /// 413 ///
414 /// </summary> 414 /// </summary>
415 /// <param name="regionHandle"></param> 415 /// <param name="regionHandle"></param>
416 /// <param name="agentID"></param> 416 /// <param name="agentID"></param>
417 /// <param name="position"></param> 417 /// <param name="position"></param>
418 /// <returns></returns> 418 /// <returns></returns>
419 public bool IncomingArrival(ulong regionHandle, LLUUID agentID, LLVector3 position) 419 public bool IncomingArrival(ulong regionHandle, LLUUID agentID, LLVector3 position)
420 { 420 {
421 if (this.listeners.ContainsKey(regionHandle)) 421 if (this.listeners.ContainsKey(regionHandle))
422 { 422 {
423 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); 423 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
424 return true; 424 return true;
425 } 425 }
426 return false; 426 return false;
427 } 427 }
428 #endregion 428 #endregion
429 #endregion 429 #endregion
430 } 430 }
431} 431}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index f514a29..520c593 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -1,69 +1,69 @@
1using System; 1using System;
2using libsecondlife; 2using libsecondlife;
3using OpenSim.Framework.Types; 3using OpenSim.Framework.Types;
4 4
5namespace OpenSim.Region.Communications.OGS1 5namespace OpenSim.Region.Communications.OGS1
6{ 6{
7 public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); 7 public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
8 public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position); 8 public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position);
9 9
10 public sealed class InterRegionSingleton 10 public sealed class InterRegionSingleton
11 { 11 {
12 static readonly InterRegionSingleton instance = new InterRegionSingleton(); 12 static readonly InterRegionSingleton instance = new InterRegionSingleton();
13 13
14 public event InformRegionChild OnChildAgent; 14 public event InformRegionChild OnChildAgent;
15 public event ExpectArrival OnArrival; 15 public event ExpectArrival OnArrival;
16 16
17 static InterRegionSingleton() 17 static InterRegionSingleton()
18 { 18 {
19 } 19 }
20 20
21 InterRegionSingleton() 21 InterRegionSingleton()
22 { 22 {
23 } 23 }
24 24
25 public static InterRegionSingleton Instance 25 public static InterRegionSingleton Instance
26 { 26 {
27 get 27 get
28 { 28 {
29 return instance; 29 return instance;
30 } 30 }
31 } 31 }
32 32
33 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 33 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
34 { 34 {
35 if (OnChildAgent != null) 35 if (OnChildAgent != null)
36 { 36 {
37 return OnChildAgent(regionHandle, agentData); 37 return OnChildAgent(regionHandle, agentData);
38 } 38 }
39 return false; 39 return false;
40 } 40 }
41 41
42 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 42 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
43 { 43 {
44 if (OnArrival != null) 44 if (OnArrival != null)
45 { 45 {
46 return OnArrival(regionHandle, agentID, position); 46 return OnArrival(regionHandle, agentID, position);
47 } 47 }
48 return false; 48 return false;
49 } 49 }
50 } 50 }
51 51
52 public class OGS1InterRegionRemoting : MarshalByRefObject 52 public class OGS1InterRegionRemoting : MarshalByRefObject
53 { 53 {
54 54
55 public OGS1InterRegionRemoting() 55 public OGS1InterRegionRemoting()
56 { 56 {
57 } 57 }
58 58
59 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 59 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
60 { 60 {
61 return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); 61 return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData);
62 } 62 }
63 63
64 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 64 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
65 { 65 {
66 return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); 66 return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position);
67 } 67 }
68 } 68 }
69} 69}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 46d71c4..0847148 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -1,101 +1,101 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using libsecondlife; 3using libsecondlife;
4using Nwc.XmlRpc; 4using Nwc.XmlRpc;
5using OpenSim.Framework.Communications; 5using OpenSim.Framework.Communications;
6using OpenSim.Framework.Data; 6using OpenSim.Framework.Data;
7 7
8namespace OpenSim.Region.Communications.OGS1 8namespace OpenSim.Region.Communications.OGS1
9{ 9{
10 public class OGS1UserServices :IUserServices 10 public class OGS1UserServices :IUserServices
11 { 11 {
12 CommunicationsOGS1 m_parent; 12 CommunicationsOGS1 m_parent;
13 public OGS1UserServices(CommunicationsOGS1 parent) 13 public OGS1UserServices(CommunicationsOGS1 parent)
14 { 14 {
15 m_parent = parent; 15 m_parent = parent;
16 } 16 }
17 17
18 public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) 18 public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
19 { 19 {
20 if (data.Contains("error_type")) 20 if (data.Contains("error_type"))
21 { 21 {
22 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); 22 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]);
23 return null; 23 return null;
24 } 24 }
25 25
26 UserProfileData userData = new UserProfileData(); 26 UserProfileData userData = new UserProfileData();
27 userData.username = (string)data["firstname"]; 27 userData.username = (string)data["firstname"];
28 userData.surname = (string)data["lastname"]; 28 userData.surname = (string)data["lastname"];
29 userData.UUID = new LLUUID((string)data["uuid"]); 29 userData.UUID = new LLUUID((string)data["uuid"]);
30 userData.userInventoryURI = (string)data["server_inventory"]; 30 userData.userInventoryURI = (string)data["server_inventory"];
31 userData.userAssetURI = (string)data["server_asset"]; 31 userData.userAssetURI = (string)data["server_asset"];
32 userData.profileFirstText = (string)data["profile_firstlife_about"]; 32 userData.profileFirstText = (string)data["profile_firstlife_about"];
33 userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); 33 userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]);
34 userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); 34 userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]);
35 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); 35 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]);
36 userData.profileImage = new LLUUID((string)data["profile_image"]); 36 userData.profileImage = new LLUUID((string)data["profile_image"]);
37 userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); 37 userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]);
38 userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); 38 userData.homeRegion = Convert.ToUInt64((string)data["home_region"]);
39 userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"])); 39 userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"]));
40 userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"])); 40 userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"]));
41 41
42 return userData; 42 return userData;
43 } 43 }
44 public UserProfileData GetUserProfile(string firstName, string lastName) 44 public UserProfileData GetUserProfile(string firstName, string lastName)
45 { 45 {
46 return GetUserProfile(firstName + " " + lastName); 46 return GetUserProfile(firstName + " " + lastName);
47 } 47 }
48 public UserProfileData GetUserProfile(string name) 48 public UserProfileData GetUserProfile(string name)
49 { 49 {
50 //try 50 //try
51 //{ 51 //{
52 Hashtable param = new Hashtable(); 52 Hashtable param = new Hashtable();
53 param["avatar_name"] = name; 53 param["avatar_name"] = name;
54 IList parameters = new ArrayList(); 54 IList parameters = new ArrayList();
55 parameters.Add(param); 55 parameters.Add(param);
56 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); 56 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
57 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); 57 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000);
58 Hashtable respData = (Hashtable)resp.Value; 58 Hashtable respData = (Hashtable)resp.Value;
59 59
60 return ConvertXMLRPCDataToUserProfile(respData); 60 return ConvertXMLRPCDataToUserProfile(respData);
61 //} 61 //}
62 //catch (Exception e) 62 //catch (Exception e)
63 //{ 63 //{
64 // Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message); 64 // Console.WriteLine("Error when trying to fetch profile data by name from remote user server: " + e.Message);
65 //} 65 //}
66 //return null; 66 //return null;
67 } 67 }
68 public UserProfileData GetUserProfile(LLUUID avatarID) 68 public UserProfileData GetUserProfile(LLUUID avatarID)
69 { 69 {
70 try 70 try
71 { 71 {
72 72
73 Hashtable param = new Hashtable(); 73 Hashtable param = new Hashtable();
74 param["avatar_uuid"] = avatarID.ToString(); 74 param["avatar_uuid"] = avatarID.ToString();
75 IList parameters = new ArrayList(); 75 IList parameters = new ArrayList();
76 parameters.Add(param); 76 parameters.Add(param);
77 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); 77 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
78 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000); 78 XmlRpcResponse resp = req.Send(m_parent.ServersInfo.UserURL, 3000);
79 Hashtable respData = (Hashtable)resp.Value; 79 Hashtable respData = (Hashtable)resp.Value;
80 80
81 return ConvertXMLRPCDataToUserProfile(respData); 81 return ConvertXMLRPCDataToUserProfile(respData);
82 } 82 }
83 catch (Exception e) 83 catch (Exception e)
84 { 84 {
85 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); 85 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message);
86 } 86 }
87 return null; 87 return null;
88 } 88 }
89 89
90 public UserProfileData SetupMasterUser(string firstName, string lastName) 90 public UserProfileData SetupMasterUser(string firstName, string lastName)
91 { 91 {
92 return SetupMasterUser(firstName, lastName, ""); 92 return SetupMasterUser(firstName, lastName, "");
93 } 93 }
94 94
95 public UserProfileData SetupMasterUser(string firstName, string lastName, string password) 95 public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
96 { 96 {
97 UserProfileData profile = GetUserProfile(firstName, lastName); 97 UserProfileData profile = GetUserProfile(firstName, lastName);
98 return profile; 98 return profile;
99 } 99 }
100 } 100 }
101} 101}
diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs
index 41f811a..2bebf9f 100644
--- a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] 6[assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("")] 9[assembly: AssemblyCompany("")]
10[assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] 10[assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 11[assembly: AssemblyCopyright("Copyright © 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] 21[assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30// You can specify all the values or you can default the Revision and Build Numbers 30// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 31// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index de0b040..3742486 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -1,299 +1,299 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
37using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; 37using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
38 38
39 39
40namespace OpenSim.Region.Environment 40namespace OpenSim.Region.Environment
41{ 41{
42 42
43 /// <summary> 43 /// <summary>
44 /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings 44 /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
45 /// </summary> 45 /// </summary>
46 public class EstateManager 46 public class EstateManager
47 { 47 {
48 private Scene m_world; 48 private Scene m_world;
49 private RegionInfo m_regInfo; 49 private RegionInfo m_regInfo;
50 50
51 public EstateManager(Scene world,RegionInfo reginfo) 51 public EstateManager(Scene world,RegionInfo reginfo)
52 { 52 {
53 m_world = world; //Estate settings found at world.m_regInfo.estateSettings 53 m_world = world; //Estate settings found at world.m_regInfo.estateSettings
54 m_regInfo = reginfo; 54 m_regInfo = reginfo;
55 } 55 }
56 56
57 private bool convertParamStringToBool(byte[] field) 57 private bool convertParamStringToBool(byte[] field)
58 { 58 {
59 string s = Helpers.FieldToUTF8String(field); 59 string s = Helpers.FieldToUTF8String(field);
60 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") 60 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true")
61 { 61 {
62 return true; 62 return true;
63 } 63 }
64 return false; 64 return false;
65 } 65 }
66 66
67 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) 67 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
68 { 68 {
69 if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID) 69 if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID)
70 { 70 {
71 switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) 71 switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
72 { 72 {
73 case "getinfo": 73 case "getinfo":
74 this.sendRegionInfoPacketToAll(); 74 this.sendRegionInfoPacketToAll();
75 75
76 break; 76 break;
77 case "setregioninfo": 77 case "setregioninfo":
78 if (packet.ParamList.Length != 9) 78 if (packet.ParamList.Length != 9)
79 { 79 {
80 MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length"); 80 MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
81 } 81 }
82 else 82 else
83 { 83 {
84 m_regInfo.estateSettings.regionFlags = Simulator.RegionFlags.None; 84 m_regInfo.estateSettings.regionFlags = Simulator.RegionFlags.None;
85 85
86 if (convertParamStringToBool(packet.ParamList[0].Parameter)) 86 if (convertParamStringToBool(packet.ParamList[0].Parameter))
87 { 87 {
88 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform; 88 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform;
89 } 89 }
90 90
91 if (convertParamStringToBool(packet.ParamList[1].Parameter)) 91 if (convertParamStringToBool(packet.ParamList[1].Parameter))
92 { 92 {
93 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly; 93 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly;
94 } 94 }
95 95
96 if (convertParamStringToBool(packet.ParamList[2].Parameter)) 96 if (convertParamStringToBool(packet.ParamList[2].Parameter))
97 { 97 {
98 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage; 98 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage;
99 } 99 }
100 100
101 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) 101 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
102 { 102 {
103 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell; 103 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell;
104 } 104 }
105 105
106 106
107 int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); 107 int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
108 m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; 108 m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
109 109
110 float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 110 float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
111 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; 111 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
112 112
113 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); 113 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
114 m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; 114 m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel;
115 115
116 116
117 if (convertParamStringToBool(packet.ParamList[7].Parameter)) 117 if (convertParamStringToBool(packet.ParamList[7].Parameter))
118 { 118 {
119 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject; 119 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject;
120 } 120 }
121 121
122 if (convertParamStringToBool(packet.ParamList[8].Parameter)) 122 if (convertParamStringToBool(packet.ParamList[8].Parameter))
123 { 123 {
124 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges; 124 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges;
125 } 125 }
126 126
127 sendRegionInfoPacketToAll(); 127 sendRegionInfoPacketToAll();
128 128
129 } 129 }
130 break; 130 break;
131 case "texturebase": 131 case "texturebase":
132 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 132 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
133 { 133 {
134 string s = Helpers.FieldToUTF8String(block.Parameter); 134 string s = Helpers.FieldToUTF8String(block.Parameter);
135 string[] splitField = s.Split(' '); 135 string[] splitField = s.Split(' ');
136 if (splitField.Length == 2) 136 if (splitField.Length == 2)
137 { 137 {
138 LLUUID tempUUID = new LLUUID(splitField[1]); 138 LLUUID tempUUID = new LLUUID(splitField[1]);
139 switch (Convert.ToInt16(splitField[0])) 139 switch (Convert.ToInt16(splitField[0]))
140 { 140 {
141 case 0: 141 case 0:
142 m_regInfo.estateSettings.terrainBase0 = tempUUID; 142 m_regInfo.estateSettings.terrainBase0 = tempUUID;
143 break; 143 break;
144 case 1: 144 case 1:
145 m_regInfo.estateSettings.terrainBase1 = tempUUID; 145 m_regInfo.estateSettings.terrainBase1 = tempUUID;
146 break; 146 break;
147 case 2: 147 case 2:
148 m_regInfo.estateSettings.terrainBase2 = tempUUID; 148 m_regInfo.estateSettings.terrainBase2 = tempUUID;
149 break; 149 break;
150 case 3: 150 case 3:
151 m_regInfo.estateSettings.terrainBase3 = tempUUID; 151 m_regInfo.estateSettings.terrainBase3 = tempUUID;
152 break; 152 break;
153 } 153 }
154 } 154 }
155 } 155 }
156 break; 156 break;
157 case "texturedetail": 157 case "texturedetail":
158 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 158 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
159 { 159 {
160 160
161 string s = Helpers.FieldToUTF8String(block.Parameter); 161 string s = Helpers.FieldToUTF8String(block.Parameter);
162 string[] splitField = s.Split(' '); 162 string[] splitField = s.Split(' ');
163 if (splitField.Length == 2) 163 if (splitField.Length == 2)
164 { 164 {
165 LLUUID tempUUID = new LLUUID(splitField[1]); 165 LLUUID tempUUID = new LLUUID(splitField[1]);
166 switch (Convert.ToInt16(splitField[0])) 166 switch (Convert.ToInt16(splitField[0]))
167 { 167 {
168 case 0: 168 case 0:
169 m_regInfo.estateSettings.terrainDetail0 = tempUUID; 169 m_regInfo.estateSettings.terrainDetail0 = tempUUID;
170 break; 170 break;
171 case 1: 171 case 1:
172 m_regInfo.estateSettings.terrainDetail1 = tempUUID; 172 m_regInfo.estateSettings.terrainDetail1 = tempUUID;
173 break; 173 break;
174 case 2: 174 case 2:
175 m_regInfo.estateSettings.terrainDetail2 = tempUUID; 175 m_regInfo.estateSettings.terrainDetail2 = tempUUID;
176 break; 176 break;
177 case 3: 177 case 3:
178 m_regInfo.estateSettings.terrainDetail3 = tempUUID; 178 m_regInfo.estateSettings.terrainDetail3 = tempUUID;
179 break; 179 break;
180 } 180 }
181 } 181 }
182 } 182 }
183 break; 183 break;
184 case "textureheights": 184 case "textureheights":
185 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 185 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
186 { 186 {
187 187
188 string s = Helpers.FieldToUTF8String(block.Parameter); 188 string s = Helpers.FieldToUTF8String(block.Parameter);
189 string[] splitField = s.Split(' '); 189 string[] splitField = s.Split(' ');
190 if (splitField.Length == 3) 190 if (splitField.Length == 3)
191 { 191 {
192 192
193 float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); 193 float tempHeightLow = (float)Convert.ToDecimal(splitField[1]);
194 float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); 194 float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]);
195 195
196 switch (Convert.ToInt16(splitField[0])) 196 switch (Convert.ToInt16(splitField[0]))
197 { 197 {
198 case 0: 198 case 0:
199 m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; 199 m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow;
200 m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; 200 m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh;
201 break; 201 break;
202 case 1: 202 case 1:
203 m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; 203 m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow;
204 m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; 204 m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh;
205 break; 205 break;
206 case 2: 206 case 2:
207 m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; 207 m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow;
208 m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; 208 m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh;
209 break; 209 break;
210 case 3: 210 case 3:
211 m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; 211 m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow;
212 m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; 212 m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh;
213 break; 213 break;
214 } 214 }
215 } 215 }
216 } 216 }
217 break; 217 break;
218 case "texturecommit": 218 case "texturecommit":
219 sendRegionHandshakeToAll(); 219 sendRegionHandshakeToAll();
220 break; 220 break;
221 case "setregionterrain": 221 case "setregionterrain":
222 if (packet.ParamList.Length != 9) 222 if (packet.ParamList.Length != 9)
223 { 223 {
224 MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); 224 MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
225 } 225 }
226 else 226 else
227 { 227 {
228 m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); 228 m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
229 m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); 229 m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
230 m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); 230 m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
231 m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); 231 m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
232 m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 232 m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
233 233
234 sendRegionInfoPacketToAll(); 234 sendRegionInfoPacketToAll();
235 } 235 }
236 break; 236 break;
237 default: 237 default:
238 MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); 238 MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
239 break; 239 break;
240 } 240 }
241 } 241 }
242 } 242 }
243 243
244 public void sendRegionInfoPacketToAll() 244 public void sendRegionInfoPacketToAll()
245 { 245 {
246 List<Avatar> avatars = m_world.RequestAvatarList(); 246 List<Avatar> avatars = m_world.RequestAvatarList();
247 247
248 for (int i = 0; i < avatars.Count; i++) 248 for (int i = 0; i < avatars.Count; i++)
249 { 249 {
250 this.sendRegionInfoPacket(avatars[i].ControllingClient); 250 this.sendRegionInfoPacket(avatars[i].ControllingClient);
251 } 251 }
252 } 252 }
253 253
254 public void sendRegionHandshakeToAll() 254 public void sendRegionHandshakeToAll()
255 { 255 {
256 List<Avatar> avatars = m_world.RequestAvatarList(); 256 List<Avatar> avatars = m_world.RequestAvatarList();
257 257
258 for (int i = 0; i < avatars.Count; i++) 258 for (int i = 0; i < avatars.Count; i++)
259 { 259 {
260 this.sendRegionHandshake(avatars[i].ControllingClient); 260 this.sendRegionHandshake(avatars[i].ControllingClient);
261 } 261 }
262 } 262 }
263 263
264 public void sendRegionInfoPacket(IClientAPI remote_client) 264 public void sendRegionInfoPacket(IClientAPI remote_client)
265 { 265 {
266 Encoding _enc = Encoding.ASCII; 266 Encoding _enc = Encoding.ASCII;
267 267
268 AgentCircuitData circuitData = remote_client.RequestClientInfo(); 268 AgentCircuitData circuitData = remote_client.RequestClientInfo();
269 269
270 RegionInfoPacket regionInfoPacket = new RegionInfoPacket(); 270 RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
271 regionInfoPacket.AgentData.AgentID = circuitData.AgentID; 271 regionInfoPacket.AgentData.AgentID = circuitData.AgentID;
272 regionInfoPacket.AgentData.SessionID = circuitData.SessionID; 272 regionInfoPacket.AgentData.SessionID = circuitData.SessionID;
273 regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor; 273 regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor;
274 regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID; 274 regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID;
275 regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents; 275 regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents;
276 regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor; 276 regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor;
277 regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID; 277 regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID;
278 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; 278 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
279 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; 279 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
280 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; 280 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
281 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; 281 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
282 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; 282 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
283 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName); 283 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName);
284 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; 284 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
285 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; 285 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
286 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; 286 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
287 regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun; 287 regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun;
288 regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight; 288 regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight;
289 289
290 remote_client.OutPacket(regionInfoPacket); 290 remote_client.OutPacket(regionInfoPacket);
291 } 291 }
292 292
293 public void sendRegionHandshake(IClientAPI remoteClient) 293 public void sendRegionHandshake(IClientAPI remoteClient)
294 { 294 {
295 remoteClient.SendRegionHandshake(m_regInfo); 295 remoteClient.SendRegionHandshake(m_regInfo);
296 } 296 }
297 297
298 } 298 }
299} 299}
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
index c068866..6ee57a5 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
@@ -1,63 +1,63 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30 30
31using OpenSim.Framework.Types; 31using OpenSim.Framework.Types;
32using OpenSim.Region; 32using OpenSim.Region;
33using OpenSim.Region.Environment; 33using OpenSim.Region.Environment;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35 35
36using System.Collections.Generic; 36using System.Collections.Generic;
37 37
38namespace OpenSim.Region.Interfaces 38namespace OpenSim.Region.Interfaces
39{ 39{
40 public interface IRegionDataStore 40 public interface IRegionDataStore
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// Initialises the data storage engine 43 /// Initialises the data storage engine
44 /// </summary> 44 /// </summary>
45 /// <param name="filename">The file to save the database to (may not be applicable)</param> 45 /// <param name="filename">The file to save the database to (may not be applicable)</param>
46 /// <param name="dbname">The name of the database to store to (may not be applicable)</param> 46 /// <param name="dbname">The name of the database to store to (may not be applicable)</param>
47 void Initialise(string filename, string dbname); 47 void Initialise(string filename, string dbname);
48 48
49 void StoreObject(SceneObject obj); 49 void StoreObject(SceneObject obj);
50 void RemoveObject(LLUUID uuid); 50 void RemoveObject(LLUUID uuid);
51 51
52 List<SceneObject> LoadObjects(); 52 List<SceneObject> LoadObjects();
53 53
54 void StoreTerrain(double[,] terrain); 54 void StoreTerrain(double[,] terrain);
55 double[,] LoadTerrain(); 55 double[,] LoadTerrain();
56 56
57 void StoreParcel(OpenSim.Region.Environment.Parcel Parcel); 57 void StoreParcel(OpenSim.Region.Environment.Parcel Parcel);
58 void RemoveParcel(uint ID); 58 void RemoveParcel(uint ID);
59 List<OpenSim.Region.Environment.Parcel> LoadParcels(); 59 List<OpenSim.Region.Environment.Parcel> LoadParcels();
60 60
61 void Shutdown(); 61 void Shutdown();
62 } 62 }
63} \ No newline at end of file 63} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs
index 31b9b1d..fbff556 100644
--- a/OpenSim/Region/Environment/ParcelManager.cs
+++ b/OpenSim/Region/Environment/ParcelManager.cs
@@ -1,1206 +1,1206 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; 35using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
36using System.IO; 36using System.IO;
37 37
38namespace OpenSim.Region.Environment 38namespace OpenSim.Region.Environment
39{ 39{
40 40
41 41
42 #region ParcelManager Class 42 #region ParcelManager Class
43 /// <summary> 43 /// <summary>
44 /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc) 44 /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc)
45 /// </summary> 45 /// </summary>
46 public class ParcelManager : ILocalStorageParcelReceiver 46 public class ParcelManager : ILocalStorageParcelReceiver
47 { 47 {
48 48
49 #region Constants 49 #region Constants
50 //Parcel types set with flags in ParcelOverlay. 50 //Parcel types set with flags in ParcelOverlay.
51 //Only one of these can be used. 51 //Only one of these can be used.
52 public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 52 public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000
53 public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 53 public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001
54 public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 54 public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010
55 public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 55 public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011
56 public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 56 public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100
57 public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 57 public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101
58 58
59 59
60 //Flags that when set, a border on the given side will be placed 60 //Flags that when set, a border on the given side will be placed
61 //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) 61 //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc)
62 //This took forever to figure out -- jeesh. /blame LL for even having to send these 62 //This took forever to figure out -- jeesh. /blame LL for even having to send these
63 public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 63 public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
64 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 64 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
65 65
66 //RequestResults (I think these are right, they seem to work): 66 //RequestResults (I think these are right, they seem to work):
67 public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel 67 public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
68 public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel 68 public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel
69 69
70 //ParcelSelectObjects 70 //ParcelSelectObjects
71 public const int PARCEL_SELECT_OBJECTS_OWNER = 2; 71 public const int PARCEL_SELECT_OBJECTS_OWNER = 2;
72 public const int PARCEL_SELECT_OBJECTS_GROUP = 4; 72 public const int PARCEL_SELECT_OBJECTS_GROUP = 4;
73 public const int PARCEL_SELECT_OBJECTS_OTHER = 8; 73 public const int PARCEL_SELECT_OBJECTS_OTHER = 8;
74 74
75 75
76 //These are other constants. Yay! 76 //These are other constants. Yay!
77 public const int START_PARCEL_LOCAL_ID = 1; 77 public const int START_PARCEL_LOCAL_ID = 1;
78 #endregion 78 #endregion
79 79
80 #region Member Variables 80 #region Member Variables
81 public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>(); 81 public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>();
82 private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; 82 private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
83 private int[,] parcelIDList = new int[64, 64]; 83 private int[,] parcelIDList = new int[64, 64];
84 84
85 /// <summary> 85 /// <summary>
86 /// Set to true when a prim is moved, created, added. Performs a prim count update 86 /// Set to true when a prim is moved, created, added. Performs a prim count update
87 /// </summary> 87 /// </summary>
88 public bool parcelPrimCountTainted = false; 88 public bool parcelPrimCountTainted = false;
89 89
90 private Scene m_world; 90 private Scene m_world;
91 private RegionInfo m_regInfo; 91 private RegionInfo m_regInfo;
92 92
93 #endregion 93 #endregion
94 94
95 #region Constructors 95 #region Constructors
96 public ParcelManager(Scene world, RegionInfo reginfo) 96 public ParcelManager(Scene world, RegionInfo reginfo)
97 { 97 {
98 98
99 m_world = world; 99 m_world = world;
100 m_regInfo = reginfo; 100 m_regInfo = reginfo;
101 parcelIDList.Initialize(); 101 parcelIDList.Initialize();
102 102
103 } 103 }
104 #endregion 104 #endregion
105 105
106 #region Member Functions 106 #region Member Functions
107 107
108 #region Parcel From Storage Functions 108 #region Parcel From Storage Functions
109 public void ParcelFromStorage(ParcelData data) 109 public void ParcelFromStorage(ParcelData data)
110 { 110 {
111 Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); 111 Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world);
112 new_parcel.parcelData = data.Copy(); 112 new_parcel.parcelData = data.Copy();
113 new_parcel.setParcelBitmapFromByteArray(); 113 new_parcel.setParcelBitmapFromByteArray();
114 addParcel(new_parcel); 114 addParcel(new_parcel);
115 115
116 } 116 }
117 117
118 public void NoParcelDataFromStorage() 118 public void NoParcelDataFromStorage()
119 { 119 {
120 resetSimParcels(); 120 resetSimParcels();
121 } 121 }
122 #endregion 122 #endregion
123 123
124 #region Parcel Add/Remove/Get/Create 124 #region Parcel Add/Remove/Get/Create
125 /// <summary> 125 /// <summary>
126 /// Creates a basic Parcel object without an owner (a zeroed key) 126 /// Creates a basic Parcel object without an owner (a zeroed key)
127 /// </summary> 127 /// </summary>
128 /// <returns></returns> 128 /// <returns></returns>
129 public Parcel createBaseParcel() 129 public Parcel createBaseParcel()
130 { 130 {
131 return new Parcel(new LLUUID(), false, m_world); 131 return new Parcel(new LLUUID(), false, m_world);
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own 135 /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own
136 /// </summary> 136 /// </summary>
137 /// <param name="new_parcel">The parcel being added</param> 137 /// <param name="new_parcel">The parcel being added</param>
138 public Parcel addParcel(Parcel new_parcel) 138 public Parcel addParcel(Parcel new_parcel)
139 { 139 {
140 lastParcelLocalID++; 140 lastParcelLocalID++;
141 new_parcel.parcelData.localID = lastParcelLocalID; 141 new_parcel.parcelData.localID = lastParcelLocalID;
142 parcelList.Add(lastParcelLocalID, new_parcel.Copy()); 142 parcelList.Add(lastParcelLocalID, new_parcel.Copy());
143 143
144 144
145 bool[,] parcelBitmap = new_parcel.getParcelBitmap(); 145 bool[,] parcelBitmap = new_parcel.getParcelBitmap();
146 int x, y; 146 int x, y;
147 for (x = 0; x < 64; x++) 147 for (x = 0; x < 64; x++)
148 { 148 {
149 for (y = 0; y < 64; y++) 149 for (y = 0; y < 64; y++)
150 { 150 {
151 if (parcelBitmap[x, y]) 151 if (parcelBitmap[x, y])
152 { 152 {
153 parcelIDList[x, y] = lastParcelLocalID; 153 parcelIDList[x, y] = lastParcelLocalID;
154 } 154 }
155 } 155 }
156 } 156 }
157 parcelList[lastParcelLocalID].forceUpdateParcelInfo(); 157 parcelList[lastParcelLocalID].forceUpdateParcelInfo();
158 158
159 return new_parcel; 159 return new_parcel;
160 160
161 } 161 }
162 /// <summary> 162 /// <summary>
163 /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList 163 /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList
164 /// </summary> 164 /// </summary>
165 /// <param name="local_id">Parcel.localID of the parcel to remove.</param> 165 /// <param name="local_id">Parcel.localID of the parcel to remove.</param>
166 public void removeParcel(int local_id) 166 public void removeParcel(int local_id)
167 { 167 {
168 int x, y; 168 int x, y;
169 for (x = 0; x < 64; x++) 169 for (x = 0; x < 64; x++)
170 { 170 {
171 for (y = 0; y < 64; y++) 171 for (y = 0; y < 64; y++)
172 { 172 {
173 if (parcelIDList[x, y] == local_id) 173 if (parcelIDList[x, y] == local_id)
174 { 174 {
175 throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y); 175 throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y);
176 } 176 }
177 } 177 }
178 } 178 }
179 m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData); 179 m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData);
180 parcelList.Remove(local_id); 180 parcelList.Remove(local_id);
181 } 181 }
182 182
183 private void performFinalParcelJoin(Parcel master, Parcel slave) 183 private void performFinalParcelJoin(Parcel master, Parcel slave)
184 { 184 {
185 int x, y; 185 int x, y;
186 bool[,] parcelBitmapSlave = slave.getParcelBitmap(); 186 bool[,] parcelBitmapSlave = slave.getParcelBitmap();
187 for (x = 0; x < 64; x++) 187 for (x = 0; x < 64; x++)
188 { 188 {
189 for (y = 0; y < 64; y++) 189 for (y = 0; y < 64; y++)
190 { 190 {
191 if (parcelBitmapSlave[x, y]) 191 if (parcelBitmapSlave[x, y])
192 { 192 {
193 parcelIDList[x, y] = master.parcelData.localID; 193 parcelIDList[x, y] = master.parcelData.localID;
194 } 194 }
195 } 195 }
196 } 196 }
197 removeParcel(slave.parcelData.localID); 197 removeParcel(slave.parcelData.localID);
198 } 198 }
199 /// <summary> 199 /// <summary>
200 /// Get the parcel at the specified point 200 /// Get the parcel at the specified point
201 /// </summary> 201 /// </summary>
202 /// <param name="x">Value between 0 - 256 on the x axis of the point</param> 202 /// <param name="x">Value between 0 - 256 on the x axis of the point</param>
203 /// <param name="y">Value between 0 - 256 on the y axis of the point</param> 203 /// <param name="y">Value between 0 - 256 on the y axis of the point</param>
204 /// <returns>Parcel at the point supplied</returns> 204 /// <returns>Parcel at the point supplied</returns>
205 public Parcel getParcel(float x_float, float y_float) 205 public Parcel getParcel(float x_float, float y_float)
206 { 206 {
207 int x = Convert.ToInt32(Math.Floor(Convert.ToDecimal(x_float) / Convert.ToDecimal(4.0))); 207 int x = Convert.ToInt32(Math.Floor(Convert.ToDecimal(x_float) / Convert.ToDecimal(4.0)));
208 int y = Convert.ToInt32(Math.Floor(Convert.ToDecimal(y_float) / Convert.ToDecimal(4.0))); 208 int y = Convert.ToInt32(Math.Floor(Convert.ToDecimal(y_float) / Convert.ToDecimal(4.0)));
209 209
210 if (x > 63 || y > 63 || x < 0 || y < 0) 210 if (x > 63 || y > 63 || x < 0 || y < 0)
211 { 211 {
212 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 212 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
213 } 213 }
214 else 214 else
215 { 215 {
216 // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")"); 216 // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
217 return parcelList[parcelIDList[x, y]]; 217 return parcelList[parcelIDList[x, y]];
218 } 218 }
219 } 219 }
220 220
221 public Parcel getParcel(int x, int y) 221 public Parcel getParcel(int x, int y)
222 { 222 {
223 if (x > 256 || y > 256 || x < 0 || y < 0) 223 if (x > 256 || y > 256 || x < 0 || y < 0)
224 { 224 {
225 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 225 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
226 } 226 }
227 else 227 else
228 { 228 {
229 return parcelList[parcelIDList[x / 4, y / 4]]; 229 return parcelList[parcelIDList[x / 4, y / 4]];
230 } 230 }
231 } 231 }
232 #endregion 232 #endregion
233 233
234 #region Parcel Modification 234 #region Parcel Modification
235 /// <summary> 235 /// <summary>
236 /// Subdivides a parcel 236 /// Subdivides a parcel
237 /// </summary> 237 /// </summary>
238 /// <param name="start_x">West Point</param> 238 /// <param name="start_x">West Point</param>
239 /// <param name="start_y">South Point</param> 239 /// <param name="start_y">South Point</param>
240 /// <param name="end_x">East Point</param> 240 /// <param name="end_x">East Point</param>
241 /// <param name="end_y">North Point</param> 241 /// <param name="end_y">North Point</param>
242 /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param> 242 /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param>
243 /// <returns>Returns true if successful</returns> 243 /// <returns>Returns true if successful</returns>
244 private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) 244 private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
245 { 245 {
246 246
247 //First, lets loop through the points and make sure they are all in the same parcel 247 //First, lets loop through the points and make sure they are all in the same parcel
248 //Get the parcel at start 248 //Get the parcel at start
249 Parcel startParcel = getParcel(start_x, start_y); 249 Parcel startParcel = getParcel(start_x, start_y);
250 if (startParcel == null) return false; //No such parcel at the beginning 250 if (startParcel == null) return false; //No such parcel at the beginning
251 251
252 //Loop through the points 252 //Loop through the points
253 try 253 try
254 { 254 {
255 int totalX = end_x - start_x; 255 int totalX = end_x - start_x;
256 int totalY = end_y - start_y; 256 int totalY = end_y - start_y;
257 int x, y; 257 int x, y;
258 for (y = 0; y < totalY; y++) 258 for (y = 0; y < totalY; y++)
259 { 259 {
260 for (x = 0; x < totalX; x++) 260 for (x = 0; x < totalX; x++)
261 { 261 {
262 Parcel tempParcel = getParcel(start_x + x, start_y + y); 262 Parcel tempParcel = getParcel(start_x + x, start_y + y);
263 if (tempParcel == null) return false; //No such parcel at that point 263 if (tempParcel == null) return false; //No such parcel at that point
264 if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no 264 if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no
265 } 265 }
266 } 266 }
267 } 267 }
268 catch (Exception) 268 catch (Exception)
269 { 269 {
270 return false; //Exception. For now, lets skip subdivision 270 return false; //Exception. For now, lets skip subdivision
271 } 271 }
272 272
273 //If we are still here, then they are subdividing within one parcel 273 //If we are still here, then they are subdividing within one parcel
274 //Check owner 274 //Check owner
275 if (startParcel.parcelData.ownerID != attempting_user_id) 275 if (startParcel.parcelData.ownerID != attempting_user_id)
276 { 276 {
277 return false; //They cant do this! 277 return false; //They cant do this!
278 } 278 }
279 279
280 //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) 280 //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info)
281 Parcel newParcel = startParcel.Copy(); 281 Parcel newParcel = startParcel.Copy();
282 newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; 282 newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName;
283 newParcel.parcelData.globalID = LLUUID.Random(); 283 newParcel.parcelData.globalID = LLUUID.Random();
284 284
285 newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); 285 newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y));
286 286
287 //Now, lets set the subdivision area of the original to false 287 //Now, lets set the subdivision area of the original to false
288 int startParcelIndex = startParcel.parcelData.localID; 288 int startParcelIndex = startParcel.parcelData.localID;
289 parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); 289 parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false));
290 parcelList[startParcelIndex].forceUpdateParcelInfo(); 290 parcelList[startParcelIndex].forceUpdateParcelInfo();
291 291
292 292
293 this.setPrimsTainted(); 293 this.setPrimsTainted();
294 294
295 //Now add the new parcel 295 //Now add the new parcel
296 Parcel result = addParcel(newParcel); 296 Parcel result = addParcel(newParcel);
297 result.sendParcelUpdateToAvatarsOverMe(); 297 result.sendParcelUpdateToAvatarsOverMe();
298 298
299 299
300 300
301 301
302 return true; 302 return true;
303 } 303 }
304 /// <summary> 304 /// <summary>
305 /// Join 2 parcels together 305 /// Join 2 parcels together
306 /// </summary> 306 /// </summary>
307 /// <param name="start_x">x value in first parcel</param> 307 /// <param name="start_x">x value in first parcel</param>
308 /// <param name="start_y">y value in first parcel</param> 308 /// <param name="start_y">y value in first parcel</param>
309 /// <param name="end_x">x value in second parcel</param> 309 /// <param name="end_x">x value in second parcel</param>
310 /// <param name="end_y">y value in second parcel</param> 310 /// <param name="end_y">y value in second parcel</param>
311 /// <param name="attempting_user_id">LLUUID of the avatar trying to join the parcels</param> 311 /// <param name="attempting_user_id">LLUUID of the avatar trying to join the parcels</param>
312 /// <returns>Returns true if successful</returns> 312 /// <returns>Returns true if successful</returns>
313 private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) 313 private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
314 { 314 {
315 end_x -= 4; 315 end_x -= 4;
316 end_y -= 4; 316 end_y -= 4;
317 317
318 List<Parcel> selectedParcels = new List<Parcel>(); 318 List<Parcel> selectedParcels = new List<Parcel>();
319 int stepXSelected = 0; 319 int stepXSelected = 0;
320 int stepYSelected = 0; 320 int stepYSelected = 0;
321 for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4) 321 for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4)
322 { 322 {
323 for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) 323 for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
324 { 324 {
325 Parcel p = getParcel(stepXSelected,stepYSelected); 325 Parcel p = getParcel(stepXSelected,stepYSelected);
326 if (!selectedParcels.Contains(p)) 326 if (!selectedParcels.Contains(p))
327 { 327 {
328 selectedParcels.Add(p); 328 selectedParcels.Add(p);
329 } 329 }
330 } 330 }
331 } 331 }
332 Parcel masterParcel = selectedParcels[0]; 332 Parcel masterParcel = selectedParcels[0];
333 selectedParcels.RemoveAt(0); 333 selectedParcels.RemoveAt(0);
334 334
335 335
336 if (selectedParcels.Count < 1) 336 if (selectedParcels.Count < 1)
337 { 337 {
338 return false; //Only one parcel selected 338 return false; //Only one parcel selected
339 } 339 }
340 if (masterParcel.parcelData.ownerID != attempting_user_id) 340 if (masterParcel.parcelData.ownerID != attempting_user_id)
341 { 341 {
342 return false; //Not the same owner 342 return false; //Not the same owner
343 } 343 }
344 foreach (Parcel p in selectedParcels) 344 foreach (Parcel p in selectedParcels)
345 { 345 {
346 if (p.parcelData.ownerID != masterParcel.parcelData.ownerID) 346 if (p.parcelData.ownerID != masterParcel.parcelData.ownerID)
347 { 347 {
348 return false; //Over multiple users. TODO: make this just ignore this parcel? 348 return false; //Over multiple users. TODO: make this just ignore this parcel?
349 } 349 }
350 } 350 }
351 foreach (Parcel slaveParcel in selectedParcels) 351 foreach (Parcel slaveParcel in selectedParcels)
352 { 352 {
353 parcelList[masterParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(masterParcel.getParcelBitmap(), slaveParcel.getParcelBitmap())); 353 parcelList[masterParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(masterParcel.getParcelBitmap(), slaveParcel.getParcelBitmap()));
354 performFinalParcelJoin(masterParcel, slaveParcel); 354 performFinalParcelJoin(masterParcel, slaveParcel);
355 } 355 }
356 356
357 357
358 this.setPrimsTainted(); 358 this.setPrimsTainted();
359 359
360 masterParcel.sendParcelUpdateToAvatarsOverMe(); 360 masterParcel.sendParcelUpdateToAvatarsOverMe();
361 361
362 return true; 362 return true;
363 363
364 364
365 365
366 } 366 }
367 #endregion 367 #endregion
368 368
369 #region Parcel Updating 369 #region Parcel Updating
370 /// <summary> 370 /// <summary>
371 /// Where we send the ParcelOverlay packet to the client 371 /// Where we send the ParcelOverlay packet to the client
372 /// </summary> 372 /// </summary>
373 /// <param name="remote_client">The object representing the client</param> 373 /// <param name="remote_client">The object representing the client</param>
374 public void sendParcelOverlay(IClientAPI remote_client) 374 public void sendParcelOverlay(IClientAPI remote_client)
375 { 375 {
376 const int PARCEL_BLOCKS_PER_PACKET = 1024; 376 const int PARCEL_BLOCKS_PER_PACKET = 1024;
377 int x, y = 0; 377 int x, y = 0;
378 byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; 378 byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET];
379 int byteArrayCount = 0; 379 int byteArrayCount = 0;
380 int sequenceID = 0; 380 int sequenceID = 0;
381 ParcelOverlayPacket packet; 381 ParcelOverlayPacket packet;
382 382
383 for (y = 0; y < 64; y++) 383 for (y = 0; y < 64; y++)
384 { 384 {
385 for (x = 0; x < 64; x++) 385 for (x = 0; x < 64; x++)
386 { 386 {
387 byte tempByte = (byte)0; //This represents the byte for the current 4x4 387 byte tempByte = (byte)0; //This represents the byte for the current 4x4
388 Parcel currentParcelBlock = getParcel(x * 4, y * 4); 388 Parcel currentParcelBlock = getParcel(x * 4, y * 4);
389 389
390 if (currentParcelBlock.parcelData.ownerID == remote_client.AgentId) 390 if (currentParcelBlock.parcelData.ownerID == remote_client.AgentId)
391 { 391 {
392 //Owner Flag 392 //Owner Flag
393 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER); 393 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER);
394 } 394 }
395 else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentId)) 395 else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentId))
396 { 396 {
397 //Sale Flag 397 //Sale Flag
398 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE); 398 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE);
399 } 399 }
400 else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero) 400 else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero)
401 { 401 {
402 //Public Flag 402 //Public Flag
403 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC); 403 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC);
404 } 404 }
405 else 405 else
406 { 406 {
407 //Other Flag 407 //Other Flag
408 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER); 408 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER);
409 } 409 }
410 410
411 411
412 //Now for border control 412 //Now for border control
413 if (x == 0) 413 if (x == 0)
414 { 414 {
415 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); 415 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST);
416 } 416 }
417 else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) 417 else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock)
418 { 418 {
419 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); 419 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST);
420 } 420 }
421 421
422 if (y == 0) 422 if (y == 0)
423 { 423 {
424 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); 424 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH);
425 } 425 }
426 else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) 426 else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock)
427 { 427 {
428 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); 428 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH);
429 } 429 }
430 430
431 byteArray[byteArrayCount] = tempByte; 431 byteArray[byteArrayCount] = tempByte;
432 byteArrayCount++; 432 byteArrayCount++;
433 if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET) 433 if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET)
434 { 434 {
435 byteArrayCount = 0; 435 byteArrayCount = 0;
436 packet = new ParcelOverlayPacket(); 436 packet = new ParcelOverlayPacket();
437 packet.ParcelData.Data = byteArray; 437 packet.ParcelData.Data = byteArray;
438 packet.ParcelData.SequenceID = sequenceID; 438 packet.ParcelData.SequenceID = sequenceID;
439 remote_client.OutPacket((Packet)packet); 439 remote_client.OutPacket((Packet)packet);
440 sequenceID++; 440 sequenceID++;
441 byteArray = new byte[PARCEL_BLOCKS_PER_PACKET]; 441 byteArray = new byte[PARCEL_BLOCKS_PER_PACKET];
442 } 442 }
443 } 443 }
444 } 444 }
445 445
446 446
447 } 447 }
448 448
449 public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) 449 public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client)
450 { 450 {
451 //Get the parcels within the bounds 451 //Get the parcels within the bounds
452 List<Parcel> temp = new List<Parcel>(); 452 List<Parcel> temp = new List<Parcel>();
453 int x, y, i; 453 int x, y, i;
454 int inc_x = end_x - start_x; 454 int inc_x = end_x - start_x;
455 int inc_y = end_y - start_y; 455 int inc_y = end_y - start_y;
456 for (x = 0; x < inc_x; x++) 456 for (x = 0; x < inc_x; x++)
457 { 457 {
458 for (y = 0; y < inc_y; y++) 458 for (y = 0; y < inc_y; y++)
459 { 459 {
460 Parcel currentParcel = getParcel(start_x + x, start_y + y); 460 Parcel currentParcel = getParcel(start_x + x, start_y + y);
461 if (!temp.Contains(currentParcel)) 461 if (!temp.Contains(currentParcel))
462 { 462 {
463 currentParcel.forceUpdateParcelInfo(); 463 currentParcel.forceUpdateParcelInfo();
464 temp.Add(currentParcel); 464 temp.Add(currentParcel);
465 } 465 }
466 } 466 }
467 } 467 }
468 468
469 int requestResult = PARCEL_RESULT_ONE_PARCEL; 469 int requestResult = PARCEL_RESULT_ONE_PARCEL;
470 if (temp.Count > 1) 470 if (temp.Count > 1)
471 { 471 {
472 requestResult = PARCEL_RESULT_MULTIPLE_PARCELS; 472 requestResult = PARCEL_RESULT_MULTIPLE_PARCELS;
473 } 473 }
474 474
475 for (i = 0; i < temp.Count; i++) 475 for (i = 0; i < temp.Count; i++)
476 { 476 {
477 temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); 477 temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client);
478 } 478 }
479 479
480 480
481 sendParcelOverlay(remote_client); 481 sendParcelOverlay(remote_client);
482 } 482 }
483 483
484 public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) 484 public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
485 { 485 {
486 if (parcelList.ContainsKey(packet.ParcelData.LocalID)) 486 if (parcelList.ContainsKey(packet.ParcelData.LocalID))
487 { 487 {
488 parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); 488 parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client);
489 } 489 }
490 } 490 }
491 public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) 491 public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
492 { 492 {
493 subdivide(west, south, east, north, remote_client.AgentId); 493 subdivide(west, south, east, north, remote_client.AgentId);
494 } 494 }
495 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) 495 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
496 { 496 {
497 join(west, south, east, north, remote_client.AgentId); 497 join(west, south, east, north, remote_client.AgentId);
498 498
499 } 499 }
500 500
501 public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) 501 public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client)
502 { 502 {
503 parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); 503 parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client);
504 } 504 }
505 505
506 public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client) 506 public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client)
507 { 507 {
508 parcelList[local_id].sendParcelObjectOwners(remote_client); 508 parcelList[local_id].sendParcelObjectOwners(remote_client);
509 } 509 }
510 #endregion 510 #endregion
511 511
512 /// <summary> 512 /// <summary>
513 /// Resets the sim to the default parcel (full sim parcel owned by the default user) 513 /// Resets the sim to the default parcel (full sim parcel owned by the default user)
514 /// </summary> 514 /// </summary>
515 public void resetSimParcels() 515 public void resetSimParcels()
516 { 516 {
517 //Remove all the parcels in the sim and add a blank, full sim parcel set to public 517 //Remove all the parcels in the sim and add a blank, full sim parcel set to public
518 parcelList.Clear(); 518 parcelList.Clear();
519 lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; 519 lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
520 parcelIDList.Initialize(); 520 parcelIDList.Initialize();
521 521
522 Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); 522 Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world);
523 523
524 fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); 524 fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256));
525 fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID; 525 fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
526 526
527 addParcel(fullSimParcel); 527 addParcel(fullSimParcel);
528 528
529 } 529 }
530 530
531 531
532 public void handleSignificantClientMovement(IClientAPI remote_client) 532 public void handleSignificantClientMovement(IClientAPI remote_client)
533 { 533 {
534 Avatar clientAvatar = m_world.RequestAvatar(remote_client.AgentId); 534 Avatar clientAvatar = m_world.RequestAvatar(remote_client.AgentId);
535 if (clientAvatar != null) 535 if (clientAvatar != null)
536 { 536 {
537 Parcel over = getParcel(clientAvatar.Pos.X,clientAvatar.Pos.Y); 537 Parcel over = getParcel(clientAvatar.Pos.X,clientAvatar.Pos.Y);
538 if (over != null) 538 if (over != null)
539 { 539 {
540 over.sendParcelProperties(0, false, 0, remote_client); 540 over.sendParcelProperties(0, false, 0, remote_client);
541 } 541 }
542 } 542 }
543 } 543 }
544 544
545 public void resetAllParcelPrimCounts() 545 public void resetAllParcelPrimCounts()
546 { 546 {
547 foreach (Parcel p in parcelList.Values) 547 foreach (Parcel p in parcelList.Values)
548 { 548 {
549 p.resetParcelPrimCounts(); 549 p.resetParcelPrimCounts();
550 } 550 }
551 } 551 }
552 public void setPrimsTainted() 552 public void setPrimsTainted()
553 { 553 {
554 this.parcelPrimCountTainted = true; 554 this.parcelPrimCountTainted = true;
555 } 555 }
556 556
557 public void addPrimToParcelCounts(SceneObject obj) 557 public void addPrimToParcelCounts(SceneObject obj)
558 { 558 {
559 LLVector3 position = obj.Pos; 559 LLVector3 position = obj.Pos;
560 Parcel parcelUnderPrim = getParcel(position.X, position.Y); 560 Parcel parcelUnderPrim = getParcel(position.X, position.Y);
561 if (parcelUnderPrim != null) 561 if (parcelUnderPrim != null)
562 { 562 {
563 parcelUnderPrim.addPrimToCount(obj); 563 parcelUnderPrim.addPrimToCount(obj);
564 } 564 }
565 } 565 }
566 566
567 public void removePrimFromParcelCounts(SceneObject obj) 567 public void removePrimFromParcelCounts(SceneObject obj)
568 { 568 {
569 foreach (Parcel p in parcelList.Values) 569 foreach (Parcel p in parcelList.Values)
570 { 570 {
571 p.removePrimFromCount(obj); 571 p.removePrimFromCount(obj);
572 } 572 }
573 } 573 }
574 574
575 public void finalizeParcelPrimCountUpdate() 575 public void finalizeParcelPrimCountUpdate()
576 { 576 {
577 //Get Simwide prim count for owner 577 //Get Simwide prim count for owner
578 Dictionary<LLUUID, List<Parcel>> parcelOwnersAndParcels = new Dictionary<LLUUID,List<Parcel>>(); 578 Dictionary<LLUUID, List<Parcel>> parcelOwnersAndParcels = new Dictionary<LLUUID,List<Parcel>>();
579 foreach (Parcel p in parcelList.Values) 579 foreach (Parcel p in parcelList.Values)
580 { 580 {
581 if(!parcelOwnersAndParcels.ContainsKey(p.parcelData.ownerID)) 581 if(!parcelOwnersAndParcels.ContainsKey(p.parcelData.ownerID))
582 { 582 {
583 List<Parcel> tempList = new List<Parcel>(); 583 List<Parcel> tempList = new List<Parcel>();
584 tempList.Add(p); 584 tempList.Add(p);
585 parcelOwnersAndParcels.Add(p.parcelData.ownerID,tempList); 585 parcelOwnersAndParcels.Add(p.parcelData.ownerID,tempList);
586 } 586 }
587 else 587 else
588 { 588 {
589 parcelOwnersAndParcels[p.parcelData.ownerID].Add(p); 589 parcelOwnersAndParcels[p.parcelData.ownerID].Add(p);
590 } 590 }
591 } 591 }
592 592
593 foreach (LLUUID owner in parcelOwnersAndParcels.Keys) 593 foreach (LLUUID owner in parcelOwnersAndParcels.Keys)
594 { 594 {
595 int simArea = 0; 595 int simArea = 0;
596 int simPrims = 0; 596 int simPrims = 0;
597 foreach (Parcel p in parcelOwnersAndParcels[owner]) 597 foreach (Parcel p in parcelOwnersAndParcels[owner])
598 { 598 {
599 simArea += p.parcelData.area; 599 simArea += p.parcelData.area;
600 simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims + p.parcelData.selectedPrims; 600 simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims + p.parcelData.selectedPrims;
601 } 601 }
602 602
603 foreach (Parcel p in parcelOwnersAndParcels[owner]) 603 foreach (Parcel p in parcelOwnersAndParcels[owner])
604 { 604 {
605 p.parcelData.simwideArea = simArea; 605 p.parcelData.simwideArea = simArea;
606 p.parcelData.simwidePrims = simPrims; 606 p.parcelData.simwidePrims = simPrims;
607 } 607 }
608 } 608 }
609 609
610 } 610 }
611 #endregion 611 #endregion
612 } 612 }
613 #endregion 613 #endregion
614 614
615 615
616 #region Parcel Class 616 #region Parcel Class
617 /// <summary> 617 /// <summary>
618 /// Keeps track of a specific parcel's information 618 /// Keeps track of a specific parcel's information
619 /// </summary> 619 /// </summary>
620 public class Parcel 620 public class Parcel
621 { 621 {
622 #region Member Variables 622 #region Member Variables
623 public ParcelData parcelData = new ParcelData(); 623 public ParcelData parcelData = new ParcelData();
624 public List<SceneObject> primsOverMe = new List<SceneObject>(); 624 public List<SceneObject> primsOverMe = new List<SceneObject>();
625 625
626 public Scene m_world; 626 public Scene m_world;
627 627
628 private bool[,] parcelBitmap = new bool[64, 64]; 628 private bool[,] parcelBitmap = new bool[64, 64];
629 629
630 #endregion 630 #endregion
631 631
632 632
633 #region Constructors 633 #region Constructors
634 public Parcel(LLUUID owner_id, bool is_group_owned, Scene world) 634 public Parcel(LLUUID owner_id, bool is_group_owned, Scene world)
635 { 635 {
636 m_world = world; 636 m_world = world;
637 parcelData.ownerID = owner_id; 637 parcelData.ownerID = owner_id;
638 parcelData.isGroupOwned = is_group_owned; 638 parcelData.isGroupOwned = is_group_owned;
639 639
640 } 640 }
641 #endregion 641 #endregion
642 642
643 643
644 #region Member Functions 644 #region Member Functions
645 645
646 #region General Functions 646 #region General Functions
647 /// <summary> 647 /// <summary>
648 /// Checks to see if this parcel contains a point 648 /// Checks to see if this parcel contains a point
649 /// </summary> 649 /// </summary>
650 /// <param name="x"></param> 650 /// <param name="x"></param>
651 /// <param name="y"></param> 651 /// <param name="y"></param>
652 /// <returns>Returns true if the parcel contains the specified point</returns> 652 /// <returns>Returns true if the parcel contains the specified point</returns>
653 public bool containsPoint(int x, int y) 653 public bool containsPoint(int x, int y)
654 { 654 {
655 if (x >= 0 && y >= 0 && x <= 256 && x <= 256) 655 if (x >= 0 && y >= 0 && x <= 256 && x <= 256)
656 { 656 {
657 return (parcelBitmap[x / 4, y / 4] == true); 657 return (parcelBitmap[x / 4, y / 4] == true);
658 } 658 }
659 else 659 else
660 { 660 {
661 return false; 661 return false;
662 } 662 }
663 } 663 }
664 664
665 public Parcel Copy() 665 public Parcel Copy()
666 { 666 {
667 Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); 667 Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world);
668 668
669 //Place all new variables here! 669 //Place all new variables here!
670 newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); 670 newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone());
671 newParcel.parcelData = parcelData.Copy(); 671 newParcel.parcelData = parcelData.Copy();
672 672
673 return newParcel; 673 return newParcel;
674 } 674 }
675 675
676 #endregion 676 #endregion
677 677
678 678
679 #region Packet Request Handling 679 #region Packet Request Handling
680 /// <summary> 680 /// <summary>
681 /// Sends parcel properties as requested 681 /// Sends parcel properties as requested
682 /// </summary> 682 /// </summary>
683 /// <param name="sequence_id">ID sent by client for them to keep track of</param> 683 /// <param name="sequence_id">ID sent by client for them to keep track of</param>
684 /// <param name="snap_selection">Bool sent by client for them to use</param> 684 /// <param name="snap_selection">Bool sent by client for them to use</param>
685 /// <param name="remote_client">Object representing the client</param> 685 /// <param name="remote_client">Object representing the client</param>
686 public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 686 public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
687 { 687 {
688 688
689 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); 689 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
690 updatePacket.ParcelData.AABBMax = parcelData.AABBMax; 690 updatePacket.ParcelData.AABBMax = parcelData.AABBMax;
691 updatePacket.ParcelData.AABBMin = parcelData.AABBMin; 691 updatePacket.ParcelData.AABBMin = parcelData.AABBMin;
692 updatePacket.ParcelData.Area = parcelData.area; 692 updatePacket.ParcelData.Area = parcelData.area;
693 updatePacket.ParcelData.AuctionID = parcelData.auctionID; 693 updatePacket.ParcelData.AuctionID = parcelData.auctionID;
694 updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented 694 updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented
695 695
696 updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; 696 updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray;
697 697
698 updatePacket.ParcelData.Desc = Helpers.StringToField(parcelData.parcelDesc); 698 updatePacket.ParcelData.Desc = Helpers.StringToField(parcelData.parcelDesc);
699 updatePacket.ParcelData.Category = (byte)parcelData.category; 699 updatePacket.ParcelData.Category = (byte)parcelData.category;
700 updatePacket.ParcelData.ClaimDate = parcelData.claimDate; 700 updatePacket.ParcelData.ClaimDate = parcelData.claimDate;
701 updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; 701 updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice;
702 updatePacket.ParcelData.GroupID = parcelData.groupID; 702 updatePacket.ParcelData.GroupID = parcelData.groupID;
703 updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; 703 updatePacket.ParcelData.GroupPrims = parcelData.groupPrims;
704 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; 704 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
705 updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; 705 updatePacket.ParcelData.LandingType = (byte)parcelData.landingType;
706 updatePacket.ParcelData.LocalID = parcelData.localID; 706 updatePacket.ParcelData.LocalID = parcelData.localID;
707 if (parcelData.area > 0) 707 if (parcelData.area > 0)
708 { 708 {
709 updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor))); 709 updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
710 } 710 }
711 else 711 else
712 { 712 {
713 updatePacket.ParcelData.MaxPrims = 0; 713 updatePacket.ParcelData.MaxPrims = 0;
714 } 714 }
715 updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; 715 updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale;
716 updatePacket.ParcelData.MediaID = parcelData.mediaID; 716 updatePacket.ParcelData.MediaID = parcelData.mediaID;
717 updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); 717 updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL);
718 updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL); 718 updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL);
719 updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); 719 updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName);
720 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented 720 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
721 updatePacket.ParcelData.OtherCount = 0; //unemplemented 721 updatePacket.ParcelData.OtherCount = 0; //unemplemented
722 updatePacket.ParcelData.OtherPrims = parcelData.otherPrims; 722 updatePacket.ParcelData.OtherPrims = parcelData.otherPrims;
723 updatePacket.ParcelData.OwnerID = parcelData.ownerID; 723 updatePacket.ParcelData.OwnerID = parcelData.ownerID;
724 updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims; 724 updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims;
725 updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags; 725 updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags;
726 updatePacket.ParcelData.ParcelPrimBonus = m_world.RegionInfo.estateSettings.objectBonusFactor; 726 updatePacket.ParcelData.ParcelPrimBonus = m_world.RegionInfo.estateSettings.objectBonusFactor;
727 updatePacket.ParcelData.PassHours = parcelData.passHours; 727 updatePacket.ParcelData.PassHours = parcelData.passHours;
728 updatePacket.ParcelData.PassPrice = parcelData.passPrice; 728 updatePacket.ParcelData.PassPrice = parcelData.passPrice;
729 updatePacket.ParcelData.PublicCount = 0; //unemplemented 729 updatePacket.ParcelData.PublicCount = 0; //unemplemented
730 updatePacket.ParcelData.RegionDenyAnonymous = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0); 730 updatePacket.ParcelData.RegionDenyAnonymous = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0);
731 updatePacket.ParcelData.RegionDenyIdentified = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0); 731 updatePacket.ParcelData.RegionDenyIdentified = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0);
732 updatePacket.ParcelData.RegionDenyTransacted = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0); 732 updatePacket.ParcelData.RegionDenyTransacted = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0);
733 updatePacket.ParcelData.RegionPushOverride = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0); 733 updatePacket.ParcelData.RegionPushOverride = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0);
734 updatePacket.ParcelData.RentPrice = 0; 734 updatePacket.ParcelData.RentPrice = 0;
735 updatePacket.ParcelData.RequestResult = request_result; 735 updatePacket.ParcelData.RequestResult = request_result;
736 updatePacket.ParcelData.SalePrice = parcelData.salePrice; 736 updatePacket.ParcelData.SalePrice = parcelData.salePrice;
737 updatePacket.ParcelData.SelectedPrims = parcelData.selectedPrims; 737 updatePacket.ParcelData.SelectedPrims = parcelData.selectedPrims;
738 updatePacket.ParcelData.SelfCount = 0;//unemplemented 738 updatePacket.ParcelData.SelfCount = 0;//unemplemented
739 updatePacket.ParcelData.SequenceID = sequence_id; 739 updatePacket.ParcelData.SequenceID = sequence_id;
740 if (parcelData.simwideArea > 0) 740 if (parcelData.simwideArea > 0)
741 { 741 {
742 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor))); 742 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
743 } 743 }
744 else 744 else
745 { 745 {
746 updatePacket.ParcelData.SimWideMaxPrims = 0; 746 updatePacket.ParcelData.SimWideMaxPrims = 0;
747 } 747 }
748 updatePacket.ParcelData.SimWideTotalPrims = parcelData.simwidePrims; 748 updatePacket.ParcelData.SimWideTotalPrims = parcelData.simwidePrims;
749 updatePacket.ParcelData.SnapSelection = snap_selection; 749 updatePacket.ParcelData.SnapSelection = snap_selection;
750 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; 750 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
751 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; 751 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
752 updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims + parcelData.selectedPrims; 752 updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims + parcelData.selectedPrims;
753 updatePacket.ParcelData.UserLocation = parcelData.userLocation; 753 updatePacket.ParcelData.UserLocation = parcelData.userLocation;
754 updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; 754 updatePacket.ParcelData.UserLookAt = parcelData.userLookAt;
755 remote_client.OutPacket((Packet)updatePacket); 755 remote_client.OutPacket((Packet)updatePacket);
756 } 756 }
757 757
758 public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) 758 public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
759 { 759 {
760 if (remote_client.AgentId == parcelData.ownerID) 760 if (remote_client.AgentId == parcelData.ownerID)
761 { 761 {
762 //Needs later group support 762 //Needs later group support
763 parcelData.authBuyerID = packet.ParcelData.AuthBuyerID; 763 parcelData.authBuyerID = packet.ParcelData.AuthBuyerID;
764 parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; 764 parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category;
765 parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); 765 parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
766 parcelData.groupID = packet.ParcelData.GroupID; 766 parcelData.groupID = packet.ParcelData.GroupID;
767 parcelData.landingType = packet.ParcelData.LandingType; 767 parcelData.landingType = packet.ParcelData.LandingType;
768 parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale; 768 parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale;
769 parcelData.mediaID = packet.ParcelData.MediaID; 769 parcelData.mediaID = packet.ParcelData.MediaID;
770 parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); 770 parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL);
771 parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); 771 parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL);
772 parcelData.parcelName = Helpers.FieldToUTF8String(packet.ParcelData.Name); 772 parcelData.parcelName = Helpers.FieldToUTF8String(packet.ParcelData.Name);
773 parcelData.parcelFlags = packet.ParcelData.ParcelFlags; 773 parcelData.parcelFlags = packet.ParcelData.ParcelFlags;
774 parcelData.passHours = packet.ParcelData.PassHours; 774 parcelData.passHours = packet.ParcelData.PassHours;
775 parcelData.passPrice = packet.ParcelData.PassPrice; 775 parcelData.passPrice = packet.ParcelData.PassPrice;
776 parcelData.salePrice = packet.ParcelData.SalePrice; 776 parcelData.salePrice = packet.ParcelData.SalePrice;
777 parcelData.snapshotID = packet.ParcelData.SnapshotID; 777 parcelData.snapshotID = packet.ParcelData.SnapshotID;
778 parcelData.userLocation = packet.ParcelData.UserLocation; 778 parcelData.userLocation = packet.ParcelData.UserLocation;
779 parcelData.userLookAt = packet.ParcelData.UserLookAt; 779 parcelData.userLookAt = packet.ParcelData.UserLookAt;
780 sendParcelUpdateToAvatarsOverMe(); 780 sendParcelUpdateToAvatarsOverMe();
781 781
782 782
783 } 783 }
784 } 784 }
785 785
786 public void sendParcelUpdateToAvatarsOverMe() 786 public void sendParcelUpdateToAvatarsOverMe()
787 { 787 {
788 List<Avatar> avatars = m_world.RequestAvatarList(); 788 List<Avatar> avatars = m_world.RequestAvatarList();
789 for (int i = 0; i < avatars.Count; i++) 789 for (int i = 0; i < avatars.Count; i++)
790 { 790 {
791 Parcel over = m_world.ParcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y)); 791 Parcel over = m_world.ParcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
792 if (over.parcelData.localID == this.parcelData.localID) 792 if (over.parcelData.localID == this.parcelData.localID)
793 { 793 {
794 sendParcelProperties(0, false, 0, avatars[i].ControllingClient); 794 sendParcelProperties(0, false, 0, avatars[i].ControllingClient);
795 } 795 }
796 } 796 }
797 } 797 }
798 #endregion 798 #endregion
799 799
800 800
801 #region Update Functions 801 #region Update Functions
802 /// <summary> 802 /// <summary>
803 /// Updates the AABBMin and AABBMax values after area/shape modification of parcel 803 /// Updates the AABBMin and AABBMax values after area/shape modification of parcel
804 /// </summary> 804 /// </summary>
805 private void updateAABBAndAreaValues() 805 private void updateAABBAndAreaValues()
806 { 806 {
807 int min_x = 64; 807 int min_x = 64;
808 int min_y = 64; 808 int min_y = 64;
809 int max_x = 0; 809 int max_x = 0;
810 int max_y = 0; 810 int max_y = 0;
811 int tempArea = 0; 811 int tempArea = 0;
812 int x, y; 812 int x, y;
813 for (x = 0; x < 64; x++) 813 for (x = 0; x < 64; x++)
814 { 814 {
815 for (y = 0; y < 64; y++) 815 for (y = 0; y < 64; y++)
816 { 816 {
817 if (parcelBitmap[x, y] == true) 817 if (parcelBitmap[x, y] == true)
818 { 818 {
819 if (min_x > x) min_x = x; 819 if (min_x > x) min_x = x;
820 if (min_y > y) min_y = y; 820 if (min_y > y) min_y = y;
821 if (max_x < x) max_x = x; 821 if (max_x < x) max_x = x;
822 if (max_y < y) max_y = y; 822 if (max_y < y) max_y = y;
823 tempArea += 16; //16sqm parcel 823 tempArea += 16; //16sqm parcel
824 } 824 }
825 } 825 }
826 } 826 }
827 parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.get((min_x * 4), (min_y * 4))); 827 parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.get((min_x * 4), (min_y * 4)));
828 parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.get((max_x * 4), (max_y * 4))); 828 parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.get((max_x * 4), (max_y * 4)));
829 parcelData.area = tempArea; 829 parcelData.area = tempArea;
830 } 830 }
831 831
832 public void updateParcelBitmapByteArray() 832 public void updateParcelBitmapByteArray()
833 { 833 {
834 parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); 834 parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes();
835 } 835 }
836 836
837 /// <summary> 837 /// <summary>
838 /// Update all settings in parcel such as area, bitmap byte array, etc 838 /// Update all settings in parcel such as area, bitmap byte array, etc
839 /// </summary> 839 /// </summary>
840 public void forceUpdateParcelInfo() 840 public void forceUpdateParcelInfo()
841 { 841 {
842 this.updateAABBAndAreaValues(); 842 this.updateAABBAndAreaValues();
843 this.updateParcelBitmapByteArray(); 843 this.updateParcelBitmapByteArray();
844 } 844 }
845 845
846 public void setParcelBitmapFromByteArray() 846 public void setParcelBitmapFromByteArray()
847 { 847 {
848 parcelBitmap = convertBytesToParcelBitmap(); 848 parcelBitmap = convertBytesToParcelBitmap();
849 } 849 }
850 #endregion 850 #endregion
851 851
852 852
853 #region Parcel Bitmap Functions 853 #region Parcel Bitmap Functions
854 /// <summary> 854 /// <summary>
855 /// Sets the parcel's bitmap manually 855 /// Sets the parcel's bitmap manually
856 /// </summary> 856 /// </summary>
857 /// <param name="bitmap">64x64 block representing where this parcel is on a map</param> 857 /// <param name="bitmap">64x64 block representing where this parcel is on a map</param>
858 public void setParcelBitmap(bool[,] bitmap) 858 public void setParcelBitmap(bool[,] bitmap)
859 { 859 {
860 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) 860 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
861 { 861 {
862 //Throw an exception - The bitmap is not 64x64 862 //Throw an exception - The bitmap is not 64x64
863 throw new Exception("Error: Invalid Parcel Bitmap"); 863 throw new Exception("Error: Invalid Parcel Bitmap");
864 } 864 }
865 else 865 else
866 { 866 {
867 //Valid: Lets set it 867 //Valid: Lets set it
868 parcelBitmap = bitmap; 868 parcelBitmap = bitmap;
869 forceUpdateParcelInfo(); 869 forceUpdateParcelInfo();
870 870
871 } 871 }
872 } 872 }
873 /// <summary> 873 /// <summary>
874 /// Gets the parcels bitmap manually 874 /// Gets the parcels bitmap manually
875 /// </summary> 875 /// </summary>
876 /// <returns></returns> 876 /// <returns></returns>
877 public bool[,] getParcelBitmap() 877 public bool[,] getParcelBitmap()
878 { 878 {
879 return parcelBitmap; 879 return parcelBitmap;
880 } 880 }
881 /// <summary> 881 /// <summary>
882 /// Converts the parcel bitmap to a packet friendly byte array 882 /// Converts the parcel bitmap to a packet friendly byte array
883 /// </summary> 883 /// </summary>
884 /// <returns></returns> 884 /// <returns></returns>
885 private byte[] convertParcelBitmapToBytes() 885 private byte[] convertParcelBitmapToBytes()
886 { 886 {
887 byte[] tempConvertArr = new byte[512]; 887 byte[] tempConvertArr = new byte[512];
888 byte tempByte = 0; 888 byte tempByte = 0;
889 int x, y, i, byteNum = 0; 889 int x, y, i, byteNum = 0;
890 i = 0; 890 i = 0;
891 for (y = 0; y < 64; y++) 891 for (y = 0; y < 64; y++)
892 { 892 {
893 for (x = 0; x < 64; x++) 893 for (x = 0; x < 64; x++)
894 { 894 {
895 tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8)); 895 tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8));
896 if (i % 8 == 0) 896 if (i % 8 == 0)
897 { 897 {
898 tempConvertArr[byteNum] = tempByte; 898 tempConvertArr[byteNum] = tempByte;
899 tempByte = (byte)0; 899 tempByte = (byte)0;
900 i = 0; 900 i = 0;
901 byteNum++; 901 byteNum++;
902 } 902 }
903 } 903 }
904 } 904 }
905 return tempConvertArr; 905 return tempConvertArr;
906 } 906 }
907 907
908 private bool[,] convertBytesToParcelBitmap() 908 private bool[,] convertBytesToParcelBitmap()
909 { 909 {
910 bool[,] tempConvertMap = new bool[64, 64]; 910 bool[,] tempConvertMap = new bool[64, 64];
911 tempConvertMap.Initialize(); 911 tempConvertMap.Initialize();
912 byte tempByte = 0; 912 byte tempByte = 0;
913 int x = 0, y = 0, i = 0, bitNum = 0; 913 int x = 0, y = 0, i = 0, bitNum = 0;
914 for (i = 0; i < 512; i++) 914 for (i = 0; i < 512; i++)
915 { 915 {
916 tempByte = parcelData.parcelBitmapByteArray[i]; 916 tempByte = parcelData.parcelBitmapByteArray[i];
917 for (bitNum = 0; bitNum < 8; bitNum++) 917 for (bitNum = 0; bitNum < 8; bitNum++)
918 { 918 {
919 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); 919 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
920 tempConvertMap[x, y] = bit; 920 tempConvertMap[x, y] = bit;
921 x++; 921 x++;
922 if (x > 63) 922 if (x > 63)
923 { 923 {
924 x = 0; 924 x = 0;
925 y++; 925 y++;
926 } 926 }
927 927
928 } 928 }
929 929
930 } 930 }
931 return tempConvertMap; 931 return tempConvertMap;
932 } 932 }
933 /// <summary> 933 /// <summary>
934 /// Full sim parcel creation 934 /// Full sim parcel creation
935 /// </summary> 935 /// </summary>
936 /// <returns></returns> 936 /// <returns></returns>
937 public static bool[,] basicFullRegionParcelBitmap() 937 public static bool[,] basicFullRegionParcelBitmap()
938 { 938 {
939 return getSquareParcelBitmap(0, 0, 256, 256); 939 return getSquareParcelBitmap(0, 0, 256, 256);
940 } 940 }
941 941
942 /// <summary> 942 /// <summary>
943 /// Used to modify the bitmap between the x and y points. Points use 64 scale 943 /// Used to modify the bitmap between the x and y points. Points use 64 scale
944 /// </summary> 944 /// </summary>
945 /// <param name="start_x"></param> 945 /// <param name="start_x"></param>
946 /// <param name="start_y"></param> 946 /// <param name="start_y"></param>
947 /// <param name="end_x"></param> 947 /// <param name="end_x"></param>
948 /// <param name="end_y"></param> 948 /// <param name="end_y"></param>
949 /// <returns></returns> 949 /// <returns></returns>
950 public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y) 950 public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y)
951 { 951 {
952 952
953 bool[,] tempBitmap = new bool[64, 64]; 953 bool[,] tempBitmap = new bool[64, 64];
954 tempBitmap.Initialize(); 954 tempBitmap.Initialize();
955 955
956 tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 956 tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
957 return tempBitmap; 957 return tempBitmap;
958 } 958 }
959 959
960 /// <summary> 960 /// <summary>
961 /// Change a parcel's bitmap at within a square and set those points to a specific value 961 /// Change a parcel's bitmap at within a square and set those points to a specific value
962 /// </summary> 962 /// </summary>
963 /// <param name="parcel_bitmap"></param> 963 /// <param name="parcel_bitmap"></param>
964 /// <param name="start_x"></param> 964 /// <param name="start_x"></param>
965 /// <param name="start_y"></param> 965 /// <param name="start_y"></param>
966 /// <param name="end_x"></param> 966 /// <param name="end_x"></param>
967 /// <param name="end_y"></param> 967 /// <param name="end_y"></param>
968 /// <param name="set_value"></param> 968 /// <param name="set_value"></param>
969 /// <returns></returns> 969 /// <returns></returns>
970 public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) 970 public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value)
971 { 971 {
972 if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2) 972 if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2)
973 { 973 {
974 //Throw an exception - The bitmap is not 64x64 974 //Throw an exception - The bitmap is not 64x64
975 throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()"); 975 throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()");
976 } 976 }
977 977
978 int x, y; 978 int x, y;
979 for (y = 0; y < 64; y++) 979 for (y = 0; y < 64; y++)
980 { 980 {
981 for (x = 0; x < 64; x++) 981 for (x = 0; x < 64; x++)
982 { 982 {
983 if (x >= start_x / 4 && x < end_x / 4 983 if (x >= start_x / 4 && x < end_x / 4
984 && y >= start_y / 4 && y < end_y / 4) 984 && y >= start_y / 4 && y < end_y / 4)
985 { 985 {
986 parcel_bitmap[x, y] = set_value; 986 parcel_bitmap[x, y] = set_value;
987 } 987 }
988 } 988 }
989 } 989 }
990 return parcel_bitmap; 990 return parcel_bitmap;
991 } 991 }
992 /// <summary> 992 /// <summary>
993 /// Join the true values of 2 bitmaps together 993 /// Join the true values of 2 bitmaps together
994 /// </summary> 994 /// </summary>
995 /// <param name="bitmap_base"></param> 995 /// <param name="bitmap_base"></param>
996 /// <param name="bitmap_add"></param> 996 /// <param name="bitmap_add"></param>
997 /// <returns></returns> 997 /// <returns></returns>
998 public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) 998 public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
999 { 999 {
1000 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) 1000 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
1001 { 1001 {
1002 //Throw an exception - The bitmap is not 64x64 1002 //Throw an exception - The bitmap is not 64x64
1003 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps"); 1003 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps");
1004 } 1004 }
1005 if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) 1005 if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2)
1006 { 1006 {
1007 //Throw an exception - The bitmap is not 64x64 1007 //Throw an exception - The bitmap is not 64x64
1008 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); 1008 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps");
1009 1009
1010 } 1010 }
1011 1011
1012 int x, y; 1012 int x, y;
1013 for (y = 0; y < 64; y++) 1013 for (y = 0; y < 64; y++)
1014 { 1014 {
1015 for (x = 0; x < 64; x++) 1015 for (x = 0; x < 64; x++)
1016 { 1016 {
1017 if (bitmap_add[x, y]) 1017 if (bitmap_add[x, y])
1018 { 1018 {
1019 bitmap_base[x, y] = true; 1019 bitmap_base[x, y] = true;
1020 } 1020 }
1021 } 1021 }
1022 } 1022 }
1023 return bitmap_base; 1023 return bitmap_base;
1024 } 1024 }
1025 #endregion 1025 #endregion
1026 1026
1027 #region Object Select and Object Owner Listing 1027 #region Object Select and Object Owner Listing
1028 public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) 1028 public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client)
1029 { 1029 {
1030 List<uint> resultLocalIDs = new List<uint>(); 1030 List<uint> resultLocalIDs = new List<uint>();
1031 foreach (SceneObject obj in primsOverMe) 1031 foreach (SceneObject obj in primsOverMe)
1032 { 1032 {
1033 if (obj.rootLocalID > 0) 1033 if (obj.rootLocalID > 0)
1034 { 1034 {
1035 if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OWNER && obj.rootPrimitive.OwnerID == this.parcelData.ownerID) 1035 if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OWNER && obj.rootPrimitive.OwnerID == this.parcelData.ownerID)
1036 { 1036 {
1037 resultLocalIDs.Add(obj.rootLocalID); 1037 resultLocalIDs.Add(obj.rootLocalID);
1038 } 1038 }
1039 else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! 1039 else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support!
1040 { 1040 {
1041 1041
1042 } 1042 }
1043 else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OTHER && obj.rootPrimitive.OwnerID != remote_client.AgentId) 1043 else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OTHER && obj.rootPrimitive.OwnerID != remote_client.AgentId)
1044 { 1044 {
1045 resultLocalIDs.Add(obj.rootLocalID); 1045 resultLocalIDs.Add(obj.rootLocalID);
1046 } 1046 }
1047 } 1047 }
1048 } 1048 }
1049 1049
1050 1050
1051 bool firstCall = true; 1051 bool firstCall = true;
1052 int MAX_OBJECTS_PER_PACKET = 251; 1052 int MAX_OBJECTS_PER_PACKET = 251;
1053 ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); 1053 ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
1054 ForceObjectSelectPacket.DataBlock[] data; 1054 ForceObjectSelectPacket.DataBlock[] data;
1055 while (resultLocalIDs.Count > 0) 1055 while (resultLocalIDs.Count > 0)
1056 { 1056 {
1057 if (firstCall) 1057 if (firstCall)
1058 { 1058 {
1059 pack._Header.ResetList = true; 1059 pack._Header.ResetList = true;
1060 firstCall = false; 1060 firstCall = false;
1061 } 1061 }
1062 else 1062 else
1063 { 1063 {
1064 pack._Header.ResetList = false; 1064 pack._Header.ResetList = false;
1065 } 1065 }
1066 1066
1067 if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) 1067 if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET)
1068 { 1068 {
1069 data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; 1069 data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET];
1070 } 1070 }
1071 else 1071 else
1072 { 1072 {
1073 data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; 1073 data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count];
1074 } 1074 }
1075 1075
1076 int i; 1076 int i;
1077 for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) 1077 for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++)
1078 { 1078 {
1079 data[i] = new ForceObjectSelectPacket.DataBlock(); 1079 data[i] = new ForceObjectSelectPacket.DataBlock();
1080 data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); 1080 data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]);
1081 resultLocalIDs.RemoveAt(0); 1081 resultLocalIDs.RemoveAt(0);
1082 } 1082 }
1083 pack.Data = data; 1083 pack.Data = data;
1084 remote_client.OutPacket((Packet)pack); 1084 remote_client.OutPacket((Packet)pack);
1085 } 1085 }
1086 1086
1087 } 1087 }
1088 public void sendParcelObjectOwners(IClientAPI remote_client) 1088 public void sendParcelObjectOwners(IClientAPI remote_client)
1089 { 1089 {
1090 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID,int>(); 1090 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID,int>();
1091 foreach(SceneObject obj in primsOverMe) 1091 foreach(SceneObject obj in primsOverMe)
1092 { 1092 {
1093 if(!ownersAndCount.ContainsKey(obj.rootPrimitive.OwnerID)) 1093 if(!ownersAndCount.ContainsKey(obj.rootPrimitive.OwnerID))
1094 { 1094 {
1095 ownersAndCount.Add(obj.rootPrimitive.OwnerID,0); 1095 ownersAndCount.Add(obj.rootPrimitive.OwnerID,0);
1096 } 1096 }
1097 ownersAndCount[obj.rootPrimitive.OwnerID] += obj.primCount; 1097 ownersAndCount[obj.rootPrimitive.OwnerID] += obj.primCount;
1098 } 1098 }
1099 if (ownersAndCount.Count > 0) 1099 if (ownersAndCount.Count > 0)
1100 { 1100 {
1101 1101
1102 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; 1102 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32];
1103 1103
1104 if(ownersAndCount.Count < 32) 1104 if(ownersAndCount.Count < 32)
1105 { 1105 {
1106 dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count]; 1106 dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count];
1107 } 1107 }
1108 1108
1109 1109
1110 int num = 0; 1110 int num = 0;
1111 foreach (LLUUID owner in ownersAndCount.Keys) 1111 foreach (LLUUID owner in ownersAndCount.Keys)
1112 { 1112 {
1113 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock(); 1113 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
1114 dataBlock[num].Count = ownersAndCount[owner]; 1114 dataBlock[num].Count = ownersAndCount[owner];
1115 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added 1115 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
1116 dataBlock[num].OnlineStatus = true; //TODO: fix me later 1116 dataBlock[num].OnlineStatus = true; //TODO: fix me later
1117 dataBlock[num].OwnerID = owner; 1117 dataBlock[num].OwnerID = owner;
1118 1118
1119 num++; 1119 num++;
1120 } 1120 }
1121 1121
1122 ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket(); 1122 ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
1123 pack.Data = dataBlock; 1123 pack.Data = dataBlock;
1124 remote_client.OutPacket(pack); 1124 remote_client.OutPacket(pack);
1125 } 1125 }
1126 } 1126 }
1127 #endregion 1127 #endregion
1128 1128
1129 #region Object Returning 1129 #region Object Returning
1130 public void returnObject(SceneObject obj) 1130 public void returnObject(SceneObject obj)
1131 { 1131 {
1132 } 1132 }
1133 public void returnParcelObjects(int type, LLUUID owner) 1133 public void returnParcelObjects(int type, LLUUID owner)
1134 { 1134 {
1135 1135
1136 } 1136 }
1137 #endregion 1137 #endregion
1138 1138
1139 #region Object Adding/Removing from Parcel 1139 #region Object Adding/Removing from Parcel
1140 public void resetParcelPrimCounts() 1140 public void resetParcelPrimCounts()
1141 { 1141 {
1142 parcelData.groupPrims = 0; 1142 parcelData.groupPrims = 0;
1143 parcelData.ownerPrims = 0; 1143 parcelData.ownerPrims = 0;
1144 parcelData.otherPrims = 0; 1144 parcelData.otherPrims = 0;
1145 parcelData.selectedPrims = 0; 1145 parcelData.selectedPrims = 0;
1146 primsOverMe.Clear(); 1146 primsOverMe.Clear();
1147 } 1147 }
1148 1148
1149 public void addPrimToCount(SceneObject obj) 1149 public void addPrimToCount(SceneObject obj)
1150 { 1150 {
1151 LLUUID prim_owner = obj.rootPrimitive.OwnerID; 1151 LLUUID prim_owner = obj.rootPrimitive.OwnerID;
1152 int prim_count = obj.primCount; 1152 int prim_count = obj.primCount;
1153 1153
1154 if (obj.isSelected) 1154 if (obj.isSelected)
1155 { 1155 {
1156 parcelData.selectedPrims += prim_count; 1156 parcelData.selectedPrims += prim_count;
1157 } 1157 }
1158 else 1158 else
1159 { 1159 {
1160 if (prim_owner == parcelData.ownerID) 1160 if (prim_owner == parcelData.ownerID)
1161 { 1161 {
1162 parcelData.ownerPrims += prim_count; 1162 parcelData.ownerPrims += prim_count;
1163 } 1163 }
1164 else 1164 else
1165 { 1165 {
1166 parcelData.otherPrims += prim_count; 1166 parcelData.otherPrims += prim_count;
1167 } 1167 }
1168 } 1168 }
1169 1169
1170 primsOverMe.Add(obj); 1170 primsOverMe.Add(obj);
1171 1171
1172 } 1172 }
1173 1173
1174 public void removePrimFromCount(SceneObject obj) 1174 public void removePrimFromCount(SceneObject obj)
1175 { 1175 {
1176 if (primsOverMe.Contains(obj)) 1176 if (primsOverMe.Contains(obj))
1177 { 1177 {
1178 LLUUID prim_owner = obj.rootPrimitive.OwnerID; 1178 LLUUID prim_owner = obj.rootPrimitive.OwnerID;
1179 int prim_count = obj.primCount; 1179 int prim_count = obj.primCount;
1180 1180
1181 if (prim_owner == parcelData.ownerID) 1181 if (prim_owner == parcelData.ownerID)
1182 { 1182 {
1183 parcelData.ownerPrims -= prim_count; 1183 parcelData.ownerPrims -= prim_count;
1184 } 1184 }
1185 else if (prim_owner == parcelData.groupID) 1185 else if (prim_owner == parcelData.groupID)
1186 { 1186 {
1187 parcelData.groupPrims -= prim_count; 1187 parcelData.groupPrims -= prim_count;
1188 } 1188 }
1189 else 1189 else
1190 { 1190 {
1191 parcelData.otherPrims -= prim_count; 1191 parcelData.otherPrims -= prim_count;
1192 } 1192 }
1193 1193
1194 primsOverMe.Remove(obj); 1194 primsOverMe.Remove(obj);
1195 } 1195 }
1196 } 1196 }
1197 #endregion 1197 #endregion
1198 1198
1199 #endregion 1199 #endregion
1200 1200
1201 1201
1202 } 1202 }
1203 #endregion 1203 #endregion
1204 1204
1205 1205
1206} 1206}
diff --git a/OpenSim/Region/Environment/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs
index cd67e97..35fbf45 100644
--- a/OpenSim/Region/Environment/RegionManager.cs
+++ b/OpenSim/Region/Environment/RegionManager.cs
@@ -1,29 +1,29 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using OpenSim.Framework; 2using OpenSim.Framework;
3using OpenSim.Framework.Communications; 3using OpenSim.Framework.Communications;
4using OpenSim.Framework.Servers; 4using OpenSim.Framework.Servers;
5using OpenSim.Region.Capabilities; 5using OpenSim.Region.Capabilities;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7 7
8namespace OpenSim.Region.Environment 8namespace OpenSim.Region.Environment
9{ 9{
10 public class RegionManager //needs renaming , but first we need to rename the namespace 10 public class RegionManager //needs renaming , but first we need to rename the namespace
11 { 11 {
12 protected AuthenticateSessionsBase authenticateHandler; 12 protected AuthenticateSessionsBase authenticateHandler;
13 protected RegionCommsListener regionCommsHost; 13 protected RegionCommsListener regionCommsHost;
14 protected CommunicationsManager commsManager; 14 protected CommunicationsManager commsManager;
15 protected List<Caps> capsHandlers = new List<Caps>(); 15 protected List<Caps> capsHandlers = new List<Caps>();
16 protected BaseHttpServer httpListener; 16 protected BaseHttpServer httpListener;
17 17
18 protected Scene m_Scene; 18 protected Scene m_Scene;
19 19
20 public ParcelManager parcelManager; 20 public ParcelManager parcelManager;
21 public EstateManager estateManager; 21 public EstateManager estateManager;
22 22
23 public RegionManager() 23 public RegionManager()
24 { 24 {
25 25
26 } 26 }
27 27
28 } 28 }
29} 29}
diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs
index 084c9ab..2456a4e 100644
--- a/OpenSim/Region/Environment/Scenes/Entity.cs
+++ b/OpenSim/Region/Environment/Scenes/Entity.cs
@@ -1,115 +1,115 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Physics.Manager; 30using OpenSim.Physics.Manager;
31 31
32namespace OpenSim.Region.Environment.Scenes 32namespace OpenSim.Region.Environment.Scenes
33{ 33{
34 public abstract class Entity :EntityBase //this class (Entity) will be phased out 34 public abstract class Entity :EntityBase //this class (Entity) will be phased out
35 { 35 {
36 protected PhysicsActor _physActor; 36 protected PhysicsActor _physActor;
37 37
38 /// <summary> 38 /// <summary>
39 /// 39 ///
40 /// </summary> 40 /// </summary>
41 public override LLVector3 Pos 41 public override LLVector3 Pos
42 { 42 {
43 get 43 get
44 { 44 {
45 if (this._physActor != null) 45 if (this._physActor != null)
46 { 46 {
47 m_pos.X = _physActor.Position.X; 47 m_pos.X = _physActor.Position.X;
48 m_pos.Y = _physActor.Position.Y; 48 m_pos.Y = _physActor.Position.Y;
49 m_pos.Z = _physActor.Position.Z; 49 m_pos.Z = _physActor.Position.Z;
50 } 50 }
51 51
52 return m_pos; 52 return m_pos;
53 } 53 }
54 set 54 set
55 { 55 {
56 if (this._physActor != null) 56 if (this._physActor != null)
57 { 57 {
58 try 58 try
59 { 59 {
60 lock (this.m_world.SyncRoot) 60 lock (this.m_world.SyncRoot)
61 { 61 {
62 62
63 this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 63 this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
64 } 64 }
65 } 65 }
66 catch (Exception e) 66 catch (Exception e)
67 { 67 {
68 Console.WriteLine(e.Message); 68 Console.WriteLine(e.Message);
69 } 69 }
70 } 70 }
71 71
72 m_pos = value; 72 m_pos = value;
73 } 73 }
74 } 74 }
75 75
76 76
77 /// <summary> 77 /// <summary>
78 /// 78 ///
79 /// </summary> 79 /// </summary>
80 public override LLVector3 Velocity 80 public override LLVector3 Velocity
81 { 81 {
82 get 82 get
83 { 83 {
84 if (this._physActor != null) 84 if (this._physActor != null)
85 { 85 {
86 m_velocity.X = _physActor.Velocity.X; 86 m_velocity.X = _physActor.Velocity.X;
87 m_velocity.Y = _physActor.Velocity.Y; 87 m_velocity.Y = _physActor.Velocity.Y;
88 m_velocity.Z = _physActor.Velocity.Z; 88 m_velocity.Z = _physActor.Velocity.Z;
89 } 89 }
90 90
91 return m_velocity; 91 return m_velocity;
92 } 92 }
93 set 93 set
94 { 94 {
95 if (this._physActor != null) 95 if (this._physActor != null)
96 { 96 {
97 try 97 try
98 { 98 {
99 lock (this.m_world.SyncRoot) 99 lock (this.m_world.SyncRoot)
100 { 100 {
101 101
102 this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 102 this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
103 } 103 }
104 } 104 }
105 catch (Exception e) 105 catch (Exception e)
106 { 106 {
107 Console.WriteLine(e.Message); 107 Console.WriteLine(e.Message);
108 } 108 }
109 } 109 }
110 110
111 m_velocity = value; 111 m_velocity = value;
112 } 112 }
113 } 113 }
114 } 114 }
115} 115}
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 65a0395..04cf595 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -1,142 +1,142 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using Axiom.Math; 2using Axiom.Math;
3using libsecondlife; 3using libsecondlife;
4 4
5namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
6{ 6{
7 public abstract class EntityBase 7 public abstract class EntityBase
8 { 8 {
9 public LLUUID uuid; 9 public LLUUID uuid;
10 10
11 protected List<EntityBase> children; 11 protected List<EntityBase> children;
12 12
13 protected Scene m_world; 13 protected Scene m_world;
14 protected string m_name; 14 protected string m_name;
15 15
16 /// <summary> 16 /// <summary>
17 /// 17 ///
18 /// </summary> 18 /// </summary>
19 public virtual string Name 19 public virtual string Name
20 { 20 {
21 get { return m_name; } 21 get { return m_name; }
22 set { m_name = value; } 22 set { m_name = value; }
23 } 23 }
24 24
25 protected LLVector3 m_pos; 25 protected LLVector3 m_pos;
26 /// <summary> 26 /// <summary>
27 /// 27 ///
28 /// </summary> 28 /// </summary>
29 public virtual LLVector3 Pos 29 public virtual LLVector3 Pos
30 { 30 {
31 get 31 get
32 { 32 {
33 return m_pos; 33 return m_pos;
34 } 34 }
35 set 35 set
36 { 36 {
37 m_pos = value; 37 m_pos = value;
38 } 38 }
39 } 39 }
40 40
41 public LLVector3 m_velocity; 41 public LLVector3 m_velocity;
42 42
43 /// <summary> 43 /// <summary>
44 /// 44 ///
45 /// </summary> 45 /// </summary>
46 public virtual LLVector3 Velocity 46 public virtual LLVector3 Velocity
47 { 47 {
48 get 48 get
49 { 49 {
50 return m_velocity; 50 return m_velocity;
51 } 51 }
52 set 52 set
53 { 53 {
54 m_velocity = value; 54 m_velocity = value;
55 } 55 }
56 } 56 }
57 57
58 protected Quaternion m_rotation = new Quaternion(0,0,1,0); 58 protected Quaternion m_rotation = new Quaternion(0,0,1,0);
59 59
60 public virtual Quaternion Rotation 60 public virtual Quaternion Rotation
61 { 61 {
62 get 62 get
63 { 63 {
64 return m_rotation; 64 return m_rotation;
65 } 65 }
66 set 66 set
67 { 67 {
68 m_rotation = value; 68 m_rotation = value;
69 } 69 }
70 } 70 }
71 71
72 protected uint m_localId; 72 protected uint m_localId;
73 73
74 public uint LocalId 74 public uint LocalId
75 { 75 {
76 get { return m_localId; } 76 get { return m_localId; }
77 set { m_localId = value; } 77 set { m_localId = value; }
78 } 78 }
79 79
80 /// <summary> 80 /// <summary>
81 /// Creates a new Entity (should not occur on it's own) 81 /// Creates a new Entity (should not occur on it's own)
82 /// </summary> 82 /// </summary>
83 public EntityBase() 83 public EntityBase()
84 { 84 {
85 uuid = new LLUUID(); 85 uuid = new LLUUID();
86 86
87 m_pos = new LLVector3(); 87 m_pos = new LLVector3();
88 m_velocity = new LLVector3(); 88 m_velocity = new LLVector3();
89 Rotation = new Quaternion(); 89 Rotation = new Quaternion();
90 m_name = "(basic entity)"; 90 m_name = "(basic entity)";
91 children = new List<EntityBase>(); 91 children = new List<EntityBase>();
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
95 /// 95 ///
96 /// </summary> 96 /// </summary>
97 public virtual void updateMovement() 97 public virtual void updateMovement()
98 { 98 {
99 foreach (EntityBase child in children) 99 foreach (EntityBase child in children)
100 { 100 {
101 child.updateMovement(); 101 child.updateMovement();
102 } 102 }
103 } 103 }
104 104
105 /// <summary> 105 /// <summary>
106 /// Performs any updates that need to be done at each frame. This function is overridable from it's children. 106 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
107 /// </summary> 107 /// </summary>
108 public virtual void update() 108 public virtual void update()
109 { 109 {
110 // Do any per-frame updates needed that are applicable to every type of entity 110 // Do any per-frame updates needed that are applicable to every type of entity
111 foreach (EntityBase child in children) 111 foreach (EntityBase child in children)
112 { 112 {
113 child.update(); 113 child.update();
114 } 114 }
115 } 115 }
116 116
117 /// <summary> 117 /// <summary>
118 /// Called at a set interval to inform entities that they should back themsleves up to the DB 118 /// Called at a set interval to inform entities that they should back themsleves up to the DB
119 /// </summary> 119 /// </summary>
120 public virtual void BackUp() 120 public virtual void BackUp()
121 { 121 {
122 122
123 } 123 }
124 124
125 /// <summary> 125 /// <summary>
126 /// Copies the entity 126 /// Copies the entity
127 /// </summary> 127 /// </summary>
128 /// <returns></returns> 128 /// <returns></returns>
129 public virtual EntityBase Copy() 129 public virtual EntityBase Copy()
130 { 130 {
131 return (EntityBase)this.MemberwiseClone(); 131 return (EntityBase)this.MemberwiseClone();
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Infoms the entity that the land (heightmap) has changed 135 /// Infoms the entity that the land (heightmap) has changed
136 /// </summary> 136 /// </summary>
137 public virtual void LandRenegerated() 137 public virtual void LandRenegerated()
138 { 138 {
139 139
140 } 140 }
141 } 141 }
142} 142}
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index 7c3a033..8551b70 100644
--- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -1,14 +1,14 @@
1using libsecondlife; 1using libsecondlife;
2using libsecondlife.Packets; 2using libsecondlife.Packets;
3using OpenSim.Framework.Interfaces; 3using OpenSim.Framework.Interfaces;
4 4
5namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
6{ 6{
7 public interface IScenePresenceBody 7 public interface IScenePresenceBody
8 { 8 {
9 void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 9 void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
10 void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); 10 void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
11 void SendOurAppearance(IClientAPI OurClient); 11 void SendOurAppearance(IClientAPI OurClient);
12 void SendAppearanceToOtherAgent(ScenePresence avatarInfo); 12 void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
13 } 13 }
14} 14}
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 0e5b083..b413758 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -1,648 +1,648 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using Axiom.Math; 3using Axiom.Math;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Inventory; 7using OpenSim.Framework.Inventory;
8using OpenSim.Framework.Types; 8using OpenSim.Framework.Types;
9 9
10namespace OpenSim.Region.Environment.Scenes 10namespace OpenSim.Region.Environment.Scenes
11{ 11{
12 public delegate void PrimCountTaintedDelegate(); 12 public delegate void PrimCountTaintedDelegate();
13 13
14 public class Primitive : EntityBase 14 public class Primitive : EntityBase
15 { 15 {
16 private const uint FULL_MASK_PERMISSIONS = 2147483647; 16 private const uint FULL_MASK_PERMISSIONS = 2147483647;
17 17
18 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 18 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
19 private ulong m_regionHandle; 19 private ulong m_regionHandle;
20 private byte updateFlag = 0; 20 private byte updateFlag = 0;
21 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; 21 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
22 22
23 private Dictionary<LLUUID, InventoryItem> inventoryItems; 23 private Dictionary<LLUUID, InventoryItem> inventoryItems;
24 24
25 private string m_description = ""; 25 private string m_description = "";
26 26
27 public string SitName = ""; 27 public string SitName = "";
28 public string TouchName = ""; 28 public string TouchName = "";
29 public string Text = ""; 29 public string Text = "";
30 30
31 public LLUUID CreatorID; 31 public LLUUID CreatorID;
32 public LLUUID OwnerID; 32 public LLUUID OwnerID;
33 public LLUUID LastOwnerID; 33 public LLUUID LastOwnerID;
34 public Int32 CreationDate; 34 public Int32 CreationDate;
35 35
36 public uint ParentID = 0; 36 public uint ParentID = 0;
37 37
38 public uint OwnerMask = FULL_MASK_PERMISSIONS; 38 public uint OwnerMask = FULL_MASK_PERMISSIONS;
39 public uint NextOwnerMask = FULL_MASK_PERMISSIONS; 39 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
40 public uint GroupMask = FULL_MASK_PERMISSIONS; 40 public uint GroupMask = FULL_MASK_PERMISSIONS;
41 public uint EveryoneMask = FULL_MASK_PERMISSIONS; 41 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
42 public uint BaseMask = FULL_MASK_PERMISSIONS; 42 public uint BaseMask = FULL_MASK_PERMISSIONS;
43 43
44 private PrimitiveBaseShape m_Shape; 44 private PrimitiveBaseShape m_Shape;
45 45
46 public SceneObject m_RootParent; 46 public SceneObject m_RootParent;
47 public bool m_isRootPrim; 47 public bool m_isRootPrim;
48 public EntityBase m_Parent; 48 public EntityBase m_Parent;
49 49
50 private EventManager m_eventManager; 50 private EventManager m_eventManager;
51 51
52 public event PrimCountTaintedDelegate OnPrimCountTainted; 52 public event PrimCountTaintedDelegate OnPrimCountTainted;
53 53
54 #region Properties 54 #region Properties
55 /// <summary> 55 /// <summary>
56 /// If rootprim, will return world position 56 /// If rootprim, will return world position
57 /// otherwise will return local offset from rootprim 57 /// otherwise will return local offset from rootprim
58 /// </summary> 58 /// </summary>
59 public override LLVector3 Pos 59 public override LLVector3 Pos
60 { 60 {
61 get 61 get
62 { 62 {
63 if (m_isRootPrim) 63 if (m_isRootPrim)
64 { 64 {
65 //if we are rootprim then our offset should be zero 65 //if we are rootprim then our offset should be zero
66 return this.m_pos + m_Parent.Pos; 66 return this.m_pos + m_Parent.Pos;
67 } 67 }
68 else 68 else
69 { 69 {
70 return this.m_pos; 70 return this.m_pos;
71 } 71 }
72 } 72 }
73 set 73 set
74 { 74 {
75 if (m_isRootPrim) 75 if (m_isRootPrim)
76 { 76 {
77 m_Parent.Pos = value; 77 m_Parent.Pos = value;
78 } 78 }
79 this.m_pos = value - m_Parent.Pos; 79 this.m_pos = value - m_Parent.Pos;
80 } 80 }
81 81
82 } 82 }
83 83
84 public PrimitiveBaseShape Shape 84 public PrimitiveBaseShape Shape
85 { 85 {
86 get 86 get
87 { 87 {
88 return this.m_Shape; 88 return this.m_Shape;
89 } 89 }
90 } 90 }
91 91
92 public LLVector3 WorldPos 92 public LLVector3 WorldPos
93 { 93 {
94 get 94 get
95 { 95 {
96 if (!this.m_isRootPrim) 96 if (!this.m_isRootPrim)
97 { 97 {
98 Primitive parentPrim = (Primitive)this.m_Parent; 98 Primitive parentPrim = (Primitive)this.m_Parent;
99 Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 99 Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z);
100 offsetPos = parentPrim.Rotation * offsetPos; 100 offsetPos = parentPrim.Rotation * offsetPos;
101 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z); 101 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z);
102 } 102 }
103 else 103 else
104 { 104 {
105 return this.Pos; 105 return this.Pos;
106 } 106 }
107 } 107 }
108 } 108 }
109 109
110 public string Description 110 public string Description
111 { 111 {
112 get 112 get
113 { 113 {
114 return this.m_description; 114 return this.m_description;
115 } 115 }
116 set 116 set
117 { 117 {
118 this.m_description = value; 118 this.m_description = value;
119 } 119 }
120 } 120 }
121 121
122 public LLVector3 Scale 122 public LLVector3 Scale
123 { 123 {
124 set 124 set
125 { 125 {
126 this.m_Shape.Scale = value; 126 this.m_Shape.Scale = value;
127 } 127 }
128 get 128 get
129 { 129 {
130 return this.m_Shape.Scale; 130 return this.m_Shape.Scale;
131 } 131 }
132 } 132 }
133 #endregion 133 #endregion
134 134
135 #region Constructors 135 #region Constructors
136 /// <summary> 136 /// <summary>
137 /// 137 ///
138 /// </summary> 138 /// </summary>
139 /// <param name="regionHandle"></param> 139 /// <param name="regionHandle"></param>
140 /// <param name="world"></param> 140 /// <param name="world"></param>
141 /// <param name="addPacket"></param> 141 /// <param name="addPacket"></param>
142 /// <param name="ownerID"></param> 142 /// <param name="ownerID"></param>
143 /// <param name="localID"></param> 143 /// <param name="localID"></param>
144 /// <param name="isRoot"></param> 144 /// <param name="isRoot"></param>
145 /// <param name="parent"></param> 145 /// <param name="parent"></param>
146 /// <param name="rootObject"></param> 146 /// <param name="rootObject"></param>
147 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 147 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
148 { 148 {
149 149
150 m_regionHandle = regionHandle; 150 m_regionHandle = regionHandle;
151 m_world = world; 151 m_world = world;
152 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 152 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
153 this.m_Parent = parent; 153 this.m_Parent = parent;
154 this.m_isRootPrim = isRoot; 154 this.m_isRootPrim = isRoot;
155 this.m_RootParent = rootObject; 155 this.m_RootParent = rootObject;
156 this.CreateFromShape(ownerID, localID, pos, shape); 156 this.CreateFromShape(ownerID, localID, pos, shape);
157 this.Rotation = Axiom.Math.Quaternion.Identity; 157 this.Rotation = Axiom.Math.Quaternion.Identity;
158 158
159 m_world.AcknowledgeNewPrim(this); 159 m_world.AcknowledgeNewPrim(this);
160 160
161 this.OnPrimCountTainted(); 161 this.OnPrimCountTainted();
162 } 162 }
163 163
164 /// <summary> 164 /// <summary>
165 /// 165 ///
166 /// </summary> 166 /// </summary>
167 /// <remarks>Empty constructor for duplication</remarks> 167 /// <remarks>Empty constructor for duplication</remarks>
168 public Primitive() 168 public Primitive()
169 { 169 {
170 170
171 } 171 }
172 172
173 #endregion 173 #endregion
174 174
175 #region Destructors 175 #region Destructors
176 176
177 ~Primitive() 177 ~Primitive()
178 { 178 {
179 this.OnPrimCountTainted(); 179 this.OnPrimCountTainted();
180 } 180 }
181 #endregion 181 #endregion
182 182
183 #region Duplication 183 #region Duplication
184 184
185 public Primitive Copy(EntityBase parent, SceneObject rootParent) 185 public Primitive Copy(EntityBase parent, SceneObject rootParent)
186 { 186 {
187 Primitive dupe = (Primitive)this.MemberwiseClone(); 187 Primitive dupe = (Primitive)this.MemberwiseClone();
188 188
189 dupe.m_Parent = parent; 189 dupe.m_Parent = parent;
190 dupe.m_RootParent = rootParent; 190 dupe.m_RootParent = rootParent;
191 191
192 // TODO: Copy this properly. 192 // TODO: Copy this properly.
193 dupe.inventoryItems = this.inventoryItems; 193 dupe.inventoryItems = this.inventoryItems;
194 dupe.children = new List<EntityBase>(); 194 dupe.children = new List<EntityBase>();
195 dupe.m_Shape = this.m_Shape.Copy(); 195 dupe.m_Shape = this.m_Shape.Copy();
196 dupe.m_regionHandle = this.m_regionHandle; 196 dupe.m_regionHandle = this.m_regionHandle;
197 dupe.m_world = this.m_world; 197 dupe.m_world = this.m_world;
198 198
199 uint newLocalID = this.m_world.PrimIDAllocate(); 199 uint newLocalID = this.m_world.PrimIDAllocate();
200 dupe.uuid = LLUUID.Random(); 200 dupe.uuid = LLUUID.Random();
201 dupe.LocalId = newLocalID; 201 dupe.LocalId = newLocalID;
202 202
203 if (parent is SceneObject) 203 if (parent is SceneObject)
204 { 204 {
205 dupe.m_isRootPrim = true; 205 dupe.m_isRootPrim = true;
206 dupe.ParentID = 0; 206 dupe.ParentID = 0;
207 } 207 }
208 else 208 else
209 { 209 {
210 dupe.m_isRootPrim = false; 210 dupe.m_isRootPrim = false;
211 dupe.ParentID = ((Primitive)parent).LocalId; 211 dupe.ParentID = ((Primitive)parent).LocalId;
212 } 212 }
213 213
214 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); 214 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
215 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 215 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
216 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 216 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z);
217 217
218 rootParent.AddChildToList(dupe); 218 rootParent.AddChildToList(dupe);
219 this.m_world.AcknowledgeNewPrim(dupe); 219 this.m_world.AcknowledgeNewPrim(dupe);
220 dupe.TriggerOnPrimCountTainted(); 220 dupe.TriggerOnPrimCountTainted();
221 221
222 foreach (Primitive prim in this.children) 222 foreach (Primitive prim in this.children)
223 { 223 {
224 Primitive primClone = prim.Copy(dupe, rootParent); 224 Primitive primClone = prim.Copy(dupe, rootParent);
225 dupe.children.Add(primClone); 225 dupe.children.Add(primClone);
226 } 226 }
227 227
228 return dupe; 228 return dupe;
229 } 229 }
230 230
231 #endregion 231 #endregion
232 232
233 #region Override from EntityBase 233 #region Override from EntityBase
234 /// <summary> 234 /// <summary>
235 /// 235 ///
236 /// </summary> 236 /// </summary>
237 public override void update() 237 public override void update()
238 { 238 {
239 if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes 239 if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes
240 { 240 {
241 this.SendFullUpdateToAllClients(); 241 this.SendFullUpdateToAllClients();
242 this.updateFlag = 0; 242 this.updateFlag = 0;
243 } 243 }
244 if (this.updateFlag == 2) //some change has been made so update the clients 244 if (this.updateFlag == 2) //some change has been made so update the clients
245 { 245 {
246 this.SendTerseUpdateToALLClients(); 246 this.SendTerseUpdateToALLClients();
247 this.updateFlag = 0; 247 this.updateFlag = 0;
248 } 248 }
249 249
250 foreach (EntityBase child in children) 250 foreach (EntityBase child in children)
251 { 251 {
252 child.update(); 252 child.update();
253 } 253 }
254 } 254 }
255 #endregion 255 #endregion
256 256
257 #region Setup 257 #region Setup
258 /// <summary> 258 /// <summary>
259 /// 259 ///
260 /// </summary> 260 /// </summary>
261 /// <param name="addPacket"></param> 261 /// <param name="addPacket"></param>
262 /// <param name="ownerID"></param> 262 /// <param name="ownerID"></param>
263 /// <param name="localID"></param> 263 /// <param name="localID"></param>
264 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 264 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
265 { 265 {
266 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 266 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
267 this.OwnerID = ownerID; 267 this.OwnerID = ownerID;
268 this.CreatorID = this.OwnerID; 268 this.CreatorID = this.OwnerID;
269 this.LastOwnerID = LLUUID.Zero; 269 this.LastOwnerID = LLUUID.Zero;
270 this.Pos = pos; 270 this.Pos = pos;
271 this.uuid = LLUUID.Random(); 271 this.uuid = LLUUID.Random();
272 this.m_localId = (uint)(localID); 272 this.m_localId = (uint)(localID);
273 273
274 this.m_Shape = shape; 274 this.m_Shape = shape;
275 this.updateFlag = 1; 275 this.updateFlag = 1;
276 } 276 }
277 277
278 #endregion 278 #endregion
279 279
280 #region Linking / unlinking 280 #region Linking / unlinking
281 /// <summary> 281 /// <summary>
282 /// 282 ///
283 /// </summary> 283 /// </summary>
284 /// <param name="linkObject"></param> 284 /// <param name="linkObject"></param>
285 public void AddNewChildren(SceneObject linkObject) 285 public void AddNewChildren(SceneObject linkObject)
286 { 286 {
287 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); 287 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
288 //TODO check permissions 288 //TODO check permissions
289 this.children.Add(linkObject.rootPrimitive); 289 this.children.Add(linkObject.rootPrimitive);
290 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); 290 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent);
291 291
292 this.m_world.DeleteEntity(linkObject.rootUUID); 292 this.m_world.DeleteEntity(linkObject.rootUUID);
293 linkObject.DeleteAllChildren(); 293 linkObject.DeleteAllChildren();
294 294
295 this.OnPrimCountTainted(); 295 this.OnPrimCountTainted();
296 } 296 }
297 297
298 /// <summary> 298 /// <summary>
299 /// 299 ///
300 /// </summary> 300 /// </summary>
301 /// <param name="newParent"></param> 301 /// <param name="newParent"></param>
302 /// <param name="rootParent"></param> 302 /// <param name="rootParent"></param>
303 public void SetNewParent(Primitive newParent, SceneObject rootParent) 303 public void SetNewParent(Primitive newParent, SceneObject rootParent)
304 { 304 {
305 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 305 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
306 this.m_isRootPrim = false; 306 this.m_isRootPrim = false;
307 this.m_Parent = newParent; 307 this.m_Parent = newParent;
308 this.ParentID = newParent.LocalId; 308 this.ParentID = newParent.LocalId;
309 this.m_RootParent = rootParent; 309 this.m_RootParent = rootParent;
310 this.m_RootParent.AddChildToList(this); 310 this.m_RootParent.AddChildToList(this);
311 this.Pos = oldPos; 311 this.Pos = oldPos;
312 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 312 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z);
313 axPos = this.m_Parent.Rotation.Inverse() * axPos; 313 axPos = this.m_Parent.Rotation.Inverse() * axPos;
314 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 314 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
315 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 315 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
316 this.Rotation = this.m_Parent.Rotation.Inverse() * this.Rotation; 316 this.Rotation = this.m_Parent.Rotation.Inverse() * this.Rotation;
317 this.updateFlag = 1; 317 this.updateFlag = 1;
318 318
319 foreach (Primitive child in children) 319 foreach (Primitive child in children)
320 { 320 {
321 child.SetRootParent(rootParent, newParent, oldPos, oldRot); 321 child.SetRootParent(rootParent, newParent, oldPos, oldRot);
322 } 322 }
323 children.Clear(); 323 children.Clear();
324 324
325 325
326 } 326 }
327 327
328 /// <summary> 328 /// <summary>
329 /// 329 ///
330 /// </summary> 330 /// </summary>
331 /// <param name="newRoot"></param> 331 /// <param name="newRoot"></param>
332 public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition, Axiom.Math.Quaternion oldParentRotation) 332 public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition, Axiom.Math.Quaternion oldParentRotation)
333 { 333 {
334 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 334 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
335 Axiom.Math.Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); 335 Axiom.Math.Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z);
336 axOldPos = oldParentRotation * axOldPos; 336 axOldPos = oldParentRotation * axOldPos;
337 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); 337 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z);
338 oldPos += oldParentPosition; 338 oldPos += oldParentPosition;
339 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 339 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
340 this.m_isRootPrim = false; 340 this.m_isRootPrim = false;
341 this.m_Parent = newParent; 341 this.m_Parent = newParent;
342 this.ParentID = newParent.LocalId; 342 this.ParentID = newParent.LocalId;
343 newParent.AddToChildrenList(this); 343 newParent.AddToChildrenList(this);
344 this.m_RootParent = newRoot; 344 this.m_RootParent = newRoot;
345 this.m_RootParent.AddChildToList(this); 345 this.m_RootParent.AddChildToList(this);
346 this.Pos = oldPos; 346 this.Pos = oldPos;
347 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 347 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z);
348 axPos = this.m_Parent.Rotation.Inverse() * axPos; 348 axPos = this.m_Parent.Rotation.Inverse() * axPos;
349 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 349 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
350 this.Rotation = oldParentRotation * this.Rotation; 350 this.Rotation = oldParentRotation * this.Rotation;
351 this.Rotation = this.m_Parent.Rotation.Inverse()* this.Rotation ; 351 this.Rotation = this.m_Parent.Rotation.Inverse()* this.Rotation ;
352 this.updateFlag = 1; 352 this.updateFlag = 1;
353 foreach (Primitive child in children) 353 foreach (Primitive child in children)
354 { 354 {
355 child.SetRootParent(newRoot, newParent, oldPos, oldRot); 355 child.SetRootParent(newRoot, newParent, oldPos, oldRot);
356 } 356 }
357 children.Clear(); 357 children.Clear();
358 } 358 }
359 359
360 /// <summary> 360 /// <summary>
361 /// 361 ///
362 /// </summary> 362 /// </summary>
363 /// <param name="offset"></param> 363 /// <param name="offset"></param>
364 public void AddOffsetToChildren(LLVector3 offset) 364 public void AddOffsetToChildren(LLVector3 offset)
365 { 365 {
366 foreach (Primitive prim in this.children) 366 foreach (Primitive prim in this.children)
367 { 367 {
368 prim.m_pos += offset; 368 prim.m_pos += offset;
369 prim.updateFlag = 2; 369 prim.updateFlag = 2;
370 } 370 }
371 this.OnPrimCountTainted(); 371 this.OnPrimCountTainted();
372 } 372 }
373 373
374 /// <summary> 374 /// <summary>
375 /// 375 ///
376 /// </summary> 376 /// </summary>
377 /// <param name="prim"></param> 377 /// <param name="prim"></param>
378 public void AddToChildrenList(Primitive prim) 378 public void AddToChildrenList(Primitive prim)
379 { 379 {
380 this.children.Add(prim); 380 this.children.Add(prim);
381 } 381 }
382 #endregion 382 #endregion
383 383
384 #region Resizing/Scale 384 #region Resizing/Scale
385 /// <summary> 385 /// <summary>
386 /// 386 ///
387 /// </summary> 387 /// </summary>
388 /// <param name="scale"></param> 388 /// <param name="scale"></param>
389 public void ResizeGoup(LLVector3 scale) 389 public void ResizeGoup(LLVector3 scale)
390 { 390 {
391 LLVector3 offset = (scale - this.m_Shape.Scale); 391 LLVector3 offset = (scale - this.m_Shape.Scale);
392 offset.X /= 2; 392 offset.X /= 2;
393 offset.Y /= 2; 393 offset.Y /= 2;
394 offset.Z /= 2; 394 offset.Z /= 2;
395 if (this.m_isRootPrim) 395 if (this.m_isRootPrim)
396 { 396 {
397 this.m_Parent.Pos += offset; 397 this.m_Parent.Pos += offset;
398 } 398 }
399 else 399 else
400 { 400 {
401 this.m_pos += offset; 401 this.m_pos += offset;
402 } 402 }
403 403
404 this.AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z)); 404 this.AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z));
405 this.m_Shape.Scale = scale; 405 this.m_Shape.Scale = scale;
406 406
407 this.updateFlag = 1; 407 this.updateFlag = 1;
408 } 408 }
409 #endregion 409 #endregion
410 410
411 #region Position 411 #region Position
412 /// <summary> 412 /// <summary>
413 /// 413 ///
414 /// </summary> 414 /// </summary>
415 /// <param name="pos"></param> 415 /// <param name="pos"></param>
416 public void UpdateGroupPosition(LLVector3 pos) 416 public void UpdateGroupPosition(LLVector3 pos)
417 { 417 {
418 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 418 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
419 419
420 this.Pos = newPos; 420 this.Pos = newPos;
421 this.updateFlag = 2; 421 this.updateFlag = 2;
422 422
423 this.OnPrimCountTainted(); 423 this.OnPrimCountTainted();
424 } 424 }
425 425
426 /// <summary> 426 /// <summary>
427 /// 427 ///
428 /// </summary> 428 /// </summary>
429 /// <param name="pos"></param> 429 /// <param name="pos"></param>
430 public void UpdateSinglePosition(LLVector3 pos) 430 public void UpdateSinglePosition(LLVector3 pos)
431 { 431 {
432 // Console.WriteLine("updating single prim position"); 432 // Console.WriteLine("updating single prim position");
433 if (this.m_isRootPrim) 433 if (this.m_isRootPrim)
434 { 434 {
435 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 435 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
436 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); 436 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
437 LLVector3 diff = oldPos - newPos; 437 LLVector3 diff = oldPos - newPos;
438 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 438 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
439 axDiff = this.Rotation.Inverse() * axDiff; 439 axDiff = this.Rotation.Inverse() * axDiff;
440 diff.X = axDiff.x; 440 diff.X = axDiff.x;
441 diff.Y = axDiff.y; 441 diff.Y = axDiff.y;
442 diff.Z = axDiff.z; 442 diff.Z = axDiff.z;
443 this.Pos = newPos; 443 this.Pos = newPos;
444 444
445 foreach (Primitive prim in this.children) 445 foreach (Primitive prim in this.children)
446 { 446 {
447 prim.m_pos += diff; 447 prim.m_pos += diff;
448 prim.updateFlag = 2; 448 prim.updateFlag = 2;
449 } 449 }
450 this.updateFlag = 2; 450 this.updateFlag = 2;
451 } 451 }
452 else 452 else
453 { 453 {
454 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 454 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
455 this.m_pos = newPos; 455 this.m_pos = newPos;
456 this.updateFlag = 2; 456 this.updateFlag = 2;
457 } 457 }
458 458
459 459
460 } 460 }
461 461
462 #endregion 462 #endregion
463 463
464 #region Rotation 464 #region Rotation
465 /// <summary> 465 /// <summary>
466 /// 466 ///
467 /// </summary> 467 /// </summary>
468 /// <param name="rot"></param> 468 /// <param name="rot"></param>
469 public void UpdateGroupRotation(LLQuaternion rot) 469 public void UpdateGroupRotation(LLQuaternion rot)
470 { 470 {
471 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 471 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
472 this.updateFlag = 2; 472 this.updateFlag = 2;
473 473
474 } 474 }
475 475
476 /// <summary> 476 /// <summary>
477 /// 477 ///
478 /// </summary> 478 /// </summary>
479 /// <param name="pos"></param> 479 /// <param name="pos"></param>
480 /// <param name="rot"></param> 480 /// <param name="rot"></param>
481 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) 481 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
482 { 482 {
483 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 483 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
484 this.Pos = pos; 484 this.Pos = pos;
485 this.updateFlag = 2; 485 this.updateFlag = 2;
486 } 486 }
487 487
488 /// <summary> 488 /// <summary>
489 /// 489 ///
490 /// </summary> 490 /// </summary>
491 /// <param name="rot"></param> 491 /// <param name="rot"></param>
492 public void UpdateSingleRotation(LLQuaternion rot) 492 public void UpdateSingleRotation(LLQuaternion rot)
493 { 493 {
494 //Console.WriteLine("updating single prim rotation"); 494 //Console.WriteLine("updating single prim rotation");
495 Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 495 Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
496 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 496 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
497 this.Rotation = axRot; 497 this.Rotation = axRot;
498 foreach (Primitive prim in this.children) 498 foreach (Primitive prim in this.children)
499 { 499 {
500 Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); 500 Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
501 axPos = oldParentRot * axPos; 501 axPos = oldParentRot * axPos;
502 axPos = axRot.Inverse() * axPos; 502 axPos = axRot.Inverse() * axPos;
503 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 503 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
504 prim.Rotation = oldParentRot * prim.Rotation ; 504 prim.Rotation = oldParentRot * prim.Rotation ;
505 prim.Rotation = axRot.Inverse()* prim.Rotation; 505 prim.Rotation = axRot.Inverse()* prim.Rotation;
506 prim.updateFlag = 2; 506 prim.updateFlag = 2;
507 } 507 }
508 this.updateFlag = 2; 508 this.updateFlag = 2;
509 } 509 }
510 #endregion 510 #endregion
511 511
512 #region Shape 512 #region Shape
513 /// <summary> 513 /// <summary>
514 /// 514 ///
515 /// </summary> 515 /// </summary>
516 /// <param name="shapeBlock"></param> 516 /// <param name="shapeBlock"></param>
517 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) 517 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
518 { 518 {
519 this.m_Shape.PathBegin = shapeBlock.PathBegin; 519 this.m_Shape.PathBegin = shapeBlock.PathBegin;
520 this.m_Shape.PathEnd = shapeBlock.PathEnd; 520 this.m_Shape.PathEnd = shapeBlock.PathEnd;
521 this.m_Shape.PathScaleX = shapeBlock.PathScaleX; 521 this.m_Shape.PathScaleX = shapeBlock.PathScaleX;
522 this.m_Shape.PathScaleY = shapeBlock.PathScaleY; 522 this.m_Shape.PathScaleY = shapeBlock.PathScaleY;
523 this.m_Shape.PathShearX = shapeBlock.PathShearX; 523 this.m_Shape.PathShearX = shapeBlock.PathShearX;
524 this.m_Shape.PathShearY = shapeBlock.PathShearY; 524 this.m_Shape.PathShearY = shapeBlock.PathShearY;
525 this.m_Shape.PathSkew = shapeBlock.PathSkew; 525 this.m_Shape.PathSkew = shapeBlock.PathSkew;
526 this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin; 526 this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin;
527 this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd; 527 this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd;
528 this.m_Shape.PathCurve = shapeBlock.PathCurve; 528 this.m_Shape.PathCurve = shapeBlock.PathCurve;
529 this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve; 529 this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve;
530 this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow; 530 this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow;
531 this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; 531 this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
532 this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions; 532 this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions;
533 this.m_Shape.PathTaperX = shapeBlock.PathTaperX; 533 this.m_Shape.PathTaperX = shapeBlock.PathTaperX;
534 this.m_Shape.PathTaperY = shapeBlock.PathTaperY; 534 this.m_Shape.PathTaperY = shapeBlock.PathTaperY;
535 this.m_Shape.PathTwist = shapeBlock.PathTwist; 535 this.m_Shape.PathTwist = shapeBlock.PathTwist;
536 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; 536 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin;
537 this.updateFlag = 1; 537 this.updateFlag = 1;
538 } 538 }
539 #endregion 539 #endregion
540 540
541 #region Texture 541 #region Texture
542 /// <summary> 542 /// <summary>
543 /// 543 ///
544 /// </summary> 544 /// </summary>
545 /// <param name="textureEntry"></param> 545 /// <param name="textureEntry"></param>
546 public void UpdateTextureEntry(byte[] textureEntry) 546 public void UpdateTextureEntry(byte[] textureEntry)
547 { 547 {
548 this.m_Shape.TextureEntry = textureEntry; 548 this.m_Shape.TextureEntry = textureEntry;
549 this.updateFlag = 1; 549 this.updateFlag = 1;
550 } 550 }
551 #endregion 551 #endregion
552 552
553 #region Client Update Methods 553 #region Client Update Methods
554 554
555 /// <summary> 555 /// <summary>
556 /// 556 ///
557 /// </summary> 557 /// </summary>
558 /// <param name="remoteClient"></param> 558 /// <param name="remoteClient"></param>
559 public void SendFullUpdateForAllChildren(IClientAPI remoteClient) 559 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
560 { 560 {
561 this.SendFullUpdateToClient(remoteClient); 561 this.SendFullUpdateToClient(remoteClient);
562 for (int i = 0; i < this.children.Count; i++) 562 for (int i = 0; i < this.children.Count; i++)
563 { 563 {
564 if (this.children[i] is Primitive) 564 if (this.children[i] is Primitive)
565 { 565 {
566 ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient); 566 ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient);
567 } 567 }
568 } 568 }
569 } 569 }
570 570
571 /// <summary> 571 /// <summary>
572 /// 572 ///
573 /// </summary> 573 /// </summary>
574 /// <param name="remoteClient"></param> 574 /// <param name="remoteClient"></param>
575 public void SendFullUpdateToClient(IClientAPI remoteClient) 575 public void SendFullUpdateToClient(IClientAPI remoteClient)
576 { 576 {
577 LLVector3 lPos; 577 LLVector3 lPos;
578 lPos = this.Pos; 578 lPos = this.Pos;
579 LLQuaternion lRot; 579 LLQuaternion lRot;
580 lRot = new LLQuaternion(this.Rotation.x, this.Rotation.y, this.Rotation.z, this.Rotation.w); 580 lRot = new LLQuaternion(this.Rotation.x, this.Rotation.y, this.Rotation.z, this.Rotation.w);
581 581
582 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, this.m_flags, this.uuid, this.OwnerID, this.Text, this.ParentID); 582 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, this.m_flags, this.uuid, this.OwnerID, this.Text, this.ParentID);
583 } 583 }
584 584
585 /// <summary> 585 /// <summary>
586 /// 586 ///
587 /// </summary> 587 /// </summary>
588 public void SendFullUpdateToAllClients() 588 public void SendFullUpdateToAllClients()
589 { 589 {
590 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 590 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
591 for (int i = 0; i < avatars.Count; i++) 591 for (int i = 0; i < avatars.Count; i++)
592 { 592 {
593 this.SendFullUpdateToClient(avatars[i].ControllingClient); 593 this.SendFullUpdateToClient(avatars[i].ControllingClient);
594 } 594 }
595 } 595 }
596 596
597 /// <summary> 597 /// <summary>
598 /// 598 ///
599 /// </summary> 599 /// </summary>
600 /// <param name="remoteClient"></param> 600 /// <param name="remoteClient"></param>
601 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) 601 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
602 { 602 {
603 this.SendTerseUpdateToClient(remoteClient); 603 this.SendTerseUpdateToClient(remoteClient);
604 for (int i = 0; i < this.children.Count; i++) 604 for (int i = 0; i < this.children.Count; i++)
605 { 605 {
606 if (this.children[i] is Primitive) 606 if (this.children[i] is Primitive)
607 { 607 {
608 ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient); 608 ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient);
609 } 609 }
610 } 610 }
611 } 611 }
612 612
613 /// <summary> 613 /// <summary>
614 /// 614 ///
615 /// </summary> 615 /// </summary>
616 /// <param name="RemoteClient"></param> 616 /// <param name="RemoteClient"></param>
617 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 617 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
618 { 618 {
619 LLVector3 lPos; 619 LLVector3 lPos;
620 Quaternion lRot; 620 Quaternion lRot;
621 621
622 lPos = this.Pos; 622 lPos = this.Pos;
623 lRot = this.Rotation; 623 lRot = this.Rotation;
624 624
625 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); 625 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
626 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); 626 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot);
627 } 627 }
628 628
629 /// <summary> 629 /// <summary>
630 /// 630 ///
631 /// </summary> 631 /// </summary>
632 public void SendTerseUpdateToALLClients() 632 public void SendTerseUpdateToALLClients()
633 { 633 {
634 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 634 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
635 for (int i = 0; i < avatars.Count; i++) 635 for (int i = 0; i < avatars.Count; i++)
636 { 636 {
637 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 637 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
638 } 638 }
639 } 639 }
640 640
641 #endregion 641 #endregion
642 642
643 public void TriggerOnPrimCountTainted() 643 public void TriggerOnPrimCountTainted()
644 { 644 {
645 this.OnPrimCountTainted(); 645 this.OnPrimCountTainted();
646 } 646 }
647 } 647 }
648} 648}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 347625a..e37d105 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -1,618 +1,618 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34 34
35namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
37 public partial class Scene 37 public partial class Scene
38 { 38 {
39 /// <summary> 39 /// <summary>
40 /// Modifies terrain using the specified information 40 /// Modifies terrain using the specified information
41 /// </summary> 41 /// </summary>
42 /// <param name="height">The height at which the user started modifying the terrain</param> 42 /// <param name="height">The height at which the user started modifying the terrain</param>
43 /// <param name="seconds">The number of seconds the modify button was pressed</param> 43 /// <param name="seconds">The number of seconds the modify button was pressed</param>
44 /// <param name="brushsize">The size of the brush used</param> 44 /// <param name="brushsize">The size of the brush used</param>
45 /// <param name="action">The action to be performed</param> 45 /// <param name="action">The action to be performed</param>
46 /// <param name="north">Distance from the north border where the cursor is located</param> 46 /// <param name="north">Distance from the north border where the cursor is located</param>
47 /// <param name="west">Distance from the west border where the cursor is located</param> 47 /// <param name="west">Distance from the west border where the cursor is located</param>
48 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west) 48 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west)
49 { 49 {
50 // Shiny. 50 // Shiny.
51 double size = (double)(1 << brushsize); 51 double size = (double)(1 << brushsize);
52 52
53 switch (action) 53 switch (action)
54 { 54 {
55 case 0: 55 case 0:
56 // flatten terrain 56 // flatten terrain
57 Terrain.flatten(north, west, size, (double)seconds / 100.0); 57 Terrain.flatten(north, west, size, (double)seconds / 100.0);
58 RegenerateTerrain(true, (int)north, (int)west); 58 RegenerateTerrain(true, (int)north, (int)west);
59 break; 59 break;
60 case 1: 60 case 1:
61 // raise terrain 61 // raise terrain
62 Terrain.raise(north, west, size, (double)seconds / 100.0); 62 Terrain.raise(north, west, size, (double)seconds / 100.0);
63 RegenerateTerrain(true, (int)north, (int)west); 63 RegenerateTerrain(true, (int)north, (int)west);
64 break; 64 break;
65 case 2: 65 case 2:
66 //lower terrain 66 //lower terrain
67 Terrain.lower(north, west, size, (double)seconds / 100.0); 67 Terrain.lower(north, west, size, (double)seconds / 100.0);
68 RegenerateTerrain(true, (int)north, (int)west); 68 RegenerateTerrain(true, (int)north, (int)west);
69 break; 69 break;
70 case 3: 70 case 3:
71 // smooth terrain 71 // smooth terrain
72 Terrain.smooth(north, west, size, (double)seconds / 100.0); 72 Terrain.smooth(north, west, size, (double)seconds / 100.0);
73 RegenerateTerrain(true, (int)north, (int)west); 73 RegenerateTerrain(true, (int)north, (int)west);
74 break; 74 break;
75 case 4: 75 case 4:
76 // noise 76 // noise
77 Terrain.noise(north, west, size, (double)seconds / 100.0); 77 Terrain.noise(north, west, size, (double)seconds / 100.0);
78 RegenerateTerrain(true, (int)north, (int)west); 78 RegenerateTerrain(true, (int)north, (int)west);
79 break; 79 break;
80 case 5: 80 case 5:
81 // revert 81 // revert
82 Terrain.revert(north, west, size, (double)seconds / 100.0); 82 Terrain.revert(north, west, size, (double)seconds / 100.0);
83 RegenerateTerrain(true, (int)north, (int)west); 83 RegenerateTerrain(true, (int)north, (int)west);
84 break; 84 break;
85 85
86 // CLIENT EXTENSIONS GO HERE 86 // CLIENT EXTENSIONS GO HERE
87 case 128: 87 case 128:
88 // erode-thermal 88 // erode-thermal
89 break; 89 break;
90 case 129: 90 case 129:
91 // erode-aerobic 91 // erode-aerobic
92 break; 92 break;
93 case 130: 93 case 130:
94 // erode-hydraulic 94 // erode-hydraulic
95 break; 95 break;
96 } 96 }
97 return; 97 return;
98 } 98 }
99 99
100 /// <summary> 100 /// <summary>
101 /// 101 ///
102 /// </summary> 102 /// </summary>
103 /// <remarks>Inefficient. TODO: Fixme</remarks> 103 /// <remarks>Inefficient. TODO: Fixme</remarks>
104 /// <param name="fromAgentID"></param> 104 /// <param name="fromAgentID"></param>
105 /// <param name="toAgentID"></param> 105 /// <param name="toAgentID"></param>
106 /// <param name="timestamp"></param> 106 /// <param name="timestamp"></param>
107 /// <param name="fromAgentName"></param> 107 /// <param name="fromAgentName"></param>
108 /// <param name="message"></param> 108 /// <param name="message"></param>
109 public void InstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message) 109 public void InstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message)
110 { 110 {
111 if (this.Avatars.ContainsKey(toAgentID)) 111 if (this.Avatars.ContainsKey(toAgentID))
112 { 112 {
113 if (this.Avatars.ContainsKey(fromAgentID)) 113 if (this.Avatars.ContainsKey(fromAgentID))
114 { 114 {
115 // Local sim message 115 // Local sim message
116 ScenePresence fromAvatar = this.Avatars[fromAgentID]; 116 ScenePresence fromAvatar = this.Avatars[fromAgentID];
117 ScenePresence toAvatar = this.Avatars[toAgentID]; 117 ScenePresence toAvatar = this.Avatars[toAgentID];
118 string fromName = fromAvatar.firstname + " " + fromAvatar.lastname; 118 string fromName = fromAvatar.firstname + " " + fromAvatar.lastname;
119 toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName); 119 toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName);
120 } 120 }
121 else 121 else
122 { 122 {
123 // Message came from a user outside the sim, ignore? 123 // Message came from a user outside the sim, ignore?
124 } 124 }
125 } 125 }
126 else 126 else
127 { 127 {
128 // Grid message 128 // Grid message
129 } 129 }
130 } 130 }
131 131
132 /// <summary> 132 /// <summary>
133 /// 133 ///
134 /// </summary> 134 /// </summary>
135 /// <param name="message"></param> 135 /// <param name="message"></param>
136 /// <param name="type"></param> 136 /// <param name="type"></param>
137 /// <param name="fromPos"></param> 137 /// <param name="fromPos"></param>
138 /// <param name="fromName"></param> 138 /// <param name="fromName"></param>
139 /// <param name="fromAgentID"></param> 139 /// <param name="fromAgentID"></param>
140 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 140 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
141 { 141 {
142 ScenePresence avatar = null; 142 ScenePresence avatar = null;
143 if (this.Avatars.ContainsKey(fromAgentID)) 143 if (this.Avatars.ContainsKey(fromAgentID))
144 { 144 {
145 avatar = this.Avatars[fromAgentID]; 145 avatar = this.Avatars[fromAgentID];
146 fromPos = avatar.Pos; 146 fromPos = avatar.Pos;
147 fromName = avatar.firstname + " " + avatar.lastname; 147 fromName = avatar.firstname + " " + avatar.lastname;
148 avatar = null; 148 avatar = null;
149 } 149 }
150 150
151 this.ForEachScenePresence(delegate(ScenePresence presence) 151 this.ForEachScenePresence(delegate(ScenePresence presence)
152 { 152 {
153 int dis = -1000; 153 int dis = -1000;
154 if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) 154 if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId))
155 { 155 {
156 avatar = this.Avatars[presence.ControllingClient.AgentId]; 156 avatar = this.Avatars[presence.ControllingClient.AgentId];
157 dis = (int)avatar.Pos.GetDistanceTo(fromPos); 157 dis = (int)avatar.Pos.GetDistanceTo(fromPos);
158 } 158 }
159 159
160 switch (type) 160 switch (type)
161 { 161 {
162 case 0: // Whisper 162 case 0: // Whisper
163 if ((dis < 10) && (dis > -10)) 163 if ((dis < 10) && (dis > -10))
164 { 164 {
165 //should change so the message is sent through the avatar rather than direct to the ClientView 165 //should change so the message is sent through the avatar rather than direct to the ClientView
166 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, 166 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
167 fromAgentID); 167 fromAgentID);
168 } 168 }
169 break; 169 break;
170 case 1: // Say 170 case 1: // Say
171 if ((dis < 30) && (dis > -30)) 171 if ((dis < 30) && (dis > -30))
172 { 172 {
173 //Console.WriteLine("sending chat"); 173 //Console.WriteLine("sending chat");
174 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, 174 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
175 fromAgentID); 175 fromAgentID);
176 } 176 }
177 break; 177 break;
178 case 2: // Shout 178 case 2: // Shout
179 if ((dis < 100) && (dis > -100)) 179 if ((dis < 100) && (dis > -100))
180 { 180 {
181 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, 181 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
182 fromAgentID); 182 fromAgentID);
183 } 183 }
184 break; 184 break;
185 185
186 case 0xff: // Broadcast 186 case 0xff: // Broadcast
187 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, 187 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
188 fromAgentID); 188 fromAgentID);
189 break; 189 break;
190 } 190 }
191 }); 191 });
192 } 192 }
193 193
194 /// <summary> 194 /// <summary>
195 /// 195 ///
196 /// </summary> 196 /// </summary>
197 /// <param name="primAsset"></param> 197 /// <param name="primAsset"></param>
198 /// <param name="pos"></param> 198 /// <param name="pos"></param>
199 public void RezObject(AssetBase primAsset, LLVector3 pos) 199 public void RezObject(AssetBase primAsset, LLVector3 pos)
200 { 200 {
201 201
202 } 202 }
203 203
204 /// <summary> 204 /// <summary>
205 /// 205 ///
206 /// </summary> 206 /// </summary>
207 /// <param name="packet"></param> 207 /// <param name="packet"></param>
208 /// <param name="simClient"></param> 208 /// <param name="simClient"></param>
209 public void DeRezObject(Packet packet, IClientAPI simClient) 209 public void DeRezObject(Packet packet, IClientAPI simClient)
210 { 210 {
211 211
212 } 212 }
213 213
214 /// <summary> 214 /// <summary>
215 /// 215 ///
216 /// </summary> 216 /// </summary>
217 /// <param name="remoteClient"></param> 217 /// <param name="remoteClient"></param>
218 public void SendAvatarsToClient(IClientAPI remoteClient) 218 public void SendAvatarsToClient(IClientAPI remoteClient)
219 { 219 {
220 220
221 } 221 }
222 222
223 /// <summary> 223 /// <summary>
224 /// 224 ///
225 /// </summary> 225 /// </summary>
226 /// <param name="originalPrim"></param> 226 /// <param name="originalPrim"></param>
227 /// <param name="offset"></param> 227 /// <param name="offset"></param>
228 /// <param name="flags"></param> 228 /// <param name="flags"></param>
229 public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags) 229 public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags)
230 { 230 {
231 SceneObject originPrim = null; 231 SceneObject originPrim = null;
232 foreach (EntityBase ent in Entities.Values) 232 foreach (EntityBase ent in Entities.Values)
233 { 233 {
234 if (ent is SceneObject) 234 if (ent is SceneObject)
235 { 235 {
236 if (((SceneObject)ent).rootLocalID == originalPrim) 236 if (((SceneObject)ent).rootLocalID == originalPrim)
237 { 237 {
238 originPrim = (SceneObject)ent; 238 originPrim = (SceneObject)ent;
239 break; 239 break;
240 } 240 }
241 } 241 }
242 } 242 }
243 243
244 if (originPrim != null) 244 if (originPrim != null)
245 { 245 {
246 SceneObject copy = originPrim.Copy(); 246 SceneObject copy = originPrim.Copy();
247 copy.Pos = copy.Pos + offset; 247 copy.Pos = copy.Pos + offset;
248 this.Entities.Add(copy.rootUUID, copy); 248 this.Entities.Add(copy.rootUUID, copy);
249 249
250 List<ScenePresence> avatars = this.RequestAvatarList(); 250 List<ScenePresence> avatars = this.RequestAvatarList();
251 for (int i = 0; i < avatars.Count; i++) 251 for (int i = 0; i < avatars.Count; i++)
252 { 252 {
253 copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); 253 copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
254 } 254 }
255 255
256 } 256 }
257 else 257 else
258 { 258 {
259 OpenSim.Framework.Console.MainLog.Instance.Warn("Attempted to duplicate nonexistant prim"); 259 OpenSim.Framework.Console.MainLog.Instance.Warn("Attempted to duplicate nonexistant prim");
260 } 260 }
261 261
262 } 262 }
263 263
264 /// <summary> 264 /// <summary>
265 /// 265 ///
266 /// </summary> 266 /// </summary>
267 /// <param name="parentPrim"></param> 267 /// <param name="parentPrim"></param>
268 /// <param name="childPrims"></param> 268 /// <param name="childPrims"></param>
269 public void LinkObjects(uint parentPrim, List<uint> childPrims) 269 public void LinkObjects(uint parentPrim, List<uint> childPrims)
270 { 270 {
271 SceneObject parenPrim = null; 271 SceneObject parenPrim = null;
272 foreach (EntityBase ent in Entities.Values) 272 foreach (EntityBase ent in Entities.Values)
273 { 273 {
274 if (ent is SceneObject) 274 if (ent is SceneObject)
275 { 275 {
276 if (((SceneObject)ent).rootLocalID == parentPrim) 276 if (((SceneObject)ent).rootLocalID == parentPrim)
277 { 277 {
278 parenPrim = (SceneObject)ent; 278 parenPrim = (SceneObject)ent;
279 break; 279 break;
280 } 280 }
281 } 281 }
282 } 282 }
283 283
284 List<SceneObject> children = new List<SceneObject>(); 284 List<SceneObject> children = new List<SceneObject>();
285 if (parenPrim != null) 285 if (parenPrim != null)
286 { 286 {
287 for (int i = 0; i < childPrims.Count; i++) 287 for (int i = 0; i < childPrims.Count; i++)
288 { 288 {
289 foreach (EntityBase ent in Entities.Values) 289 foreach (EntityBase ent in Entities.Values)
290 { 290 {
291 if (ent is SceneObject) 291 if (ent is SceneObject)
292 { 292 {
293 if (((SceneObject)ent).rootLocalID == childPrims[i]) 293 if (((SceneObject)ent).rootLocalID == childPrims[i])
294 { 294 {
295 children.Add((SceneObject)ent); 295 children.Add((SceneObject)ent);
296 } 296 }
297 } 297 }
298 } 298 }
299 } 299 }
300 } 300 }
301 301
302 foreach (SceneObject sceneObj in children) 302 foreach (SceneObject sceneObj in children)
303 { 303 {
304 parenPrim.AddNewChildPrims(sceneObj); 304 parenPrim.AddNewChildPrims(sceneObj);
305 } 305 }
306 } 306 }
307 307
308 /// <summary> 308 /// <summary>
309 /// 309 ///
310 /// </summary> 310 /// </summary>
311 /// <param name="primLocalID"></param> 311 /// <param name="primLocalID"></param>
312 /// <param name="shapeBlock"></param> 312 /// <param name="shapeBlock"></param>
313 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) 313 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
314 { 314 {
315 Primitive prim = null; 315 Primitive prim = null;
316 foreach (EntityBase ent in Entities.Values) 316 foreach (EntityBase ent in Entities.Values)
317 { 317 {
318 if (ent is SceneObject) 318 if (ent is SceneObject)
319 { 319 {
320 prim = ((SceneObject)ent).HasChildPrim(primLocalID); 320 prim = ((SceneObject)ent).HasChildPrim(primLocalID);
321 if (prim != null) 321 if (prim != null)
322 { 322 {
323 prim.UpdateShape(shapeBlock); 323 prim.UpdateShape(shapeBlock);
324 break; 324 break;
325 } 325 }
326 } 326 }
327 } 327 }
328 } 328 }
329 329
330 /// <summary> 330 /// <summary>
331 /// 331 ///
332 /// </summary> 332 /// </summary>
333 /// <param name="primLocalID"></param> 333 /// <param name="primLocalID"></param>
334 /// <param name="remoteClient"></param> 334 /// <param name="remoteClient"></param>
335 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 335 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
336 { 336 {
337 foreach (EntityBase ent in Entities.Values) 337 foreach (EntityBase ent in Entities.Values)
338 { 338 {
339 if (ent is SceneObject) 339 if (ent is SceneObject)
340 { 340 {
341 if (((SceneObject)ent).rootLocalID == primLocalID) 341 if (((SceneObject)ent).rootLocalID == primLocalID)
342 { 342 {
343 ((SceneObject)ent).GetProperites(remoteClient); 343 ((SceneObject)ent).GetProperites(remoteClient);
344 ((SceneObject)ent).isSelected = true; 344 ((SceneObject)ent).isSelected = true;
345 this.ParcelManager.setPrimsTainted(); 345 this.ParcelManager.setPrimsTainted();
346 break; 346 break;
347 } 347 }
348 } 348 }
349 } 349 }
350 } 350 }
351 351
352 /// <summary> 352 /// <summary>
353 /// 353 ///
354 /// </summary> 354 /// </summary>
355 /// <param name="primLocalID"></param> 355 /// <param name="primLocalID"></param>
356 /// <param name="remoteClient"></param> 356 /// <param name="remoteClient"></param>
357 public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) 357 public void DeselectPrim(uint primLocalID, IClientAPI remoteClient)
358 { 358 {
359 foreach (EntityBase ent in Entities.Values) 359 foreach (EntityBase ent in Entities.Values)
360 { 360 {
361 if (ent is SceneObject) 361 if (ent is SceneObject)
362 { 362 {
363 if (((SceneObject)ent).rootLocalID == primLocalID) 363 if (((SceneObject)ent).rootLocalID == primLocalID)
364 { 364 {
365 ((SceneObject)ent).isSelected = false; 365 ((SceneObject)ent).isSelected = false;
366 this.ParcelManager.setPrimsTainted(); 366 this.ParcelManager.setPrimsTainted();
367 break; 367 break;
368 } 368 }
369 } 369 }
370 } 370 }
371 } 371 }
372 372
373 /// <summary> 373 /// <summary>
374 /// 374 ///
375 /// </summary> 375 /// </summary>
376 /// <param name="primLocalID"></param> 376 /// <param name="primLocalID"></param>
377 /// <param name="description"></param> 377 /// <param name="description"></param>
378 public void PrimDescription(uint primLocalID, string description) 378 public void PrimDescription(uint primLocalID, string description)
379 { 379 {
380 Primitive prim = null; 380 Primitive prim = null;
381 foreach (EntityBase ent in Entities.Values) 381 foreach (EntityBase ent in Entities.Values)
382 { 382 {
383 if (ent is SceneObject) 383 if (ent is SceneObject)
384 { 384 {
385 prim = ((SceneObject)ent).HasChildPrim(primLocalID); 385 prim = ((SceneObject)ent).HasChildPrim(primLocalID);
386 if (prim != null) 386 if (prim != null)
387 { 387 {
388 prim.Description = description; 388 prim.Description = description;
389 break; 389 break;
390 } 390 }
391 } 391 }
392 } 392 }
393 } 393 }
394 394
395 /// <summary> 395 /// <summary>
396 /// 396 ///
397 /// </summary> 397 /// </summary>
398 /// <param name="primLocalID"></param> 398 /// <param name="primLocalID"></param>
399 /// <param name="description"></param> 399 /// <param name="description"></param>
400 public void PrimName(uint primLocalID, string name) 400 public void PrimName(uint primLocalID, string name)
401 { 401 {
402 Primitive prim = null; 402 Primitive prim = null;
403 foreach (EntityBase ent in Entities.Values) 403 foreach (EntityBase ent in Entities.Values)
404 { 404 {
405 if (ent is SceneObject) 405 if (ent is SceneObject)
406 { 406 {
407 prim = ((SceneObject)ent).HasChildPrim(primLocalID); 407 prim = ((SceneObject)ent).HasChildPrim(primLocalID);
408 if (prim != null) 408 if (prim != null)
409 { 409 {
410 prim.Name = name; 410 prim.Name = name;
411 break; 411 break;
412 } 412 }
413 } 413 }
414 } 414 }
415 } 415 }
416 416
417 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 417 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
418 { 418 {
419 Primitive prim = null; 419 Primitive prim = null;
420 foreach (EntityBase ent in Entities.Values) 420 foreach (EntityBase ent in Entities.Values)
421 { 421 {
422 if (ent is SceneObject) 422 if (ent is SceneObject)
423 { 423 {
424 prim = ((SceneObject)ent).HasChildPrim(objectID); 424 prim = ((SceneObject)ent).HasChildPrim(objectID);
425 if (prim != null) 425 if (prim != null)
426 { 426 {
427 ((SceneObject)ent).GrapMovement(offset, pos, remoteClient); 427 ((SceneObject)ent).GrapMovement(offset, pos, remoteClient);
428 break; 428 break;
429 } 429 }
430 } 430 }
431 } 431 }
432 /* 432 /*
433 if (this.Entities.ContainsKey(objectID)) 433 if (this.Entities.ContainsKey(objectID))
434 { 434 {
435 if (this.Entities[objectID] is SceneObject) 435 if (this.Entities[objectID] is SceneObject)
436 { 436 {
437 ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); 437 ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
438 } 438 }
439 }*/ 439 }*/
440 } 440 }
441 441
442 /// <summary> 442 /// <summary>
443 /// 443 ///
444 /// </summary> 444 /// </summary>
445 /// <param name="localID"></param> 445 /// <param name="localID"></param>
446 /// <param name="packet"></param> 446 /// <param name="packet"></param>
447 /// <param name="remoteClient"></param> 447 /// <param name="remoteClient"></param>
448 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) 448 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
449 { 449 {
450 450
451 } 451 }
452 452
453 /// <summary> 453 /// <summary>
454 /// 454 ///
455 /// </summary> 455 /// </summary>
456 /// <param name="localID"></param> 456 /// <param name="localID"></param>
457 /// <param name="texture"></param> 457 /// <param name="texture"></param>
458 /// <param name="remoteClient"></param> 458 /// <param name="remoteClient"></param>
459 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) 459 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
460 { 460 {
461 Primitive prim = null; 461 Primitive prim = null;
462 foreach (EntityBase ent in Entities.Values) 462 foreach (EntityBase ent in Entities.Values)
463 { 463 {
464 if (ent is SceneObject) 464 if (ent is SceneObject)
465 { 465 {
466 prim = ((SceneObject)ent).HasChildPrim(localID); 466 prim = ((SceneObject)ent).HasChildPrim(localID);
467 if (prim != null) 467 if (prim != null)
468 { 468 {
469 prim.UpdateTextureEntry(texture); 469 prim.UpdateTextureEntry(texture);
470 } 470 }
471 } 471 }
472 } 472 }
473 } 473 }
474 474
475 /// <summary> 475 /// <summary>
476 /// 476 ///
477 /// </summary> 477 /// </summary>
478 /// <param name="localID"></param> 478 /// <param name="localID"></param>
479 /// <param name="pos"></param> 479 /// <param name="pos"></param>
480 /// <param name="remoteClient"></param> 480 /// <param name="remoteClient"></param>
481 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) 481 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
482 { 482 {
483 Primitive prim = null; 483 Primitive prim = null;
484 foreach (EntityBase ent in Entities.Values) 484 foreach (EntityBase ent in Entities.Values)
485 { 485 {
486 if (ent is SceneObject) 486 if (ent is SceneObject)
487 { 487 {
488 prim = ((SceneObject)ent).HasChildPrim(localID); 488 prim = ((SceneObject)ent).HasChildPrim(localID);
489 if (prim != null) 489 if (prim != null)
490 { 490 {
491 prim.UpdateGroupPosition(pos); 491 prim.UpdateGroupPosition(pos);
492 break; 492 break;
493 } 493 }
494 } 494 }
495 } 495 }
496 } 496 }
497 497
498 public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient) 498 public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
499 { 499 {
500 Primitive prim = null; 500 Primitive prim = null;
501 foreach (EntityBase ent in Entities.Values) 501 foreach (EntityBase ent in Entities.Values)
502 { 502 {
503 if (ent is SceneObject) 503 if (ent is SceneObject)
504 { 504 {
505 prim = ((SceneObject)ent).HasChildPrim(localID); 505 prim = ((SceneObject)ent).HasChildPrim(localID);
506 if (prim != null) 506 if (prim != null)
507 { 507 {
508 prim.UpdateSinglePosition(pos); 508 prim.UpdateSinglePosition(pos);
509 break; 509 break;
510 } 510 }
511 } 511 }
512 } 512 }
513 } 513 }
514 514
515 /// <summary> 515 /// <summary>
516 /// 516 ///
517 /// </summary> 517 /// </summary>
518 /// <param name="localID"></param> 518 /// <param name="localID"></param>
519 /// <param name="pos"></param> 519 /// <param name="pos"></param>
520 /// <param name="rot"></param> 520 /// <param name="rot"></param>
521 /// <param name="remoteClient"></param> 521 /// <param name="remoteClient"></param>
522 public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient) 522 public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient)
523 { 523 {
524 Primitive prim = null; 524 Primitive prim = null;
525 foreach (EntityBase ent in Entities.Values) 525 foreach (EntityBase ent in Entities.Values)
526 { 526 {
527 if (ent is SceneObject) 527 if (ent is SceneObject)
528 { 528 {
529 prim = ((SceneObject)ent).HasChildPrim(localID); 529 prim = ((SceneObject)ent).HasChildPrim(localID);
530 if (prim != null) 530 if (prim != null)
531 { 531 {
532 prim.UpdateGroupMouseRotation(pos, rot); 532 prim.UpdateGroupMouseRotation(pos, rot);
533 break; 533 break;
534 } 534 }
535 } 535 }
536 } 536 }
537 } 537 }
538 538
539 /// <summary> 539 /// <summary>
540 /// 540 ///
541 /// </summary> 541 /// </summary>
542 /// <param name="localID"></param> 542 /// <param name="localID"></param>
543 /// <param name="rot"></param> 543 /// <param name="rot"></param>
544 /// <param name="remoteClient"></param> 544 /// <param name="remoteClient"></param>
545 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) 545 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
546 { 546 {
547 Primitive prim = null; 547 Primitive prim = null;
548 foreach (EntityBase ent in Entities.Values) 548 foreach (EntityBase ent in Entities.Values)
549 { 549 {
550 if (ent is SceneObject) 550 if (ent is SceneObject)
551 { 551 {
552 prim = ((SceneObject)ent).HasChildPrim(localID); 552 prim = ((SceneObject)ent).HasChildPrim(localID);
553 if (prim != null) 553 if (prim != null)
554 { 554 {
555 prim.UpdateGroupRotation(rot); 555 prim.UpdateGroupRotation(rot);
556 break; 556 break;
557 } 557 }
558 } 558 }
559 } 559 }
560 } 560 }
561 561
562 /// <summary> 562 /// <summary>
563 /// 563 ///
564 /// </summary> 564 /// </summary>
565 /// <param name="localID"></param> 565 /// <param name="localID"></param>
566 /// <param name="rot"></param> 566 /// <param name="rot"></param>
567 /// <param name="remoteClient"></param> 567 /// <param name="remoteClient"></param>
568 public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) 568 public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
569 { 569 {
570 //Console.WriteLine("trying to update single prim rotation"); 570 //Console.WriteLine("trying to update single prim rotation");
571 Primitive prim = null; 571 Primitive prim = null;
572 foreach (EntityBase ent in Entities.Values) 572 foreach (EntityBase ent in Entities.Values)
573 { 573 {
574 if (ent is SceneObject) 574 if (ent is SceneObject)
575 { 575 {
576 prim = ((SceneObject)ent).HasChildPrim(localID); 576 prim = ((SceneObject)ent).HasChildPrim(localID);
577 if (prim != null) 577 if (prim != null)
578 { 578 {
579 prim.UpdateSingleRotation(rot); 579 prim.UpdateSingleRotation(rot);
580 break; 580 break;
581 } 581 }
582 } 582 }
583 } 583 }
584 } 584 }
585 585
586 /// <summary> 586 /// <summary>
587 /// 587 ///
588 /// </summary> 588 /// </summary>
589 /// <param name="localID"></param> 589 /// <param name="localID"></param>
590 /// <param name="scale"></param> 590 /// <param name="scale"></param>
591 /// <param name="remoteClient"></param> 591 /// <param name="remoteClient"></param>
592 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) 592 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
593 { 593 {
594 Primitive prim = null; 594 Primitive prim = null;
595 foreach (EntityBase ent in Entities.Values) 595 foreach (EntityBase ent in Entities.Values)
596 { 596 {
597 if (ent is SceneObject) 597 if (ent is SceneObject)
598 { 598 {
599 prim = ((SceneObject)ent).HasChildPrim(localID); 599 prim = ((SceneObject)ent).HasChildPrim(localID);
600 if (prim != null) 600 if (prim != null)
601 { 601 {
602 prim.ResizeGoup(scale); 602 prim.ResizeGoup(scale);
603 break; 603 break;
604 } 604 }
605 } 605 }
606 } 606 }
607 } 607 }
608 608
609 /// <summary> 609 /// <summary>
610 /// Sends prims to a client 610 /// Sends prims to a client
611 /// </summary> 611 /// </summary>
612 /// <param name="RemoteClient">Client to send to</param> 612 /// <param name="RemoteClient">Client to send to</param>
613 public void GetInitialPrims(IClientAPI RemoteClient) 613 public void GetInitialPrims(IClientAPI RemoteClient)
614 { 614 {
615 615
616 } 616 }
617 } 617 }
618} 618}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 1e69c9e..a06d74d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1,919 +1,919 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading; 30using System.Threading;
31using System.Timers; 31using System.Timers;
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets; 33using libsecondlife.Packets;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.Physics.Manager; 40using OpenSim.Physics.Manager;
41using OpenSim.Region.Caches; 41using OpenSim.Region.Caches;
42using OpenSim.Region.Interfaces; 42using OpenSim.Region.Interfaces;
43using OpenSim.Region.Scripting; 43using OpenSim.Region.Scripting;
44using OpenSim.Region.Terrain; 44using OpenSim.Region.Terrain;
45using Caps = OpenSim.Region.Capabilities.Caps; 45using Caps = OpenSim.Region.Capabilities.Caps;
46using Timer = System.Timers.Timer; 46using Timer = System.Timers.Timer;
47 47
48namespace OpenSim.Region.Environment.Scenes 48namespace OpenSim.Region.Environment.Scenes
49{ 49{
50 public delegate bool FilterAvatarList(ScenePresence avatar); 50 public delegate bool FilterAvatarList(ScenePresence avatar);
51 public delegate void ForEachScenePresenceDelegate(ScenePresence presence); 51 public delegate void ForEachScenePresenceDelegate(ScenePresence presence);
52 52
53 public partial class Scene : SceneBase, ILocalStorageReceiver 53 public partial class Scene : SceneBase, ILocalStorageReceiver
54 { 54 {
55 protected Timer m_heartbeatTimer = new Timer(); 55 protected Timer m_heartbeatTimer = new Timer();
56 protected Dictionary<LLUUID, ScenePresence> Avatars; 56 protected Dictionary<LLUUID, ScenePresence> Avatars;
57 protected Dictionary<LLUUID, SceneObject> Prims; 57 protected Dictionary<LLUUID, SceneObject> Prims;
58 protected PhysicsScene phyScene; 58 protected PhysicsScene phyScene;
59 protected float timeStep = 0.1f; 59 protected float timeStep = 0.1f;
60 private Random Rand = new Random(); 60 private Random Rand = new Random();
61 private uint _primCount = 702000; 61 private uint _primCount = 702000;
62 private System.Threading.Mutex _primAllocateMutex = new Mutex(false); 62 private System.Threading.Mutex _primAllocateMutex = new Mutex(false);
63 private int storageCount; 63 private int storageCount;
64 private int parcelPrimCheckCount; 64 private int parcelPrimCheckCount;
65 private Mutex updateLock; 65 private Mutex updateLock;
66 66
67 protected AuthenticateSessionsBase authenticateHandler; 67 protected AuthenticateSessionsBase authenticateHandler;
68 protected RegionCommsListener regionCommsHost; 68 protected RegionCommsListener regionCommsHost;
69 protected CommunicationsManager commsManager; 69 protected CommunicationsManager commsManager;
70 protected StorageManager storageManager; 70 protected StorageManager storageManager;
71 71
72 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); 72 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
73 protected BaseHttpServer httpListener; 73 protected BaseHttpServer httpListener;
74 74
75 #region Properties 75 #region Properties
76 /// <summary> 76 /// <summary>
77 /// 77 ///
78 /// </summary> 78 /// </summary>
79 public PhysicsScene PhysScene 79 public PhysicsScene PhysScene
80 { 80 {
81 set 81 set
82 { 82 {
83 this.phyScene = value; 83 this.phyScene = value;
84 } 84 }
85 get 85 get
86 { 86 {
87 return (this.phyScene); 87 return (this.phyScene);
88 } 88 }
89 } 89 }
90 90
91 private ParcelManager m_parcelManager; 91 private ParcelManager m_parcelManager;
92 public ParcelManager ParcelManager 92 public ParcelManager ParcelManager
93 { 93 {
94 get { return m_parcelManager; } 94 get { return m_parcelManager; }
95 } 95 }
96 96
97 private EstateManager m_estateManager; 97 private EstateManager m_estateManager;
98 public EstateManager EstateManager 98 public EstateManager EstateManager
99 { 99 {
100 get { return m_estateManager; } 100 get { return m_estateManager; }
101 } 101 }
102 102
103 private EventManager m_eventManager; 103 private EventManager m_eventManager;
104 public EventManager EventManager 104 public EventManager EventManager
105 { 105 {
106 get { return m_eventManager; } 106 get { return m_eventManager; }
107 } 107 }
108 108
109 private ScriptManager m_scriptManager; 109 private ScriptManager m_scriptManager;
110 public ScriptManager ScriptManager 110 public ScriptManager ScriptManager
111 { 111 {
112 get { return m_scriptManager; } 112 get { return m_scriptManager; }
113 } 113 }
114 114
115 public Dictionary<LLUUID, SceneObject> Objects 115 public Dictionary<LLUUID, SceneObject> Objects
116 { 116 {
117 get { return Prims; } 117 get { return Prims; }
118 } 118 }
119 119
120 #endregion 120 #endregion
121 121
122 #region Constructors 122 #region Constructors
123 /// <summary> 123 /// <summary>
124 /// Creates a new World class, and a region to go with it. 124 /// Creates a new World class, and a region to go with it.
125 /// </summary> 125 /// </summary>
126 /// <param name="clientThreads">Dictionary to contain client threads</param> 126 /// <param name="clientThreads">Dictionary to contain client threads</param>
127 /// <param name="regionHandle">Region Handle for this region</param> 127 /// <param name="regionHandle">Region Handle for this region</param>
128 /// <param name="regionName">Region Name for this region</param> 128 /// <param name="regionName">Region Name for this region</param>
129 public Scene(RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) 129 public Scene(RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer)
130 { 130 {
131 updateLock = new Mutex(false); 131 updateLock = new Mutex(false);
132 this.authenticateHandler = authen; 132 this.authenticateHandler = authen;
133 this.commsManager = commsMan; 133 this.commsManager = commsMan;
134 this.storageManager = storeManager; 134 this.storageManager = storeManager;
135 this.assetCache = assetCach; 135 this.assetCache = assetCach;
136 m_regInfo = regInfo; 136 m_regInfo = regInfo;
137 m_regionHandle = m_regInfo.RegionHandle; 137 m_regionHandle = m_regInfo.RegionHandle;
138 m_regionName = m_regInfo.RegionName; 138 m_regionName = m_regInfo.RegionName;
139 this.m_datastore = m_regInfo.DataStore; 139 this.m_datastore = m_regInfo.DataStore;
140 this.RegisterRegionWithComms(); 140 this.RegisterRegionWithComms();
141 141
142 m_parcelManager = new ParcelManager(this, this.m_regInfo); 142 m_parcelManager = new ParcelManager(this, this.m_regInfo);
143 m_estateManager = new EstateManager(this, this.m_regInfo); 143 m_estateManager = new EstateManager(this, this.m_regInfo);
144 m_scriptManager = new ScriptManager(this); 144 m_scriptManager = new ScriptManager(this);
145 m_eventManager = new EventManager(); 145 m_eventManager = new EventManager();
146 146
147 m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts); 147 m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts);
148 148
149 MainLog.Instance.Verbose("World.cs - creating new entitities instance"); 149 MainLog.Instance.Verbose("World.cs - creating new entitities instance");
150 Entities = new Dictionary<LLUUID, EntityBase>(); 150 Entities = new Dictionary<LLUUID, EntityBase>();
151 Avatars = new Dictionary<LLUUID, ScenePresence>(); 151 Avatars = new Dictionary<LLUUID, ScenePresence>();
152 Prims = new Dictionary<LLUUID, SceneObject>(); 152 Prims = new Dictionary<LLUUID, SceneObject>();
153 153
154 MainLog.Instance.Verbose("World.cs - loading objects from datastore"); 154 MainLog.Instance.Verbose("World.cs - loading objects from datastore");
155 List<SceneObject> PrimsFromDB = storageManager.DataStore.LoadObjects(); 155 List<SceneObject> PrimsFromDB = storageManager.DataStore.LoadObjects();
156 foreach (SceneObject prim in PrimsFromDB) 156 foreach (SceneObject prim in PrimsFromDB)
157 { 157 {
158 AddEntity(prim); 158 AddEntity(prim);
159 } 159 }
160 MainLog.Instance.Verbose("World.cs - loaded " + PrimsFromDB.Count.ToString() + " object(s)"); 160 MainLog.Instance.Verbose("World.cs - loaded " + PrimsFromDB.Count.ToString() + " object(s)");
161 161
162 162
163 MainLog.Instance.Verbose("World.cs - creating LandMap"); 163 MainLog.Instance.Verbose("World.cs - creating LandMap");
164 Terrain = new TerrainEngine(); 164 Terrain = new TerrainEngine();
165 165
166 ScenePresence.LoadAnims(); 166 ScenePresence.LoadAnims();
167 167
168 this.httpListener = httpServer; 168 this.httpListener = httpServer;
169 } 169 }
170 #endregion 170 #endregion
171 171
172 #region Script Handling Methods 172 #region Script Handling Methods
173 173
174 public void SendCommandToScripts(string[] args) 174 public void SendCommandToScripts(string[] args)
175 { 175 {
176 m_eventManager.TriggerOnScriptConsole(args); 176 m_eventManager.TriggerOnScriptConsole(args);
177 } 177 }
178 178
179 #endregion 179 #endregion
180 180
181 /// <summary> 181 /// <summary>
182 /// 182 ///
183 /// </summary> 183 /// </summary>
184 public void StartTimer() 184 public void StartTimer()
185 { 185 {
186 m_heartbeatTimer.Enabled = true; 186 m_heartbeatTimer.Enabled = true;
187 m_heartbeatTimer.Interval = 100; 187 m_heartbeatTimer.Interval = 100;
188 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 188 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
189 } 189 }
190 190
191 191
192 #region Update Methods 192 #region Update Methods
193 193
194 194
195 /// <summary> 195 /// <summary>
196 /// Performs per-frame updates regularly 196 /// Performs per-frame updates regularly
197 /// </summary> 197 /// </summary>
198 /// <param name="sender"></param> 198 /// <param name="sender"></param>
199 /// <param name="e"></param> 199 /// <param name="e"></param>
200 void Heartbeat(object sender, EventArgs e) 200 void Heartbeat(object sender, EventArgs e)
201 { 201 {
202 this.Update(); 202 this.Update();
203 } 203 }
204 204
205 /// <summary> 205 /// <summary>
206 /// Performs per-frame updates on the world, this should be the central world loop 206 /// Performs per-frame updates on the world, this should be the central world loop
207 /// </summary> 207 /// </summary>
208 public override void Update() 208 public override void Update()
209 { 209 {
210 updateLock.WaitOne(); 210 updateLock.WaitOne();
211 try 211 try
212 { 212 {
213 if (this.phyScene.IsThreaded) 213 if (this.phyScene.IsThreaded)
214 { 214 {
215 this.phyScene.GetResults(); 215 this.phyScene.GetResults();
216 216
217 } 217 }
218 218
219 foreach (LLUUID UUID in Entities.Keys) 219 foreach (LLUUID UUID in Entities.Keys)
220 { 220 {
221 Entities[UUID].updateMovement(); 221 Entities[UUID].updateMovement();
222 } 222 }
223 223
224 lock (this.m_syncRoot) 224 lock (this.m_syncRoot)
225 { 225 {
226 this.phyScene.Simulate(timeStep); 226 this.phyScene.Simulate(timeStep);
227 } 227 }
228 228
229 foreach (LLUUID UUID in Entities.Keys) 229 foreach (LLUUID UUID in Entities.Keys)
230 { 230 {
231 Entities[UUID].update(); 231 Entities[UUID].update();
232 } 232 }
233 233
234 // General purpose event manager 234 // General purpose event manager
235 m_eventManager.TriggerOnFrame(); 235 m_eventManager.TriggerOnFrame();
236 236
237 //backup world data 237 //backup world data
238 this.storageCount++; 238 this.storageCount++;
239 if (storageCount > 1200) //set to how often you want to backup 239 if (storageCount > 1200) //set to how often you want to backup
240 { 240 {
241 this.Backup(); 241 this.Backup();
242 storageCount = 0; 242 storageCount = 0;
243 } 243 }
244 244
245 this.parcelPrimCheckCount++; 245 this.parcelPrimCheckCount++;
246 if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims 246 if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims
247 { 247 {
248 if (m_parcelManager.parcelPrimCountTainted) 248 if (m_parcelManager.parcelPrimCountTainted)
249 { 249 {
250 //Perform parcel update of prim count 250 //Perform parcel update of prim count
251 performParcelPrimCountUpdate(); 251 performParcelPrimCountUpdate();
252 this.parcelPrimCheckCount = 0; 252 this.parcelPrimCheckCount = 0;
253 } 253 }
254 } 254 }
255 255
256 } 256 }
257 catch (Exception e) 257 catch (Exception e)
258 { 258 {
259 MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); 259 MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString());
260 } 260 }
261 updateLock.ReleaseMutex(); 261 updateLock.ReleaseMutex();
262 262
263 } 263 }
264 264
265 /// <summary> 265 /// <summary>
266 /// 266 ///
267 /// </summary> 267 /// </summary>
268 /// <returns></returns> 268 /// <returns></returns>
269 public bool Backup() 269 public bool Backup()
270 { 270 {
271 EventManager.TriggerOnBackup(this.storageManager.DataStore); 271 EventManager.TriggerOnBackup(this.storageManager.DataStore);
272 return true; 272 return true;
273 } 273 }
274 #endregion 274 #endregion
275 275
276 #region Regenerate Terrain 276 #region Regenerate Terrain
277 277
278 /// <summary> 278 /// <summary>
279 /// Rebuilds the terrain using a procedural algorithm 279 /// Rebuilds the terrain using a procedural algorithm
280 /// </summary> 280 /// </summary>
281 public void RegenerateTerrain() 281 public void RegenerateTerrain()
282 { 282 {
283 try 283 try
284 { 284 {
285 Terrain.hills(); 285 Terrain.hills();
286 286
287 lock (this.m_syncRoot) 287 lock (this.m_syncRoot)
288 { 288 {
289 this.phyScene.SetTerrain(Terrain.getHeights1D()); 289 this.phyScene.SetTerrain(Terrain.getHeights1D());
290 } 290 }
291 291
292 this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); 292 this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD());
293 293
294 this.ForEachScenePresence(delegate(ScenePresence presence) 294 this.ForEachScenePresence(delegate(ScenePresence presence)
295 { 295 {
296 this.SendLayerData(presence.ControllingClient); 296 this.SendLayerData(presence.ControllingClient);
297 }); 297 });
298 298
299 foreach (LLUUID UUID in Entities.Keys) 299 foreach (LLUUID UUID in Entities.Keys)
300 { 300 {
301 Entities[UUID].LandRenegerated(); 301 Entities[UUID].LandRenegerated();
302 } 302 }
303 } 303 }
304 catch (Exception e) 304 catch (Exception e)
305 { 305 {
306 MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); 306 MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
307 } 307 }
308 } 308 }
309 309
310 /// <summary> 310 /// <summary>
311 /// Rebuilds the terrain using a 2D float array 311 /// Rebuilds the terrain using a 2D float array
312 /// </summary> 312 /// </summary>
313 /// <param name="newMap">256,256 float array containing heights</param> 313 /// <param name="newMap">256,256 float array containing heights</param>
314 public void RegenerateTerrain(float[,] newMap) 314 public void RegenerateTerrain(float[,] newMap)
315 { 315 {
316 try 316 try
317 { 317 {
318 this.Terrain.setHeights2D(newMap); 318 this.Terrain.setHeights2D(newMap);
319 lock (this.m_syncRoot) 319 lock (this.m_syncRoot)
320 { 320 {
321 this.phyScene.SetTerrain(this.Terrain.getHeights1D()); 321 this.phyScene.SetTerrain(this.Terrain.getHeights1D());
322 } 322 }
323 this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); 323 this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD());
324 324
325 this.ForEachScenePresence(delegate(ScenePresence presence) 325 this.ForEachScenePresence(delegate(ScenePresence presence)
326 { 326 {
327 this.SendLayerData(presence.ControllingClient); 327 this.SendLayerData(presence.ControllingClient);
328 }); 328 });
329 329
330 foreach (LLUUID UUID in Entities.Keys) 330 foreach (LLUUID UUID in Entities.Keys)
331 { 331 {
332 Entities[UUID].LandRenegerated(); 332 Entities[UUID].LandRenegerated();
333 } 333 }
334 } 334 }
335 catch (Exception e) 335 catch (Exception e)
336 { 336 {
337 MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); 337 MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
338 } 338 }
339 } 339 }
340 340
341 /// <summary> 341 /// <summary>
342 /// Rebuilds the terrain assuming changes occured at a specified point[?] 342 /// Rebuilds the terrain assuming changes occured at a specified point[?]
343 /// </summary> 343 /// </summary>
344 /// <param name="changes">???</param> 344 /// <param name="changes">???</param>
345 /// <param name="pointx">???</param> 345 /// <param name="pointx">???</param>
346 /// <param name="pointy">???</param> 346 /// <param name="pointy">???</param>
347 public void RegenerateTerrain(bool changes, int pointx, int pointy) 347 public void RegenerateTerrain(bool changes, int pointx, int pointy)
348 { 348 {
349 try 349 try
350 { 350 {
351 if (changes) 351 if (changes)
352 { 352 {
353 /* Dont save here, rely on tainting system instead */ 353 /* Dont save here, rely on tainting system instead */
354 354
355 this.ForEachScenePresence(delegate(ScenePresence presence) 355 this.ForEachScenePresence(delegate(ScenePresence presence)
356 { 356 {
357 this.SendLayerData(pointx, pointy, presence.ControllingClient); 357 this.SendLayerData(pointx, pointy, presence.ControllingClient);
358 }); 358 });
359 } 359 }
360 } 360 }
361 catch (Exception e) 361 catch (Exception e)
362 { 362 {
363 MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); 363 MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
364 } 364 }
365 } 365 }
366 366
367 #endregion 367 #endregion
368 368
369 #region Load Terrain 369 #region Load Terrain
370 /// <summary> 370 /// <summary>
371 /// Loads the World heightmap 371 /// Loads the World heightmap
372 /// </summary> 372 /// </summary>
373 /// 373 ///
374 public override void LoadWorldMap() 374 public override void LoadWorldMap()
375 { 375 {
376 try 376 try
377 { 377 {
378 double[,] map = this.storageManager.DataStore.LoadTerrain(); 378 double[,] map = this.storageManager.DataStore.LoadTerrain();
379 if (map == null) 379 if (map == null)
380 { 380 {
381 if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) 381 if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile))
382 { 382 {
383 Console.WriteLine("No default terrain, procedurally generating..."); 383 Console.WriteLine("No default terrain, procedurally generating...");
384 this.Terrain.hills(); 384 this.Terrain.hills();
385 385
386 this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); 386 this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD());
387 } 387 }
388 else 388 else
389 { 389 {
390 try 390 try
391 { 391 {
392 this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); 392 this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile);
393 this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; 393 this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier;
394 } 394 }
395 catch 395 catch
396 { 396 {
397 Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); 397 Console.WriteLine("Unable to load default terrain, procedurally generating instead...");
398 Terrain.hills(); 398 Terrain.hills();
399 } 399 }
400 this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); 400 this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD());
401 } 401 }
402 } 402 }
403 else 403 else
404 { 404 {
405 this.Terrain.setHeights2D(map); 405 this.Terrain.setHeights2D(map);
406 } 406 }
407 407
408 CreateTerrainTexture(); 408 CreateTerrainTexture();
409 409
410 } 410 }
411 catch (Exception e) 411 catch (Exception e)
412 { 412 {
413 MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); 413 MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString());
414 } 414 }
415 } 415 }
416 416
417 /// <summary> 417 /// <summary>
418 /// 418 ///
419 /// </summary> 419 /// </summary>
420 public void CreateTerrainTexture() 420 public void CreateTerrainTexture()
421 { 421 {
422 //create a texture asset of the terrain 422 //create a texture asset of the terrain
423 byte[] data = this.Terrain.exportJpegImage("defaultstripe.png"); 423 byte[] data = this.Terrain.exportJpegImage("defaultstripe.png");
424 this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); 424 this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random();
425 AssetBase asset = new AssetBase(); 425 AssetBase asset = new AssetBase();
426 asset.FullID = this.m_regInfo.estateSettings.terrainImageID; 426 asset.FullID = this.m_regInfo.estateSettings.terrainImageID;
427 asset.Data = data; 427 asset.Data = data;
428 asset.Name = "terrainImage"; 428 asset.Name = "terrainImage";
429 asset.Type = 0; 429 asset.Type = 0;
430 this.assetCache.AddAsset(asset); 430 this.assetCache.AddAsset(asset);
431 } 431 }
432 #endregion 432 #endregion
433 433
434 #region Primitives Methods 434 #region Primitives Methods
435 435
436 436
437 /// <summary> 437 /// <summary>
438 /// Loads the World's objects 438 /// Loads the World's objects
439 /// </summary> 439 /// </summary>
440 public void LoadPrimsFromStorage() 440 public void LoadPrimsFromStorage()
441 { 441 {
442 try 442 try
443 { 443 {
444 MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); 444 MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives");
445 this.localStorage.LoadPrimitives(this); 445 this.localStorage.LoadPrimitives(this);
446 } 446 }
447 catch (Exception e) 447 catch (Exception e)
448 { 448 {
449 MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); 449 MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString());
450 } 450 }
451 } 451 }
452 452
453 /// <summary> 453 /// <summary>
454 /// Loads a specific object from storage 454 /// Loads a specific object from storage
455 /// </summary> 455 /// </summary>
456 /// <param name="prim">The object to load</param> 456 /// <param name="prim">The object to load</param>
457 public void PrimFromStorage(PrimData prim) 457 public void PrimFromStorage(PrimData prim)
458 { 458 {
459 } 459 }
460 460
461 /// <summary> 461 /// <summary>
462 /// Returns a new unallocated primitive ID 462 /// Returns a new unallocated primitive ID
463 /// </summary> 463 /// </summary>
464 /// <returns>A brand new primitive ID</returns> 464 /// <returns>A brand new primitive ID</returns>
465 public uint PrimIDAllocate() 465 public uint PrimIDAllocate()
466 { 466 {
467 uint myID; 467 uint myID;
468 468
469 _primAllocateMutex.WaitOne(); 469 _primAllocateMutex.WaitOne();
470 ++_primCount; 470 ++_primCount;
471 myID = _primCount; 471 myID = _primCount;
472 _primAllocateMutex.ReleaseMutex(); 472 _primAllocateMutex.ReleaseMutex();
473 473
474 return myID; 474 return myID;
475 } 475 }
476 476
477 /// <summary> 477 /// <summary>
478 /// 478 ///
479 /// </summary> 479 /// </summary>
480 /// <param name="addPacket"></param> 480 /// <param name="addPacket"></param>
481 /// <param name="ownerID"></param> 481 /// <param name="ownerID"></param>
482 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) 482 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
483 { 483 {
484 484
485 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape); 485 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
486 AddEntity(sceneOb); 486 AddEntity(sceneOb);
487 } 487 }
488 488
489 public void RemovePrim(uint localID, LLUUID avatar_deleter) 489 public void RemovePrim(uint localID, LLUUID avatar_deleter)
490 { 490 {
491 foreach (EntityBase obj in Entities.Values) 491 foreach (EntityBase obj in Entities.Values)
492 { 492 {
493 if (obj is SceneObject) 493 if (obj is SceneObject)
494 { 494 {
495 if (((SceneObject)obj).LocalId == localID) 495 if (((SceneObject)obj).LocalId == localID)
496 { 496 {
497 RemoveEntity((SceneObject)obj); 497 RemoveEntity((SceneObject)obj);
498 return; 498 return;
499 } 499 }
500 } 500 }
501 } 501 }
502 502
503 } 503 }
504 504
505 public void AddEntity(SceneObject sceneObject) 505 public void AddEntity(SceneObject sceneObject)
506 { 506 {
507 this.Entities.Add(sceneObject.rootUUID, sceneObject); 507 this.Entities.Add(sceneObject.rootUUID, sceneObject);
508 } 508 }
509 509
510 public void RemoveEntity(SceneObject sceneObject) 510 public void RemoveEntity(SceneObject sceneObject)
511 { 511 {
512 if (this.Entities.ContainsKey(sceneObject.rootUUID)) 512 if (this.Entities.ContainsKey(sceneObject.rootUUID))
513 { 513 {
514 m_parcelManager.removePrimFromParcelCounts(sceneObject); 514 m_parcelManager.removePrimFromParcelCounts(sceneObject);
515 this.Entities.Remove(sceneObject.rootUUID); 515 this.Entities.Remove(sceneObject.rootUUID);
516 m_parcelManager.setPrimsTainted(); 516 m_parcelManager.setPrimsTainted();
517 } 517 }
518 } 518 }
519 519
520 /// <summary> 520 /// <summary>
521 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to 521 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to
522 /// </summary> 522 /// </summary>
523 /// <param name="prim"></param> 523 /// <param name="prim"></param>
524 public void AcknowledgeNewPrim(Primitive prim) 524 public void AcknowledgeNewPrim(Primitive prim)
525 { 525 {
526 prim.OnPrimCountTainted += m_parcelManager.setPrimsTainted; 526 prim.OnPrimCountTainted += m_parcelManager.setPrimsTainted;
527 } 527 }
528 #endregion 528 #endregion
529 529
530 #region Add/Remove Avatar Methods 530 #region Add/Remove Avatar Methods
531 531
532 /// <summary> 532 /// <summary>
533 /// 533 ///
534 /// </summary> 534 /// </summary>
535 /// <param name="remoteClient"></param 535 /// <param name="remoteClient"></param
536 /// <param name="agentID"></param> 536 /// <param name="agentID"></param>
537 /// <param name="child"></param> 537 /// <param name="child"></param>
538 public override void AddNewClient(IClientAPI client, bool child) 538 public override void AddNewClient(IClientAPI client, bool child)
539 { 539 {
540 SubscribeToClientEvents(client); 540 SubscribeToClientEvents(client);
541 this.m_estateManager.sendRegionHandshake(client); 541 this.m_estateManager.sendRegionHandshake(client);
542 CreateAndAddScenePresence(client); 542 CreateAndAddScenePresence(client);
543 this.m_parcelManager.sendParcelOverlay(client); 543 this.m_parcelManager.sendParcelOverlay(client);
544 544
545 } 545 }
546 546
547 protected virtual void SubscribeToClientEvents(IClientAPI client) 547 protected virtual void SubscribeToClientEvents(IClientAPI client)
548 { 548 {
549 client.OnRegionHandShakeReply += this.SendLayerData; 549 client.OnRegionHandShakeReply += this.SendLayerData;
550 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); 550 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
551 client.OnChatFromViewer += this.SimChat; 551 client.OnChatFromViewer += this.SimChat;
552 client.OnInstantMessage += this.InstantMessage; 552 client.OnInstantMessage += this.InstantMessage;
553 client.OnRequestWearables += this.InformClientOfNeighbours; 553 client.OnRequestWearables += this.InformClientOfNeighbours;
554 client.OnAddPrim += this.AddNewPrim; 554 client.OnAddPrim += this.AddNewPrim;
555 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; 555 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
556 client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; 556 client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition;
557 client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; 557 client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation;
558 client.OnUpdatePrimGroupMouseRotation += this.UpdatePrimRotation; 558 client.OnUpdatePrimGroupMouseRotation += this.UpdatePrimRotation;
559 client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; 559 client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation;
560 client.OnUpdatePrimScale += this.UpdatePrimScale; 560 client.OnUpdatePrimScale += this.UpdatePrimScale;
561 client.OnUpdatePrimShape += this.UpdatePrimShape; 561 client.OnUpdatePrimShape += this.UpdatePrimShape;
562 client.OnRequestMapBlocks += this.RequestMapBlocks; 562 client.OnRequestMapBlocks += this.RequestMapBlocks;
563 client.OnUpdatePrimTexture += this.UpdatePrimTexture; 563 client.OnUpdatePrimTexture += this.UpdatePrimTexture;
564 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 564 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
565 client.OnObjectSelect += this.SelectPrim; 565 client.OnObjectSelect += this.SelectPrim;
566 client.OnObjectDeselect += this.DeselectPrim; 566 client.OnObjectDeselect += this.DeselectPrim;
567 client.OnGrapUpdate += this.MoveObject; 567 client.OnGrapUpdate += this.MoveObject;
568 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 568 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
569 client.OnObjectDescription += this.PrimDescription; 569 client.OnObjectDescription += this.PrimDescription;
570 client.OnObjectName += this.PrimName; 570 client.OnObjectName += this.PrimName;
571 client.OnLinkObjects += this.LinkObjects; 571 client.OnLinkObjects += this.LinkObjects;
572 client.OnObjectDuplicate += this.DuplicateObject; 572 client.OnObjectDuplicate += this.DuplicateObject;
573 573
574 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_parcelManager.handleParcelPropertiesRequest); 574 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_parcelManager.handleParcelPropertiesRequest);
575 client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest); 575 client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest);
576 client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); 576 client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest);
577 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest); 577 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest);
578 client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest); 578 client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest);
579 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_parcelManager.handleParcelObjectOwnersRequest); 579 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_parcelManager.handleParcelObjectOwnersRequest);
580 580
581 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 581 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
582 582
583 } 583 }
584 584
585 protected ScenePresence CreateAndAddScenePresence(IClientAPI client) 585 protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
586 { 586 {
587 ScenePresence newAvatar = null; 587 ScenePresence newAvatar = null;
588 588
589 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 589 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
590 newAvatar = new ScenePresence(client, this, this.m_regInfo); 590 newAvatar = new ScenePresence(client, this, this.m_regInfo);
591 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); 591 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world");
592 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); 592 MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake ");
593 593
594 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 594 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
595 lock (this.m_syncRoot) 595 lock (this.m_syncRoot)
596 { 596 {
597 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 597 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
598 } 598 }
599 599
600 lock (Entities) 600 lock (Entities)
601 { 601 {
602 if (!Entities.ContainsKey(client.AgentId)) 602 if (!Entities.ContainsKey(client.AgentId))
603 { 603 {
604 this.Entities.Add(client.AgentId, newAvatar); 604 this.Entities.Add(client.AgentId, newAvatar);
605 } 605 }
606 else 606 else
607 { 607 {
608 Entities[client.AgentId] = newAvatar; 608 Entities[client.AgentId] = newAvatar;
609 } 609 }
610 } 610 }
611 lock (Avatars) 611 lock (Avatars)
612 { 612 {
613 if (Avatars.ContainsKey(client.AgentId)) 613 if (Avatars.ContainsKey(client.AgentId))
614 { 614 {
615 Avatars[client.AgentId] = newAvatar; 615 Avatars[client.AgentId] = newAvatar;
616 } 616 }
617 else 617 else
618 { 618 {
619 this.Avatars.Add(client.AgentId, newAvatar); 619 this.Avatars.Add(client.AgentId, newAvatar);
620 } 620 }
621 } 621 }
622 newAvatar.OnSignificantClientMovement += m_parcelManager.handleSignificantClientMovement; 622 newAvatar.OnSignificantClientMovement += m_parcelManager.handleSignificantClientMovement;
623 return newAvatar; 623 return newAvatar;
624 } 624 }
625 625
626 626
627 /// <summary> 627 /// <summary>
628 /// 628 ///
629 /// </summary> 629 /// </summary>
630 /// <param name="agentID"></param> 630 /// <param name="agentID"></param>
631 public override void RemoveClient(LLUUID agentID) 631 public override void RemoveClient(LLUUID agentID)
632 { 632 {
633 m_eventManager.TriggerOnRemovePresence(agentID); 633 m_eventManager.TriggerOnRemovePresence(agentID);
634 634
635 ScenePresence avatar = this.RequestAvatar(agentID); 635 ScenePresence avatar = this.RequestAvatar(agentID);
636 636
637 this.ForEachScenePresence( 637 this.ForEachScenePresence(
638 delegate(ScenePresence presence) 638 delegate(ScenePresence presence)
639 { 639 {
640 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); 640 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
641 }); 641 });
642 642
643 lock (Avatars) 643 lock (Avatars)
644 { 644 {
645 if (Avatars.ContainsKey(agentID)) 645 if (Avatars.ContainsKey(agentID))
646 { 646 {
647 Avatars.Remove(agentID); 647 Avatars.Remove(agentID);
648 } 648 }
649 } 649 }
650 lock (Entities) 650 lock (Entities)
651 { 651 {
652 if (Entities.ContainsKey(agentID)) 652 if (Entities.ContainsKey(agentID))
653 { 653 {
654 Entities.Remove(agentID); 654 Entities.Remove(agentID);
655 } 655 }
656 } 656 }
657 // TODO: Add the removal from physics ? 657 // TODO: Add the removal from physics ?
658 658
659 659
660 660
661 return; 661 return;
662 } 662 }
663 #endregion 663 #endregion
664 664
665 #region Request Avatars List Methods 665 #region Request Avatars List Methods
666 //The idea is to have a group of method that return a list of avatars meeting some requirement 666 //The idea is to have a group of method that return a list of avatars meeting some requirement
667 // ie it could be all Avatars within a certain range of the calling prim/avatar. 667 // ie it could be all Avatars within a certain range of the calling prim/avatar.
668 668
669 /// <summary> 669 /// <summary>
670 /// Request a List of all Avatars in this World 670 /// Request a List of all Avatars in this World
671 /// </summary> 671 /// </summary>
672 /// <returns></returns> 672 /// <returns></returns>
673 public List<ScenePresence> RequestAvatarList() 673 public List<ScenePresence> RequestAvatarList()
674 { 674 {
675 List<ScenePresence> result = new List<ScenePresence>(); 675 List<ScenePresence> result = new List<ScenePresence>();
676 676
677 foreach (ScenePresence avatar in Avatars.Values) 677 foreach (ScenePresence avatar in Avatars.Values)
678 { 678 {
679 result.Add(avatar); 679 result.Add(avatar);
680 } 680 }
681 681
682 return result; 682 return result;
683 } 683 }
684 684
685 /// <summary> 685 /// <summary>
686 /// Request a filtered list of Avatars in this World 686 /// Request a filtered list of Avatars in this World
687 /// </summary> 687 /// </summary>
688 /// <returns></returns> 688 /// <returns></returns>
689 public List<ScenePresence> RequestAvatarList(FilterAvatarList filter) 689 public List<ScenePresence> RequestAvatarList(FilterAvatarList filter)
690 { 690 {
691 List<ScenePresence> result = new List<ScenePresence>(); 691 List<ScenePresence> result = new List<ScenePresence>();
692 692
693 foreach (ScenePresence avatar in Avatars.Values) 693 foreach (ScenePresence avatar in Avatars.Values)
694 { 694 {
695 if (filter(avatar)) 695 if (filter(avatar))
696 { 696 {
697 result.Add(avatar); 697 result.Add(avatar);
698 } 698 }
699 } 699 }
700 700
701 return result; 701 return result;
702 } 702 }
703 703
704 /// <summary> 704 /// <summary>
705 /// Request a Avatar by UUID 705 /// Request a Avatar by UUID
706 /// </summary> 706 /// </summary>
707 /// <param name="avatarID"></param> 707 /// <param name="avatarID"></param>
708 /// <returns></returns> 708 /// <returns></returns>
709 public ScenePresence RequestAvatar(LLUUID avatarID) 709 public ScenePresence RequestAvatar(LLUUID avatarID)
710 { 710 {
711 if (this.Avatars.ContainsKey(avatarID)) 711 if (this.Avatars.ContainsKey(avatarID))
712 { 712 {
713 return Avatars[avatarID]; 713 return Avatars[avatarID];
714 } 714 }
715 return null; 715 return null;
716 } 716 }
717 717
718 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo) 718 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo)
719 { 719 {
720 foreach (ScenePresence presence in this.Avatars.Values) 720 foreach (ScenePresence presence in this.Avatars.Values)
721 { 721 {
722 whatToDo(presence); 722 whatToDo(presence);
723 } 723 }
724 } 724 }
725 #endregion 725 #endregion
726 726
727 727
728 /// <summary> 728 /// <summary>
729 /// 729 ///
730 /// </summary> 730 /// </summary>
731 /// <param name="entID"></param> 731 /// <param name="entID"></param>
732 /// <returns></returns> 732 /// <returns></returns>
733 public bool DeleteEntity(LLUUID entID) 733 public bool DeleteEntity(LLUUID entID)
734 { 734 {
735 if (this.Entities.ContainsKey(entID)) 735 if (this.Entities.ContainsKey(entID))
736 { 736 {
737 this.Entities.Remove(entID); 737 this.Entities.Remove(entID);
738 return true; 738 return true;
739 } 739 }
740 return false; 740 return false;
741 } 741 }
742 742
743 public void SendAllSceneObjectsToClient(IClientAPI client) 743 public void SendAllSceneObjectsToClient(IClientAPI client)
744 { 744 {
745 foreach (EntityBase ent in Entities.Values) 745 foreach (EntityBase ent in Entities.Values)
746 { 746 {
747 if (ent is SceneObject) 747 if (ent is SceneObject)
748 { 748 {
749 ((SceneObject)ent).SendAllChildPrimsToClient(client); 749 ((SceneObject)ent).SendAllChildPrimsToClient(client);
750 } 750 }
751 } 751 }
752 } 752 }
753 753
754 #region RegionCommsHost 754 #region RegionCommsHost
755 755
756 /// <summary> 756 /// <summary>
757 /// 757 ///
758 /// </summary> 758 /// </summary>
759 public void RegisterRegionWithComms() 759 public void RegisterRegionWithComms()
760 { 760 {
761 761
762 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); 762 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo);
763 if (this.regionCommsHost != null) 763 if (this.regionCommsHost != null)
764 { 764 {
765 this.regionCommsHost.OnExpectUser += this.NewUserConnection; 765 this.regionCommsHost.OnExpectUser += this.NewUserConnection;
766 this.regionCommsHost.OnAvatarCrossingIntoRegion += this.AgentCrossing; 766 this.regionCommsHost.OnAvatarCrossingIntoRegion += this.AgentCrossing;
767 } 767 }
768 } 768 }
769 769
770 /// <summary> 770 /// <summary>
771 /// 771 ///
772 /// </summary> 772 /// </summary>
773 /// <param name="regionHandle"></param> 773 /// <param name="regionHandle"></param>
774 /// <param name="agent"></param> 774 /// <param name="agent"></param>
775 public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) 775 public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
776 { 776 {
777 // Console.WriteLine("World.cs - add new user connection"); 777 // Console.WriteLine("World.cs - add new user connection");
778 //should just check that its meant for this region 778 //should just check that its meant for this region
779 if (regionHandle == this.m_regInfo.RegionHandle) 779 if (regionHandle == this.m_regInfo.RegionHandle)
780 { 780 {
781 if (agent.CapsPath != "") 781 if (agent.CapsPath != "")
782 { 782 {
783 //Console.WriteLine("new user, so creating caps handler for it"); 783 //Console.WriteLine("new user, so creating caps handler for it");
784 Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.ExternalHostName, this.m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); 784 Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.ExternalHostName, this.m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID);
785 cap.RegisterHandlers(); 785 cap.RegisterHandlers();
786 if (capsHandlers.ContainsKey(agent.AgentID)) 786 if (capsHandlers.ContainsKey(agent.AgentID))
787 { 787 {
788 OpenSim.Framework.Console.MainLog.Instance.Warn("Adding duplicate CAPS entry for user " + agent.AgentID.ToStringHyphenated()); 788 OpenSim.Framework.Console.MainLog.Instance.Warn("Adding duplicate CAPS entry for user " + agent.AgentID.ToStringHyphenated());
789 this.capsHandlers[agent.AgentID] = cap; 789 this.capsHandlers[agent.AgentID] = cap;
790 } 790 }
791 else 791 else
792 { 792 {
793 this.capsHandlers.Add(agent.AgentID, cap); 793 this.capsHandlers.Add(agent.AgentID, cap);
794 } 794 }
795 795
796 } 796 }
797 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 797 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
798 } 798 }
799 } 799 }
800 800
801 public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) 801 public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
802 { 802 {
803 if (regionHandle == this.m_regInfo.RegionHandle) 803 if (regionHandle == this.m_regInfo.RegionHandle)
804 { 804 {
805 if (this.Avatars.ContainsKey(agentID)) 805 if (this.Avatars.ContainsKey(agentID))
806 { 806 {
807 this.Avatars[agentID].MakeAvatar(position); 807 this.Avatars[agentID].MakeAvatar(position);
808 } 808 }
809 } 809 }
810 } 810 }
811 811
812 /// <summary> 812 /// <summary>
813 /// 813 ///
814 /// </summary> 814 /// </summary>
815 public void InformClientOfNeighbours(IClientAPI remoteClient) 815 public void InformClientOfNeighbours(IClientAPI remoteClient)
816 { 816 {
817 List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); 817 List<RegionInfo> neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo);
818 818
819 if (neighbours != null) 819 if (neighbours != null)
820 { 820 {
821 for (int i = 0; i < neighbours.Count; i++) 821 for (int i = 0; i < neighbours.Count; i++)
822 { 822 {
823 AgentCircuitData agent = remoteClient.RequestClientInfo(); 823 AgentCircuitData agent = remoteClient.RequestClientInfo();
824 agent.BaseFolder = LLUUID.Zero; 824 agent.BaseFolder = LLUUID.Zero;
825 agent.InventoryFolder = LLUUID.Zero; 825 agent.InventoryFolder = LLUUID.Zero;
826 agent.startpos = new LLVector3(128, 128, 70); 826 agent.startpos = new LLVector3(128, 128, 70);
827 agent.child = true; 827 agent.child = true;
828 this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); 828 this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent);
829 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint); 829 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint);
830 //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); 830 //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort);
831 } 831 }
832 } 832 }
833 } 833 }
834 834
835 /// <summary> 835 /// <summary>
836 /// 836 ///
837 /// </summary> 837 /// </summary>
838 /// <param name="regionHandle"></param> 838 /// <param name="regionHandle"></param>
839 /// <returns></returns> 839 /// <returns></returns>
840 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) 840 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
841 { 841 {
842 return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); 842 return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle);
843 } 843 }
844 844
845 /// <summary> 845 /// <summary>
846 /// 846 ///
847 /// </summary> 847 /// </summary>
848 /// <param name="minX"></param> 848 /// <param name="minX"></param>
849 /// <param name="minY"></param> 849 /// <param name="minY"></param>
850 /// <param name="maxX"></param> 850 /// <param name="maxX"></param>
851 /// <param name="maxY"></param> 851 /// <param name="maxY"></param>
852 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) 852 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
853 { 853 {
854 List<MapBlockData> mapBlocks; 854 List<MapBlockData> mapBlocks;
855 mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 855 mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
856 remoteClient.SendMapBlock(mapBlocks); 856 remoteClient.SendMapBlock(mapBlocks);
857 } 857 }
858 858
859 /// <summary> 859 /// <summary>
860 /// 860 ///
861 /// </summary> 861 /// </summary>
862 /// <param name="remoteClient"></param> 862 /// <param name="remoteClient"></param>
863 /// <param name="RegionHandle"></param> 863 /// <param name="RegionHandle"></param>
864 /// <param name="position"></param> 864 /// <param name="position"></param>
865 /// <param name="lookAt"></param> 865 /// <param name="lookAt"></param>
866 /// <param name="flags"></param> 866 /// <param name="flags"></param>
867 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) 867 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags)
868 { 868 {
869 if (regionHandle == this.m_regionHandle) 869 if (regionHandle == this.m_regionHandle)
870 { 870 {
871 if (this.Avatars.ContainsKey(remoteClient.AgentId)) 871 if (this.Avatars.ContainsKey(remoteClient.AgentId))
872 { 872 {
873 remoteClient.SendTeleportLocationStart(); 873 remoteClient.SendTeleportLocationStart();
874 remoteClient.SendLocalTeleport(position, lookAt, flags); 874 remoteClient.SendLocalTeleport(position, lookAt, flags);
875 this.Avatars[remoteClient.AgentId].Teleport(position); 875 this.Avatars[remoteClient.AgentId].Teleport(position);
876 } 876 }
877 } 877 }
878 else 878 else
879 { 879 {
880 RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle); 880 RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle);
881 if (reg != null) 881 if (reg != null)
882 { 882 {
883 remoteClient.SendTeleportLocationStart(); 883 remoteClient.SendTeleportLocationStart();
884 AgentCircuitData agent = remoteClient.RequestClientInfo(); 884 AgentCircuitData agent = remoteClient.RequestClientInfo();
885 agent.BaseFolder = LLUUID.Zero; 885 agent.BaseFolder = LLUUID.Zero;
886 agent.InventoryFolder = LLUUID.Zero; 886 agent.InventoryFolder = LLUUID.Zero;
887 agent.startpos = new LLVector3(128, 128, 70); 887 agent.startpos = new LLVector3(128, 128, 70);
888 agent.child = true; 888 agent.child = true;
889 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); 889 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
890 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); 890 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
891 891
892 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); 892 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4));
893 893
894 } 894 }
895 } 895 }
896 } 896 }
897 897
898 /// <summary> 898 /// <summary>
899 /// 899 ///
900 /// </summary> 900 /// </summary>
901 /// <param name="regionhandle"></param> 901 /// <param name="regionhandle"></param>
902 /// <param name="agentID"></param> 902 /// <param name="agentID"></param>
903 /// <param name="position"></param> 903 /// <param name="position"></param>
904 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) 904 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
905 { 905 {
906 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); 906 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
907 } 907 }
908 908
909 public void performParcelPrimCountUpdate() 909 public void performParcelPrimCountUpdate()
910 { 910 {
911 m_parcelManager.resetAllParcelPrimCounts(); 911 m_parcelManager.resetAllParcelPrimCounts();
912 m_eventManager.TriggerParcelPrimCountUpdate(); 912 m_eventManager.TriggerParcelPrimCountUpdate();
913 m_parcelManager.finalizeParcelPrimCountUpdate(); 913 m_parcelManager.finalizeParcelPrimCountUpdate();
914 m_parcelManager.parcelPrimCountTainted = false; 914 m_parcelManager.parcelPrimCountTainted = false;
915 } 915 }
916 #endregion 916 #endregion
917 917
918 } 918 }
919} 919}
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 161a5cf..cbf69ac 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -1,195 +1,195 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Region.Caches; 35using OpenSim.Region.Caches;
36using OpenSim.Region.Terrain; 36using OpenSim.Region.Terrain;
37using OpenSim.Framework; 37using OpenSim.Framework;
38 38
39namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public abstract class SceneBase : IWorld 41 public abstract class SceneBase : IWorld
42 { 42 {
43 public Dictionary<LLUUID, EntityBase> Entities; 43 public Dictionary<LLUUID, EntityBase> Entities;
44 protected ulong m_regionHandle; 44 protected ulong m_regionHandle;
45 protected string m_regionName; 45 protected string m_regionName;
46 protected RegionInfo m_regInfo; 46 protected RegionInfo m_regInfo;
47 47
48 public TerrainEngine Terrain; 48 public TerrainEngine Terrain;
49 49
50 public string m_datastore; 50 public string m_datastore;
51 public ILocalStorage localStorage; 51 public ILocalStorage localStorage;
52 52
53 protected object m_syncRoot = new object(); 53 protected object m_syncRoot = new object();
54 private uint m_nextLocalId = 8880000; 54 private uint m_nextLocalId = 8880000;
55 protected AssetCache assetCache; 55 protected AssetCache assetCache;
56 56
57 #region Update Methods 57 #region Update Methods
58 /// <summary> 58 /// <summary>
59 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) 59 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
60 /// </summary> 60 /// </summary>
61 public abstract void Update(); 61 public abstract void Update();
62 62
63 #endregion 63 #endregion
64 64
65 #region Terrain Methods 65 #region Terrain Methods
66 66
67 /// <summary> 67 /// <summary>
68 /// Loads the World heightmap 68 /// Loads the World heightmap
69 /// </summary> 69 /// </summary>
70 public abstract void LoadWorldMap(); 70 public abstract void LoadWorldMap();
71 71
72 /// <summary> 72 /// <summary>
73 /// Loads a new storage subsystem from a named library 73 /// Loads a new storage subsystem from a named library
74 /// </summary> 74 /// </summary>
75 /// <param name="dllName">Storage Library</param> 75 /// <param name="dllName">Storage Library</param>
76 /// <returns>Successful or not</returns> 76 /// <returns>Successful or not</returns>
77 public bool LoadStorageDLL(string dllName) 77 public bool LoadStorageDLL(string dllName)
78 { 78 {
79 try 79 try
80 { 80 {
81 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 81 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
82 ILocalStorage store = null; 82 ILocalStorage store = null;
83 83
84 foreach (Type pluginType in pluginAssembly.GetTypes()) 84 foreach (Type pluginType in pluginAssembly.GetTypes())
85 { 85 {
86 if (pluginType.IsPublic) 86 if (pluginType.IsPublic)
87 { 87 {
88 if (!pluginType.IsAbstract) 88 if (!pluginType.IsAbstract)
89 { 89 {
90 Type typeInterface = pluginType.GetInterface("ILocalStorage", true); 90 Type typeInterface = pluginType.GetInterface("ILocalStorage", true);
91 91
92 if (typeInterface != null) 92 if (typeInterface != null)
93 { 93 {
94 ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 94 ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
95 store = plug; 95 store = plug;
96 96
97 store.Initialise(this.m_datastore); 97 store.Initialise(this.m_datastore);
98 break; 98 break;
99 } 99 }
100 100
101 typeInterface = null; 101 typeInterface = null;
102 } 102 }
103 } 103 }
104 } 104 }
105 pluginAssembly = null; 105 pluginAssembly = null;
106 this.localStorage = store; 106 this.localStorage = store;
107 return (store == null); 107 return (store == null);
108 } 108 }
109 catch (Exception e) 109 catch (Exception e)
110 { 110 {
111 MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); 111 MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
112 return false; 112 return false;
113 } 113 }
114 } 114 }
115 115
116 116
117 /// <summary> 117 /// <summary>
118 /// Send the region heightmap to the client 118 /// Send the region heightmap to the client
119 /// </summary> 119 /// </summary>
120 /// <param name="RemoteClient">Client to send to</param> 120 /// <param name="RemoteClient">Client to send to</param>
121 public virtual void SendLayerData(IClientAPI RemoteClient) 121 public virtual void SendLayerData(IClientAPI RemoteClient)
122 { 122 {
123 RemoteClient.SendLayerData(Terrain.getHeights1D()); 123 RemoteClient.SendLayerData(Terrain.getHeights1D());
124 } 124 }
125 125
126 /// <summary> 126 /// <summary>
127 /// Sends a specified patch to a client 127 /// Sends a specified patch to a client
128 /// </summary> 128 /// </summary>
129 /// <param name="px">Patch coordinate (x) 0..16</param> 129 /// <param name="px">Patch coordinate (x) 0..16</param>
130 /// <param name="py">Patch coordinate (y) 0..16</param> 130 /// <param name="py">Patch coordinate (y) 0..16</param>
131 /// <param name="RemoteClient">The client to send to</param> 131 /// <param name="RemoteClient">The client to send to</param>
132 public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) 132 public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient)
133 { 133 {
134 RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); 134 RemoteClient.SendLayerData(px, py, Terrain.getHeights1D());
135 } 135 }
136 136
137 #endregion 137 #endregion
138 138
139 #region Add/Remove Agent/Avatar 139 #region Add/Remove Agent/Avatar
140 /// <summary> 140 /// <summary>
141 /// 141 ///
142 /// </summary> 142 /// </summary>
143 /// <param name="remoteClient"></param> 143 /// <param name="remoteClient"></param>
144 /// <param name="agentID"></param> 144 /// <param name="agentID"></param>
145 /// <param name="child"></param> 145 /// <param name="child"></param>
146 public abstract void AddNewClient(IClientAPI client, bool child); 146 public abstract void AddNewClient(IClientAPI client, bool child);
147 147
148 /// <summary> 148 /// <summary>
149 /// 149 ///
150 /// </summary> 150 /// </summary>
151 /// <param name="agentID"></param> 151 /// <param name="agentID"></param>
152 public abstract void RemoveClient(LLUUID agentID); 152 public abstract void RemoveClient(LLUUID agentID);
153 153
154 #endregion 154 #endregion
155 155
156 /// <summary> 156 /// <summary>
157 /// 157 ///
158 /// </summary> 158 /// </summary>
159 /// <returns></returns> 159 /// <returns></returns>
160 public virtual RegionInfo RegionInfo 160 public virtual RegionInfo RegionInfo
161 { 161 {
162 get { return this.m_regInfo; } 162 get { return this.m_regInfo; }
163 } 163 }
164 164
165 public object SyncRoot 165 public object SyncRoot
166 { 166 {
167 get { return m_syncRoot; } 167 get { return m_syncRoot; }
168 } 168 }
169 169
170 public uint NextLocalId 170 public uint NextLocalId
171 { 171 {
172 get { return m_nextLocalId++; } 172 get { return m_nextLocalId++; }
173 } 173 }
174 174
175 #region Shutdown 175 #region Shutdown
176 /// <summary> 176 /// <summary>
177 /// Tidy before shutdown 177 /// Tidy before shutdown
178 /// </summary> 178 /// </summary>
179 public virtual void Close() 179 public virtual void Close()
180 { 180 {
181 try 181 try
182 { 182 {
183 this.localStorage.ShutDown(); 183 this.localStorage.ShutDown();
184 } 184 }
185 catch (Exception e) 185 catch (Exception e)
186 { 186 {
187 MainLog.Instance.WriteLine(LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); 187 MainLog.Instance.WriteLine(LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString());
188 } 188 }
189 } 189 }
190 190
191 #endregion 191 #endregion
192 192
193 193
194 } 194 }
195} 195}
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 1e4b163..255cbf2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -1,82 +1,82 @@
1using libsecondlife; 1using libsecondlife;
2 2
3namespace OpenSim.Region.Environment.Scenes 3namespace OpenSim.Region.Environment.Scenes
4{ 4{
5 /// <summary> 5 /// <summary>
6 /// A class for triggering remote scene events. 6 /// A class for triggering remote scene events.
7 /// </summary> 7 /// </summary>
8 public class EventManager 8 public class EventManager
9 { 9 {
10 public delegate void OnFrameDelegate(); 10 public delegate void OnFrameDelegate();
11 public event OnFrameDelegate OnFrame; 11 public event OnFrameDelegate OnFrame;
12 12
13 public delegate void OnBackupDelegate(Interfaces.IRegionDataStore datastore); 13 public delegate void OnBackupDelegate(Interfaces.IRegionDataStore datastore);
14 public event OnBackupDelegate OnBackup; 14 public event OnBackupDelegate OnBackup;
15 15
16 public delegate void OnNewPresenceDelegate(ScenePresence presence); 16 public delegate void OnNewPresenceDelegate(ScenePresence presence);
17 public event OnNewPresenceDelegate OnNewPresence; 17 public event OnNewPresenceDelegate OnNewPresence;
18 18
19 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 19 public delegate void OnRemovePresenceDelegate(LLUUID uuid);
20 public event OnRemovePresenceDelegate OnRemovePresence; 20 public event OnRemovePresenceDelegate OnRemovePresence;
21 21
22 public delegate void OnParcelPrimCountUpdateDelegate(); 22 public delegate void OnParcelPrimCountUpdateDelegate();
23 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 23 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
24 24
25 public delegate void OnParcelPrimCountAddDelegate(SceneObject obj); 25 public delegate void OnParcelPrimCountAddDelegate(SceneObject obj);
26 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; 26 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
27 27
28 public delegate void OnScriptConsoleDelegate(string[] args); 28 public delegate void OnScriptConsoleDelegate(string[] args);
29 public event OnScriptConsoleDelegate OnScriptConsole; 29 public event OnScriptConsoleDelegate OnScriptConsole;
30 30
31 public void TriggerOnScriptConsole(string[] args) 31 public void TriggerOnScriptConsole(string[] args)
32 { 32 {
33 if (OnScriptConsole != null) 33 if (OnScriptConsole != null)
34 OnScriptConsole(args); 34 OnScriptConsole(args);
35 } 35 }
36 36
37 public void TriggerOnFrame() 37 public void TriggerOnFrame()
38 { 38 {
39 if (OnFrame != null) 39 if (OnFrame != null)
40 { 40 {
41 OnFrame(); 41 OnFrame();
42 } 42 }
43 } 43 }
44 44
45 public void TriggerOnNewPresence(ScenePresence presence) 45 public void TriggerOnNewPresence(ScenePresence presence)
46 { 46 {
47 if (OnNewPresence != null) 47 if (OnNewPresence != null)
48 OnNewPresence(presence); 48 OnNewPresence(presence);
49 } 49 }
50 50
51 public void TriggerOnRemovePresence(LLUUID uuid) 51 public void TriggerOnRemovePresence(LLUUID uuid)
52 { 52 {
53 if (OnRemovePresence != null) 53 if (OnRemovePresence != null)
54 { 54 {
55 OnRemovePresence(uuid); 55 OnRemovePresence(uuid);
56 } 56 }
57 } 57 }
58 58
59 public void TriggerOnBackup(Interfaces.IRegionDataStore dstore) 59 public void TriggerOnBackup(Interfaces.IRegionDataStore dstore)
60 { 60 {
61 if (OnBackup != null) 61 if (OnBackup != null)
62 { 62 {
63 OnBackup(dstore); 63 OnBackup(dstore);
64 } 64 }
65 } 65 }
66 66
67 public void TriggerParcelPrimCountUpdate() 67 public void TriggerParcelPrimCountUpdate()
68 { 68 {
69 if (OnParcelPrimCountUpdate != null) 69 if (OnParcelPrimCountUpdate != null)
70 { 70 {
71 OnParcelPrimCountUpdate(); 71 OnParcelPrimCountUpdate();
72 } 72 }
73 } 73 }
74 public void TriggerParcelPrimCountAdd(SceneObject obj) 74 public void TriggerParcelPrimCountAdd(SceneObject obj)
75 { 75 {
76 if (OnParcelPrimCountAdd != null) 76 if (OnParcelPrimCountAdd != null)
77 { 77 {
78 OnParcelPrimCountAdd(obj); 78 OnParcelPrimCountAdd(obj);
79 } 79 }
80 } 80 }
81 } 81 }
82} 82}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index e615599..43d41e6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -1,309 +1,309 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Physics.Manager; 34using OpenSim.Physics.Manager;
35 35
36namespace OpenSim.Region.Environment.Scenes 36namespace OpenSim.Region.Environment.Scenes
37{ 37{
38 public class SceneObject : EntityBase 38 public class SceneObject : EntityBase
39 { 39 {
40 private Encoding enc = Encoding.ASCII; 40 private Encoding enc = Encoding.ASCII;
41 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group 41 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
42 public Primitive rootPrimitive; 42 public Primitive rootPrimitive;
43 private new Scene m_world; 43 private new Scene m_world;
44 protected ulong m_regionHandle; 44 protected ulong m_regionHandle;
45 45
46 private bool physicsEnabled = false; 46 private bool physicsEnabled = false;
47 private PhysicsScene m_PhysScene; 47 private PhysicsScene m_PhysScene;
48 private PhysicsActor m_PhysActor; 48 private PhysicsActor m_PhysActor;
49 49
50 private EventManager m_eventManager; 50 private EventManager m_eventManager;
51 51
52 public bool isSelected = false; 52 public bool isSelected = false;
53 53
54 public LLUUID rootUUID 54 public LLUUID rootUUID
55 { 55 {
56 get 56 get
57 { 57 {
58 this.uuid = this.rootPrimitive.uuid; 58 this.uuid = this.rootPrimitive.uuid;
59 return this.uuid; 59 return this.uuid;
60 } 60 }
61 } 61 }
62 62
63 public uint rootLocalID 63 public uint rootLocalID
64 { 64 {
65 get 65 get
66 { 66 {
67 this.m_localId = this.rootPrimitive.LocalId; 67 this.m_localId = this.rootPrimitive.LocalId;
68 return this.LocalId; 68 return this.LocalId;
69 } 69 }
70 } 70 }
71 71
72 public int primCount 72 public int primCount
73 { 73 {
74 get 74 get
75 { 75 {
76 return this.ChildPrimitives.Count; 76 return this.ChildPrimitives.Count;
77 } 77 }
78 } 78 }
79 79
80 public Dictionary<LLUUID, Primitive> Children 80 public Dictionary<LLUUID, Primitive> Children
81 { 81 {
82 get 82 get
83 { 83 {
84 return this.ChildPrimitives; 84 return this.ChildPrimitives;
85 } 85 }
86 } 86 }
87 87
88 /// <summary> 88 /// <summary>
89 /// 89 ///
90 /// </summary> 90 /// </summary>
91 public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 91 public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
92 { 92 {
93 m_regionHandle = world.RegionInfo.RegionHandle; 93 m_regionHandle = world.RegionInfo.RegionHandle;
94 m_world = world; 94 m_world = world;
95 m_eventManager = eventManager; 95 m_eventManager = eventManager;
96 96
97 this.Pos = pos; 97 this.Pos = pos;
98 this.CreateRootFromShape(ownerID, localID, shape, pos); 98 this.CreateRootFromShape(ownerID, localID, shape, pos);
99 99
100 registerEvents(); 100 registerEvents();
101 101
102 } 102 }
103 103
104 /// <summary> 104 /// <summary>
105 /// 105 ///
106 /// </summary> 106 /// </summary>
107 /// <remarks>Need a null constructor for duplication</remarks> 107 /// <remarks>Need a null constructor for duplication</remarks>
108 public SceneObject() 108 public SceneObject()
109 { 109 {
110 110
111 } 111 }
112 112
113 public void registerEvents() 113 public void registerEvents()
114 { 114 {
115 m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup); 115 m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup);
116 m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate); 116 m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
117 } 117 }
118 118
119 public void unregisterEvents() 119 public void unregisterEvents()
120 { 120 {
121 m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup); 121 m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup);
122 m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate); 122 m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
123 } 123 }
124 124
125 /// <summary> 125 /// <summary>
126 /// Processes backup 126 /// Processes backup
127 /// </summary> 127 /// </summary>
128 /// <param name="datastore"></param> 128 /// <param name="datastore"></param>
129 public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore) 129 public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
130 { 130 {
131 datastore.StoreObject(this); 131 datastore.StoreObject(this);
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Sends my primitive info to the parcel manager for it to keep tally of all of the prims! 135 /// Sends my primitive info to the parcel manager for it to keep tally of all of the prims!
136 /// </summary> 136 /// </summary>
137 private void ProcessParcelPrimCountUpdate() 137 private void ProcessParcelPrimCountUpdate()
138 { 138 {
139 139
140 m_eventManager.TriggerParcelPrimCountAdd(this); 140 m_eventManager.TriggerParcelPrimCountAdd(this);
141 } 141 }
142 142
143 /// <summary> 143 /// <summary>
144 /// 144 ///
145 /// </summary> 145 /// </summary>
146 /// <param name="addPacket"></param> 146 /// <param name="addPacket"></param>
147 /// <param name="agentID"></param> 147 /// <param name="agentID"></param>
148 /// <param name="localID"></param> 148 /// <param name="localID"></param>
149 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) 149 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
150 { 150 {
151 151
152 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); 152 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
153 153
154 this.children.Add(rootPrimitive); 154 this.children.Add(rootPrimitive);
155 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 155 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
156 } 156 }
157 157
158 /// <summary> 158 /// <summary>
159 /// 159 ///
160 /// </summary> 160 /// </summary>
161 /// <param name="data"></param> 161 /// <param name="data"></param>
162 public void CreateFromBytes(byte[] data) 162 public void CreateFromBytes(byte[] data)
163 { 163 {
164 164
165 } 165 }
166 166
167 /// <summary> 167 /// <summary>
168 /// Makes a copy of this SceneObject (and child primitives) 168 /// Makes a copy of this SceneObject (and child primitives)
169 /// </summary> 169 /// </summary>
170 /// <returns>A complete copy of the object</returns> 170 /// <returns>A complete copy of the object</returns>
171 public new SceneObject Copy() 171 public new SceneObject Copy()
172 { 172 {
173 SceneObject dupe = new SceneObject(); 173 SceneObject dupe = new SceneObject();
174 174
175 dupe.m_world = this.m_world; 175 dupe.m_world = this.m_world;
176 dupe.m_eventManager = this.m_eventManager; 176 dupe.m_eventManager = this.m_eventManager;
177 dupe.m_regionHandle = this.m_regionHandle; 177 dupe.m_regionHandle = this.m_regionHandle;
178 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe); 178 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
179 dupe.rootPrimitive = newRoot; 179 dupe.rootPrimitive = newRoot;
180 dupe.children.Add(dupe.rootPrimitive); 180 dupe.children.Add(dupe.rootPrimitive);
181 dupe.rootPrimitive.Pos = this.Pos; 181 dupe.rootPrimitive.Pos = this.Pos;
182 dupe.Rotation = this.Rotation; 182 dupe.Rotation = this.Rotation;
183 dupe.LocalId = m_world.PrimIDAllocate(); 183 dupe.LocalId = m_world.PrimIDAllocate();
184 184
185 dupe.registerEvents(); 185 dupe.registerEvents();
186 return dupe; 186 return dupe;
187 } 187 }
188 188
189 /// <summary> 189 /// <summary>
190 /// 190 ///
191 /// </summary> 191 /// </summary>
192 public void DeleteAllChildren() 192 public void DeleteAllChildren()
193 { 193 {
194 this.children.Clear(); 194 this.children.Clear();
195 this.ChildPrimitives.Clear(); 195 this.ChildPrimitives.Clear();
196 this.rootPrimitive = null; 196 this.rootPrimitive = null;
197 unregisterEvents(); 197 unregisterEvents();
198 } 198 }
199 199
200 /// <summary> 200 /// <summary>
201 /// 201 ///
202 /// </summary> 202 /// </summary>
203 /// <param name="primObject"></param> 203 /// <param name="primObject"></param>
204 public void AddNewChildPrims(SceneObject primObject) 204 public void AddNewChildPrims(SceneObject primObject)
205 { 205 {
206 this.rootPrimitive.AddNewChildren(primObject); 206 this.rootPrimitive.AddNewChildren(primObject);
207 } 207 }
208 208
209 public void AddChildToList(Primitive prim) 209 public void AddChildToList(Primitive prim)
210 { 210 {
211 if (!this.ChildPrimitives.ContainsKey(prim.uuid)) 211 if (!this.ChildPrimitives.ContainsKey(prim.uuid))
212 { 212 {
213 this.ChildPrimitives.Add(prim.uuid, prim); 213 this.ChildPrimitives.Add(prim.uuid, prim);
214 } 214 }
215 } 215 }
216 /// <summary> 216 /// <summary>
217 /// 217 ///
218 /// </summary> 218 /// </summary>
219 /// <param name="primID"></param> 219 /// <param name="primID"></param>
220 /// <returns></returns> 220 /// <returns></returns>
221 public Primitive HasChildPrim(LLUUID primID) 221 public Primitive HasChildPrim(LLUUID primID)
222 { 222 {
223 if (this.ChildPrimitives.ContainsKey(primID)) 223 if (this.ChildPrimitives.ContainsKey(primID))
224 { 224 {
225 return this.ChildPrimitives[primID]; 225 return this.ChildPrimitives[primID];
226 } 226 }
227 227
228 return null; 228 return null;
229 } 229 }
230 230
231 /// <summary> 231 /// <summary>
232 /// 232 ///
233 /// </summary> 233 /// </summary>
234 /// <param name="localID"></param> 234 /// <param name="localID"></param>
235 /// <returns></returns> 235 /// <returns></returns>
236 public Primitive HasChildPrim(uint localID) 236 public Primitive HasChildPrim(uint localID)
237 { 237 {
238 Primitive returnPrim = null; 238 Primitive returnPrim = null;
239 foreach (Primitive prim in this.ChildPrimitives.Values) 239 foreach (Primitive prim in this.ChildPrimitives.Values)
240 { 240 {
241 if (prim.LocalId == localID) 241 if (prim.LocalId == localID)
242 { 242 {
243 returnPrim = prim; 243 returnPrim = prim;
244 break; 244 break;
245 } 245 }
246 } 246 }
247 return returnPrim; 247 return returnPrim;
248 } 248 }
249 249
250 public void SendAllChildPrimsToClient(IClientAPI client) 250 public void SendAllChildPrimsToClient(IClientAPI client)
251 { 251 {
252 this.rootPrimitive.SendFullUpdateForAllChildren(client); 252 this.rootPrimitive.SendFullUpdateForAllChildren(client);
253 } 253 }
254 254
255 /// <summary> 255 /// <summary>
256 /// 256 ///
257 /// </summary> 257 /// </summary>
258 public override void BackUp() 258 public override void BackUp()
259 { 259 {
260 260
261 } 261 }
262 262
263 /// <summary> 263 /// <summary>
264 /// 264 ///
265 /// </summary> 265 /// </summary>
266 /// <param name="offset"></param> 266 /// <param name="offset"></param>
267 /// <param name="pos"></param> 267 /// <param name="pos"></param>
268 /// <param name="remoteClient"></param> 268 /// <param name="remoteClient"></param>
269 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 269 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
270 { 270 {
271 this.rootPrimitive.Pos = pos; 271 this.rootPrimitive.Pos = pos;
272 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); 272 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
273 } 273 }
274 274
275 /// <summary> 275 /// <summary>
276 /// 276 ///
277 /// </summary> 277 /// </summary>
278 /// <param name="client"></param> 278 /// <param name="client"></param>
279 public void GetProperites(IClientAPI client) 279 public void GetProperites(IClientAPI client)
280 { 280 {
281 ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); 281 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
282 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 282 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
283 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 283 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
284 proper.ObjectData[0].ItemID = LLUUID.Zero; 284 proper.ObjectData[0].ItemID = LLUUID.Zero;
285 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate; 285 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
286 proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID; 286 proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
287 proper.ObjectData[0].FolderID = LLUUID.Zero; 287 proper.ObjectData[0].FolderID = LLUUID.Zero;
288 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 288 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
289 proper.ObjectData[0].GroupID = LLUUID.Zero; 289 proper.ObjectData[0].GroupID = LLUUID.Zero;
290 proper.ObjectData[0].InventorySerial = 0; 290 proper.ObjectData[0].InventorySerial = 0;
291 proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID; 291 proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
292 proper.ObjectData[0].ObjectID = this.rootUUID; 292 proper.ObjectData[0].ObjectID = this.rootUUID;
293 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; 293 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
294 proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0"); 294 proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
295 proper.ObjectData[0].TextureID = new byte[0]; 295 proper.ObjectData[0].TextureID = new byte[0];
296 proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0"); 296 proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0");
297 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0"); 297 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0");
298 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0"); 298 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0");
299 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; 299 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
300 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; 300 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
301 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; 301 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
302 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask; 302 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
303 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask; 303 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
304 304
305 client.OutPacket(proper); 305 client.OutPacket(proper);
306 } 306 }
307 307
308 } 308 }
309} 309}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index d1f75ed..e88ee71 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -1,74 +1,74 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Xml; 29using System.Xml;
30using libsecondlife; 30using libsecondlife;
31 31
32namespace OpenSim.Region.Environment.Scenes 32namespace OpenSim.Region.Environment.Scenes
33{ 33{
34 partial class ScenePresence 34 partial class ScenePresence
35 { 35 {
36 public class AvatarAnimations 36 public class AvatarAnimations
37 { 37 {
38 38
39 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); 39 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
40 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); 40 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
41 41
42 public AvatarAnimations() 42 public AvatarAnimations()
43 { 43 {
44 } 44 }
45 45
46 public void LoadAnims() 46 public void LoadAnims()
47 { 47 {
48 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); 48 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
49 XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); 49 XmlTextReader reader = new XmlTextReader("data/avataranimations.xml");
50 50
51 XmlDocument doc = new XmlDocument(); 51 XmlDocument doc = new XmlDocument();
52 doc.Load(reader); 52 doc.Load(reader);
53 foreach (XmlNode nod in doc.DocumentElement.ChildNodes) 53 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
54 { 54 {
55 55
56 if (nod.Attributes["name"] != null) 56 if (nod.Attributes["name"] != null)
57 { 57 {
58 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); 58 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
59 } 59 }
60 60
61 } 61 }
62 62
63 reader.Close(); 63 reader.Close();
64 64
65 // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); 65 // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
66 66
67 foreach (KeyValuePair<string, LLUUID> kp in Animations.AnimsLLUUID) 67 foreach (KeyValuePair<string, LLUUID> kp in Animations.AnimsLLUUID)
68 { 68 {
69 AnimsNames.Add(kp.Value, kp.Key); 69 AnimsNames.Add(kp.Value, kp.Key);
70 } 70 }
71 } 71 }
72 } 72 }
73 } 73 }
74} 74}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
index dbb5d3f..c2599a1 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
@@ -1,85 +1,85 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using libsecondlife.Packets; 29using libsecondlife.Packets;
30using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
31 31
32namespace OpenSim.Region.Environment.Scenes 32namespace OpenSim.Region.Environment.Scenes
33{ 33{
34 partial class ScenePresence 34 partial class ScenePresence
35 { 35 {
36 public class Avatar : IScenePresenceBody 36 public class Avatar : IScenePresenceBody
37 { 37 {
38 public Avatar() 38 public Avatar()
39 { 39 {
40 40
41 } 41 }
42 42
43 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 43 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
44 { 44 {
45 } 45 }
46 46
47 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) 47 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
48 { 48 {
49 } 49 }
50 50
51 public void SendOurAppearance(IClientAPI OurClient) 51 public void SendOurAppearance(IClientAPI OurClient)
52 { 52 {
53 } 53 }
54 54
55 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 55 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
56 { 56 {
57 } 57 }
58 } 58 }
59 59
60 public class ChildAgent : IScenePresenceBody //is a ghost 60 public class ChildAgent : IScenePresenceBody //is a ghost
61 { 61 {
62 public ChildAgent() 62 public ChildAgent()
63 { 63 {
64 64
65 } 65 }
66 66
67 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 67 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
68 { 68 {
69 } 69 }
70 70
71 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) 71 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
72 { 72 {
73 } 73 }
74 74
75 public void SendOurAppearance(IClientAPI OurClient) 75 public void SendOurAppearance(IClientAPI OurClient)
76 { 76 {
77 } 77 }
78 78
79 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 79 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
80 { 80 {
81 } 81 }
82 } 82 }
83 } 83 }
84 84
85} 85}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index b619b59..ae49d9f 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1,623 +1,623 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using Axiom.Math; 31using Axiom.Math;
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets; 33using libsecondlife.Packets;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Physics.Manager; 37using OpenSim.Physics.Manager;
38 38
39namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public partial class ScenePresence : Entity 41 public partial class ScenePresence : Entity
42 { 42 {
43 public static bool PhysicsEngineFlying = false; 43 public static bool PhysicsEngineFlying = false;
44 public static AvatarAnimations Animations; 44 public static AvatarAnimations Animations;
45 public static byte[] DefaultTexture; 45 public static byte[] DefaultTexture;
46 public string firstname; 46 public string firstname;
47 public string lastname; 47 public string lastname;
48 public IClientAPI ControllingClient; 48 public IClientAPI ControllingClient;
49 public LLUUID current_anim; 49 public LLUUID current_anim;
50 public int anim_seq; 50 public int anim_seq;
51 private bool updateflag = false; 51 private bool updateflag = false;
52 private byte movementflag = 0; 52 private byte movementflag = 0;
53 private List<NewForce> forcesList = new List<NewForce>(); 53 private List<NewForce> forcesList = new List<NewForce>();
54 private short _updateCount = 0; 54 private short _updateCount = 0;
55 private Quaternion bodyRot; 55 private Quaternion bodyRot;
56 private LLObject.TextureEntry avatarAppearanceTexture = null; 56 private LLObject.TextureEntry avatarAppearanceTexture = null;
57 private byte[] visualParams; 57 private byte[] visualParams;
58 private AvatarWearable[] Wearables; 58 private AvatarWearable[] Wearables;
59 private ulong m_regionHandle; 59 private ulong m_regionHandle;
60 60
61 public bool childAgent = false; 61 public bool childAgent = false;
62 public bool IsRestrictedToRegion = false; 62 public bool IsRestrictedToRegion = false;
63 63
64 private bool newForce = false; 64 private bool newForce = false;
65 private bool newAvatar = false; 65 private bool newAvatar = false;
66 private IScenePresenceBody m_body; 66 private IScenePresenceBody m_body;
67 67
68 protected RegionInfo m_regionInfo; 68 protected RegionInfo m_regionInfo;
69 69
70 private Vector3[] Dir_Vectors = new Vector3[6]; 70 private Vector3[] Dir_Vectors = new Vector3[6];
71 private enum Dir_ControlFlags 71 private enum Dir_ControlFlags
72 { 72 {
73 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, 73 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
74 DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG, 74 DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG,
75 DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS, 75 DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS,
76 DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG, 76 DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG,
77 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, 77 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
78 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG 78 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
79 } 79 }
80 /// <summary> 80 /// <summary>
81 /// Position at which a significant movement was made 81 /// Position at which a significant movement was made
82 /// </summary> 82 /// </summary>
83 private LLVector3 posLastSignificantMove = new LLVector3(); 83 private LLVector3 posLastSignificantMove = new LLVector3();
84 84
85 public delegate void SignificantClientMovement(IClientAPI remote_client); 85 public delegate void SignificantClientMovement(IClientAPI remote_client);
86 public event SignificantClientMovement OnSignificantClientMovement; 86 public event SignificantClientMovement OnSignificantClientMovement;
87 87
88 #region Properties 88 #region Properties
89 /// <summary> 89 /// <summary>
90 /// 90 ///
91 /// </summary> 91 /// </summary>
92 public PhysicsActor PhysActor 92 public PhysicsActor PhysActor
93 { 93 {
94 set 94 set
95 { 95 {
96 this._physActor = value; 96 this._physActor = value;
97 } 97 }
98 get 98 get
99 { 99 {
100 return _physActor; 100 return _physActor;
101 } 101 }
102 } 102 }
103 103
104 public ulong RegionHandle 104 public ulong RegionHandle
105 { 105 {
106 get { return m_regionHandle; } 106 get { return m_regionHandle; }
107 } 107 }
108 108
109 #endregion 109 #endregion
110 110
111 #region Constructor(s) 111 #region Constructor(s)
112 /// <summary> 112 /// <summary>
113 /// 113 ///
114 /// </summary> 114 /// </summary>
115 /// <param name="theClient"></param> 115 /// <param name="theClient"></param>
116 /// <param name="world"></param> 116 /// <param name="world"></param>
117 /// <param name="clientThreads"></param> 117 /// <param name="clientThreads"></param>
118 /// <param name="regionDat"></param> 118 /// <param name="regionDat"></param>
119 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) 119 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
120 { 120 {
121 121
122 m_world = world; 122 m_world = world;
123 this.uuid = theClient.AgentId; 123 this.uuid = theClient.AgentId;
124 124
125 m_regionInfo = reginfo; 125 m_regionInfo = reginfo;
126 m_regionHandle = reginfo.RegionHandle; 126 m_regionHandle = reginfo.RegionHandle;
127 MainLog.Instance.Verbose("Avatar.cs "); 127 MainLog.Instance.Verbose("Avatar.cs ");
128 ControllingClient = theClient; 128 ControllingClient = theClient;
129 this.firstname = ControllingClient.FirstName; 129 this.firstname = ControllingClient.FirstName;
130 this.lastname = ControllingClient.LastName; 130 this.lastname = ControllingClient.LastName;
131 m_localId = m_world.NextLocalId; 131 m_localId = m_world.NextLocalId;
132 Pos = ControllingClient.StartPos; 132 Pos = ControllingClient.StartPos;
133 visualParams = new byte[218]; 133 visualParams = new byte[218];
134 for (int i = 0; i < 218; i++) 134 for (int i = 0; i < 218; i++)
135 { 135 {
136 visualParams[i] = 100; 136 visualParams[i] = 100;
137 } 137 }
138 138
139 Wearables = AvatarWearable.DefaultWearables; 139 Wearables = AvatarWearable.DefaultWearables;
140 Animations = new ScenePresence.AvatarAnimations(); 140 Animations = new ScenePresence.AvatarAnimations();
141 Animations.LoadAnims(); 141 Animations.LoadAnims();
142 142
143 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 143 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
144 144
145 //register for events 145 //register for events
146 ControllingClient.OnRequestWearables += this.SendOurAppearance; 146 ControllingClient.OnRequestWearables += this.SendOurAppearance;
147 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 147 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
148 ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; 148 ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement;
149 ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; 149 ControllingClient.OnCompleteMovementToRegion += this.SendInitialData;
150 ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; 150 ControllingClient.OnAgentUpdate += this.HandleAgentUpdate;
151 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 151 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
152 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 152 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
153 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 153 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
154 154
155 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD 155 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD
156 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK 156 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK
157 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT 157 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT
158 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT 158 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT
159 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP 159 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP
160 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN 160 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
161 161
162 } 162 }
163 #endregion 163 #endregion
164 164
165 #region Status Methods 165 #region Status Methods
166 /// <summary> 166 /// <summary>
167 /// Not Used, most likely can be deleted 167 /// Not Used, most likely can be deleted
168 /// </summary> 168 /// </summary>
169 /// <param name="status"></param> 169 /// <param name="status"></param>
170 public void ChildStatusChange(bool status) 170 public void ChildStatusChange(bool status)
171 { 171 {
172 this.childAgent = status; 172 this.childAgent = status;
173 173
174 if (this.childAgent == true) 174 if (this.childAgent == true)
175 { 175 {
176 this.Velocity = new LLVector3(0, 0, 0); 176 this.Velocity = new LLVector3(0, 0, 0);
177 this.Pos = new LLVector3(128, 128, 70); 177 this.Pos = new LLVector3(128, 128, 70);
178 178
179 } 179 }
180 } 180 }
181 181
182 /// <summary> 182 /// <summary>
183 /// 183 ///
184 /// </summary> 184 /// </summary>
185 /// <param name="pos"></param> 185 /// <param name="pos"></param>
186 public void MakeAvatar(LLVector3 pos) 186 public void MakeAvatar(LLVector3 pos)
187 { 187 {
188 //this.childAvatar = false; 188 //this.childAvatar = false;
189 this.Pos = pos; 189 this.Pos = pos;
190 this.newAvatar = true; 190 this.newAvatar = true;
191 this.childAgent = false; 191 this.childAgent = false;
192 } 192 }
193 193
194 protected void MakeChildAgent() 194 protected void MakeChildAgent()
195 { 195 {
196 this.Velocity = new LLVector3(0, 0, 0); 196 this.Velocity = new LLVector3(0, 0, 0);
197 this.Pos = new LLVector3(128, 128, 70); 197 this.Pos = new LLVector3(128, 128, 70);
198 this.childAgent = true; 198 this.childAgent = true;
199 } 199 }
200 200
201 /// <summary> 201 /// <summary>
202 /// 202 ///
203 /// </summary> 203 /// </summary>
204 /// <param name="pos"></param> 204 /// <param name="pos"></param>
205 public void Teleport(LLVector3 pos) 205 public void Teleport(LLVector3 pos)
206 { 206 {
207 this.Pos = pos; 207 this.Pos = pos;
208 this.SendTerseUpdateToALLClients(); 208 this.SendTerseUpdateToALLClients();
209 } 209 }
210 210
211 /// <summary> 211 /// <summary>
212 /// 212 ///
213 /// </summary> 213 /// </summary>
214 public void StopMovement() 214 public void StopMovement()
215 { 215 {
216 216
217 } 217 }
218 #endregion 218 #endregion
219 219
220 #region Event Handlers 220 #region Event Handlers
221 /// <summary> 221 /// <summary>
222 /// 222 ///
223 /// </summary> 223 /// </summary>
224 /// <param name="texture"></param> 224 /// <param name="texture"></param>
225 /// <param name="visualParam"></param> 225 /// <param name="visualParam"></param>
226 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) 226 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
227 { 227 {
228 228
229 } 229 }
230 230
231 /// <summary> 231 /// <summary>
232 /// Complete Avatar's movement into the region 232 /// Complete Avatar's movement into the region
233 /// </summary> 233 /// </summary>
234 public void CompleteMovement() 234 public void CompleteMovement()
235 { 235 {
236 LLVector3 look = this.Velocity; 236 LLVector3 look = this.Velocity;
237 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 237 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
238 { 238 {
239 look = new LLVector3(0.99f, 0.042f, 0); 239 look = new LLVector3(0.99f, 0.042f, 0);
240 } 240 }
241 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); 241 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look);
242 if (this.childAgent) 242 if (this.childAgent)
243 { 243 {
244 this.childAgent = false; 244 this.childAgent = false;
245 } 245 }
246 } 246 }
247 247
248 /// <summary> 248 /// <summary>
249 /// 249 ///
250 /// </summary> 250 /// </summary>
251 /// <param name="pack"></param> 251 /// <param name="pack"></param>
252 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 252 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
253 { 253 {
254 int i = 0; 254 int i = 0;
255 bool update_movementflag = false; 255 bool update_movementflag = false;
256 bool update_rotation = false; 256 bool update_rotation = false;
257 bool DCFlagKeyPressed = false; 257 bool DCFlagKeyPressed = false;
258 Vector3 agent_control_v3 = new Vector3(0, 0, 0); 258 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
259 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 259 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
260 260
261 this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 261 this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
262 262
263 if (q != this.bodyRot) 263 if (q != this.bodyRot)
264 { 264 {
265 this.bodyRot = q; 265 this.bodyRot = q;
266 update_rotation = true; 266 update_rotation = true;
267 } 267 }
268 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 268 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
269 { 269 {
270 if ((flags & (uint)DCF) != 0) 270 if ((flags & (uint)DCF) != 0)
271 { 271 {
272 DCFlagKeyPressed = true; 272 DCFlagKeyPressed = true;
273 agent_control_v3 += Dir_Vectors[i]; 273 agent_control_v3 += Dir_Vectors[i];
274 if ((movementflag & (uint)DCF) == 0) 274 if ((movementflag & (uint)DCF) == 0)
275 { 275 {
276 movementflag += (byte)(uint)DCF; 276 movementflag += (byte)(uint)DCF;
277 update_movementflag = true; 277 update_movementflag = true;
278 } 278 }
279 } 279 }
280 else 280 else
281 { 281 {
282 if ((movementflag & (uint)DCF) != 0) 282 if ((movementflag & (uint)DCF) != 0)
283 { 283 {
284 movementflag -= (byte)(uint)DCF; 284 movementflag -= (byte)(uint)DCF;
285 update_movementflag = true; 285 update_movementflag = true;
286 286
287 } 287 }
288 } 288 }
289 i++; 289 i++;
290 } 290 }
291 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 291 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
292 { 292 {
293 this.AddNewMovement(agent_control_v3, q); 293 this.AddNewMovement(agent_control_v3, q);
294 } 294 }
295 UpdateMovementAnimations(update_movementflag); 295 UpdateMovementAnimations(update_movementflag);
296 } 296 }
297 297
298 protected void UpdateMovementAnimations(bool update_movementflag) 298 protected void UpdateMovementAnimations(bool update_movementflag)
299 { 299 {
300 if (update_movementflag) 300 if (update_movementflag)
301 { 301 {
302 if (movementflag != 0) 302 if (movementflag != 0)
303 { 303 {
304 if (this._physActor.Flying) 304 if (this._physActor.Flying)
305 { 305 {
306 this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); 306 this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1);
307 } 307 }
308 else 308 else
309 { 309 {
310 this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); 310 this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
311 } 311 }
312 } 312 }
313 else 313 else
314 { 314 {
315 this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); 315 this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
316 } 316 }
317 } 317 }
318 318
319 } 319 }
320 320
321 321
322 protected void AddNewMovement(Vector3 vec, Quaternion rotation) 322 protected void AddNewMovement(Vector3 vec, Quaternion rotation)
323 { 323 {
324 NewForce newVelocity = new NewForce(); 324 NewForce newVelocity = new NewForce();
325 Vector3 direc = rotation * vec; 325 Vector3 direc = rotation * vec;
326 direc.Normalize(); 326 direc.Normalize();
327 327
328 direc = direc * ((0.03f) * 128f); 328 direc = direc * ((0.03f) * 128f);
329 if (this._physActor.Flying) 329 if (this._physActor.Flying)
330 direc *= 4; 330 direc *= 4;
331 331
332 newVelocity.X = direc.x; 332 newVelocity.X = direc.x;
333 newVelocity.Y = direc.y; 333 newVelocity.Y = direc.y;
334 newVelocity.Z = direc.z; 334 newVelocity.Z = direc.z;
335 this.forcesList.Add(newVelocity); 335 this.forcesList.Add(newVelocity);
336 } 336 }
337 337
338 #endregion 338 #endregion
339 339
340 #region Overridden Methods 340 #region Overridden Methods
341 /// <summary> 341 /// <summary>
342 /// 342 ///
343 /// </summary> 343 /// </summary>
344 public override void LandRenegerated() 344 public override void LandRenegerated()
345 { 345 {
346 346
347 } 347 }
348 348
349 /// <summary> 349 /// <summary>
350 /// 350 ///
351 /// </summary> 351 /// </summary>
352 public override void update() 352 public override void update()
353 { 353 {
354 if (this.childAgent == false) 354 if (this.childAgent == false)
355 { 355 {
356 if (this.newForce) 356 if (this.newForce)
357 { 357 {
358 this.SendTerseUpdateToALLClients(); 358 this.SendTerseUpdateToALLClients();
359 _updateCount = 0; 359 _updateCount = 0;
360 } 360 }
361 else if (movementflag != 0) 361 else if (movementflag != 0)
362 { 362 {
363 _updateCount++; 363 _updateCount++;
364 if (_updateCount > 3) 364 if (_updateCount > 3)
365 { 365 {
366 this.SendTerseUpdateToALLClients(); 366 this.SendTerseUpdateToALLClients();
367 _updateCount = 0; 367 _updateCount = 0;
368 } 368 }
369 } 369 }
370 370
371 this.CheckForSignificantMovement(); 371 this.CheckForSignificantMovement();
372 this.CheckForBorderCrossing(); 372 this.CheckForBorderCrossing();
373 373
374 } 374 }
375 } 375 }
376 #endregion 376 #endregion
377 377
378 #region Update Client(s) 378 #region Update Client(s)
379 /// <summary> 379 /// <summary>
380 /// 380 ///
381 /// </summary> 381 /// </summary>
382 /// <param name="RemoteClient"></param> 382 /// <param name="RemoteClient"></param>
383 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 383 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
384 { 384 {
385 LLVector3 pos = this.Pos; 385 LLVector3 pos = this.Pos;
386 LLVector3 vel = this.Velocity; 386 LLVector3 vel = this.Velocity;
387 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); 387 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z));
388 } 388 }
389 389
390 /// <summary> 390 /// <summary>
391 /// 391 ///
392 /// </summary> 392 /// </summary>
393 public void SendTerseUpdateToALLClients() 393 public void SendTerseUpdateToALLClients()
394 { 394 {
395 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 395 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
396 for (int i = 0; i < avatars.Count; i++) 396 for (int i = 0; i < avatars.Count; i++)
397 { 397 {
398 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 398 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
399 } 399 }
400 } 400 }
401 401
402 /// <summary> 402 /// <summary>
403 /// 403 ///
404 /// </summary> 404 /// </summary>
405 /// <param name="remoteAvatar"></param> 405 /// <param name="remoteAvatar"></param>
406 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 406 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
407 { 407 {
408 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); 408 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture);
409 } 409 }
410 410
411 public void SendFullUpdateToALLClients() 411 public void SendFullUpdateToALLClients()
412 { 412 {
413 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 413 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
414 foreach (ScenePresence avatar in this.m_world.RequestAvatarList()) 414 foreach (ScenePresence avatar in this.m_world.RequestAvatarList())
415 { 415 {
416 this.SendFullUpdateToOtherClient(avatar); 416 this.SendFullUpdateToOtherClient(avatar);
417 avatar.SendFullUpdateToOtherClient(this); 417 avatar.SendFullUpdateToOtherClient(this);
418 } 418 }
419 } 419 }
420 420
421 /// <summary> 421 /// <summary>
422 /// 422 ///
423 /// </summary> 423 /// </summary>
424 public void SendInitialData() 424 public void SendInitialData()
425 { 425 {
426 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); 426 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture);
427 if (this.newAvatar) 427 if (this.newAvatar)
428 { 428 {
429 this.m_world.InformClientOfNeighbours(this.ControllingClient); 429 this.m_world.InformClientOfNeighbours(this.ControllingClient);
430 this.newAvatar = false; 430 this.newAvatar = false;
431 } 431 }
432 } 432 }
433 433
434 /// <summary> 434 /// <summary>
435 /// 435 ///
436 /// </summary> 436 /// </summary>
437 /// <param name="OurClient"></param> 437 /// <param name="OurClient"></param>
438 public void SendOurAppearance(IClientAPI OurClient) 438 public void SendOurAppearance(IClientAPI OurClient)
439 { 439 {
440 this.ControllingClient.SendWearables(this.Wearables); 440 this.ControllingClient.SendWearables(this.Wearables);
441 this.SendFullUpdateToALLClients(); 441 this.SendFullUpdateToALLClients();
442 this.m_world.SendAllSceneObjectsToClient(this.ControllingClient); 442 this.m_world.SendAllSceneObjectsToClient(this.ControllingClient);
443 } 443 }
444 444
445 /// <summary> 445 /// <summary>
446 /// 446 ///
447 /// </summary> 447 /// </summary>
448 /// <param name="avatarInfo"></param> 448 /// <param name="avatarInfo"></param>
449 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 449 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
450 { 450 {
451 451
452 } 452 }
453 453
454 /// <summary> 454 /// <summary>
455 /// 455 ///
456 /// </summary> 456 /// </summary>
457 /// <param name="animID"></param> 457 /// <param name="animID"></param>
458 /// <param name="seq"></param> 458 /// <param name="seq"></param>
459 public void SendAnimPack(LLUUID animID, int seq) 459 public void SendAnimPack(LLUUID animID, int seq)
460 { 460 {
461 this.current_anim = animID; 461 this.current_anim = animID;
462 this.anim_seq = seq; 462 this.anim_seq = seq;
463 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 463 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
464 for (int i = 0; i < avatars.Count; i++) 464 for (int i = 0; i < avatars.Count; i++)
465 { 465 {
466 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); 466 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
467 } 467 }
468 } 468 }
469 469
470 /// <summary> 470 /// <summary>
471 /// 471 ///
472 /// </summary> 472 /// </summary>
473 public void SendAnimPack() 473 public void SendAnimPack()
474 { 474 {
475 this.SendAnimPack(this.current_anim, this.anim_seq); 475 this.SendAnimPack(this.current_anim, this.anim_seq);
476 } 476 }
477 #endregion 477 #endregion
478 478
479 #region Significant Movement Method 479 #region Significant Movement Method
480 480
481 protected void CheckForSignificantMovement() 481 protected void CheckForSignificantMovement()
482 { 482 {
483 if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0) 483 if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0)
484 { 484 {
485 this.posLastSignificantMove = this.Pos; 485 this.posLastSignificantMove = this.Pos;
486 if (OnSignificantClientMovement != null) 486 if (OnSignificantClientMovement != null)
487 { 487 {
488 OnSignificantClientMovement(this.ControllingClient); 488 OnSignificantClientMovement(this.ControllingClient);
489 } 489 }
490 } 490 }
491 } 491 }
492 #endregion 492 #endregion
493 #region Border Crossing Methods 493 #region Border Crossing Methods
494 /// <summary> 494 /// <summary>
495 /// 495 ///
496 /// </summary> 496 /// </summary>
497 protected void CheckForBorderCrossing() 497 protected void CheckForBorderCrossing()
498 { 498 {
499 LLVector3 pos2 = this.Pos; 499 LLVector3 pos2 = this.Pos;
500 LLVector3 vel = this.Velocity; 500 LLVector3 vel = this.Velocity;
501 501
502 float timeStep = 0.2f; 502 float timeStep = 0.2f;
503 pos2.X = pos2.X + (vel.X * timeStep); 503 pos2.X = pos2.X + (vel.X * timeStep);
504 pos2.Y = pos2.Y + (vel.Y * timeStep); 504 pos2.Y = pos2.Y + (vel.Y * timeStep);
505 pos2.Z = pos2.Z + (vel.Z * timeStep); 505 pos2.Z = pos2.Z + (vel.Z * timeStep);
506 506
507 if ((pos2.X < 0) || (pos2.X > 256)) 507 if ((pos2.X < 0) || (pos2.X > 256))
508 { 508 {
509 this.CrossToNewRegion(); 509 this.CrossToNewRegion();
510 } 510 }
511 511
512 if ((pos2.Y < 0) || (pos2.Y > 256)) 512 if ((pos2.Y < 0) || (pos2.Y > 256))
513 { 513 {
514 this.CrossToNewRegion(); 514 this.CrossToNewRegion();
515 } 515 }
516 } 516 }
517 517
518 /// <summary> 518 /// <summary>
519 /// 519 ///
520 /// </summary> 520 /// </summary>
521 protected void CrossToNewRegion() 521 protected void CrossToNewRegion()
522 { 522 {
523 LLVector3 pos = this.Pos; 523 LLVector3 pos = this.Pos;
524 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); 524 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
525 uint neighbourx = this.m_regionInfo.RegionLocX; 525 uint neighbourx = this.m_regionInfo.RegionLocX;
526 uint neighboury = this.m_regionInfo.RegionLocY; 526 uint neighboury = this.m_regionInfo.RegionLocY;
527 527
528 if (pos.X < 2) 528 if (pos.X < 2)
529 { 529 {
530 neighbourx -= 1; 530 neighbourx -= 1;
531 newpos.X = 254; 531 newpos.X = 254;
532 } 532 }
533 if (pos.X > 253) 533 if (pos.X > 253)
534 { 534 {
535 neighbourx += 1; 535 neighbourx += 1;
536 newpos.X = 1; 536 newpos.X = 1;
537 } 537 }
538 if (pos.Y < 2) 538 if (pos.Y < 2)
539 { 539 {
540 neighboury -= 1; 540 neighboury -= 1;
541 newpos.Y = 254; 541 newpos.Y = 254;
542 } 542 }
543 if (pos.Y > 253) 543 if (pos.Y > 253)
544 { 544 {
545 neighboury += 1; 545 neighboury += 1;
546 newpos.Y = 1; 546 newpos.Y = 1;
547 } 547 }
548 548
549 LLVector3 vel = this.m_velocity; 549 LLVector3 vel = this.m_velocity;
550 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 550 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256));
551 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); 551 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
552 if (neighbourRegion != null) 552 if (neighbourRegion != null)
553 { 553 {
554 bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); 554 bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
555 if (res) 555 if (res)
556 { 556 {
557 this.MakeChildAgent(); 557 this.MakeChildAgent();
558 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.InternalEndPoint); 558 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.InternalEndPoint);
559 } 559 }
560 } 560 }
561 } 561 }
562 #endregion 562 #endregion
563 563
564 /// <summary> 564 /// <summary>
565 /// 565 ///
566 /// </summary> 566 /// </summary>
567 public static void LoadAnims() 567 public static void LoadAnims()
568 { 568 {
569 569
570 } 570 }
571 571
572 /// <summary> 572 /// <summary>
573 /// 573 ///
574 /// </summary> 574 /// </summary>
575 public override void updateMovement() 575 public override void updateMovement()
576 { 576 {
577 newForce = false; 577 newForce = false;
578 lock (this.forcesList) 578 lock (this.forcesList)
579 { 579 {
580 if (this.forcesList.Count > 0) 580 if (this.forcesList.Count > 0)
581 { 581 {
582 for (int i = 0; i < this.forcesList.Count; i++) 582 for (int i = 0; i < this.forcesList.Count; i++)
583 { 583 {
584 NewForce force = this.forcesList[i]; 584 NewForce force = this.forcesList[i];
585 585
586 this.updateflag = true; 586 this.updateflag = true;
587 this.Velocity = new LLVector3(force.X, force.Y, force.Z); 587 this.Velocity = new LLVector3(force.X, force.Y, force.Z);
588 this.newForce = true; 588 this.newForce = true;
589 } 589 }
590 for (int i = 0; i < this.forcesList.Count; i++) 590 for (int i = 0; i < this.forcesList.Count; i++)
591 { 591 {
592 this.forcesList.RemoveAt(0); 592 this.forcesList.RemoveAt(0);
593 } 593 }
594 } 594 }
595 } 595 }
596 } 596 }
597 597
598 public static void LoadTextureFile(string name) 598 public static void LoadTextureFile(string name)
599 { 599 {
600 FileInfo fInfo = new FileInfo(name); 600 FileInfo fInfo = new FileInfo(name);
601 long numBytes = fInfo.Length; 601 long numBytes = fInfo.Length;
602 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); 602 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
603 BinaryReader br = new BinaryReader(fStream); 603 BinaryReader br = new BinaryReader(fStream);
604 byte[] data1 = br.ReadBytes((int)numBytes); 604 byte[] data1 = br.ReadBytes((int)numBytes);
605 br.Close(); 605 br.Close();
606 fStream.Close(); 606 fStream.Close();
607 DefaultTexture = data1; 607 DefaultTexture = data1;
608 } 608 }
609 609
610 public class NewForce 610 public class NewForce
611 { 611 {
612 public float X; 612 public float X;
613 public float Y; 613 public float Y;
614 public float Z; 614 public float Z;
615 615
616 public NewForce() 616 public NewForce()
617 { 617 {
618 618
619 } 619 }
620 } 620 }
621 } 621 }
622 622
623} 623}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs
index 1fc576e..b0ccd22 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs
@@ -1,102 +1,102 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Microsoft.CSharp; 31using Microsoft.CSharp;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Region.Scripting 34namespace OpenSim.Region.Scripting
35{ 35{
36 public class CSharpScriptEngine : IScriptCompiler 36 public class CSharpScriptEngine : IScriptCompiler
37 { 37 {
38 public string FileExt() 38 public string FileExt()
39 { 39 {
40 return ".cs"; 40 return ".cs";
41 } 41 }
42 42
43 private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) 43 private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
44 { 44 {
45 CompilerParameters compilerParams = new CompilerParameters(); 45 CompilerParameters compilerParams = new CompilerParameters();
46 CompilerResults compilerResults; 46 CompilerResults compilerResults;
47 compilerParams.GenerateExecutable = false; 47 compilerParams.GenerateExecutable = false;
48 compilerParams.GenerateInMemory = true; 48 compilerParams.GenerateInMemory = true;
49 compilerParams.IncludeDebugInformation = false; 49 compilerParams.IncludeDebugInformation = false;
50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); 50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); 51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); 52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); 53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
54 compilerParams.ReferencedAssemblies.Add("System.dll"); 54 compilerParams.ReferencedAssemblies.Add("System.dll");
55 55
56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
57 57
58 if (compilerResults.Errors.Count > 0) 58 if (compilerResults.Errors.Count > 0)
59 { 59 {
60 MainLog.Instance.Error("Compile errors"); 60 MainLog.Instance.Error("Compile errors");
61 foreach (CompilerError error in compilerResults.Errors) 61 foreach (CompilerError error in compilerResults.Errors)
62 { 62 {
63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
64 } 64 }
65 } 65 }
66 else 66 else
67 { 67 {
68 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); 68 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>();
69 69
70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
71 { 71 {
72 Type testInterface = pluginType.GetInterface("IScript", true); 72 Type testInterface = pluginType.GetInterface("IScript", true);
73 73
74 if (testInterface != null) 74 if (testInterface != null)
75 { 75 {
76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
77 77
78 string scriptName = "C#/" + script.getName(); 78 string scriptName = "C#/" + script.getName();
79 Console.WriteLine("Script: " + scriptName + " loaded."); 79 Console.WriteLine("Script: " + scriptName + " loaded.");
80 80
81 if (!scripts.ContainsKey(scriptName)) 81 if (!scripts.ContainsKey(scriptName))
82 { 82 {
83 scripts.Add(scriptName, script); 83 scripts.Add(scriptName, script);
84 } 84 }
85 else 85 else
86 { 86 {
87 scripts[scriptName] = script; 87 scripts[scriptName] = script;
88 } 88 }
89 } 89 }
90 } 90 }
91 return scripts; 91 return scripts;
92 } 92 }
93 return null; 93 return null;
94 } 94 }
95 95
96 public Dictionary<string,IScript> compile(string filename) 96 public Dictionary<string,IScript> compile(string filename)
97 { 97 {
98 CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); 98 CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
99 return LoadDotNetScript(csharpProvider, filename); 99 return LoadDotNetScript(csharpProvider, filename);
100 } 100 }
101 } 101 }
102} 102}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
index d9f1f0a..79d88b1 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
@@ -1,70 +1,70 @@
1using OpenSim.Framework.Console; 1using OpenSim.Framework.Console;
2using OpenSim.Framework; 2using OpenSim.Framework;
3using OpenSim.Region.Environment; 3using OpenSim.Region.Environment;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5 5
6using System.Collections.Generic; 6using System.Collections.Generic;
7using libsecondlife; 7using libsecondlife;
8 8
9namespace OpenSim.Region.Scripting.Examples 9namespace OpenSim.Region.Scripting.Examples
10{ 10{
11 public class LSLExportScript : IScript 11 public class LSLExportScript : IScript
12 { 12 {
13 ScriptInfo script; 13 ScriptInfo script;
14 14
15 public string getName() 15 public string getName()
16 { 16 {
17 return "LSL Export Script 0.1"; 17 return "LSL Export Script 0.1";
18 } 18 }
19 19
20 public void Initialise(ScriptInfo scriptInfo) 20 public void Initialise(ScriptInfo scriptInfo)
21 { 21 {
22 script = scriptInfo; 22 script = scriptInfo;
23 23
24 script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); 24 script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg);
25 } 25 }
26 26
27 void ProcessConsoleMsg(string[] args) 27 void ProcessConsoleMsg(string[] args)
28 { 28 {
29 if (args[0].ToLower() == "lslexport") 29 if (args[0].ToLower() == "lslexport")
30 { 30 {
31 string sequence = ""; 31 string sequence = "";
32 32
33 foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) 33 foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
34 { 34 {
35 SceneObject root = obj.Value; 35 SceneObject root = obj.Value;
36 36
37 sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; 37 sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n";
38 38
39 string rootPrim = processPrimitiveToString(root.rootPrimitive); 39 string rootPrim = processPrimitiveToString(root.rootPrimitive);
40 40
41 sequence += "ROOT:" + rootPrim; 41 sequence += "ROOT:" + rootPrim;
42 42
43 foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) 43 foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
44 { 44 {
45 string child = processPrimitiveToString(prim.Value); 45 string child = processPrimitiveToString(prim.Value);
46 sequence += "CHILD:" + child; 46 sequence += "CHILD:" + child;
47 } 47 }
48 } 48 }
49 49
50 System.Console.WriteLine(sequence); 50 System.Console.WriteLine(sequence);
51 } 51 }
52 } 52 }
53 53
54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim) 54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim)
55 { 55 {
56 string desc = prim.Description; 56 string desc = prim.Description;
57 string name = prim.Name; 57 string name = prim.Name;
58 LLVector3 pos = prim.Pos; 58 LLVector3 pos = prim.Pos;
59 LLVector3 rot = new LLVector3(); 59 LLVector3 rot = new LLVector3();
60 LLVector3 scale = prim.Scale; 60 LLVector3 scale = prim.Scale;
61 LLVector3 rootPos = prim.WorldPos; 61 LLVector3 rootPos = prim.WorldPos;
62 62
63 string setPrimParams = ""; 63 string setPrimParams = "";
64 64
65 setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; 65 setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
66 66
67 return setPrimParams; 67 return setPrimParams;
68 } 68 }
69 } 69 }
70} \ No newline at end of file 70} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs
index 0833e7a..af4f8b4 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs
@@ -1,102 +1,102 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Microsoft.JScript; 31using Microsoft.JScript;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Region.Scripting 34namespace OpenSim.Region.Scripting
35{ 35{
36 public class JScriptEngine : IScriptCompiler 36 public class JScriptEngine : IScriptCompiler
37 { 37 {
38 public string FileExt() 38 public string FileExt()
39 { 39 {
40 return ".js"; 40 return ".js";
41 } 41 }
42 42
43 private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) 43 private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
44 { 44 {
45 CompilerParameters compilerParams = new CompilerParameters(); 45 CompilerParameters compilerParams = new CompilerParameters();
46 CompilerResults compilerResults; 46 CompilerResults compilerResults;
47 compilerParams.GenerateExecutable = false; 47 compilerParams.GenerateExecutable = false;
48 compilerParams.GenerateInMemory = true; 48 compilerParams.GenerateInMemory = true;
49 compilerParams.IncludeDebugInformation = false; 49 compilerParams.IncludeDebugInformation = false;
50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); 50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); 51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); 52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); 53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
54 compilerParams.ReferencedAssemblies.Add("System.dll"); 54 compilerParams.ReferencedAssemblies.Add("System.dll");
55 55
56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
57 57
58 if (compilerResults.Errors.Count > 0) 58 if (compilerResults.Errors.Count > 0)
59 { 59 {
60 MainLog.Instance.Error("Compile errors"); 60 MainLog.Instance.Error("Compile errors");
61 foreach (CompilerError error in compilerResults.Errors) 61 foreach (CompilerError error in compilerResults.Errors)
62 { 62 {
63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
64 } 64 }
65 } 65 }
66 else 66 else
67 { 67 {
68 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); 68 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
69 69
70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
71 { 71 {
72 Type testInterface = pluginType.GetInterface("IScript", true); 72 Type testInterface = pluginType.GetInterface("IScript", true);
73 73
74 if (testInterface != null) 74 if (testInterface != null)
75 { 75 {
76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
77 77
78 string scriptName = "JS.NET/" + script.getName(); 78 string scriptName = "JS.NET/" + script.getName();
79 Console.WriteLine("Script: " + scriptName + " loaded."); 79 Console.WriteLine("Script: " + scriptName + " loaded.");
80 80
81 if (!scripts.ContainsKey(scriptName)) 81 if (!scripts.ContainsKey(scriptName))
82 { 82 {
83 scripts.Add(scriptName, script); 83 scripts.Add(scriptName, script);
84 } 84 }
85 else 85 else
86 { 86 {
87 scripts[scriptName] = script; 87 scripts[scriptName] = script;
88 } 88 }
89 } 89 }
90 } 90 }
91 return scripts; 91 return scripts;
92 } 92 }
93 return null; 93 return null;
94 } 94 }
95 95
96 public Dictionary<string, IScript> compile(string filename) 96 public Dictionary<string, IScript> compile(string filename)
97 { 97 {
98 JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); 98 JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
99 return LoadDotNetScript(jscriptProvider, filename); 99 return LoadDotNetScript(jscriptProvider, filename);
100 } 100 }
101 } 101 }
102} 102}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
index 0b1cf41..ca729b4 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
@@ -1,45 +1,45 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32 32
33namespace OpenSim.Region.Scripting.EmbeddedJVM 33namespace OpenSim.Region.Scripting.EmbeddedJVM
34{ 34{
35 public class ClassInstance : Object 35 public class ClassInstance : Object
36 { 36 {
37 public int size; 37 public int size;
38 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); 38 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
39 39
40 public ClassInstance() 40 public ClassInstance()
41 { 41 {
42 42
43 } 43 }
44 } 44 }
45} 45}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
index f821f52..f151b7e 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
@@ -1,503 +1,503 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types;
33 33
34namespace OpenSim.Region.Scripting.EmbeddedJVM 34namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 35{
36 public class ClassRecord 36 public class ClassRecord
37 { 37 {
38 private ushort _majorVersion; 38 private ushort _majorVersion;
39 private ushort _minorVersion; 39 private ushort _minorVersion;
40 private ushort _constantPoolCount; 40 private ushort _constantPoolCount;
41 private ushort _accessFlags; 41 private ushort _accessFlags;
42 private ushort _thisClass; 42 private ushort _thisClass;
43 private ushort _supperClass; 43 private ushort _supperClass;
44 private ushort _interfaceCount; 44 private ushort _interfaceCount;
45 private ushort _fieldCount; 45 private ushort _fieldCount;
46 private ushort _methodCount; 46 private ushort _methodCount;
47 //private ushort _attributeCount; 47 //private ushort _attributeCount;
48 //private string _name; 48 //private string _name;
49 public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); 49 public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>();
50 public PoolClass mClass; 50 public PoolClass mClass;
51 51
52 public List<PoolItem> _constantsPool = new List<PoolItem>(); 52 public List<PoolItem> _constantsPool = new List<PoolItem>();
53 private List<MethodInfo> _methodsList = new List<MethodInfo>(); 53 private List<MethodInfo> _methodsList = new List<MethodInfo>();
54 private List<FieldInfo> _fieldList = new List<FieldInfo>(); 54 private List<FieldInfo> _fieldList = new List<FieldInfo>();
55 55
56 public ClassRecord() 56 public ClassRecord()
57 { 57 {
58 58
59 } 59 }
60 60
61 public ClassInstance CreateNewInstance() 61 public ClassInstance CreateNewInstance()
62 { 62 {
63 return new ClassInstance(); 63 return new ClassInstance();
64 } 64 }
65 65
66 public void LoadClassFromFile(string fileName) 66 public void LoadClassFromFile(string fileName)
67 { 67 {
68 Console.WriteLine("loading script " + fileName); 68 Console.WriteLine("loading script " + fileName);
69 FileStream fs = File.OpenRead(fileName); 69 FileStream fs = File.OpenRead(fileName);
70 this.LoadClassFromBytes(ReadFully(fs)); 70 this.LoadClassFromBytes(ReadFully(fs));
71 fs.Close(); 71 fs.Close();
72 } 72 }
73 73
74 public void LoadClassFromBytes(byte[] data) 74 public void LoadClassFromBytes(byte[] data)
75 { 75 {
76 int i = 0; 76 int i = 0;
77 i += 4; 77 i += 4;
78 _minorVersion = (ushort)((data[i++] << 8) + data[i++] ); 78 _minorVersion = (ushort)((data[i++] << 8) + data[i++] );
79 _majorVersion = (ushort)((data[i++] << 8) + data[i++] ); 79 _majorVersion = (ushort)((data[i++] << 8) + data[i++] );
80 _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] ); 80 _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] );
81 // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); 81 // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool");
82 for (int count = 0; count < _constantPoolCount -1 ; count++) 82 for (int count = 0; count < _constantPoolCount -1 ; count++)
83 { 83 {
84 //read in the constant pool 84 //read in the constant pool
85 byte pooltype = data[i++]; 85 byte pooltype = data[i++];
86 //Console.WriteLine("#" +count +": new constant type = " +pooltype); 86 //Console.WriteLine("#" +count +": new constant type = " +pooltype);
87 //Console.WriteLine("start position is: " + i); 87 //Console.WriteLine("start position is: " + i);
88 switch (pooltype) 88 switch (pooltype)
89 { 89 {
90 case 1: //Utf8 90 case 1: //Utf8
91 ushort uLength = (ushort)((data[i++] << 8) + data[i++] ); 91 ushort uLength = (ushort)((data[i++] << 8) + data[i++] );
92 92
93 // Console.WriteLine("new utf8 type, length is " + uLength); 93 // Console.WriteLine("new utf8 type, length is " + uLength);
94 PoolUtf8 utf8 = new PoolUtf8(); 94 PoolUtf8 utf8 = new PoolUtf8();
95 utf8.readValue(data, ref i, uLength); 95 utf8.readValue(data, ref i, uLength);
96 this._constantsPool.Add(utf8); 96 this._constantsPool.Add(utf8);
97 break; 97 break;
98 case 3: //Int 98 case 3: //Int
99 break; 99 break;
100 case 7: //Class 100 case 7: //Class
101 PoolClass pClass = new PoolClass(this); 101 PoolClass pClass = new PoolClass(this);
102 pClass.readValue(data, ref i); 102 pClass.readValue(data, ref i);
103 this._constantsPool.Add(pClass); 103 this._constantsPool.Add(pClass);
104 break; 104 break;
105 case 10: //Method 105 case 10: //Method
106 PoolMethodRef pMeth = new PoolMethodRef(this); 106 PoolMethodRef pMeth = new PoolMethodRef(this);
107 pMeth.readValue(data, ref i); 107 pMeth.readValue(data, ref i);
108 this._constantsPool.Add(pMeth); 108 this._constantsPool.Add(pMeth);
109 break; 109 break;
110 case 12: //NamedType 110 case 12: //NamedType
111 PoolNamedType pNamed = new PoolNamedType(this); 111 PoolNamedType pNamed = new PoolNamedType(this);
112 pNamed.readValue(data, ref i); 112 pNamed.readValue(data, ref i);
113 this._constantsPool.Add(pNamed); 113 this._constantsPool.Add(pNamed);
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 _accessFlags = (ushort)((data[i++] << 8) + data[i++] ); 118 _accessFlags = (ushort)((data[i++] << 8) + data[i++] );
119 _thisClass = (ushort)((data[i++] << 8) + data[i++] ); 119 _thisClass = (ushort)((data[i++] << 8) + data[i++] );
120 _supperClass = (ushort)((data[i++] << 8) + data[i++] ); 120 _supperClass = (ushort)((data[i++] << 8) + data[i++] );
121 121
122 if (this._constantsPool[this._thisClass - 1] is PoolClass) 122 if (this._constantsPool[this._thisClass - 1] is PoolClass)
123 { 123 {
124 this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]); 124 this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]);
125 } 125 }
126 126
127 _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); 127 _interfaceCount = (ushort)((data[i++] << 8) + data[i++]);
128 //should now read in the info for each interface 128 //should now read in the info for each interface
129 _fieldCount = (ushort)((data[i++] << 8) + data[i++]); 129 _fieldCount = (ushort)((data[i++] << 8) + data[i++]);
130 //should now read in the info for each field 130 //should now read in the info for each field
131 _methodCount = (ushort)((data[i++] << 8) + data[i++]); 131 _methodCount = (ushort)((data[i++] << 8) + data[i++]);
132 for (int count = 0; count < _methodCount; count++) 132 for (int count = 0; count < _methodCount; count++)
133 { 133 {
134 MethodInfo methInf = new MethodInfo(this); 134 MethodInfo methInf = new MethodInfo(this);
135 methInf.ReadData(data, ref i); 135 methInf.ReadData(data, ref i);
136 this._methodsList.Add(methInf); 136 this._methodsList.Add(methInf);
137 } 137 }
138 } 138 }
139 139
140 public void AddMethodsToMemory(MethodMemory memory) 140 public void AddMethodsToMemory(MethodMemory memory)
141 { 141 {
142 for (int count = 0; count < _methodCount; count++) 142 for (int count = 0; count < _methodCount; count++)
143 { 143 {
144 this._methodsList[count].AddMethodCode(memory); 144 this._methodsList[count].AddMethodCode(memory);
145 } 145 }
146 } 146 }
147 147
148 public bool StartMethod(Thread thread, string methodName) 148 public bool StartMethod(Thread thread, string methodName)
149 { 149 {
150 for (int count = 0; count < _methodCount; count++) 150 for (int count = 0; count < _methodCount; count++)
151 { 151 {
152 if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8) 152 if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8)
153 { 153 {
154 if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName) 154 if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName)
155 { 155 {
156 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); 156 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
157 thread.SetPC(this._methodsList[count].CodePointer); 157 thread.SetPC(this._methodsList[count].CodePointer);
158 return true; 158 return true;
159 } 159 }
160 } 160 }
161 } 161 }
162 return false; 162 return false;
163 } 163 }
164 164
165 public void PrintToConsole() 165 public void PrintToConsole()
166 { 166 {
167 Console.WriteLine("Class File:"); 167 Console.WriteLine("Class File:");
168 Console.WriteLine("Major version: " + _majorVersion); 168 Console.WriteLine("Major version: " + _majorVersion);
169 Console.WriteLine("Minor version: " + _minorVersion); 169 Console.WriteLine("Minor version: " + _minorVersion);
170 Console.WriteLine("Pool size: " + _constantPoolCount); 170 Console.WriteLine("Pool size: " + _constantPoolCount);
171 171
172 for (int i = 0; i < _constantsPool.Count; i++) 172 for (int i = 0; i < _constantsPool.Count; i++)
173 { 173 {
174 this._constantsPool[i].Print(); 174 this._constantsPool[i].Print();
175 } 175 }
176 176
177 Console.WriteLine("Access flags: " + _accessFlags); 177 Console.WriteLine("Access flags: " + _accessFlags);
178 Console.WriteLine("This class: " + _thisClass ); 178 Console.WriteLine("This class: " + _thisClass );
179 Console.WriteLine("Super class: " + _supperClass); 179 Console.WriteLine("Super class: " + _supperClass);
180 180
181 for (int count = 0; count < _methodCount; count++) 181 for (int count = 0; count < _methodCount; count++)
182 { 182 {
183 Console.WriteLine(); 183 Console.WriteLine();
184 this._methodsList[count].Print(); 184 this._methodsList[count].Print();
185 } 185 }
186 186
187 Console.WriteLine("class name is " + this.mClass.Name.Value); 187 Console.WriteLine("class name is " + this.mClass.Name.Value);
188 } 188 }
189 189
190 public static byte[] ReadFully(Stream stream) 190 public static byte[] ReadFully(Stream stream)
191 { 191 {
192 byte[] buffer = new byte[1024]; 192 byte[] buffer = new byte[1024];
193 using (MemoryStream ms = new MemoryStream()) 193 using (MemoryStream ms = new MemoryStream())
194 { 194 {
195 while (true) 195 while (true)
196 { 196 {
197 int read = stream.Read(buffer, 0, buffer.Length); 197 int read = stream.Read(buffer, 0, buffer.Length);
198 if (read <= 0) 198 if (read <= 0)
199 return ms.ToArray(); 199 return ms.ToArray();
200 ms.Write(buffer, 0, read); 200 ms.Write(buffer, 0, read);
201 } 201 }
202 } 202 }
203 } 203 }
204 204
205 #region nested classes 205 #region nested classes
206 public class PoolItem 206 public class PoolItem
207 { 207 {
208 public virtual void Print() 208 public virtual void Print()
209 { 209 {
210 210
211 } 211 }
212 } 212 }
213 213
214 public class PoolUtf8 : PoolItem 214 public class PoolUtf8 : PoolItem
215 { 215 {
216 public string Value = ""; 216 public string Value = "";
217 217
218 public void readValue(byte[] data,ref int pointer , int length) 218 public void readValue(byte[] data,ref int pointer , int length)
219 { 219 {
220 for (int i = 0; i < length; i++) 220 for (int i = 0; i < length; i++)
221 { 221 {
222 int a =(int) data[pointer++]; 222 int a =(int) data[pointer++];
223 if ((a & 0x80) == 0) 223 if ((a & 0x80) == 0)
224 { 224 {
225 Value = Value + (char)a; 225 Value = Value + (char)a;
226 } 226 }
227 else if ((a & 0x20) == 0) 227 else if ((a & 0x20) == 0)
228 { 228 {
229 int b = (int) data[pointer++]; 229 int b = (int) data[pointer++];
230 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); 230 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f));
231 } 231 }
232 else 232 else
233 { 233 {
234 int b = (int)data[pointer++]; 234 int b = (int)data[pointer++];
235 int c = (int)data[pointer++]; 235 int c = (int)data[pointer++];
236 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); 236 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f));
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 public override void Print() 241 public override void Print()
242 { 242 {
243 Console.WriteLine("Utf8 type: " + Value); 243 Console.WriteLine("Utf8 type: " + Value);
244 } 244 }
245 } 245 }
246 246
247 private class PoolInt : PoolItem 247 private class PoolInt : PoolItem
248 { 248 {
249 249
250 } 250 }
251 251
252 public class PoolClass : PoolItem 252 public class PoolClass : PoolItem
253 { 253 {
254 //public string name = ""; 254 //public string name = "";
255 public ushort namePointer = 0; 255 public ushort namePointer = 0;
256 private ClassRecord parent; 256 private ClassRecord parent;
257 public PoolUtf8 Name; 257 public PoolUtf8 Name;
258 258
259 public PoolClass(ClassRecord paren) 259 public PoolClass(ClassRecord paren)
260 { 260 {
261 parent = paren; 261 parent = paren;
262 } 262 }
263 263
264 public void readValue(byte[] data, ref int pointer) 264 public void readValue(byte[] data, ref int pointer)
265 { 265 {
266 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 266 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] );
267 } 267 }
268 268
269 public override void Print() 269 public override void Print()
270 { 270 {
271 this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); 271 this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]);
272 Console.Write("Class type: " + namePointer); 272 Console.Write("Class type: " + namePointer);
273 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); 273 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value);
274 274
275 } 275 }
276 } 276 }
277 277
278 public class PoolMethodRef : PoolItem 278 public class PoolMethodRef : PoolItem
279 { 279 {
280 public ushort classPointer = 0; 280 public ushort classPointer = 0;
281 public ushort nameTypePointer = 0; 281 public ushort nameTypePointer = 0;
282 public PoolNamedType mNameType; 282 public PoolNamedType mNameType;
283 public PoolClass mClass; 283 public PoolClass mClass;
284 private ClassRecord parent; 284 private ClassRecord parent;
285 285
286 public PoolMethodRef(ClassRecord paren) 286 public PoolMethodRef(ClassRecord paren)
287 { 287 {
288 parent = paren; 288 parent = paren;
289 } 289 }
290 290
291 public void readValue(byte[] data, ref int pointer) 291 public void readValue(byte[] data, ref int pointer)
292 { 292 {
293 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 293 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
294 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 294 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
295 } 295 }
296 296
297 public override void Print() 297 public override void Print()
298 { 298 {
299 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); 299 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]);
300 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); 300 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]);
301 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); 301 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
302 } 302 }
303 } 303 }
304 304
305 public class PoolNamedType : PoolItem 305 public class PoolNamedType : PoolItem
306 { 306 {
307 public ushort namePointer = 0; 307 public ushort namePointer = 0;
308 public ushort typePointer = 0; 308 public ushort typePointer = 0;
309 private ClassRecord parent; 309 private ClassRecord parent;
310 public PoolUtf8 Name; 310 public PoolUtf8 Name;
311 public PoolUtf8 Type; 311 public PoolUtf8 Type;
312 312
313 public PoolNamedType(ClassRecord paren) 313 public PoolNamedType(ClassRecord paren)
314 { 314 {
315 parent = paren; 315 parent = paren;
316 } 316 }
317 317
318 public void readValue(byte[] data, ref int pointer) 318 public void readValue(byte[] data, ref int pointer)
319 { 319 {
320 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 320 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] );
321 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 321 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] );
322 } 322 }
323 323
324 public override void Print() 324 public override void Print()
325 { 325 {
326 Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]); 326 Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]);
327 Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]); 327 Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]);
328 Console.Write("Named type: " + namePointer + " , " + typePointer ); 328 Console.Write("Named type: " + namePointer + " , " + typePointer );
329 Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value); 329 Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value);
330 } 330 }
331 } 331 }
332 332
333 //*********************** 333 //***********************
334 public class MethodInfo 334 public class MethodInfo
335 { 335 {
336 public ushort AccessFlags = 0; 336 public ushort AccessFlags = 0;
337 public ushort NameIndex = 0; 337 public ushort NameIndex = 0;
338 public string Name = ""; 338 public string Name = "";
339 public ushort DescriptorIndex = 0; 339 public ushort DescriptorIndex = 0;
340 public ushort AttributeCount = 0; 340 public ushort AttributeCount = 0;
341 public List<MethodAttribute> Attributes = new List<MethodAttribute>(); 341 public List<MethodAttribute> Attributes = new List<MethodAttribute>();
342 private ClassRecord parent; 342 private ClassRecord parent;
343 public int CodePointer = 0; 343 public int CodePointer = 0;
344 344
345 public MethodInfo(ClassRecord paren) 345 public MethodInfo(ClassRecord paren)
346 { 346 {
347 parent = paren; 347 parent = paren;
348 } 348 }
349 349
350 public void AddMethodCode(MethodMemory memory) 350 public void AddMethodCode(MethodMemory memory)
351 { 351 {
352 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); 352 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length);
353 memory.Methodcount++; 353 memory.Methodcount++;
354 this.CodePointer = memory.NextMethodPC; 354 this.CodePointer = memory.NextMethodPC;
355 memory.NextMethodPC += this.Attributes[0].Code.Length; 355 memory.NextMethodPC += this.Attributes[0].Code.Length;
356 } 356 }
357 357
358 public void ReadData(byte[] data, ref int pointer) 358 public void ReadData(byte[] data, ref int pointer)
359 { 359 {
360 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); 360 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]);
361 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 361 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
362 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 362 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
363 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 363 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
364 for(int i =0; i< AttributeCount; i++) 364 for(int i =0; i< AttributeCount; i++)
365 { 365 {
366 MethodAttribute attri = new MethodAttribute(this.parent); 366 MethodAttribute attri = new MethodAttribute(this.parent);
367 attri.ReadData(data, ref pointer); 367 attri.ReadData(data, ref pointer);
368 this.Attributes.Add(attri); 368 this.Attributes.Add(attri);
369 } 369 }
370 } 370 }
371 371
372 public void Print() 372 public void Print()
373 { 373 {
374 Console.WriteLine("Method Info Struct: "); 374 Console.WriteLine("Method Info Struct: ");
375 Console.WriteLine("AccessFlags: " + AccessFlags); 375 Console.WriteLine("AccessFlags: " + AccessFlags);
376 Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); 376 Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value);
377 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value); 377 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value);
378 Console.WriteLine("Attribute Count:" + AttributeCount); 378 Console.WriteLine("Attribute Count:" + AttributeCount);
379 for (int i = 0; i < AttributeCount; i++) 379 for (int i = 0; i < AttributeCount; i++)
380 { 380 {
381 this.Attributes[i].Print(); 381 this.Attributes[i].Print();
382 } 382 }
383 } 383 }
384 384
385 public class MethodAttribute 385 public class MethodAttribute
386 { 386 {
387 public ushort NameIndex = 0; 387 public ushort NameIndex = 0;
388 public string Name = ""; 388 public string Name = "";
389 public Int32 Length = 0; 389 public Int32 Length = 0;
390 //for now only support code attribute 390 //for now only support code attribute
391 public ushort MaxStack = 0; 391 public ushort MaxStack = 0;
392 public ushort MaxLocals = 0; 392 public ushort MaxLocals = 0;
393 public Int32 CodeLength = 0; 393 public Int32 CodeLength = 0;
394 public byte[] Code; 394 public byte[] Code;
395 public ushort ExceptionTableLength = 0; 395 public ushort ExceptionTableLength = 0;
396 public ushort SubAttributeCount = 0; 396 public ushort SubAttributeCount = 0;
397 public List<SubAttribute> SubAttributes = new List<SubAttribute>(); 397 public List<SubAttribute> SubAttributes = new List<SubAttribute>();
398 private ClassRecord parent; 398 private ClassRecord parent;
399 399
400 public MethodAttribute(ClassRecord paren) 400 public MethodAttribute(ClassRecord paren)
401 { 401 {
402 parent = paren; 402 parent = paren;
403 } 403 }
404 404
405 public void ReadData(byte[] data, ref int pointer) 405 public void ReadData(byte[] data, ref int pointer)
406 { 406 {
407 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 407 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
408 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 408 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
409 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); 409 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]);
410 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); 410 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]);
411 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 411 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
412 Code = new byte[CodeLength]; 412 Code = new byte[CodeLength];
413 for (int i = 0; i < CodeLength; i++) 413 for (int i = 0; i < CodeLength; i++)
414 { 414 {
415 Code[i] = data[pointer++]; 415 Code[i] = data[pointer++];
416 } 416 }
417 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); 417 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]);
418 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 418 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
419 for (int i = 0; i < SubAttributeCount; i++) 419 for (int i = 0; i < SubAttributeCount; i++)
420 { 420 {
421 SubAttribute subAttri = new SubAttribute(this.parent); 421 SubAttribute subAttri = new SubAttribute(this.parent);
422 subAttri.ReadData(data, ref pointer); 422 subAttri.ReadData(data, ref pointer);
423 this.SubAttributes.Add(subAttri); 423 this.SubAttributes.Add(subAttri);
424 } 424 }
425 } 425 }
426 426
427 public void Print() 427 public void Print()
428 { 428 {
429 Console.WriteLine("Method Attribute: "); 429 Console.WriteLine("Method Attribute: ");
430 Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); 430 Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value);
431 Console.WriteLine("Length: " + Length); 431 Console.WriteLine("Length: " + Length);
432 Console.WriteLine("MaxStack: " + MaxStack); 432 Console.WriteLine("MaxStack: " + MaxStack);
433 Console.WriteLine("MaxLocals: " + MaxLocals); 433 Console.WriteLine("MaxLocals: " + MaxLocals);
434 Console.WriteLine("CodeLength: " + CodeLength); 434 Console.WriteLine("CodeLength: " + CodeLength);
435 for (int i = 0; i < Code.Length; i++) 435 for (int i = 0; i < Code.Length; i++)
436 { 436 {
437 Console.WriteLine("OpCode #" + i + " is: " + Code[i]); 437 Console.WriteLine("OpCode #" + i + " is: " + Code[i]);
438 } 438 }
439 Console.WriteLine("SubAttributes: " + SubAttributeCount); 439 Console.WriteLine("SubAttributes: " + SubAttributeCount);
440 for (int i = 0; i < SubAttributeCount; i++) 440 for (int i = 0; i < SubAttributeCount; i++)
441 { 441 {
442 this.SubAttributes[i].Print(); 442 this.SubAttributes[i].Print();
443 } 443 }
444 } 444 }
445 445
446 public class SubAttribute 446 public class SubAttribute
447 { 447 {
448 public ushort NameIndex = 0; 448 public ushort NameIndex = 0;
449 public string Name = ""; 449 public string Name = "";
450 public Int32 Length = 0; 450 public Int32 Length = 0;
451 public byte[] Data; 451 public byte[] Data;
452 private ClassRecord parent; 452 private ClassRecord parent;
453 453
454 public SubAttribute(ClassRecord paren) 454 public SubAttribute(ClassRecord paren)
455 { 455 {
456 parent = paren; 456 parent = paren;
457 } 457 }
458 458
459 public void ReadData(byte[] data, ref int pointer) 459 public void ReadData(byte[] data, ref int pointer)
460 { 460 {
461 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 461 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
462 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 462 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
463 Data = new byte[Length]; 463 Data = new byte[Length];
464 for (int i = 0; i < Length; i++) 464 for (int i = 0; i < Length; i++)
465 { 465 {
466 Data[i] = data[pointer++]; 466 Data[i] = data[pointer++];
467 } 467 }
468 } 468 }
469 469
470 public void Print() 470 public void Print()
471 { 471 {
472 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); 472 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
473 } 473 }
474 474
475 } 475 }
476 } 476 }
477 477
478 } 478 }
479 private class InterfaceInfo 479 private class InterfaceInfo
480 { 480 {
481 public void ReadData(byte[] data, ref int i) 481 public void ReadData(byte[] data, ref int i)
482 { 482 {
483 483
484 } 484 }
485 } 485 }
486 private class FieldInfo 486 private class FieldInfo
487 { 487 {
488 public void ReadData(byte[] data, ref int i) 488 public void ReadData(byte[] data, ref int i)
489 { 489 {
490 490
491 } 491 }
492 } 492 }
493 private class AttributeInfo 493 private class AttributeInfo
494 { 494 {
495 public void ReadData(byte[] data, ref int i) 495 public void ReadData(byte[] data, ref int i)
496 { 496 {
497 497
498 } 498 }
499 } 499 }
500 #endregion 500 #endregion
501 501
502 } 502 }
503} 503}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs
index 1a97b7d..c6423fc 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs
@@ -1,43 +1,43 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class Heap 34 public class Heap
35 { 35 {
36 public List<ClassInstance> ClassObjects = new List<ClassInstance>(); 36 public List<ClassInstance> ClassObjects = new List<ClassInstance>();
37 37
38 public Heap() 38 public Heap()
39 { 39 {
40 40
41 } 41 }
42 } 42 }
43} 43}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index ef6b805..56135d3 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -1,427 +1,427 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.Scripting.EmbeddedJVM 34namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 35{
36 partial class Thread 36 partial class Thread
37 { 37 {
38 private partial class Interpreter 38 private partial class Interpreter
39 { 39 {
40 private bool IsLogicOpCode(byte opcode) 40 private bool IsLogicOpCode(byte opcode)
41 { 41 {
42 bool result = false; 42 bool result = false;
43 switch (opcode) 43 switch (opcode)
44 { 44 {
45 case 2: 45 case 2:
46 Int m_int= new Int(); 46 Int m_int= new Int();
47 m_int.mValue = -1; 47 m_int.mValue = -1;
48 this._mThread.currentFrame.OpStack.Push(m_int); 48 this._mThread.currentFrame.OpStack.Push(m_int);
49 result = true; 49 result = true;
50 break; 50 break;
51 case 3: 51 case 3:
52 m_int= new Int(); 52 m_int= new Int();
53 m_int.mValue = 0; 53 m_int.mValue = 0;
54 this._mThread.currentFrame.OpStack.Push(m_int); 54 this._mThread.currentFrame.OpStack.Push(m_int);
55 result = true; 55 result = true;
56 break; 56 break;
57 case 4: 57 case 4:
58 m_int = new Int(); 58 m_int = new Int();
59 m_int.mValue = 1; 59 m_int.mValue = 1;
60 this._mThread.currentFrame.OpStack.Push(m_int); 60 this._mThread.currentFrame.OpStack.Push(m_int);
61 result = true; 61 result = true;
62 break; 62 break;
63 case 5: 63 case 5:
64 m_int = new Int(); 64 m_int = new Int();
65 m_int.mValue = 2; 65 m_int.mValue = 2;
66 this._mThread.currentFrame.OpStack.Push(m_int); 66 this._mThread.currentFrame.OpStack.Push(m_int);
67 result = true; 67 result = true;
68 break; 68 break;
69 case 6: 69 case 6:
70 m_int = new Int(); 70 m_int = new Int();
71 m_int.mValue = 3; 71 m_int.mValue = 3;
72 this._mThread.currentFrame.OpStack.Push(m_int); 72 this._mThread.currentFrame.OpStack.Push(m_int);
73 break; 73 break;
74 case 7: 74 case 7:
75 m_int = new Int(); 75 m_int = new Int();
76 m_int.mValue = 4; 76 m_int.mValue = 4;
77 this._mThread.currentFrame.OpStack.Push(m_int); 77 this._mThread.currentFrame.OpStack.Push(m_int);
78 result = true; 78 result = true;
79 break; 79 break;
80 case 8: 80 case 8:
81 m_int = new Int(); 81 m_int = new Int();
82 m_int.mValue = 5; 82 m_int.mValue = 5;
83 this._mThread.currentFrame.OpStack.Push(m_int); 83 this._mThread.currentFrame.OpStack.Push(m_int);
84 result = true; 84 result = true;
85 break; 85 break;
86 case 11: 86 case 11:
87 Float m_float = new Float(); 87 Float m_float = new Float();
88 m_float.mValue = 0.0f; 88 m_float.mValue = 0.0f;
89 this._mThread.currentFrame.OpStack.Push(m_float); 89 this._mThread.currentFrame.OpStack.Push(m_float);
90 result = true; 90 result = true;
91 break; 91 break;
92 case 12: 92 case 12:
93 m_float = new Float(); 93 m_float = new Float();
94 m_float.mValue = 1.0f; 94 m_float.mValue = 1.0f;
95 this._mThread.currentFrame.OpStack.Push(m_float); 95 this._mThread.currentFrame.OpStack.Push(m_float);
96 result = true; 96 result = true;
97 break; 97 break;
98 case 13: 98 case 13:
99 m_float = new Float(); 99 m_float = new Float();
100 m_float.mValue = 2.0f; 100 m_float.mValue = 2.0f;
101 this._mThread.currentFrame.OpStack.Push(m_float); 101 this._mThread.currentFrame.OpStack.Push(m_float);
102 result = true; 102 result = true;
103 break; 103 break;
104 case 16: 104 case 16:
105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; 105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC];
106 Int pushInt = new Int(); 106 Int pushInt = new Int();
107 pushInt.mValue = pushvalue; 107 pushInt.mValue = pushvalue;
108 this._mThread.currentFrame.OpStack.Push(pushInt); 108 this._mThread.currentFrame.OpStack.Push(pushInt);
109 this._mThread.PC++; 109 this._mThread.PC++;
110 result = true; 110 result = true;
111 break; 111 break;
112 case 17: 112 case 17:
113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
114 Int pushInt2 = new Int(); 114 Int pushInt2 = new Int();
115 pushInt2.mValue = pushvalue2; 115 pushInt2.mValue = pushvalue2;
116 this._mThread.currentFrame.OpStack.Push(pushInt2); 116 this._mThread.currentFrame.OpStack.Push(pushInt2);
117 this._mThread.PC += 2; 117 this._mThread.PC += 2;
118 result = true; 118 result = true;
119 break; 119 break;
120 case 23: 120 case 23:
121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); 121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
122 Float fload = new Float(); 122 Float fload = new Float();
123 if (this._mThread.currentFrame.LocalVariables[findex1] != null) 123 if (this._mThread.currentFrame.LocalVariables[findex1] != null)
124 { 124 {
125 if (this._mThread.currentFrame.LocalVariables[findex1] is Float) 125 if (this._mThread.currentFrame.LocalVariables[findex1] is Float)
126 { 126 {
127 fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; 127 fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue;
128 this._mThread.currentFrame.OpStack.Push(fload); 128 this._mThread.currentFrame.OpStack.Push(fload);
129 } 129 }
130 } 130 }
131 this._mThread.PC++; 131 this._mThread.PC++;
132 result = true; 132 result = true;
133 break; 133 break;
134 case 26: 134 case 26:
135 if (this._mThread.currentFrame.LocalVariables[0] != null) 135 if (this._mThread.currentFrame.LocalVariables[0] != null)
136 { 136 {
137 if (this._mThread.currentFrame.LocalVariables[0] is Int) 137 if (this._mThread.currentFrame.LocalVariables[0] is Int)
138 { 138 {
139 Int newInt = new Int(); 139 Int newInt = new Int();
140 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; 140 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue;
141 this._mThread.currentFrame.OpStack.Push(newInt); 141 this._mThread.currentFrame.OpStack.Push(newInt);
142 } 142 }
143 } 143 }
144 result = true; 144 result = true;
145 break; 145 break;
146 case 27: 146 case 27:
147 if (this._mThread.currentFrame.LocalVariables[1] != null) 147 if (this._mThread.currentFrame.LocalVariables[1] != null)
148 { 148 {
149 if (this._mThread.currentFrame.LocalVariables[1] is Int) 149 if (this._mThread.currentFrame.LocalVariables[1] is Int)
150 { 150 {
151 Int newInt = new Int(); 151 Int newInt = new Int();
152 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; 152 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue;
153 this._mThread.currentFrame.OpStack.Push(newInt); 153 this._mThread.currentFrame.OpStack.Push(newInt);
154 } 154 }
155 } 155 }
156 result = true; 156 result = true;
157 break; 157 break;
158 case 34: 158 case 34:
159 if (this._mThread.currentFrame.LocalVariables[0] != null) 159 if (this._mThread.currentFrame.LocalVariables[0] != null)
160 { 160 {
161 if (this._mThread.currentFrame.LocalVariables[0] is Float) 161 if (this._mThread.currentFrame.LocalVariables[0] is Float)
162 { 162 {
163 Float newfloat = new Float(); 163 Float newfloat = new Float();
164 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; 164 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue;
165 this._mThread.currentFrame.OpStack.Push(newfloat); 165 this._mThread.currentFrame.OpStack.Push(newfloat);
166 } 166 }
167 } 167 }
168 result = true; 168 result = true;
169 break; 169 break;
170 case 35: 170 case 35:
171 if (this._mThread.currentFrame.LocalVariables[1] != null) 171 if (this._mThread.currentFrame.LocalVariables[1] != null)
172 { 172 {
173 if (this._mThread.currentFrame.LocalVariables[1] is Float) 173 if (this._mThread.currentFrame.LocalVariables[1] is Float)
174 { 174 {
175 Float newfloat = new Float(); 175 Float newfloat = new Float();
176 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; 176 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue;
177 this._mThread.currentFrame.OpStack.Push(newfloat); 177 this._mThread.currentFrame.OpStack.Push(newfloat);
178 } 178 }
179 } 179 }
180 result = true; 180 result = true;
181 break; 181 break;
182 case 36: 182 case 36:
183 if (this._mThread.currentFrame.LocalVariables[2] != null) 183 if (this._mThread.currentFrame.LocalVariables[2] != null)
184 { 184 {
185 if (this._mThread.currentFrame.LocalVariables[2] is Float) 185 if (this._mThread.currentFrame.LocalVariables[2] is Float)
186 { 186 {
187 Float newfloat = new Float(); 187 Float newfloat = new Float();
188 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; 188 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue;
189 this._mThread.currentFrame.OpStack.Push(newfloat); 189 this._mThread.currentFrame.OpStack.Push(newfloat);
190 } 190 }
191 } 191 }
192 result = true; 192 result = true;
193 break; 193 break;
194 case 37: 194 case 37:
195 if (this._mThread.currentFrame.LocalVariables[3] != null) 195 if (this._mThread.currentFrame.LocalVariables[3] != null)
196 { 196 {
197 if (this._mThread.currentFrame.LocalVariables[3] is Float) 197 if (this._mThread.currentFrame.LocalVariables[3] is Float)
198 { 198 {
199 Float newfloat = new Float(); 199 Float newfloat = new Float();
200 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; 200 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue;
201 this._mThread.currentFrame.OpStack.Push(newfloat); 201 this._mThread.currentFrame.OpStack.Push(newfloat);
202 } 202 }
203 } 203 }
204 result = true; 204 result = true;
205 break; 205 break;
206 case 56: 206 case 56:
207 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); 207 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] ));
208 BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); 208 BaseType fstor = this._mThread.currentFrame.OpStack.Pop();
209 if (fstor is Float) 209 if (fstor is Float)
210 { 210 {
211 this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; 211 this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor;
212 } 212 }
213 this._mThread.PC++; 213 this._mThread.PC++;
214 result = true; 214 result = true;
215 break; 215 break;
216 case 59: 216 case 59:
217 BaseType baset = this._mThread.currentFrame.OpStack.Pop(); 217 BaseType baset = this._mThread.currentFrame.OpStack.Pop();
218 if (baset is Int) 218 if (baset is Int)
219 { 219 {
220 this._mThread.currentFrame.LocalVariables[0] = (Int)baset; 220 this._mThread.currentFrame.LocalVariables[0] = (Int)baset;
221 } 221 }
222 result = true; 222 result = true;
223 break; 223 break;
224 case 60: 224 case 60:
225 baset = this._mThread.currentFrame.OpStack.Pop(); 225 baset = this._mThread.currentFrame.OpStack.Pop();
226 if (baset is Int) 226 if (baset is Int)
227 { 227 {
228 this._mThread.currentFrame.LocalVariables[1] = (Int)baset; 228 this._mThread.currentFrame.LocalVariables[1] = (Int)baset;
229 } 229 }
230 result = true; 230 result = true;
231 break; 231 break;
232 case 67: 232 case 67:
233 baset = this._mThread.currentFrame.OpStack.Pop(); 233 baset = this._mThread.currentFrame.OpStack.Pop();
234 if (baset is Float) 234 if (baset is Float)
235 { 235 {
236 this._mThread.currentFrame.LocalVariables[0] = (Float)baset; 236 this._mThread.currentFrame.LocalVariables[0] = (Float)baset;
237 } 237 }
238 result = true; 238 result = true;
239 break; 239 break;
240 case 68: 240 case 68:
241 baset = this._mThread.currentFrame.OpStack.Pop(); 241 baset = this._mThread.currentFrame.OpStack.Pop();
242 if (baset is Float) 242 if (baset is Float)
243 { 243 {
244 this._mThread.currentFrame.LocalVariables[1] = (Float)baset; 244 this._mThread.currentFrame.LocalVariables[1] = (Float)baset;
245 } 245 }
246 result = true; 246 result = true;
247 break; 247 break;
248 case 69: 248 case 69:
249 baset = this._mThread.currentFrame.OpStack.Pop(); 249 baset = this._mThread.currentFrame.OpStack.Pop();
250 if (baset is Float) 250 if (baset is Float)
251 { 251 {
252 this._mThread.currentFrame.LocalVariables[2] = (Float)baset; 252 this._mThread.currentFrame.LocalVariables[2] = (Float)baset;
253 } 253 }
254 result = true; 254 result = true;
255 break; 255 break;
256 case 70: 256 case 70:
257 baset = this._mThread.currentFrame.OpStack.Pop(); 257 baset = this._mThread.currentFrame.OpStack.Pop();
258 if (baset is Float) 258 if (baset is Float)
259 { 259 {
260 this._mThread.currentFrame.LocalVariables[3] = (Float)baset; 260 this._mThread.currentFrame.LocalVariables[3] = (Float)baset;
261 } 261 }
262 result = true; 262 result = true;
263 break; 263 break;
264 case 87: 264 case 87:
265 this._mThread.currentFrame.OpStack.Pop(); 265 this._mThread.currentFrame.OpStack.Pop();
266 result = true; 266 result = true;
267 break; 267 break;
268 case 98: 268 case 98:
269 BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); 269 BaseType bf2 = this._mThread.currentFrame.OpStack.Pop();
270 BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); 270 BaseType bf1 = this._mThread.currentFrame.OpStack.Pop();
271 if (bf1 is Float && bf2 is Float) 271 if (bf1 is Float && bf2 is Float)
272 { 272 {
273 Float nflt = new Float(); 273 Float nflt = new Float();
274 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; 274 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
275 this._mThread.currentFrame.OpStack.Push(nflt); 275 this._mThread.currentFrame.OpStack.Push(nflt);
276 } 276 }
277 result = true; 277 result = true;
278 break; 278 break;
279 case 102: 279 case 102:
280 BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); 280 BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop();
281 BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); 281 BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop();
282 if (bsf1 is Float && bsf2 is Float) 282 if (bsf1 is Float && bsf2 is Float)
283 { 283 {
284 Float resf = new Float(); 284 Float resf = new Float();
285 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; 285 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
286 this._mThread.currentFrame.OpStack.Push(resf); 286 this._mThread.currentFrame.OpStack.Push(resf);
287 } 287 }
288 result = true; 288 result = true;
289 break; 289 break;
290 case 104: //check the order of the two values off the stack is correct 290 case 104: //check the order of the two values off the stack is correct
291 BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); 291 BaseType bs2 = this._mThread.currentFrame.OpStack.Pop();
292 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); 292 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
293 if (bs1 is Int && bs2 is Int) 293 if (bs1 is Int && bs2 is Int)
294 { 294 {
295 Int nInt = new Int(); 295 Int nInt = new Int();
296 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; 296 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
297 this._mThread.currentFrame.OpStack.Push(nInt); 297 this._mThread.currentFrame.OpStack.Push(nInt);
298 } 298 }
299 result = true; 299 result = true;
300 break; 300 break;
301 case 132: 301 case 132:
302 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) 302 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null)
303 { 303 {
304 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) 304 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int)
305 { 305 {
306 ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; 306 ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1];
307 } 307 }
308 } 308 }
309 this._mThread.PC += 2; 309 this._mThread.PC += 2;
310 result = true; 310 result = true;
311 break; 311 break;
312 case 139: 312 case 139:
313 BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); 313 BaseType conv1 = this._mThread.currentFrame.OpStack.Pop();
314 if (conv1 is Float) 314 if (conv1 is Float)
315 { 315 {
316 Int newconv = new Int(); 316 Int newconv = new Int();
317 newconv.mValue = (int)((Float)conv1).mValue; 317 newconv.mValue = (int)((Float)conv1).mValue;
318 this._mThread.currentFrame.OpStack.Push(newconv); 318 this._mThread.currentFrame.OpStack.Push(newconv);
319 } 319 }
320 result = true; 320 result = true;
321 break; 321 break;
322 case 149: 322 case 149:
323 BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); 323 BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop();
324 BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); 324 BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop();
325 if (flcom1 is Float && flcom2 is Float) 325 if (flcom1 is Float && flcom2 is Float)
326 { 326 {
327 Int compres = new Int(); 327 Int compres = new Int();
328 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 328 if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
329 { 329 {
330 compres.mValue = -1; 330 compres.mValue = -1;
331 } 331 }
332 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 332 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
333 { 333 {
334 compres.mValue = 1; 334 compres.mValue = 1;
335 } 335 }
336 else 336 else
337 { 337 {
338 compres.mValue = 0; 338 compres.mValue = 0;
339 } 339 }
340 this._mThread.currentFrame.OpStack.Push(compres); 340 this._mThread.currentFrame.OpStack.Push(compres);
341 } 341 }
342 result = true; 342 result = true;
343 break; 343 break;
344 case 158: 344 case 158:
345 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 345 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
346 BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); 346 BaseType comp1 = this._mThread.currentFrame.OpStack.Pop();
347 if (comp1 is Int) 347 if (comp1 is Int)
348 { 348 {
349 if (((Int)comp1).mValue <= 0) 349 if (((Int)comp1).mValue <= 0)
350 { 350 {
351 this._mThread.PC += -1 + compareoffset1; 351 this._mThread.PC += -1 + compareoffset1;
352 } 352 }
353 else 353 else
354 { 354 {
355 this._mThread.PC += 2; 355 this._mThread.PC += 2;
356 } 356 }
357 } 357 }
358 else 358 else
359 { 359 {
360 this._mThread.PC += 2; 360 this._mThread.PC += 2;
361 } 361 }
362 result = true; 362 result = true;
363 break; 363 break;
364 case 162: 364 case 162:
365 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 365 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
366 BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); 366 BaseType bc2 = this._mThread.currentFrame.OpStack.Pop();
367 BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); 367 BaseType bc1 = this._mThread.currentFrame.OpStack.Pop();
368 if (bc1 is Int && bc2 is Int) 368 if (bc1 is Int && bc2 is Int)
369 { 369 {
370 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); 370 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
371 if (((Int)bc1).mValue >= ((Int)bc2).mValue) 371 if (((Int)bc1).mValue >= ((Int)bc2).mValue)
372 { 372 {
373 // Console.WriteLine("branch compare true , offset is " +compareoffset); 373 // Console.WriteLine("branch compare true , offset is " +compareoffset);
374 // Console.WriteLine("current PC is " + this._mThread.PC); 374 // Console.WriteLine("current PC is " + this._mThread.PC);
375 this._mThread.PC += -1 + compareoffset; 375 this._mThread.PC += -1 + compareoffset;
376 //Console.WriteLine("new PC is " + this._mThread.PC); 376 //Console.WriteLine("new PC is " + this._mThread.PC);
377 } 377 }
378 else 378 else
379 { 379 {
380 //Console.WriteLine("branch compare false"); 380 //Console.WriteLine("branch compare false");
381 this._mThread.PC += 2; 381 this._mThread.PC += 2;
382 } 382 }
383 } 383 }
384 else 384 else
385 { 385 {
386 this._mThread.PC += 2; 386 this._mThread.PC += 2;
387 } 387 }
388 result = true; 388 result = true;
389 break; 389 break;
390 case 164: 390 case 164:
391 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 391 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
392 BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); 392 BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop();
393 BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); 393 BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop();
394 if (bcl1 is Int && bcl2 is Int) 394 if (bcl1 is Int && bcl2 is Int)
395 { 395 {
396 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); 396 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
397 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) 397 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue)
398 { 398 {
399 // Console.WriteLine("branch compare true , offset is " + compareloffset); 399 // Console.WriteLine("branch compare true , offset is " + compareloffset);
400 // Console.WriteLine("current PC is " + this._mThread.PC); 400 // Console.WriteLine("current PC is " + this._mThread.PC);
401 this._mThread.PC += -1 + compareloffset; 401 this._mThread.PC += -1 + compareloffset;
402 // Console.WriteLine("new PC is " + this._mThread.PC); 402 // Console.WriteLine("new PC is " + this._mThread.PC);
403 } 403 }
404 else 404 else
405 { 405 {
406 //Console.WriteLine("branch compare false"); 406 //Console.WriteLine("branch compare false");
407 this._mThread.PC += 2; 407 this._mThread.PC += 2;
408 } 408 }
409 } 409 }
410 else 410 else
411 { 411 {
412 this._mThread.PC += 2; 412 this._mThread.PC += 2;
413 } 413 }
414 result = true; 414 result = true;
415 break; 415 break;
416 case 167: 416 case 167:
417 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); 417 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
418 this._mThread.PC += -1 + offset; 418 this._mThread.PC += -1 + offset;
419 result = true; 419 result = true;
420 break; 420 break;
421 } 421 }
422 422
423 return result; 423 return result;
424 } 424 }
425 } 425 }
426 } 426 }
427} 427}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs
index e2e2b7c..6b85fcc 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs
@@ -1,96 +1,96 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36 36
37namespace OpenSim.Region.Scripting.EmbeddedJVM 37namespace OpenSim.Region.Scripting.EmbeddedJVM
38{ 38{
39 partial class Thread 39 partial class Thread
40 { 40 {
41 private partial class Interpreter 41 private partial class Interpreter
42 { 42 {
43 private bool IsMethodOpCode(byte opcode) 43 private bool IsMethodOpCode(byte opcode)
44 { 44 {
45 bool result = false; 45 bool result = false;
46 switch (opcode) 46 switch (opcode)
47 { 47 {
48 case 184: 48 case 184:
49 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); 49 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
50 if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) 50 if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
51 { 51 {
52 string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value; 52 string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value;
53 string typeparam = ""; 53 string typeparam = "";
54 string typereturn = ""; 54 string typereturn = "";
55 int firstbrak = 0; 55 int firstbrak = 0;
56 int secondbrak = 0; 56 int secondbrak = 0;
57 firstbrak = typ.LastIndexOf('('); 57 firstbrak = typ.LastIndexOf('(');
58 secondbrak = typ.LastIndexOf(')'); 58 secondbrak = typ.LastIndexOf(')');
59 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); 59 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
60 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); 60 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
61 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) 61 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
62 { 62 {
63 //calling a method in this class 63 //calling a method in this class
64 if (typeparam.Length == 0) 64 if (typeparam.Length == 0)
65 { 65 {
66 this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2)); 66 this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2));
67 } 67 }
68 else 68 else
69 { 69 {
70 this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2)); 70 this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2));
71 } 71 }
72 } 72 }
73 else 73 else
74 { 74 {
75 //calling a method of a different class 75 //calling a method of a different class
76 76
77 // OpenSimAPI Class 77 // OpenSimAPI Class
78 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") 78 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
79 { 79 {
80 this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null); 80 this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null);
81 } 81 }
82 } 82 }
83 } 83 }
84 else 84 else
85 { 85 {
86 this._mThread.PC += 2; 86 this._mThread.PC += 2;
87 } 87 }
88 result = true; 88 result = true;
89 break; 89 break;
90 } 90 }
91 91
92 return result; 92 return result;
93 } 93 }
94 } 94 }
95 } 95 }
96} 96}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs
index 6444776..3c18a11 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs
@@ -1,40 +1,40 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 partial class Thread 34 partial class Thread
35 { 35 {
36 private partial class Interpreter 36 private partial class Interpreter
37 { 37 {
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs
index d44f315..9961cbd 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs
@@ -1,135 +1,135 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.Scripting.EmbeddedJVM 34namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 35{
36 partial class Thread 36 partial class Thread
37 { 37 {
38 private partial class Interpreter 38 private partial class Interpreter
39 { 39 {
40 private Thread _mThread; 40 private Thread _mThread;
41 41
42 public Interpreter(Thread parentThread) 42 public Interpreter(Thread parentThread)
43 { 43 {
44 _mThread = parentThread; 44 _mThread = parentThread;
45 } 45 }
46 46
47 public bool Excute() 47 public bool Excute()
48 { 48 {
49 bool run = true; 49 bool run = true;
50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++]; 50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++];
51 // Console.WriteLine("opCode is: " + currentOpCode); 51 // Console.WriteLine("opCode is: " + currentOpCode);
52 bool handled = false; 52 bool handled = false;
53 53
54 handled = this.IsLogicOpCode(currentOpCode); 54 handled = this.IsLogicOpCode(currentOpCode);
55 if (!handled) 55 if (!handled)
56 { 56 {
57 handled = this.IsMethodOpCode(currentOpCode); 57 handled = this.IsMethodOpCode(currentOpCode);
58 } 58 }
59 if (!handled) 59 if (!handled)
60 { 60 {
61 if (currentOpCode == 172) 61 if (currentOpCode == 172)
62 { 62 {
63 if (this._mThread.stack.StackFrames.Count > 1) 63 if (this._mThread.stack.StackFrames.Count > 1)
64 { 64 {
65 Console.WriteLine("returning int from function"); 65 Console.WriteLine("returning int from function");
66 int retPC1 = this._mThread.currentFrame.ReturnPC; 66 int retPC1 = this._mThread.currentFrame.ReturnPC;
67 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); 67 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
68 this._mThread.stack.StackFrames.Pop(); 68 this._mThread.stack.StackFrames.Pop();
69 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); 69 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
70 this._mThread.PC = retPC1; 70 this._mThread.PC = retPC1;
71 if (bas1 is Int) 71 if (bas1 is Int)
72 { 72 {
73 this._mThread.currentFrame.OpStack.Push((Int)bas1); 73 this._mThread.currentFrame.OpStack.Push((Int)bas1);
74 } 74 }
75 } 75 }
76 else 76 else
77 { 77 {
78 // Console.WriteLine("No parent function so ending program"); 78 // Console.WriteLine("No parent function so ending program");
79 this._mThread.stack.StackFrames.Pop(); 79 this._mThread.stack.StackFrames.Pop();
80 run = false; 80 run = false;
81 } 81 }
82 handled = true; 82 handled = true;
83 } 83 }
84 if (currentOpCode == 174) 84 if (currentOpCode == 174)
85 { 85 {
86 if (this._mThread.stack.StackFrames.Count > 1) 86 if (this._mThread.stack.StackFrames.Count > 1)
87 { 87 {
88 Console.WriteLine("returning float from function"); 88 Console.WriteLine("returning float from function");
89 int retPC1 = this._mThread.currentFrame.ReturnPC; 89 int retPC1 = this._mThread.currentFrame.ReturnPC;
90 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); 90 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
91 this._mThread.stack.StackFrames.Pop(); 91 this._mThread.stack.StackFrames.Pop();
92 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); 92 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
93 this._mThread.PC = retPC1; 93 this._mThread.PC = retPC1;
94 if (bas1 is Float) 94 if (bas1 is Float)
95 { 95 {
96 this._mThread.currentFrame.OpStack.Push((Float)bas1); 96 this._mThread.currentFrame.OpStack.Push((Float)bas1);
97 } 97 }
98 } 98 }
99 else 99 else
100 { 100 {
101 // Console.WriteLine("No parent function so ending program"); 101 // Console.WriteLine("No parent function so ending program");
102 this._mThread.stack.StackFrames.Pop(); 102 this._mThread.stack.StackFrames.Pop();
103 run = false; 103 run = false;
104 } 104 }
105 handled = true; 105 handled = true;
106 } 106 }
107 if (currentOpCode == 177) 107 if (currentOpCode == 177)
108 { 108 {
109 if (this._mThread.stack.StackFrames.Count > 1) 109 if (this._mThread.stack.StackFrames.Count > 1)
110 { 110 {
111 Console.WriteLine("returning from function"); 111 Console.WriteLine("returning from function");
112 int retPC = this._mThread.currentFrame.ReturnPC; 112 int retPC = this._mThread.currentFrame.ReturnPC;
113 this._mThread.stack.StackFrames.Pop(); 113 this._mThread.stack.StackFrames.Pop();
114 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); 114 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
115 this._mThread.PC = retPC; 115 this._mThread.PC = retPC;
116 } 116 }
117 else 117 else
118 { 118 {
119 // Console.WriteLine("No parent function so ending program"); 119 // Console.WriteLine("No parent function so ending program");
120 this._mThread.stack.StackFrames.Pop(); 120 this._mThread.stack.StackFrames.Pop();
121 run = false; 121 run = false;
122 } 122 }
123 handled = true; 123 handled = true;
124 } 124 }
125 } 125 }
126 if (!handled) 126 if (!handled)
127 { 127 {
128 Console.WriteLine("opcode " + currentOpCode + " not been handled "); 128 Console.WriteLine("opcode " + currentOpCode + " not been handled ");
129 } 129 }
130 return run; 130 return run;
131 131
132 } 132 }
133 } 133 }
134 } 134 }
135} 135}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs
index addb6ff..7174975 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs
@@ -1,45 +1,45 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class MainMemory 34 public class MainMemory
35 { 35 {
36 public Heap HeapArea; 36 public Heap HeapArea;
37 public MethodMemory MethodArea; 37 public MethodMemory MethodArea;
38 38
39 public MainMemory() 39 public MainMemory()
40 { 40 {
41 MethodArea = new MethodMemory(); 41 MethodArea = new MethodMemory();
42 HeapArea = new Heap(); 42 HeapArea = new Heap();
43 } 43 }
44 } 44 }
45} 45}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs
index 7d69e91..5f29091 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class MethodMemory 34 public class MethodMemory
35 { 35 {
36 public byte[] MethodBuffer; 36 public byte[] MethodBuffer;
37 public List<ClassRecord> Classes = new List<ClassRecord>(); 37 public List<ClassRecord> Classes = new List<ClassRecord>();
38 public int NextMethodPC = 0; 38 public int NextMethodPC = 0;
39 public int Methodcount = 0; 39 public int Methodcount = 0;
40 40
41 public MethodMemory() 41 public MethodMemory()
42 { 42 {
43 MethodBuffer = new byte[20000]; 43 MethodBuffer = new byte[20000];
44 } 44 }
45 } 45 }
46} 46}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs
index 6a0a1a4..8acb2bd 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs
@@ -1,37 +1,37 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class Object 34 public class Object
35 { 35 {
36 } 36 }
37} 37}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs
index 74f0a7f..7c12678 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs
@@ -1,42 +1,42 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class Stack 34 public class Stack
35 { 35 {
36 public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); 36 public Stack<StackFrame> StackFrames = new Stack<StackFrame>();
37 37
38 public Stack() 38 public Stack()
39 { 39 {
40 } 40 }
41 } 41 }
42} 42}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs
index 1072395..76257b8 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs
@@ -1,49 +1,49 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32 32
33namespace OpenSim.Region.Scripting.EmbeddedJVM 33namespace OpenSim.Region.Scripting.EmbeddedJVM
34{ 34{
35 public class StackFrame 35 public class StackFrame
36 { 36 {
37 public BaseType[] LocalVariables; 37 public BaseType[] LocalVariables;
38 public Stack<BaseType> OpStack = new Stack<BaseType>(); 38 public Stack<BaseType> OpStack = new Stack<BaseType>();
39 39
40 public int ReturnPC = 0; 40 public int ReturnPC = 0;
41 public ClassRecord CallingClass = null; 41 public ClassRecord CallingClass = null;
42 42
43 public StackFrame() 43 public StackFrame()
44 { 44 {
45 LocalVariables = new BaseType[20]; 45 LocalVariables = new BaseType[20];
46 } 46 }
47 47
48 } 48 }
49} 49}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
index 59f3042..eda2640 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
@@ -1,119 +1,119 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36using OpenSim.Region.Scripting; 36using OpenSim.Region.Scripting;
37 37
38namespace OpenSim.Region.Scripting.EmbeddedJVM 38namespace OpenSim.Region.Scripting.EmbeddedJVM
39{ 39{
40 public partial class Thread 40 public partial class Thread
41 { 41 {
42 // Is this smart? 42 // Is this smart?
43 public static MainMemory GlobalMemory; 43 public static MainMemory GlobalMemory;
44 public static Scene World; 44 public static Scene World;
45 private int PC = 0; 45 private int PC = 0;
46 private Stack stack; 46 private Stack stack;
47 private Interpreter mInterpreter; 47 private Interpreter mInterpreter;
48 public ClassRecord currentClass; 48 public ClassRecord currentClass;
49 public ClassInstance currentInstance; 49 public ClassInstance currentInstance;
50 private StackFrame currentFrame; 50 private StackFrame currentFrame;
51 public int excutionCounter = 0; 51 public int excutionCounter = 0;
52 public bool running = false; 52 public bool running = false;
53 53
54 public ScriptInfo scriptInfo; 54 public ScriptInfo scriptInfo;
55 55
56 public Thread() 56 public Thread()
57 { 57 {
58 this.mInterpreter = new Interpreter(this); 58 this.mInterpreter = new Interpreter(this);
59 this.stack = new Stack(); 59 this.stack = new Stack();
60 } 60 }
61 61
62 public void SetPC(int methodpointer) 62 public void SetPC(int methodpointer)
63 { 63 {
64 //Console.WriteLine("Thread PC has been set to " + methodpointer); 64 //Console.WriteLine("Thread PC has been set to " + methodpointer);
65 PC = methodpointer; 65 PC = methodpointer;
66 } 66 }
67 67
68 public void StartMethod(ClassRecord rec, string methName) 68 public void StartMethod(ClassRecord rec, string methName)
69 { 69 {
70 currentFrame = new StackFrame(); 70 currentFrame = new StackFrame();
71 this.stack.StackFrames.Push(currentFrame); 71 this.stack.StackFrames.Push(currentFrame);
72 this.currentClass = rec; 72 this.currentClass = rec;
73 currentClass.StartMethod(this, methName); 73 currentClass.StartMethod(this, methName);
74 } 74 }
75 75
76 public void StartMethod( string methName) 76 public void StartMethod( string methName)
77 { 77 {
78 currentFrame = new StackFrame(); 78 currentFrame = new StackFrame();
79 this.stack.StackFrames.Push(currentFrame); 79 this.stack.StackFrames.Push(currentFrame);
80 currentClass.StartMethod(this, methName); 80 currentClass.StartMethod(this, methName);
81 } 81 }
82 82
83 public void JumpToStaticVoidMethod(string methName, int returnPC) 83 public void JumpToStaticVoidMethod(string methName, int returnPC)
84 { 84 {
85 currentFrame = new StackFrame(); 85 currentFrame = new StackFrame();
86 currentFrame.ReturnPC = returnPC; 86 currentFrame.ReturnPC = returnPC;
87 this.stack.StackFrames.Push(currentFrame); 87 this.stack.StackFrames.Push(currentFrame);
88 currentClass.StartMethod(this, methName); 88 currentClass.StartMethod(this, methName);
89 } 89 }
90 90
91 public void JumpToStaticParamMethod(string methName, string param, int returnPC) 91 public void JumpToStaticParamMethod(string methName, string param, int returnPC)
92 { 92 {
93 if (param == "I") 93 if (param == "I")
94 { 94 {
95 BaseType bs1 = currentFrame.OpStack.Pop(); 95 BaseType bs1 = currentFrame.OpStack.Pop();
96 currentFrame = new StackFrame(); 96 currentFrame = new StackFrame();
97 currentFrame.ReturnPC = returnPC; 97 currentFrame.ReturnPC = returnPC;
98 this.stack.StackFrames.Push(currentFrame); 98 this.stack.StackFrames.Push(currentFrame);
99 currentFrame.LocalVariables[0] = ((Int)bs1); 99 currentFrame.LocalVariables[0] = ((Int)bs1);
100 currentClass.StartMethod(this, methName); 100 currentClass.StartMethod(this, methName);
101 } 101 }
102 if (param == "F") 102 if (param == "F")
103 { 103 {
104 104
105 } 105 }
106 } 106 }
107 107
108 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) 108 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
109 { 109 {
110 110
111 } 111 }
112 112
113 public bool Excute() 113 public bool Excute()
114 { 114 {
115 excutionCounter++; 115 excutionCounter++;
116 return this.mInterpreter.Excute(); 116 return this.mInterpreter.Excute();
117 } 117 }
118 } 118 }
119} 119}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
index a884e2b..58cdf49 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
@@ -1,29 +1,29 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Region.Scripting; 5using OpenSim.Region.Scripting;
6using OpenSim.Region.Scripting.EmbeddedJVM; 6using OpenSim.Region.Scripting.EmbeddedJVM;
7 7
8namespace OpenSim.Region.Scripting 8namespace OpenSim.Region.Scripting
9{ 9{
10 public class JavaEngine : IScriptCompiler 10 public class JavaEngine : IScriptCompiler
11 { 11 {
12 public string FileExt() 12 public string FileExt()
13 { 13 {
14 return ".java"; 14 return ".java";
15 } 15 }
16 16
17 public Dictionary<string, IScript> compile(string filename) 17 public Dictionary<string, IScript> compile(string filename)
18 { 18 {
19 JVMScript script = new JVMScript(); 19 JVMScript script = new JVMScript();
20 Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); 20 Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
21 21
22 script.LoadScript(filename); 22 script.LoadScript(filename);
23 23
24 returns.Add(filename, script); 24 returns.Add(filename, script);
25 25
26 return returns; 26 return returns;
27 } 27 }
28 } 28 }
29} 29}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
index 8b38951..78c6f67 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
@@ -1,170 +1,170 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.IO; 31using System.IO;
32using System.Threading; 32using System.Threading;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36using OpenSim.Region.Scripting; 36using OpenSim.Region.Scripting;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38 38
39namespace OpenSim.Region.Scripting.EmbeddedJVM 39namespace OpenSim.Region.Scripting.EmbeddedJVM
40{ 40{
41 public class JVMScript : IScript 41 public class JVMScript : IScript
42 { 42 {
43 private List<Thread> _threads = new List<Thread>(); 43 private List<Thread> _threads = new List<Thread>();
44 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); 44 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
45 private MainMemory _mainMemory; 45 private MainMemory _mainMemory;
46 46
47 ScriptInfo scriptInfo; 47 ScriptInfo scriptInfo;
48 48
49 public void Initialise(ScriptInfo info) 49 public void Initialise(ScriptInfo info)
50 { 50 {
51 scriptInfo = info; 51 scriptInfo = info;
52 52
53 _mainMemory = new MainMemory(); 53 _mainMemory = new MainMemory();
54 Thread.GlobalMemory = this._mainMemory; 54 Thread.GlobalMemory = this._mainMemory;
55 Thread.World = info.world; 55 Thread.World = info.world;
56 CompileScript(); 56 CompileScript();
57 57
58 scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); 58 scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
59 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 59 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
60 } 60 }
61 61
62 void events_OnNewPresence(ScenePresence presence) 62 void events_OnNewPresence(ScenePresence presence)
63 { 63 {
64 for (int i = 0; i < this._threads.Count; i++) 64 for (int i = 0; i < this._threads.Count; i++)
65 { 65 {
66 if (!this._threads[i].running) 66 if (!this._threads[i].running)
67 { 67 {
68 this._threads[i].StartMethod("OnNewPresence"); 68 this._threads[i].StartMethod("OnNewPresence");
69 bool run = true; 69 bool run = true;
70 while (run) 70 while (run)
71 { 71 {
72 run = this._threads[i].Excute(); 72 run = this._threads[i].Excute();
73 } 73 }
74 } 74 }
75 } 75 }
76 } 76 }
77 77
78 void events_OnFrame() 78 void events_OnFrame()
79 { 79 {
80 for (int i = 0; i < this._threads.Count; i++) 80 for (int i = 0; i < this._threads.Count; i++)
81 { 81 {
82 if (!this._threads[i].running) 82 if (!this._threads[i].running)
83 { 83 {
84 this._threads[i].StartMethod("OnFrame"); 84 this._threads[i].StartMethod("OnFrame");
85 bool run = true; 85 bool run = true;
86 while (run) 86 while (run)
87 { 87 {
88 run = this._threads[i].Excute(); 88 run = this._threads[i].Excute();
89 } 89 }
90 } 90 }
91 } 91 }
92 } 92 }
93 93
94 public string getName() 94 public string getName()
95 { 95 {
96 return "JVM Scripting Engine"; 96 return "JVM Scripting Engine";
97 } 97 }
98 98
99 public void LoadScript(string script) 99 public void LoadScript(string script)
100 { 100 {
101 Console.WriteLine("OpenSimJVM - loading new script: " + script); 101 Console.WriteLine("OpenSimJVM - loading new script: " + script);
102 CompileInfo comp = new CompileInfo(); 102 CompileInfo comp = new CompileInfo();
103 comp.script = script; 103 comp.script = script;
104 comp.scriptName = script; 104 comp.scriptName = script;
105 this.CompileScripts.Enqueue(comp); 105 this.CompileScripts.Enqueue(comp);
106 } 106 }
107 107
108 public void CompileScript() 108 public void CompileScript()
109 { 109 {
110 CompileInfo comp = this.CompileScripts.Dequeue(); 110 CompileInfo comp = this.CompileScripts.Dequeue();
111 string script = comp.script; 111 string script = comp.script;
112 string scriptName = comp.scriptName; 112 string scriptName = comp.scriptName;
113 try 113 try
114 { 114 {
115 //need to compile the script into a java class file 115 //need to compile the script into a java class file
116 116
117 //first save it to a java source file 117 //first save it to a java source file
118 TextWriter tw = new StreamWriter(scriptName + ".java"); 118 TextWriter tw = new StreamWriter(scriptName + ".java");
119 tw.WriteLine(script); 119 tw.WriteLine(script);
120 tw.Close(); 120 tw.Close();
121 121
122 //now compile 122 //now compile
123 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); 123 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
124 // psi.RedirectStandardOutput = true; 124 // psi.RedirectStandardOutput = true;
125 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 125 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
126 psi.UseShellExecute = false; 126 psi.UseShellExecute = false;
127 127
128 System.Diagnostics.Process javacomp; 128 System.Diagnostics.Process javacomp;
129 javacomp = System.Diagnostics.Process.Start(psi); 129 javacomp = System.Diagnostics.Process.Start(psi);
130 javacomp.WaitForExit(); 130 javacomp.WaitForExit();
131 131
132 132
133 //now load in class file 133 //now load in class file
134 ClassRecord class1 = new ClassRecord(); 134 ClassRecord class1 = new ClassRecord();
135 class1.LoadClassFromFile(scriptName + ".class"); 135 class1.LoadClassFromFile(scriptName + ".class");
136 class1.PrintToConsole(); 136 class1.PrintToConsole();
137 //Console.WriteLine(); 137 //Console.WriteLine();
138 this._mainMemory.MethodArea.Classes.Add(class1); 138 this._mainMemory.MethodArea.Classes.Add(class1);
139 class1.AddMethodsToMemory(this._mainMemory.MethodArea); 139 class1.AddMethodsToMemory(this._mainMemory.MethodArea);
140 140
141 Thread newThread = new Thread(); 141 Thread newThread = new Thread();
142 this._threads.Add(newThread); 142 this._threads.Add(newThread);
143 newThread.currentClass = class1; 143 newThread.currentClass = class1;
144 newThread.scriptInfo = scriptInfo; 144 newThread.scriptInfo = scriptInfo;
145 145
146 //now delete the created files 146 //now delete the created files
147 System.IO.File.Delete(scriptName + ".java"); 147 System.IO.File.Delete(scriptName + ".java");
148 System.IO.File.Delete(scriptName + ".class"); 148 System.IO.File.Delete(scriptName + ".class");
149 //this.OnFrame(); 149 //this.OnFrame();
150 } 150 }
151 catch (Exception e) 151 catch (Exception e)
152 { 152 {
153 Console.WriteLine("exception"); 153 Console.WriteLine("exception");
154 Console.WriteLine(e.StackTrace); 154 Console.WriteLine(e.StackTrace);
155 Console.WriteLine(e.Message); 155 Console.WriteLine(e.Message);
156 } 156 }
157 } 157 }
158 158
159 private class CompileInfo 159 private class CompileInfo
160 { 160 {
161 public string script; 161 public string script;
162 public string scriptName; 162 public string scriptName;
163 163
164 public CompileInfo() 164 public CompileInfo()
165 { 165 {
166 166
167 } 167 }
168 } 168 }
169 } 169 }
170} 170}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs
index 40e2e22..0c4d623 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
6{ 6{
7 public class ArrayReference :BaseType 7 public class ArrayReference :BaseType
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs
index 4ee1720..7fc0a4f 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
6{ 6{
7 public class BaseType : Object 7 public class BaseType : Object
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs
index 75d8e41..7718765 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
6{ 6{
7 public class ObjectReference : BaseType 7 public class ObjectReference : BaseType
8 { 8 {
9 public ushort Reference; 9 public ushort Reference;
10 10
11 public ObjectReference() 11 public ObjectReference()
12 { 12 {
13 13
14 } 14 }
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
index f5446dc..5a7b780 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Byte : BaseType 7 public class Byte : BaseType
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
index 89824b4..c87ee8f 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Char : BaseType 7 public class Char : BaseType
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
index 2638c20..982e748 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Float : BaseType 7 public class Float : BaseType
8 { 8 {
9 public float mValue = 0; 9 public float mValue = 0;
10 10
11 public Float() 11 public Float()
12 { 12 {
13 13
14 } 14 }
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
index 0155e72..073a9b3 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Int : BaseType 7 public class Int : BaseType
8 { 8 {
9 public int mValue = 0; 9 public int mValue = 0;
10 10
11 public Int() 11 public Int()
12 { 12 {
13 13
14 } 14 }
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs
index 8b957d3..012a00e 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs
@@ -1,140 +1,140 @@
1using System; 1using System;
2using System.Reflection; 2using System.Reflection;
3using System.Reflection.Emit; 3using System.Reflection.Emit;
4using System.Threading; 4using System.Threading;
5 5
6using OpenSim.Region.Scripting; 6using OpenSim.Region.Scripting;
7 7
8namespace OpenSim.ScriptEngines.LSL 8namespace OpenSim.ScriptEngines.LSL
9{ 9{
10 10
11 11
12 public class Engine 12 public class Engine
13 { 13 {
14 public void Start(ScriptInfo WorldAPI) 14 public void Start(ScriptInfo WorldAPI)
15 { 15 {
16 16
17 17
18 18
19 // Create Assembly Name 19 // Create Assembly Name
20 AssemblyName asmName = new AssemblyName(); 20 AssemblyName asmName = new AssemblyName();
21 asmName.Name = "TestAssembly"; 21 asmName.Name = "TestAssembly";
22 22
23 // Create Assembly 23 // Create Assembly
24 AssemblyBuilder asmBuilder = 24 AssemblyBuilder asmBuilder =
25 Thread.GetDomain().DefineDynamicAssembly 25 Thread.GetDomain().DefineDynamicAssembly
26 (asmName, AssemblyBuilderAccess.RunAndSave); 26 (asmName, AssemblyBuilderAccess.RunAndSave);
27 27
28 // Create a module (and save to disk) 28 // Create a module (and save to disk)
29 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule 29 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
30 (asmName.Name, asmName.Name + ".dll"); 30 (asmName.Name, asmName.Name + ".dll");
31 31
32 // Create a Class (/Type) 32 // Create a Class (/Type)
33 TypeBuilder typeBuilder = modBuilder.DefineType( 33 TypeBuilder typeBuilder = modBuilder.DefineType(
34 "MyClass", 34 "MyClass",
35 TypeAttributes.Public, 35 TypeAttributes.Public,
36 typeof(object), 36 typeof(object),
37 new Type[] { typeof(LSL_CLRInterface.LSLScript) }); 37 new Type[] { typeof(LSL_CLRInterface.LSLScript) });
38 38
39 39
40 40
41 /* 41 /*
42 * Generate the IL itself 42 * Generate the IL itself
43 */ 43 */
44 44
45 GenerateIL(WorldAPI, typeBuilder); 45 GenerateIL(WorldAPI, typeBuilder);
46 46
47 47
48 /* 48 /*
49 * Done generating, create a type and run it. 49 * Done generating, create a type and run it.
50 */ 50 */
51 51
52 // Create type object for the class (after defining fields and methods) 52 // Create type object for the class (after defining fields and methods)
53 Type type = typeBuilder.CreateType(); 53 Type type = typeBuilder.CreateType();
54 54
55 asmBuilder.Save("TestAssembly.dll"); 55 asmBuilder.Save("TestAssembly.dll");
56 56
57 // Create an instance we can play with 57 // Create an instance we can play with
58 //LSLScript hello = (LSLScript)Activator.CreateInstance(type); 58 //LSLScript hello = (LSLScript)Activator.CreateInstance(type);
59 LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); 59 LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type);
60 60
61 // Play with it 61 // Play with it
62 MyScript.event_state_entry("Test"); 62 MyScript.event_state_entry("Test");
63 } 63 }
64 64
65 private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder) 65 private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder)
66 { 66 {
67 67
68 68
69 // For debug 69 // For debug
70 LSO_Parser LSOP = new LSO_Parser(); 70 LSO_Parser LSOP = new LSO_Parser();
71 LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder); 71 LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder);
72 return; 72 return;
73 73
74 74
75 // Override a Method / Function 75 // Override a Method / Function
76 MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry", 76 MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry",
77 MethodAttributes.Private | MethodAttributes.Virtual, 77 MethodAttributes.Private | MethodAttributes.Virtual,
78 typeof(void), 78 typeof(void),
79 new Type[] { typeof(object) }); 79 new Type[] { typeof(object) });
80 80
81 typeBuilder.DefineMethodOverride(methodBuilder, 81 typeBuilder.DefineMethodOverride(methodBuilder,
82 typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry")); 82 typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry"));
83 83
84 // Create the IL generator 84 // Create the IL generator
85 ILGenerator il = methodBuilder.GetILGenerator(); 85 ILGenerator il = methodBuilder.GetILGenerator();
86 86
87 87
88 /* 88 /*
89 * TRY 89 * TRY
90 */ 90 */
91 il.BeginExceptionBlock(); 91 il.BeginExceptionBlock();
92 92
93 // Push "Hello World!" string to stack 93 // Push "Hello World!" string to stack
94 il.Emit(OpCodes.Ldstr, "Hello World!"); 94 il.Emit(OpCodes.Ldstr, "Hello World!");
95 95
96 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 96 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
97 il.Emit(OpCodes.Call, typeof(Console).GetMethod 97 il.Emit(OpCodes.Call, typeof(Console).GetMethod
98 ("WriteLine", new Type[] { typeof(string) })); 98 ("WriteLine", new Type[] { typeof(string) }));
99 99
100 //il.EmitCall(OpCodes.Callvirt 100 //il.EmitCall(OpCodes.Callvirt
101 //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod 101 //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod
102 //("TestFunction")); 102 //("TestFunction"));
103 103
104 104
105 //il.ThrowException(typeof(NotSupportedException)); 105 //il.ThrowException(typeof(NotSupportedException));
106 106
107 107
108 /* 108 /*
109 * CATCH 109 * CATCH
110 */ 110 */
111 il.BeginCatchBlock(typeof(Exception)); 111 il.BeginCatchBlock(typeof(Exception));
112 112
113 // Push "Hello World!" string to stack 113 // Push "Hello World!" string to stack
114 il.Emit(OpCodes.Ldstr, "Something went wrong: "); 114 il.Emit(OpCodes.Ldstr, "Something went wrong: ");
115 115
116 //call void [mscorlib]System.Console::WriteLine(string) 116 //call void [mscorlib]System.Console::WriteLine(string)
117 il.Emit(OpCodes.Call, typeof(Console).GetMethod 117 il.Emit(OpCodes.Call, typeof(Console).GetMethod
118 ("Write", new Type[] { typeof(string) })); 118 ("Write", new Type[] { typeof(string) }));
119 119
120 //callvirt instance string [mscorlib]System.Exception::get_Message() 120 //callvirt instance string [mscorlib]System.Exception::get_Message()
121 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod 121 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod
122 ("get_Message")); 122 ("get_Message"));
123 123
124 //call void [mscorlib]System.Console::WriteLine(string) 124 //call void [mscorlib]System.Console::WriteLine(string)
125 il.Emit(OpCodes.Call, typeof(Console).GetMethod 125 il.Emit(OpCodes.Call, typeof(Console).GetMethod
126 ("WriteLine", new Type[] { typeof(string) })); 126 ("WriteLine", new Type[] { typeof(string) }));
127 127
128 /* 128 /*
129 * END TRY 129 * END TRY
130 */ 130 */
131 il.EndExceptionBlock(); 131 il.EndExceptionBlock();
132 132
133 133
134 // Push "Return from current method, with return value if present" to stack 134 // Push "Return from current method, with return value if present" to stack
135 il.Emit(OpCodes.Ret); 135 il.Emit(OpCodes.Ret);
136 136
137 137
138 } 138 }
139 } 139 }
140} 140}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs
index dc612ff..57bbf11 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs
@@ -1,51 +1,51 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.ScriptEngines.LSL 5namespace OpenSim.ScriptEngines.LSL
6{ 6{
7 public class LSL_CLRInterface 7 public class LSL_CLRInterface
8 { 8 {
9 public interface LSLScript 9 public interface LSLScript
10 { 10 {
11 //public virtual void Run(object arg) 11 //public virtual void Run(object arg)
12 //{ 12 //{
13 //} 13 //}
14 //void Run(object arg); 14 //void Run(object arg);
15 15
16 void event_state_entry(object arg); 16 void event_state_entry(object arg);
17 //void event_state_exit(); 17 //void event_state_exit();
18 void event_touch_start(object arg); 18 void event_touch_start(object arg);
19 //void event_touch(); 19 //void event_touch();
20 //void event_touch_end(); 20 //void event_touch_end();
21 //void event_collision_start(); 21 //void event_collision_start();
22 //void event_collision(); 22 //void event_collision();
23 //void event_collision_end(); 23 //void event_collision_end();
24 //void event_land_collision_start(); 24 //void event_land_collision_start();
25 //void event_land_collision(); 25 //void event_land_collision();
26 //void event_land_collision_end(); 26 //void event_land_collision_end();
27 //void event_timer(); 27 //void event_timer();
28 //void event_listen(); 28 //void event_listen();
29 //void event_on_rez(); 29 //void event_on_rez();
30 //void event_sensor(); 30 //void event_sensor();
31 //void event_no_sensor(); 31 //void event_no_sensor();
32 //void event_control(); 32 //void event_control();
33 //void event_money(); 33 //void event_money();
34 //void event_email(); 34 //void event_email();
35 //void event_at_target(); 35 //void event_at_target();
36 //void event_not_at_target(); 36 //void event_not_at_target();
37 //void event_at_rot_target(); 37 //void event_at_rot_target();
38 //void event_not_at_rot_target(); 38 //void event_not_at_rot_target();
39 //void event_run_time_permissions(); 39 //void event_run_time_permissions();
40 //void event_changed(); 40 //void event_changed();
41 //void event_attach(); 41 //void event_attach();
42 //void event_dataserver(); 42 //void event_dataserver();
43 //void event_link_message(); 43 //void event_link_message();
44 //void event_moving_start(); 44 //void event_moving_start();
45 //void event_moving_end(); 45 //void event_moving_end();
46 //void event_object_rez(); 46 //void event_object_rez();
47 //void event_remote_data(); 47 //void event_remote_data();
48 //void event_http_response(); 48 //void event_http_response();
49 } 49 }
50 } 50 }
51} 51}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs
index edeccdd..b45abe0 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs
@@ -1,485 +1,485 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.ScriptEngines.LSL 5namespace OpenSim.ScriptEngines.LSL
6{ 6{
7 static class LSO_Enums 7 static class LSO_Enums
8 { 8 {
9 9
10 public enum Variable_Type_Codes 10 public enum Variable_Type_Codes
11 { 11 {
12 Void = 0, 12 Void = 0,
13 Integer = 1, 13 Integer = 1,
14 Float = 2, 14 Float = 2,
15 String = 3, 15 String = 3,
16 Key = 4, 16 Key = 4,
17 Vector = 5, 17 Vector = 5,
18 Rotation = 6, 18 Rotation = 6,
19 List = 7 19 List = 7
20 } 20 }
21 public enum Event_Mask_Values 21 public enum Event_Mask_Values
22 { 22 {
23 state_entry = 0, 23 state_entry = 0,
24 state_exit = 1, 24 state_exit = 1,
25 touch_start = 2, 25 touch_start = 2,
26 touch = 3, 26 touch = 3,
27 touch_end = 4, 27 touch_end = 4,
28 collision_start = 5, 28 collision_start = 5,
29 collision = 6, 29 collision = 6,
30 collision_end = 7, 30 collision_end = 7,
31 land_collision_start = 8, 31 land_collision_start = 8,
32 land_collision = 9, 32 land_collision = 9,
33 land_collision_end = 10, 33 land_collision_end = 10,
34 timer = 11, 34 timer = 11,
35 listen = 12, 35 listen = 12,
36 on_rez = 13, 36 on_rez = 13,
37 sensor = 14, 37 sensor = 14,
38 no_sensor = 15, 38 no_sensor = 15,
39 control = 16, 39 control = 16,
40 money = 17, 40 money = 17,
41 email = 18, 41 email = 18,
42 at_target = 19, 42 at_target = 19,
43 not_at_target = 20, 43 not_at_target = 20,
44 at_rot_target = 21, 44 at_rot_target = 21,
45 not_at_rot_target = 22, 45 not_at_rot_target = 22,
46 run_time_permissions = 23, 46 run_time_permissions = 23,
47 changed = 24, 47 changed = 24,
48 attach = 25, 48 attach = 25,
49 dataserver = 26, 49 dataserver = 26,
50 link_message = 27, 50 link_message = 27,
51 moving_start = 28, 51 moving_start = 28,
52 moving_end = 29, 52 moving_end = 29,
53 object_rez = 30, 53 object_rez = 30,
54 remote_data = 31, 54 remote_data = 31,
55 http_response = 32 55 http_response = 32
56 } 56 }
57 public enum Operation_Table 57 public enum Operation_Table
58 { 58 {
59 NOOP = 0x0, 59 NOOP = 0x0,
60 POP = 0x1, 60 POP = 0x1,
61 POPS = 0x2, 61 POPS = 0x2,
62 POPL = 0x3, 62 POPL = 0x3,
63 POPV = 0x4, 63 POPV = 0x4,
64 POPQ = 0x5, 64 POPQ = 0x5,
65 POPARG = 0x6, 65 POPARG = 0x6,
66 POPIP = 0x7, 66 POPIP = 0x7,
67 POPBP = 0x8, 67 POPBP = 0x8,
68 POPSP = 0x9, 68 POPSP = 0x9,
69 POPSLR = 0xa, 69 POPSLR = 0xa,
70 DUP = 0x20, 70 DUP = 0x20,
71 DUPS = 0x21, 71 DUPS = 0x21,
72 DUPL = 0x22, 72 DUPL = 0x22,
73 DUPV = 0x23, 73 DUPV = 0x23,
74 DUPQ = 0x24, 74 DUPQ = 0x24,
75 STORE = 0x30, 75 STORE = 0x30,
76 STORES = 0x31, 76 STORES = 0x31,
77 STOREL = 0x32, 77 STOREL = 0x32,
78 STOREV = 0x33, 78 STOREV = 0x33,
79 STOREQ = 0x34, 79 STOREQ = 0x34,
80 STOREG = 0x35, 80 STOREG = 0x35,
81 STOREGS = 0x36, 81 STOREGS = 0x36,
82 STOREGL = 0x37, 82 STOREGL = 0x37,
83 STOREGV = 0x38, 83 STOREGV = 0x38,
84 STOREGQ = 0x39, 84 STOREGQ = 0x39,
85 LOADP = 0x3a, 85 LOADP = 0x3a,
86 LOADSP = 0x3b, 86 LOADSP = 0x3b,
87 LOADLP = 0x3c, 87 LOADLP = 0x3c,
88 LOADVP = 0x3d, 88 LOADVP = 0x3d,
89 LOADQP = 0x3e, 89 LOADQP = 0x3e,
90 LOADGP = 0x3f, 90 LOADGP = 0x3f,
91 LOADGSP = 0x40, 91 LOADGSP = 0x40,
92 LOADGLP = 0x41, 92 LOADGLP = 0x41,
93 LOADGVP = 0x42, 93 LOADGVP = 0x42,
94 LOADGQP = 0x43, 94 LOADGQP = 0x43,
95 PUSH = 0x50, 95 PUSH = 0x50,
96 PUSHS = 0x51, 96 PUSHS = 0x51,
97 PUSHL = 0x52, 97 PUSHL = 0x52,
98 PUSHV = 0x53, 98 PUSHV = 0x53,
99 PUSHQ = 0x54, 99 PUSHQ = 0x54,
100 PUSHG = 0x55, 100 PUSHG = 0x55,
101 PUSHGS = 0x56, 101 PUSHGS = 0x56,
102 PUSHGL = 0x57, 102 PUSHGL = 0x57,
103 PUSHGV = 0x58, 103 PUSHGV = 0x58,
104 PUSHGQ = 0x59, 104 PUSHGQ = 0x59,
105 PUSHIP = 0x5a, 105 PUSHIP = 0x5a,
106 PUSHBP = 0x5b, 106 PUSHBP = 0x5b,
107 PUSHSP = 0x5c, 107 PUSHSP = 0x5c,
108 PUSHARGB = 0x5d, 108 PUSHARGB = 0x5d,
109 PUSHARGI = 0x5e, 109 PUSHARGI = 0x5e,
110 PUSHARGF = 0x5f, 110 PUSHARGF = 0x5f,
111 PUSHARGS = 0x60, 111 PUSHARGS = 0x60,
112 PUSHARGV = 0x61, 112 PUSHARGV = 0x61,
113 PUSHARGQ = 0x62, 113 PUSHARGQ = 0x62,
114 PUSHE = 0x63, 114 PUSHE = 0x63,
115 PUSHEV = 0x64, 115 PUSHEV = 0x64,
116 PUSHEQ = 0x65, 116 PUSHEQ = 0x65,
117 PUSHARGE = 0x66, 117 PUSHARGE = 0x66,
118 ADD = 0x70, 118 ADD = 0x70,
119 SUB = 0x71, 119 SUB = 0x71,
120 MUL = 0x72, 120 MUL = 0x72,
121 DIV = 0x73, 121 DIV = 0x73,
122 MOD = 0x74, 122 MOD = 0x74,
123 EQ = 0x75, 123 EQ = 0x75,
124 NEQ = 0x76, 124 NEQ = 0x76,
125 LEQ = 0x77, 125 LEQ = 0x77,
126 GEQ = 0x78, 126 GEQ = 0x78,
127 LESS = 0x79, 127 LESS = 0x79,
128 GREATER = 0x7a, 128 GREATER = 0x7a,
129 BITAND = 0x7b, 129 BITAND = 0x7b,
130 BITOR = 0x7c, 130 BITOR = 0x7c,
131 BITXOR = 0x7d, 131 BITXOR = 0x7d,
132 BOOLAND = 0x7e, 132 BOOLAND = 0x7e,
133 BOOLOR = 0x7f, 133 BOOLOR = 0x7f,
134 NEG = 0x80, 134 NEG = 0x80,
135 BITNOT = 0x81, 135 BITNOT = 0x81,
136 BOOLNOT = 0x82, 136 BOOLNOT = 0x82,
137 JUMP = 0x90, 137 JUMP = 0x90,
138 JUMPIF = 0x91, 138 JUMPIF = 0x91,
139 JUMPNIF = 0x92, 139 JUMPNIF = 0x92,
140 STATE = 0x93, 140 STATE = 0x93,
141 CALL = 0x94, 141 CALL = 0x94,
142 RETURN = 0x95, 142 RETURN = 0x95,
143 CAST = 0xa0, 143 CAST = 0xa0,
144 STACKTOS = 0xb0, 144 STACKTOS = 0xb0,
145 STACKTOL = 0xb1, 145 STACKTOL = 0xb1,
146 PRINT = 0xc0, 146 PRINT = 0xc0,
147 CALLLIB = 0xd0, 147 CALLLIB = 0xd0,
148 CALLLIB_TWO_BYTE = 0xd1, 148 CALLLIB_TWO_BYTE = 0xd1,
149 SHL = 0xe0, 149 SHL = 0xe0,
150 SHR = 0xe1 150 SHR = 0xe1
151 } 151 }
152 public enum BuiltIn_Functions 152 public enum BuiltIn_Functions
153 { 153 {
154 llSin = 0, 154 llSin = 0,
155 llCos = 1, 155 llCos = 1,
156 llTan = 2, 156 llTan = 2,
157 llAtan2 = 3, 157 llAtan2 = 3,
158 llSqrt = 4, 158 llSqrt = 4,
159 llPow = 5, 159 llPow = 5,
160 llAbs = 6, 160 llAbs = 6,
161 llFabs = 7, 161 llFabs = 7,
162 llFrand = 8, 162 llFrand = 8,
163 llFloor = 9, 163 llFloor = 9,
164 llCeil = 10, 164 llCeil = 10,
165 llRound = 11, 165 llRound = 11,
166 llVecMag = 12, 166 llVecMag = 12,
167 llVecNorm = 13, 167 llVecNorm = 13,
168 llVecDist = 14, 168 llVecDist = 14,
169 llRot2Euler = 15, 169 llRot2Euler = 15,
170 llEuler2Rot = 16, 170 llEuler2Rot = 16,
171 llAxes2Rot = 17, 171 llAxes2Rot = 17,
172 llRot2Fwd = 18, 172 llRot2Fwd = 18,
173 llRot2Left = 19, 173 llRot2Left = 19,
174 llRot2Up = 20, 174 llRot2Up = 20,
175 llRotBetween = 21, 175 llRotBetween = 21,
176 llWhisper = 22, 176 llWhisper = 22,
177 llSay = 23, 177 llSay = 23,
178 llShout = 24, 178 llShout = 24,
179 llListen = 25, 179 llListen = 25,
180 llListenControl = 26, 180 llListenControl = 26,
181 llListenRemove = 27, 181 llListenRemove = 27,
182 llSensor = 28, 182 llSensor = 28,
183 llSensorRepeat = 29, 183 llSensorRepeat = 29,
184 llSensorRemove = 30, 184 llSensorRemove = 30,
185 llDetectedName = 31, 185 llDetectedName = 31,
186 llDetectedKey = 32, 186 llDetectedKey = 32,
187 llDetectedOwner = 33, 187 llDetectedOwner = 33,
188 llDetectedType = 34, 188 llDetectedType = 34,
189 llDetectedPos = 35, 189 llDetectedPos = 35,
190 llDetectedVel = 36, 190 llDetectedVel = 36,
191 llDetectedGrab = 37, 191 llDetectedGrab = 37,
192 llDetectedRot = 38, 192 llDetectedRot = 38,
193 llDetectedGroup = 39, 193 llDetectedGroup = 39,
194 llDetectedLinkNumber = 40, 194 llDetectedLinkNumber = 40,
195 llDie = 41, 195 llDie = 41,
196 llGround = 42, 196 llGround = 42,
197 llCloud = 43, 197 llCloud = 43,
198 llWind = 44, 198 llWind = 44,
199 llSetStatus = 45, 199 llSetStatus = 45,
200 llGetStatus = 46, 200 llGetStatus = 46,
201 llSetScale = 47, 201 llSetScale = 47,
202 llGetScale = 48, 202 llGetScale = 48,
203 llSetColor = 49, 203 llSetColor = 49,
204 llGetAlpha = 50, 204 llGetAlpha = 50,
205 llSetAlpha = 51, 205 llSetAlpha = 51,
206 llGetColor = 52, 206 llGetColor = 52,
207 llSetTexture = 53, 207 llSetTexture = 53,
208 llScaleTexture = 54, 208 llScaleTexture = 54,
209 llOffsetTexture = 55, 209 llOffsetTexture = 55,
210 llRotateTexture = 56, 210 llRotateTexture = 56,
211 llGetTexture = 57, 211 llGetTexture = 57,
212 llSetPos = 58, 212 llSetPos = 58,
213 llGetPos = 59, 213 llGetPos = 59,
214 llGetLocalPos = 60, 214 llGetLocalPos = 60,
215 llSetRot = 61, 215 llSetRot = 61,
216 llGetRot = 62, 216 llGetRot = 62,
217 llGetLocalRot = 63, 217 llGetLocalRot = 63,
218 llSetForce = 64, 218 llSetForce = 64,
219 llGetForce = 65, 219 llGetForce = 65,
220 llTarget = 66, 220 llTarget = 66,
221 llTargetRemove = 67, 221 llTargetRemove = 67,
222 llRotTarget = 68, 222 llRotTarget = 68,
223 llRotTargetRemove = 69, 223 llRotTargetRemove = 69,
224 llMoveToTarget = 70, 224 llMoveToTarget = 70,
225 llStopMoveToTarget = 71, 225 llStopMoveToTarget = 71,
226 llApplyImpulse = 72, 226 llApplyImpulse = 72,
227 llApplyRotationalImpulse = 73, 227 llApplyRotationalImpulse = 73,
228 llSetTorque = 74, 228 llSetTorque = 74,
229 llGetTorque = 75, 229 llGetTorque = 75,
230 llSetForceAndTorque = 76, 230 llSetForceAndTorque = 76,
231 llGetVel = 77, 231 llGetVel = 77,
232 llGetAccel = 78, 232 llGetAccel = 78,
233 llGetOmega = 79, 233 llGetOmega = 79,
234 llGetTimeOfDay = 80, 234 llGetTimeOfDay = 80,
235 llGetWallclock = 81, 235 llGetWallclock = 81,
236 llGetTime = 82, 236 llGetTime = 82,
237 llResetTime = 83, 237 llResetTime = 83,
238 llGetAndResetTime = 84, 238 llGetAndResetTime = 84,
239 llSound = 85, 239 llSound = 85,
240 llPlaySound = 86, 240 llPlaySound = 86,
241 llLoopSound = 87, 241 llLoopSound = 87,
242 llLoopSoundMaster = 88, 242 llLoopSoundMaster = 88,
243 llLoopSoundSlave = 89, 243 llLoopSoundSlave = 89,
244 llPlaySoundSlave = 90, 244 llPlaySoundSlave = 90,
245 llTriggerSound = 91, 245 llTriggerSound = 91,
246 llStopSound = 92, 246 llStopSound = 92,
247 llPreloadSound = 93, 247 llPreloadSound = 93,
248 llGetSubString = 94, 248 llGetSubString = 94,
249 llDeleteSubString = 95, 249 llDeleteSubString = 95,
250 llInsertString = 96, 250 llInsertString = 96,
251 llToUpper = 97, 251 llToUpper = 97,
252 llToLower = 98, 252 llToLower = 98,
253 llGiveMoney = 99, 253 llGiveMoney = 99,
254 llMakeExplosion = 100, 254 llMakeExplosion = 100,
255 llMakeFountain = 101, 255 llMakeFountain = 101,
256 llMakeSmoke = 102, 256 llMakeSmoke = 102,
257 llMakeFire = 103, 257 llMakeFire = 103,
258 llRezObject = 104, 258 llRezObject = 104,
259 llLookAt = 105, 259 llLookAt = 105,
260 llStopLookAt = 106, 260 llStopLookAt = 106,
261 llSetTimerEvent = 107, 261 llSetTimerEvent = 107,
262 llSleep = 108, 262 llSleep = 108,
263 llGetMass = 109, 263 llGetMass = 109,
264 llCollisionFilter = 110, 264 llCollisionFilter = 110,
265 llTakeControls = 111, 265 llTakeControls = 111,
266 llReleaseControls = 112, 266 llReleaseControls = 112,
267 llAttachToAvatar = 113, 267 llAttachToAvatar = 113,
268 llDetachFromAvatar = 114, 268 llDetachFromAvatar = 114,
269 llTakeCamera = 115, 269 llTakeCamera = 115,
270 llReleaseCamera = 116, 270 llReleaseCamera = 116,
271 llGetOwner = 117, 271 llGetOwner = 117,
272 llInstantMessage = 118, 272 llInstantMessage = 118,
273 llEmail = 119, 273 llEmail = 119,
274 llGetNextEmail = 120, 274 llGetNextEmail = 120,
275 llGetKey = 121, 275 llGetKey = 121,
276 llSetBuoyancy = 122, 276 llSetBuoyancy = 122,
277 llSetHoverHeight = 123, 277 llSetHoverHeight = 123,
278 llStopHover = 124, 278 llStopHover = 124,
279 llMinEventDelay = 125, 279 llMinEventDelay = 125,
280 llSoundPreload = 126, 280 llSoundPreload = 126,
281 llRotLookAt = 127, 281 llRotLookAt = 127,
282 llStringLength = 128, 282 llStringLength = 128,
283 llStartAnimation = 129, 283 llStartAnimation = 129,
284 llStopAnimation = 130, 284 llStopAnimation = 130,
285 llPointAt = 131, 285 llPointAt = 131,
286 llStopPointAt = 132, 286 llStopPointAt = 132,
287 llTargetOmega = 133, 287 llTargetOmega = 133,
288 llGetStartParameter = 134, 288 llGetStartParameter = 134,
289 llGodLikeRezObject = 135, 289 llGodLikeRezObject = 135,
290 llRequestPermissions = 136, 290 llRequestPermissions = 136,
291 llGetPermissionsKey = 137, 291 llGetPermissionsKey = 137,
292 llGetPermissions = 138, 292 llGetPermissions = 138,
293 llGetLinkNumber = 139, 293 llGetLinkNumber = 139,
294 llSetLinkColor = 140, 294 llSetLinkColor = 140,
295 llCreateLink = 141, 295 llCreateLink = 141,
296 llBreakLink = 142, 296 llBreakLink = 142,
297 llBreakAllLinks = 143, 297 llBreakAllLinks = 143,
298 llGetLinkKey = 144, 298 llGetLinkKey = 144,
299 llGetLinkName = 145, 299 llGetLinkName = 145,
300 llGetInventoryNumber = 146, 300 llGetInventoryNumber = 146,
301 llGetInventoryName = 147, 301 llGetInventoryName = 147,
302 llSetScriptState = 148, 302 llSetScriptState = 148,
303 llGetEnergy = 149, 303 llGetEnergy = 149,
304 llGiveInventory = 150, 304 llGiveInventory = 150,
305 llRemoveInventory = 151, 305 llRemoveInventory = 151,
306 llSetText = 152, 306 llSetText = 152,
307 llWater = 153, 307 llWater = 153,
308 llPassTouches = 154, 308 llPassTouches = 154,
309 llRequestAgentData = 155, 309 llRequestAgentData = 155,
310 llRequestInventoryData = 156, 310 llRequestInventoryData = 156,
311 llSetDamage = 157, 311 llSetDamage = 157,
312 llTeleportAgentHome = 158, 312 llTeleportAgentHome = 158,
313 llModifyLand = 159, 313 llModifyLand = 159,
314 llCollisionSound = 160, 314 llCollisionSound = 160,
315 llCollisionSprite = 161, 315 llCollisionSprite = 161,
316 llGetAnimation = 162, 316 llGetAnimation = 162,
317 llResetScript = 163, 317 llResetScript = 163,
318 llMessageLinked = 164, 318 llMessageLinked = 164,
319 llPushObject = 165, 319 llPushObject = 165,
320 llPassCollisions = 166, 320 llPassCollisions = 166,
321 llGetScriptName = 167, 321 llGetScriptName = 167,
322 llGetNumberOfSides = 168, 322 llGetNumberOfSides = 168,
323 llAxisAngle2Rot = 169, 323 llAxisAngle2Rot = 169,
324 llRot2Axis = 170, 324 llRot2Axis = 170,
325 llRot2Angle = 171, 325 llRot2Angle = 171,
326 llAcos = 172, 326 llAcos = 172,
327 llAsin = 173, 327 llAsin = 173,
328 llAngleBetween = 174, 328 llAngleBetween = 174,
329 llGetInventoryKey = 175, 329 llGetInventoryKey = 175,
330 llAllowInventoryDrop = 176, 330 llAllowInventoryDrop = 176,
331 llGetSunDirection = 177, 331 llGetSunDirection = 177,
332 llGetTextureOffset = 178, 332 llGetTextureOffset = 178,
333 llGetTextureScale = 179, 333 llGetTextureScale = 179,
334 llGetTextureRot = 180, 334 llGetTextureRot = 180,
335 llSubStringIndex = 181, 335 llSubStringIndex = 181,
336 llGetOwnerKey = 182, 336 llGetOwnerKey = 182,
337 llGetCenterOfMass = 183, 337 llGetCenterOfMass = 183,
338 llListSort = 184, 338 llListSort = 184,
339 llGetListLength = 185, 339 llGetListLength = 185,
340 llList2Integer = 186, 340 llList2Integer = 186,
341 llList2Float = 187, 341 llList2Float = 187,
342 llList2String = 188, 342 llList2String = 188,
343 llList2Key = 189, 343 llList2Key = 189,
344 llList2Vector = 190, 344 llList2Vector = 190,
345 llList2Rot = 191, 345 llList2Rot = 191,
346 llList2List = 192, 346 llList2List = 192,
347 llDeleteSubList = 193, 347 llDeleteSubList = 193,
348 llGetListEntryType = 194, 348 llGetListEntryType = 194,
349 llList2CSV = 195, 349 llList2CSV = 195,
350 llCSV2List = 196, 350 llCSV2List = 196,
351 llListRandomize = 197, 351 llListRandomize = 197,
352 llList2ListStrided = 198, 352 llList2ListStrided = 198,
353 llGetRegionCorner = 199, 353 llGetRegionCorner = 199,
354 llListInsertList = 200, 354 llListInsertList = 200,
355 llListFindList = 201, 355 llListFindList = 201,
356 llGetObjectName = 202, 356 llGetObjectName = 202,
357 llSetObjectName = 203, 357 llSetObjectName = 203,
358 llGetDate = 204, 358 llGetDate = 204,
359 llEdgeOfWorld = 205, 359 llEdgeOfWorld = 205,
360 llGetAgentInfo = 206, 360 llGetAgentInfo = 206,
361 llAdjustSoundVolume = 207, 361 llAdjustSoundVolume = 207,
362 llSetSoundQueueing = 208, 362 llSetSoundQueueing = 208,
363 llSetSoundRadius = 209, 363 llSetSoundRadius = 209,
364 llKey2Name = 210, 364 llKey2Name = 210,
365 llSetTextureAnim = 211, 365 llSetTextureAnim = 211,
366 llTriggerSoundLimited = 212, 366 llTriggerSoundLimited = 212,
367 llEjectFromLand = 213, 367 llEjectFromLand = 213,
368 llParseString2List = 214, 368 llParseString2List = 214,
369 llOverMyLand = 215, 369 llOverMyLand = 215,
370 llGetLandOwnerAt = 216, 370 llGetLandOwnerAt = 216,
371 llGetNotecardLine = 217, 371 llGetNotecardLine = 217,
372 llGetAgentSize = 218, 372 llGetAgentSize = 218,
373 llSameGroup = 219, 373 llSameGroup = 219,
374 llUnSit = 220, 374 llUnSit = 220,
375 llGroundSlope = 221, 375 llGroundSlope = 221,
376 llGroundNormal = 222, 376 llGroundNormal = 222,
377 llGroundContour = 223, 377 llGroundContour = 223,
378 llGetAttached = 224, 378 llGetAttached = 224,
379 llGetFreeMemory = 225, 379 llGetFreeMemory = 225,
380 llGetRegionName = 226, 380 llGetRegionName = 226,
381 llGetRegionTimeDilation = 227, 381 llGetRegionTimeDilation = 227,
382 llGetRegionFPS = 228, 382 llGetRegionFPS = 228,
383 llParticleSystem = 229, 383 llParticleSystem = 229,
384 llGroundRepel = 230, 384 llGroundRepel = 230,
385 llGiveInventoryList = 231, 385 llGiveInventoryList = 231,
386 llSetVehicleType = 232, 386 llSetVehicleType = 232,
387 llSetVehicleFloatParam = 233, 387 llSetVehicleFloatParam = 233,
388 llSetVehicleVectorParam = 234, 388 llSetVehicleVectorParam = 234,
389 llSetVehicleRotationParam = 235, 389 llSetVehicleRotationParam = 235,
390 llSetVehicleFlags = 236, 390 llSetVehicleFlags = 236,
391 llRemoveVehicleFlags = 237, 391 llRemoveVehicleFlags = 237,
392 llSitTarget = 238, 392 llSitTarget = 238,
393 llAvatarOnSitTarget = 239, 393 llAvatarOnSitTarget = 239,
394 llAddToLandPassList = 240, 394 llAddToLandPassList = 240,
395 llSetTouchText = 241, 395 llSetTouchText = 241,
396 llSetSitText = 242, 396 llSetSitText = 242,
397 llSetCameraEyeOffset = 243, 397 llSetCameraEyeOffset = 243,
398 llSetCameraAtOffset = 244, 398 llSetCameraAtOffset = 244,
399 llDumpList2String = 245, 399 llDumpList2String = 245,
400 llScriptDanger = 246, 400 llScriptDanger = 246,
401 llDialog = 247, 401 llDialog = 247,
402 llVolumeDetect = 248, 402 llVolumeDetect = 248,
403 llResetOtherScript = 249, 403 llResetOtherScript = 249,
404 llGetScriptState = 250, 404 llGetScriptState = 250,
405 llRemoteLoadScript = 251, 405 llRemoteLoadScript = 251,
406 llSetRemoteScriptAccessPin = 252, 406 llSetRemoteScriptAccessPin = 252,
407 llRemoteLoadScriptPin = 253, 407 llRemoteLoadScriptPin = 253,
408 llOpenRemoteDataChannel = 254, 408 llOpenRemoteDataChannel = 254,
409 llSendRemoteData = 255, 409 llSendRemoteData = 255,
410 llRemoteDataReply = 256, 410 llRemoteDataReply = 256,
411 llCloseRemoteDataChannel = 257, 411 llCloseRemoteDataChannel = 257,
412 llMD5String = 258, 412 llMD5String = 258,
413 llSetPrimitiveParams = 259, 413 llSetPrimitiveParams = 259,
414 llStringToBase64 = 260, 414 llStringToBase64 = 260,
415 llBase64ToString = 261, 415 llBase64ToString = 261,
416 llXorBase64Strings = 262, 416 llXorBase64Strings = 262,
417 llRemoteDataSetRegion = 263, 417 llRemoteDataSetRegion = 263,
418 llLog10 = 264, 418 llLog10 = 264,
419 llLog = 265, 419 llLog = 265,
420 llGetAnimationList = 266, 420 llGetAnimationList = 266,
421 llSetParcelMusicURL = 267, 421 llSetParcelMusicURL = 267,
422 llGetRootPosition = 268, 422 llGetRootPosition = 268,
423 llGetRootRotation = 269, 423 llGetRootRotation = 269,
424 llGetObjectDesc = 270, 424 llGetObjectDesc = 270,
425 llSetObjectDesc = 271, 425 llSetObjectDesc = 271,
426 llGetCreator = 272, 426 llGetCreator = 272,
427 llGetTimestamp = 273, 427 llGetTimestamp = 273,
428 llSetLinkAlpha = 274, 428 llSetLinkAlpha = 274,
429 llGetNumberOfPrims = 275, 429 llGetNumberOfPrims = 275,
430 llGetNumberOfNotecardLines = 276, 430 llGetNumberOfNotecardLines = 276,
431 llGetBoundingBox = 277, 431 llGetBoundingBox = 277,
432 llGetGeometricCenter = 278, 432 llGetGeometricCenter = 278,
433 llGetPrimitiveParams = 279, 433 llGetPrimitiveParams = 279,
434 llIntegerToBase64 = 280, 434 llIntegerToBase64 = 280,
435 llBase64ToInteger = 281, 435 llBase64ToInteger = 281,
436 llGetGMTclock = 282, 436 llGetGMTclock = 282,
437 llGetSimulatorHostname = 283, 437 llGetSimulatorHostname = 283,
438 llSetLocalRot = 284, 438 llSetLocalRot = 284,
439 llParseStringKeepNulls = 285, 439 llParseStringKeepNulls = 285,
440 llRezAtRoot = 286, 440 llRezAtRoot = 286,
441 llGetObjectPermMask = 287, 441 llGetObjectPermMask = 287,
442 llSetObjectPermMask = 288, 442 llSetObjectPermMask = 288,
443 llGetInventoryPermMask = 289, 443 llGetInventoryPermMask = 289,
444 llSetInventoryPermMask = 290, 444 llSetInventoryPermMask = 290,
445 llGetInventoryCreator = 291, 445 llGetInventoryCreator = 291,
446 llOwnerSay = 292, 446 llOwnerSay = 292,
447 llRequestSimulatorData = 293, 447 llRequestSimulatorData = 293,
448 llForceMouselook = 294, 448 llForceMouselook = 294,
449 llGetObjectMass = 295, 449 llGetObjectMass = 295,
450 llListReplaceList = 296, 450 llListReplaceList = 296,
451 llLoadURL = 297, 451 llLoadURL = 297,
452 llParcelMediaCommandList = 298, 452 llParcelMediaCommandList = 298,
453 llParcelMediaQuery = 299, 453 llParcelMediaQuery = 299,
454 llModPow = 300, 454 llModPow = 300,
455 llGetInventoryType = 301, 455 llGetInventoryType = 301,
456 llSetPayPrice = 302, 456 llSetPayPrice = 302,
457 llGetCameraPos = 303, 457 llGetCameraPos = 303,
458 llGetCameraRot = 304, 458 llGetCameraRot = 304,
459 llSetPrimURL = 305, 459 llSetPrimURL = 305,
460 llRefreshPrimURL = 306, 460 llRefreshPrimURL = 306,
461 llEscapeURL = 307, 461 llEscapeURL = 307,
462 llUnescapeURL = 308, 462 llUnescapeURL = 308,
463 llMapDestination = 309, 463 llMapDestination = 309,
464 llAddToLandBanList = 310, 464 llAddToLandBanList = 310,
465 llRemoveFromLandPassList = 311, 465 llRemoveFromLandPassList = 311,
466 llRemoveFromLandBanList = 312, 466 llRemoveFromLandBanList = 312,
467 llSetCameraParams = 313, 467 llSetCameraParams = 313,
468 llClearCameraParams = 314, 468 llClearCameraParams = 314,
469 llListStatistics = 315, 469 llListStatistics = 315,
470 llGetUnixTime = 316, 470 llGetUnixTime = 316,
471 llGetParcelFlags = 317, 471 llGetParcelFlags = 317,
472 llGetRegionFlags = 318, 472 llGetRegionFlags = 318,
473 llXorBase64StringsCorrect = 319, 473 llXorBase64StringsCorrect = 319,
474 llHTTPRequest = 320, 474 llHTTPRequest = 320,
475 llResetLandBanList = 321, 475 llResetLandBanList = 321,
476 llResetLandPassList = 322, 476 llResetLandPassList = 322,
477 llGetParcelPrimCount = 323, 477 llGetParcelPrimCount = 323,
478 llGetParcelPrimOwners = 324, 478 llGetParcelPrimOwners = 324,
479 llGetObjectPrimCount = 325, 479 llGetObjectPrimCount = 325,
480 llGetParcelMaxPrims = 326, 480 llGetParcelMaxPrims = 326,
481 llGetParcelDetails = 327 481 llGetParcelDetails = 327
482 } 482 }
483 483
484 } 484 }
485} 485}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs
index 2da1189..ebe4465 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs
@@ -1,608 +1,608 @@
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Text; 3 using System.Text;
4 using System.IO; 4 using System.IO;
5 using System.Reflection; 5 using System.Reflection;
6 using System.Reflection.Emit; 6 using System.Reflection.Emit;
7using OpenSim.Region.Scripting; 7using OpenSim.Region.Scripting;
8 8
9 namespace OpenSim.ScriptEngines.LSL 9 namespace OpenSim.ScriptEngines.LSL
10 { 10 {
11 class LSO_Parser 11 class LSO_Parser
12 { 12 {
13 private bool Debug = true; 13 private bool Debug = true;
14 private FileStream fs; 14 private FileStream fs;
15 private BinaryReader br; 15 private BinaryReader br;
16 private LSO_Struct.Header myHeader; 16 private LSO_Struct.Header myHeader;
17 17
18 private TypeBuilder typeBuilder; 18 private TypeBuilder typeBuilder;
19 private ScriptInfo WorldAPI; 19 private ScriptInfo WorldAPI;
20 20
21 /// <summary> 21 /// <summary>
22 /// Parse LSO file. 22 /// Parse LSO file.
23 /// Reads LSO ByteCode into memory structures. 23 /// Reads LSO ByteCode into memory structures.
24 /// TODO: What else does it do? 24 /// TODO: What else does it do?
25 /// </summary> 25 /// </summary>
26 /// <param name="FileName">FileName of LSO ByteCode file</param> 26 /// <param name="FileName">FileName of LSO ByteCode file</param>
27 public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder) 27 public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder)
28 { 28 {
29 typeBuilder = _typeBuilder; 29 typeBuilder = _typeBuilder;
30 WorldAPI = _WorldAPI; 30 WorldAPI = _WorldAPI;
31 // Open 31 // Open
32 SendToDebug("Opening filename: " + FileName); 32 SendToDebug("Opening filename: " + FileName);
33 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); 33 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
34 br = new BinaryReader(fs, Encoding.BigEndianUnicode); 34 br = new BinaryReader(fs, Encoding.BigEndianUnicode);
35 35
36 36
37 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. 37 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
38 38
39 39
40 // HEADER BLOCK 40 // HEADER BLOCK
41 SendToDebug("Reading HEADER BLOCK at: 0"); 41 SendToDebug("Reading HEADER BLOCK at: 0");
42 fs.Seek(0, SeekOrigin.Begin); 42 fs.Seek(0, SeekOrigin.Begin);
43 myHeader = new LSO_Struct.Header(); 43 myHeader = new LSO_Struct.Header();
44 myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); 44 myHeader.TM = BitConverter.ToUInt32(br_read(4), 0);
45 myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); 45 myHeader.IP = BitConverter.ToUInt32(br_read(4), 0);
46 myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); 46 myHeader.VN = BitConverter.ToUInt32(br_read(4), 0);
47 myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); 47 myHeader.BP = BitConverter.ToUInt32(br_read(4), 0);
48 myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); 48 myHeader.SP = BitConverter.ToUInt32(br_read(4), 0);
49 myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); 49 myHeader.HR = BitConverter.ToUInt32(br_read(4), 0);
50 myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); 50 myHeader.HP = BitConverter.ToUInt32(br_read(4), 0);
51 myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); 51 myHeader.CS = BitConverter.ToUInt32(br_read(4), 0);
52 myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); 52 myHeader.NS = BitConverter.ToUInt32(br_read(4), 0);
53 myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); 53 myHeader.CE = BitConverter.ToUInt32(br_read(4), 0);
54 myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); 54 myHeader.IE = BitConverter.ToUInt32(br_read(4), 0);
55 myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); 55 myHeader.ER = BitConverter.ToUInt32(br_read(4), 0);
56 myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); 56 myHeader.FR = BitConverter.ToUInt32(br_read(4), 0);
57 myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); 57 myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0);
58 myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); 58 myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0);
59 myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); 59 myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0);
60 myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); 60 myHeader.PR = BitConverter.ToUInt32(br_read(4), 0);
61 myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); 61 myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0);
62 myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); 62 myHeader.SR = BitConverter.ToUInt32(br_read(4), 0);
63 myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); 63 myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0);
64 myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); 64 myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0);
65 myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); 65 myHeader.NER = BitConverter.ToUInt64(br_read(8), 0);
66 66
67 // Print Header Block to debug 67 // Print Header Block to debug
68 SendToDebug("TM - Top of memory (size): " + myHeader.TM); 68 SendToDebug("TM - Top of memory (size): " + myHeader.TM);
69 SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); 69 SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP);
70 SendToDebug("VN - Version number: " + myHeader.VN); 70 SendToDebug("VN - Version number: " + myHeader.VN);
71 SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); 71 SendToDebug("BP - Local Frame Pointer: " + myHeader.BP);
72 SendToDebug("SP - Stack Pointer: " + myHeader.SP); 72 SendToDebug("SP - Stack Pointer: " + myHeader.SP);
73 SendToDebug("HR - Heap Register: " + myHeader.HR); 73 SendToDebug("HR - Heap Register: " + myHeader.HR);
74 SendToDebug("HP - Heap Pointer: " + myHeader.HP); 74 SendToDebug("HP - Heap Pointer: " + myHeader.HP);
75 SendToDebug("CS - Current State: " + myHeader.CS); 75 SendToDebug("CS - Current State: " + myHeader.CS);
76 SendToDebug("NS - Next State: " + myHeader.NS); 76 SendToDebug("NS - Next State: " + myHeader.NS);
77 SendToDebug("CE - Current Events: " + myHeader.CE); 77 SendToDebug("CE - Current Events: " + myHeader.CE);
78 SendToDebug("IE - In Event: " + myHeader.IE); 78 SendToDebug("IE - In Event: " + myHeader.IE);
79 SendToDebug("ER - Event Register: " + myHeader.ER); 79 SendToDebug("ER - Event Register: " + myHeader.ER);
80 SendToDebug("FR - Fault Register: " + myHeader.FR); 80 SendToDebug("FR - Fault Register: " + myHeader.FR);
81 SendToDebug("SLR - Sleep Register: " + myHeader.SLR); 81 SendToDebug("SLR - Sleep Register: " + myHeader.SLR);
82 SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); 82 SendToDebug("GVR - Global Variable Register: " + myHeader.GVR);
83 SendToDebug("GFR - Global Function Register: " + myHeader.GFR); 83 SendToDebug("GFR - Global Function Register: " + myHeader.GFR);
84 SendToDebug("PR - Parameter Register: " + myHeader.PR); 84 SendToDebug("PR - Parameter Register: " + myHeader.PR);
85 SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); 85 SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR);
86 SendToDebug("SR - State Register: " + myHeader.SR); 86 SendToDebug("SR - State Register: " + myHeader.SR);
87 SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); 87 SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE);
88 SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); 88 SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE);
89 SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); 89 SendToDebug("NER - 64-bit Event Register: " + myHeader.NER);
90 SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); 90 SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position);
91 91
92 // STATIC BLOCK 92 // STATIC BLOCK
93 SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); 93 SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR);
94 fs.Seek(myHeader.GVR, SeekOrigin.Begin); 94 fs.Seek(myHeader.GVR, SeekOrigin.Begin);
95 int StaticBlockCount = 0; 95 int StaticBlockCount = 0;
96 // Read function blocks until we hit GFR 96 // Read function blocks until we hit GFR
97 while (fs.Position < myHeader.GFR) 97 while (fs.Position < myHeader.GFR)
98 { 98 {
99 StaticBlockCount++; 99 StaticBlockCount++;
100 SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); 100 SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position);
101 //fs.Seek(myHeader.GVR, SeekOrigin.Begin); 101 //fs.Seek(myHeader.GVR, SeekOrigin.Begin);
102 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); 102 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
103 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); 103 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
104 myStaticBlock.ObjectType = br_read(1)[0]; 104 myStaticBlock.ObjectType = br_read(1)[0];
105 SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); 105 SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString());
106 myStaticBlock.Unknown = br_read(1)[0]; 106 myStaticBlock.Unknown = br_read(1)[0];
107 // Size of datatype varies 107 // Size of datatype varies
108 if (myStaticBlock.ObjectType != 0) 108 if (myStaticBlock.ObjectType != 0)
109 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); 109 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
110 } 110 }
111 SendToDebug("Number of Static Blocks read: " + StaticBlockCount); 111 SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
112 112
113 113
114 // FUNCTION BLOCK 114 // FUNCTION BLOCK
115 // Always right after STATIC BLOCK 115 // Always right after STATIC BLOCK
116 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); 116 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock();
117 if (myHeader.GFR == myHeader.SR) 117 if (myHeader.GFR == myHeader.SR)
118 { 118 {
119 // If GFR and SR are at same position then there is no fuction block 119 // If GFR and SR are at same position then there is no fuction block
120 SendToDebug("No FUNCTION BLOCK found"); 120 SendToDebug("No FUNCTION BLOCK found");
121 } else { 121 } else {
122 SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); 122 SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR);
123 fs.Seek(myHeader.GFR, SeekOrigin.Begin); 123 fs.Seek(myHeader.GFR, SeekOrigin.Begin);
124 myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); 124 myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0);
125 SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); 125 SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount);
126 if (myFunctionBlock.FunctionCount > 0) 126 if (myFunctionBlock.FunctionCount > 0)
127 { 127 {
128 myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; 128 myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount];
129 for (int i = 0; i < myFunctionBlock.FunctionCount; i++) 129 for (int i = 0; i < myFunctionBlock.FunctionCount; i++)
130 { 130 {
131 SendToDebug("Reading function " + i + " at: " + fs.Position); 131 SendToDebug("Reading function " + i + " at: " + fs.Position);
132 // TODO: ADD TO FUNCTION LIST (How do we identify it later?) 132 // TODO: ADD TO FUNCTION LIST (How do we identify it later?)
133 // Note! Absolute position 133 // Note! Absolute position
134 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; 134 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR;
135 SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); 135 SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]);
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 140
141 // STATE FRAME BLOCK 141 // STATE FRAME BLOCK
142 // Always right after FUNCTION BLOCK 142 // Always right after FUNCTION BLOCK
143 SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); 143 SendToDebug("Reading STATE BLOCK at: " + myHeader.SR);
144 fs.Seek(myHeader.SR, SeekOrigin.Begin); 144 fs.Seek(myHeader.SR, SeekOrigin.Begin);
145 LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); 145 LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock();
146 myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); 146 myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0);
147 if (myStateFrameBlock.StateCount > 0) 147 if (myStateFrameBlock.StateCount > 0)
148 { 148 {
149 // Initialize array 149 // Initialize array
150 myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; 150 myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount];
151 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 151 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
152 { 152 {
153 SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position); 153 SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position);
154 // Position is relative to state frame 154 // Position is relative to state frame
155 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); 155 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
156 myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); 156 myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8));
157 SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); 157 SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location);
158 SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); 158 SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count);
159 159
160 //// Read STATE BLOCK 160 //// Read STATE BLOCK
161 //long CurPos = fs.Position; 161 //long CurPos = fs.Position;
162 //fs.Seek(CurPos, SeekOrigin.Begin); 162 //fs.Seek(CurPos, SeekOrigin.Begin);
163 163
164 } 164 }
165 } 165 }
166 166
167 167
168 // STATE BLOCK 168 // STATE BLOCK
169 // For each StateFrameBlock there is one StateBlock with multiple event handlers 169 // For each StateFrameBlock there is one StateBlock with multiple event handlers
170 170
171 if (myStateFrameBlock.StateCount > 0) 171 if (myStateFrameBlock.StateCount > 0)
172 { 172 {
173 // Go through all State Frame Pointers found 173 // Go through all State Frame Pointers found
174 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 174 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
175 { 175 {
176 176
177 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); 177 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin);
178 SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); 178 SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position);
179 179
180 // READ: STATE BLOCK HEADER 180 // READ: STATE BLOCK HEADER
181 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); 181 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock();
182 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note 182 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note
183 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); 183 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0);
184 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; 184 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0];
185 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note 185 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note
186 SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); 186 SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos);
187 SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); 187 SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
188 SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); 188 SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
189 189
190 // We need to count number of bits flagged in EventMask? 190 // We need to count number of bits flagged in EventMask?
191 191
192 192
193 // for each bit in myStateFrameBlock.StatePointer[i].EventMask 193 // for each bit in myStateFrameBlock.StatePointer[i].EventMask
194 194
195 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE 195 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
196 //TODO: Create event hooks 196 //TODO: Create event hooks
197 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; 197 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
198 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 198 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
199 { 199 {
200 200
201 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) 201 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true)
202 { 202 {
203 // We got an event 203 // We got an event
204 // READ: STATE BLOCK HANDLER 204 // READ: STATE BLOCK HANDLER
205 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); 205 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position);
206 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); 206 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0);
207 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); 207 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0);
208 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); 208 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer);
209 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize ); 209 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize );
210 } 210 }
211 } 211 }
212 } 212 }
213 } 213 }
214 214
215 215
216 216
217 217
218 //// READ FUNCTION CODE CHUNKS 218 //// READ FUNCTION CODE CHUNKS
219 //// Functions + Function start pos (GFR) 219 //// Functions + Function start pos (GFR)
220 //// TODO: Somehow be able to identify and reference this 220 //// TODO: Somehow be able to identify and reference this
221 //LSO_Struct.CodeChunk[] myFunctionCodeChunk; 221 //LSO_Struct.CodeChunk[] myFunctionCodeChunk;
222 //if (myFunctionBlock.FunctionCount > 0) 222 //if (myFunctionBlock.FunctionCount > 0)
223 //{ 223 //{
224 // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; 224 // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount];
225 // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) 225 // for (int i = 0; i < myFunctionBlock.FunctionCount; i++)
226 // { 226 // {
227 // SendToDebug("Reading Function Code Chunk " + i); 227 // SendToDebug("Reading Function Code Chunk " + i);
228 // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); 228 // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]);
229 // } 229 // }
230 230
231 //} 231 //}
232 // READ EVENT CODE CHUNKS 232 // READ EVENT CODE CHUNKS
233 LSO_Struct.CodeChunk[] myEventCodeChunk; 233 LSO_Struct.CodeChunk[] myEventCodeChunk;
234 if (myStateFrameBlock.StateCount > 0) 234 if (myStateFrameBlock.StateCount > 0)
235 { 235 {
236 myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; 236 myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount];
237 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 237 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
238 { 238 {
239 // TODO: Somehow organize events and functions so they can be found again, 239 // TODO: Somehow organize events and functions so they can be found again,
240 // two level search ain't no good 240 // two level search ain't no good
241 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 241 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
242 { 242 {
243 243
244 244
245 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) 245 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0)
246 { 246 {
247 SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); 247 SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii);
248 248
249 249
250 // Override a Method / Function 250 // Override a Method / Function
251 string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii; 251 string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii;
252 SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); 252 SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod...");
253 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 253 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
254 MethodAttributes.Private | MethodAttributes.Virtual, 254 MethodAttributes.Private | MethodAttributes.Virtual,
255 typeof(void), 255 typeof(void),
256 new Type[] { typeof(object) }); 256 new Type[] { typeof(object) });
257 257
258 SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); 258 SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder...");
259 typeBuilder.DefineMethodOverride(methodBuilder, 259 typeBuilder.DefineMethodOverride(methodBuilder,
260 typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); 260 typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
261 261
262 // Create the IL generator 262 // Create the IL generator
263 263
264 SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); 264 SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();");
265 ILGenerator il = methodBuilder.GetILGenerator(); 265 ILGenerator il = methodBuilder.GetILGenerator();
266 266
267 267
268 LSO_Struct.CodeChunk myECC = 268 LSO_Struct.CodeChunk myECC =
269 GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname); 269 GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname);
270 } 270 }
271 271
272 } 272 }
273 } 273 }
274 274
275 } 275 }
276 276
277 277
278 // Close 278 // Close
279 br.Close(); 279 br.Close();
280 fs.Close(); 280 fs.Close();
281 281
282 } 282 }
283 283
284 private LSO_Struct.HeapBlock GetHeap(UInt32 pos) 284 private LSO_Struct.HeapBlock GetHeap(UInt32 pos)
285 { 285 {
286 // HEAP BLOCK 286 // HEAP BLOCK
287 // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) 287 // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries)
288 SendToDebug("Reading HEAP BLOCK at: " + pos); 288 SendToDebug("Reading HEAP BLOCK at: " + pos);
289 fs.Seek(pos, SeekOrigin.Begin); 289 fs.Seek(pos, SeekOrigin.Begin);
290 290
291 LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); 291 LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock();
292 myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0); 292 myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0);
293 myHeapBlock.ObjectType = br_read(1)[0]; 293 myHeapBlock.ObjectType = br_read(1)[0];
294 myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); 294 myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0);
295 myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); 295 myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType));
296 296
297 SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); 297 SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize);
298 SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); 298 SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString());
299 SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); 299 SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount);
300 300
301 return myHeapBlock; 301 return myHeapBlock;
302 } 302 }
303 303
304 304
305 305
306 private byte[] br_read(int len) 306 private byte[] br_read(int len)
307 { 307 {
308 if (len <= 0) 308 if (len <= 0)
309 return null; 309 return null;
310 310
311 try 311 try
312 { 312 {
313 byte[] bytes = new byte[len]; 313 byte[] bytes = new byte[len];
314 for (int i = len - 1; i > -1; i--) 314 for (int i = len - 1; i > -1; i--)
315 bytes[i] = br.ReadByte(); 315 bytes[i] = br.ReadByte();
316 return bytes; 316 return bytes;
317 } 317 }
318 catch (Exception e) 318 catch (Exception e)
319 { 319 {
320 SendToDebug("Exception: " + e.ToString()); 320 SendToDebug("Exception: " + e.ToString());
321 throw (e); 321 throw (e);
322 } 322 }
323 } 323 }
324 //private byte[] br_read_smallendian(int len) 324 //private byte[] br_read_smallendian(int len)
325 //{ 325 //{
326 // byte[] bytes = new byte[len]; 326 // byte[] bytes = new byte[len];
327 // br.Read(bytes,0, len); 327 // br.Read(bytes,0, len);
328 // return bytes; 328 // return bytes;
329 //} 329 //}
330 330
331 private int getObjectSize(byte ObjectType) 331 private int getObjectSize(byte ObjectType)
332 { 332 {
333 switch (ObjectType) 333 switch (ObjectType)
334 { 334 {
335 case 1: 335 case 1:
336 case 2: 336 case 2:
337 case 3: 337 case 3:
338 case 4: 338 case 4:
339 case 7: 339 case 7:
340 return 4; 340 return 4;
341 case 5: 341 case 5:
342 return 12; 342 return 12;
343 case 6: 343 case 6:
344 return 16; 344 return 16;
345 default: 345 default:
346 return 0; 346 return 0;
347 } 347 }
348 } 348 }
349 private void SendToDebug(string Message) 349 private void SendToDebug(string Message)
350 { 350 {
351 if (Debug == true) 351 if (Debug == true)
352 Console.WriteLine("Debug: " + Message); 352 Console.WriteLine("Debug: " + Message);
353 } 353 }
354 354
355 355
356 private string Read_String() 356 private string Read_String()
357 { 357 {
358 string ret = ""; 358 string ret = "";
359 byte reader = br_read(1)[0]; 359 byte reader = br_read(1)[0];
360 while (reader != 0x000) 360 while (reader != 0x000)
361 { 361 {
362 ret += (char)reader; 362 ret += (char)reader;
363 reader = br_read(1)[0]; 363 reader = br_read(1)[0];
364 } 364 }
365 return ret; 365 return ret;
366 } 366 }
367 367
368 /// <summary> 368 /// <summary>
369 /// Reads a code chunk into structure and returns it. 369 /// Reads a code chunk into structure and returns it.
370 /// </summary> 370 /// </summary>
371 /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> 371 /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param>
372 /// <returns></returns> 372 /// <returns></returns>
373 private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname) 373 private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname)
374 { 374 {
375 375
376 /* 376 /*
377 * CLR TRY 377 * CLR TRY
378 */ 378 */
379 //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); 379 //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()");
380 il.BeginExceptionBlock(); 380 il.BeginExceptionBlock();
381 381
382 // Push "Hello World!" string to stack 382 // Push "Hello World!" string to stack
383 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 383 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
384 il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); 384 il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname);
385 385
386 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 386 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
387 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 387 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
388 il.Emit(OpCodes.Call, typeof(Console).GetMethod 388 il.Emit(OpCodes.Call, typeof(Console).GetMethod
389 ("WriteLine", new Type[] { typeof(string) })); 389 ("WriteLine", new Type[] { typeof(string) }));
390 390
391 391
392 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); 392 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk();
393 393
394 SendToDebug("Reading Function Code Chunk at: " + pos); 394 SendToDebug("Reading Function Code Chunk at: " + pos);
395 fs.Seek(pos, SeekOrigin.Begin); 395 fs.Seek(pos, SeekOrigin.Begin);
396 myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); 396 myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0);
397 SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize ); 397 SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize );
398 // Read until null 398 // Read until null
399 myCodeChunk.Comment = Read_String(); 399 myCodeChunk.Comment = Read_String();
400 SendToDebug("Function comment: " + myCodeChunk.Comment); 400 SendToDebug("Function comment: " + myCodeChunk.Comment);
401 myCodeChunk.ReturnType = br_read(1)[0]; 401 myCodeChunk.ReturnType = br_read(1)[0];
402 SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType); 402 SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType);
403 // TODO: How to determine number of codechunks -- does this method work? 403 // TODO: How to determine number of codechunks -- does this method work?
404 myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); 404 myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>();
405 byte reader = br_read(1)[0]; 405 byte reader = br_read(1)[0];
406 reader = br_read(1)[0]; 406 reader = br_read(1)[0];
407 int ccount = 0; 407 int ccount = 0;
408 while (reader != 0x000) 408 while (reader != 0x000)
409 { 409 {
410 ccount++; 410 ccount++;
411 SendToDebug("Reading Code Chunk Argument " + ccount); 411 SendToDebug("Reading Code Chunk Argument " + ccount);
412 LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); 412 LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument();
413 CCA.FunctionReturnType = reader; 413 CCA.FunctionReturnType = reader;
414 reader = br_read(1)[0]; 414 reader = br_read(1)[0];
415 CCA.NullString = reader; 415 CCA.NullString = reader;
416 myCodeChunk.CodeChunkArguments.Add(CCA); 416 myCodeChunk.CodeChunkArguments.Add(CCA);
417 SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); 417 SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType);
418 } 418 }
419 // End marker is 0x000 419 // End marker is 0x000
420 myCodeChunk.EndMarker = reader; 420 myCodeChunk.EndMarker = reader;
421 // TODO: How to read and identify following code 421 // TODO: How to read and identify following code
422 // TODO: Code is read until a return of some sort is found 422 // TODO: Code is read until a return of some sort is found
423 bool FoundRet = false; 423 bool FoundRet = false;
424 while (FoundRet == false) 424 while (FoundRet == false)
425 { 425 {
426 //reader = br_read(1)[0]; 426 //reader = br_read(1)[0];
427 //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0); 427 //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0);
428 UInt16 opcode = br_read(1)[0]; 428 UInt16 opcode = br_read(1)[0];
429 //long rPos = fs.Position; 429 //long rPos = fs.Position;
430 SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); 430 SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString());
431 switch (opcode) 431 switch (opcode)
432 { 432 {
433 // LONG 433 // LONG
434 case (UInt16)LSO_Enums.Operation_Table.POPARG: 434 case (UInt16)LSO_Enums.Operation_Table.POPARG:
435 case (UInt16)LSO_Enums.Operation_Table.STORE: 435 case (UInt16)LSO_Enums.Operation_Table.STORE:
436 case (UInt16)LSO_Enums.Operation_Table.STORES: 436 case (UInt16)LSO_Enums.Operation_Table.STORES:
437 case (UInt16)LSO_Enums.Operation_Table.STOREL: 437 case (UInt16)LSO_Enums.Operation_Table.STOREL:
438 case (UInt16)LSO_Enums.Operation_Table.STOREV: 438 case (UInt16)LSO_Enums.Operation_Table.STOREV:
439 case (UInt16)LSO_Enums.Operation_Table.STOREQ: 439 case (UInt16)LSO_Enums.Operation_Table.STOREQ:
440 case (UInt16)LSO_Enums.Operation_Table.STOREG: 440 case (UInt16)LSO_Enums.Operation_Table.STOREG:
441 case (UInt16)LSO_Enums.Operation_Table.STOREGS: 441 case (UInt16)LSO_Enums.Operation_Table.STOREGS:
442 case (UInt16)LSO_Enums.Operation_Table.STOREGL: 442 case (UInt16)LSO_Enums.Operation_Table.STOREGL:
443 case (UInt16)LSO_Enums.Operation_Table.STOREGV: 443 case (UInt16)LSO_Enums.Operation_Table.STOREGV:
444 case (UInt16)LSO_Enums.Operation_Table.STOREGQ: 444 case (UInt16)LSO_Enums.Operation_Table.STOREGQ:
445 case (UInt16)LSO_Enums.Operation_Table.LOADP: 445 case (UInt16)LSO_Enums.Operation_Table.LOADP:
446 case (UInt16)LSO_Enums.Operation_Table.LOADSP: 446 case (UInt16)LSO_Enums.Operation_Table.LOADSP:
447 case (UInt16)LSO_Enums.Operation_Table.LOADLP: 447 case (UInt16)LSO_Enums.Operation_Table.LOADLP:
448 case (UInt16)LSO_Enums.Operation_Table.LOADVP: 448 case (UInt16)LSO_Enums.Operation_Table.LOADVP:
449 case (UInt16)LSO_Enums.Operation_Table.LOADQP: 449 case (UInt16)LSO_Enums.Operation_Table.LOADQP:
450 case (UInt16)LSO_Enums.Operation_Table.PUSH: 450 case (UInt16)LSO_Enums.Operation_Table.PUSH:
451 case (UInt16)LSO_Enums.Operation_Table.PUSHS: 451 case (UInt16)LSO_Enums.Operation_Table.PUSHS:
452 case (UInt16)LSO_Enums.Operation_Table.PUSHL: 452 case (UInt16)LSO_Enums.Operation_Table.PUSHL:
453 case (UInt16)LSO_Enums.Operation_Table.PUSHV: 453 case (UInt16)LSO_Enums.Operation_Table.PUSHV:
454 case (UInt16)LSO_Enums.Operation_Table.PUSHQ: 454 case (UInt16)LSO_Enums.Operation_Table.PUSHQ:
455 case (UInt16)LSO_Enums.Operation_Table.PUSHG: 455 case (UInt16)LSO_Enums.Operation_Table.PUSHG:
456 case (UInt16)LSO_Enums.Operation_Table.PUSHGS: 456 case (UInt16)LSO_Enums.Operation_Table.PUSHGS:
457 case (UInt16)LSO_Enums.Operation_Table.PUSHGL: 457 case (UInt16)LSO_Enums.Operation_Table.PUSHGL:
458 case (UInt16)LSO_Enums.Operation_Table.PUSHGV: 458 case (UInt16)LSO_Enums.Operation_Table.PUSHGV:
459 case (UInt16)LSO_Enums.Operation_Table.PUSHGQ: 459 case (UInt16)LSO_Enums.Operation_Table.PUSHGQ:
460 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 460 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
461 break; 461 break;
462 // BYTE 462 // BYTE
463 case (UInt16)LSO_Enums.Operation_Table.PUSHARGB: 463 case (UInt16)LSO_Enums.Operation_Table.PUSHARGB:
464 SendToDebug("Param1: " + br_read(1)[0]); 464 SendToDebug("Param1: " + br_read(1)[0]);
465 break; 465 break;
466 // INTEGER 466 // INTEGER
467 case (UInt16)LSO_Enums.Operation_Table.PUSHARGI: 467 case (UInt16)LSO_Enums.Operation_Table.PUSHARGI:
468 // TODO: What is size of integer? 468 // TODO: What is size of integer?
469 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 469 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
470 break; 470 break;
471 // FLOAT 471 // FLOAT
472 case (UInt16)LSO_Enums.Operation_Table.PUSHARGF: 472 case (UInt16)LSO_Enums.Operation_Table.PUSHARGF:
473 // TODO: What is size of float? 473 // TODO: What is size of float?
474 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 474 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
475 break; 475 break;
476 // STRING 476 // STRING
477 case (UInt16)LSO_Enums.Operation_Table.PUSHARGS: 477 case (UInt16)LSO_Enums.Operation_Table.PUSHARGS:
478 string s = Read_String(); 478 string s = Read_String();
479 SendToDebug("Param1: " + s); 479 SendToDebug("Param1: " + s);
480 il.Emit(OpCodes.Ldstr, s); 480 il.Emit(OpCodes.Ldstr, s);
481 break; 481 break;
482 // VECTOR z,y,x 482 // VECTOR z,y,x
483 case (UInt16)LSO_Enums.Operation_Table.PUSHARGV: 483 case (UInt16)LSO_Enums.Operation_Table.PUSHARGV:
484 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); 484 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0));
485 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); 485 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0));
486 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); 486 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0));
487 break; 487 break;
488 // ROTATION s,z,y,x 488 // ROTATION s,z,y,x
489 case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ: 489 case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ:
490 SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0)); 490 SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0));
491 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); 491 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0));
492 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); 492 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0));
493 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); 493 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0));
494 break; 494 break;
495 // LONG 495 // LONG
496 case (UInt16)LSO_Enums.Operation_Table.PUSHARGE: 496 case (UInt16)LSO_Enums.Operation_Table.PUSHARGE:
497 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 497 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
498 break; 498 break;
499 // BYTE 499 // BYTE
500 case (UInt16)LSO_Enums.Operation_Table.ADD: 500 case (UInt16)LSO_Enums.Operation_Table.ADD:
501 case (UInt16)LSO_Enums.Operation_Table.SUB: 501 case (UInt16)LSO_Enums.Operation_Table.SUB:
502 case (UInt16)LSO_Enums.Operation_Table.MUL: 502 case (UInt16)LSO_Enums.Operation_Table.MUL:
503 case (UInt16)LSO_Enums.Operation_Table.DIV: 503 case (UInt16)LSO_Enums.Operation_Table.DIV:
504 case (UInt16)LSO_Enums.Operation_Table.MOD: 504 case (UInt16)LSO_Enums.Operation_Table.MOD:
505 case (UInt16)LSO_Enums.Operation_Table.EQ: 505 case (UInt16)LSO_Enums.Operation_Table.EQ:
506 case (UInt16)LSO_Enums.Operation_Table.NEQ: 506 case (UInt16)LSO_Enums.Operation_Table.NEQ:
507 case (UInt16)LSO_Enums.Operation_Table.LEQ: 507 case (UInt16)LSO_Enums.Operation_Table.LEQ:
508 case (UInt16)LSO_Enums.Operation_Table.GEQ: 508 case (UInt16)LSO_Enums.Operation_Table.GEQ:
509 case (UInt16)LSO_Enums.Operation_Table.LESS: 509 case (UInt16)LSO_Enums.Operation_Table.LESS:
510 case (UInt16)LSO_Enums.Operation_Table.GREATER: 510 case (UInt16)LSO_Enums.Operation_Table.GREATER:
511 case (UInt16)LSO_Enums.Operation_Table.BOOLOR: 511 case (UInt16)LSO_Enums.Operation_Table.BOOLOR:
512 SendToDebug("Param1: " + br_read(1)[0]); 512 SendToDebug("Param1: " + br_read(1)[0]);
513 break; 513 break;
514 // LONG 514 // LONG
515 case (UInt16)LSO_Enums.Operation_Table.JUMP: 515 case (UInt16)LSO_Enums.Operation_Table.JUMP:
516 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 516 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
517 break; 517 break;
518 // BYTE, LONG 518 // BYTE, LONG
519 case (UInt16)LSO_Enums.Operation_Table.JUMPIF: 519 case (UInt16)LSO_Enums.Operation_Table.JUMPIF:
520 case (UInt16)LSO_Enums.Operation_Table.JUMPNIF: 520 case (UInt16)LSO_Enums.Operation_Table.JUMPNIF:
521 SendToDebug("Param1: " + br_read(1)[0]); 521 SendToDebug("Param1: " + br_read(1)[0]);
522 SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0)); 522 SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0));
523 break; 523 break;
524 // LONG 524 // LONG
525 case (UInt16)LSO_Enums.Operation_Table.STATE: 525 case (UInt16)LSO_Enums.Operation_Table.STATE:
526 case (UInt16)LSO_Enums.Operation_Table.CALL: 526 case (UInt16)LSO_Enums.Operation_Table.CALL:
527 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 527 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
528 break; 528 break;
529 // BYTE 529 // BYTE
530 case (UInt16)LSO_Enums.Operation_Table.CAST: 530 case (UInt16)LSO_Enums.Operation_Table.CAST:
531 SendToDebug("Param1: " + br_read(1)[0]); 531 SendToDebug("Param1: " + br_read(1)[0]);
532 break; 532 break;
533 // LONG 533 // LONG
534 case (UInt16)LSO_Enums.Operation_Table.STACKTOS: 534 case (UInt16)LSO_Enums.Operation_Table.STACKTOS:
535 case (UInt16)LSO_Enums.Operation_Table.STACKTOL: 535 case (UInt16)LSO_Enums.Operation_Table.STACKTOL:
536 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 536 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
537 break; 537 break;
538 // BYTE 538 // BYTE
539 case (UInt16)LSO_Enums.Operation_Table.PRINT: 539 case (UInt16)LSO_Enums.Operation_Table.PRINT:
540 case (UInt16)LSO_Enums.Operation_Table.CALLLIB: 540 case (UInt16)LSO_Enums.Operation_Table.CALLLIB:
541 SendToDebug("Param1: " + br_read(1)[0]); 541 SendToDebug("Param1: " + br_read(1)[0]);
542 break; 542 break;
543 // SHORT 543 // SHORT
544 case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: 544 case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE:
545 // TODO: What is size of short? 545 // TODO: What is size of short?
546 UInt16 _i = BitConverter.ToUInt16(br_read(2), 0); 546 UInt16 _i = BitConverter.ToUInt16(br_read(2), 0);
547 SendToDebug("Param1: " + _i); 547 SendToDebug("Param1: " + _i);
548 switch (_i) 548 switch (_i)
549 { 549 {
550 case (UInt16)LSO_Enums.BuiltIn_Functions.llSay: 550 case (UInt16)LSO_Enums.BuiltIn_Functions.llSay:
551 il.Emit(OpCodes.Call, typeof(Console).GetMethod 551 il.Emit(OpCodes.Call, typeof(Console).GetMethod
552 ("WriteLine", new Type[] { typeof(string) })); 552 ("WriteLine", new Type[] { typeof(string) }));
553 break; 553 break;
554 } 554 }
555 break; 555 break;
556 556
557 557
558 // RETURN 558 // RETURN
559 case (UInt16)LSO_Enums.Operation_Table.RETURN: 559 case (UInt16)LSO_Enums.Operation_Table.RETURN:
560 SendToDebug("Last OPCODE was return command. Code chunk execution complete."); 560 SendToDebug("Last OPCODE was return command. Code chunk execution complete.");
561 FoundRet = true; 561 FoundRet = true;
562 break; 562 break;
563 } 563 }
564 //fs.Seek(rPos, SeekOrigin.Begin); 564 //fs.Seek(rPos, SeekOrigin.Begin);
565 565
566 } 566 }
567 567
568 568
569 /* 569 /*
570 * CATCH 570 * CATCH
571 */ 571 */
572 SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); 572 SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));");
573 il.BeginCatchBlock(typeof(Exception)); 573 il.BeginCatchBlock(typeof(Exception));
574 574
575 // Push "Hello World!" string to stack 575 // Push "Hello World!" string to stack
576 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 576 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
577 il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); 577 il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": ");
578 578
579 //call void [mscorlib]System.Console::WriteLine(string) 579 //call void [mscorlib]System.Console::WriteLine(string)
580 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 580 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
581 il.Emit(OpCodes.Call, typeof(Console).GetMethod 581 il.Emit(OpCodes.Call, typeof(Console).GetMethod
582 ("Write", new Type[] { typeof(string) })); 582 ("Write", new Type[] { typeof(string) }));
583 583
584 //callvirt instance string [mscorlib]System.Exception::get_Message() 584 //callvirt instance string [mscorlib]System.Exception::get_Message()
585 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); 585 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt...");
586 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod 586 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod
587 ("get_Message")); 587 ("get_Message"));
588 588
589 //call void [mscorlib]System.Console::WriteLine(string) 589 //call void [mscorlib]System.Console::WriteLine(string)
590 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 590 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
591 il.Emit(OpCodes.Call, typeof(Console).GetMethod 591 il.Emit(OpCodes.Call, typeof(Console).GetMethod
592 ("WriteLine", new Type[] { typeof(string) })); 592 ("WriteLine", new Type[] { typeof(string) }));
593 593
594 /* 594 /*
595 * CLR END TRY 595 * CLR END TRY
596 */ 596 */
597 //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); 597 //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();");
598 il.EndExceptionBlock(); 598 il.EndExceptionBlock();
599 // Push "Return from current method, with return value if present" to stack 599 // Push "Return from current method, with return value if present" to stack
600 il.Emit(OpCodes.Ret); 600 il.Emit(OpCodes.Ret);
601 601
602 602
603 603
604 return myCodeChunk; 604 return myCodeChunk;
605 605
606 } 606 }
607 } 607 }
608} 608}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs
index 3b91e9f..66c6c5e 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs
@@ -1,105 +1,105 @@
1 1
2using System; 2using System;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5 5
6namespace OpenSim.ScriptEngines.LSL 6namespace OpenSim.ScriptEngines.LSL
7{ 7{
8 static class LSO_Struct 8 static class LSO_Struct
9 { 9 {
10 10
11 public struct Header 11 public struct Header
12 { 12 {
13 public UInt32 TM; 13 public UInt32 TM;
14 public UInt32 IP; 14 public UInt32 IP;
15 public UInt32 VN; 15 public UInt32 VN;
16 public UInt32 BP; 16 public UInt32 BP;
17 public UInt32 SP; 17 public UInt32 SP;
18 public UInt32 HR; 18 public UInt32 HR;
19 public UInt32 HP; 19 public UInt32 HP;
20 public UInt32 CS; 20 public UInt32 CS;
21 public UInt32 NS; 21 public UInt32 NS;
22 public UInt32 CE; 22 public UInt32 CE;
23 public UInt32 IE; 23 public UInt32 IE;
24 public UInt32 ER; 24 public UInt32 ER;
25 public UInt32 FR; 25 public UInt32 FR;
26 public UInt32 SLR; 26 public UInt32 SLR;
27 public UInt32 GVR; 27 public UInt32 GVR;
28 public UInt32 GFR; 28 public UInt32 GFR;
29 public UInt32 PR; 29 public UInt32 PR;
30 public UInt32 ESR; 30 public UInt32 ESR;
31 public UInt32 SR; 31 public UInt32 SR;
32 public UInt64 NCE; 32 public UInt64 NCE;
33 public UInt64 NIE; 33 public UInt64 NIE;
34 public UInt64 NER; 34 public UInt64 NER;
35 } 35 }
36 36
37 public struct StaticBlock 37 public struct StaticBlock
38 { 38 {
39 public UInt32 Static_Chunk_Header_Size; 39 public UInt32 Static_Chunk_Header_Size;
40 public byte ObjectType; 40 public byte ObjectType;
41 public byte Unknown; 41 public byte Unknown;
42 public byte[] BlockVariable; 42 public byte[] BlockVariable;
43 } 43 }
44 /* Not actually a structure 44 /* Not actually a structure
45 public struct StaticBlockVariable 45 public struct StaticBlockVariable
46 { 46 {
47 public UInt32 Integer1; 47 public UInt32 Integer1;
48 public UInt32 Float1; 48 public UInt32 Float1;
49 public UInt32 HeapPointer_String; 49 public UInt32 HeapPointer_String;
50 public UInt32 HeapPointer_Key; 50 public UInt32 HeapPointer_Key;
51 public byte[] Vector_12; 51 public byte[] Vector_12;
52 public byte[] Rotation_16; 52 public byte[] Rotation_16;
53 public UInt32 Pointer_List_Structure; 53 public UInt32 Pointer_List_Structure;
54 } */ 54 } */
55 public struct HeapBlock 55 public struct HeapBlock
56 { 56 {
57 public UInt32 DataBlockSize; 57 public UInt32 DataBlockSize;
58 public byte ObjectType; 58 public byte ObjectType;
59 public UInt16 ReferenceCount; 59 public UInt16 ReferenceCount;
60 public byte[] Data; 60 public byte[] Data;
61 } 61 }
62 public struct StateFrameBlock 62 public struct StateFrameBlock
63 { 63 {
64 public UInt32 StateCount; 64 public UInt32 StateCount;
65 public StatePointerBlock[] StatePointer; 65 public StatePointerBlock[] StatePointer;
66 } 66 }
67 public struct StatePointerBlock 67 public struct StatePointerBlock
68 { 68 {
69 public UInt32 Location; 69 public UInt32 Location;
70 public System.Collections.BitArray EventMask; 70 public System.Collections.BitArray EventMask;
71 public StateBlock StateBlock; 71 public StateBlock StateBlock;
72 } 72 }
73 public struct StateBlock 73 public struct StateBlock
74 { 74 {
75 public UInt32 StartPos; 75 public UInt32 StartPos;
76 public UInt32 EndPos; 76 public UInt32 EndPos;
77 public UInt32 HeaderSize; 77 public UInt32 HeaderSize;
78 public byte Unknown; 78 public byte Unknown;
79 public StateBlockHandler[] StateBlockHandlers; 79 public StateBlockHandler[] StateBlockHandlers;
80 } 80 }
81 public struct StateBlockHandler 81 public struct StateBlockHandler
82 { 82 {
83 public UInt32 CodeChunkPointer; 83 public UInt32 CodeChunkPointer;
84 public UInt32 CallFrameSize; 84 public UInt32 CallFrameSize;
85 } 85 }
86 public struct FunctionBlock 86 public struct FunctionBlock
87 { 87 {
88 public UInt32 FunctionCount; 88 public UInt32 FunctionCount;
89 public UInt32[] CodeChunkPointer; 89 public UInt32[] CodeChunkPointer;
90 } 90 }
91 public struct CodeChunk 91 public struct CodeChunk
92 { 92 {
93 public UInt32 CodeChunkHeaderSize; 93 public UInt32 CodeChunkHeaderSize;
94 public string Comment; 94 public string Comment;
95 public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; 95 public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments;
96 public byte EndMarker; 96 public byte EndMarker;
97 public byte ReturnType; 97 public byte ReturnType;
98 } 98 }
99 public struct CodeChunkArgument 99 public struct CodeChunkArgument
100 { 100 {
101 public byte FunctionReturnType; 101 public byte FunctionReturnType;
102 public byte NullString; 102 public byte NullString;
103 } 103 }
104 } 104 }
105} 105}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs
index 99d7d04..40825c0 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Script.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs
@@ -1,64 +1,64 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Region.Environment.Scenes; 28using OpenSim.Region.Environment.Scenes;
29 29
30namespace OpenSim.Region.Scripting 30namespace OpenSim.Region.Scripting
31{ 31{
32 public interface IScript 32 public interface IScript
33 { 33 {
34 void Initialise(ScriptInfo scriptInfo); 34 void Initialise(ScriptInfo scriptInfo);
35 string getName(); 35 string getName();
36 } 36 }
37 37
38 public class TestScript : IScript 38 public class TestScript : IScript
39 { 39 {
40 ScriptInfo script; 40 ScriptInfo script;
41 41
42 public string getName() 42 public string getName()
43 { 43 {
44 return "TestScript 0.1"; 44 return "TestScript 0.1";
45 } 45 }
46 46
47 public void Initialise(ScriptInfo scriptInfo) 47 public void Initialise(ScriptInfo scriptInfo)
48 { 48 {
49 script = scriptInfo; 49 script = scriptInfo;
50 script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); 50 script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
51 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 51 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
52 } 52 }
53 53
54 void events_OnNewPresence(ScenePresence presence) 54 void events_OnNewPresence(ScenePresence presence)
55 { 55 {
56 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); 56 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
57 } 57 }
58 58
59 void events_OnFrame() 59 void events_OnFrame()
60 { 60 {
61 //script.logger.Verbose("Hello World!"); 61 //script.logger.Verbose("Hello World!");
62 } 62 }
63 } 63 }
64} 64}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs
index a8f6aa5..b4f6a05 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs
@@ -1,32 +1,32 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using Key = libsecondlife.LLUUID; 4using Key = libsecondlife.LLUUID;
5using Rotation = libsecondlife.LLQuaternion; 5using Rotation = libsecondlife.LLQuaternion;
6using Vector = libsecondlife.LLVector3; 6using Vector = libsecondlife.LLVector3;
7using LSLList = System.Collections.Generic.List<string>; 7using LSLList = System.Collections.Generic.List<string>;
8 8
9 9
10using OpenSim.Region.Environment.Scenes; 10using OpenSim.Region.Environment.Scenes;
11 11
12namespace OpenSim.Region.Scripting 12namespace OpenSim.Region.Scripting
13{ 13{
14 // This class is to be used for engines which may not be able to access the Scene directly. 14 // This class is to be used for engines which may not be able to access the Scene directly.
15 // Scene access is preffered, but obviously not possible on some non-.NET languages. 15 // Scene access is preffered, but obviously not possible on some non-.NET languages.
16 public class ScriptAPI 16 public class ScriptAPI
17 { 17 {
18 Scene scene; 18 Scene scene;
19 ScriptInterpretedAPI interpretedAPI; 19 ScriptInterpretedAPI interpretedAPI;
20 20
21 public ScriptAPI(Scene world) 21 public ScriptAPI(Scene world)
22 { 22 {
23 scene = world; 23 scene = world;
24 interpretedAPI = new ScriptInterpretedAPI(); 24 interpretedAPI = new ScriptInterpretedAPI();
25 } 25 }
26 26
27 public Object CallMethod(String method, Object[] args) 27 public Object CallMethod(String method, Object[] args)
28 { 28 {
29 return null; 29 return null;
30 } 30 }
31 } 31 }
32} 32}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
index c3be22a..4a6086c 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
@@ -1,58 +1,58 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework.Console; 28using OpenSim.Framework.Console;
29using OpenSim.Region.Environment.Scenes; 29using OpenSim.Region.Environment.Scenes;
30 30
31namespace OpenSim.Region.Scripting 31namespace OpenSim.Region.Scripting
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Class which provides access to the world 34 /// Class which provides access to the world
35 /// </summary> 35 /// </summary>
36 public class ScriptInfo 36 public class ScriptInfo
37 { 37 {
38 // Reference to world.eventsManager provided for convenience 38 // Reference to world.eventsManager provided for convenience
39 public EventManager events; 39 public EventManager events;
40 40
41 // The main world 41 // The main world
42 public Scene world; 42 public Scene world;
43 43
44 // The console 44 // The console
45 public LogBase logger; 45 public LogBase logger;
46 46
47 // API Access 47 // API Access
48 public ScriptAPI api; 48 public ScriptAPI api;
49 49
50 public ScriptInfo(Scene scene) 50 public ScriptInfo(Scene scene)
51 { 51 {
52 world = scene; 52 world = scene;
53 events = world.EventManager; 53 events = world.EventManager;
54 logger = MainLog.Instance; 54 logger = MainLog.Instance;
55 api = new ScriptAPI(scene); 55 api = new ScriptAPI(scene);
56 } 56 }
57 } 57 }
58} 58}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
index 085d97e..b4a6019 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
@@ -1,206 +1,206 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using Key = libsecondlife.LLUUID; 4using Key = libsecondlife.LLUUID;
5using Rotation = libsecondlife.LLQuaternion; 5using Rotation = libsecondlife.LLQuaternion;
6using Vector = libsecondlife.LLVector3; 6using Vector = libsecondlife.LLVector3;
7using LSLList = System.Collections.Generic.List<string>; 7using LSLList = System.Collections.Generic.List<string>;
8 8
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10 10
11namespace OpenSim.Region.Scripting 11namespace OpenSim.Region.Scripting
12{ 12{
13 /// <summary> 13 /// <summary>
14 /// A class inteded to act as an API for LSL-styled interpreted languages 14 /// A class inteded to act as an API for LSL-styled interpreted languages
15 /// </summary> 15 /// </summary>
16 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> 16 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
17 class ScriptInterpretedAPI 17 class ScriptInterpretedAPI
18 { 18 {
19 public int osAbs(int val) 19 public int osAbs(int val)
20 { 20 {
21 return Math.Abs(val); 21 return Math.Abs(val);
22 } 22 }
23 23
24 public float osAcos(float val) 24 public float osAcos(float val)
25 { 25 {
26 return (float)Math.Acos(val); 26 return (float)Math.Acos(val);
27 } 27 }
28 28
29 [Obsolete("Unimplemented")] 29 [Obsolete("Unimplemented")]
30 public void osAddToLandPassList(Key avatar, float hours) 30 public void osAddToLandPassList(Key avatar, float hours)
31 { 31 {
32 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); 32 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
33 return; 33 return;
34 } 34 }
35 35
36 [Obsolete("Unimplemented")] 36 [Obsolete("Unimplemented")]
37 public void osAdjustSoundVolume(float volume) 37 public void osAdjustSoundVolume(float volume)
38 { 38 {
39 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAdjustSoundVolume(float volume)"); 39 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAdjustSoundVolume(float volume)");
40 return; 40 return;
41 } 41 }
42 42
43 [Obsolete("Unimplemented")] 43 [Obsolete("Unimplemented")]
44 public void osAllowInventoryDrop(int add) 44 public void osAllowInventoryDrop(int add)
45 { 45 {
46 return; 46 return;
47 } 47 }
48 48
49 [Obsolete("Unimplemented")] 49 [Obsolete("Unimplemented")]
50 public float osAngleBetween(Rotation a, Rotation b) 50 public float osAngleBetween(Rotation a, Rotation b)
51 { 51 {
52 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); 52 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z);
53 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); 53 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z);
54 54
55 return 0; 55 return 0;
56 } 56 }
57 57
58 [Obsolete("Unimplemented")] 58 [Obsolete("Unimplemented")]
59 public void osApplyImpulse(Vector force, int local) 59 public void osApplyImpulse(Vector force, int local)
60 { 60 {
61 return; 61 return;
62 } 62 }
63 63
64 [Obsolete("Unimplemented")] 64 [Obsolete("Unimplemented")]
65 public void osApplyRotationalImpulse(Vector force, int local) 65 public void osApplyRotationalImpulse(Vector force, int local)
66 { 66 {
67 return; 67 return;
68 } 68 }
69 69
70 public float osAsin(float val) 70 public float osAsin(float val)
71 { 71 {
72 return (float)Math.Asin(val); 72 return (float)Math.Asin(val);
73 } 73 }
74 74
75 public float osAtan2(float x, float y) 75 public float osAtan2(float x, float y)
76 { 76 {
77 return (float)Math.Atan2(x, y); 77 return (float)Math.Atan2(x, y);
78 } 78 }
79 79
80 [Obsolete("Unimplemented")] 80 [Obsolete("Unimplemented")]
81 public void osAttachToAvatar(Key avatar, int attachmentPoint) 81 public void osAttachToAvatar(Key avatar, int attachmentPoint)
82 { 82 {
83 return; 83 return;
84 } 84 }
85 85
86 [Obsolete("Unimplemented")] 86 [Obsolete("Unimplemented")]
87 public Key osAvatarOnSitTarget() 87 public Key osAvatarOnSitTarget()
88 { 88 {
89 return Key.Zero; 89 return Key.Zero;
90 } 90 }
91 91
92 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) 92 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
93 { 93 {
94 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); 94 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion();
95 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); 95 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z);
96 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); 96 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z);
97 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); 97 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z);
98 98
99 axQ.FromAxes(axFwd, axLeft, axUp); 99 axQ.FromAxes(axFwd, axLeft, axUp);
100 100
101 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 101 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
102 } 102 }
103 103
104 public Rotation osAxisAngle2Rot(Vector axis, float angle) 104 public Rotation osAxisAngle2Rot(Vector axis, float angle)
105 { 105 {
106 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); 106 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z));
107 107
108 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 108 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
109 } 109 }
110 110
111 public string osBase64ToString(string str) 111 public string osBase64ToString(string str)
112 { 112 {
113 Encoding enc = System.Text.Encoding.UTF8; 113 Encoding enc = System.Text.Encoding.UTF8;
114 return enc.GetString(Convert.FromBase64String(str)); 114 return enc.GetString(Convert.FromBase64String(str));
115 } 115 }
116 116
117 [Obsolete("Unimplemented")] 117 [Obsolete("Unimplemented")]
118 public void osBreakAllLinks() 118 public void osBreakAllLinks()
119 { 119 {
120 return; 120 return;
121 } 121 }
122 122
123 [Obsolete("Unimplemented")] 123 [Obsolete("Unimplemented")]
124 public void osBreakLink() 124 public void osBreakLink()
125 { 125 {
126 return; 126 return;
127 } 127 }
128 128
129 public LSLList osCSV2List(string src) 129 public LSLList osCSV2List(string src)
130 { 130 {
131 LSLList retVal = new LSLList(); 131 LSLList retVal = new LSLList();
132 retVal.AddRange(src.Split(',')); 132 retVal.AddRange(src.Split(','));
133 133
134 return retVal; 134 return retVal;
135 } 135 }
136 136
137 public int osCeil(float val) 137 public int osCeil(float val)
138 { 138 {
139 return (int)Math.Ceiling(val); 139 return (int)Math.Ceiling(val);
140 } 140 }
141 141
142 [Obsolete("Unimplemented")] 142 [Obsolete("Unimplemented")]
143 public void osCloseRemoteDataChannel(Key channel) 143 public void osCloseRemoteDataChannel(Key channel)
144 { 144 {
145 return; 145 return;
146 } 146 }
147 147
148 [Obsolete("Unimplemented")] 148 [Obsolete("Unimplemented")]
149 public float osCloud(Vector offset) 149 public float osCloud(Vector offset)
150 { 150 {
151 return 0.0f; 151 return 0.0f;
152 } 152 }
153 153
154 [Obsolete("Unimplemented")] 154 [Obsolete("Unimplemented")]
155 public void osCollisionFilter(string name, Key id, int accept) 155 public void osCollisionFilter(string name, Key id, int accept)
156 { 156 {
157 return; 157 return;
158 } 158 }
159 159
160 [Obsolete("Unimplemented")] 160 [Obsolete("Unimplemented")]
161 public void osCollisionSprite(string impact_sprite) 161 public void osCollisionSprite(string impact_sprite)
162 { 162 {
163 return; 163 return;
164 } 164 }
165 165
166 public float osCos(float theta) 166 public float osCos(float theta)
167 { 167 {
168 return (float)Math.Cos(theta); 168 return (float)Math.Cos(theta);
169 } 169 }
170 170
171 [Obsolete("Unimplemented")] 171 [Obsolete("Unimplemented")]
172 public void osCreateLink(Key target, int parent) 172 public void osCreateLink(Key target, int parent)
173 { 173 {
174 return; 174 return;
175 } 175 }
176 176
177 [Obsolete("Partially Unimplemented")] 177 [Obsolete("Partially Unimplemented")]
178 public LSLList osDeleteSubList(LSLList src, int start, int end) 178 public LSLList osDeleteSubList(LSLList src, int start, int end)
179 { 179 {
180 if (start < 0 || end < 0) 180 if (start < 0 || end < 0)
181 { 181 {
182 throw new Exception("Unsupported at this time."); 182 throw new Exception("Unsupported at this time.");
183 } 183 }
184 184
185 src.RemoveRange(start, start - end + 1); 185 src.RemoveRange(start, start - end + 1);
186 return src; 186 return src;
187 } 187 }
188 188
189 [Obsolete("Partially Unimplemented")] 189 [Obsolete("Partially Unimplemented")]
190 public string osDeleteSubString(string src, int start, int end) 190 public string osDeleteSubString(string src, int start, int end)
191 { 191 {
192 if (start < 0 || end < 0) 192 if (start < 0 || end < 0)
193 { 193 {
194 throw new Exception("Unsupported at this time."); 194 throw new Exception("Unsupported at this time.");
195 } 195 }
196 196
197 return src.Remove(start, start - end + 1); 197 return src.Remove(start, start - end + 1);
198 } 198 }
199 199
200 [Obsolete("Unimplemented")] 200 [Obsolete("Unimplemented")]
201 public void osDetachFromAvatar(Key avatar) 201 public void osDetachFromAvatar(Key avatar)
202 { 202 {
203 return; 203 return;
204 } 204 }
205 } 205 }
206} 206}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs
index 7743186..d6456a6 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5using libsecondlife; 5using libsecondlife;
6using Key = libsecondlife.LLUUID; 6using Key = libsecondlife.LLUUID;
7 7
8namespace OpenSim.Region.Scripting 8namespace OpenSim.Region.Scripting
9{ 9{
10 10
11 public class ScriptInterpretedEvents 11 public class ScriptInterpretedEvents
12 { 12 {
13 public delegate void OnTouchStartDelegate(Key user); 13 public delegate void OnTouchStartDelegate(Key user);
14 public event OnTouchStartDelegate OnTouchStart; 14 public event OnTouchStartDelegate OnTouchStart;
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
index 7a08735..27e831b 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
@@ -1,107 +1,107 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim.Region.Scripting 32namespace OpenSim.Region.Scripting
33{ 33{
34 public class ScriptManager 34 public class ScriptManager
35 { 35 {
36 List<IScript> scripts = new List<IScript>(); 36 List<IScript> scripts = new List<IScript>();
37 Scene scene; 37 Scene scene;
38 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 38 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
39 39
40 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 40 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
41 { 41 {
42 foreach (KeyValuePair<string, IScript> script in compiledscripts) 42 foreach (KeyValuePair<string, IScript> script in compiledscripts)
43 { 43 {
44 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 44 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
45 MainLog.Instance.Verbose("Loading " + script.Key); 45 MainLog.Instance.Verbose("Loading " + script.Key);
46 script.Value.Initialise(scriptInfo); 46 script.Value.Initialise(scriptInfo);
47 scripts.Add(script.Value); 47 scripts.Add(script.Value);
48 } 48 }
49 MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); 49 MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
50 } 50 }
51 51
52 public ScriptManager(Scene world) 52 public ScriptManager(Scene world)
53 { 53 {
54 scene = world; 54 scene = world;
55 55
56 // Default Engines 56 // Default Engines
57 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); 57 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
58 compilers.Add(csharpCompiler.FileExt(),csharpCompiler); 58 compilers.Add(csharpCompiler.FileExt(),csharpCompiler);
59 59
60 JScriptEngine jscriptCompiler = new JScriptEngine(); 60 JScriptEngine jscriptCompiler = new JScriptEngine();
61 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); 61 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
62 62
63 JavaEngine javaCompiler = new JavaEngine(); 63 JavaEngine javaCompiler = new JavaEngine();
64 compilers.Add(javaCompiler.FileExt(), javaCompiler); 64 compilers.Add(javaCompiler.FileExt(), javaCompiler);
65 } 65 }
66 66
67 public void Compile(string filename) 67 public void Compile(string filename)
68 { 68 {
69 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) 69 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
70 { 70 {
71 if (filename.EndsWith(compiler.Key)) 71 if (filename.EndsWith(compiler.Key))
72 { 72 {
73 LoadFromCompiler(compiler.Value.compile(filename)); 73 LoadFromCompiler(compiler.Value.compile(filename));
74 break; 74 break;
75 } 75 }
76 } 76 }
77 } 77 }
78 78
79 public void RunScriptCmd(string[] args) 79 public void RunScriptCmd(string[] args)
80 { 80 {
81 switch (args[0]) 81 switch (args[0])
82 { 82 {
83 case "load": 83 case "load":
84 Compile(args[1]); 84 Compile(args[1]);
85 break; 85 break;
86 86
87 default: 87 default:
88 MainLog.Instance.Error("Unknown script command"); 88 MainLog.Instance.Error("Unknown script command");
89 break; 89 break;
90 } 90 }
91 } 91 }
92 92
93 public void AddPreCompiledScript(IScript script) 93 public void AddPreCompiledScript(IScript script)
94 { 94 {
95 MainLog.Instance.Verbose("Loading script " + script.getName()); 95 MainLog.Instance.Verbose("Loading script " + script.getName());
96 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 96 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
97 script.Initialise(scriptInfo); 97 script.Initialise(scriptInfo);
98 scripts.Add(script); 98 scripts.Add(script);
99 } 99 }
100 } 100 }
101 101
102 interface IScriptCompiler 102 interface IScriptCompiler
103 { 103 {
104 Dictionary<string,IScript> compile(string filename); 104 Dictionary<string,IScript> compile(string filename);
105 string FileExt(); 105 string FileExt();
106 } 106 }
107} 107}
diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs
index 8f8ac97..fb12c4d 100644
--- a/OpenSim/Region/Environment/StorageManager.cs
+++ b/OpenSim/Region/Environment/StorageManager.cs
@@ -1,60 +1,60 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Framework; 5using OpenSim.Framework;
6using OpenSim.Framework.Communications; 6using OpenSim.Framework.Communications;
7using OpenSim.Framework.Servers; 7using OpenSim.Framework.Servers;
8using OpenSim.Region.Capabilities; 8using OpenSim.Region.Capabilities;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Interfaces; 10using OpenSim.Region.Interfaces;
11 11
12using System.Reflection; 12using System.Reflection;
13 13
14namespace OpenSim.Region.Environment 14namespace OpenSim.Region.Environment
15{ 15{
16 public class StorageManager 16 public class StorageManager
17 { 17 {
18 private IRegionDataStore m_dataStore; 18 private IRegionDataStore m_dataStore;
19 19
20 public IRegionDataStore DataStore 20 public IRegionDataStore DataStore
21 { 21 {
22 get 22 get
23 { 23 {
24 return m_dataStore; 24 return m_dataStore;
25 } 25 }
26 } 26 }
27 27
28 public StorageManager(IRegionDataStore storage) 28 public StorageManager(IRegionDataStore storage)
29 { 29 {
30 m_dataStore = storage; 30 m_dataStore = storage;
31 } 31 }
32 32
33 public StorageManager(string dllName, string dataStoreFile, string dataStoreDB) 33 public StorageManager(string dllName, string dataStoreFile, string dataStoreDB)
34 { 34 {
35 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 35 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
36 36
37 foreach (Type pluginType in pluginAssembly.GetTypes()) 37 foreach (Type pluginType in pluginAssembly.GetTypes())
38 { 38 {
39 if (pluginType.IsPublic) 39 if (pluginType.IsPublic)
40 { 40 {
41 Type typeInterface = pluginType.GetInterface("IRegionDataStore", true); 41 Type typeInterface = pluginType.GetInterface("IRegionDataStore", true);
42 42
43 if (typeInterface != null) 43 if (typeInterface != null)
44 { 44 {
45 IRegionDataStore plug = (IRegionDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 45 IRegionDataStore plug = (IRegionDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
46 plug.Initialise(dataStoreFile, dataStoreDB); 46 plug.Initialise(dataStoreFile, dataStoreDB);
47 47
48 m_dataStore = plug; 48 m_dataStore = plug;
49 } 49 }
50 50
51 typeInterface = null; 51 typeInterface = null;
52 } 52 }
53 } 53 }
54 54
55 pluginAssembly = null; 55 pluginAssembly = null;
56 56
57 //TODO: Add checking and warning to make sure it initialised. 57 //TODO: Add checking and warning to make sure it initialised.
58 } 58 }
59 } 59 }
60} 60}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 7e6b1af..28c9b9a 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -1,184 +1,184 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using System.Net; 2using System.Net;
3using System.Timers; 3using System.Timers;
4using System; 4using System;
5using System.Text; 5using System.Text;
6 6
7using libsecondlife; 7using libsecondlife;
8using libsecondlife.Packets; 8using libsecondlife.Packets;
9 9
10using OpenSim.Framework; 10using OpenSim.Framework;
11using OpenSim.Framework.Interfaces; 11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Types; 12using OpenSim.Framework.Types;
13using OpenSim.Framework.Data; 13using OpenSim.Framework.Data;
14using OpenSim.Framework.Utilities; 14using OpenSim.Framework.Utilities;
15 15
16namespace SimpleApp 16namespace SimpleApp
17{ 17{
18 public class MyNpcCharacter : IClientAPI 18 public class MyNpcCharacter : IClientAPI
19 { 19 {
20 private uint movementFlag = 0; 20 private uint movementFlag = 0;
21 private short flyState = 0; 21 private short flyState = 0;
22 private LLQuaternion bodyDirection = LLQuaternion.Identity; 22 private LLQuaternion bodyDirection = LLQuaternion.Identity;
23 private short count = 0; 23 private short count = 0;
24 24
25 public event ImprovedInstantMessage OnInstantMessage; 25 public event ImprovedInstantMessage OnInstantMessage;
26 public event ChatFromViewer OnChatFromViewer; 26 public event ChatFromViewer OnChatFromViewer;
27 public event RezObject OnRezObject; 27 public event RezObject OnRezObject;
28 public event ModifyTerrain OnModifyTerrain; 28 public event ModifyTerrain OnModifyTerrain;
29 public event SetAppearance OnSetAppearance; 29 public event SetAppearance OnSetAppearance;
30 public event StartAnim OnStartAnim; 30 public event StartAnim OnStartAnim;
31 public event LinkObjects OnLinkObjects; 31 public event LinkObjects OnLinkObjects;
32 public event RequestMapBlocks OnRequestMapBlocks; 32 public event RequestMapBlocks OnRequestMapBlocks;
33 public event TeleportLocationRequest OnTeleportLocationRequest; 33 public event TeleportLocationRequest OnTeleportLocationRequest;
34 34
35 public event GenericCall4 OnDeRezObject; 35 public event GenericCall4 OnDeRezObject;
36 public event GenericCall OnRegionHandShakeReply; 36 public event GenericCall OnRegionHandShakeReply;
37 public event GenericCall OnRequestWearables; 37 public event GenericCall OnRequestWearables;
38 public event GenericCall2 OnCompleteMovementToRegion; 38 public event GenericCall2 OnCompleteMovementToRegion;
39 public event UpdateAgent OnAgentUpdate; 39 public event UpdateAgent OnAgentUpdate;
40 public event GenericCall OnRequestAvatarsData; 40 public event GenericCall OnRequestAvatarsData;
41 public event AddNewPrim OnAddPrim; 41 public event AddNewPrim OnAddPrim;
42 public event ObjectDuplicate OnObjectDuplicate; 42 public event ObjectDuplicate OnObjectDuplicate;
43 public event UpdateVector OnGrapObject; 43 public event UpdateVector OnGrapObject;
44 public event ObjectSelect OnDeGrapObject; 44 public event ObjectSelect OnDeGrapObject;
45 public event MoveObject OnGrapUpdate; 45 public event MoveObject OnGrapUpdate;
46 46
47 public event UpdateShape OnUpdatePrimShape; 47 public event UpdateShape OnUpdatePrimShape;
48 public event ObjectSelect OnObjectSelect; 48 public event ObjectSelect OnObjectSelect;
49 public event GenericCall7 OnObjectDescription; 49 public event GenericCall7 OnObjectDescription;
50 public event GenericCall7 OnObjectName; 50 public event GenericCall7 OnObjectName;
51 public event UpdatePrimFlags OnUpdatePrimFlags; 51 public event UpdatePrimFlags OnUpdatePrimFlags;
52 public event UpdatePrimTexture OnUpdatePrimTexture; 52 public event UpdatePrimTexture OnUpdatePrimTexture;
53 public event UpdateVector OnUpdatePrimGroupPosition; 53 public event UpdateVector OnUpdatePrimGroupPosition;
54 public event UpdateVector OnUpdatePrimSinglePosition; 54 public event UpdateVector OnUpdatePrimSinglePosition;
55 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 55 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
56 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 56 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
57 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 57 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
58 public event UpdateVector OnUpdatePrimScale; 58 public event UpdateVector OnUpdatePrimScale;
59 public event StatusChange OnChildAgentStatus; 59 public event StatusChange OnChildAgentStatus;
60 public event GenericCall2 OnStopMovement; 60 public event GenericCall2 OnStopMovement;
61 public event NewAvatar OnNewAvatar; 61 public event NewAvatar OnNewAvatar;
62 public event GenericCall6 OnRemoveAvatar; 62 public event GenericCall6 OnRemoveAvatar;
63 63
64 public event UUIDNameRequest OnNameFromUUIDRequest; 64 public event UUIDNameRequest OnNameFromUUIDRequest;
65 65
66 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 66 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
67 public event ParcelDivideRequest OnParcelDivideRequest; 67 public event ParcelDivideRequest OnParcelDivideRequest;
68 public event ParcelJoinRequest OnParcelJoinRequest; 68 public event ParcelJoinRequest OnParcelJoinRequest;
69 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 69 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
70 70
71 public event ParcelSelectObjects OnParcelSelectObjects; 71 public event ParcelSelectObjects OnParcelSelectObjects;
72 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 72 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
73 public event ObjectDeselect OnObjectDeselect; 73 public event ObjectDeselect OnObjectDeselect;
74 public event EstateOwnerMessageRequest OnEstateOwnerMessage; 74 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
75 75
76 private LLUUID myID = LLUUID.Random(); 76 private LLUUID myID = LLUUID.Random();
77 public MyNpcCharacter() 77 public MyNpcCharacter()
78 { 78 {
79 79
80 } 80 }
81 81
82 public virtual LLVector3 StartPos 82 public virtual LLVector3 StartPos
83 { 83 {
84 get { return new LLVector3(128, 100, 2); } 84 get { return new LLVector3(128, 100, 2); }
85 set { } 85 set { }
86 } 86 }
87 87
88 public virtual LLUUID AgentId 88 public virtual LLUUID AgentId
89 { 89 {
90 get { return myID; } 90 get { return myID; }
91 } 91 }
92 92
93 public virtual string FirstName 93 public virtual string FirstName
94 { 94 {
95 get { return "Annoying"; } 95 get { return "Annoying"; }
96 } 96 }
97 97
98 public virtual string LastName 98 public virtual string LastName
99 { 99 {
100 get { return "NPC"; } 100 get { return "NPC"; }
101 } 101 }
102 102
103 public virtual void OutPacket(Packet newPack) { } 103 public virtual void OutPacket(Packet newPack) { }
104 public virtual void SendWearables(AvatarWearable[] wearables) { } 104 public virtual void SendWearables(AvatarWearable[] wearables) { }
105 public virtual void SendStartPingCheck(byte seq) { } 105 public virtual void SendStartPingCheck(byte seq) { }
106 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID) { } 106 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID) { }
107 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } 107 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { }
108 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 108 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { }
109 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 109 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { }
110 public virtual void SendInstantMessage(string message, LLUUID target, string fromName) { } 110 public virtual void SendInstantMessage(string message, LLUUID target, string fromName) { }
111 public virtual void SendLayerData(float[] map) { } 111 public virtual void SendLayerData(float[] map) { }
112 public virtual void SendLayerData(int px, int py, float[] map) { } 112 public virtual void SendLayerData(int px, int py, float[] map) { }
113 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } 113 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { }
114 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } 114 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { }
115 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } 115 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); }
116 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint) { } 116 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint) { }
117 public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { } 117 public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { }
118 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } 118 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { }
119 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags) { } 119 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags) { }
120 public virtual void SendTeleportCancel() { } 120 public virtual void SendTeleportCancel() { }
121 public virtual void SendTeleportLocationStart() { } 121 public virtual void SendTeleportLocationStart() { }
122 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } 122 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
123 123
124 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } 124 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { }
125 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { } 125 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { }
126 126
127 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } 127 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { }
128 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) { } 128 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) { }
129 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { } 129 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { }
130 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } 130 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { }
131 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } 131 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { }
132 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } 132 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { }
133 133
134 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } 134 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
135 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { } 135 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { }
136 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } 136 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
137 137
138 public virtual void SendRegionHandshake(RegionInfo regionInfo) 138 public virtual void SendRegionHandshake(RegionInfo regionInfo)
139 { 139 {
140 this.OnRegionHandShakeReply(this); 140 this.OnRegionHandShakeReply(this);
141 this.OnCompleteMovementToRegion(); 141 this.OnCompleteMovementToRegion();
142 this.StartMovement(); 142 this.StartMovement();
143 } 143 }
144 144
145 public void StartMovement() 145 public void StartMovement()
146 { 146 {
147 Timer timer = new Timer(); 147 Timer timer = new Timer();
148 timer.Enabled = true; 148 timer.Enabled = true;
149 timer.Interval = 500; 149 timer.Interval = 500;
150 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 150 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
151 } 151 }
152 152
153 public void Heartbeat(object sender, EventArgs e) 153 public void Heartbeat(object sender, EventArgs e)
154 { 154 {
155 Encoding enc = Encoding.ASCII; 155 Encoding enc = Encoding.ASCII;
156 156
157 this.OnAgentUpdate(this, movementFlag, bodyDirection); 157 this.OnAgentUpdate(this, movementFlag, bodyDirection);
158 158
159 if (this.flyState == 0) 159 if (this.flyState == 0)
160 { 160 {
161 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; 161 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
162 flyState = 1; 162 flyState = 1;
163 } 163 }
164 else if (this.flyState == 1) 164 else if (this.flyState == 1)
165 { 165 {
166 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; 166 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
167 flyState = 2; 167 flyState = 2;
168 } 168 }
169 else 169 else
170 { 170 {
171 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY; 171 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
172 flyState = 0; 172 flyState = 0;
173 } 173 }
174 174
175 if (count >= 40) 175 if (count >= 40)
176 { 176 {
177 this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); 177 this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId);
178 count = -1; 178 count = -1;
179 } 179 }
180 180
181 count++; 181 count++;
182 } 182 }
183 } 183 }
184} 184}
diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
index aab52cc..f5c6a0f 100644
--- a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Types; 6using OpenSim.Framework.Types;
7using System.Timers; 7using System.Timers;
8using System.Diagnostics; 8using System.Diagnostics;
9 9
10namespace SimpleApp 10namespace SimpleApp
11{ 11{
12 public class MySceneObject : SceneObject 12 public class MySceneObject : SceneObject
13 { 13 {
14 private PerformanceCounter m_counter; 14 private PerformanceCounter m_counter;
15 15
16 public MySceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 16 public MySceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
17 : base(world, eventManager, ownerID, localID, pos, shape ) 17 : base(world, eventManager, ownerID, localID, pos, shape )
18 { 18 {
19 String objectName = "Processor"; 19 String objectName = "Processor";
20 String counterName = "% Processor Time"; 20 String counterName = "% Processor Time";
21 String instanceName = "_Total"; 21 String instanceName = "_Total";
22 22
23 m_counter = new PerformanceCounter(objectName, counterName, instanceName); 23 m_counter = new PerformanceCounter(objectName, counterName, instanceName);
24 24
25 Timer timer = new Timer(); 25 Timer timer = new Timer();
26 timer.Enabled = true; 26 timer.Enabled = true;
27 timer.Interval = 100; 27 timer.Interval = 100;
28 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 28 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
29 29
30 } 30 }
31 31
32 public void Heartbeat(object sender, EventArgs e) 32 public void Heartbeat(object sender, EventArgs e)
33 { 33 {
34 float cpu = m_counter.NextValue() / 40f; 34 float cpu = m_counter.NextValue() / 40f;
35 LLVector3 size = new LLVector3(cpu, cpu, cpu); 35 LLVector3 size = new LLVector3(cpu, cpu, cpu);
36 rootPrimitive.ResizeGoup( size ); 36 rootPrimitive.ResizeGoup( size );
37 update(); 37 update();
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
index 29b255b..4fe3c7a 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -1,97 +1,97 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using libsecondlife; 2using libsecondlife;
3using OpenSim.Framework; 3using OpenSim.Framework;
4using OpenSim.Framework.Communications; 4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Framework.Servers; 6using OpenSim.Framework.Servers;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Region.Caches; 8using OpenSim.Region.Caches;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Terrain; 10using OpenSim.Region.Terrain;
11using OpenSim.Region.Environment; 11using OpenSim.Region.Environment;
12 12
13using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; 13using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
14 14
15namespace SimpleApp 15namespace SimpleApp
16{ 16{
17 public class MyWorld : Scene 17 public class MyWorld : Scene
18 { 18 {
19 private List<ScenePresence> m_avatars; 19 private List<ScenePresence> m_avatars;
20 20
21 public MyWorld( RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer) 21 public MyWorld( RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer)
22 : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer) 22 : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer)
23 { 23 {
24 m_avatars = new List<Avatar>(); 24 m_avatars = new List<Avatar>();
25 } 25 }
26 26
27 public override void LoadWorldMap() 27 public override void LoadWorldMap()
28 { 28 {
29 float[] map = new float[65536]; 29 float[] map = new float[65536];
30 30
31 for (int i = 0; i < 65536; i++) 31 for (int i = 0; i < 65536; i++)
32 { 32 {
33 int x = i % 256; 33 int x = i % 256;
34 int y = i / 256; 34 int y = i / 256;
35 35
36 map[i] = 25f; 36 map[i] = 25f;
37 } 37 }
38 38
39 this.Terrain.setHeights1D(map); 39 this.Terrain.setHeights1D(map);
40 this.CreateTerrainTexture(); 40 this.CreateTerrainTexture();
41 } 41 }
42 42
43 #region IWorld Members 43 #region IWorld Members
44 44
45 override public void AddNewClient(IClientAPI client, bool child) 45 override public void AddNewClient(IClientAPI client, bool child)
46 { 46 {
47 LLVector3 pos = new LLVector3(128, 128, 128); 47 LLVector3 pos = new LLVector3(128, 128, 128);
48 48
49 client.OnRegionHandShakeReply += SendLayerData; 49 client.OnRegionHandShakeReply += SendLayerData;
50 /*client.OnChatFromViewer += 50 /*client.OnChatFromViewer +=
51 delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 51 delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
52 { 52 {
53 // Echo it (so you know what you typed) 53 // Echo it (so you know what you typed)
54 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); 54 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
55 client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); 55 client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero );
56 }; 56 };
57 */ 57 */
58 client.OnChatFromViewer += this.SimChat; 58 client.OnChatFromViewer += this.SimChat;
59 client.OnAddPrim += AddNewPrim; 59 client.OnAddPrim += AddNewPrim;
60 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; 60 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
61 client.OnRequestMapBlocks += this.RequestMapBlocks; 61 client.OnRequestMapBlocks += this.RequestMapBlocks;
62 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 62 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
63 client.OnGrapUpdate += this.MoveObject; 63 client.OnGrapUpdate += this.MoveObject;
64 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 64 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
65 65
66 client.OnCompleteMovementToRegion += delegate() 66 client.OnCompleteMovementToRegion += delegate()
67 { 67 {
68 client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); 68 client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
69 }; 69 };
70 70
71 client.SendRegionHandshake(m_regInfo); 71 client.SendRegionHandshake(m_regInfo);
72 72
73 ScenePresence avatar = CreateAndAddScenePresence(client); 73 ScenePresence avatar = CreateAndAddScenePresence(client);
74 avatar.Pos = new LLVector3(128, 128, 26); 74 avatar.Pos = new LLVector3(128, 128, 26);
75 } 75 }
76 76
77 public override void Update() 77 public override void Update()
78 { 78 {
79 foreach (LLUUID UUID in Entities.Keys) 79 foreach (LLUUID UUID in Entities.Keys)
80 { 80 {
81 Entities[UUID].updateMovement(); 81 Entities[UUID].updateMovement();
82 } 82 }
83 83
84 lock (this.m_syncRoot) 84 lock (this.m_syncRoot)
85 { 85 {
86 this.phyScene.Simulate(timeStep); 86 this.phyScene.Simulate(timeStep);
87 } 87 }
88 88
89 foreach (LLUUID UUID in Entities.Keys) 89 foreach (LLUUID UUID in Entities.Keys)
90 { 90 {
91 Entities[UUID].update(); 91 Entities[UUID].update();
92 } 92 }
93 } 93 }
94 94
95 #endregion 95 #endregion
96 } 96 }
97} 97}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index c3edf0c..f82bdcb 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -1,126 +1,126 @@
1using System; 1using System;
2using System.Net; 2using System.Net;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Assets; 4using OpenSim.Assets;
5using OpenSim.Framework; 5using OpenSim.Framework;
6using OpenSim.Framework.Console; 6using OpenSim.Framework.Console;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Servers; 8using OpenSim.Framework.Servers;
9using OpenSim.Framework.Types; 9using OpenSim.Framework.Types;
10using OpenSim.Physics.Manager; 10using OpenSim.Physics.Manager;
11using OpenSim.Region.Caches; 11using OpenSim.Region.Caches;
12using OpenSim.Region.Capabilities; 12using OpenSim.Region.Capabilities;
13using OpenSim.Region.ClientStack; 13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local; 14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.GridInterfaces.Local; 15using OpenSim.Region.GridInterfaces.Local;
16using System.Timers; 16using System.Timers;
17using OpenSim.Region.Environment.Scenes; 17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Framework.Data; 18using OpenSim.Framework.Data;
19 19
20namespace SimpleApp 20namespace SimpleApp
21{ 21{
22 class Program : conscmd_callback 22 class Program : conscmd_callback
23 { 23 {
24 private LogBase m_log; 24 private LogBase m_log;
25 AuthenticateSessionsBase m_circuitManager; 25 AuthenticateSessionsBase m_circuitManager;
26 uint m_localId; 26 uint m_localId;
27 public MyWorld world; 27 public MyWorld world;
28 private SceneObject m_sceneObject; 28 private SceneObject m_sceneObject;
29 public MyNpcCharacter m_character; 29 public MyNpcCharacter m_character;
30 30
31 private void Run() 31 private void Run()
32 { 32 {
33 m_log = new LogBase(null, "SimpleApp", this, false); 33 m_log = new LogBase(null, "SimpleApp", this, false);
34 MainLog.Instance = m_log; 34 MainLog.Instance = m_log;
35 35
36 // CheckSumServer checksumServer = new CheckSumServer(12036); 36 // CheckSumServer checksumServer = new CheckSumServer(12036);
37 // checksumServer.ServerListener(); 37 // checksumServer.ServerListener();
38 38
39 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000); 39 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000);
40 40
41 m_circuitManager = new AuthenticateSessionsBase(); 41 m_circuitManager = new AuthenticateSessionsBase();
42 42
43 InventoryCache inventoryCache = new InventoryCache(); 43 InventoryCache inventoryCache = new InventoryCache();
44 44
45 LocalAssetServer assetServer = new LocalAssetServer(); 45 LocalAssetServer assetServer = new LocalAssetServer();
46 assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); 46 assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
47 47
48 AssetCache assetCache = new AssetCache(assetServer); 48 AssetCache assetCache = new AssetCache(assetServer);
49 49
50 ScenePresence.LoadTextureFile("avatar-texture.dat"); 50 ScenePresence.LoadTextureFile("avatar-texture.dat");
51 ScenePresence.PhysicsEngineFlying = true; 51 ScenePresence.PhysicsEngineFlying = true;
52 52
53 PhysicsManager physManager = new PhysicsManager(); 53 PhysicsManager physManager = new PhysicsManager();
54 physManager.LoadPlugins(); 54 physManager.LoadPlugins();
55 55
56 UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager); 56 UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager);
57 PacketServer packetServer = new PacketServer(udpServer); 57 PacketServer packetServer = new PacketServer(udpServer);
58 58
59 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 59 ClientView.TerrainManager = new TerrainManager(new SecondLife());
60 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); 60 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port);
61 61
62 NetworkServersInfo serverInfo = new NetworkServersInfo(); 62 NetworkServersInfo serverInfo = new NetworkServersInfo();
63 CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer); 63 CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer);
64 64
65 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "127.0.0.1"); 65 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "127.0.0.1");
66 66
67 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); 67 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
68 68
69 world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer); 69 world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer);
70 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; 70 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
71 71
72 world.LoadWorldMap(); 72 world.LoadWorldMap();
73 world.PhysScene.SetTerrain(world.Terrain.getHeights1D()); 73 world.PhysScene.SetTerrain(world.Terrain.getHeights1D());
74 world.performParcelPrimCountUpdate(); 74 world.performParcelPrimCountUpdate();
75 75
76 udpServer.LocalWorld = world; 76 udpServer.LocalWorld = world;
77 77
78 httpServer.Start(); 78 httpServer.Start();
79 udpServer.ServerListener(); 79 udpServer.ServerListener();
80 80
81 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test"); 81 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test");
82 if (masterAvatar != null) 82 if (masterAvatar != null)
83 { 83 {
84 world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; 84 world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
85 world.ParcelManager.NoParcelDataFromStorage(); 85 world.ParcelManager.NoParcelDataFromStorage();
86 } 86 }
87 87
88 world.StartTimer(); 88 world.StartTimer();
89 89
90 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); 90 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
91 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); 91 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
92 LLVector3 pos = new LLVector3(138, 129, 27); 92 LLVector3 pos = new LLVector3(138, 129, 27);
93 93
94 m_sceneObject = new MySceneObject(world, world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); 94 m_sceneObject = new MySceneObject(world, world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape);
95 world.AddEntity(m_sceneObject); 95 world.AddEntity(m_sceneObject);
96 96
97 m_character = new MyNpcCharacter(); 97 m_character = new MyNpcCharacter();
98 world.AddNewClient(m_character, false); 98 world.AddNewClient(m_character, false);
99 99
100 m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); 100 m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit.");
101 m_log.ReadLine(); 101 m_log.ReadLine();
102 102
103 } 103 }
104 104
105 #region conscmd_callback Members 105 #region conscmd_callback Members
106 106
107 public void RunCmd(string cmd, string[] cmdparams) 107 public void RunCmd(string cmd, string[] cmdparams)
108 { 108 {
109 throw new Exception("The method or operation is not implemented."); 109 throw new Exception("The method or operation is not implemented.");
110 } 110 }
111 111
112 public void Show(string ShowWhat) 112 public void Show(string ShowWhat)
113 { 113 {
114 throw new Exception("The method or operation is not implemented."); 114 throw new Exception("The method or operation is not implemented.");
115 } 115 }
116 116
117 #endregion 117 #endregion
118 118
119 static void Main(string[] args) 119 static void Main(string[] args)
120 { 120 {
121 Program app = new Program(); 121 Program app = new Program();
122 122
123 app.Run(); 123 app.Run();
124 } 124 }
125 } 125 }
126} 126}
diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
index 3b0de8a..2250613 100644
--- a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
@@ -1,31 +1,31 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("SimpleApp")] 6[assembly: AssemblyTitle("SimpleApp")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("Playahead AB")] 9[assembly: AssemblyCompany("Playahead AB")]
10[assembly: AssemblyProduct("SimpleApp")] 10[assembly: AssemblyProduct("SimpleApp")]
11[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] 11[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] 21[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30[assembly: AssemblyVersion("1.0.0.0")] 30[assembly: AssemblyVersion("1.0.0.0")]
31[assembly: AssemblyFileVersion("1.0.0.0")] 31[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs
index b5fc1ef..61adf80 100644
--- a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs
+++ b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("LocalGridServers")] 36[assembly: AssemblyTitle("LocalGridServers")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("LocalGridServers")] 40[assembly: AssemblyProduct("LocalGridServers")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
index 1023820..f3d7a2c 100644
--- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
+++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
@@ -1,311 +1,311 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Threading; 30using System.Threading;
31using Db4objects.Db4o; 31using Db4objects.Db4o;
32using Db4objects.Db4o.Query; 32using Db4objects.Db4o.Query;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38 38
39namespace OpenSim.Region.GridInterfaces.Local 39namespace OpenSim.Region.GridInterfaces.Local
40{ 40{
41 public class LocalAssetPlugin : IAssetPlugin 41 public class LocalAssetPlugin : IAssetPlugin
42 { 42 {
43 public LocalAssetPlugin() 43 public LocalAssetPlugin()
44 { 44 {
45 45
46 } 46 }
47 47
48 public IAssetServer GetAssetServer() 48 public IAssetServer GetAssetServer()
49 { 49 {
50 return (new LocalAssetServer()); 50 return (new LocalAssetServer());
51 } 51 }
52 } 52 }
53 53
54 public class LocalAssetServer : IAssetServer 54 public class LocalAssetServer : IAssetServer
55 { 55 {
56 private IAssetReceiver _receiver; 56 private IAssetReceiver _receiver;
57 private BlockingQueue<ARequest> _assetRequests; 57 private BlockingQueue<ARequest> _assetRequests;
58 private IObjectContainer db; 58 private IObjectContainer db;
59 private Thread _localAssetServerThread; 59 private Thread _localAssetServerThread;
60 60
61 public LocalAssetServer() 61 public LocalAssetServer()
62 { 62 {
63 bool yapfile; 63 bool yapfile;
64 this._assetRequests = new BlockingQueue<ARequest>(); 64 this._assetRequests = new BlockingQueue<ARequest>();
65 yapfile = File.Exists("regionassets.yap"); 65 yapfile = File.Exists("regionassets.yap");
66 66
67 MainLog.Instance.Verbose( "Local Asset Server class created"); 67 MainLog.Instance.Verbose( "Local Asset Server class created");
68 try 68 try
69 { 69 {
70 db = Db4oFactory.OpenFile("regionassets.yap"); 70 db = Db4oFactory.OpenFile("regionassets.yap");
71 MainLog.Instance.Verbose( "Db4 Asset database creation"); 71 MainLog.Instance.Verbose( "Db4 Asset database creation");
72 } 72 }
73 catch (Exception e) 73 catch (Exception e)
74 { 74 {
75 db.Close(); 75 db.Close();
76 MainLog.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured"); 76 MainLog.Instance.WriteLine(LogPriority.MEDIUM, "Db4 Asset server :Constructor - Exception occured");
77 MainLog.Instance.Warn(e.ToString()); 77 MainLog.Instance.Warn(e.ToString());
78 } 78 }
79 if (!yapfile) 79 if (!yapfile)
80 { 80 {
81 this.SetUpAssetDatabase(); 81 this.SetUpAssetDatabase();
82 } 82 }
83 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); 83 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
84 this._localAssetServerThread.IsBackground = true; 84 this._localAssetServerThread.IsBackground = true;
85 this._localAssetServerThread.Start(); 85 this._localAssetServerThread.Start();
86 86
87 } 87 }
88 88
89 public void SetReceiver(IAssetReceiver receiver) 89 public void SetReceiver(IAssetReceiver receiver)
90 { 90 {
91 this._receiver = receiver; 91 this._receiver = receiver;
92 } 92 }
93 93
94 public void RequestAsset(LLUUID assetID, bool isTexture) 94 public void RequestAsset(LLUUID assetID, bool isTexture)
95 { 95 {
96 ARequest req = new ARequest(); 96 ARequest req = new ARequest();
97 req.AssetID = assetID; 97 req.AssetID = assetID;
98 req.IsTexture = isTexture; 98 req.IsTexture = isTexture;
99 this._assetRequests.Enqueue(req); 99 this._assetRequests.Enqueue(req);
100 } 100 }
101 101
102 public void UpdateAsset(AssetBase asset) 102 public void UpdateAsset(AssetBase asset)
103 { 103 {
104 104
105 } 105 }
106 106
107 public void UploadNewAsset(AssetBase asset) 107 public void UploadNewAsset(AssetBase asset)
108 { 108 {
109 AssetStorage store = new AssetStorage(); 109 AssetStorage store = new AssetStorage();
110 store.Data = asset.Data; 110 store.Data = asset.Data;
111 store.Name = asset.Name; 111 store.Name = asset.Name;
112 store.UUID = asset.FullID; 112 store.UUID = asset.FullID;
113 db.Set(store); 113 db.Set(store);
114 db.Commit(); 114 db.Commit();
115 } 115 }
116 116
117 public void SetServerInfo(string ServerUrl, string ServerKey) 117 public void SetServerInfo(string ServerUrl, string ServerKey)
118 { 118 {
119 119
120 } 120 }
121 public void Close() 121 public void Close()
122 { 122 {
123 if (db != null) 123 if (db != null)
124 { 124 {
125 MainLog.Instance.Verbose( "Closing local asset server database"); 125 MainLog.Instance.Verbose( "Closing local asset server database");
126 db.Close(); 126 db.Close();
127 } 127 }
128 } 128 }
129 129
130 private void RunRequests() 130 private void RunRequests()
131 { 131 {
132 while (true) 132 while (true)
133 { 133 {
134 byte[] idata = null; 134 byte[] idata = null;
135 bool found = false; 135 bool found = false;
136 AssetStorage foundAsset = null; 136 AssetStorage foundAsset = null;
137 ARequest req = this._assetRequests.Dequeue(); 137 ARequest req = this._assetRequests.Dequeue();
138 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); 138 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
139 if (result.Count > 0) 139 if (result.Count > 0)
140 { 140 {
141 foundAsset = (AssetStorage)result.Next(); 141 foundAsset = (AssetStorage)result.Next();
142 found = true; 142 found = true;
143 } 143 }
144 144
145 AssetBase asset = new AssetBase(); 145 AssetBase asset = new AssetBase();
146 if (found) 146 if (found)
147 { 147 {
148 asset.FullID = foundAsset.UUID; 148 asset.FullID = foundAsset.UUID;
149 asset.Type = foundAsset.Type; 149 asset.Type = foundAsset.Type;
150 asset.InvType = foundAsset.Type; 150 asset.InvType = foundAsset.Type;
151 asset.Name = foundAsset.Name; 151 asset.Name = foundAsset.Name;
152 idata = foundAsset.Data; 152 idata = foundAsset.Data;
153 } 153 }
154 else 154 else
155 { 155 {
156 asset.FullID = LLUUID.Zero; 156 asset.FullID = LLUUID.Zero;
157 } 157 }
158 asset.Data = idata; 158 asset.Data = idata;
159 _receiver.AssetReceived(asset, req.IsTexture); 159 _receiver.AssetReceived(asset, req.IsTexture);
160 } 160 }
161 161
162 } 162 }
163 163
164 private void SetUpAssetDatabase() 164 private void SetUpAssetDatabase()
165 { 165 {
166 try 166 try
167 { 167 {
168 168
169 MainLog.Instance.Verbose( "Setting up asset database"); 169 MainLog.Instance.Verbose( "Setting up asset database");
170 170
171 AssetBase Image = new AssetBase(); 171 AssetBase Image = new AssetBase();
172 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); 172 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
173 Image.Name = "Bricks"; 173 Image.Name = "Bricks";
174 this.LoadAsset(Image, true, "bricks.jp2"); 174 this.LoadAsset(Image, true, "bricks.jp2");
175 AssetStorage store = new AssetStorage(); 175 AssetStorage store = new AssetStorage();
176 store.Data = Image.Data; 176 store.Data = Image.Data;
177 store.Name = Image.Name; 177 store.Name = Image.Name;
178 store.UUID = Image.FullID; 178 store.UUID = Image.FullID;
179 db.Set(store); 179 db.Set(store);
180 db.Commit(); 180 db.Commit();
181 181
182 Image = new AssetBase(); 182 Image = new AssetBase();
183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); 183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
184 Image.Name = "Plywood"; 184 Image.Name = "Plywood";
185 this.LoadAsset(Image, true, "plywood.jp2"); 185 this.LoadAsset(Image, true, "plywood.jp2");
186 store = new AssetStorage(); 186 store = new AssetStorage();
187 store.Data = Image.Data; 187 store.Data = Image.Data;
188 store.Name = Image.Name; 188 store.Name = Image.Name;
189 store.UUID = Image.FullID; 189 store.UUID = Image.FullID;
190 db.Set(store); 190 db.Set(store);
191 db.Commit(); 191 db.Commit();
192 192
193 Image = new AssetBase(); 193 Image = new AssetBase();
194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); 194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
195 Image.Name = "Rocks"; 195 Image.Name = "Rocks";
196 this.LoadAsset(Image, true, "rocks.jp2"); 196 this.LoadAsset(Image, true, "rocks.jp2");
197 store = new AssetStorage(); 197 store = new AssetStorage();
198 store.Data = Image.Data; 198 store.Data = Image.Data;
199 store.Name = Image.Name; 199 store.Name = Image.Name;
200 store.UUID = Image.FullID; 200 store.UUID = Image.FullID;
201 db.Set(store); 201 db.Set(store);
202 db.Commit(); 202 db.Commit();
203 203
204 Image = new AssetBase(); 204 Image = new AssetBase();
205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); 205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
206 Image.Name = "Granite"; 206 Image.Name = "Granite";
207 this.LoadAsset(Image, true, "granite.jp2"); 207 this.LoadAsset(Image, true, "granite.jp2");
208 store = new AssetStorage(); 208 store = new AssetStorage();
209 store.Data = Image.Data; 209 store.Data = Image.Data;
210 store.Name = Image.Name; 210 store.Name = Image.Name;
211 store.UUID = Image.FullID; 211 store.UUID = Image.FullID;
212 db.Set(store); 212 db.Set(store);
213 db.Commit(); 213 db.Commit();
214 214
215 Image = new AssetBase(); 215 Image = new AssetBase();
216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); 216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
217 Image.Name = "Hardwood"; 217 Image.Name = "Hardwood";
218 this.LoadAsset(Image, true, "hardwood.jp2"); 218 this.LoadAsset(Image, true, "hardwood.jp2");
219 store = new AssetStorage(); 219 store = new AssetStorage();
220 store.Data = Image.Data; 220 store.Data = Image.Data;
221 store.Name = Image.Name; 221 store.Name = Image.Name;
222 store.UUID = Image.FullID; 222 store.UUID = Image.FullID;
223 db.Set(store); 223 db.Set(store);
224 db.Commit(); 224 db.Commit();
225 225
226 Image = new AssetBase(); 226 Image = new AssetBase();
227 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); 227 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
228 Image.Name = "Prim Base Texture"; 228 Image.Name = "Prim Base Texture";
229 this.LoadAsset(Image, true, "plywood.jp2"); 229 this.LoadAsset(Image, true, "plywood.jp2");
230 store = new AssetStorage(); 230 store = new AssetStorage();
231 store.Data = Image.Data; 231 store.Data = Image.Data;
232 store.Name = Image.Name; 232 store.Name = Image.Name;
233 store.UUID = Image.FullID; 233 store.UUID = Image.FullID;
234 db.Set(store); 234 db.Set(store);
235 db.Commit(); 235 db.Commit();
236 236
237 Image = new AssetBase(); 237 Image = new AssetBase();
238 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); 238 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
239 Image.Name = "Map Base Texture"; 239 Image.Name = "Map Base Texture";
240 this.LoadAsset(Image, true, "map_base.jp2"); 240 this.LoadAsset(Image, true, "map_base.jp2");
241 store = new AssetStorage(); 241 store = new AssetStorage();
242 store.Data = Image.Data; 242 store.Data = Image.Data;
243 store.Name = Image.Name; 243 store.Name = Image.Name;
244 store.UUID = Image.FullID; 244 store.UUID = Image.FullID;
245 db.Set(store); 245 db.Set(store);
246 db.Commit(); 246 db.Commit();
247 247
248 Image = new AssetBase(); 248 Image = new AssetBase();
249 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); 249 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
250 Image.Name = "Map Texture"; 250 Image.Name = "Map Texture";
251 this.LoadAsset(Image, true, "map1.jp2"); 251 this.LoadAsset(Image, true, "map1.jp2");
252 store = new AssetStorage(); 252 store = new AssetStorage();
253 store.Data = Image.Data; 253 store.Data = Image.Data;
254 store.Name = Image.Name; 254 store.Name = Image.Name;
255 store.UUID = Image.FullID; 255 store.UUID = Image.FullID;
256 db.Set(store); 256 db.Set(store);
257 db.Commit(); 257 db.Commit();
258 258
259 Image = new AssetBase(); 259 Image = new AssetBase();
260 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 260 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
261 Image.Name = "Shape"; 261 Image.Name = "Shape";
262 this.LoadAsset(Image, false, "base_shape.dat"); 262 this.LoadAsset(Image, false, "base_shape.dat");
263 store = new AssetStorage(); 263 store = new AssetStorage();
264 store.Data = Image.Data; 264 store.Data = Image.Data;
265 store.Name = Image.Name; 265 store.Name = Image.Name;
266 store.UUID = Image.FullID; 266 store.UUID = Image.FullID;
267 db.Set(store); 267 db.Set(store);
268 db.Commit(); 268 db.Commit();
269 } 269 }
270 catch (Exception e) 270 catch (Exception e)
271 { 271 {
272 Console.WriteLine("exception loading default assets into database"); 272 Console.WriteLine("exception loading default assets into database");
273 Console.WriteLine(e.Message); 273 Console.WriteLine(e.Message);
274 } 274 }
275 275
276 } 276 }
277 277
278 private void LoadAsset(AssetBase info, bool image, string filename) 278 private void LoadAsset(AssetBase info, bool image, string filename)
279 { 279 {
280 //should request Asset from storage manager 280 //should request Asset from storage manager
281 //but for now read from file 281 //but for now read from file
282 282
283 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; 283 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
284 string fileName = Path.Combine(dataPath, filename); 284 string fileName = Path.Combine(dataPath, filename);
285 FileInfo fInfo = new FileInfo(fileName); 285 FileInfo fInfo = new FileInfo(fileName);
286 long numBytes = fInfo.Length; 286 long numBytes = fInfo.Length;
287 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 287 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
288 byte[] idata = new byte[numBytes]; 288 byte[] idata = new byte[numBytes];
289 BinaryReader br = new BinaryReader(fStream); 289 BinaryReader br = new BinaryReader(fStream);
290 idata = br.ReadBytes((int)numBytes); 290 idata = br.ReadBytes((int)numBytes);
291 br.Close(); 291 br.Close();
292 fStream.Close(); 292 fStream.Close();
293 info.Data = idata; 293 info.Data = idata;
294 //info.loaded=true; 294 //info.loaded=true;
295 } 295 }
296 } 296 }
297 public class AssetUUIDQuery : Predicate 297 public class AssetUUIDQuery : Predicate
298 { 298 {
299 private LLUUID _findID; 299 private LLUUID _findID;
300 300
301 public AssetUUIDQuery(LLUUID find) 301 public AssetUUIDQuery(LLUUID find)
302 { 302 {
303 _findID = find; 303 _findID = find;
304 } 304 }
305 public bool Match(AssetStorage asset) 305 public bool Match(AssetStorage asset)
306 { 306 {
307 return (asset.UUID == _findID); 307 return (asset.UUID == _findID);
308 } 308 }
309 } 309 }
310 310
311} 311}
diff --git a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs
index 1e15c5e..a658f2f 100644
--- a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs
+++ b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("RemoteGridServers")] 36[assembly: AssemblyTitle("RemoteGridServers")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("RemoteGridServers")] 40[assembly: AssemblyProduct("RemoteGridServers")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs
index 8643736..f81bb8d 100644
--- a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs
+++ b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs
@@ -1,133 +1,133 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.IO; 28using System.IO;
29using System.Net; 29using System.Net;
30using System.Text; 30using System.Text;
31using System.Threading; 31using System.Threading;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37 37
38namespace OpenSim.Region.GridInterfaces.Remote 38namespace OpenSim.Region.GridInterfaces.Remote
39{ 39{
40 public class RemoteAssetServer : IAssetServer 40 public class RemoteAssetServer : IAssetServer
41 { 41 {
42 private IAssetReceiver _receiver; 42 private IAssetReceiver _receiver;
43 private BlockingQueue<ARequest> _assetRequests; 43 private BlockingQueue<ARequest> _assetRequests;
44 private Thread _remoteAssetServerThread; 44 private Thread _remoteAssetServerThread;
45 private string AssetServerUrl; 45 private string AssetServerUrl;
46 private string AssetSendKey; 46 private string AssetSendKey;
47 47
48 public RemoteAssetServer() 48 public RemoteAssetServer()
49 { 49 {
50 this._assetRequests = new BlockingQueue<ARequest>(); 50 this._assetRequests = new BlockingQueue<ARequest>();
51 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); 51 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
52 this._remoteAssetServerThread.IsBackground = true; 52 this._remoteAssetServerThread.IsBackground = true;
53 this._remoteAssetServerThread.Start(); 53 this._remoteAssetServerThread.Start();
54 MainLog.Instance.Verbose("Remote Asset Server class created"); 54 MainLog.Instance.Verbose("Remote Asset Server class created");
55 } 55 }
56 56
57 public void SetReceiver(IAssetReceiver receiver) 57 public void SetReceiver(IAssetReceiver receiver)
58 { 58 {
59 this._receiver = receiver; 59 this._receiver = receiver;
60 } 60 }
61 61
62 public void RequestAsset(LLUUID assetID, bool isTexture) 62 public void RequestAsset(LLUUID assetID, bool isTexture)
63 { 63 {
64 ARequest req = new ARequest(); 64 ARequest req = new ARequest();
65 req.AssetID = assetID; 65 req.AssetID = assetID;
66 req.IsTexture = isTexture; 66 req.IsTexture = isTexture;
67 this._assetRequests.Enqueue(req); 67 this._assetRequests.Enqueue(req);
68 } 68 }
69 69
70 public void UpdateAsset(AssetBase asset) 70 public void UpdateAsset(AssetBase asset)
71 { 71 {
72 72
73 } 73 }
74 74
75 public void UploadNewAsset(AssetBase asset) 75 public void UploadNewAsset(AssetBase asset)
76 { 76 {
77 Encoding Windows1252Encoding = Encoding.GetEncoding(1252); 77 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
78 string ret = Windows1252Encoding.GetString(asset.Data); 78 string ret = Windows1252Encoding.GetString(asset.Data);
79 byte[] buffer = Windows1252Encoding.GetBytes(ret); 79 byte[] buffer = Windows1252Encoding.GetBytes(ret);
80 WebClient client = new WebClient(); 80 WebClient client = new WebClient();
81 client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer); 81 client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer);
82 82
83 } 83 }
84 84
85 public void SetServerInfo(string ServerUrl, string ServerKey) 85 public void SetServerInfo(string ServerUrl, string ServerKey)
86 { 86 {
87 this.AssetServerUrl = ServerUrl; 87 this.AssetServerUrl = ServerUrl;
88 this.AssetSendKey = ServerKey; 88 this.AssetSendKey = ServerKey;
89 } 89 }
90 90
91 private void RunRequests() 91 private void RunRequests()
92 { 92 {
93 while (true) 93 while (true)
94 { 94 {
95 //we need to add support for the asset server not knowing about a requested asset 95 //we need to add support for the asset server not knowing about a requested asset
96 // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM 96 // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM
97 ARequest req = this._assetRequests.Dequeue(); 97 ARequest req = this._assetRequests.Dequeue();
98 LLUUID assetID = req.AssetID; 98 LLUUID assetID = req.AssetID;
99 // OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID); 99 // OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID);
100 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID); 100 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID);
101 WebResponse AssetResponse = AssetLoad.GetResponse(); 101 WebResponse AssetResponse = AssetLoad.GetResponse();
102 byte[] idata = new byte[(int)AssetResponse.ContentLength]; 102 byte[] idata = new byte[(int)AssetResponse.ContentLength];
103 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); 103 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
104 idata = br.ReadBytes((int)AssetResponse.ContentLength); 104 idata = br.ReadBytes((int)AssetResponse.ContentLength);
105 br.Close(); 105 br.Close();
106 106
107 AssetBase asset = new AssetBase(); 107 AssetBase asset = new AssetBase();
108 asset.FullID = assetID; 108 asset.FullID = assetID;
109 asset.Data = idata; 109 asset.Data = idata;
110 _receiver.AssetReceived(asset, req.IsTexture); 110 _receiver.AssetReceived(asset, req.IsTexture);
111 } 111 }
112 } 112 }
113 113
114 public void Close() 114 public void Close()
115 { 115 {
116 116
117 } 117 }
118 } 118 }
119 119
120 public class RemoteAssetPlugin : IAssetPlugin 120 public class RemoteAssetPlugin : IAssetPlugin
121 { 121 {
122 public RemoteAssetPlugin() 122 public RemoteAssetPlugin()
123 { 123 {
124 124
125 } 125 }
126 126
127 public IAssetServer GetAssetServer() 127 public IAssetServer GetAssetServer()
128 { 128 {
129 return (new RemoteAssetServer()); 129 return (new RemoteAssetServer());
130 } 130 }
131 } 131 }
132 132
133} 133}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
index ce567a9..ecf8e68 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("PhysXplugin")] 36[assembly: AssemblyTitle("PhysXplugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("PhysXplugin")] 40[assembly: AssemblyProduct("PhysXplugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index f133045..ec406f1 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -1,301 +1,301 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using Axiom.Math; 29using Axiom.Math;
30using OpenSim.Physics.Manager; 30using OpenSim.Physics.Manager;
31 31
32namespace OpenSim.Region.Physics.BasicPhysicsPlugin 32namespace OpenSim.Region.Physics.BasicPhysicsPlugin
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Will be the PhysX plugin but for now will be a very basic physics engine 35 /// Will be the PhysX plugin but for now will be a very basic physics engine
36 /// </summary> 36 /// </summary>
37 public class BasicPhysicsPlugin : IPhysicsPlugin 37 public class BasicPhysicsPlugin : IPhysicsPlugin
38 { 38 {
39 private BasicScene _mScene; 39 private BasicScene _mScene;
40 40
41 public BasicPhysicsPlugin() 41 public BasicPhysicsPlugin()
42 { 42 {
43 43
44 } 44 }
45 45
46 public bool Init() 46 public bool Init()
47 { 47 {
48 return true; 48 return true;
49 } 49 }
50 50
51 public PhysicsScene GetScene() 51 public PhysicsScene GetScene()
52 { 52 {
53 return new BasicScene(); 53 return new BasicScene();
54 } 54 }
55 55
56 public string GetName() 56 public string GetName()
57 { 57 {
58 return("basicphysics"); 58 return("basicphysics");
59 } 59 }
60 60
61 public void Dispose() 61 public void Dispose()
62 { 62 {
63 63
64 } 64 }
65 } 65 }
66 66
67 public class BasicScene :PhysicsScene 67 public class BasicScene :PhysicsScene
68 { 68 {
69 private List<BasicActor> _actors = new List<BasicActor>(); 69 private List<BasicActor> _actors = new List<BasicActor>();
70 private float[] _heightMap; 70 private float[] _heightMap;
71 71
72 public BasicScene() 72 public BasicScene()
73 { 73 {
74 74
75 } 75 }
76 76
77 public override PhysicsActor AddAvatar(PhysicsVector position) 77 public override PhysicsActor AddAvatar(PhysicsVector position)
78 { 78 {
79 BasicActor act = new BasicActor(); 79 BasicActor act = new BasicActor();
80 act.Position = position; 80 act.Position = position;
81 _actors.Add(act); 81 _actors.Add(act);
82 return act; 82 return act;
83 } 83 }
84 84
85 public override void RemoveAvatar(PhysicsActor actor) 85 public override void RemoveAvatar(PhysicsActor actor)
86 { 86 {
87 BasicActor act = (BasicActor)actor; 87 BasicActor act = (BasicActor)actor;
88 if(_actors.Contains(act)) 88 if(_actors.Contains(act))
89 { 89 {
90 _actors.Remove(act); 90 _actors.Remove(act);
91 } 91 }
92 92
93 } 93 }
94 94
95 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 95 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
96 { 96 {
97 return null; 97 return null;
98 } 98 }
99 99
100 public override void Simulate(float timeStep) 100 public override void Simulate(float timeStep)
101 { 101 {
102 foreach (BasicActor actor in _actors) 102 foreach (BasicActor actor in _actors)
103 { 103 {
104 if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) 104 if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256))
105 { 105 {
106 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; 106 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;
107 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); 107 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
108 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); 108 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
109 if (actor.Flying) 109 if (actor.Flying)
110 { 110 {
111 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < 111 if (actor.Position.Z + (actor.Velocity.Z * timeStep) <
112 _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2) 112 _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
113 { 113 {
114 actor.Position.Z = height; 114 actor.Position.Z = height;
115 actor.Velocity.Z = 0; 115 actor.Velocity.Z = 0;
116 } 116 }
117 else 117 else
118 { 118 {
119 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); 119 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
120 } 120 }
121 } 121 }
122 else 122 else
123 { 123 {
124 actor.Position.Z = height; 124 actor.Position.Z = height;
125 actor.Velocity.Z = 0; 125 actor.Velocity.Z = 0;
126 } 126 }
127 } 127 }
128 else 128 else
129 { 129 {
130 if (actor.Position.Y < 0) 130 if (actor.Position.Y < 0)
131 { 131 {
132 actor.Position.Y = 0; 132 actor.Position.Y = 0;
133 } 133 }
134 else if (actor.Position.Y > 256) 134 else if (actor.Position.Y > 256)
135 { 135 {
136 actor.Position.Y = 256; 136 actor.Position.Y = 256;
137 } 137 }
138 138
139 if (actor.Position.X < 0) 139 if (actor.Position.X < 0)
140 { 140 {
141 actor.Position.X = 0; 141 actor.Position.X = 0;
142 } 142 }
143 if (actor.Position.X > 256) 143 if (actor.Position.X > 256)
144 { 144 {
145 actor.Position.X = 256; 145 actor.Position.X = 256;
146 } 146 }
147 } 147 }
148 //} 148 //}
149 149
150 150
151 151
152 // This code needs sorting out - border crossings etc 152 // This code needs sorting out - border crossings etc
153/* if(actor.Position.X<0) 153/* if(actor.Position.X<0)
154 { 154 {
155 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 155 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
156 actor.Position.X = 0; 156 actor.Position.X = 0;
157 actor.Velocity.X = 0; 157 actor.Velocity.X = 0;
158 } 158 }
159 if(actor.Position.Y < 0) 159 if(actor.Position.Y < 0)
160 { 160 {
161 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 161 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
162 actor.Position.Y = 0; 162 actor.Position.Y = 0;
163 actor.Velocity.Y = 0; 163 actor.Velocity.Y = 0;
164 } 164 }
165 if(actor.Position.X > 255) 165 if(actor.Position.X > 255)
166 { 166 {
167 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 167 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
168 actor.Position.X = 255; 168 actor.Position.X = 255;
169 actor.Velocity.X = 0; 169 actor.Velocity.X = 0;
170 } 170 }
171 if(actor.Position.Y > 255) 171 if(actor.Position.Y > 255)
172 { 172 {
173 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 173 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
174 actor.Position.Y = 255; 174 actor.Position.Y = 255;
175 actor.Velocity.X = 0; 175 actor.Velocity.X = 0;
176 }*/ 176 }*/
177 } 177 }
178 } 178 }
179 179
180 public override void GetResults() 180 public override void GetResults()
181 { 181 {
182 182
183 } 183 }
184 184
185 public override bool IsThreaded 185 public override bool IsThreaded
186 { 186 {
187 get 187 get
188 { 188 {
189 return(false); // for now we won't be multithreaded 189 return(false); // for now we won't be multithreaded
190 } 190 }
191 } 191 }
192 192
193 public override void SetTerrain(float[] heightMap) 193 public override void SetTerrain(float[] heightMap)
194 { 194 {
195 this._heightMap = heightMap; 195 this._heightMap = heightMap;
196 } 196 }
197 197
198 public override void DeleteTerrain() 198 public override void DeleteTerrain()
199 { 199 {
200 200
201 } 201 }
202 } 202 }
203 203
204 public class BasicActor : PhysicsActor 204 public class BasicActor : PhysicsActor
205 { 205 {
206 private PhysicsVector _position; 206 private PhysicsVector _position;
207 private PhysicsVector _velocity; 207 private PhysicsVector _velocity;
208 private PhysicsVector _acceleration; 208 private PhysicsVector _acceleration;
209 private bool flying; 209 private bool flying;
210 public BasicActor() 210 public BasicActor()
211 { 211 {
212 _velocity = new PhysicsVector(); 212 _velocity = new PhysicsVector();
213 _position = new PhysicsVector(); 213 _position = new PhysicsVector();
214 _acceleration = new PhysicsVector(); 214 _acceleration = new PhysicsVector();
215 } 215 }
216 216
217 public override bool Flying 217 public override bool Flying
218 { 218 {
219 get 219 get
220 { 220 {
221 return flying; 221 return flying;
222 } 222 }
223 set 223 set
224 { 224 {
225 flying= value; 225 flying= value;
226 } 226 }
227 } 227 }
228 228
229 public override PhysicsVector Position 229 public override PhysicsVector Position
230 { 230 {
231 get 231 get
232 { 232 {
233 return _position; 233 return _position;
234 } 234 }
235 set 235 set
236 { 236 {
237 _position = value; 237 _position = value;
238 } 238 }
239 } 239 }
240 240
241 public override PhysicsVector Velocity 241 public override PhysicsVector Velocity
242 { 242 {
243 get 243 get
244 { 244 {
245 return _velocity; 245 return _velocity;
246 } 246 }
247 set 247 set
248 { 248 {
249 _velocity = value; 249 _velocity = value;
250 } 250 }
251 } 251 }
252 252
253 public override Quaternion Orientation 253 public override Quaternion Orientation
254 { 254 {
255 get 255 get
256 { 256 {
257 return Quaternion.Identity; 257 return Quaternion.Identity;
258 } 258 }
259 set 259 set
260 { 260 {
261 261
262 } 262 }
263 } 263 }
264 264
265 public override PhysicsVector Acceleration 265 public override PhysicsVector Acceleration
266 { 266 {
267 get 267 get
268 { 268 {
269 return _acceleration; 269 return _acceleration;
270 } 270 }
271 271
272 } 272 }
273 273
274 public override bool Kinematic 274 public override bool Kinematic
275 { 275 {
276 get 276 get
277 { 277 {
278 return true; 278 return true;
279 } 279 }
280 set 280 set
281 { 281 {
282 282
283 } 283 }
284 } 284 }
285 public void SetAcceleration (PhysicsVector accel) 285 public void SetAcceleration (PhysicsVector accel)
286 { 286 {
287 this._acceleration = accel; 287 this._acceleration = accel;
288 } 288 }
289 289
290 public override void AddForce(PhysicsVector force) 290 public override void AddForce(PhysicsVector force)
291 { 291 {
292 292
293 } 293 }
294 294
295 public override void SetMomentum(PhysicsVector momentum) 295 public override void SetMomentum(PhysicsVector momentum)
296 { 296 {
297 297
298 } 298 }
299 } 299 }
300 300
301} 301}
diff --git a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
index bda35f7..42ccdff 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("BulletXPlugin")] 36[assembly: AssemblyTitle("BulletXPlugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("BulletXPlugin")] 40[assembly: AssemblyProduct("BulletXPlugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.0.0")] 56[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 1ca5efe..383dbc0 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -1,534 +1,534 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28#region References 28#region References
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Physics.Manager; 31using OpenSim.Physics.Manager;
32using Axiom.Math; 32using Axiom.Math;
33//Specific References for BulletXPlugin 33//Specific References for BulletXPlugin
34using MonoXnaCompactMaths; 34using MonoXnaCompactMaths;
35using XnaDevRu.BulletX; 35using XnaDevRu.BulletX;
36using XnaDevRu.BulletX.Dynamics; 36using XnaDevRu.BulletX.Dynamics;
37#endregion 37#endregion
38 38
39namespace OpenSim.Region.Physics.BulletXPlugin 39namespace OpenSim.Region.Physics.BulletXPlugin
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// This Class converts objects and types for BulletX 42 /// This Class converts objects and types for BulletX
43 /// </summary> 43 /// </summary>
44 public class BulletXConversions 44 public class BulletXConversions
45 { 45 {
46 public static MonoXnaCompactMaths.Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) 46 public static MonoXnaCompactMaths.Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector)
47 { 47 {
48 return new MonoXnaCompactMaths.Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); 48 return new MonoXnaCompactMaths.Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
49 } 49 }
50 public static void PhysicsVectorToXnaVector3(PhysicsVector physicsVector, out MonoXnaCompactMaths.Vector3 XnaVector3) 50 public static void PhysicsVectorToXnaVector3(PhysicsVector physicsVector, out MonoXnaCompactMaths.Vector3 XnaVector3)
51 { 51 {
52 XnaVector3.X = physicsVector.X; 52 XnaVector3.X = physicsVector.X;
53 XnaVector3.Y = physicsVector.Y; 53 XnaVector3.Y = physicsVector.Y;
54 XnaVector3.Z = physicsVector.Z; 54 XnaVector3.Z = physicsVector.Z;
55 } 55 }
56 public static PhysicsVector XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3) 56 public static PhysicsVector XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3)
57 { 57 {
58 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); 58 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
59 } 59 }
60 /*public static void XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3, out PhysicsVector physicsVector) 60 /*public static void XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3, out PhysicsVector physicsVector)
61 { 61 {
62 xnaVector3.X = physicsVector.X; 62 xnaVector3.X = physicsVector.X;
63 xnaVector3.Y = physicsVector.Y; 63 xnaVector3.Y = physicsVector.Y;
64 xnaVector3.Z = physicsVector.Z; 64 xnaVector3.Z = physicsVector.Z;
65 }*/ 65 }*/
66 #region Axiom and Xna 66 #region Axiom and Xna
67 ///// <summary> 67 ///// <summary>
68 ///// BTW maybe some conversions will be a simply converion that it doesn't require this class, but i don't know 68 ///// BTW maybe some conversions will be a simply converion that it doesn't require this class, but i don't know
69 ///// </summary> 69 ///// </summary>
70 ///// <param name="AxiomVector3"></param> 70 ///// <param name="AxiomVector3"></param>
71 ///// <returns></returns> 71 ///// <returns></returns>
72 //public static MonoXnaCompactMaths.Vector3 Vector3AxiomToXna(Axiom.Math.Vector3 AxiomVector3) 72 //public static MonoXnaCompactMaths.Vector3 Vector3AxiomToXna(Axiom.Math.Vector3 AxiomVector3)
73 //{ 73 //{
74 // return new MonoXnaCompactMaths.Vector3(AxiomVector3.x, AxiomVector3.y, AxiomVector3.z); 74 // return new MonoXnaCompactMaths.Vector3(AxiomVector3.x, AxiomVector3.y, AxiomVector3.z);
75 //} 75 //}
76 #endregion 76 #endregion
77 } 77 }
78 /// <summary> 78 /// <summary>
79 /// PhysicsPlugin Class for BulletX 79 /// PhysicsPlugin Class for BulletX
80 /// </summary> 80 /// </summary>
81 public class BulletXPlugin : IPhysicsPlugin 81 public class BulletXPlugin : IPhysicsPlugin
82 { 82 {
83 private BulletXScene _mScene; 83 private BulletXScene _mScene;
84 84
85 public BulletXPlugin() 85 public BulletXPlugin()
86 { 86 {
87 } 87 }
88 public bool Init() 88 public bool Init()
89 { 89 {
90 return true; 90 return true;
91 } 91 }
92 public PhysicsScene GetScene() 92 public PhysicsScene GetScene()
93 { 93 {
94 if (_mScene == null) 94 if (_mScene == null)
95 { 95 {
96 _mScene = new BulletXScene(); 96 _mScene = new BulletXScene();
97 } 97 }
98 return (_mScene); 98 return (_mScene);
99 } 99 }
100 public string GetName() 100 public string GetName()
101 { 101 {
102 return ("BulletXEngine"); 102 return ("BulletXEngine");
103 } 103 }
104 public void Dispose() 104 public void Dispose()
105 { 105 {
106 } 106 }
107 } 107 }
108 /// <summary> 108 /// <summary>
109 /// PhysicsScene Class for BulletX 109 /// PhysicsScene Class for BulletX
110 /// </summary> 110 /// </summary>
111 public class BulletXScene : PhysicsScene 111 public class BulletXScene : PhysicsScene
112 { 112 {
113 public DiscreteDynamicsWorld ddWorld; 113 public DiscreteDynamicsWorld ddWorld;
114 private CollisionDispatcher cDispatcher; 114 private CollisionDispatcher cDispatcher;
115 private OverlappingPairCache opCache; 115 private OverlappingPairCache opCache;
116 private SequentialImpulseConstraintSolver sicSolver; 116 private SequentialImpulseConstraintSolver sicSolver;
117 117
118 private const int minXY = 0; 118 private const int minXY = 0;
119 private const int minZ = 0; 119 private const int minZ = 0;
120 private const int maxXY = 256; 120 private const int maxXY = 256;
121 private const int maxZ = 4096; 121 private const int maxZ = 4096;
122 private const int maxHandles = 32766; //Why? I don't know 122 private const int maxHandles = 32766; //Why? I don't know
123 private static float gravity = 9.8f; 123 private static float gravity = 9.8f;
124 private static float heightLevel0 = 77.0f; 124 private static float heightLevel0 = 77.0f;
125 private static float heightLevel1 = 200.0f; 125 private static float heightLevel1 = 200.0f;
126 private static float lowGravityFactor = 0.2f; 126 private static float lowGravityFactor = 0.2f;
127 127
128 private float[] _heightmap; 128 private float[] _heightmap;
129 private List<BulletXCharacter> _characters = new List<BulletXCharacter>(); 129 private List<BulletXCharacter> _characters = new List<BulletXCharacter>();
130 130
131 public static float Gravity { get { return gravity; } } 131 public static float Gravity { get { return gravity; } }
132 public static float HeightLevel0 { get { return heightLevel0; } } 132 public static float HeightLevel0 { get { return heightLevel0; } }
133 public static float HeightLevel1 { get { return heightLevel1; } } 133 public static float HeightLevel1 { get { return heightLevel1; } }
134 public static float LowGravityFactor { get { return lowGravityFactor; } } 134 public static float LowGravityFactor { get { return lowGravityFactor; } }
135 135
136 public BulletXScene() 136 public BulletXScene()
137 { 137 {
138 cDispatcher = new CollisionDispatcher(); 138 cDispatcher = new CollisionDispatcher();
139 MonoXnaCompactMaths.Vector3 worldMinDim = new MonoXnaCompactMaths.Vector3((float)minXY, (float)minXY, (float)minZ); 139 MonoXnaCompactMaths.Vector3 worldMinDim = new MonoXnaCompactMaths.Vector3((float)minXY, (float)minXY, (float)minZ);
140 MonoXnaCompactMaths.Vector3 worldMaxDim = new MonoXnaCompactMaths.Vector3((float)maxXY, (float)maxXY, (float)maxZ); 140 MonoXnaCompactMaths.Vector3 worldMaxDim = new MonoXnaCompactMaths.Vector3((float)maxXY, (float)maxXY, (float)maxZ);
141 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles); 141 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles);
142 sicSolver = new SequentialImpulseConstraintSolver(); 142 sicSolver = new SequentialImpulseConstraintSolver();
143 143
144 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver); 144 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver);
145 ddWorld.Gravity = new MonoXnaCompactMaths.Vector3(0, 0, -gravity); 145 ddWorld.Gravity = new MonoXnaCompactMaths.Vector3(0, 0, -gravity);
146 146
147 this._heightmap = new float[65536]; 147 this._heightmap = new float[65536];
148 } 148 }
149 149
150 public override PhysicsActor AddAvatar(PhysicsVector position) 150 public override PhysicsActor AddAvatar(PhysicsVector position)
151 { 151 {
152 PhysicsVector pos = new PhysicsVector(); 152 PhysicsVector pos = new PhysicsVector();
153 pos.X = position.X; 153 pos.X = position.X;
154 pos.Y = position.Y; 154 pos.Y = position.Y;
155 pos.Z = position.Z + 20; 155 pos.Z = position.Z + 20;
156 BulletXCharacter newAv = new BulletXCharacter(this, pos); 156 BulletXCharacter newAv = new BulletXCharacter(this, pos);
157 this._characters.Add(newAv); 157 this._characters.Add(newAv);
158 return newAv; 158 return newAv;
159 } 159 }
160 160
161 public override void RemoveAvatar(PhysicsActor actor) 161 public override void RemoveAvatar(PhysicsActor actor)
162 { 162 {
163 163
164 } 164 }
165 165
166 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 166 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
167 { 167 {
168 PhysicsVector pos = new PhysicsVector(); 168 PhysicsVector pos = new PhysicsVector();
169 pos.X = position.X; 169 pos.X = position.X;
170 pos.Y = position.Y; 170 pos.Y = position.Y;
171 pos.Z = position.Z; 171 pos.Z = position.Z;
172 PhysicsVector siz = new PhysicsVector(); 172 PhysicsVector siz = new PhysicsVector();
173 siz.X = size.X; 173 siz.X = size.X;
174 siz.Y = size.Y; 174 siz.Y = size.Y;
175 siz.Z = size.Z; 175 siz.Z = size.Z;
176 return new BulletXPrim(); 176 return new BulletXPrim();
177 } 177 }
178 178
179 public override void Simulate(float timeStep) 179 public override void Simulate(float timeStep)
180 { 180 {
181 foreach (BulletXCharacter actor in _characters) 181 foreach (BulletXCharacter actor in _characters)
182 { 182 {
183 actor.Move(timeStep); 183 actor.Move(timeStep);
184 184
185 } 185 }
186 ddWorld.StepSimulation(timeStep, 0, timeStep); 186 ddWorld.StepSimulation(timeStep, 0, timeStep);
187 foreach (BulletXCharacter actor in _characters) 187 foreach (BulletXCharacter actor in _characters)
188 { 188 {
189 actor.ValidateHeight(this._heightmap[ 189 actor.ValidateHeight(this._heightmap[
190 (int)Math.Round(actor.RigidBodyHorizontalPosition.x) * 256 190 (int)Math.Round(actor.RigidBodyHorizontalPosition.x) * 256
191 + (int)Math.Round(actor.RigidBodyHorizontalPosition.y)]); 191 + (int)Math.Round(actor.RigidBodyHorizontalPosition.y)]);
192 } 192 }
193 foreach (BulletXCharacter actor in _characters) 193 foreach (BulletXCharacter actor in _characters)
194 { 194 {
195 actor.UpdatePosition(); 195 actor.UpdatePosition();
196 } 196 }
197 197
198 } 198 }
199 199
200 public override void GetResults() 200 public override void GetResults()
201 { 201 {
202 202
203 } 203 }
204 204
205 public override bool IsThreaded 205 public override bool IsThreaded
206 { 206 {
207 get 207 get
208 { 208 {
209 return (false); // for now we won't be multithreaded 209 return (false); // for now we won't be multithreaded
210 } 210 }
211 } 211 }
212 212
213 public override void SetTerrain(float[] heightMap) 213 public override void SetTerrain(float[] heightMap)
214 { 214 {
215 //As the same as ODE, heightmap (x,y) must be swapped for BulletX 215 //As the same as ODE, heightmap (x,y) must be swapped for BulletX
216 for (int i = 0; i < 65536; i++) 216 for (int i = 0; i < 65536; i++)
217 { 217 {
218 // this._heightmap[i] = (double)heightMap[i]; 218 // this._heightmap[i] = (double)heightMap[i];
219 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) 219 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...)
220 int x = i & 0xff; 220 int x = i & 0xff;
221 int y = i >> 8; 221 int y = i >> 8;
222 this._heightmap[i] = heightMap[x * 256 + y]; 222 this._heightmap[i] = heightMap[x * 256 + y];
223 } 223 }
224 } 224 }
225 225
226 public override void DeleteTerrain() 226 public override void DeleteTerrain()
227 { 227 {
228 228
229 } 229 }
230 } 230 }
231 /// <summary> 231 /// <summary>
232 /// PhysicsActor Character Class for BulletX 232 /// PhysicsActor Character Class for BulletX
233 /// </summary> 233 /// </summary>
234 public class BulletXCharacter : PhysicsActor 234 public class BulletXCharacter : PhysicsActor
235 { 235 {
236 private PhysicsVector _position; 236 private PhysicsVector _position;
237 private PhysicsVector _velocity; 237 private PhysicsVector _velocity;
238 private PhysicsVector _acceleration; 238 private PhysicsVector _acceleration;
239 private bool flying; 239 private bool flying;
240 private RigidBody rigidBody; 240 private RigidBody rigidBody;
241 public Axiom.Math.Vector2 RigidBodyHorizontalPosition 241 public Axiom.Math.Vector2 RigidBodyHorizontalPosition
242 { 242 {
243 get 243 get
244 { 244 {
245 return new Axiom.Math.Vector2(this.rigidBody.CenterOfMassPosition.X, this.rigidBody.CenterOfMassPosition.Y); 245 return new Axiom.Math.Vector2(this.rigidBody.CenterOfMassPosition.X, this.rigidBody.CenterOfMassPosition.Y);
246 } 246 }
247 } 247 }
248 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) 248 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos)
249 { 249 {
250 _velocity = new PhysicsVector(); 250 _velocity = new PhysicsVector();
251 _position = pos; 251 _position = pos;
252 _acceleration = new PhysicsVector(); 252 _acceleration = new PhysicsVector();
253 float _mass = 50.0f; //This depends of avatar's dimensions 253 float _mass = 50.0f; //This depends of avatar's dimensions
254 Matrix _startTransform = Matrix.Identity; 254 Matrix _startTransform = Matrix.Identity;
255 _startTransform.Translation = BulletXConversions.PhysicsVectorToXnaVector3(pos); 255 _startTransform.Translation = BulletXConversions.PhysicsVectorToXnaVector3(pos);
256 Matrix _centerOfMassOffset = Matrix.Identity; 256 Matrix _centerOfMassOffset = Matrix.Identity;
257 CollisionShape _collisionShape = new BoxShape(new MonoXnaCompactMaths.Vector3(0.5f, 0.5f, 1.60f)); 257 CollisionShape _collisionShape = new BoxShape(new MonoXnaCompactMaths.Vector3(0.5f, 0.5f, 1.60f));
258 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 258 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
259 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 259 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3();
260 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 260 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0
261 261
262 //The next values might change 262 //The next values might change
263 float _linearDamping = 0.0f; 263 float _linearDamping = 0.0f;
264 float _angularDamping = 0.0f; 264 float _angularDamping = 0.0f;
265 float _friction = 0.5f; 265 float _friction = 0.5f;
266 float _restitution = 0.0f; 266 float _restitution = 0.0f;
267 267
268 rigidBody = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 268 rigidBody = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution);
269 rigidBody.ActivationState = ActivationState.DisableDeactivation; 269 rigidBody.ActivationState = ActivationState.DisableDeactivation;
270 270
271 parent_scene.ddWorld.AddRigidBody(rigidBody); 271 parent_scene.ddWorld.AddRigidBody(rigidBody);
272 } 272 }
273 273
274 public override bool Flying 274 public override bool Flying
275 { 275 {
276 get 276 get
277 { 277 {
278 return flying; 278 return flying;
279 } 279 }
280 set 280 set
281 { 281 {
282 flying = value; 282 flying = value;
283 } 283 }
284 } 284 }
285 285
286 public override PhysicsVector Position 286 public override PhysicsVector Position
287 { 287 {
288 get 288 get
289 { 289 {
290 return _position; 290 return _position;
291 } 291 }
292 set 292 set
293 { 293 {
294 _position = value; 294 _position = value;
295 } 295 }
296 } 296 }
297 297
298 public override PhysicsVector Velocity 298 public override PhysicsVector Velocity
299 { 299 {
300 get 300 get
301 { 301 {
302 return _velocity; 302 return _velocity;
303 } 303 }
304 set 304 set
305 { 305 {
306 _velocity = value; 306 _velocity = value;
307 } 307 }
308 } 308 }
309 309
310 public override bool Kinematic 310 public override bool Kinematic
311 { 311 {
312 get 312 get
313 { 313 {
314 return false; 314 return false;
315 } 315 }
316 set 316 set
317 { 317 {
318 318
319 } 319 }
320 } 320 }
321 321
322 public override Axiom.Math.Quaternion Orientation 322 public override Axiom.Math.Quaternion Orientation
323 { 323 {
324 get 324 get
325 { 325 {
326 return Axiom.Math.Quaternion.Identity; 326 return Axiom.Math.Quaternion.Identity;
327 } 327 }
328 set 328 set
329 { 329 {
330 330
331 } 331 }
332 } 332 }
333 333
334 public override PhysicsVector Acceleration 334 public override PhysicsVector Acceleration
335 { 335 {
336 get 336 get
337 { 337 {
338 return _acceleration; 338 return _acceleration;
339 } 339 }
340 340
341 } 341 }
342 public void SetAcceleration(PhysicsVector accel) 342 public void SetAcceleration(PhysicsVector accel)
343 { 343 {
344 this._acceleration = accel; 344 this._acceleration = accel;
345 } 345 }
346 346
347 public override void AddForce(PhysicsVector force) 347 public override void AddForce(PhysicsVector force)
348 { 348 {
349 349
350 } 350 }
351 351
352 public override void SetMomentum(PhysicsVector momentum) 352 public override void SetMomentum(PhysicsVector momentum)
353 { 353 {
354 354
355 } 355 }
356 356
357 public void Move(float timeStep) 357 public void Move(float timeStep)
358 { 358 {
359 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3(); 359 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3();
360 //if (this._velocity.X == 0.0f) 360 //if (this._velocity.X == 0.0f)
361 // vec.X = this.rigidBody.LinearVelocity.X; //current velocity 361 // vec.X = this.rigidBody.LinearVelocity.X; //current velocity
362 //else 362 //else
363 vec.X = this._velocity.X; //overrides current velocity 363 vec.X = this._velocity.X; //overrides current velocity
364 364
365 //if (this._velocity.Y == 0.0f) 365 //if (this._velocity.Y == 0.0f)
366 // vec.Y = this.rigidBody.LinearVelocity.Y; //current velocity 366 // vec.Y = this.rigidBody.LinearVelocity.Y; //current velocity
367 //else 367 //else
368 vec.Y = this._velocity.Y; //overrides current velocity 368 vec.Y = this._velocity.Y; //overrides current velocity
369 369
370 float nextZVelocity; 370 float nextZVelocity;
371 //if (this._velocity.Z == 0.0f) 371 //if (this._velocity.Z == 0.0f)
372 // nextZVelocity = this.rigidBody.LinearVelocity.Z; //current velocity 372 // nextZVelocity = this.rigidBody.LinearVelocity.Z; //current velocity
373 //else 373 //else
374 nextZVelocity = this._velocity.Z; //overrides current velocity 374 nextZVelocity = this._velocity.Z; //overrides current velocity
375 375
376 if (flying) 376 if (flying)
377 { 377 {
378 //Antigravity with movement 378 //Antigravity with movement
379 if (this._position.Z <= BulletXScene.HeightLevel0) 379 if (this._position.Z <= BulletXScene.HeightLevel0)
380 { 380 {
381 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep; 381 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep;
382 } 382 }
383 //Lowgravity with movement 383 //Lowgravity with movement
384 else if((this._position.Z > BulletXScene.HeightLevel0) 384 else if((this._position.Z > BulletXScene.HeightLevel0)
385 && (this._position.Z <= BulletXScene.HeightLevel1)) 385 && (this._position.Z <= BulletXScene.HeightLevel1))
386 { 386 {
387 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 387 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
388 } 388 }
389 //Lowgravity with... 389 //Lowgravity with...
390 else if (this._position.Z > BulletXScene.HeightLevel1) 390 else if (this._position.Z > BulletXScene.HeightLevel1)
391 { 391 {
392 if(nextZVelocity > 0) //no movement 392 if(nextZVelocity > 0) //no movement
393 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 393 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
394 else 394 else
395 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 395 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
396 396
397 } 397 }
398 } 398 }
399 else 399 else
400 { 400 {
401 vec.Z = nextZVelocity; 401 vec.Z = nextZVelocity;
402 } 402 }
403 rigidBody.LinearVelocity = vec; 403 rigidBody.LinearVelocity = vec;
404 } 404 }
405 405
406 public void UpdatePosition() 406 public void UpdatePosition()
407 { 407 {
408 this._position = BulletXConversions.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); 408 this._position = BulletXConversions.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
409 } 409 }
410 410
411 //This validation is very basic 411 //This validation is very basic
412 internal void ValidateHeight(float heighmapPositionValue) 412 internal void ValidateHeight(float heighmapPositionValue)
413 { 413 {
414 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue) 414 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue)
415 { 415 {
416 Matrix m = rigidBody.WorldTransform; 416 Matrix m = rigidBody.WorldTransform;
417 MonoXnaCompactMaths.Vector3 v3 = m.Translation; 417 MonoXnaCompactMaths.Vector3 v3 = m.Translation;
418 v3.Z = heighmapPositionValue; 418 v3.Z = heighmapPositionValue;
419 m.Translation = v3; 419 m.Translation = v3;
420 rigidBody.WorldTransform = m; 420 rigidBody.WorldTransform = m;
421 } 421 }
422 } 422 }
423 } 423 }
424 /// <summary> 424 /// <summary>
425 /// PhysicsActor Prim Class for BulletX 425 /// PhysicsActor Prim Class for BulletX
426 /// </summary> 426 /// </summary>
427 public class BulletXPrim : PhysicsActor 427 public class BulletXPrim : PhysicsActor
428 { 428 {
429 private PhysicsVector _position; 429 private PhysicsVector _position;
430 private PhysicsVector _velocity; 430 private PhysicsVector _velocity;
431 private PhysicsVector _acceleration; 431 private PhysicsVector _acceleration;
432 432
433 public BulletXPrim() 433 public BulletXPrim()
434 { 434 {
435 _velocity = new PhysicsVector(); 435 _velocity = new PhysicsVector();
436 _position = new PhysicsVector(); 436 _position = new PhysicsVector();
437 _acceleration = new PhysicsVector(); 437 _acceleration = new PhysicsVector();
438 } 438 }
439 public override bool Flying 439 public override bool Flying
440 { 440 {
441 get 441 get
442 { 442 {
443 return false; //no flying prims for you 443 return false; //no flying prims for you
444 } 444 }
445 set 445 set
446 { 446 {
447 447
448 } 448 }
449 } 449 }
450 public override PhysicsVector Position 450 public override PhysicsVector Position
451 { 451 {
452 get 452 get
453 { 453 {
454 PhysicsVector pos = new PhysicsVector(); 454 PhysicsVector pos = new PhysicsVector();
455 // PhysicsVector vec = this._prim.Position; 455 // PhysicsVector vec = this._prim.Position;
456 //pos.X = vec.X; 456 //pos.X = vec.X;
457 //pos.Y = vec.Y; 457 //pos.Y = vec.Y;
458 //pos.Z = vec.Z; 458 //pos.Z = vec.Z;
459 return pos; 459 return pos;
460 460
461 } 461 }
462 set 462 set
463 { 463 {
464 /*PhysicsVector vec = value; 464 /*PhysicsVector vec = value;
465 PhysicsVector pos = new PhysicsVector(); 465 PhysicsVector pos = new PhysicsVector();
466 pos.X = vec.X; 466 pos.X = vec.X;
467 pos.Y = vec.Y; 467 pos.Y = vec.Y;
468 pos.Z = vec.Z; 468 pos.Z = vec.Z;
469 this._prim.Position = pos;*/ 469 this._prim.Position = pos;*/
470 } 470 }
471 } 471 }
472 472
473 public override PhysicsVector Velocity 473 public override PhysicsVector Velocity
474 { 474 {
475 get 475 get
476 { 476 {
477 return _velocity; 477 return _velocity;
478 } 478 }
479 set 479 set
480 { 480 {
481 _velocity = value; 481 _velocity = value;
482 } 482 }
483 } 483 }
484 484
485 public override bool Kinematic 485 public override bool Kinematic
486 { 486 {
487 get 487 get
488 { 488 {
489 return false; 489 return false;
490 //return this._prim.Kinematic; 490 //return this._prim.Kinematic;
491 } 491 }
492 set 492 set
493 { 493 {
494 //this._prim.Kinematic = value; 494 //this._prim.Kinematic = value;
495 } 495 }
496 } 496 }
497 497
498 public override Axiom.Math.Quaternion Orientation 498 public override Axiom.Math.Quaternion Orientation
499 { 499 {
500 get 500 get
501 { 501 {
502 Axiom.Math.Quaternion res = new Axiom.Math.Quaternion(); 502 Axiom.Math.Quaternion res = new Axiom.Math.Quaternion();
503 return res; 503 return res;
504 } 504 }
505 set 505 set
506 { 506 {
507 507
508 } 508 }
509 } 509 }
510 510
511 public override PhysicsVector Acceleration 511 public override PhysicsVector Acceleration
512 { 512 {
513 get 513 get
514 { 514 {
515 return _acceleration; 515 return _acceleration;
516 } 516 }
517 517
518 } 518 }
519 public void SetAcceleration(PhysicsVector accel) 519 public void SetAcceleration(PhysicsVector accel)
520 { 520 {
521 this._acceleration = accel; 521 this._acceleration = accel;
522 } 522 }
523 523
524 public override void AddForce(PhysicsVector force) 524 public override void AddForce(PhysicsVector force)
525 { 525 {
526 526
527 } 527 }
528 528
529 public override void SetMomentum(PhysicsVector momentum) 529 public override void SetMomentum(PhysicsVector momentum)
530 { 530 {
531 531
532 } 532 }
533 } 533 }
534} 534}
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
index 9415db9..27b467f 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("PhysicsManager")] 36[assembly: AssemblyTitle("PhysicsManager")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("PhysicsManager")] 40[assembly: AssemblyProduct("PhysicsManager")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index da3b560..2c2c8dd 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -1,167 +1,167 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Axiom.Math; 28using Axiom.Math;
29 29
30namespace OpenSim.Physics.Manager 30namespace OpenSim.Physics.Manager
31{ 31{
32 public delegate void PositionUpdate(PhysicsVector position); 32 public delegate void PositionUpdate(PhysicsVector position);
33 public delegate void VelocityUpdate(PhysicsVector velocity); 33 public delegate void VelocityUpdate(PhysicsVector velocity);
34 public delegate void OrientationUpdate(Quaternion orientation); 34 public delegate void OrientationUpdate(Quaternion orientation);
35 35
36 public abstract class PhysicsActor 36 public abstract class PhysicsActor
37 { 37 {
38 public event PositionUpdate OnPositionUpdate; 38 public event PositionUpdate OnPositionUpdate;
39 public event VelocityUpdate OnVelocityUpdate; 39 public event VelocityUpdate OnVelocityUpdate;
40 public event OrientationUpdate OnOrientationUpdate; 40 public event OrientationUpdate OnOrientationUpdate;
41 41
42 public static PhysicsActor Null 42 public static PhysicsActor Null
43 { 43 {
44 get 44 get
45 { 45 {
46 return new NullPhysicsActor(); 46 return new NullPhysicsActor();
47 } 47 }
48 } 48 }
49 49
50 public abstract PhysicsVector Position 50 public abstract PhysicsVector Position
51 { 51 {
52 get; 52 get;
53 set; 53 set;
54 } 54 }
55 55
56 public abstract PhysicsVector Velocity 56 public abstract PhysicsVector Velocity
57 { 57 {
58 get; 58 get;
59 set; 59 set;
60 } 60 }
61 61
62 public abstract PhysicsVector Acceleration 62 public abstract PhysicsVector Acceleration
63 { 63 {
64 get; 64 get;
65 } 65 }
66 66
67 public abstract Quaternion Orientation 67 public abstract Quaternion Orientation
68 { 68 {
69 get; 69 get;
70 set; 70 set;
71 } 71 }
72 72
73 public abstract bool Flying 73 public abstract bool Flying
74 { 74 {
75 get; 75 get;
76 set; 76 set;
77 } 77 }
78 78
79 public abstract bool Kinematic 79 public abstract bool Kinematic
80 { 80 {
81 get; 81 get;
82 set; 82 set;
83 } 83 }
84 84
85 public abstract void AddForce(PhysicsVector force); 85 public abstract void AddForce(PhysicsVector force);
86 86
87 public abstract void SetMomentum(PhysicsVector momentum); 87 public abstract void SetMomentum(PhysicsVector momentum);
88 } 88 }
89 89
90 public class NullPhysicsActor : PhysicsActor 90 public class NullPhysicsActor : PhysicsActor
91 { 91 {
92 public override PhysicsVector Position 92 public override PhysicsVector Position
93 { 93 {
94 get 94 get
95 { 95 {
96 return PhysicsVector.Zero; 96 return PhysicsVector.Zero;
97 } 97 }
98 set 98 set
99 { 99 {
100 return; 100 return;
101 } 101 }
102 } 102 }
103 103
104 public override PhysicsVector Velocity 104 public override PhysicsVector Velocity
105 { 105 {
106 get 106 get
107 { 107 {
108 return PhysicsVector.Zero; 108 return PhysicsVector.Zero;
109 } 109 }
110 set 110 set
111 { 111 {
112 return; 112 return;
113 } 113 }
114 } 114 }
115 115
116 public override Quaternion Orientation 116 public override Quaternion Orientation
117 { 117 {
118 get 118 get
119 { 119 {
120 return Quaternion.Identity; 120 return Quaternion.Identity;
121 } 121 }
122 set 122 set
123 { 123 {
124 124
125 } 125 }
126 } 126 }
127 127
128 public override PhysicsVector Acceleration 128 public override PhysicsVector Acceleration
129 { 129 {
130 get { return PhysicsVector.Zero; } 130 get { return PhysicsVector.Zero; }
131 } 131 }
132 132
133 public override bool Flying 133 public override bool Flying
134 { 134 {
135 get 135 get
136 { 136 {
137 return false; 137 return false;
138 } 138 }
139 set 139 set
140 { 140 {
141 return; 141 return;
142 } 142 }
143 } 143 }
144 144
145 public override bool Kinematic 145 public override bool Kinematic
146 { 146 {
147 get 147 get
148 { 148 {
149 return true; 149 return true;
150 } 150 }
151 set 151 set
152 { 152 {
153 return; 153 return;
154 } 154 }
155 } 155 }
156 156
157 public override void AddForce(PhysicsVector force) 157 public override void AddForce(PhysicsVector force)
158 { 158 {
159 return; 159 return;
160 } 160 }
161 161
162 public override void SetMomentum(PhysicsVector momentum) 162 public override void SetMomentum(PhysicsVector momentum)
163 { 163 {
164 return; 164 return;
165 } 165 }
166 } 166 }
167} 167}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsManager.cs b/OpenSim/Region/Physics/Manager/PhysicsManager.cs
index 265bce6..7c475e7 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsManager.cs
@@ -1,115 +1,115 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Physics.Manager 34namespace OpenSim.Physics.Manager
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Description of MyClass. 37 /// Description of MyClass.
38 /// </summary> 38 /// </summary>
39 public class PhysicsManager 39 public class PhysicsManager
40 { 40 {
41 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); 41 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>();
42 42
43 public PhysicsManager() 43 public PhysicsManager()
44 { 44 {
45 45
46 } 46 }
47 47
48 public PhysicsScene GetPhysicsScene(string engineName) 48 public PhysicsScene GetPhysicsScene(string engineName)
49 { 49 {
50 if (String.IsNullOrEmpty(engineName)) 50 if (String.IsNullOrEmpty(engineName))
51 { 51 {
52 return PhysicsScene.Null; 52 return PhysicsScene.Null;
53 } 53 }
54 54
55 if(_plugins.ContainsKey(engineName)) 55 if(_plugins.ContainsKey(engineName))
56 { 56 {
57 MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName); 57 MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName);
58 return _plugins[engineName].GetScene(); 58 return _plugins[engineName].GetScene();
59 } 59 }
60 else 60 else
61 { 61 {
62 MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName); 62 MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName);
63 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); 63 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName));
64 } 64 }
65 } 65 }
66 66
67 public void LoadPlugins() 67 public void LoadPlugins()
68 { 68 {
69 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics"); 69 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics");
70 string[] pluginFiles = Directory.GetFiles(path, "*.dll"); 70 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
71 71
72 72
73 for(int i= 0; i<pluginFiles.Length; i++) 73 for(int i= 0; i<pluginFiles.Length; i++)
74 { 74 {
75 this.AddPlugin(pluginFiles[i]); 75 this.AddPlugin(pluginFiles[i]);
76 } 76 }
77 } 77 }
78 78
79 private void AddPlugin(string FileName) 79 private void AddPlugin(string FileName)
80 { 80 {
81 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 81 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
82 82
83 foreach (Type pluginType in pluginAssembly.GetTypes()) 83 foreach (Type pluginType in pluginAssembly.GetTypes())
84 { 84 {
85 if (pluginType.IsPublic) 85 if (pluginType.IsPublic)
86 { 86 {
87 if (!pluginType.IsAbstract) 87 if (!pluginType.IsAbstract)
88 { 88 {
89 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); 89 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
90 90
91 if (typeInterface != null) 91 if (typeInterface != null)
92 { 92 {
93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
94 plug.Init(); 94 plug.Init();
95 this._plugins.Add(plug.GetName(),plug); 95 this._plugins.Add(plug.GetName(),plug);
96 96
97 } 97 }
98 98
99 typeInterface = null; 99 typeInterface = null;
100 } 100 }
101 } 101 }
102 } 102 }
103 103
104 pluginAssembly = null; 104 pluginAssembly = null;
105 } 105 }
106 } 106 }
107 107
108 public interface IPhysicsPlugin 108 public interface IPhysicsPlugin
109 { 109 {
110 bool Init(); 110 bool Init();
111 PhysicsScene GetScene(); 111 PhysicsScene GetScene();
112 string GetName(); 112 string GetName();
113 void Dispose(); 113 void Dispose();
114 } 114 }
115} 115}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index d44da00..fb6358a 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -1,110 +1,110 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework.Console; 28using OpenSim.Framework.Console;
29 29
30namespace OpenSim.Physics.Manager 30namespace OpenSim.Physics.Manager
31{ 31{
32 public abstract class PhysicsScene 32 public abstract class PhysicsScene
33 { 33 {
34 public static PhysicsScene Null 34 public static PhysicsScene Null
35 { 35 {
36 get 36 get
37 { 37 {
38 return new NullPhysicsScene(); 38 return new NullPhysicsScene();
39 } 39 }
40 } 40 }
41 41
42 public abstract PhysicsActor AddAvatar(PhysicsVector position); 42 public abstract PhysicsActor AddAvatar(PhysicsVector position);
43 43
44 public abstract void RemoveAvatar(PhysicsActor actor); 44 public abstract void RemoveAvatar(PhysicsActor actor);
45 45
46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); 46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
47 47
48 public abstract void Simulate(float timeStep); 48 public abstract void Simulate(float timeStep);
49 49
50 public abstract void GetResults(); 50 public abstract void GetResults();
51 51
52 public abstract void SetTerrain(float[] heightMap); 52 public abstract void SetTerrain(float[] heightMap);
53 53
54 public abstract void DeleteTerrain(); 54 public abstract void DeleteTerrain();
55 55
56 public abstract bool IsThreaded 56 public abstract bool IsThreaded
57 { 57 {
58 get; 58 get;
59 } 59 }
60 60
61 private class NullPhysicsScene : PhysicsScene 61 private class NullPhysicsScene : PhysicsScene
62 { 62 {
63 private static int m_workIndicator; 63 private static int m_workIndicator;
64 64
65 public override PhysicsActor AddAvatar(PhysicsVector position) 65 public override PhysicsActor AddAvatar(PhysicsVector position)
66 { 66 {
67 MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); 67 MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position);
68 return PhysicsActor.Null; 68 return PhysicsActor.Null;
69 } 69 }
70 70
71 public override void RemoveAvatar(PhysicsActor actor) 71 public override void RemoveAvatar(PhysicsActor actor)
72 { 72 {
73 73
74 } 74 }
75 75
76 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 76 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
77 { 77 {
78 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); 78 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
79 return PhysicsActor.Null; 79 return PhysicsActor.Null;
80 } 80 }
81 81
82 public override void Simulate(float timeStep) 82 public override void Simulate(float timeStep)
83 { 83 {
84 m_workIndicator = (m_workIndicator + 1) % 10; 84 m_workIndicator = (m_workIndicator + 1) % 10;
85 85
86 //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); 86 //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString());
87 } 87 }
88 88
89 public override void GetResults() 89 public override void GetResults()
90 { 90 {
91 MainLog.Instance.Verbose("NullPhysicsScene : GetResults()"); 91 MainLog.Instance.Verbose("NullPhysicsScene : GetResults()");
92 } 92 }
93 93
94 public override void SetTerrain(float[] heightMap) 94 public override void SetTerrain(float[] heightMap)
95 { 95 {
96 MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); 96 MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
97 } 97 }
98 98
99 public override void DeleteTerrain() 99 public override void DeleteTerrain()
100 { 100 {
101 101
102 } 102 }
103 103
104 public override bool IsThreaded 104 public override bool IsThreaded
105 { 105 {
106 get { return false; } 106 get { return false; }
107 } 107 }
108 } 108 }
109 } 109 }
110} 110}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index e75f29b..2cbca25 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -1,55 +1,55 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Physics.Manager 28namespace OpenSim.Physics.Manager
29{ 29{
30 public class PhysicsVector 30 public class PhysicsVector
31 { 31 {
32 public float X; 32 public float X;
33 public float Y; 33 public float Y;
34 public float Z; 34 public float Z;
35 35
36 public PhysicsVector() 36 public PhysicsVector()
37 { 37 {
38 38
39 } 39 }
40 40
41 public PhysicsVector(float x, float y, float z) 41 public PhysicsVector(float x, float y, float z)
42 { 42 {
43 X = x; 43 X = x;
44 Y = y; 44 Y = y;
45 Z = z; 45 Z = z;
46 } 46 }
47 47
48 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); 48 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
49 49
50 public override string ToString() 50 public override string ToString()
51 { 51 {
52 return "<" + this.X + "," + this.Y + "," + this.Z + ">"; 52 return "<" + this.X + "," + this.Y + "," + this.Z + ">";
53 } 53 }
54 } 54 }
55} 55}
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
index ee10430..662b75a 100644
--- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("RealPhysXplugin")] 36[assembly: AssemblyTitle("RealPhysXplugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("RealPhysXplugin")] 40[assembly: AssemblyProduct("RealPhysXplugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 2780188..486fa9e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1,457 +1,457 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Axiom.Math; 30using Axiom.Math;
31using Ode.NET; 31using Ode.NET;
32using OpenSim.Physics.Manager; 32using OpenSim.Physics.Manager;
33 33
34namespace OpenSim.Region.Physics.OdePlugin 34namespace OpenSim.Region.Physics.OdePlugin
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// ODE plugin 37 /// ODE plugin
38 /// </summary> 38 /// </summary>
39 public class OdePlugin : IPhysicsPlugin 39 public class OdePlugin : IPhysicsPlugin
40 { 40 {
41 private OdeScene _mScene; 41 private OdeScene _mScene;
42 42
43 public OdePlugin() 43 public OdePlugin()
44 { 44 {
45 45
46 } 46 }
47 47
48 public bool Init() 48 public bool Init()
49 { 49 {
50 return true; 50 return true;
51 } 51 }
52 52
53 public PhysicsScene GetScene() 53 public PhysicsScene GetScene()
54 { 54 {
55 if (_mScene == null) 55 if (_mScene == null)
56 { 56 {
57 _mScene = new OdeScene(); 57 _mScene = new OdeScene();
58 } 58 }
59 return (_mScene); 59 return (_mScene);
60 } 60 }
61 61
62 public string GetName() 62 public string GetName()
63 { 63 {
64 return ("OpenDynamicsEngine"); 64 return ("OpenDynamicsEngine");
65 } 65 }
66 66
67 public void Dispose() 67 public void Dispose()
68 { 68 {
69 69
70 } 70 }
71 } 71 }
72 72
73 public class OdeScene : PhysicsScene 73 public class OdeScene : PhysicsScene
74 { 74 {
75 static public IntPtr world; 75 static public IntPtr world;
76 static public IntPtr space; 76 static public IntPtr space;
77 static private IntPtr contactgroup; 77 static private IntPtr contactgroup;
78 static private IntPtr LandGeom; 78 static private IntPtr LandGeom;
79 //static private IntPtr Land; 79 //static private IntPtr Land;
80 private double[] _heightmap; 80 private double[] _heightmap;
81 static private d.NearCallback nearCallback = near; 81 static private d.NearCallback nearCallback = near;
82 private List<OdeCharacter> _characters = new List<OdeCharacter>(); 82 private List<OdeCharacter> _characters = new List<OdeCharacter>();
83 private static d.ContactGeom[] contacts = new d.ContactGeom[30]; 83 private static d.ContactGeom[] contacts = new d.ContactGeom[30];
84 private static d.Contact contact; 84 private static d.Contact contact;
85 85
86 public OdeScene() 86 public OdeScene()
87 { 87 {
88 contact.surface.mode = d.ContactFlags.Bounce | d.ContactFlags.SoftCFM; 88 contact.surface.mode = d.ContactFlags.Bounce | d.ContactFlags.SoftCFM;
89 contact.surface.mu = d.Infinity; 89 contact.surface.mu = d.Infinity;
90 contact.surface.mu2 = 0.0f; 90 contact.surface.mu2 = 0.0f;
91 contact.surface.bounce = 0.1f; 91 contact.surface.bounce = 0.1f;
92 contact.surface.bounce_vel = 0.1f; 92 contact.surface.bounce_vel = 0.1f;
93 contact.surface.soft_cfm = 0.01f; 93 contact.surface.soft_cfm = 0.01f;
94 94
95 world = d.WorldCreate(); 95 world = d.WorldCreate();
96 space = d.HashSpaceCreate(IntPtr.Zero); 96 space = d.HashSpaceCreate(IntPtr.Zero);
97 contactgroup = d.JointGroupCreate(0); 97 contactgroup = d.JointGroupCreate(0);
98 d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f); 98 d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f);
99 //d.WorldSetCFM(world, 1e-5f); 99 //d.WorldSetCFM(world, 1e-5f);
100 d.WorldSetAutoDisableFlag(world, false); 100 d.WorldSetAutoDisableFlag(world, false);
101 d.WorldSetContactSurfaceLayer(world, 0.001f); 101 d.WorldSetContactSurfaceLayer(world, 0.001f);
102 // d.CreatePlane(space, 0, 0, 1, 0); 102 // d.CreatePlane(space, 0, 0, 1, 0);
103 this._heightmap = new double[65536]; 103 this._heightmap = new double[65536];
104 } 104 }
105 105
106 // This function blatantly ripped off from BoxStack.cs 106 // This function blatantly ripped off from BoxStack.cs
107 static private void near(IntPtr space, IntPtr g1, IntPtr g2) 107 static private void near(IntPtr space, IntPtr g1, IntPtr g2)
108 { 108 {
109 IntPtr b1 = d.GeomGetBody(g1); 109 IntPtr b1 = d.GeomGetBody(g1);
110 IntPtr b2 = d.GeomGetBody(g2); 110 IntPtr b2 = d.GeomGetBody(g2);
111 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 111 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
112 return; 112 return;
113 113
114 int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf); 114 int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf);
115 for (int i = 0; i < count; ++i) 115 for (int i = 0; i < count; ++i)
116 { 116 {
117 contact.geom = contacts[i]; 117 contact.geom = contacts[i];
118 IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); 118 IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact);
119 d.JointAttach(joint, b1, b2); 119 d.JointAttach(joint, b1, b2);
120 } 120 }
121 121
122 } 122 }
123 123
124 public override PhysicsActor AddAvatar(PhysicsVector position) 124 public override PhysicsActor AddAvatar(PhysicsVector position)
125 { 125 {
126 PhysicsVector pos = new PhysicsVector(); 126 PhysicsVector pos = new PhysicsVector();
127 pos.X = position.X; 127 pos.X = position.X;
128 pos.Y = position.Y; 128 pos.Y = position.Y;
129 pos.Z = position.Z + 20; 129 pos.Z = position.Z + 20;
130 OdeCharacter newAv = new OdeCharacter(this, pos); 130 OdeCharacter newAv = new OdeCharacter(this, pos);
131 this._characters.Add(newAv); 131 this._characters.Add(newAv);
132 return newAv; 132 return newAv;
133 } 133 }
134 134
135 public override void RemoveAvatar(PhysicsActor actor) 135 public override void RemoveAvatar(PhysicsActor actor)
136 { 136 {
137 137
138 } 138 }
139 139
140 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 140 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
141 { 141 {
142 PhysicsVector pos = new PhysicsVector(); 142 PhysicsVector pos = new PhysicsVector();
143 pos.X = position.X; 143 pos.X = position.X;
144 pos.Y = position.Y; 144 pos.Y = position.Y;
145 pos.Z = position.Z; 145 pos.Z = position.Z;
146 PhysicsVector siz = new PhysicsVector(); 146 PhysicsVector siz = new PhysicsVector();
147 siz.X = size.X; 147 siz.X = size.X;
148 siz.Y = size.Y; 148 siz.Y = size.Y;
149 siz.Z = size.Z; 149 siz.Z = size.Z;
150 return new OdePrim(); 150 return new OdePrim();
151 } 151 }
152 152
153 public override void Simulate(float timeStep) 153 public override void Simulate(float timeStep)
154 { 154 {
155 foreach (OdeCharacter actor in _characters) 155 foreach (OdeCharacter actor in _characters)
156 { 156 {
157 actor.Move(timeStep * 5f); 157 actor.Move(timeStep * 5f);
158 } 158 }
159 d.SpaceCollide(space, IntPtr.Zero, nearCallback); 159 d.SpaceCollide(space, IntPtr.Zero, nearCallback);
160 d.WorldQuickStep(world, timeStep * 5f); 160 d.WorldQuickStep(world, timeStep * 5f);
161 d.JointGroupEmpty(contactgroup); 161 d.JointGroupEmpty(contactgroup);
162 foreach (OdeCharacter actor in _characters) 162 foreach (OdeCharacter actor in _characters)
163 { 163 {
164 actor.UpdatePosition(); 164 actor.UpdatePosition();
165 } 165 }
166 166
167 } 167 }
168 168
169 public override void GetResults() 169 public override void GetResults()
170 { 170 {
171 171
172 } 172 }
173 173
174 public override bool IsThreaded 174 public override bool IsThreaded
175 { 175 {
176 get 176 get
177 { 177 {
178 return (false); // for now we won't be multithreaded 178 return (false); // for now we won't be multithreaded
179 } 179 }
180 } 180 }
181 181
182 public override void SetTerrain(float[] heightMap) 182 public override void SetTerrain(float[] heightMap)
183 { 183 {
184 for (int i = 0; i < 65536; i++) 184 for (int i = 0; i < 65536; i++)
185 { 185 {
186 // this._heightmap[i] = (double)heightMap[i]; 186 // this._heightmap[i] = (double)heightMap[i];
187 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) 187 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...)
188 int x = i & 0xff; 188 int x = i & 0xff;
189 int y = i >> 8; 189 int y = i >> 8;
190 this._heightmap[i] = (double)heightMap[x * 256 + y]; 190 this._heightmap[i] = (double)heightMap[x * 256 + y];
191 } 191 }
192 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 192 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
193 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); 193 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0);
194 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); 194 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256);
195 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 195 LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
196 d.Matrix3 R = new d.Matrix3(); 196 d.Matrix3 R = new d.Matrix3();
197 197
198 Quaternion q1 =Quaternion.FromAngleAxis(1.5707f, new Vector3(1,0,0)); 198 Quaternion q1 =Quaternion.FromAngleAxis(1.5707f, new Vector3(1,0,0));
199 Quaternion q2 =Quaternion.FromAngleAxis(1.5707f, new Vector3(0,1,0)); 199 Quaternion q2 =Quaternion.FromAngleAxis(1.5707f, new Vector3(0,1,0));
200 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); 200 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
201 201
202 q1 = q1 * q2; 202 q1 = q1 * q2;
203 //q1 = q1 * q3; 203 //q1 = q1 * q3;
204 Vector3 v3 = new Vector3(); 204 Vector3 v3 = new Vector3();
205 float angle = 0; 205 float angle = 0;
206 q1.ToAngleAxis(ref angle, ref v3); 206 q1.ToAngleAxis(ref angle, ref v3);
207 207
208 d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); 208 d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle);
209 d.GeomSetRotation(LandGeom, ref R); 209 d.GeomSetRotation(LandGeom, ref R);
210 d.GeomSetPosition(LandGeom, 128, 128, 0); 210 d.GeomSetPosition(LandGeom, 128, 128, 0);
211 } 211 }
212 212
213 public override void DeleteTerrain() 213 public override void DeleteTerrain()
214 { 214 {
215 215
216 } 216 }
217 } 217 }
218 218
219 public class OdeCharacter : PhysicsActor 219 public class OdeCharacter : PhysicsActor
220 { 220 {
221 private PhysicsVector _position; 221 private PhysicsVector _position;
222 private PhysicsVector _velocity; 222 private PhysicsVector _velocity;
223 private PhysicsVector _acceleration; 223 private PhysicsVector _acceleration;
224 private bool flying; 224 private bool flying;
225 //private float gravityAccel; 225 //private float gravityAccel;
226 private IntPtr BoundingCapsule; 226 private IntPtr BoundingCapsule;
227 IntPtr capsule_geom; 227 IntPtr capsule_geom;
228 d.Mass capsule_mass; 228 d.Mass capsule_mass;
229 229
230 public OdeCharacter(OdeScene parent_scene, PhysicsVector pos) 230 public OdeCharacter(OdeScene parent_scene, PhysicsVector pos)
231 { 231 {
232 _velocity = new PhysicsVector(); 232 _velocity = new PhysicsVector();
233 _position = pos; 233 _position = pos;
234 _acceleration = new PhysicsVector(); 234 _acceleration = new PhysicsVector();
235 d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f); 235 d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f);
236 capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f); 236 capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f);
237 this.BoundingCapsule = d.BodyCreate(OdeScene.world); 237 this.BoundingCapsule = d.BodyCreate(OdeScene.world);
238 d.BodySetMass(BoundingCapsule, ref capsule_mass); 238 d.BodySetMass(BoundingCapsule, ref capsule_mass);
239 d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); 239 d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z);
240 d.GeomSetBody(capsule_geom, BoundingCapsule); 240 d.GeomSetBody(capsule_geom, BoundingCapsule);
241 } 241 }
242 242
243 public override bool Flying 243 public override bool Flying
244 { 244 {
245 get 245 get
246 { 246 {
247 return flying; 247 return flying;
248 } 248 }
249 set 249 set
250 { 250 {
251 flying = value; 251 flying = value;
252 } 252 }
253 } 253 }
254 254
255 public override PhysicsVector Position 255 public override PhysicsVector Position
256 { 256 {
257 get 257 get
258 { 258 {
259 return _position; 259 return _position;
260 } 260 }
261 set 261 set
262 { 262 {
263 _position = value; 263 _position = value;
264 } 264 }
265 } 265 }
266 266
267 public override PhysicsVector Velocity 267 public override PhysicsVector Velocity
268 { 268 {
269 get 269 get
270 { 270 {
271 return _velocity; 271 return _velocity;
272 } 272 }
273 set 273 set
274 { 274 {
275 _velocity = value; 275 _velocity = value;
276 } 276 }
277 } 277 }
278 278
279 public override bool Kinematic 279 public override bool Kinematic
280 { 280 {
281 get 281 get
282 { 282 {
283 return false; 283 return false;
284 } 284 }
285 set 285 set
286 { 286 {
287 287
288 } 288 }
289 } 289 }
290 290
291 public override Quaternion Orientation 291 public override Quaternion Orientation
292 { 292 {
293 get 293 get
294 { 294 {
295 return Quaternion.Identity; 295 return Quaternion.Identity;
296 } 296 }
297 set 297 set
298 { 298 {
299 299
300 } 300 }
301 } 301 }
302 302
303 public override PhysicsVector Acceleration 303 public override PhysicsVector Acceleration
304 { 304 {
305 get 305 get
306 { 306 {
307 return _acceleration; 307 return _acceleration;
308 } 308 }
309 309
310 } 310 }
311 public void SetAcceleration(PhysicsVector accel) 311 public void SetAcceleration(PhysicsVector accel)
312 { 312 {
313 this._acceleration = accel; 313 this._acceleration = accel;
314 } 314 }
315 315
316 public override void AddForce(PhysicsVector force) 316 public override void AddForce(PhysicsVector force)
317 { 317 {
318 318
319 } 319 }
320 320
321 public override void SetMomentum(PhysicsVector momentum) 321 public override void SetMomentum(PhysicsVector momentum)
322 { 322 {
323 323
324 } 324 }
325 325
326 public void Move(float timeStep) 326 public void Move(float timeStep)
327 { 327 {
328 PhysicsVector vec = new PhysicsVector(); 328 PhysicsVector vec = new PhysicsVector();
329 vec.X = this._velocity.X * timeStep; 329 vec.X = this._velocity.X * timeStep;
330 vec.Y = this._velocity.Y * timeStep; 330 vec.Y = this._velocity.Y * timeStep;
331 if (flying) 331 if (flying)
332 { 332 {
333 vec.Z = (this._velocity.Z + 0.5f) * timeStep; 333 vec.Z = (this._velocity.Z + 0.5f) * timeStep;
334 } 334 }
335 d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z); 335 d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z);
336 } 336 }
337 337
338 public void UpdatePosition() 338 public void UpdatePosition()
339 { 339 {
340 d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); 340 d.Vector3 vec = d.BodyGetPosition(BoundingCapsule);
341 this._position.X = vec.X; 341 this._position.X = vec.X;
342 this._position.Y = vec.Y; 342 this._position.Y = vec.Y;
343 this._position.Z = vec.Z+1.0f; 343 this._position.Z = vec.Z+1.0f;
344 } 344 }
345 } 345 }
346 346
347 public class OdePrim : PhysicsActor 347 public class OdePrim : PhysicsActor
348 { 348 {
349 private PhysicsVector _position; 349 private PhysicsVector _position;
350 private PhysicsVector _velocity; 350 private PhysicsVector _velocity;
351 private PhysicsVector _acceleration; 351 private PhysicsVector _acceleration;
352 352
353 public OdePrim() 353 public OdePrim()
354 { 354 {
355 _velocity = new PhysicsVector(); 355 _velocity = new PhysicsVector();
356 _position = new PhysicsVector(); 356 _position = new PhysicsVector();
357 _acceleration = new PhysicsVector(); 357 _acceleration = new PhysicsVector();
358 } 358 }
359 public override bool Flying 359 public override bool Flying
360 { 360 {
361 get 361 get
362 { 362 {
363 return false; //no flying prims for you 363 return false; //no flying prims for you
364 } 364 }
365 set 365 set
366 { 366 {
367 367
368 } 368 }
369 } 369 }
370 public override PhysicsVector Position 370 public override PhysicsVector Position
371 { 371 {
372 get 372 get
373 { 373 {
374 PhysicsVector pos = new PhysicsVector(); 374 PhysicsVector pos = new PhysicsVector();
375 // PhysicsVector vec = this._prim.Position; 375 // PhysicsVector vec = this._prim.Position;
376 //pos.X = vec.X; 376 //pos.X = vec.X;
377 //pos.Y = vec.Y; 377 //pos.Y = vec.Y;
378 //pos.Z = vec.Z; 378 //pos.Z = vec.Z;
379 return pos; 379 return pos;
380 380
381 } 381 }
382 set 382 set
383 { 383 {
384 /*PhysicsVector vec = value; 384 /*PhysicsVector vec = value;
385 PhysicsVector pos = new PhysicsVector(); 385 PhysicsVector pos = new PhysicsVector();
386 pos.X = vec.X; 386 pos.X = vec.X;
387 pos.Y = vec.Y; 387 pos.Y = vec.Y;
388 pos.Z = vec.Z; 388 pos.Z = vec.Z;
389 this._prim.Position = pos;*/ 389 this._prim.Position = pos;*/
390 } 390 }
391 } 391 }
392 392
393 public override PhysicsVector Velocity 393 public override PhysicsVector Velocity
394 { 394 {
395 get 395 get
396 { 396 {
397 return _velocity; 397 return _velocity;
398 } 398 }
399 set 399 set
400 { 400 {
401 _velocity = value; 401 _velocity = value;
402 } 402 }
403 } 403 }
404 404
405 public override bool Kinematic 405 public override bool Kinematic
406 { 406 {
407 get 407 get
408 { 408 {
409 return false; 409 return false;
410 //return this._prim.Kinematic; 410 //return this._prim.Kinematic;
411 } 411 }
412 set 412 set
413 { 413 {
414 //this._prim.Kinematic = value; 414 //this._prim.Kinematic = value;
415 } 415 }
416 } 416 }
417 417
418 public override Quaternion Orientation 418 public override Quaternion Orientation
419 { 419 {
420 get 420 get
421 { 421 {
422 Quaternion res = new Quaternion(); 422 Quaternion res = new Quaternion();
423 return res; 423 return res;
424 } 424 }
425 set 425 set
426 { 426 {
427 427
428 } 428 }
429 } 429 }
430 430
431 public override PhysicsVector Acceleration 431 public override PhysicsVector Acceleration
432 { 432 {
433 get 433 get
434 { 434 {
435 return _acceleration; 435 return _acceleration;
436 } 436 }
437 437
438 } 438 }
439 public void SetAcceleration(PhysicsVector accel) 439 public void SetAcceleration(PhysicsVector accel)
440 { 440 {
441 this._acceleration = accel; 441 this._acceleration = accel;
442 } 442 }
443 443
444 public override void AddForce(PhysicsVector force) 444 public override void AddForce(PhysicsVector force)
445 { 445 {
446 446
447 } 447 }
448 448
449 public override void SetMomentum(PhysicsVector momentum) 449 public override void SetMomentum(PhysicsVector momentum)
450 { 450 {
451 451
452 } 452 }
453 453
454 454
455 } 455 }
456 456
457} 457}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
index ee10430..662b75a 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("RealPhysXplugin")] 36[assembly: AssemblyTitle("RealPhysXplugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("RealPhysXplugin")] 40[assembly: AssemblyProduct("RealPhysXplugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 4c82549..111d436 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -1,425 +1,425 @@
1/*/* 1/*/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Physics.Manager; 30using OpenSim.Physics.Manager;
31using PhysXWrapper; 31using PhysXWrapper;
32using Quaternion=Axiom.Math.Quaternion; 32using Quaternion=Axiom.Math.Quaternion;
33 33
34namespace OpenSim.Region.Physics.PhysXPlugin 34namespace OpenSim.Region.Physics.PhysXPlugin
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Will be the PhysX plugin but for now will be a very basic physics engine 37 /// Will be the PhysX plugin but for now will be a very basic physics engine
38 /// </summary> 38 /// </summary>
39 public class PhysXPlugin : IPhysicsPlugin 39 public class PhysXPlugin : IPhysicsPlugin
40 { 40 {
41 private PhysXScene _mScene; 41 private PhysXScene _mScene;
42 42
43 public PhysXPlugin() 43 public PhysXPlugin()
44 { 44 {
45 45
46 } 46 }
47 47
48 public bool Init() 48 public bool Init()
49 { 49 {
50 return true; 50 return true;
51 } 51 }
52 52
53 public PhysicsScene GetScene() 53 public PhysicsScene GetScene()
54 { 54 {
55 if(_mScene == null) 55 if(_mScene == null)
56 { 56 {
57 _mScene = new PhysXScene(); 57 _mScene = new PhysXScene();
58 } 58 }
59 return(_mScene); 59 return(_mScene);
60 } 60 }
61 61
62 public string GetName() 62 public string GetName()
63 { 63 {
64 return("RealPhysX"); 64 return("RealPhysX");
65 } 65 }
66 66
67 public void Dispose() 67 public void Dispose()
68 { 68 {
69 69
70 } 70 }
71 } 71 }
72 72
73 public class PhysXScene :PhysicsScene 73 public class PhysXScene :PhysicsScene
74 { 74 {
75 private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); 75 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
76 private List<PhysXPrim> _prims = new List<PhysXPrim>(); 76 private List<PhysXPrim> _prims = new List<PhysXPrim>();
77 private float[] _heightMap = null; 77 private float[] _heightMap = null;
78 private NxPhysicsSDK mySdk; 78 private NxPhysicsSDK mySdk;
79 private NxScene scene; 79 private NxScene scene;
80 80
81 public PhysXScene() 81 public PhysXScene()
82 { 82 {
83 mySdk = NxPhysicsSDK.CreateSDK(); 83 mySdk = NxPhysicsSDK.CreateSDK();
84 Console.WriteLine("Sdk created - now creating scene"); 84 Console.WriteLine("Sdk created - now creating scene");
85 scene = mySdk.CreateScene(); 85 scene = mySdk.CreateScene();
86 86
87 } 87 }
88 88
89 public override PhysicsActor AddAvatar(PhysicsVector position) 89 public override PhysicsActor AddAvatar(PhysicsVector position)
90 { 90 {
91 Vec3 pos = new Vec3(); 91 Vec3 pos = new Vec3();
92 pos.X = position.X; 92 pos.X = position.X;
93 pos.Y = position.Y; 93 pos.Y = position.Y;
94 pos.Z = position.Z; 94 pos.Z = position.Z;
95 PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); 95 PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos));
96 act.Position = position; 96 act.Position = position;
97 _characters.Add(act); 97 _characters.Add(act);
98 return act; 98 return act;
99 } 99 }
100 100
101 public override void RemoveAvatar(PhysicsActor actor) 101 public override void RemoveAvatar(PhysicsActor actor)
102 { 102 {
103 103
104 } 104 }
105 105
106 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 106 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
107 { 107 {
108 Vec3 pos = new Vec3(); 108 Vec3 pos = new Vec3();
109 pos.X = position.X; 109 pos.X = position.X;
110 pos.Y = position.Y; 110 pos.Y = position.Y;
111 pos.Z = position.Z; 111 pos.Z = position.Z;
112 Vec3 siz = new Vec3(); 112 Vec3 siz = new Vec3();
113 siz.X = size.X; 113 siz.X = size.X;
114 siz.Y = size.Y; 114 siz.Y = size.Y;
115 siz.Z = size.Z; 115 siz.Z = size.Z;
116 PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); 116 PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz));
117 _prims.Add(act); 117 _prims.Add(act);
118 return act; 118 return act;
119 } 119 }
120 public override void Simulate(float timeStep) 120 public override void Simulate(float timeStep)
121 { 121 {
122 try 122 try
123 { 123 {
124 foreach (PhysXCharacter actor in _characters) 124 foreach (PhysXCharacter actor in _characters)
125 { 125 {
126 actor.Move(timeStep); 126 actor.Move(timeStep);
127 } 127 }
128 scene.Simulate(timeStep); 128 scene.Simulate(timeStep);
129 scene.FetchResults(); 129 scene.FetchResults();
130 scene.UpdateControllers(); 130 scene.UpdateControllers();
131 131
132 foreach (PhysXCharacter actor in _characters) 132 foreach (PhysXCharacter actor in _characters)
133 { 133 {
134 actor.UpdatePosition(); 134 actor.UpdatePosition();
135 } 135 }
136 } 136 }
137 catch (Exception e) 137 catch (Exception e)
138 { 138 {
139 Console.WriteLine(e.Message); 139 Console.WriteLine(e.Message);
140 } 140 }
141 141
142 } 142 }
143 143
144 public override void GetResults() 144 public override void GetResults()
145 { 145 {
146 146
147 } 147 }
148 148
149 public override bool IsThreaded 149 public override bool IsThreaded
150 { 150 {
151 get 151 get
152 { 152 {
153 return(false); // for now we won't be multithreaded 153 return(false); // for now we won't be multithreaded
154 } 154 }
155 } 155 }
156 156
157 public override void SetTerrain(float[] heightMap) 157 public override void SetTerrain(float[] heightMap)
158 { 158 {
159 if (this._heightMap != null) 159 if (this._heightMap != null)
160 { 160 {
161 Console.WriteLine("PhysX - deleting old terrain"); 161 Console.WriteLine("PhysX - deleting old terrain");
162 this.scene.DeleteTerrain(); 162 this.scene.DeleteTerrain();
163 } 163 }
164 this._heightMap = heightMap; 164 this._heightMap = heightMap;
165 this.scene.AddTerrain(heightMap); 165 this.scene.AddTerrain(heightMap);
166 } 166 }
167 167
168 public override void DeleteTerrain() 168 public override void DeleteTerrain()
169 { 169 {
170 this.scene.DeleteTerrain(); 170 this.scene.DeleteTerrain();
171 } 171 }
172 } 172 }
173 173
174 public class PhysXCharacter : PhysicsActor 174 public class PhysXCharacter : PhysicsActor
175 { 175 {
176 private PhysicsVector _position; 176 private PhysicsVector _position;
177 private PhysicsVector _velocity; 177 private PhysicsVector _velocity;
178 private PhysicsVector _acceleration; 178 private PhysicsVector _acceleration;
179 private NxCharacter _character; 179 private NxCharacter _character;
180 private bool flying; 180 private bool flying;
181 private float gravityAccel; 181 private float gravityAccel;
182 182
183 public PhysXCharacter(NxCharacter character) 183 public PhysXCharacter(NxCharacter character)
184 { 184 {
185 _velocity = new PhysicsVector(); 185 _velocity = new PhysicsVector();
186 _position = new PhysicsVector(); 186 _position = new PhysicsVector();
187 _acceleration = new PhysicsVector(); 187 _acceleration = new PhysicsVector();
188 _character = character; 188 _character = character;
189 } 189 }
190 190
191 public override bool Flying 191 public override bool Flying
192 { 192 {
193 get 193 get
194 { 194 {
195 return flying; 195 return flying;
196 } 196 }
197 set 197 set
198 { 198 {
199 flying = value; 199 flying = value;
200 } 200 }
201 } 201 }
202 202
203 public override PhysicsVector Position 203 public override PhysicsVector Position
204 { 204 {
205 get 205 get
206 { 206 {
207 return _position; 207 return _position;
208 } 208 }
209 set 209 set
210 { 210 {
211 _position = value; 211 _position = value;
212 Vec3 ps = new Vec3(); 212 Vec3 ps = new Vec3();
213 ps.X = value.X; 213 ps.X = value.X;
214 ps.Y = value.Y; 214 ps.Y = value.Y;
215 ps.Z = value.Z; 215 ps.Z = value.Z;
216 this._character.Position = ps; 216 this._character.Position = ps;
217 } 217 }
218 } 218 }
219 219
220 public override PhysicsVector Velocity 220 public override PhysicsVector Velocity
221 { 221 {
222 get 222 get
223 { 223 {
224 return _velocity; 224 return _velocity;
225 } 225 }
226 set 226 set
227 { 227 {
228 _velocity = value; 228 _velocity = value;
229 } 229 }
230 } 230 }
231 231
232 public override bool Kinematic 232 public override bool Kinematic
233 { 233 {
234 get 234 get
235 { 235 {
236 return false; 236 return false;
237 } 237 }
238 set 238 set
239 { 239 {
240 240
241 } 241 }
242 } 242 }
243 243
244 public override Quaternion Orientation 244 public override Quaternion Orientation
245 { 245 {
246 get 246 get
247 { 247 {
248 return Quaternion.Identity; 248 return Quaternion.Identity;
249 } 249 }
250 set 250 set
251 { 251 {
252 252
253 } 253 }
254 } 254 }
255 255
256 public override PhysicsVector Acceleration 256 public override PhysicsVector Acceleration
257 { 257 {
258 get 258 get
259 { 259 {
260 return _acceleration; 260 return _acceleration;
261 } 261 }
262 262
263 } 263 }
264 public void SetAcceleration (PhysicsVector accel) 264 public void SetAcceleration (PhysicsVector accel)
265 { 265 {
266 this._acceleration = accel; 266 this._acceleration = accel;
267 } 267 }
268 268
269 public override void AddForce(PhysicsVector force) 269 public override void AddForce(PhysicsVector force)
270 { 270 {
271 271
272 } 272 }
273 273
274 public override void SetMomentum(PhysicsVector momentum) 274 public override void SetMomentum(PhysicsVector momentum)
275 { 275 {
276 276
277 } 277 }
278 278
279 public void Move(float timeStep) 279 public void Move(float timeStep)
280 { 280 {
281 Vec3 vec = new Vec3(); 281 Vec3 vec = new Vec3();
282 vec.X = this._velocity.X * timeStep; 282 vec.X = this._velocity.X * timeStep;
283 vec.Y = this._velocity.Y * timeStep; 283 vec.Y = this._velocity.Y * timeStep;
284 if(flying) 284 if(flying)
285 { 285 {
286 vec.Z = ( this._velocity.Z) * timeStep; 286 vec.Z = ( this._velocity.Z) * timeStep;
287 } 287 }
288 else 288 else
289 { 289 {
290 gravityAccel+= -9.8f; 290 gravityAccel+= -9.8f;
291 vec.Z = (gravityAccel + this._velocity.Z) * timeStep; 291 vec.Z = (gravityAccel + this._velocity.Z) * timeStep;
292 } 292 }
293 int res = this._character.Move(vec); 293 int res = this._character.Move(vec);
294 if(res == 1) 294 if(res == 1)
295 { 295 {
296 gravityAccel = 0; 296 gravityAccel = 0;
297 } 297 }
298 } 298 }
299 299
300 public void UpdatePosition() 300 public void UpdatePosition()
301 { 301 {
302 Vec3 vec = this._character.Position; 302 Vec3 vec = this._character.Position;
303 this._position.X = vec.X; 303 this._position.X = vec.X;
304 this._position.Y = vec.Y; 304 this._position.Y = vec.Y;
305 this._position.Z = vec.Z; 305 this._position.Z = vec.Z;
306 } 306 }
307 } 307 }
308 308
309 public class PhysXPrim : PhysicsActor 309 public class PhysXPrim : PhysicsActor
310 { 310 {
311 private PhysicsVector _position; 311 private PhysicsVector _position;
312 private PhysicsVector _velocity; 312 private PhysicsVector _velocity;
313 private PhysicsVector _acceleration; 313 private PhysicsVector _acceleration;
314 private NxActor _prim; 314 private NxActor _prim;
315 315
316 public PhysXPrim(NxActor prim) 316 public PhysXPrim(NxActor prim)
317 { 317 {
318 _velocity = new PhysicsVector(); 318 _velocity = new PhysicsVector();
319 _position = new PhysicsVector(); 319 _position = new PhysicsVector();
320 _acceleration = new PhysicsVector(); 320 _acceleration = new PhysicsVector();
321 _prim = prim; 321 _prim = prim;
322 } 322 }
323 public override bool Flying 323 public override bool Flying
324 { 324 {
325 get 325 get
326 { 326 {
327 return false; //no flying prims for you 327 return false; //no flying prims for you
328 } 328 }
329 set 329 set
330 { 330 {
331 331
332 } 332 }
333 } 333 }
334 public override PhysicsVector Position 334 public override PhysicsVector Position
335 { 335 {
336 get 336 get
337 { 337 {
338 PhysicsVector pos = new PhysicsVector(); 338 PhysicsVector pos = new PhysicsVector();
339 Vec3 vec = this._prim.Position; 339 Vec3 vec = this._prim.Position;
340 pos.X = vec.X; 340 pos.X = vec.X;
341 pos.Y = vec.Y; 341 pos.Y = vec.Y;
342 pos.Z = vec.Z; 342 pos.Z = vec.Z;
343 return pos; 343 return pos;
344 344
345 } 345 }
346 set 346 set
347 { 347 {
348 PhysicsVector vec = value; 348 PhysicsVector vec = value;
349 Vec3 pos = new Vec3(); 349 Vec3 pos = new Vec3();
350 pos.X = vec.X; 350 pos.X = vec.X;
351 pos.Y = vec.Y; 351 pos.Y = vec.Y;
352 pos.Z = vec.Z; 352 pos.Z = vec.Z;
353 this._prim.Position = pos; 353 this._prim.Position = pos;
354 } 354 }
355 } 355 }
356 356
357 public override PhysicsVector Velocity 357 public override PhysicsVector Velocity
358 { 358 {
359 get 359 get
360 { 360 {
361 return _velocity; 361 return _velocity;
362 } 362 }
363 set 363 set
364 { 364 {
365 _velocity = value; 365 _velocity = value;
366 } 366 }
367 } 367 }
368 368
369 public override bool Kinematic 369 public override bool Kinematic
370 { 370 {
371 get 371 get
372 { 372 {
373 return this._prim.Kinematic; 373 return this._prim.Kinematic;
374 } 374 }
375 set 375 set
376 { 376 {
377 this._prim.Kinematic = value; 377 this._prim.Kinematic = value;
378 } 378 }
379 } 379 }
380 380
381 public override Quaternion Orientation 381 public override Quaternion Orientation
382 { 382 {
383 get 383 get
384 { 384 {
385 Quaternion res = new Quaternion(); 385 Quaternion res = new Quaternion();
386 PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); 386 PhysXWrapper.Quaternion quat = this._prim.GetOrientation();
387 res.w = quat.W; 387 res.w = quat.W;
388 res.x = quat.X; 388 res.x = quat.X;
389 res.y = quat.Y; 389 res.y = quat.Y;
390 res.z = quat.Z; 390 res.z = quat.Z;
391 return res; 391 return res;
392 } 392 }
393 set 393 set
394 { 394 {
395 395
396 } 396 }
397 } 397 }
398 398
399 public override PhysicsVector Acceleration 399 public override PhysicsVector Acceleration
400 { 400 {
401 get 401 get
402 { 402 {
403 return _acceleration; 403 return _acceleration;
404 } 404 }
405 405
406 } 406 }
407 public void SetAcceleration (PhysicsVector accel) 407 public void SetAcceleration (PhysicsVector accel)
408 { 408 {
409 this._acceleration = accel; 409 this._acceleration = accel;
410 } 410 }
411 411
412 public override void AddForce(PhysicsVector force) 412 public override void AddForce(PhysicsVector force)
413 { 413 {
414 414
415 } 415 }
416 416
417 public override void SetMomentum(PhysicsVector momentum) 417 public override void SetMomentum(PhysicsVector momentum)
418 { 418 {
419 419
420 } 420 }
421 421
422 422
423 } 423 }
424 424
425} 425}
diff --git a/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs b/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs
index f5da4c0..d6debed 100644
--- a/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Scripting/Properties/AssemblyInfo.cs
@@ -1,35 +1,35 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Scripting")] 8[assembly: AssemblyTitle("OpenSim.Scripting")]
9[assembly: AssemblyDescription("")] 9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")] 10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")] 11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.Scripting")] 12[assembly: AssemblyProduct("OpenSim.Scripting")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
22// The following GUID is for the ID of the typelib if this project is exposed to COM 22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("61eae1ad-82aa-4c77-8bc5-b5a8c9522b18")] 23[assembly: Guid("61eae1ad-82aa-4c77-8bc5-b5a8c9522b18")]
24 24
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32// You can specify all the values or you can default the Revision and Build Numbers 32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below: 33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")] 34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Scripting/Script.cs b/OpenSim/Region/Scripting/Script.cs
index 0f4af00..0551ea0 100644
--- a/OpenSim/Region/Scripting/Script.cs
+++ b/OpenSim/Region/Scripting/Script.cs
@@ -1,32 +1,32 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Framework.Console; 5using OpenSim.Framework.Console;
6using OpenSim.Framework; 6using OpenSim.Framework;
7using OpenSim.Region; 7using OpenSim.Region;
8using OpenSim.Region.Scenes; 8using OpenSim.Region.Scenes;
9 9
10namespace OpenSim.Scripting 10namespace OpenSim.Scripting
11{ 11{
12 public interface IScript 12 public interface IScript
13 { 13 {
14 void Initialise(ScriptInfo scriptInfo); 14 void Initialise(ScriptInfo scriptInfo);
15 } 15 }
16 16
17 public class TestScript : IScript 17 public class TestScript : IScript
18 { 18 {
19 ScriptInfo script; 19 ScriptInfo script;
20 20
21 public void Initialise(ScriptInfo scriptInfo) 21 public void Initialise(ScriptInfo scriptInfo)
22 { 22 {
23 script = scriptInfo; 23 script = scriptInfo;
24 script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame); 24 script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame);
25 } 25 }
26 26
27 void events_OnFrame() 27 void events_OnFrame()
28 { 28 {
29 script.logger.Verbose("Hello World!"); 29 script.logger.Verbose("Hello World!");
30 } 30 }
31 } 31 }
32} 32}
diff --git a/OpenSim/Region/Scripting/ScriptAccess.cs b/OpenSim/Region/Scripting/ScriptAccess.cs
index a9fede5..ce814a4 100644
--- a/OpenSim/Region/Scripting/ScriptAccess.cs
+++ b/OpenSim/Region/Scripting/ScriptAccess.cs
@@ -1,31 +1,31 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Region.Scenes; 5using OpenSim.Region.Scenes;
6using OpenSim.Framework.Console; 6using OpenSim.Framework.Console;
7 7
8namespace OpenSim.Scripting 8namespace OpenSim.Scripting
9{ 9{
10 /// <summary> 10 /// <summary>
11 /// Class which provides access to the world 11 /// Class which provides access to the world
12 /// </summary> 12 /// </summary>
13 public class ScriptInfo 13 public class ScriptInfo
14 { 14 {
15 // Reference to world.eventsManager provided for convenience 15 // Reference to world.eventsManager provided for convenience
16 public EventManager events; 16 public EventManager events;
17 17
18 // The main world 18 // The main world
19 public Scene world; 19 public Scene world;
20 20
21 // The console 21 // The console
22 public LogBase logger; 22 public LogBase logger;
23 23
24 public ScriptInfo(Scene scene) 24 public ScriptInfo(Scene scene)
25 { 25 {
26 world = scene; 26 world = scene;
27 events = world.eventManager; 27 events = world.eventManager;
28 logger = OpenSim.Framework.Console.MainLog.Instance; 28 logger = OpenSim.Framework.Console.MainLog.Instance;
29 } 29 }
30 } 30 }
31} 31}
diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
index 39ba6e4..0a88594 100644
--- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
+++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
@@ -1,112 +1,112 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29// BDB Support 29// BDB Support
30// Apparently broken on Mono 30// Apparently broken on Mono
31 31
32using BerkeleyDb; 32using BerkeleyDb;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36 36
37namespace OpenSim.Region.Storage.LocalStorageBDB 37namespace OpenSim.Region.Storage.LocalStorageBDB
38{ 38{
39 public class BDBLocalStorage : ILocalStorage 39 public class BDBLocalStorage : ILocalStorage
40 { 40 {
41 const string simDbName = "localsim.db"; 41 const string simDbName = "localsim.db";
42 42
43 DbHash sim; 43 DbHash sim;
44 Db DB; 44 Db DB;
45 //BEFormatter formatter; 45 //BEFormatter formatter;
46 46
47 public BDBLocalStorage() 47 public BDBLocalStorage()
48 { 48 {
49 DB = new Db(DbCreateFlags.None); 49 DB = new Db(DbCreateFlags.None);
50 sim = (DbHash)DB.Open(null, simDbName, null, DbType.Hash, Db.OpenFlags.Create, 0); 50 sim = (DbHash)DB.Open(null, simDbName, null, DbType.Hash, Db.OpenFlags.Create, 0);
51 //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0); 51 //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0);
52 } 52 }
53 53
54 public void Initialise(string file) 54 public void Initialise(string file)
55 { 55 {
56 // Blank 56 // Blank
57 } 57 }
58 58
59 public void StorePrim(PrimData prim) 59 public void StorePrim(PrimData prim)
60 { 60 {
61 DbEntry key = new DbEntry(); 61 DbEntry key = new DbEntry();
62 DbEntry data = new DbEntry(); 62 DbEntry data = new DbEntry();
63 lock (sim) 63 lock (sim)
64 { 64 {
65 sim.PutUnique(null, ref key, ref data, DbFile.WriteFlags.AutoCommit); 65 sim.PutUnique(null, ref key, ref data, DbFile.WriteFlags.AutoCommit);
66 } 66 }
67 } 67 }
68 public void RemovePrim(LLUUID primID) 68 public void RemovePrim(LLUUID primID)
69 { 69 {
70 70
71 } 71 }
72 public void LoadPrimitives(ILocalStorageReceiver receiver) 72 public void LoadPrimitives(ILocalStorageReceiver receiver)
73 { 73 {
74 74
75 } 75 }
76 public float[] LoadWorld() 76 public float[] LoadWorld()
77 { 77 {
78 return new float[65536]; 78 return new float[65536];
79 } 79 }
80 public void SaveMap(float[] heightmap) 80 public void SaveMap(float[] heightmap)
81 { 81 {
82 82
83 } 83 }
84 84
85 public void SaveParcels(ParcelData[] parcel_data) 85 public void SaveParcels(ParcelData[] parcel_data)
86 { 86 {
87 } 87 }
88 88
89 public void SaveParcel(ParcelData parcel) 89 public void SaveParcel(ParcelData parcel)
90 { 90 {
91 } 91 }
92 92
93 public void RemoveParcel(ParcelData parcel) 93 public void RemoveParcel(ParcelData parcel)
94 { 94 {
95 } 95 }
96 96
97 public void RemoveAllParcels() 97 public void RemoveAllParcels()
98 { 98 {
99 } 99 }
100 100
101 public void LoadParcels(ILocalStorageParcelReceiver recv) 101 public void LoadParcels(ILocalStorageParcelReceiver recv)
102 { 102 {
103 recv.NoParcelDataFromStorage(); 103 recv.NoParcelDataFromStorage();
104 } 104 }
105 105
106 public void ShutDown() 106 public void ShutDown()
107 { 107 {
108 sim.GetDb().Close(); 108 sim.GetDb().Close();
109 DB.Close(); 109 DB.Close();
110 } 110 }
111 } 111 }
112} \ No newline at end of file 112} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs
index 4463ac9..a3aac18 100644
--- a/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs
+++ b/OpenSim/Region/Storage/LocalStorageDb4o/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("Db4LocalStorage")] 36[assembly: AssemblyTitle("Db4LocalStorage")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("Db4LocalStorage")] 40[assembly: AssemblyProduct("Db4LocalStorage")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs
index 8214bc8..8d9f473 100644
--- a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs
+++ b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -1,267 +1,267 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework.Console; 31using OpenSim.Framework.Console;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34 34
35namespace OpenSim.Region.Storage.LocalStorageDb4o 35namespace OpenSim.Region.Storage.LocalStorageDb4o
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// 38 ///
39 /// </summary> 39 /// </summary>
40 public class Db4LocalStorage : ILocalStorage 40 public class Db4LocalStorage : ILocalStorage
41 { 41 {
42 private IObjectContainer db; 42 private IObjectContainer db;
43 private string datastore; 43 private string datastore;
44 44
45 public Db4LocalStorage() 45 public Db4LocalStorage()
46 { 46 {
47 47
48 } 48 }
49 49
50 public void Initialise(string dfile) 50 public void Initialise(string dfile)
51 { 51 {
52 MainLog.Instance.Warn("Db4LocalStorage Opening " + dfile); 52 MainLog.Instance.Warn("Db4LocalStorage Opening " + dfile);
53 datastore = dfile; 53 datastore = dfile;
54 try 54 try
55 { 55 {
56 db = Db4oFactory.OpenFile(datastore); 56 db = Db4oFactory.OpenFile(datastore);
57 MainLog.Instance.Verbose("Db4LocalStorage creation"); 57 MainLog.Instance.Verbose("Db4LocalStorage creation");
58 } 58 }
59 catch (Exception e) 59 catch (Exception e)
60 { 60 {
61 db.Close(); 61 db.Close();
62 MainLog.Instance.Warn("Db4LocalStorage :Constructor - Exception occured"); 62 MainLog.Instance.Warn("Db4LocalStorage :Constructor - Exception occured");
63 MainLog.Instance.Warn(e.ToString()); 63 MainLog.Instance.Warn(e.ToString());
64 } 64 }
65 } 65 }
66 66
67 public void StorePrim(PrimData prim) 67 public void StorePrim(PrimData prim)
68 { 68 {
69 IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID)); 69 IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID));
70 if (result.Count > 0) 70 if (result.Count > 0)
71 { 71 {
72 //prim already in storage 72 //prim already in storage
73 //so update it 73 //so update it
74 PrimData found = (PrimData)result.Next(); 74 PrimData found = (PrimData)result.Next();
75 found.PathBegin = prim.PathBegin; 75 found.PathBegin = prim.PathBegin;
76 found.PathCurve = prim.PathCurve; 76 found.PathCurve = prim.PathCurve;
77 found.PathEnd = prim.PathEnd; 77 found.PathEnd = prim.PathEnd;
78 found.PathRadiusOffset = prim.PathRadiusOffset; 78 found.PathRadiusOffset = prim.PathRadiusOffset;
79 found.PathRevolutions = prim.PathRevolutions; 79 found.PathRevolutions = prim.PathRevolutions;
80 found.PathScaleX = prim.PathScaleX; 80 found.PathScaleX = prim.PathScaleX;
81 found.PathScaleY = prim.PathScaleY; 81 found.PathScaleY = prim.PathScaleY;
82 found.PathShearX = prim.PathShearX; 82 found.PathShearX = prim.PathShearX;
83 found.PathShearY = prim.PathShearY; 83 found.PathShearY = prim.PathShearY;
84 found.PathSkew = prim.PathSkew; 84 found.PathSkew = prim.PathSkew;
85 found.PathTaperX = prim.PathTaperX; 85 found.PathTaperX = prim.PathTaperX;
86 found.PathTaperY = prim.PathTaperY; 86 found.PathTaperY = prim.PathTaperY;
87 found.PathTwist = prim.PathTwist; 87 found.PathTwist = prim.PathTwist;
88 found.PathTwistBegin = prim.PathTwistBegin; 88 found.PathTwistBegin = prim.PathTwistBegin;
89 found.PCode = prim.PCode; 89 found.PCode = prim.PCode;
90 found.ProfileBegin = prim.ProfileBegin; 90 found.ProfileBegin = prim.ProfileBegin;
91 found.ProfileCurve = prim.ProfileCurve; 91 found.ProfileCurve = prim.ProfileCurve;
92 found.ProfileEnd = prim.ProfileEnd; 92 found.ProfileEnd = prim.ProfileEnd;
93 found.ProfileHollow = prim.ProfileHollow; 93 found.ProfileHollow = prim.ProfileHollow;
94 found.Position = prim.Position; 94 found.Position = prim.Position;
95 found.Rotation = prim.Rotation; 95 found.Rotation = prim.Rotation;
96 found.TextureEntry = prim.TextureEntry; 96 found.TextureEntry = prim.TextureEntry;
97 db.Set(found); 97 db.Set(found);
98 db.Commit(); 98 db.Commit();
99 } 99 }
100 else 100 else
101 { 101 {
102 //not in storage 102 //not in storage
103 db.Set(prim); 103 db.Set(prim);
104 db.Commit(); 104 db.Commit();
105 } 105 }
106 } 106 }
107 107
108 public void RemovePrim(LLUUID primID) 108 public void RemovePrim(LLUUID primID)
109 { 109 {
110 IObjectSet result = db.Query(new UUIDPrimQuery(primID)); 110 IObjectSet result = db.Query(new UUIDPrimQuery(primID));
111 if (result.Count > 0) 111 if (result.Count > 0)
112 { 112 {
113 PrimData found = (PrimData)result.Next(); 113 PrimData found = (PrimData)result.Next();
114 db.Delete(found); 114 db.Delete(found);
115 } 115 }
116 } 116 }
117 117
118 118
119 public void LoadPrimitives(ILocalStorageReceiver receiver) 119 public void LoadPrimitives(ILocalStorageReceiver receiver)
120 { 120 {
121 IObjectSet result = db.Get(typeof(PrimData)); 121 IObjectSet result = db.Get(typeof(PrimData));
122 MainLog.Instance.Verbose("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is " + result.Count); 122 MainLog.Instance.Verbose("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is " + result.Count);
123 foreach (PrimData prim in result) 123 foreach (PrimData prim in result)
124 { 124 {
125 receiver.PrimFromStorage(prim); 125 receiver.PrimFromStorage(prim);
126 } 126 }
127 } 127 }
128 128
129 public float[] LoadWorld() 129 public float[] LoadWorld()
130 { 130 {
131 MainLog.Instance.Verbose("LoadWorld() - Loading world...."); 131 MainLog.Instance.Verbose("LoadWorld() - Loading world....");
132 float[] heightmap = null; 132 float[] heightmap = null;
133 MainLog.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); 133 MainLog.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB");
134 IObjectSet world_result = db.Get(typeof(MapStorage)); 134 IObjectSet world_result = db.Get(typeof(MapStorage));
135 if (world_result.Count > 0) 135 if (world_result.Count > 0)
136 { 136 {
137 MainLog.Instance.Verbose("LoadWorld() - Found a heightmap in local database, loading"); 137 MainLog.Instance.Verbose("LoadWorld() - Found a heightmap in local database, loading");
138 MapStorage map = (MapStorage)world_result.Next(); 138 MapStorage map = (MapStorage)world_result.Next();
139 //blank.LandMap = map.Map; 139 //blank.LandMap = map.Map;
140 heightmap = map.Map; 140 heightmap = map.Map;
141 } 141 }
142 return heightmap; 142 return heightmap;
143 } 143 }
144 144
145 public void SaveMap(float[] heightmap) 145 public void SaveMap(float[] heightmap)
146 { 146 {
147 IObjectSet world_result = db.Get(typeof(MapStorage)); 147 IObjectSet world_result = db.Get(typeof(MapStorage));
148 if (world_result.Count > 0) 148 if (world_result.Count > 0)
149 { 149 {
150 MainLog.Instance.Verbose("SaveWorld() - updating saved copy of heightmap in local database"); 150 MainLog.Instance.Verbose("SaveWorld() - updating saved copy of heightmap in local database");
151 MapStorage map = (MapStorage)world_result.Next(); 151 MapStorage map = (MapStorage)world_result.Next();
152 db.Delete(map); 152 db.Delete(map);
153 } 153 }
154 MapStorage map1 = new MapStorage(); 154 MapStorage map1 = new MapStorage();
155 map1.Map = heightmap; //OpenSim_Main.local_world.LandMap; 155 map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
156 db.Set(map1); 156 db.Set(map1);
157 db.Commit(); 157 db.Commit();
158 } 158 }
159 159
160 public void SaveParcel(ParcelData parcel) 160 public void SaveParcel(ParcelData parcel)
161 { 161 {
162 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); 162 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
163 if (result.Count > 0) 163 if (result.Count > 0)
164 { 164 {
165 //Old Parcel 165 //Old Parcel
166 ParcelData updateParcel = (ParcelData)result.Next(); 166 ParcelData updateParcel = (ParcelData)result.Next();
167 updateParcel.AABBMax = parcel.AABBMax; 167 updateParcel.AABBMax = parcel.AABBMax;
168 updateParcel.AABBMin = parcel.AABBMin; 168 updateParcel.AABBMin = parcel.AABBMin;
169 updateParcel.area = parcel.area; 169 updateParcel.area = parcel.area;
170 updateParcel.auctionID = parcel.auctionID; 170 updateParcel.auctionID = parcel.auctionID;
171 updateParcel.authBuyerID = parcel.authBuyerID; 171 updateParcel.authBuyerID = parcel.authBuyerID;
172 updateParcel.category = parcel.category; 172 updateParcel.category = parcel.category;
173 updateParcel.claimDate = parcel.claimDate; 173 updateParcel.claimDate = parcel.claimDate;
174 updateParcel.claimPrice = parcel.claimPrice; 174 updateParcel.claimPrice = parcel.claimPrice;
175 updateParcel.groupID = parcel.groupID; 175 updateParcel.groupID = parcel.groupID;
176 updateParcel.groupPrims = parcel.groupPrims; 176 updateParcel.groupPrims = parcel.groupPrims;
177 updateParcel.isGroupOwned = parcel.isGroupOwned; 177 updateParcel.isGroupOwned = parcel.isGroupOwned;
178 updateParcel.landingType = parcel.landingType; 178 updateParcel.landingType = parcel.landingType;
179 updateParcel.mediaAutoScale = parcel.mediaAutoScale; 179 updateParcel.mediaAutoScale = parcel.mediaAutoScale;
180 updateParcel.mediaID = parcel.mediaID; 180 updateParcel.mediaID = parcel.mediaID;
181 updateParcel.mediaURL = parcel.mediaURL; 181 updateParcel.mediaURL = parcel.mediaURL;
182 updateParcel.musicURL = parcel.musicURL; 182 updateParcel.musicURL = parcel.musicURL;
183 updateParcel.localID = parcel.localID; 183 updateParcel.localID = parcel.localID;
184 updateParcel.ownerID = parcel.ownerID; 184 updateParcel.ownerID = parcel.ownerID;
185 updateParcel.passHours = parcel.passHours; 185 updateParcel.passHours = parcel.passHours;
186 updateParcel.passPrice = parcel.passPrice; 186 updateParcel.passPrice = parcel.passPrice;
187 updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone(); 187 updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone();
188 updateParcel.parcelDesc = parcel.parcelDesc; 188 updateParcel.parcelDesc = parcel.parcelDesc;
189 updateParcel.parcelFlags = parcel.parcelFlags; 189 updateParcel.parcelFlags = parcel.parcelFlags;
190 updateParcel.parcelName = parcel.parcelName; 190 updateParcel.parcelName = parcel.parcelName;
191 updateParcel.parcelStatus = parcel.parcelStatus; 191 updateParcel.parcelStatus = parcel.parcelStatus;
192 updateParcel.salePrice = parcel.salePrice; 192 updateParcel.salePrice = parcel.salePrice;
193 updateParcel.snapshotID = parcel.snapshotID; 193 updateParcel.snapshotID = parcel.snapshotID;
194 updateParcel.userLocation = parcel.userLocation; 194 updateParcel.userLocation = parcel.userLocation;
195 updateParcel.userLookAt = parcel.userLookAt; 195 updateParcel.userLookAt = parcel.userLookAt;
196 196
197 db.Set(updateParcel); 197 db.Set(updateParcel);
198 } 198 }
199 else 199 else
200 { 200 {
201 db.Set(parcel); 201 db.Set(parcel);
202 } 202 }
203 db.Commit(); 203 db.Commit();
204 } 204 }
205 205
206 public void SaveParcels(ParcelData[] parcel_data) 206 public void SaveParcels(ParcelData[] parcel_data)
207 { 207 {
208 MainLog.Instance.Notice("Parcel Backup: Saving Parcels..."); 208 MainLog.Instance.Notice("Parcel Backup: Saving Parcels...");
209 int i; 209 int i;
210 for (i = 0; i < parcel_data.GetLength(0); i++) 210 for (i = 0; i < parcel_data.GetLength(0); i++)
211 { 211 {
212 212
213 SaveParcel(parcel_data[i]); 213 SaveParcel(parcel_data[i]);
214 214
215 } 215 }
216 MainLog.Instance.Notice("Parcel Backup: Parcel Save Complete"); 216 MainLog.Instance.Notice("Parcel Backup: Parcel Save Complete");
217 } 217 }
218 218
219 public void RemoveParcel(ParcelData parcel) 219 public void RemoveParcel(ParcelData parcel)
220 { 220 {
221 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); 221 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
222 if (result.Count > 0) 222 if (result.Count > 0)
223 { 223 {
224 db.Delete(result[0]); 224 db.Delete(result[0]);
225 } 225 }
226 db.Commit(); 226 db.Commit();
227 } 227 }
228 public void RemoveAllParcels() 228 public void RemoveAllParcels()
229 { 229 {
230 MainLog.Instance.Notice("Parcel Backup: Removing all parcels..."); 230 MainLog.Instance.Notice("Parcel Backup: Removing all parcels...");
231 IObjectSet result = db.Get(typeof(ParcelData)); 231 IObjectSet result = db.Get(typeof(ParcelData));
232 if (result.Count > 0) 232 if (result.Count > 0)
233 { 233 {
234 foreach (ParcelData parcelData in result) 234 foreach (ParcelData parcelData in result)
235 { 235 {
236 RemoveParcel(parcelData); 236 RemoveParcel(parcelData);
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 public void LoadParcels(ILocalStorageParcelReceiver recv) 241 public void LoadParcels(ILocalStorageParcelReceiver recv)
242 { 242 {
243 MainLog.Instance.Notice("Parcel Backup: Loading Parcels..."); 243 MainLog.Instance.Notice("Parcel Backup: Loading Parcels...");
244 IObjectSet result = db.Get(typeof(ParcelData)); 244 IObjectSet result = db.Get(typeof(ParcelData));
245 if (result.Count > 0) 245 if (result.Count > 0)
246 { 246 {
247 MainLog.Instance.Notice("Parcel Backup: Parcels exist in database."); 247 MainLog.Instance.Notice("Parcel Backup: Parcels exist in database.");
248 foreach (ParcelData parcelData in result) 248 foreach (ParcelData parcelData in result)
249 { 249 {
250 250
251 recv.ParcelFromStorage(parcelData); 251 recv.ParcelFromStorage(parcelData);
252 } 252 }
253 } 253 }
254 else 254 else
255 { 255 {
256 MainLog.Instance.Notice("Parcel Backup: No parcels exist. Creating basic parcel."); 256 MainLog.Instance.Notice("Parcel Backup: No parcels exist. Creating basic parcel.");
257 recv.NoParcelDataFromStorage(); 257 recv.NoParcelDataFromStorage();
258 } 258 }
259 MainLog.Instance.Notice("Parcel Backup: Parcels Restored"); 259 MainLog.Instance.Notice("Parcel Backup: Parcels Restored");
260 } 260 }
261 public void ShutDown() 261 public void ShutDown()
262 { 262 {
263 db.Commit(); 263 db.Commit();
264 db.Close(); 264 db.Close();
265 } 265 }
266 } 266 }
267} \ No newline at end of file 267} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs
index ec82d02..3a5dd19 100644
--- a/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs
+++ b/OpenSim/Region/Storage/LocalStorageDb4o/MapStorage.cs
@@ -1,39 +1,39 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Region.Storage.LocalStorageDb4o 28namespace OpenSim.Region.Storage.LocalStorageDb4o
29{ 29{
30 public class MapStorage 30 public class MapStorage
31 { 31 {
32 public float[] Map; 32 public float[] Map;
33 33
34 public MapStorage() 34 public MapStorage()
35 { 35 {
36 36
37 } 37 }
38 } 38 }
39} \ No newline at end of file 39} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs
index 6e6768c..debaa88 100644
--- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs
+++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs
@@ -1,47 +1,47 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Db4objects.Db4o.Query; 28using Db4objects.Db4o.Query;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Types; 30using OpenSim.Framework.Types;
31 31
32namespace OpenSim.Region.Storage.LocalStorageDb4o 32namespace OpenSim.Region.Storage.LocalStorageDb4o
33{ 33{
34 public class UUIDParcelQuery : Predicate 34 public class UUIDParcelQuery : Predicate
35 { 35 {
36 private LLUUID globalIDSearch; 36 private LLUUID globalIDSearch;
37 37
38 public UUIDParcelQuery(LLUUID find) 38 public UUIDParcelQuery(LLUUID find)
39 { 39 {
40 globalIDSearch = find; 40 globalIDSearch = find;
41 } 41 }
42 public bool Match(ParcelData parcel) 42 public bool Match(ParcelData parcel)
43 { 43 {
44 return (parcel.globalID == globalIDSearch); 44 return (parcel.globalID == globalIDSearch);
45 } 45 }
46 } 46 }
47} 47}
diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs
index eb309cb..d5077ff 100644
--- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs
+++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDPrimQuery.cs
@@ -1,47 +1,47 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Db4objects.Db4o.Query; 28using Db4objects.Db4o.Query;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Types; 30using OpenSim.Framework.Types;
31 31
32namespace OpenSim.Region.Storage.LocalStorageDb4o 32namespace OpenSim.Region.Storage.LocalStorageDb4o
33{ 33{
34 public class UUIDPrimQuery : Predicate 34 public class UUIDPrimQuery : Predicate
35 { 35 {
36 private LLUUID _findID; 36 private LLUUID _findID;
37 37
38 public UUIDPrimQuery(LLUUID find) 38 public UUIDPrimQuery(LLUUID find)
39 { 39 {
40 _findID = find; 40 _findID = find;
41 } 41 }
42 public bool Match(PrimData prim) 42 public bool Match(PrimData prim)
43 { 43 {
44 return (prim.FullID == _findID); 44 return (prim.FullID == _findID);
45 } 45 }
46 } 46 }
47} 47}
diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs
index 7bc1cc5..6bbaf0f 100644
--- a/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Storage/LocalStorageSQLite/Properties/AssemblyInfo.cs
@@ -1,60 +1,60 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OpenSim.Region.Storage.LocalStorageSQLite")] 33[assembly: AssemblyTitle("OpenSim.Region.Storage.LocalStorageSQLite")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OpenSim.Region.Storage.LocalStorageSQLite")] 37[assembly: AssemblyProduct("OpenSim.Region.Storage.LocalStorageSQLite")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("ecd6e0c1-7909-413e-9e3f-659678ac3bc3")] 48[assembly: Guid("ecd6e0c1-7909-413e-9e3f-659678ac3bc3")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57// You can specify all the values or you can default the Revision and Build Numbers 57// You can specify all the values or you can default the Revision and Build Numbers
58// by using the '*' as shown below: 58// by using the '*' as shown below:
59[assembly: AssemblyVersion("1.0.0.0")] 59[assembly: AssemblyVersion("1.0.0.0")]
60[assembly: AssemblyFileVersion("1.0.0.0")] 60[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
index 9900a98..599ff6c 100644
--- a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
+++ b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
@@ -1,198 +1,198 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29// SQLite Support 29// SQLite Support
30// A bad idea, but the IRC people told me to! 30// A bad idea, but the IRC people told me to!
31 31
32using System; 32using System;
33using System.Data; 33using System.Data;
34using System.Data.SQLite; 34using System.Data.SQLite;
35using libsecondlife; 35using libsecondlife;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Types; 38using OpenSim.Framework.Types;
39 39
40namespace OpenSim.Region.Storage.LocalStorageSQLite 40namespace OpenSim.Region.Storage.LocalStorageSQLite
41{ 41{
42 public class SQLiteLocalStorage : ILocalStorage 42 public class SQLiteLocalStorage : ILocalStorage
43 { 43 {
44 IDbConnection db; 44 IDbConnection db;
45 45
46 public SQLiteLocalStorage() 46 public SQLiteLocalStorage()
47 { 47 {
48 try 48 try
49 { 49 {
50 string connectionstring = "URI=file:localsim.sdb"; 50 string connectionstring = "URI=file:localsim.sdb";
51 db = (IDbConnection)new SQLiteConnection(connectionstring); 51 db = (IDbConnection)new SQLiteConnection(connectionstring);
52 db.Open(); 52 db.Open();
53 } 53 }
54 catch (Exception e) 54 catch (Exception e)
55 { 55 {
56 db.Close(); 56 db.Close();
57 MainLog.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured"); 57 MainLog.Instance.Warn("SQLiteLocalStorage :Constructor - Exception occured");
58 MainLog.Instance.Warn(e.ToString()); 58 MainLog.Instance.Warn(e.ToString());
59 } 59 }
60 } 60 }
61 61
62 public void Initialise(string file) 62 public void Initialise(string file)
63 { 63 {
64 // Blank 64 // Blank
65 } 65 }
66 66
67 public void StorePrim(PrimData prim) 67 public void StorePrim(PrimData prim)
68 { 68 {
69 IDbCommand cmd = db.CreateCommand(); 69 IDbCommand cmd = db.CreateCommand();
70 70
71 //SECURITY WARNING: 71 //SECURITY WARNING:
72 // These parameters wont produce SQL injections since they are all integer based, however. 72 // These parameters wont produce SQL injections since they are all integer based, however.
73 // if inserting strings such as name or description, you will need to use appropriate 73 // if inserting strings such as name or description, you will need to use appropriate
74 // measures to prevent SQL injection (although the value of SQL injection in this is limited). 74 // measures to prevent SQL injection (although the value of SQL injection in this is limited).
75 75
76 string sql = "REPLACE INTO prim (OwnerID,PCode,PathBegin,PathEnd,PathScaleX,PathScaleY,PathShearX,PathShearY,PathSkew,ProfileBegin,ProfileEnd,Scale,PathCurve,ProfileCurve,ParentID,ProfileHollow,PathRadiusOffset,PathRevolutions,PathTaperX,PathTaperY,PathTwist,PathTwistBegin,Texture,CreationDate,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,Position,Rotation,LocalID,FullID) "; 76 string sql = "REPLACE INTO prim (OwnerID,PCode,PathBegin,PathEnd,PathScaleX,PathScaleY,PathShearX,PathShearY,PathSkew,ProfileBegin,ProfileEnd,Scale,PathCurve,ProfileCurve,ParentID,ProfileHollow,PathRadiusOffset,PathRevolutions,PathTaperX,PathTaperY,PathTwist,PathTwistBegin,Texture,CreationDate,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,Position,Rotation,LocalID,FullID) ";
77 sql += "VALUES ("; 77 sql += "VALUES (";
78 sql += "\"" + prim.OwnerID.ToStringHyphenated() + "\","; // KILL ME NOW! 78 sql += "\"" + prim.OwnerID.ToStringHyphenated() + "\","; // KILL ME NOW!
79 sql += "\"" + prim.PCode.ToString() + "\","; 79 sql += "\"" + prim.PCode.ToString() + "\",";
80 sql += "\"" + prim.PathBegin.ToString() + "\","; 80 sql += "\"" + prim.PathBegin.ToString() + "\",";
81 sql += "\"" + prim.PathEnd.ToString() + "\","; 81 sql += "\"" + prim.PathEnd.ToString() + "\",";
82 sql += "\"" + prim.PathScaleX.ToString() + "\","; 82 sql += "\"" + prim.PathScaleX.ToString() + "\",";
83 sql += "\"" + prim.PathScaleY.ToString() + "\","; 83 sql += "\"" + prim.PathScaleY.ToString() + "\",";
84 sql += "\"" + prim.PathShearX.ToString() + "\","; 84 sql += "\"" + prim.PathShearX.ToString() + "\",";
85 sql += "\"" + prim.PathShearY.ToString() + "\","; 85 sql += "\"" + prim.PathShearY.ToString() + "\",";
86 sql += "\"" + prim.PathSkew.ToString() + "\","; 86 sql += "\"" + prim.PathSkew.ToString() + "\",";
87 sql += "\"" + prim.ProfileBegin.ToString() + "\","; 87 sql += "\"" + prim.ProfileBegin.ToString() + "\",";
88 sql += "\"" + prim.ProfileEnd.ToString() + "\","; 88 sql += "\"" + prim.ProfileEnd.ToString() + "\",";
89 sql += "\"" + prim.Scale.ToString() + "\","; 89 sql += "\"" + prim.Scale.ToString() + "\",";
90 sql += "\"" + prim.PathCurve.ToString() + "\","; 90 sql += "\"" + prim.PathCurve.ToString() + "\",";
91 sql += "\"" + prim.ProfileCurve.ToString() + "\","; 91 sql += "\"" + prim.ProfileCurve.ToString() + "\",";
92 sql += "\"" + prim.ParentID.ToString() + "\","; 92 sql += "\"" + prim.ParentID.ToString() + "\",";
93 sql += "\"" + prim.ProfileHollow.ToString() + "\","; 93 sql += "\"" + prim.ProfileHollow.ToString() + "\",";
94 sql += "\"" + prim.PathRadiusOffset.ToString() + "\","; 94 sql += "\"" + prim.PathRadiusOffset.ToString() + "\",";
95 sql += "\"" + prim.PathRevolutions.ToString() + "\","; 95 sql += "\"" + prim.PathRevolutions.ToString() + "\",";
96 sql += "\"" + prim.PathTaperX.ToString() + "\","; 96 sql += "\"" + prim.PathTaperX.ToString() + "\",";
97 sql += "\"" + prim.PathTaperY.ToString() + "\","; 97 sql += "\"" + prim.PathTaperY.ToString() + "\",";
98 sql += "\"" + prim.PathTwist.ToString() + "\","; 98 sql += "\"" + prim.PathTwist.ToString() + "\",";
99 sql += "\"" + prim.PathTwistBegin.ToString() + "\","; 99 sql += "\"" + prim.PathTwistBegin.ToString() + "\",";
100 sql += "\"" + prim.TextureEntry.ToString() + "\","; 100 sql += "\"" + prim.TextureEntry.ToString() + "\",";
101 sql += "\"" + prim.CreationDate.ToString() + "\","; 101 sql += "\"" + prim.CreationDate.ToString() + "\",";
102 sql += "\"" + prim.OwnerMask.ToString() + "\","; 102 sql += "\"" + prim.OwnerMask.ToString() + "\",";
103 sql += "\"" + prim.NextOwnerMask.ToString() + "\","; 103 sql += "\"" + prim.NextOwnerMask.ToString() + "\",";
104 sql += "\"" + prim.GroupMask.ToString() + "\","; 104 sql += "\"" + prim.GroupMask.ToString() + "\",";
105 sql += "\"" + prim.EveryoneMask.ToString() + "\","; 105 sql += "\"" + prim.EveryoneMask.ToString() + "\",";
106 sql += "\"" + prim.BaseMask.ToString() + "\","; 106 sql += "\"" + prim.BaseMask.ToString() + "\",";
107 sql += "\"" + prim.Position.ToString() + "\","; 107 sql += "\"" + prim.Position.ToString() + "\",";
108 sql += "\"" + prim.Rotation.ToString() + "\","; 108 sql += "\"" + prim.Rotation.ToString() + "\",";
109 sql += "\"" + prim.LocalID.ToString() + "\","; 109 sql += "\"" + prim.LocalID.ToString() + "\",";
110 sql += "\"" + prim.FullID.ToString() + "\")"; 110 sql += "\"" + prim.FullID.ToString() + "\")";
111 111
112 cmd.CommandText = sql; 112 cmd.CommandText = sql;
113 113
114 try 114 try
115 { 115 {
116 cmd.ExecuteNonQuery(); 116 cmd.ExecuteNonQuery();
117 } 117 }
118 catch (Exception e) 118 catch (Exception e)
119 { 119 {
120 MainLog.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured"); 120 MainLog.Instance.Warn("SQLiteLocalStorage :StorePrim - Exception occured");
121 MainLog.Instance.Warn(e.ToString()); 121 MainLog.Instance.Warn(e.ToString());
122 } 122 }
123 123
124 cmd.Dispose(); 124 cmd.Dispose();
125 cmd = null; 125 cmd = null;
126 } 126 }
127 127
128 public void RemovePrim(LLUUID primID) 128 public void RemovePrim(LLUUID primID)
129 { 129 {
130 IDbCommand cmd = db.CreateCommand(); 130 IDbCommand cmd = db.CreateCommand();
131 131
132 //SECURITY WARNING: 132 //SECURITY WARNING:
133 // These parameters wont produce SQL injections since they are all integer based, however. 133 // These parameters wont produce SQL injections since they are all integer based, however.
134 // if inserting strings such as name or description, you will need to use appropriate 134 // if inserting strings such as name or description, you will need to use appropriate
135 // measures to prevent SQL injection (although the value of SQL injection in this is limited). 135 // measures to prevent SQL injection (although the value of SQL injection in this is limited).
136 136
137 string sql = "DELETE FROM prim WHERE FullID = \"" + primID.ToStringHyphenated() + "\""; 137 string sql = "DELETE FROM prim WHERE FullID = \"" + primID.ToStringHyphenated() + "\"";
138 138
139 cmd.CommandText = sql; 139 cmd.CommandText = sql;
140 140
141 try 141 try
142 { 142 {
143 cmd.ExecuteNonQuery(); 143 cmd.ExecuteNonQuery();
144 } 144 }
145 catch (Exception e) 145 catch (Exception e)
146 { 146 {
147 MainLog.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured"); 147 MainLog.Instance.Warn("SQLiteLocalStorage :RemovePrim - Exception occured");
148 MainLog.Instance.Warn(e.ToString()); 148 MainLog.Instance.Warn(e.ToString());
149 } 149 }
150 150
151 cmd.Dispose(); 151 cmd.Dispose();
152 cmd = null; 152 cmd = null;
153 } 153 }
154 154
155 public void LoadPrimitives(ILocalStorageReceiver receiver) 155 public void LoadPrimitives(ILocalStorageReceiver receiver)
156 { 156 {
157 157
158 } 158 }
159 159
160 public float[] LoadWorld() 160 public float[] LoadWorld()
161 { 161 {
162 return new float[65536]; 162 return new float[65536];
163 } 163 }
164 164
165 public void SaveMap(float[] heightmap) 165 public void SaveMap(float[] heightmap)
166 { 166 {
167 167
168 } 168 }
169 169
170 public void SaveParcels(ParcelData[] parcel_manager) 170 public void SaveParcels(ParcelData[] parcel_manager)
171 { 171 {
172 172
173 } 173 }
174 174
175 public void SaveParcel(ParcelData parcel) 175 public void SaveParcel(ParcelData parcel)
176 { 176 {
177 } 177 }
178 178
179 public void RemoveParcel(ParcelData parcel) 179 public void RemoveParcel(ParcelData parcel)
180 { 180 {
181 } 181 }
182 182
183 public void RemoveAllParcels() 183 public void RemoveAllParcels()
184 { 184 {
185 } 185 }
186 186
187 public void LoadParcels(ILocalStorageParcelReceiver recv) 187 public void LoadParcels(ILocalStorageParcelReceiver recv)
188 { 188 {
189 recv.NoParcelDataFromStorage(); 189 recv.NoParcelDataFromStorage();
190 } 190 }
191 191
192 public void ShutDown() 192 public void ShutDown()
193 { 193 {
194 db.Close(); 194 db.Close();
195 db = null; 195 db = null;
196 } 196 }
197 } 197 }
198} \ No newline at end of file 198} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
index 7c8bd07..3ce0967 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
@@ -1,65 +1,66 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Region.Environment.Scenes; 5using OpenSim.Region.Environment.Scenes;
6using OpenSim.Region.Environment; 6using OpenSim.Region.Environment;
7using OpenSim.Region.Interfaces; 7using OpenSim.Region.Interfaces;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using libsecondlife; 9using libsecondlife;
10 10
11namespace OpenSim.DataStore.NullStorage 11namespace OpenSim.DataStore.NullStorage
12{ 12{
13 public class NullDataStore : IRegionDataStore 13 public class NullDataStore : IRegionDataStore
14 { 14 {
15 public void Initialise(string dbfile, string dbname) 15
16 { 16 public void Initialise(string dbfile, string dbname)
17 return; 17 {
18 } 18 return;
19 19 }
20 public void StoreObject(SceneObject obj) 20
21 { 21 public void StoreObject(SceneObject obj)
22 22 {
23 } 23
24 24 }
25 public void RemoveObject(LLUUID obj) 25
26 { 26 public void RemoveObject(LLUUID obj)
27 27 {
28 } 28
29 29 }
30 public List<SceneObject> LoadObjects() 30
31 { 31 public List<SceneObject> LoadObjects()
32 return new List<SceneObject>(); 32 {
33 } 33 return new List<SceneObject>();
34 34 }
35 public void StoreTerrain(double[,] ter) 35
36 { 36 public void StoreTerrain(double[,] ter)
37 37 {
38 } 38
39 39 }
40 public double[,] LoadTerrain() 40
41 { 41 public double[,] LoadTerrain()
42 return null; 42 {
43 } 43 return null;
44 44 }
45 public void RemoveParcel(uint id) 45
46 { 46 public void RemoveParcel(uint id)
47 47 {
48 } 48
49 49 }
50 public void StoreParcel(OpenSim.Region.Environment.Parcel parcel) 50
51 { 51 public void StoreParcel(OpenSim.Region.Environment.Parcel parcel)
52 52 {
53 } 53
54 54 }
55 public List<OpenSim.Region.Environment.Parcel> LoadParcels() 55
56 { 56 public List<OpenSim.Region.Environment.Parcel> LoadParcels()
57 return new List<OpenSim.Region.Environment.Parcel>(); 57 {
58 } 58 return new List<OpenSim.Region.Environment.Parcel>();
59 59 }
60 public void Shutdown() 60
61 { 61 public void Shutdown()
62 62 {
63 } 63
64 } 64 }
65} 65 }
66}
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs
index c0bd46d..fd86315 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs
@@ -1,35 +1,35 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.DataStore.NullStorage")] 8[assembly: AssemblyTitle("OpenSim.DataStore.NullStorage")]
9[assembly: AssemblyDescription("")] 9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")] 10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")] 11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.DataStore.NullStorage")] 12[assembly: AssemblyProduct("OpenSim.DataStore.NullStorage")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
22// The following GUID is for the ID of the typelib if this project is exposed to COM 22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b4a1656d-de22-4080-a970-fd8166acbf16")] 23[assembly: Guid("b4a1656d-de22-4080-a970-fd8166acbf16")]
24 24
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32// You can specify all the values or you can default the Revision and Build Numbers 32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below: 33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")] 34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
index 9c721d1..c523cd6 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
@@ -1,60 +1,60 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")] 33[assembly: AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")] 37[assembly: AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")] 48[assembly: Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57// You can specify all the values or you can default the Revision and Build Numbers 57// You can specify all the values or you can default the Revision and Build Numbers
58// by using the '*' as shown below: 58// by using the '*' as shown below:
59[assembly: AssemblyVersion("1.0.0.0")] 59[assembly: AssemblyVersion("1.0.0.0")]
60[assembly: AssemblyFileVersion("1.0.0.0")] 60[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
index f017e44..6f3afea 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
@@ -1,954 +1,954 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using System.IO; 32using System.IO;
33using libTerrain; 33using libTerrain;
34using OpenJPEGNet; 34using OpenJPEGNet;
35 35
36namespace OpenSim.Region.Terrain 36namespace OpenSim.Region.Terrain
37{ 37{
38 public class TerrainCommand 38 public class TerrainCommand
39 { 39 {
40 public virtual bool run(string[] cmdargs, ref string output) 40 public virtual bool run(string[] cmdargs, ref string output)
41 { 41 {
42 return false; 42 return false;
43 } 43 }
44 44
45 public string args; 45 public string args;
46 public string help; 46 public string help;
47 } 47 }
48 48
49 public class TerrainEngine 49 public class TerrainEngine
50 { 50 {
51 /// <summary> 51 /// <summary>
52 /// Plugin library for scripts 52 /// Plugin library for scripts
53 /// </summary> 53 /// </summary>
54 public FilterHost customFilters = new FilterHost(); 54 public FilterHost customFilters = new FilterHost();
55 55
56 /// <summary> 56 /// <summary>
57 /// A [normally] 256x256 heightmap 57 /// A [normally] 256x256 heightmap
58 /// </summary> 58 /// </summary>
59 public Channel heightmap; 59 public Channel heightmap;
60 60
61 /// <summary> 61 /// <summary>
62 /// A copy of heightmap at the last save point (for reverting) 62 /// A copy of heightmap at the last save point (for reverting)
63 /// </summary> 63 /// </summary>
64 public Channel revertmap; 64 public Channel revertmap;
65 65
66 /// <summary> 66 /// <summary>
67 /// Water heightmap (needs clientside mods to work) 67 /// Water heightmap (needs clientside mods to work)
68 /// </summary> 68 /// </summary>
69 public Channel watermap; 69 public Channel watermap;
70 70
71 /// <summary> 71 /// <summary>
72 /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. 72 /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine.
73 /// Counts the number of modifications since the last save. (0 = Untainted) 73 /// Counts the number of modifications since the last save. (0 = Untainted)
74 /// </summary> 74 /// </summary>
75 public int tainted; 75 public int tainted;
76 76
77 int w, h; 77 int w, h;
78 78
79 /// <summary> 79 /// <summary>
80 /// Generate a new TerrainEngine instance and creates a new heightmap 80 /// Generate a new TerrainEngine instance and creates a new heightmap
81 /// </summary> 81 /// </summary>
82 public TerrainEngine() 82 public TerrainEngine()
83 { 83 {
84 w = 256; 84 w = 256;
85 h = 256; 85 h = 256;
86 heightmap = new Channel(w, h); 86 heightmap = new Channel(w, h);
87 87
88 tainted++; 88 tainted++;
89 } 89 }
90 90
91 /// <summary> 91 /// <summary>
92 /// Converts the heightmap to a 65536 value 1D floating point array 92 /// Converts the heightmap to a 65536 value 1D floating point array
93 /// </summary> 93 /// </summary>
94 /// <returns>A float[65536] array containing the heightmap</returns> 94 /// <returns>A float[65536] array containing the heightmap</returns>
95 public float[] getHeights1D() 95 public float[] getHeights1D()
96 { 96 {
97 float[] heights = new float[w * h]; 97 float[] heights = new float[w * h];
98 int i; 98 int i;
99 99
100 for (i = 0; i < w * h; i++) 100 for (i = 0; i < w * h; i++)
101 { 101 {
102 heights[i] = (float)heightmap.map[i / w, i % w]; 102 heights[i] = (float)heightmap.map[i / w, i % w];
103 } 103 }
104 104
105 return heights; 105 return heights;
106 } 106 }
107 107
108 /// <summary> 108 /// <summary>
109 /// Converts the heightmap to a 256x256 value 2D floating point array. 109 /// Converts the heightmap to a 256x256 value 2D floating point array.
110 /// </summary> 110 /// </summary>
111 /// <returns>An array of 256,256 values containing the heightmap</returns> 111 /// <returns>An array of 256,256 values containing the heightmap</returns>
112 public float[,] getHeights2D() 112 public float[,] getHeights2D()
113 { 113 {
114 float[,] heights = new float[w, h]; 114 float[,] heights = new float[w, h];
115 int x, y; 115 int x, y;
116 for (x = 0; x < w; x++) 116 for (x = 0; x < w; x++)
117 { 117 {
118 for (y = 0; y < h; y++) 118 for (y = 0; y < h; y++)
119 { 119 {
120 heights[x, y] = (float)heightmap.map[x, y]; 120 heights[x, y] = (float)heightmap.map[x, y];
121 } 121 }
122 } 122 }
123 return heights; 123 return heights;
124 } 124 }
125 125
126 /// <summary> 126 /// <summary>
127 /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version. 127 /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version.
128 /// </summary> 128 /// </summary>
129 /// <returns>An array of 256,256 values containing the heightmap</returns> 129 /// <returns>An array of 256,256 values containing the heightmap</returns>
130 public double[,] getHeights2DD() 130 public double[,] getHeights2DD()
131 { 131 {
132 return heightmap.map; 132 return heightmap.map;
133 } 133 }
134 134
135 /// <summary> 135 /// <summary>
136 /// Imports a 1D floating point array into the 2D heightmap array 136 /// Imports a 1D floating point array into the 2D heightmap array
137 /// </summary> 137 /// </summary>
138 /// <param name="heights">The array to import (must have 65536 members)</param> 138 /// <param name="heights">The array to import (must have 65536 members)</param>
139 public void setHeights1D(float[] heights) 139 public void setHeights1D(float[] heights)
140 { 140 {
141 int i; 141 int i;
142 for (i = 0; i < w * h; i++) 142 for (i = 0; i < w * h; i++)
143 { 143 {
144 heightmap.map[i / w, i % w] = heights[i]; 144 heightmap.map[i / w, i % w] = heights[i];
145 } 145 }
146 146
147 tainted++; 147 tainted++;
148 } 148 }
149 149
150 /// <summary> 150 /// <summary>
151 /// Loads a 2D array of values into the heightmap 151 /// Loads a 2D array of values into the heightmap
152 /// </summary> 152 /// </summary>
153 /// <param name="heights">An array of 256,256 float values</param> 153 /// <param name="heights">An array of 256,256 float values</param>
154 public void setHeights2D(float[,] heights) 154 public void setHeights2D(float[,] heights)
155 { 155 {
156 int x, y; 156 int x, y;
157 for (x = 0; x < w; x++) 157 for (x = 0; x < w; x++)
158 { 158 {
159 for (y = 0; y < h; y++) 159 for (y = 0; y < h; y++)
160 { 160 {
161 heightmap.set(x, y, (double)heights[x, y]); 161 heightmap.set(x, y, (double)heights[x, y]);
162 } 162 }
163 } 163 }
164 tainted++; 164 tainted++;
165 } 165 }
166 166
167 /// <summary> 167 /// <summary>
168 /// Loads a 2D array of values into the heightmap (Double Precision Version) 168 /// Loads a 2D array of values into the heightmap (Double Precision Version)
169 /// </summary> 169 /// </summary>
170 /// <param name="heights">An array of 256,256 float values</param> 170 /// <param name="heights">An array of 256,256 float values</param>
171 public void setHeights2D(double[,] heights) 171 public void setHeights2D(double[,] heights)
172 { 172 {
173 int x, y; 173 int x, y;
174 for (x = 0; x < w; x++) 174 for (x = 0; x < w; x++)
175 { 175 {
176 for (y = 0; y < h; y++) 176 for (y = 0; y < h; y++)
177 { 177 {
178 heightmap.set(x, y, heights[x, y]); 178 heightmap.set(x, y, heights[x, y]);
179 } 179 }
180 } 180 }
181 tainted++; 181 tainted++;
182 } 182 }
183 183
184 /// <summary> 184 /// <summary>
185 /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) 185 /// Swaps the two heightmap buffers (the 'revert map' and the heightmap)
186 /// </summary> 186 /// </summary>
187 public void swapRevertMaps() 187 public void swapRevertMaps()
188 { 188 {
189 Channel backup = heightmap.copy(); 189 Channel backup = heightmap.copy();
190 heightmap = revertmap; 190 heightmap = revertmap;
191 revertmap = backup; 191 revertmap = backup;
192 } 192 }
193 193
194 /// <summary> 194 /// <summary>
195 /// Saves the current heightmap into the revertmap 195 /// Saves the current heightmap into the revertmap
196 /// </summary> 196 /// </summary>
197 public void saveRevertMap() 197 public void saveRevertMap()
198 { 198 {
199 revertmap = heightmap.copy(); 199 revertmap = heightmap.copy();
200 } 200 }
201 201
202 /// <summary> 202 /// <summary>
203 /// Processes a terrain-specific command 203 /// Processes a terrain-specific command
204 /// </summary> 204 /// </summary>
205 /// <param name="args">Commandline arguments (space seperated)</param> 205 /// <param name="args">Commandline arguments (space seperated)</param>
206 /// <param name="resultText">Reference that returns error or help text if returning false</param> 206 /// <param name="resultText">Reference that returns error or help text if returning false</param>
207 /// <returns>If the operation was successful (if not, the error is placed into resultText)</returns> 207 /// <returns>If the operation was successful (if not, the error is placed into resultText)</returns>
208 public bool RunTerrainCmd(string[] args, ref string resultText, string simName) 208 public bool RunTerrainCmd(string[] args, ref string resultText, string simName)
209 { 209 {
210 string command = args[0]; 210 string command = args[0];
211 211
212 try 212 try
213 { 213 {
214 214
215 switch (command) 215 switch (command)
216 { 216 {
217 case "help": 217 case "help":
218 resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; 218 resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n";
219 resultText += "terrain voronoi <points> <blocksize> - generates a worley fractal with X points per block"; 219 resultText += "terrain voronoi <points> <blocksize> - generates a worley fractal with X points per block";
220 resultText += "terrain seed <seed> - sets the random seed value to <seed>\n"; 220 resultText += "terrain seed <seed> - sets the random seed value to <seed>\n";
221 resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; 221 resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n";
222 resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n"; 222 resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n";
223 resultText += "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n"; 223 resultText += "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n";
224 resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n"; 224 resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n";
225 resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n"; 225 resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n";
226 resultText += "terrain erode thermal <talus> <rounds> <carry>\n"; 226 resultText += "terrain erode thermal <talus> <rounds> <carry>\n";
227 resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; 227 resultText += "terrain multiply <val> - multiplies a terrain by <val>\n";
228 resultText += "terrain revert - reverts the terrain to the stored original\n"; 228 resultText += "terrain revert - reverts the terrain to the stored original\n";
229 resultText += "terrain bake - saves the current terrain into the revert map\n"; 229 resultText += "terrain bake - saves the current terrain into the revert map\n";
230 resultText += "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n"; 230 resultText += "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n";
231 resultText += "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n"; 231 resultText += "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n";
232 foreach (KeyValuePair<string, ITerrainFilter> filter in customFilters.filters) 232 foreach (KeyValuePair<string, ITerrainFilter> filter in customFilters.filters)
233 { 233 {
234 resultText += filter.Value.Help(); 234 resultText += filter.Value.Help();
235 } 235 }
236 236
237 return false; 237 return false;
238 238
239 case "revert": 239 case "revert":
240 swapRevertMaps(); 240 swapRevertMaps();
241 saveRevertMap(); 241 saveRevertMap();
242 break; 242 break;
243 243
244 case "bake": 244 case "bake":
245 saveRevertMap(); 245 saveRevertMap();
246 break; 246 break;
247 247
248 case "seed": 248 case "seed":
249 setSeed(Convert.ToInt32(args[1])); 249 setSeed(Convert.ToInt32(args[1]));
250 break; 250 break;
251 251
252 case "erode": 252 case "erode":
253 return consoleErosion(args, ref resultText); 253 return consoleErosion(args, ref resultText);
254 254
255 case "voronoi": 255 case "voronoi":
256 double[] c = new double[2]; 256 double[] c = new double[2];
257 c[0] = -1; 257 c[0] = -1;
258 c[1] = 1; 258 c[1] = 1;
259 heightmap.voronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c); 259 heightmap.voronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c);
260 break; 260 break;
261 261
262 case "hills": 262 case "hills":
263 return consoleHills(args, ref resultText); 263 return consoleHills(args, ref resultText);
264 264
265 case "regenerate": 265 case "regenerate":
266 hills(); 266 hills();
267 break; 267 break;
268 268
269 case "rescale": 269 case "rescale":
270 setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); 270 setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2]));
271 break; 271 break;
272 272
273 case "multiply": 273 case "multiply":
274 heightmap *= Convert.ToDouble(args[1]); 274 heightmap *= Convert.ToDouble(args[1]);
275 break; 275 break;
276 276
277 case "load": 277 case "load":
278 args[2].Replace("%name%", simName); 278 args[2].Replace("%name%", simName);
279 switch (args[1].ToLower()) 279 switch (args[1].ToLower())
280 { 280 {
281 case "f32": 281 case "f32":
282 loadFromFileF32(args[2]); 282 loadFromFileF32(args[2]);
283 break; 283 break;
284 284
285 case "f64": 285 case "f64":
286 loadFromFileF64(args[2]); 286 loadFromFileF64(args[2]);
287 break; 287 break;
288 288
289 case "raw": 289 case "raw":
290 loadFromFileSLRAW(args[2]); 290 loadFromFileSLRAW(args[2]);
291 break; 291 break;
292 292
293 case "img": 293 case "img":
294 heightmap.loadImage(args[2]); 294 heightmap.loadImage(args[2]);
295 return false; 295 return false;
296 296
297 default: 297 default:
298 resultText = "Unknown image or data format"; 298 resultText = "Unknown image or data format";
299 return false; 299 return false;
300 } 300 }
301 break; 301 break;
302 302
303 case "save": 303 case "save":
304 args[2].Replace("%name%", simName); 304 args[2].Replace("%name%", simName);
305 switch (args[1].ToLower()) 305 switch (args[1].ToLower())
306 { 306 {
307 case "f32": 307 case "f32":
308 writeToFileF32(args[2]); 308 writeToFileF32(args[2]);
309 break; 309 break;
310 310
311 case "f64": 311 case "f64":
312 writeToFileF64(args[2]); 312 writeToFileF64(args[2]);
313 break; 313 break;
314 314
315 case "grdmap": 315 case "grdmap":
316 exportImage(args[2], args[3]); 316 exportImage(args[2], args[3]);
317 break; 317 break;
318 318
319 case "png": 319 case "png":
320 heightmap.saveImage(args[2]); 320 heightmap.saveImage(args[2]);
321 break; 321 break;
322 322
323 case "raw": 323 case "raw":
324 writeToFileRAW(args[2]); 324 writeToFileRAW(args[2]);
325 break; 325 break;
326 326
327 case "hiraw": 327 case "hiraw":
328 writeToFileHiRAW(args[2]); 328 writeToFileHiRAW(args[2]);
329 break; 329 break;
330 330
331 default: 331 default:
332 resultText = "Unknown image or data format"; 332 resultText = "Unknown image or data format";
333 return false; 333 return false;
334 } 334 }
335 break; 335 break;
336 336
337 case "csfilter": 337 case "csfilter":
338 customFilters.LoadFilterCSharp(args[1]); 338 customFilters.LoadFilterCSharp(args[1]);
339 break; 339 break;
340 case "jsfilter": 340 case "jsfilter":
341 customFilters.LoadFilterJScript(args[1]); 341 customFilters.LoadFilterJScript(args[1]);
342 break; 342 break;
343 343
344 default: 344 default:
345 // Run any custom registered filters 345 // Run any custom registered filters
346 if (customFilters.filters.ContainsKey(command)) 346 if (customFilters.filters.ContainsKey(command))
347 { 347 {
348 customFilters.filters[command].Filter(heightmap, args); 348 customFilters.filters[command].Filter(heightmap, args);
349 break; 349 break;
350 } 350 }
351 else 351 else
352 { 352 {
353 resultText = "Unknown terrain command"; 353 resultText = "Unknown terrain command";
354 return false; 354 return false;
355 } 355 }
356 } 356 }
357 return true; 357 return true;
358 } 358 }
359 catch (Exception e) 359 catch (Exception e)
360 { 360 {
361 resultText = "Error running terrain command: " + e.ToString(); 361 resultText = "Error running terrain command: " + e.ToString();
362 return false; 362 return false;
363 } 363 }
364 } 364 }
365 365
366 private bool consoleErosion(string[] args, ref string resultText) 366 private bool consoleErosion(string[] args, ref string resultText)
367 { 367 {
368 switch (args[1].ToLower()) 368 switch (args[1].ToLower())
369 { 369 {
370 case "aerobic": 370 case "aerobic":
371 // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest 371 // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest
372 heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7])); 372 heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]));
373 break; 373 break;
374 case "thermal": 374 case "thermal":
375 heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); 375 heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4]));
376 break; 376 break;
377 default: 377 default:
378 resultText = "Unknown erosion type"; 378 resultText = "Unknown erosion type";
379 return false; 379 return false;
380 } 380 }
381 return true; 381 return true;
382 } 382 }
383 383
384 private bool consoleHills(string[] args, ref string resultText) 384 private bool consoleHills(string[] args, ref string resultText)
385 { 385 {
386 int count; 386 int count;
387 double sizeMin; 387 double sizeMin;
388 double sizeRange; 388 double sizeRange;
389 bool island; 389 bool island;
390 bool additive; 390 bool additive;
391 bool noisy; 391 bool noisy;
392 392
393 if (args.GetLength(0) > 2) 393 if (args.GetLength(0) > 2)
394 { 394 {
395 count = Convert.ToInt32(args[2]); 395 count = Convert.ToInt32(args[2]);
396 sizeMin = Convert.ToDouble(args[3]); 396 sizeMin = Convert.ToDouble(args[3]);
397 sizeRange = Convert.ToDouble(args[4]); 397 sizeRange = Convert.ToDouble(args[4]);
398 island = Convert.ToBoolean(args[5]); 398 island = Convert.ToBoolean(args[5]);
399 additive = Convert.ToBoolean(args[6]); 399 additive = Convert.ToBoolean(args[6]);
400 noisy = Convert.ToBoolean(args[7]); 400 noisy = Convert.ToBoolean(args[7]);
401 } 401 }
402 else 402 else
403 { 403 {
404 count = 200; 404 count = 200;
405 sizeMin = 20; 405 sizeMin = 20;
406 sizeRange = 40; 406 sizeRange = 40;
407 island = true; 407 island = true;
408 additive = true; 408 additive = true;
409 noisy = false; 409 noisy = false;
410 } 410 }
411 411
412 switch (args[1].ToLower()) 412 switch (args[1].ToLower())
413 { 413 {
414 case "blocks": 414 case "blocks":
415 heightmap.hillsBlocks(count, sizeMin, sizeRange, island, additive, noisy); 415 heightmap.hillsBlocks(count, sizeMin, sizeRange, island, additive, noisy);
416 break; 416 break;
417 case "cones": 417 case "cones":
418 heightmap.hillsCones(count, sizeMin, sizeRange, island, additive, noisy); 418 heightmap.hillsCones(count, sizeMin, sizeRange, island, additive, noisy);
419 break; 419 break;
420 case "spheres": 420 case "spheres":
421 heightmap.hillsSpheres(count, sizeMin, sizeRange, island, additive, noisy); 421 heightmap.hillsSpheres(count, sizeMin, sizeRange, island, additive, noisy);
422 break; 422 break;
423 case "squared": 423 case "squared":
424 heightmap.hillsSquared(count, sizeMin, sizeRange, island, additive, noisy); 424 heightmap.hillsSquared(count, sizeMin, sizeRange, island, additive, noisy);
425 break; 425 break;
426 default: 426 default:
427 resultText = "Unknown hills type"; 427 resultText = "Unknown hills type";
428 return false; 428 return false;
429 } 429 }
430 return true; 430 return true;
431 } 431 }
432 432
433 /// <summary> 433 /// <summary>
434 /// Renormalises the array between min and max 434 /// Renormalises the array between min and max
435 /// </summary> 435 /// </summary>
436 /// <param name="min">Minimum value of the new array</param> 436 /// <param name="min">Minimum value of the new array</param>
437 /// <param name="max">Maximum value of the new array</param> 437 /// <param name="max">Maximum value of the new array</param>
438 public void setRange(float min, float max) 438 public void setRange(float min, float max)
439 { 439 {
440 heightmap.normalise((double)min, (double)max); 440 heightmap.normalise((double)min, (double)max);
441 tainted++; 441 tainted++;
442 } 442 }
443 443
444 /// <summary> 444 /// <summary>
445 /// Loads a file consisting of 256x256 doubles and imports it as an array into the map. 445 /// Loads a file consisting of 256x256 doubles and imports it as an array into the map.
446 /// </summary> 446 /// </summary>
447 /// <remarks>TODO: Move this to libTerrain itself</remarks> 447 /// <remarks>TODO: Move this to libTerrain itself</remarks>
448 /// <param name="filename">The filename of the double array to import</param> 448 /// <param name="filename">The filename of the double array to import</param>
449 public void loadFromFileF64(string filename) 449 public void loadFromFileF64(string filename)
450 { 450 {
451 FileInfo file = new FileInfo(filename); 451 FileInfo file = new FileInfo(filename);
452 FileStream s = file.Open(FileMode.Open, FileAccess.Read); 452 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
453 BinaryReader bs = new BinaryReader(s); 453 BinaryReader bs = new BinaryReader(s);
454 int x, y; 454 int x, y;
455 for (x = 0; x < w; x++) 455 for (x = 0; x < w; x++)
456 { 456 {
457 for (y = 0; y < h; y++) 457 for (y = 0; y < h; y++)
458 { 458 {
459 heightmap.map[x, y] = bs.ReadDouble(); 459 heightmap.map[x, y] = bs.ReadDouble();
460 } 460 }
461 } 461 }
462 462
463 bs.Close(); 463 bs.Close();
464 s.Close(); 464 s.Close();
465 465
466 tainted++; 466 tainted++;
467 } 467 }
468 468
469 /// <summary> 469 /// <summary>
470 /// Loads a file consisting of 256x256 floats and imports it as an array into the map. 470 /// Loads a file consisting of 256x256 floats and imports it as an array into the map.
471 /// </summary> 471 /// </summary>
472 /// <remarks>TODO: Move this to libTerrain itself</remarks> 472 /// <remarks>TODO: Move this to libTerrain itself</remarks>
473 /// <param name="filename">The filename of the float array to import</param> 473 /// <param name="filename">The filename of the float array to import</param>
474 public void loadFromFileF32(string filename) 474 public void loadFromFileF32(string filename)
475 { 475 {
476 FileInfo file = new FileInfo(filename); 476 FileInfo file = new FileInfo(filename);
477 FileStream s = file.Open(FileMode.Open, FileAccess.Read); 477 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
478 BinaryReader bs = new BinaryReader(s); 478 BinaryReader bs = new BinaryReader(s);
479 int x, y; 479 int x, y;
480 for (x = 0; x < w; x++) 480 for (x = 0; x < w; x++)
481 { 481 {
482 for (y = 0; y < h; y++) 482 for (y = 0; y < h; y++)
483 { 483 {
484 heightmap.map[x, y] = (double)bs.ReadSingle(); 484 heightmap.map[x, y] = (double)bs.ReadSingle();
485 } 485 }
486 } 486 }
487 487
488 bs.Close(); 488 bs.Close();
489 s.Close(); 489 s.Close();
490 490
491 tainted++; 491 tainted++;
492 } 492 }
493 493
494 /// <summary> 494 /// <summary>
495 /// Loads a file formatted in the SL .RAW Format used on the main grid 495 /// Loads a file formatted in the SL .RAW Format used on the main grid
496 /// </summary> 496 /// </summary>
497 /// <remarks>This file format stinks and is best avoided.</remarks> 497 /// <remarks>This file format stinks and is best avoided.</remarks>
498 /// <param name="filename">A path to the .RAW format</param> 498 /// <param name="filename">A path to the .RAW format</param>
499 public void loadFromFileSLRAW(string filename) 499 public void loadFromFileSLRAW(string filename)
500 { 500 {
501 FileInfo file = new FileInfo(filename); 501 FileInfo file = new FileInfo(filename);
502 FileStream s = file.Open(FileMode.Open, FileAccess.Read); 502 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
503 BinaryReader bs = new BinaryReader(s); 503 BinaryReader bs = new BinaryReader(s);
504 int x, y; 504 int x, y;
505 for (x = 0; x < w; x++) 505 for (x = 0; x < w; x++)
506 { 506 {
507 for (y = 0; y < h; y++) 507 for (y = 0; y < h; y++)
508 { 508 {
509 heightmap.map[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0); 509 heightmap.map[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0);
510 bs.ReadBytes(11); // Advance the stream to next bytes. 510 bs.ReadBytes(11); // Advance the stream to next bytes.
511 } 511 }
512 } 512 }
513 513
514 bs.Close(); 514 bs.Close();
515 s.Close(); 515 s.Close();
516 516
517 tainted++; 517 tainted++;
518 } 518 }
519 519
520 /// <summary> 520 /// <summary>
521 /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array. 521 /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array.
522 /// </summary> 522 /// </summary>
523 /// <param name="filename">The desired output filename</param> 523 /// <param name="filename">The desired output filename</param>
524 public void writeToFileF64(string filename) 524 public void writeToFileF64(string filename)
525 { 525 {
526 FileInfo file = new FileInfo(filename); 526 FileInfo file = new FileInfo(filename);
527 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); 527 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
528 BinaryWriter bs = new BinaryWriter(s); 528 BinaryWriter bs = new BinaryWriter(s);
529 529
530 int x, y; 530 int x, y;
531 for (x = 0; x < w; x++) 531 for (x = 0; x < w; x++)
532 { 532 {
533 for (y = 0; y < h; y++) 533 for (y = 0; y < h; y++)
534 { 534 {
535 bs.Write(heightmap.get(x, y)); 535 bs.Write(heightmap.get(x, y));
536 } 536 }
537 } 537 }
538 538
539 bs.Close(); 539 bs.Close();
540 s.Close(); 540 s.Close();
541 } 541 }
542 542
543 /// <summary> 543 /// <summary>
544 /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array 544 /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array
545 /// </summary> 545 /// </summary>
546 /// <param name="filename">The desired output filename</param> 546 /// <param name="filename">The desired output filename</param>
547 public void writeToFileF32(string filename) 547 public void writeToFileF32(string filename)
548 { 548 {
549 FileInfo file = new FileInfo(filename); 549 FileInfo file = new FileInfo(filename);
550 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); 550 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
551 BinaryWriter bs = new BinaryWriter(s); 551 BinaryWriter bs = new BinaryWriter(s);
552 552
553 int x, y; 553 int x, y;
554 for (x = 0; x < w; x++) 554 for (x = 0; x < w; x++)
555 { 555 {
556 for (y = 0; y < h; y++) 556 for (y = 0; y < h; y++)
557 { 557 {
558 bs.Write((float)heightmap.get(x, y)); 558 bs.Write((float)heightmap.get(x, y));
559 } 559 }
560 } 560 }
561 561
562 bs.Close(); 562 bs.Close();
563 s.Close(); 563 s.Close();
564 } 564 }
565 565
566 /// <summary> 566 /// <summary>
567 /// A very fast LL-RAW file output mechanism - lower precision mechanism but wont take 5 minutes to run either. 567 /// A very fast LL-RAW file output mechanism - lower precision mechanism but wont take 5 minutes to run either.
568 /// (is also editable in an image application) 568 /// (is also editable in an image application)
569 /// </summary> 569 /// </summary>
570 /// <param name="filename">Filename to write to</param> 570 /// <param name="filename">Filename to write to</param>
571 public void writeToFileRAW(string filename) 571 public void writeToFileRAW(string filename)
572 { 572 {
573 FileInfo file = new FileInfo(filename); 573 FileInfo file = new FileInfo(filename);
574 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); 574 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
575 BinaryWriter bs = new BinaryWriter(s); 575 BinaryWriter bs = new BinaryWriter(s);
576 576
577 int x, y; 577 int x, y;
578 578
579 // Used for the 'green' channel. 579 // Used for the 'green' channel.
580 byte avgMultiplier = (byte)heightmap.avg(); 580 byte avgMultiplier = (byte)heightmap.avg();
581 byte backupMultiplier = (byte)revertmap.avg(); 581 byte backupMultiplier = (byte)revertmap.avg();
582 582
583 // Limit the multiplier so it can represent points >64m. 583 // Limit the multiplier so it can represent points >64m.
584 if (avgMultiplier > 196) 584 if (avgMultiplier > 196)
585 avgMultiplier = 196; 585 avgMultiplier = 196;
586 if(backupMultiplier > 196) 586 if(backupMultiplier > 196)
587 backupMultiplier = 196; 587 backupMultiplier = 196;
588 // Make sure it's at least one to prevent a div by zero 588 // Make sure it's at least one to prevent a div by zero
589 if (avgMultiplier < 1) 589 if (avgMultiplier < 1)
590 avgMultiplier = 1; 590 avgMultiplier = 1;
591 if(backupMultiplier < 1) 591 if(backupMultiplier < 1)
592 backupMultiplier = 1; 592 backupMultiplier = 1;
593 593
594 for (x = 0; x < w; x++) 594 for (x = 0; x < w; x++)
595 { 595 {
596 for (y = 0; y < h; y++) 596 for (y = 0; y < h; y++)
597 { 597 {
598 byte red = (byte)(heightmap.get(x, y) / ((double)avgMultiplier / 128.0)); 598 byte red = (byte)(heightmap.get(x, y) / ((double)avgMultiplier / 128.0));
599 byte green = avgMultiplier; 599 byte green = avgMultiplier;
600 byte blue = (byte)watermap.get(x, y); 600 byte blue = (byte)watermap.get(x, y);
601 byte alpha1 = 0; // Land Parcels 601 byte alpha1 = 0; // Land Parcels
602 byte alpha2 = 0; // For Sale Land 602 byte alpha2 = 0; // For Sale Land
603 byte alpha3 = 0; // Public Edit Object 603 byte alpha3 = 0; // Public Edit Object
604 byte alpha4 = 0; // Public Edit Land 604 byte alpha4 = 0; // Public Edit Land
605 byte alpha5 = 255; // Safe Land 605 byte alpha5 = 255; // Safe Land
606 byte alpha6 = 255; // Flying Allowed 606 byte alpha6 = 255; // Flying Allowed
607 byte alpha7 = 255; // Create Landmark 607 byte alpha7 = 255; // Create Landmark
608 byte alpha8 = 255; // Outside Scripts 608 byte alpha8 = 255; // Outside Scripts
609 byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0)); 609 byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0));
610 byte alpha10 = backupMultiplier; 610 byte alpha10 = backupMultiplier;
611 611
612 bs.Write(red); 612 bs.Write(red);
613 bs.Write(green); 613 bs.Write(green);
614 bs.Write(blue); 614 bs.Write(blue);
615 bs.Write(alpha1); 615 bs.Write(alpha1);
616 bs.Write(alpha2); 616 bs.Write(alpha2);
617 bs.Write(alpha3); 617 bs.Write(alpha3);
618 bs.Write(alpha4); 618 bs.Write(alpha4);
619 bs.Write(alpha5); 619 bs.Write(alpha5);
620 bs.Write(alpha6); 620 bs.Write(alpha6);
621 bs.Write(alpha7); 621 bs.Write(alpha7);
622 bs.Write(alpha8); 622 bs.Write(alpha8);
623 bs.Write(alpha9); 623 bs.Write(alpha9);
624 bs.Write(alpha10); 624 bs.Write(alpha10);
625 } 625 }
626 } 626 }
627 bs.Close(); 627 bs.Close();
628 s.Close(); 628 s.Close();
629 } 629 }
630 630
631 /// <summary> 631 /// <summary>
632 /// Outputs to a LL compatible RAW in the most efficient manner possible 632 /// Outputs to a LL compatible RAW in the most efficient manner possible
633 /// </summary> 633 /// </summary>
634 /// <remarks>Does not calculate the revert map</remarks> 634 /// <remarks>Does not calculate the revert map</remarks>
635 /// <param name="filename">The filename to output to</param> 635 /// <param name="filename">The filename to output to</param>
636 public void writeToFileHiRAW(string filename) 636 public void writeToFileHiRAW(string filename)
637 { 637 {
638 FileInfo file = new FileInfo(filename); 638 FileInfo file = new FileInfo(filename);
639 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); 639 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
640 BinaryWriter bs = new BinaryWriter(s); 640 BinaryWriter bs = new BinaryWriter(s);
641 641
642 // Generate a smegging big lookup table to speed the operation up (it needs it) 642 // Generate a smegging big lookup table to speed the operation up (it needs it)
643 double[] lookupTable = new double[65536]; 643 double[] lookupTable = new double[65536];
644 int i, j, x, y; 644 int i, j, x, y;
645 for (i = 0; i < 256; i++) 645 for (i = 0; i < 256; i++)
646 { 646 {
647 for (j = 0; j < 256; j++) 647 for (j = 0; j < 256; j++)
648 { 648 {
649 lookupTable[i + (j * 256)] = ((double)i * ((double)j / 127.0)); 649 lookupTable[i + (j * 256)] = ((double)i * ((double)j / 127.0));
650 } 650 }
651 } 651 }
652 652
653 // Output the calculated raw 653 // Output the calculated raw
654 for (x = 0; x < w; x++) 654 for (x = 0; x < w; x++)
655 { 655 {
656 for (y = 0; y < h; y++) 656 for (y = 0; y < h; y++)
657 { 657 {
658 double t = heightmap.get(x, y); 658 double t = heightmap.get(x, y);
659 double min = double.MaxValue; 659 double min = double.MaxValue;
660 int index = 0; 660 int index = 0;
661 661
662 for (i = 0; i < 65536; i++) 662 for (i = 0; i < 65536; i++)
663 { 663 {
664 if (Math.Abs(t - lookupTable[i]) < min) 664 if (Math.Abs(t - lookupTable[i]) < min)
665 { 665 {
666 min = Math.Abs(t - lookupTable[i]); 666 min = Math.Abs(t - lookupTable[i]);
667 index = i; 667 index = i;
668 } 668 }
669 } 669 }
670 670
671 byte red = (byte)(index & 0xFF); 671 byte red = (byte)(index & 0xFF);
672 byte green = (byte)((index >> 8) & 0xFF); 672 byte green = (byte)((index >> 8) & 0xFF);
673 byte blue = (byte)watermap.get(x, y); 673 byte blue = (byte)watermap.get(x, y);
674 byte alpha1 = 0; // Land Parcels 674 byte alpha1 = 0; // Land Parcels
675 byte alpha2 = 0; // For Sale Land 675 byte alpha2 = 0; // For Sale Land
676 byte alpha3 = 0; // Public Edit Object 676 byte alpha3 = 0; // Public Edit Object
677 byte alpha4 = 0; // Public Edit Land 677 byte alpha4 = 0; // Public Edit Land
678 byte alpha5 = 255; // Safe Land 678 byte alpha5 = 255; // Safe Land
679 byte alpha6 = 255; // Flying Allowed 679 byte alpha6 = 255; // Flying Allowed
680 byte alpha7 = 255; // Create Landmark 680 byte alpha7 = 255; // Create Landmark
681 byte alpha8 = 255; // Outside Scripts 681 byte alpha8 = 255; // Outside Scripts
682 byte alpha9 = red; 682 byte alpha9 = red;
683 byte alpha10 = green; 683 byte alpha10 = green;
684 684
685 bs.Write(red); 685 bs.Write(red);
686 bs.Write(green); 686 bs.Write(green);
687 bs.Write(blue); 687 bs.Write(blue);
688 bs.Write(alpha1); 688 bs.Write(alpha1);
689 bs.Write(alpha2); 689 bs.Write(alpha2);
690 bs.Write(alpha3); 690 bs.Write(alpha3);
691 bs.Write(alpha4); 691 bs.Write(alpha4);
692 bs.Write(alpha5); 692 bs.Write(alpha5);
693 bs.Write(alpha6); 693 bs.Write(alpha6);
694 bs.Write(alpha7); 694 bs.Write(alpha7);
695 bs.Write(alpha8); 695 bs.Write(alpha8);
696 bs.Write(alpha9); 696 bs.Write(alpha9);
697 bs.Write(alpha10); 697 bs.Write(alpha10);
698 } 698 }
699 } 699 }
700 700
701 bs.Close(); 701 bs.Close();
702 s.Close(); 702 s.Close();
703 } 703 }
704 704
705 /// <summary> 705 /// <summary>
706 /// Sets the random seed to be used by procedural functions which involve random numbers. 706 /// Sets the random seed to be used by procedural functions which involve random numbers.
707 /// </summary> 707 /// </summary>
708 /// <param name="val">The desired seed</param> 708 /// <param name="val">The desired seed</param>
709 public void setSeed(int val) 709 public void setSeed(int val)
710 { 710 {
711 heightmap.seed = val; 711 heightmap.seed = val;
712 } 712 }
713 713
714 /// <summary> 714 /// <summary>
715 /// Raises land in a sphere around the specified coordinates 715 /// Raises land in a sphere around the specified coordinates
716 /// </summary> 716 /// </summary>
717 /// <param name="rx">Center of the sphere on the X axis</param> 717 /// <param name="rx">Center of the sphere on the X axis</param>
718 /// <param name="ry">Center of the sphere on the Y axis</param> 718 /// <param name="ry">Center of the sphere on the Y axis</param>
719 /// <param name="size">The radius of the sphere</param> 719 /// <param name="size">The radius of the sphere</param>
720 /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> 720 /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param>
721 public void raise(double rx, double ry, double size, double amount) 721 public void raise(double rx, double ry, double size, double amount)
722 { 722 {
723 lock (heightmap) 723 lock (heightmap)
724 { 724 {
725 heightmap.raise(rx, ry, size, amount); 725 heightmap.raise(rx, ry, size, amount);
726 } 726 }
727 727
728 tainted++; 728 tainted++;
729 } 729 }
730 730
731 /// <summary> 731 /// <summary>
732 /// Lowers the land in a sphere around the specified coordinates 732 /// Lowers the land in a sphere around the specified coordinates
733 /// </summary> 733 /// </summary>
734 /// <param name="rx">The center of the sphere at the X axis</param> 734 /// <param name="rx">The center of the sphere at the X axis</param>
735 /// <param name="ry">The center of the sphere at the Y axis</param> 735 /// <param name="ry">The center of the sphere at the Y axis</param>
736 /// <param name="size">The radius of the sphere in meters</param> 736 /// <param name="size">The radius of the sphere in meters</param>
737 /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> 737 /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param>
738 public void lower(double rx, double ry, double size, double amount) 738 public void lower(double rx, double ry, double size, double amount)
739 { 739 {
740 lock (heightmap) 740 lock (heightmap)
741 { 741 {
742 heightmap.lower(rx, ry, size, amount); 742 heightmap.lower(rx, ry, size, amount);
743 } 743 }
744 744
745 tainted++; 745 tainted++;
746 } 746 }
747 747
748 /// <summary> 748 /// <summary>
749 /// Flattens the land under the brush of specified coordinates (spherical mask) 749 /// Flattens the land under the brush of specified coordinates (spherical mask)
750 /// </summary> 750 /// </summary>
751 /// <param name="rx">Center of sphere</param> 751 /// <param name="rx">Center of sphere</param>
752 /// <param name="ry">Center of sphere</param> 752 /// <param name="ry">Center of sphere</param>
753 /// <param name="size">Radius of the sphere</param> 753 /// <param name="size">Radius of the sphere</param>
754 /// <param name="amount">Thickness of the mask (0..2 recommended)</param> 754 /// <param name="amount">Thickness of the mask (0..2 recommended)</param>
755 public void flatten(double rx, double ry, double size, double amount) 755 public void flatten(double rx, double ry, double size, double amount)
756 { 756 {
757 lock (heightmap) 757 lock (heightmap)
758 { 758 {
759 heightmap.flatten(rx, ry, size, amount); 759 heightmap.flatten(rx, ry, size, amount);
760 } 760 }
761 761
762 tainted++; 762 tainted++;
763 } 763 }
764 764
765 /// <summary> 765 /// <summary>
766 /// Creates noise within the specified bounds 766 /// Creates noise within the specified bounds
767 /// </summary> 767 /// </summary>
768 /// <param name="rx">Center of the bounding sphere</param> 768 /// <param name="rx">Center of the bounding sphere</param>
769 /// <param name="ry">Center of the bounding sphere</param> 769 /// <param name="ry">Center of the bounding sphere</param>
770 /// <param name="size">The radius of the sphere</param> 770 /// <param name="size">The radius of the sphere</param>
771 /// <param name="amount">Strength of the mask (0..2) recommended</param> 771 /// <param name="amount">Strength of the mask (0..2) recommended</param>
772 public void noise(double rx, double ry, double size, double amount) 772 public void noise(double rx, double ry, double size, double amount)
773 { 773 {
774 lock (heightmap) 774 lock (heightmap)
775 { 775 {
776 Channel smoothed = new Channel(); 776 Channel smoothed = new Channel();
777 smoothed.noise(); 777 smoothed.noise();
778 778
779 Channel mask = new Channel(); 779 Channel mask = new Channel();
780 mask.raise(rx, ry, size, amount); 780 mask.raise(rx, ry, size, amount);
781 781
782 heightmap.blend(smoothed, mask); 782 heightmap.blend(smoothed, mask);
783 } 783 }
784 784
785 tainted++; 785 tainted++;
786 } 786 }
787 787
788 /// <summary> 788 /// <summary>
789 /// Reverts land within the specified bounds 789 /// Reverts land within the specified bounds
790 /// </summary> 790 /// </summary>
791 /// <param name="rx">Center of the bounding sphere</param> 791 /// <param name="rx">Center of the bounding sphere</param>
792 /// <param name="ry">Center of the bounding sphere</param> 792 /// <param name="ry">Center of the bounding sphere</param>
793 /// <param name="size">The radius of the sphere</param> 793 /// <param name="size">The radius of the sphere</param>
794 /// <param name="amount">Strength of the mask (0..2) recommended</param> 794 /// <param name="amount">Strength of the mask (0..2) recommended</param>
795 public void revert(double rx, double ry, double size, double amount) 795 public void revert(double rx, double ry, double size, double amount)
796 { 796 {
797 lock (heightmap) 797 lock (heightmap)
798 { 798 {
799 Channel mask = new Channel(); 799 Channel mask = new Channel();
800 mask.raise(rx, ry, size, amount); 800 mask.raise(rx, ry, size, amount);
801 801
802 heightmap.blend(revertmap, mask); 802 heightmap.blend(revertmap, mask);
803 } 803 }
804 804
805 tainted++; 805 tainted++;
806 } 806 }
807 807
808 /// <summary> 808 /// <summary>
809 /// Smooths land under the brush of specified coordinates (spherical mask) 809 /// Smooths land under the brush of specified coordinates (spherical mask)
810 /// </summary> 810 /// </summary>
811 /// <param name="rx">Center of the sphere</param> 811 /// <param name="rx">Center of the sphere</param>
812 /// <param name="ry">Center of the sphere</param> 812 /// <param name="ry">Center of the sphere</param>
813 /// <param name="size">Radius of the sphere</param> 813 /// <param name="size">Radius of the sphere</param>
814 /// <param name="amount">Thickness of the mask (0..2 recommended)</param> 814 /// <param name="amount">Thickness of the mask (0..2 recommended)</param>
815 public void smooth(double rx, double ry, double size, double amount) 815 public void smooth(double rx, double ry, double size, double amount)
816 { 816 {
817 lock (heightmap) 817 lock (heightmap)
818 { 818 {
819 Channel smoothed = heightmap.copy(); 819 Channel smoothed = heightmap.copy();
820 smoothed.smooth(amount); 820 smoothed.smooth(amount);
821 821
822 Channel mask = new Channel(); 822 Channel mask = new Channel();
823 mask.raise(rx,ry,size,amount); 823 mask.raise(rx,ry,size,amount);
824 824
825 heightmap.blend(smoothed, mask); 825 heightmap.blend(smoothed, mask);
826 } 826 }
827 827
828 tainted++; 828 tainted++;
829 } 829 }
830 830
831 /// <summary> 831 /// <summary>
832 /// Generates a simple set of hills in the shape of an island 832 /// Generates a simple set of hills in the shape of an island
833 /// </summary> 833 /// </summary>
834 public void hills() 834 public void hills()
835 { 835 {
836 lock (heightmap) 836 lock (heightmap)
837 { 837 {
838 heightmap.hillsSpheres(200, 20, 40, true, true, false); 838 heightmap.hillsSpheres(200, 20, 40, true, true, false);
839 heightmap.normalise(); 839 heightmap.normalise();
840 heightmap *= 60.0; // Raise to 60m 840 heightmap *= 60.0; // Raise to 60m
841 } 841 }
842 842
843 tainted++; 843 tainted++;
844 } 844 }
845 845
846 /// <summary> 846 /// <summary>
847 /// Wrapper to heightmap.get() 847 /// Wrapper to heightmap.get()
848 /// </summary> 848 /// </summary>
849 /// <param name="x">X coord</param> 849 /// <param name="x">X coord</param>
850 /// <param name="y">Y coord</param> 850 /// <param name="y">Y coord</param>
851 /// <returns>Height at specified coordinates</returns> 851 /// <returns>Height at specified coordinates</returns>
852 public double get(int x, int y) 852 public double get(int x, int y)
853 { 853 {
854 return heightmap.get(x, y); 854 return heightmap.get(x, y);
855 } 855 }
856 856
857 /// <summary> 857 /// <summary>
858 /// Multiplies the heightfield by val 858 /// Multiplies the heightfield by val
859 /// </summary> 859 /// </summary>
860 /// <param name="meep">The heightfield</param> 860 /// <param name="meep">The heightfield</param>
861 /// <param name="val">The multiplier</param> 861 /// <param name="val">The multiplier</param>
862 /// <returns></returns> 862 /// <returns></returns>
863 public static TerrainEngine operator *(TerrainEngine meep, Double val) 863 public static TerrainEngine operator *(TerrainEngine meep, Double val)
864 { 864 {
865 meep.heightmap *= val; 865 meep.heightmap *= val;
866 meep.tainted++; 866 meep.tainted++;
867 return meep; 867 return meep;
868 } 868 }
869 869
870 /// <summary> 870 /// <summary>
871 /// Exports the current heightmap to a PNG file 871 /// Exports the current heightmap to a PNG file
872 /// </summary> 872 /// </summary>
873 /// <param name="filename">The destination filename for the image</param> 873 /// <param name="filename">The destination filename for the image</param>
874 /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> 874 /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
875 public void exportImage(string filename, string gradientmap) 875 public void exportImage(string filename, string gradientmap)
876 { 876 {
877 try 877 try
878 { 878 {
879 Bitmap gradientmapLd = new Bitmap(gradientmap); 879 Bitmap gradientmapLd = new Bitmap(gradientmap);
880 880
881 int pallete = gradientmapLd.Height; 881 int pallete = gradientmapLd.Height;
882 882
883 Bitmap bmp = new Bitmap(heightmap.w, heightmap.h); 883 Bitmap bmp = new Bitmap(heightmap.w, heightmap.h);
884 Color[] colours = new Color[pallete]; 884 Color[] colours = new Color[pallete];
885 885
886 for (int i = 0; i < pallete; i++) 886 for (int i = 0; i < pallete; i++)
887 { 887 {
888 colours[i] = gradientmapLd.GetPixel(0, i); 888 colours[i] = gradientmapLd.GetPixel(0, i);
889 } 889 }
890 890
891 Channel copy = heightmap.copy(); 891 Channel copy = heightmap.copy();
892 for (int x = 0; x < copy.w; x++) 892 for (int x = 0; x < copy.w; x++)
893 { 893 {
894 for (int y = 0; y < copy.h; y++) 894 for (int y = 0; y < copy.h; y++)
895 { 895 {
896 // 512 is the largest possible height before colours clamp 896 // 512 is the largest possible height before colours clamp
897 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * pallete); 897 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * pallete);
898 bmp.SetPixel(x, y, colours[colorindex]); 898 bmp.SetPixel(x, y, colours[colorindex]);
899 } 899 }
900 } 900 }
901 901
902 bmp.Save(filename, ImageFormat.Png); 902 bmp.Save(filename, ImageFormat.Png);
903 } 903 }
904 catch (Exception e) 904 catch (Exception e)
905 { 905 {
906 Console.WriteLine("Failed generating terrain map: " + e.ToString()); 906 Console.WriteLine("Failed generating terrain map: " + e.ToString());
907 } 907 }
908 } 908 }
909 909
910 /// <summary> 910 /// <summary>
911 /// Exports the current heightmap in Jpeg2000 format to a byte[] 911 /// Exports the current heightmap in Jpeg2000 format to a byte[]
912 /// </summary> 912 /// </summary>
913 /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> 913 /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
914 public byte[] exportJpegImage(string gradientmap) 914 public byte[] exportJpegImage(string gradientmap)
915 { 915 {
916 byte[] imageData = null; 916 byte[] imageData = null;
917 try 917 try
918 { 918 {
919 Bitmap gradientmapLd = new Bitmap(gradientmap); 919 Bitmap gradientmapLd = new Bitmap(gradientmap);
920 920
921 int pallete = gradientmapLd.Height; 921 int pallete = gradientmapLd.Height;
922 922
923 Bitmap bmp = new Bitmap(heightmap.w, heightmap.h); 923 Bitmap bmp = new Bitmap(heightmap.w, heightmap.h);
924 Color[] colours = new Color[pallete]; 924 Color[] colours = new Color[pallete];
925 925
926 for (int i = 0; i < pallete; i++) 926 for (int i = 0; i < pallete; i++)
927 { 927 {
928 colours[i] = gradientmapLd.GetPixel(0, i); 928 colours[i] = gradientmapLd.GetPixel(0, i);
929 } 929 }
930 930
931 Channel copy = heightmap.copy(); 931 Channel copy = heightmap.copy();
932 for (int x = 0; x < copy.w; x++) 932 for (int x = 0; x < copy.w; x++)
933 { 933 {
934 for (int y = 0; y < copy.h; y++) 934 for (int y = 0; y < copy.h; y++)
935 { 935 {
936 // 512 is the largest possible height before colours clamp 936 // 512 is the largest possible height before colours clamp
937 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.h - y, x) / 512.0), 0.0) * pallete); 937 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.h - y, x) / 512.0), 0.0) * pallete);
938 bmp.SetPixel(x, y, colours[colorindex]); 938 bmp.SetPixel(x, y, colours[colorindex]);
939 } 939 }
940 } 940 }
941 941
942 //bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png); 942 //bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
943 imageData = OpenJPEG.EncodeFromImage(bmp, true ); 943 imageData = OpenJPEG.EncodeFromImage(bmp, true );
944 944
945 } 945 }
946 catch (Exception e) 946 catch (Exception e)
947 { 947 {
948 Console.WriteLine("Failed generating terrain map: " + e.ToString()); 948 Console.WriteLine("Failed generating terrain map: " + e.ToString());
949 } 949 }
950 950
951 return imageData; 951 return imageData;
952 } 952 }
953 } 953 }
954} \ No newline at end of file 954} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
index a38be07..a80ac85 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
@@ -1,126 +1,126 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libTerrain; 31using libTerrain;
32using Microsoft.CSharp; 32using Microsoft.CSharp;
33using Microsoft.JScript; 33using Microsoft.JScript;
34 34
35namespace OpenSim.Region.Terrain 35namespace OpenSim.Region.Terrain
36{ 36{
37 public interface ITerrainFilter 37 public interface ITerrainFilter
38 { 38 {
39 void Filter(Channel heightmap, string[] args); 39 void Filter(Channel heightmap, string[] args);
40 string Register(); 40 string Register();
41 string Help(); 41 string Help();
42 } 42 }
43 43
44 public class TestFilter : ITerrainFilter 44 public class TestFilter : ITerrainFilter
45 { 45 {
46 public void Filter(Channel heightmap, string[] args) 46 public void Filter(Channel heightmap, string[] args)
47 { 47 {
48 Console.WriteLine("Hello world"); 48 Console.WriteLine("Hello world");
49 } 49 }
50 50
51 public string Register() 51 public string Register()
52 { 52 {
53 return "demofilter"; 53 return "demofilter";
54 } 54 }
55 55
56 public string Help() 56 public string Help()
57 { 57 {
58 return "demofilter - Does nothing"; 58 return "demofilter - Does nothing";
59 } 59 }
60 } 60 }
61 61
62 public class FilterHost 62 public class FilterHost
63 { 63 {
64 public Dictionary<string, ITerrainFilter> filters = new Dictionary<string, ITerrainFilter>(); 64 public Dictionary<string, ITerrainFilter> filters = new Dictionary<string, ITerrainFilter>();
65 65
66 private void LoadFilter(CodeDomProvider compiler, string filename) 66 private void LoadFilter(CodeDomProvider compiler, string filename)
67 { 67 {
68 CompilerParameters compilerParams = new CompilerParameters(); 68 CompilerParameters compilerParams = new CompilerParameters();
69 CompilerResults compilerResults; 69 CompilerResults compilerResults;
70 compilerParams.GenerateExecutable = false; 70 compilerParams.GenerateExecutable = false;
71 compilerParams.GenerateInMemory = true; 71 compilerParams.GenerateInMemory = true;
72 compilerParams.IncludeDebugInformation = false; 72 compilerParams.IncludeDebugInformation = false;
73 compilerParams.ReferencedAssemblies.Add("libTerrain-BSD.dll"); 73 compilerParams.ReferencedAssemblies.Add("libTerrain-BSD.dll");
74 compilerParams.ReferencedAssemblies.Add("OpenSim.Terrain.BasicTerrain.dll"); 74 compilerParams.ReferencedAssemblies.Add("OpenSim.Terrain.BasicTerrain.dll");
75 compilerParams.ReferencedAssemblies.Add("System.dll"); 75 compilerParams.ReferencedAssemblies.Add("System.dll");
76 76
77 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 77 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
78 78
79 if (compilerResults.Errors.Count > 0) 79 if (compilerResults.Errors.Count > 0)
80 { 80 {
81 Console.WriteLine("Compile errors:"); 81 Console.WriteLine("Compile errors:");
82 foreach (CompilerError error in compilerResults.Errors) 82 foreach (CompilerError error in compilerResults.Errors)
83 { 83 {
84 Console.WriteLine(error.Line.ToString() + ": " + error.ErrorText.ToString()); 84 Console.WriteLine(error.Line.ToString() + ": " + error.ErrorText.ToString());
85 } 85 }
86 } 86 }
87 else 87 else
88 { 88 {
89 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 89 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
90 { 90 {
91 Type testInterface = pluginType.GetInterface("ITerrainFilter",true); 91 Type testInterface = pluginType.GetInterface("ITerrainFilter",true);
92 92
93 if (testInterface != null) 93 if (testInterface != null)
94 { 94 {
95 ITerrainFilter filter = (ITerrainFilter)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 95 ITerrainFilter filter = (ITerrainFilter)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
96 96
97 string filterName = filter.Register(); 97 string filterName = filter.Register();
98 Console.WriteLine("Plugin: " + filterName + " loaded."); 98 Console.WriteLine("Plugin: " + filterName + " loaded.");
99 99
100 if (!filters.ContainsKey(filterName)) 100 if (!filters.ContainsKey(filterName))
101 { 101 {
102 filters.Add(filterName, filter); 102 filters.Add(filterName, filter);
103 } 103 }
104 else 104 else
105 { 105 {
106 filters[filterName] = filter; 106 filters[filterName] = filter;
107 } 107 }
108 } 108 }
109 } 109 }
110 } 110 }
111 111
112 } 112 }
113 113
114 public void LoadFilterCSharp(string filename) 114 public void LoadFilterCSharp(string filename)
115 { 115 {
116 CSharpCodeProvider compiler = new CSharpCodeProvider(); 116 CSharpCodeProvider compiler = new CSharpCodeProvider();
117 LoadFilter(compiler, filename); 117 LoadFilter(compiler, filename);
118 } 118 }
119 119
120 public void LoadFilterJScript(string filename) 120 public void LoadFilterJScript(string filename)
121 { 121 {
122 JScriptCodeProvider compiler = new JScriptCodeProvider(); 122 JScriptCodeProvider compiler = new JScriptCodeProvider();
123 LoadFilter(compiler, filename); 123 LoadFilter(compiler, filename);
124 } 124 }
125 } 125 }
126} 126}