aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorSean Dague2007-09-17 12:52:03 +0000
committerSean Dague2007-09-17 12:52:03 +0000
commitb8d9737a47696952bedec33dface8f18df47341f (patch)
tree9279f45510f8a9285ac5b9c9165ab6c741009eac /OpenSim/Region
parentI think this is the last bits for a consistant pristine (diff)
downloadopensim-SC-b8d9737a47696952bedec33dface8f18df47341f.zip
opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.tar.gz
opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.tar.bz2
opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.tar.xz
fixing me some line endings
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs144
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs332
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs76
-rw-r--r--OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs54
-rw-r--r--OpenSim/Region/Environment/Interfaces/IHttpRequests.cs24
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionModule.cs30
-rw-r--r--OpenSim/Region/Environment/Interfaces/ISimChat.cs24
-rw-r--r--OpenSim/Region/Environment/Interfaces/ITerrain.cs92
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXfer.cs22
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs320
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs100
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs142
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs432
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs318
-rw-r--r--OpenSim/Region/Environment/Modules/EmailModule.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs80
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/TeleportModule.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs108
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs360
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs610
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs854
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs474
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs40
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs112
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs86
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs248
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs334
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs108
-rw-r--r--OpenSim/Region/Examples/SimpleApp/ComplexObject.cs156
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs206
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs142
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs206
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs92
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs1278
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs86
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs1100
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs192
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs80
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs270
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs90
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs92
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs74
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs112
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs84
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs98
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs238
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs56
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs342
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs20
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs20
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs32
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs22
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs22
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs34
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs34
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Script.cs128
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs64
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs126
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs534
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs46
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs286
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs240
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs2062
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs524
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs16
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs104
72 files changed, 7569 insertions, 7569 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index af58d33..b8f57f6 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -1,72 +1,72 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Framework.Communications; 4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6using OpenSim.Framework.Types; 6using OpenSim.Framework.Types;
7using OpenSim.Framework.UserManagement; 7using OpenSim.Framework.UserManagement;
8using OpenSim.Framework.Utilities; 8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.InventoryServiceBase; 9using OpenSim.Framework.InventoryServiceBase;
10using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; 10using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
11 11
12namespace OpenSim.Region.Communications.Local 12namespace OpenSim.Region.Communications.Local
13{ 13{
14 public class LocalInventoryService : InventoryServiceBase , IInventoryServices 14 public class LocalInventoryService : InventoryServiceBase , IInventoryServices
15 { 15 {
16 16
17 public LocalInventoryService() 17 public LocalInventoryService()
18 { 18 {
19 19
20 } 20 }
21 21
22 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) 22 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
23 { 23 {
24 List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); 24 List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
25 InventoryFolder rootFolder = null; 25 InventoryFolder rootFolder = null;
26 26
27 //need to make sure we send root folder first 27 //need to make sure we send root folder first
28 foreach (InventoryFolderBase folder in folders) 28 foreach (InventoryFolderBase folder in folders)
29 { 29 {
30 if (folder.parentID == libsecondlife.LLUUID.Zero) 30 if (folder.parentID == libsecondlife.LLUUID.Zero)
31 { 31 {
32 InventoryFolder newfolder = new InventoryFolder(folder); 32 InventoryFolder newfolder = new InventoryFolder(folder);
33 rootFolder = newfolder; 33 rootFolder = newfolder;
34 folderCallBack(userID, newfolder); 34 folderCallBack(userID, newfolder);
35 } 35 }
36 } 36 }
37 37
38 if (rootFolder != null) 38 if (rootFolder != null)
39 { 39 {
40 foreach (InventoryFolderBase folder in folders) 40 foreach (InventoryFolderBase folder in folders)
41 { 41 {
42 if (folder.folderID != rootFolder.folderID) 42 if (folder.folderID != rootFolder.folderID)
43 { 43 {
44 InventoryFolder newfolder = new InventoryFolder(folder); 44 InventoryFolder newfolder = new InventoryFolder(folder);
45 folderCallBack(userID, newfolder); 45 folderCallBack(userID, newfolder);
46 46
47 List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); 47 List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID);
48 foreach (InventoryItemBase item in items) 48 foreach (InventoryItemBase item in items)
49 { 49 {
50 itemCallBack(userID, item); 50 itemCallBack(userID, item);
51 } 51 }
52 } 52 }
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) 57 public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
58 { 58 {
59 this.AddFolder(folder); 59 this.AddFolder(folder);
60 } 60 }
61 61
62 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 62 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
63 { 63 {
64 this.AddItem(item); 64 this.AddItem(item);
65 } 65 }
66 66
67 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 67 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
68 { 68 {
69 this.deleteItem(item); 69 this.deleteItem(item);
70 } 70 }
71 } 71 }
72} 72}
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index c461661..3c43d29 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -1,166 +1,166 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using libsecondlife; 4using libsecondlife;
5using OpenSim.Framework.Communications; 5using OpenSim.Framework.Communications;
6using OpenSim.Framework.Data; 6using OpenSim.Framework.Data;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.UserManagement; 8using OpenSim.Framework.UserManagement;
9using OpenSim.Framework.Utilities; 9using OpenSim.Framework.Utilities;
10using OpenSim.Framework.Inventory; 10using OpenSim.Framework.Inventory;
11 11
12namespace OpenSim.Region.Communications.Local 12namespace OpenSim.Region.Communications.Local
13{ 13{
14 public class LocalLoginService : LoginService 14 public class LocalLoginService : LoginService
15 { 15 {
16 private CommunicationsLocal m_Parent; 16 private CommunicationsLocal m_Parent;
17 17
18 private NetworkServersInfo serversInfo; 18 private NetworkServersInfo serversInfo;
19 private uint defaultHomeX; 19 private uint defaultHomeX;
20 private uint defaultHomeY; 20 private uint defaultHomeY;
21 private bool authUsers = false; 21 private bool authUsers = false;
22 22
23 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) 23 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
24 : base(userManager, welcomeMess) 24 : base(userManager, welcomeMess)
25 { 25 {
26 m_Parent = parent; 26 m_Parent = parent;
27 this.serversInfo = serversInfo; 27 this.serversInfo = serversInfo;
28 defaultHomeX = this.serversInfo.DefaultHomeLocX; 28 defaultHomeX = this.serversInfo.DefaultHomeLocX;
29 defaultHomeY = this.serversInfo.DefaultHomeLocY; 29 defaultHomeY = this.serversInfo.DefaultHomeLocY;
30 this.authUsers = authenticate; 30 this.authUsers = authenticate;
31 } 31 }
32 32
33 33
34 public override UserProfileData GetTheUser(string firstname, string lastname) 34 public override UserProfileData GetTheUser(string firstname, string lastname)
35 { 35 {
36 UserProfileData profile = this.m_userManager.getUserProfile(firstname, lastname); 36 UserProfileData profile = this.m_userManager.getUserProfile(firstname, lastname);
37 if (profile != null) 37 if (profile != null)
38 { 38 {
39 39
40 return profile; 40 return profile;
41 } 41 }
42 42
43 if (!authUsers) 43 if (!authUsers)
44 { 44 {
45 //no current user account so make one 45 //no current user account so make one
46 Console.WriteLine("No User account found so creating a new one "); 46 Console.WriteLine("No User account found so creating a new one ");
47 this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 47 this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
48 48
49 profile = this.m_userManager.getUserProfile(firstname, lastname); 49 profile = this.m_userManager.getUserProfile(firstname, lastname);
50 if (profile != null) 50 if (profile != null)
51 { 51 {
52 m_Parent.InvenServices.CreateNewUserInventory(profile.UUID); 52 m_Parent.InvenServices.CreateNewUserInventory(profile.UUID);
53 } 53 }
54 54
55 return profile; 55 return profile;
56 } 56 }
57 return null; 57 return null;
58 } 58 }
59 59
60 public override bool AuthenticateUser(UserProfileData profile, string password) 60 public override bool AuthenticateUser(UserProfileData profile, string password)
61 { 61 {
62 if (!authUsers) 62 if (!authUsers)
63 { 63 {
64 //for now we will accept any password in sandbox mode 64 //for now we will accept any password in sandbox mode
65 Console.WriteLine("authorising user"); 65 Console.WriteLine("authorising user");
66 return true; 66 return true;
67 } 67 }
68 else 68 else
69 { 69 {
70 Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); 70 Console.WriteLine("Authenticating " + profile.username + " " + profile.surname);
71 71
72 password = password.Remove(0, 3); //remove $1$ 72 password = password.Remove(0, 3); //remove $1$
73 73
74 string s = Util.Md5Hash(password + ":" + profile.passwordSalt); 74 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
75 75
76 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 76 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
77 } 77 }
78 } 78 }
79 79
80 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) 80 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
81 { 81 {
82 ulong currentRegion = theUser.currentAgent.currentHandle; 82 ulong currentRegion = theUser.currentAgent.currentHandle;
83 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); 83 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
84 84
85 if (reg != null) 85 if (reg != null)
86 { 86 {
87 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + 87 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
88 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 88 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
89 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 89 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
90 string capsPath = Util.GetRandomCapsPath(); 90 string capsPath = Util.GetRandomCapsPath();
91 response.SimAddress = reg.ExternalEndPoint.Address.ToString(); 91 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
92 response.SimPort = (Int32)reg.ExternalEndPoint.Port; 92 response.SimPort = (Int32)reg.ExternalEndPoint.Port;
93 response.RegionX = reg.RegionLocX; 93 response.RegionX = reg.RegionLocX;
94 response.RegionY = reg.RegionLocY; 94 response.RegionY = reg.RegionLocY;
95 95
96 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; 96 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
97 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; 97 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
98 theUser.currentAgent.currentRegion = reg.SimUUID; 98 theUser.currentAgent.currentRegion = reg.SimUUID;
99 theUser.currentAgent.currentHandle = reg.RegionHandle; 99 theUser.currentAgent.currentHandle = reg.RegionHandle;
100 100
101 Login _login = new Login(); 101 Login _login = new Login();
102 //copy data to login object 102 //copy data to login object
103 _login.First = response.Firstname; 103 _login.First = response.Firstname;
104 _login.Last = response.Lastname; 104 _login.Last = response.Lastname;
105 _login.Agent = response.AgentID; 105 _login.Agent = response.AgentID;
106 _login.Session = response.SessionID; 106 _login.Session = response.SessionID;
107 _login.SecureSession = response.SecureSessionID; 107 _login.SecureSession = response.SecureSessionID;
108 _login.CircuitCode = (uint)response.CircuitCode; 108 _login.CircuitCode = (uint)response.CircuitCode;
109 _login.CapsPath = capsPath; 109 _login.CapsPath = capsPath;
110 110
111 m_Parent.InformRegionOfLogin(currentRegion, _login); 111 m_Parent.InformRegionOfLogin(currentRegion, _login);
112 } 112 }
113 else 113 else
114 { 114 {
115 Console.WriteLine("not found region " + currentRegion); 115 Console.WriteLine("not found region " + currentRegion);
116 } 116 }
117 117
118 } 118 }
119 119
120 protected override InventoryData CreateInventoryData(LLUUID userID) 120 protected override InventoryData CreateInventoryData(LLUUID userID)
121 { 121 {
122 List<InventoryFolderBase> folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID); 122 List<InventoryFolderBase> folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID);
123 if (folders.Count > 0) 123 if (folders.Count > 0)
124 { 124 {
125 LLUUID rootID = LLUUID.Zero; 125 LLUUID rootID = LLUUID.Zero;
126 ArrayList AgentInventoryArray = new ArrayList(); 126 ArrayList AgentInventoryArray = new ArrayList();
127 Hashtable TempHash; 127 Hashtable TempHash;
128 foreach (InventoryFolderBase InvFolder in folders) 128 foreach (InventoryFolderBase InvFolder in folders)
129 { 129 {
130 if (InvFolder.parentID == LLUUID.Zero) 130 if (InvFolder.parentID == LLUUID.Zero)
131 { 131 {
132 rootID = InvFolder.folderID; 132 rootID = InvFolder.folderID;
133 } 133 }
134 TempHash = new Hashtable(); 134 TempHash = new Hashtable();
135 TempHash["name"] = InvFolder.name; 135 TempHash["name"] = InvFolder.name;
136 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); 136 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
137 TempHash["version"] = (Int32)InvFolder.version; 137 TempHash["version"] = (Int32)InvFolder.version;
138 TempHash["type_default"] = (Int32)InvFolder.type; 138 TempHash["type_default"] = (Int32)InvFolder.type;
139 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); 139 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
140 AgentInventoryArray.Add(TempHash); 140 AgentInventoryArray.Add(TempHash);
141 } 141 }
142 return new InventoryData(AgentInventoryArray, rootID); 142 return new InventoryData(AgentInventoryArray, rootID);
143 } 143 }
144 else 144 else
145 { 145 {
146 AgentInventory userInventory = new AgentInventory(); 146 AgentInventory userInventory = new AgentInventory();
147 userInventory.CreateRootFolder(userID, false); 147 userInventory.CreateRootFolder(userID, false);
148 148
149 ArrayList AgentInventoryArray = new ArrayList(); 149 ArrayList AgentInventoryArray = new ArrayList();
150 Hashtable TempHash; 150 Hashtable TempHash;
151 foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) 151 foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
152 { 152 {
153 TempHash = new Hashtable(); 153 TempHash = new Hashtable();
154 TempHash["name"] = InvFolder.FolderName; 154 TempHash["name"] = InvFolder.FolderName;
155 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 155 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
156 TempHash["version"] = (Int32)InvFolder.Version; 156 TempHash["version"] = (Int32)InvFolder.Version;
157 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 157 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
158 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 158 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
159 AgentInventoryArray.Add(TempHash); 159 AgentInventoryArray.Add(TempHash);
160 } 160 }
161 161
162 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); 162 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
163 } 163 }
164 } 164 }
165 } 165 }
166} 166}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 70ab75e..1428639 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -1,38 +1,38 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Framework.Communications; 4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Data; 5using OpenSim.Framework.Data;
6using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; 6using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
7 7
8namespace OpenSim.Region.Communications.OGS1 8namespace OpenSim.Region.Communications.OGS1
9{ 9{
10 public class OGS1InventoryService : IInventoryServices 10 public class OGS1InventoryService : IInventoryServices
11 { 11 {
12 12
13 public OGS1InventoryService() 13 public OGS1InventoryService()
14 { 14 {
15 15
16 } 16 }
17 17
18 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) 18 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
19 { 19 {
20 20
21 } 21 }
22 22
23 public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) 23 public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
24 { 24 {
25 25
26 } 26 }
27 27
28 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 28 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
29 { 29 {
30 30
31 } 31 }
32 32
33 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 33 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
34 { 34 {
35 35
36 } 36 }
37 } 37 }
38} 38}
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
index 8fdfa8f..727b386 100644
--- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
@@ -1,27 +1,27 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using libsecondlife; 5using libsecondlife;
6 6
7namespace OpenSim.Region.Environment.Interfaces 7namespace OpenSim.Region.Environment.Interfaces
8{ 8{
9 public interface IDynamicTextureManager 9 public interface IDynamicTextureManager
10 { 10 {
11 void RegisterRender(string handleType, IDynamicTextureRender render); 11 void RegisterRender(string handleType, IDynamicTextureRender render);
12 void ReturnData(LLUUID id, byte[] data); 12 void ReturnData(LLUUID id, byte[] data);
13 LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); 13 LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer);
14 LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer); 14 LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer);
15 } 15 }
16 16
17 public interface IDynamicTextureRender 17 public interface IDynamicTextureRender
18 { 18 {
19 string GetName(); 19 string GetName();
20 string GetContentType(); 20 string GetContentType();
21 bool SupportsAsynchronous(); 21 bool SupportsAsynchronous();
22 byte[] ConvertUrl(string url, string extraParams); 22 byte[] ConvertUrl(string url, string extraParams);
23 byte[] ConvertStream(Stream data, string extraParams); 23 byte[] ConvertStream(Stream data, string extraParams);
24 bool AsyncConvertUrl(LLUUID id, string url, string extraParams); 24 bool AsyncConvertUrl(LLUUID id, string url, string extraParams);
25 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); 25 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams);
26 } 26 }
27} 27}
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
index 2294631..e974e25 100644
--- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
@@ -1,12 +1,12 @@
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.Environment.Interfaces 6namespace OpenSim.Region.Environment.Interfaces
7{ 7{
8 public interface IHttpRequests 8 public interface IHttpRequests
9 { 9 {
10 LLUUID MakeHttpRequest(string url, string type, string body); 10 LLUUID MakeHttpRequest(string url, string type, string body);
11 } 11 }
12} 12}
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
index 11989fe..47f3d92 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
@@ -1,15 +1,15 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Environment.Interfaces 5namespace OpenSim.Region.Environment.Interfaces
6{ 6{
7 public interface IRegionModule 7 public interface IRegionModule
8 { 8 {
9 void Initialise(Scenes.Scene scene); 9 void Initialise(Scenes.Scene scene);
10 void PostInitialise(); 10 void PostInitialise();
11 void CloseDown(); 11 void CloseDown();
12 string GetName(); 12 string GetName();
13 bool IsSharedModule(); 13 bool IsSharedModule();
14 } 14 }
15} 15}
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
index 73ef476..f0adabc 100644
--- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs
+++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
@@ -1,12 +1,12 @@
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.Environment.Interfaces 6namespace OpenSim.Region.Environment.Interfaces
7{ 7{
8 public interface ISimChat 8 public interface ISimChat
9 { 9 {
10 void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 10 void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
11 } 11 }
12} 12}
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
index a07168e..576c5b4 100644
--- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
@@ -1,46 +1,46 @@
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.Region.Environment.Interfaces 6namespace OpenSim.Region.Environment.Interfaces
7{ 7{
8 public interface ITerrain 8 public interface ITerrain
9 { 9 {
10 bool Tainted(); 10 bool Tainted();
11 bool Tainted(int x, int y); 11 bool Tainted(int x, int y);
12 void ResetTaint(); 12 void ResetTaint();
13 void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser); 13 void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser);
14 void CheckHeightValues(); 14 void CheckHeightValues();
15 float[] GetHeights1D(); 15 float[] GetHeights1D();
16 float[,] GetHeights2D(); 16 float[,] GetHeights2D();
17 double[,] GetHeights2DD(); 17 double[,] GetHeights2DD();
18 void GetHeights1D(float[] heights); 18 void GetHeights1D(float[] heights);
19 void SetHeights2D(float[,] heights); 19 void SetHeights2D(float[,] heights);
20 void SetHeights2D(double[,] heights); 20 void SetHeights2D(double[,] heights);
21 void SwapRevertMaps(); 21 void SwapRevertMaps();
22 void SaveRevertMap(); 22 void SaveRevertMap();
23 bool RunTerrainCmd(string[] args, ref string resultText, string simName); 23 bool RunTerrainCmd(string[] args, ref string resultText, string simName);
24 void SetRange(float min, float max); 24 void SetRange(float min, float max);
25 void LoadFromFileF64(string filename); 25 void LoadFromFileF64(string filename);
26 void LoadFromFileF32(string filename); 26 void LoadFromFileF32(string filename);
27 void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); 27 void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY);
28 void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); 28 void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY);
29 void LoadFromFileSLRAW(string filename); 29 void LoadFromFileSLRAW(string filename);
30 void WriteToFileF64(string filename); 30 void WriteToFileF64(string filename);
31 void WriteToFileF32(string filename); 31 void WriteToFileF32(string filename);
32 void WriteToFileRAW(string filename); 32 void WriteToFileRAW(string filename);
33 void WriteToFileHiRAW(string filename); 33 void WriteToFileHiRAW(string filename);
34 void SetSeed(int val); 34 void SetSeed(int val);
35 void RaiseTerrain(double rx, double ry, double size, double amount); 35 void RaiseTerrain(double rx, double ry, double size, double amount);
36 void LowerTerrain(double rx, double ry, double size, double amount); 36 void LowerTerrain(double rx, double ry, double size, double amount);
37 void FlattenTerrain(double rx, double ry, double size, double amount); 37 void FlattenTerrain(double rx, double ry, double size, double amount);
38 void NoiseTerrain(double rx, double ry, double size, double amount); 38 void NoiseTerrain(double rx, double ry, double size, double amount);
39 void RevertTerrain(double rx, double ry, double size, double amount); 39 void RevertTerrain(double rx, double ry, double size, double amount);
40 void SmoothTerrain(double rx, double ry, double size, double amount); 40 void SmoothTerrain(double rx, double ry, double size, double amount);
41 void HillsGenerator(); 41 void HillsGenerator();
42 double GetHeight(int x, int y); 42 double GetHeight(int x, int y);
43 void ExportImage(string filename, string gradientmap); 43 void ExportImage(string filename, string gradientmap);
44 byte[] ExportJpegImage(string gradientmap); 44 byte[] ExportJpegImage(string gradientmap);
45 } 45 }
46} 46}
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs
index a19ba8d..7482ec0 100644
--- a/OpenSim/Region/Environment/Interfaces/IXfer.cs
+++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs
@@ -1,11 +1,11 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Environment.Interfaces 5namespace OpenSim.Region.Environment.Interfaces
6{ 6{
7 public interface IXfer 7 public interface IXfer
8 { 8 {
9 bool AddNewFile(string fileName, byte[] data); 9 bool AddNewFile(string fileName, byte[] data);
10 } 10 }
11} 11}
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index ea416cb..5e27f50 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -1,160 +1,160 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Reflection; 3using System.Reflection;
4using System.Text; 4using System.Text;
5using OpenSim.Framework.Console; 5using OpenSim.Framework.Console;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8using OpenSim.Region.Environment.Modules; 8using OpenSim.Region.Environment.Modules;
9 9
10namespace OpenSim.Region.Environment 10namespace OpenSim.Region.Environment
11{ 11{
12 public class ModuleLoader 12 public class ModuleLoader
13 { 13 {
14 14
15 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); 15 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
16 16
17 public List<IRegionModule> LoadedModules = new List<IRegionModule>(); 17 public List<IRegionModule> LoadedModules = new List<IRegionModule>();
18 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); 18 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
19 19
20 public ModuleLoader() 20 public ModuleLoader()
21 { 21 {
22 22
23 } 23 }
24 24
25 /// <summary> 25 /// <summary>
26 /// Should have a module factory? 26 /// Should have a module factory?
27 /// </summary> 27 /// </summary>
28 /// <param name="scene"></param> 28 /// <param name="scene"></param>
29 public void CreateDefaultModules(Scene scene, string exceptModules) 29 public void CreateDefaultModules(Scene scene, string exceptModules)
30 { 30 {
31 IRegionModule module = new XferModule(); 31 IRegionModule module = new XferModule();
32 InitialiseModule(module, scene); 32 InitialiseModule(module, scene);
33 33
34 module = new ChatModule(); 34 module = new ChatModule();
35 InitialiseModule(module, scene); 35 InitialiseModule(module, scene);
36 36
37 module = new AvatarProfilesModule(); 37 module = new AvatarProfilesModule();
38 InitialiseModule(module, scene); 38 InitialiseModule(module, scene);
39 39
40 this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); 40 this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
41 41
42 string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); 42 string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
43 this.LoadRegionModule(lslPath, "LSLScriptingModule", scene); 43 this.LoadRegionModule(lslPath, "LSLScriptingModule", scene);
44 44
45 } 45 }
46 46
47 47
48 public void LoadDefaultSharedModules(string exceptModules) 48 public void LoadDefaultSharedModules(string exceptModules)
49 { 49 {
50 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 50 DynamicTextureModule dynamicModule = new DynamicTextureModule();
51 this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); 51 this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
52 } 52 }
53 53
54 public void InitialiseSharedModules(Scene scene) 54 public void InitialiseSharedModules(Scene scene)
55 { 55 {
56 foreach (IRegionModule module in this.LoadedSharedModules.Values) 56 foreach (IRegionModule module in this.LoadedSharedModules.Values)
57 { 57 {
58 module.Initialise(scene); 58 module.Initialise(scene);
59 scene.AddModule(module.GetName(), module); //should be doing this? 59 scene.AddModule(module.GetName(), module); //should be doing this?
60 } 60 }
61 } 61 }
62 62
63 private void InitialiseModule(IRegionModule module, Scene scene) 63 private void InitialiseModule(IRegionModule module, Scene scene)
64 { 64 {
65 module.Initialise(scene); 65 module.Initialise(scene);
66 scene.AddModule(module.GetName(), module); 66 scene.AddModule(module.GetName(), module);
67 LoadedModules.Add(module); 67 LoadedModules.Add(module);
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// Loads/initialises a Module instance that can be used by mutliple Regions 71 /// Loads/initialises a Module instance that can be used by mutliple Regions
72 /// </summary> 72 /// </summary>
73 /// <param name="dllName"></param> 73 /// <param name="dllName"></param>
74 /// <param name="moduleName"></param> 74 /// <param name="moduleName"></param>
75 /// <param name="scene"></param> 75 /// <param name="scene"></param>
76 public void LoadSharedModule(string dllName, string moduleName) 76 public void LoadSharedModule(string dllName, string moduleName)
77 { 77 {
78 IRegionModule module = this.LoadModule(dllName, moduleName); 78 IRegionModule module = this.LoadModule(dllName, moduleName);
79 if (module != null) 79 if (module != null)
80 { 80 {
81 this.LoadedSharedModules.Add(module.GetName(), module); 81 this.LoadedSharedModules.Add(module.GetName(), module);
82 } 82 }
83 } 83 }
84 84
85 public void LoadRegionModule(string dllName, string moduleName, Scene scene) 85 public void LoadRegionModule(string dllName, string moduleName, Scene scene)
86 { 86 {
87 IRegionModule module = this.LoadModule(dllName, moduleName); 87 IRegionModule module = this.LoadModule(dllName, moduleName);
88 if (module != null) 88 if (module != null)
89 { 89 {
90 this.InitialiseModule(module, scene); 90 this.InitialiseModule(module, scene);
91 } 91 }
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
95 /// Loads a external Module (if not already loaded) and creates a new instance of it. 95 /// Loads a external Module (if not already loaded) and creates a new instance of it.
96 /// </summary> 96 /// </summary>
97 /// <param name="dllName"></param> 97 /// <param name="dllName"></param>
98 /// <param name="moduleName"></param> 98 /// <param name="moduleName"></param>
99 /// <param name="scene"></param> 99 /// <param name="scene"></param>
100 public IRegionModule LoadModule(string dllName, string moduleName) 100 public IRegionModule LoadModule(string dllName, string moduleName)
101 { 101 {
102 Assembly pluginAssembly = null; 102 Assembly pluginAssembly = null;
103 if (LoadedAssemblys.ContainsKey(dllName)) 103 if (LoadedAssemblys.ContainsKey(dllName))
104 { 104 {
105 pluginAssembly = LoadedAssemblys[dllName]; 105 pluginAssembly = LoadedAssemblys[dllName];
106 } 106 }
107 else 107 else
108 { 108 {
109 pluginAssembly = Assembly.LoadFrom(dllName); 109 pluginAssembly = Assembly.LoadFrom(dllName);
110 this.LoadedAssemblys.Add(dllName, pluginAssembly); 110 this.LoadedAssemblys.Add(dllName, pluginAssembly);
111 } 111 }
112 112
113 IRegionModule module = null; 113 IRegionModule module = null;
114 foreach (Type pluginType in pluginAssembly.GetTypes()) 114 foreach (Type pluginType in pluginAssembly.GetTypes())
115 { 115 {
116 if (pluginType.IsPublic) 116 if (pluginType.IsPublic)
117 { 117 {
118 if (!pluginType.IsAbstract) 118 if (!pluginType.IsAbstract)
119 { 119 {
120 Type typeInterface = pluginType.GetInterface("IRegionModule", true); 120 Type typeInterface = pluginType.GetInterface("IRegionModule", true);
121 121
122 if (typeInterface != null) 122 if (typeInterface != null)
123 { 123 {
124 module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 124 module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
125 break; 125 break;
126 } 126 }
127 typeInterface = null; 127 typeInterface = null;
128 } 128 }
129 } 129 }
130 } 130 }
131 pluginAssembly = null; 131 pluginAssembly = null;
132 132
133 if ((module != null ) || (module.GetName() == moduleName)) 133 if ((module != null ) || (module.GetName() == moduleName))
134 { 134 {
135 return module; 135 return module;
136 } 136 }
137 137
138 return null; 138 return null;
139 139
140 } 140 }
141 141
142 public void PostInitialise() 142 public void PostInitialise()
143 { 143 {
144 foreach (IRegionModule module in this.LoadedSharedModules.Values) 144 foreach (IRegionModule module in this.LoadedSharedModules.Values)
145 { 145 {
146 module.PostInitialise(); 146 module.PostInitialise();
147 } 147 }
148 148
149 foreach (IRegionModule module in this.LoadedModules) 149 foreach (IRegionModule module in this.LoadedModules)
150 { 150 {
151 module.PostInitialise(); 151 module.PostInitialise();
152 } 152 }
153 } 153 }
154 154
155 public void ClearCache() 155 public void ClearCache()
156 { 156 {
157 this.LoadedAssemblys.Clear(); 157 this.LoadedAssemblys.Clear();
158 } 158 }
159 } 159 }
160} 160}
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index 21a7e61..7a53f6f 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -1,50 +1,50 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class AssetDownloadModule : IRegionModule 12 public class AssetDownloadModule : IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public AssetDownloadModule() 16 public AssetDownloadModule()
17 { 17 {
18 18
19 } 19 }
20 20
21 public void Initialise(Scene scene) 21 public void Initialise(Scene scene)
22 { 22 {
23 m_scene = scene; 23 m_scene = scene;
24 m_scene.EventManager.OnNewClient += NewClient; 24 m_scene.EventManager.OnNewClient += NewClient;
25 } 25 }
26 26
27 public void PostInitialise() 27 public void PostInitialise()
28 { 28 {
29 29
30 } 30 }
31 31
32 public void CloseDown() 32 public void CloseDown()
33 { 33 {
34 } 34 }
35 35
36 public string GetName() 36 public string GetName()
37 { 37 {
38 return "AssetDownloadModule"; 38 return "AssetDownloadModule";
39 } 39 }
40 40
41 public bool IsSharedModule() 41 public bool IsSharedModule()
42 { 42 {
43 return false; 43 return false;
44 } 44 }
45 45
46 public void NewClient(IClientAPI client) 46 public void NewClient(IClientAPI client)
47 { 47 {
48 } 48 }
49 } 49 }
50} 50}
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 1ad061a..c349888 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -1,71 +1,71 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
10{ 10{
11 public class AvatarProfilesModule :IRegionModule 11 public class AvatarProfilesModule :IRegionModule
12 { 12 {
13 13
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public AvatarProfilesModule() 16 public AvatarProfilesModule()
17 { 17 {
18 18
19 } 19 }
20 20
21 public void Initialise(Scene scene) 21 public void Initialise(Scene scene)
22 { 22 {
23 m_scene = scene; 23 m_scene = scene;
24 m_scene.EventManager.OnNewClient += NewClient; 24 m_scene.EventManager.OnNewClient += NewClient;
25 } 25 }
26 26
27 public void PostInitialise() 27 public void PostInitialise()
28 { 28 {
29 29
30 } 30 }
31 31
32 public void CloseDown() 32 public void CloseDown()
33 { 33 {
34 34
35 } 35 }
36 36
37 public string GetName() 37 public string GetName()
38 { 38 {
39 return "AvatarProfilesModule"; 39 return "AvatarProfilesModule";
40 } 40 }
41 41
42 public bool IsSharedModule() 42 public bool IsSharedModule()
43 { 43 {
44 return false; 44 return false;
45 } 45 }
46 46
47 public void NewClient(IClientAPI client) 47 public void NewClient(IClientAPI client)
48 { 48 {
49 client.OnRequestAvatarProperties += RequestAvatarProperty; 49 client.OnRequestAvatarProperties += RequestAvatarProperty;
50 } 50 }
51 51
52 public void RemoveClient(IClientAPI client) 52 public void RemoveClient(IClientAPI client)
53 { 53 {
54 client.OnRequestAvatarProperties -= RequestAvatarProperty; 54 client.OnRequestAvatarProperties -= RequestAvatarProperty;
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
58 /// 58 ///
59 /// </summary> 59 /// </summary>
60 /// <param name="remoteClient"></param> 60 /// <param name="remoteClient"></param>
61 /// <param name="avatarID"></param> 61 /// <param name="avatarID"></param>
62 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) 62 public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
63 { 63 {
64 string about = "OpenSim crash test dummy"; 64 string about = "OpenSim crash test dummy";
65 string bornOn = "Before now"; 65 string bornOn = "Before now";
66 string flAbout = "First life? What is one of those? OpenSim is my life!"; 66 string flAbout = "First life? What is one of those? OpenSim is my life!";
67 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 67 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
68 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); 68 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner);
69 } 69 }
70 } 70 }
71} 71}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index a46343b..8d3a553 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -1,216 +1,216 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Net; 4using System.Net;
5using System.Net.Sockets; 5using System.Net.Sockets;
6using System.Threading; 6using System.Threading;
7using System.IO; 7using System.IO;
8using libsecondlife; 8using libsecondlife;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 10using OpenSim.Region.Environment.Interfaces;
11using OpenSim.Framework.Interfaces; 11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13using OpenSim.Framework.Console; 13using OpenSim.Framework.Console;
14 14
15namespace OpenSim.Region.Environment.Modules 15namespace OpenSim.Region.Environment.Modules
16{ 16{
17 public class ChatModule : IRegionModule, ISimChat 17 public class ChatModule : IRegionModule, ISimChat
18 { 18 {
19 private Scene m_scene; 19 private Scene m_scene;
20 20
21 private string m_server = "irc2.choopa.net"; 21 private string m_server = "irc2.choopa.net";
22 22
23 // private int m_port = 6668; 23 // private int m_port = 6668;
24 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 24 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
25 private string m_nick = "OSimBot"; 25 private string m_nick = "OSimBot";
26 private string m_channel = "#opensim"; 26 private string m_channel = "#opensim";
27 27
28 // private NetworkStream m_stream; 28 // private NetworkStream m_stream;
29 private TcpClient m_irc; 29 private TcpClient m_irc;
30 private StreamWriter m_ircWriter; 30 private StreamWriter m_ircWriter;
31 private StreamReader m_ircReader; 31 private StreamReader m_ircReader;
32 32
33 // private Thread pingSender; 33 // private Thread pingSender;
34 // private Thread listener; 34 // private Thread listener;
35 35
36 private bool connected = false; 36 private bool connected = false;
37 37
38 public ChatModule() 38 public ChatModule()
39 { 39 {
40 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); 40 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
41 m_irc = null; 41 m_irc = null;
42 m_ircWriter = null; 42 m_ircWriter = null;
43 m_ircReader = null; 43 m_ircReader = null;
44 } 44 }
45 45
46 public void Initialise(Scene scene) 46 public void Initialise(Scene scene)
47 { 47 {
48 m_scene = scene; 48 m_scene = scene;
49 m_scene.EventManager.OnNewClient += NewClient; 49 m_scene.EventManager.OnNewClient += NewClient;
50 50
51 m_scene.RegisterModuleInterface<ISimChat>(this); 51 m_scene.RegisterModuleInterface<ISimChat>(this);
52 } 52 }
53 53
54 public void PostInitialise() 54 public void PostInitialise()
55 { 55 {
56 /* 56 /*
57 try 57 try
58 { 58 {
59 m_irc = new TcpClient(m_server, m_port); 59 m_irc = new TcpClient(m_server, m_port);
60 m_stream = m_irc.GetStream(); 60 m_stream = m_irc.GetStream();
61 m_ircReader = new StreamReader(m_stream); 61 m_ircReader = new StreamReader(m_stream);
62 m_ircWriter = new StreamWriter(m_stream); 62 m_ircWriter = new StreamWriter(m_stream);
63 63
64 pingSender = new Thread(new ThreadStart(this.PingRun)); 64 pingSender = new Thread(new ThreadStart(this.PingRun));
65 pingSender.Start(); 65 pingSender.Start();
66 66
67 listener = new Thread(new ThreadStart(this.ListenerRun)); 67 listener = new Thread(new ThreadStart(this.ListenerRun));
68 listener.Start(); 68 listener.Start();
69 69
70 m_ircWriter.WriteLine(m_user); 70 m_ircWriter.WriteLine(m_user);
71 m_ircWriter.Flush(); 71 m_ircWriter.Flush();
72 m_ircWriter.WriteLine("NICK " + m_nick); 72 m_ircWriter.WriteLine("NICK " + m_nick);
73 m_ircWriter.Flush(); 73 m_ircWriter.Flush();
74 m_ircWriter.WriteLine("JOIN " + m_channel); 74 m_ircWriter.WriteLine("JOIN " + m_channel);
75 m_ircWriter.Flush(); 75 m_ircWriter.Flush();
76 connected = true; 76 connected = true;
77 } 77 }
78 catch (Exception e) 78 catch (Exception e)
79 { 79 {
80 Console.WriteLine(e.ToString()); 80 Console.WriteLine(e.ToString());
81 } 81 }
82 */ 82 */
83 } 83 }
84 84
85 public void CloseDown() 85 public void CloseDown()
86 { 86 {
87 m_ircWriter.Close(); 87 m_ircWriter.Close();
88 m_ircReader.Close(); 88 m_ircReader.Close();
89 m_irc.Close(); 89 m_irc.Close();
90 } 90 }
91 91
92 public string GetName() 92 public string GetName()
93 { 93 {
94 return "ChatModule"; 94 return "ChatModule";
95 } 95 }
96 96
97 public bool IsSharedModule() 97 public bool IsSharedModule()
98 { 98 {
99 return false; 99 return false;
100 } 100 }
101 101
102 public void NewClient(IClientAPI client) 102 public void NewClient(IClientAPI client)
103 { 103 {
104 client.OnChatFromViewer += SimChat; 104 client.OnChatFromViewer += SimChat;
105 } 105 }
106 106
107 public void PingRun() 107 public void PingRun()
108 { 108 {
109 while (true) 109 while (true)
110 { 110 {
111 m_ircWriter.WriteLine("PING :" + m_server); 111 m_ircWriter.WriteLine("PING :" + m_server);
112 m_ircWriter.Flush(); 112 m_ircWriter.Flush();
113 Thread.Sleep(15000); 113 Thread.Sleep(15000);
114 } 114 }
115 } 115 }
116 116
117 public void ListenerRun() 117 public void ListenerRun()
118 { 118 {
119 string inputLine; 119 string inputLine;
120 LLVector3 pos = new LLVector3(128, 128, 20); 120 LLVector3 pos = new LLVector3(128, 128, 20);
121 while (true) 121 while (true)
122 { 122 {
123 while ((inputLine = m_ircReader.ReadLine()) != null) 123 while ((inputLine = m_ircReader.ReadLine()) != null)
124 { 124 {
125 Console.WriteLine(inputLine); 125 Console.WriteLine(inputLine);
126 if (inputLine.Contains(m_channel)) 126 if (inputLine.Contains(m_channel))
127 { 127 {
128 string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); 128 string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
129 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 129 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
130 { 130 {
131 presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:", 131 presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:",
132 LLUUID.Zero); 132 LLUUID.Zero);
133 }); 133 });
134 } 134 }
135 } 135 }
136 } 136 }
137 } 137 }
138 138
139 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 139 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
140 { 140 {
141 ScenePresence avatar = null; 141 ScenePresence avatar = null;
142 avatar = m_scene.RequestAvatar(fromAgentID); 142 avatar = m_scene.RequestAvatar(fromAgentID);
143 if (avatar != null) 143 if (avatar != null)
144 { 144 {
145 fromPos = avatar.AbsolutePosition; 145 fromPos = avatar.AbsolutePosition;
146 fromName = avatar.Firstname + " " + avatar.Lastname; 146 fromName = avatar.Firstname + " " + avatar.Lastname;
147 avatar = null; 147 avatar = null;
148 } 148 }
149 149
150 if (connected) 150 if (connected)
151 { 151 {
152 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + 152 m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
153 Util.FieldToString(message)); 153 Util.FieldToString(message));
154 m_ircWriter.Flush(); 154 m_ircWriter.Flush();
155 } 155 }
156 156
157 if (channel == 0) 157 if (channel == 0)
158 { 158 {
159 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 159 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
160 { 160 {
161 int dis = -1000; 161 int dis = -1000;
162 162
163 //err ??? the following code seems to be request a scenePresence when it already has a ref to it 163 //err ??? the following code seems to be request a scenePresence when it already has a ref to it
164 avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId); 164 avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
165 if (avatar != null) 165 if (avatar != null)
166 { 166 {
167 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); 167 dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
168 } 168 }
169 169
170 switch (type) 170 switch (type)
171 { 171 {
172 case 0: // Whisper 172 case 0: // Whisper
173 if ((dis < 10) && (dis > -10)) 173 if ((dis < 10) && (dis > -10))
174 { 174 {
175 //should change so the message is sent through the avatar rather than direct to the ClientView 175 //should change so the message is sent through the avatar rather than direct to the ClientView
176 presence.ControllingClient.SendChatMessage(message, 176 presence.ControllingClient.SendChatMessage(message,
177 type, 177 type,
178 fromPos, 178 fromPos,
179 fromName, 179 fromName,
180 fromAgentID); 180 fromAgentID);
181 } 181 }
182 break; 182 break;
183 case 1: // Say 183 case 1: // Say
184 if ((dis < 30) && (dis > -30)) 184 if ((dis < 30) && (dis > -30))
185 { 185 {
186 //Console.WriteLine("sending chat"); 186 //Console.WriteLine("sending chat");
187 presence.ControllingClient.SendChatMessage(message, 187 presence.ControllingClient.SendChatMessage(message,
188 type, 188 type,
189 fromPos, 189 fromPos,
190 fromName, 190 fromName,
191 fromAgentID); 191 fromAgentID);
192 } 192 }
193 break; 193 break;
194 case 2: // Shout 194 case 2: // Shout
195 if ((dis < 100) && (dis > -100)) 195 if ((dis < 100) && (dis > -100))
196 { 196 {
197 presence.ControllingClient.SendChatMessage(message, 197 presence.ControllingClient.SendChatMessage(message,
198 type, 198 type,
199 fromPos, 199 fromPos,
200 fromName, 200 fromName,
201 fromAgentID); 201 fromAgentID);
202 } 202 }
203 break; 203 break;
204 204
205 case 0xff: // Broadcast 205 case 0xff: // Broadcast
206 presence.ControllingClient.SendChatMessage(message, type, 206 presence.ControllingClient.SendChatMessage(message, type,
207 fromPos, 207 fromPos,
208 fromName, 208 fromName,
209 fromAgentID); 209 fromAgentID);
210 break; 210 break;
211 } 211 }
212 }); 212 });
213 } 213 }
214 } 214 }
215 } 215 }
216} 216}
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index 8223919..bbd9810 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -1,159 +1,159 @@
1using System.Text; 1using System.Text;
2using System.Net; 2using System.Net;
3using System.Net.Sockets; 3using System.Net.Sockets;
4using System.Threading; 4using System.Threading;
5using System.IO; 5using System.IO;
6using System.Collections.Generic; 6using System.Collections.Generic;
7using libsecondlife; 7using libsecondlife;
8using OpenSim.Region.Environment.Scenes; 8using OpenSim.Region.Environment.Scenes;
9using OpenSim.Region.Environment.Interfaces; 9using OpenSim.Region.Environment.Interfaces;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Utilities; 11using OpenSim.Framework.Utilities;
12using OpenSim.Framework.Console; 12using OpenSim.Framework.Console;
13using OpenSim.Framework.Types; 13using OpenSim.Framework.Types;
14 14
15namespace OpenSim.Region.Environment.Modules 15namespace OpenSim.Region.Environment.Modules
16{ 16{
17 public class DynamicTextureModule :IRegionModule, IDynamicTextureManager 17 public class DynamicTextureModule :IRegionModule, IDynamicTextureManager
18 { 18 {
19 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 19 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
20 private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>(); 20 private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>();
21 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); 21 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
22 22
23 public void Initialise(Scene scene) 23 public void Initialise(Scene scene)
24 { 24 {
25 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) 25 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
26 { 26 {
27 RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); 27 RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
28 scene.RegisterModuleInterface<IDynamicTextureManager>(this); 28 scene.RegisterModuleInterface<IDynamicTextureManager>(this);
29 } 29 }
30 } 30 }
31 31
32 public void PostInitialise() 32 public void PostInitialise()
33 { 33 {
34 34
35 } 35 }
36 36
37 public void CloseDown() 37 public void CloseDown()
38 { 38 {
39 } 39 }
40 40
41 public string GetName() 41 public string GetName()
42 { 42 {
43 return "DynamicTextureModule"; 43 return "DynamicTextureModule";
44 } 44 }
45 45
46 public bool IsSharedModule() 46 public bool IsSharedModule()
47 { 47 {
48 return true; 48 return true;
49 } 49 }
50 50
51 public void RegisterRender(string handleType, IDynamicTextureRender render) 51 public void RegisterRender(string handleType, IDynamicTextureRender render)
52 { 52 {
53 if (!RenderPlugins.ContainsKey(handleType)) 53 if (!RenderPlugins.ContainsKey(handleType))
54 { 54 {
55 RenderPlugins.Add(handleType, render); 55 RenderPlugins.Add(handleType, render);
56 } 56 }
57 } 57 }
58 58
59 public void ReturnData(LLUUID id, byte[] data) 59 public void ReturnData(LLUUID id, byte[] data)
60 { 60 {
61 if (Updaters.ContainsKey(id)) 61 if (Updaters.ContainsKey(id))
62 { 62 {
63 DynamicTextureUpdater updater = Updaters[id]; 63 DynamicTextureUpdater updater = Updaters[id];
64 if (RegisteredScenes.ContainsKey(updater.SimUUID)) 64 if (RegisteredScenes.ContainsKey(updater.SimUUID))
65 { 65 {
66 Scene scene = RegisteredScenes[updater.SimUUID]; 66 Scene scene = RegisteredScenes[updater.SimUUID];
67 updater.DataReceived(data, scene); 67 updater.DataReceived(data, scene);
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) 72 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer)
73 { 73 {
74 System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 74 System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
75 if (this.RenderPlugins.ContainsKey(contentType)) 75 if (this.RenderPlugins.ContainsKey(contentType))
76 { 76 {
77 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 77 DynamicTextureUpdater updater = new DynamicTextureUpdater();
78 updater.SimUUID = simID; 78 updater.SimUUID = simID;
79 updater.PrimID = primID; 79 updater.PrimID = primID;
80 updater.ContentType = contentType; 80 updater.ContentType = contentType;
81 updater.Url = url; 81 updater.Url = url;
82 updater.UpdateTimer = updateTimer; 82 updater.UpdateTimer = updateTimer;
83 updater.UpdaterID = LLUUID.Random(); 83 updater.UpdaterID = LLUUID.Random();
84 updater.Params = extraParams; 84 updater.Params = extraParams;
85 85
86 if (!this.Updaters.ContainsKey(updater.UpdaterID)) 86 if (!this.Updaters.ContainsKey(updater.UpdaterID))
87 { 87 {
88 Updaters.Add(updater.UpdaterID, updater); 88 Updaters.Add(updater.UpdaterID, updater);
89 } 89 }
90 90
91 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); 91 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
92 return updater.UpdaterID; 92 return updater.UpdaterID;
93 } 93 }
94 return LLUUID.Zero; 94 return LLUUID.Zero;
95 } 95 }
96 96
97 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer) 97 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer)
98 { 98 {
99 if (this.RenderPlugins.ContainsKey(contentType)) 99 if (this.RenderPlugins.ContainsKey(contentType))
100 { 100 {
101 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 101 DynamicTextureUpdater updater = new DynamicTextureUpdater();
102 updater.SimUUID = simID; 102 updater.SimUUID = simID;
103 updater.PrimID = primID; 103 updater.PrimID = primID;
104 updater.ContentType = contentType; 104 updater.ContentType = contentType;
105 updater.BodyData = data; 105 updater.BodyData = data;
106 updater.UpdateTimer = updateTimer; 106 updater.UpdateTimer = updateTimer;
107 updater.UpdaterID = LLUUID.Random(); 107 updater.UpdaterID = LLUUID.Random();
108 updater.Params = extraParams; 108 updater.Params = extraParams;
109 109
110 if (!this.Updaters.ContainsKey(updater.UpdaterID)) 110 if (!this.Updaters.ContainsKey(updater.UpdaterID))
111 { 111 {
112 Updaters.Add(updater.UpdaterID, updater); 112 Updaters.Add(updater.UpdaterID, updater);
113 } 113 }
114 114
115 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); 115 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
116 return updater.UpdaterID; 116 return updater.UpdaterID;
117 } 117 }
118 return LLUUID.Zero; 118 return LLUUID.Zero;
119 } 119 }
120 120
121 public class DynamicTextureUpdater 121 public class DynamicTextureUpdater
122 { 122 {
123 public LLUUID SimUUID; 123 public LLUUID SimUUID;
124 public LLUUID UpdaterID; 124 public LLUUID UpdaterID;
125 public string ContentType; 125 public string ContentType;
126 public string Url; 126 public string Url;
127 public string BodyData; 127 public string BodyData;
128 public LLUUID PrimID; 128 public LLUUID PrimID;
129 public int UpdateTimer; 129 public int UpdateTimer;
130 public LLUUID LastAssetID; 130 public LLUUID LastAssetID;
131 public string Params; 131 public string Params;
132 132
133 public DynamicTextureUpdater() 133 public DynamicTextureUpdater()
134 { 134 {
135 LastAssetID = LLUUID.Zero; 135 LastAssetID = LLUUID.Zero;
136 UpdateTimer = 0; 136 UpdateTimer = 0;
137 BodyData = null; 137 BodyData = null;
138 } 138 }
139 139
140 public void DataReceived(byte[] data, Scene scene) 140 public void DataReceived(byte[] data, Scene scene)
141 { 141 {
142 //TODO delete the last asset(data), if it was a dynamic texture 142 //TODO delete the last asset(data), if it was a dynamic texture
143 143
144 AssetBase asset = new AssetBase(); 144 AssetBase asset = new AssetBase();
145 asset.FullID = LLUUID.Random(); 145 asset.FullID = LLUUID.Random();
146 asset.Data = data; 146 asset.Data = data;
147 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); 147 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
148 asset.Type = 0; 148 asset.Type = 0;
149 scene.commsManager.AssetCache.AddAsset(asset); 149 scene.commsManager.AssetCache.AddAsset(asset);
150 150
151 this.LastAssetID = asset.FullID; 151 this.LastAssetID = asset.FullID;
152 152
153 SceneObjectPart part = scene.GetSceneObjectPart(PrimID); 153 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
154 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); 154 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
155 part.ScheduleFullUpdate(); 155 part.ScheduleFullUpdate();
156 } 156 }
157 } 157 }
158 } 158 }
159} 159}
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs
index 2a90dd3..fff9539 100644
--- a/OpenSim/Region/Environment/Modules/EmailModule.cs
+++ b/OpenSim/Region/Environment/Modules/EmailModule.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.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
6{ 6{
7 class EmailModule 7 class EmailModule
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index d46039c..411b838 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -1,40 +1,40 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class FriendsModule : IRegionModule 12 public class FriendsModule : IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
17 { 17 {
18 m_scene = scene; 18 m_scene = scene;
19 } 19 }
20 20
21 public void PostInitialise() 21 public void PostInitialise()
22 { 22 {
23 23
24 } 24 }
25 25
26 public void CloseDown() 26 public void CloseDown()
27 { 27 {
28 } 28 }
29 29
30 public string GetName() 30 public string GetName()
31 { 31 {
32 return "FriendsModule"; 32 return "FriendsModule";
33 } 33 }
34 34
35 public bool IsSharedModule() 35 public bool IsSharedModule()
36 { 36 {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 8e4b409..9ed0e96 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -1,40 +1,40 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
10{ 10{
11 public class GroupsModule : IRegionModule 11 public class GroupsModule : IRegionModule
12 { 12 {
13 private Scene m_scene; 13 private Scene m_scene;
14 14
15 public void Initialise(Scene scene) 15 public void Initialise(Scene scene)
16 { 16 {
17 m_scene = scene; 17 m_scene = scene;
18 } 18 }
19 19
20 public void PostInitialise() 20 public void PostInitialise()
21 { 21 {
22 22
23 } 23 }
24 24
25 public void CloseDown() 25 public void CloseDown()
26 { 26 {
27 } 27 }
28 28
29 public string GetName() 29 public string GetName()
30 { 30 {
31 return "GroupsModule"; 31 return "GroupsModule";
32 } 32 }
33 33
34 public bool IsSharedModule() 34 public bool IsSharedModule()
35 { 35 {
36 return false; 36 return false;
37 } 37 }
38 } 38 }
39} 39}
40 40
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index acf031b..25c118a 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -1,40 +1,40 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class InstantMessageModule :IRegionModule 12 public class InstantMessageModule :IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
17 { 17 {
18 m_scene = scene; 18 m_scene = scene;
19 } 19 }
20 20
21 public void PostInitialise() 21 public void PostInitialise()
22 { 22 {
23 23
24 } 24 }
25 25
26 public void CloseDown() 26 public void CloseDown()
27 { 27 {
28 } 28 }
29 29
30 public string GetName() 30 public string GetName()
31 { 31 {
32 return "InstantMessageModule"; 32 return "InstantMessageModule";
33 } 33 }
34 34
35 public bool IsSharedModule() 35 public bool IsSharedModule()
36 { 36 {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index 00b4d8e..bfcb7d7 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -1,40 +1,40 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9 9
10namespace OpenSim.Region.Environment.Modules 10namespace OpenSim.Region.Environment.Modules
11{ 11{
12 public class InventoryModule :IRegionModule 12 public class InventoryModule :IRegionModule
13 { 13 {
14 private Scene m_scene; 14 private Scene m_scene;
15 15
16 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
17 { 17 {
18 m_scene = scene; 18 m_scene = scene;
19 } 19 }
20 20
21 public void PostInitialise() 21 public void PostInitialise()
22 { 22 {
23 23
24 } 24 }
25 25
26 public void CloseDown() 26 public void CloseDown()
27 { 27 {
28 } 28 }
29 29
30 public string GetName() 30 public string GetName()
31 { 31 {
32 return "InventoryModule"; 32 return "InventoryModule";
33 } 33 }
34 34
35 public bool IsSharedModule() 35 public bool IsSharedModule()
36 { 36 {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index 11af718..e47cc9e 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.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.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
6{ 6{
7 class ScriptsHttpRequests 7 class ScriptsHttpRequests
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs
index 08fc202..1c01b27 100644
--- a/OpenSim/Region/Environment/Modules/TeleportModule.cs
+++ b/OpenSim/Region/Environment/Modules/TeleportModule.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.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
6{ 6{
7 class TeleportModule 7 class TeleportModule
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 7d31644..59c0839 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -1,54 +1,54 @@
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.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Interfaces;
8 8
9namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
10{ 10{
11 public class TextureDownloadModule :IRegionModule 11 public class TextureDownloadModule :IRegionModule
12 { 12 {
13 private Scene m_scene; 13 private Scene m_scene;
14 14
15 public TextureDownloadModule() 15 public TextureDownloadModule()
16 { 16 {
17 17
18 } 18 }
19 19
20 public void Initialise(Scene scene) 20 public void Initialise(Scene scene)
21 { 21 {
22 m_scene = scene; 22 m_scene = scene;
23 m_scene.EventManager.OnNewClient += NewClient; 23 m_scene.EventManager.OnNewClient += NewClient;
24 } 24 }
25 25
26 public void PostInitialise() 26 public void PostInitialise()
27 { 27 {
28 28
29 } 29 }
30 30
31 public void CloseDown() 31 public void CloseDown()
32 { 32 {
33 } 33 }
34 34
35 public string GetName() 35 public string GetName()
36 { 36 {
37 return "TextureDownloadModule"; 37 return "TextureDownloadModule";
38 } 38 }
39 39
40 public bool IsSharedModule() 40 public bool IsSharedModule()
41 { 41 {
42 return false; 42 return false;
43 } 43 }
44 44
45 public void NewClient(IClientAPI client) 45 public void NewClient(IClientAPI client)
46 { 46 {
47 } 47 }
48 48
49 public void TextureAssetCallback(LLUUID texture, byte[] data) 49 public void TextureAssetCallback(LLUUID texture, byte[] data)
50 { 50 {
51 51
52 } 52 }
53 } 53 }
54} 54}
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index 44b4d7a..216d10a 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -1,180 +1,180 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Utilities; 7using OpenSim.Framework.Utilities;
8using OpenSim.Region.Environment.Scenes; 8using OpenSim.Region.Environment.Scenes;
9using OpenSim.Region.Environment.Interfaces; 9using OpenSim.Region.Environment.Interfaces;
10 10
11namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
12{ 12{
13 public class XferModule : IRegionModule, IXfer 13 public class XferModule : IRegionModule, IXfer
14 { 14 {
15 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 15 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
16 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 16 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
17 17
18 private Scene m_scene; 18 private Scene m_scene;
19 19
20 public XferModule() 20 public XferModule()
21 { 21 {
22 22
23 } 23 }
24 24
25 public void Initialise(Scene scene) 25 public void Initialise(Scene scene)
26 { 26 {
27 m_scene = scene; 27 m_scene = scene;
28 m_scene.EventManager.OnNewClient += NewClient; 28 m_scene.EventManager.OnNewClient += NewClient;
29 29
30 m_scene.RegisterModuleInterface<IXfer>(this); 30 m_scene.RegisterModuleInterface<IXfer>(this);
31 } 31 }
32 32
33 public void PostInitialise() 33 public void PostInitialise()
34 { 34 {
35 35
36 } 36 }
37 37
38 public void CloseDown() 38 public void CloseDown()
39 { 39 {
40 40
41 } 41 }
42 42
43 public string GetName() 43 public string GetName()
44 { 44 {
45 return "XferModule"; 45 return "XferModule";
46 } 46 }
47 47
48 public bool IsSharedModule() 48 public bool IsSharedModule()
49 { 49 {
50 return false; 50 return false;
51 } 51 }
52 52
53 public void NewClient(IClientAPI client) 53 public void NewClient(IClientAPI client)
54 { 54 {
55 client.OnRequestXfer += RequestXfer; 55 client.OnRequestXfer += RequestXfer;
56 client.OnConfirmXfer += AckPacket; 56 client.OnConfirmXfer += AckPacket;
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// 60 ///
61 /// </summary> 61 /// </summary>
62 /// <param name="remoteClient"></param> 62 /// <param name="remoteClient"></param>
63 /// <param name="xferID"></param> 63 /// <param name="xferID"></param>
64 /// <param name="fileName"></param> 64 /// <param name="fileName"></param>
65 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) 65 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
66 { 66 {
67 lock (NewFiles) 67 lock (NewFiles)
68 { 68 {
69 if (NewFiles.ContainsKey(fileName)) 69 if (NewFiles.ContainsKey(fileName))
70 { 70 {
71 if (!Transfers.ContainsKey(xferID)) 71 if (!Transfers.ContainsKey(xferID))
72 { 72 {
73 byte[] fileData = NewFiles[fileName]; 73 byte[] fileData = NewFiles[fileName];
74 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 74 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
75 Transfers.Add(xferID, transaction); 75 Transfers.Add(xferID, transaction);
76 NewFiles.Remove(fileName); 76 NewFiles.Remove(fileName);
77 transaction.StartSend(); 77 transaction.StartSend();
78 } 78 }
79 } 79 }
80 } 80 }
81 } 81 }
82 82
83 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) 83 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
84 { 84 {
85 if (this.Transfers.ContainsKey(xferID)) 85 if (this.Transfers.ContainsKey(xferID))
86 { 86 {
87 Transfers[xferID].AckPacket(packet); 87 Transfers[xferID].AckPacket(packet);
88 } 88 }
89 } 89 }
90 90
91 public bool AddNewFile(string fileName, byte[] data) 91 public bool AddNewFile(string fileName, byte[] data)
92 { 92 {
93 lock (NewFiles) 93 lock (NewFiles)
94 { 94 {
95 if (NewFiles.ContainsKey(fileName)) 95 if (NewFiles.ContainsKey(fileName))
96 { 96 {
97 NewFiles[fileName] = data; 97 NewFiles[fileName] = data;
98 } 98 }
99 else 99 else
100 { 100 {
101 NewFiles.Add(fileName, data); 101 NewFiles.Add(fileName, data);
102 } 102 }
103 } 103 }
104 return true; 104 return true;
105 } 105 }
106 106
107 107
108 public class XferDownLoad 108 public class XferDownLoad
109 { 109 {
110 public byte[] Data = new byte[0]; 110 public byte[] Data = new byte[0];
111 public string FileName = ""; 111 public string FileName = "";
112 public ulong XferID = 0; 112 public ulong XferID = 0;
113 public int DataPointer = 0; 113 public int DataPointer = 0;
114 public uint Packet = 0; 114 public uint Packet = 0;
115 public IClientAPI Client; 115 public IClientAPI Client;
116 public uint Serial = 1; 116 public uint Serial = 1;
117 private bool complete = false; 117 private bool complete = false;
118 118
119 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) 119 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
120 { 120 {
121 FileName = fileName; 121 FileName = fileName;
122 Data = data; 122 Data = data;
123 XferID = xferID; 123 XferID = xferID;
124 Client = client; 124 Client = client;
125 } 125 }
126 126
127 public XferDownLoad() 127 public XferDownLoad()
128 { 128 {
129 129
130 } 130 }
131 131
132 public void StartSend() 132 public void StartSend()
133 { 133 {
134 if (Data.Length < 1000) 134 if (Data.Length < 1000)
135 { 135 {
136 // for now (testing ) we only support files under 1000 bytes 136 // for now (testing ) we only support files under 1000 bytes
137 byte[] transferData = new byte[Data.Length + 4]; 137 byte[] transferData = new byte[Data.Length + 4];
138 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 138 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
139 Array.Copy(Data, 0, transferData, 4, Data.Length); 139 Array.Copy(Data, 0, transferData, 4, Data.Length);
140 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); 140 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
141 complete = true; 141 complete = true;
142 } 142 }
143 else 143 else
144 { 144 {
145 byte[] transferData = new byte[1000 +4]; 145 byte[] transferData = new byte[1000 +4];
146 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 146 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
147 Array.Copy(Data, 0, transferData, 4, 1000); 147 Array.Copy(Data, 0, transferData, 4, 1000);
148 Client.SendXferPacket(XferID, 0 , transferData); 148 Client.SendXferPacket(XferID, 0 , transferData);
149 Packet++; 149 Packet++;
150 DataPointer = 1000; 150 DataPointer = 1000;
151 } 151 }
152 } 152 }
153 153
154 public void AckPacket(uint packet) 154 public void AckPacket(uint packet)
155 { 155 {
156 if (!complete) 156 if (!complete)
157 { 157 {
158 if ((Data.Length - DataPointer) > 1000) 158 if ((Data.Length - DataPointer) > 1000)
159 { 159 {
160 byte[] transferData = new byte[1000]; 160 byte[] transferData = new byte[1000];
161 Array.Copy(Data, DataPointer, transferData, 0, 1000); 161 Array.Copy(Data, DataPointer, transferData, 0, 1000);
162 Client.SendXferPacket(XferID, Packet, transferData); 162 Client.SendXferPacket(XferID, Packet, transferData);
163 Packet++; 163 Packet++;
164 DataPointer += 1000; 164 DataPointer += 1000;
165 } 165 }
166 else 166 else
167 { 167 {
168 byte[] transferData = new byte[Data.Length - DataPointer]; 168 byte[] transferData = new byte[Data.Length - DataPointer];
169 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); 169 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
170 uint endPacket = Packet |= (uint)0x80000000; 170 uint endPacket = Packet |= (uint)0x80000000;
171 Client.SendXferPacket(XferID, endPacket, transferData); 171 Client.SendXferPacket(XferID, endPacket, transferData);
172 Packet++; 172 Packet++;
173 DataPointer += (Data.Length - DataPointer); 173 DataPointer += (Data.Length - DataPointer);
174 complete = true; 174 complete = true;
175 } 175 }
176 } 176 }
177 } 177 }
178 } 178 }
179 } 179 }
180} 180}
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 110a130..cb455f4 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -1,305 +1,305 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using OpenSim.Framework; 2using OpenSim.Framework;
3using OpenSim.Framework.Types; 3using OpenSim.Framework.Types;
4using OpenSim.Framework.Communications; 4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Servers; 5using OpenSim.Framework.Servers;
6using OpenSim.Region.Capabilities; 6using OpenSim.Region.Capabilities;
7using OpenSim.Region.Environment.Scenes; 7using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.LandManagement; 8using OpenSim.Region.Environment.LandManagement;
9 9
10using libsecondlife; 10using libsecondlife;
11 11
12namespace OpenSim.Region.Environment 12namespace OpenSim.Region.Environment
13{ 13{
14 public class PermissionManager 14 public class PermissionManager
15 { 15 {
16 protected Scene m_scene; 16 protected Scene m_scene;
17 17
18 // Bypasses the permissions engine (always returns OK) 18 // Bypasses the permissions engine (always returns OK)
19 // disable in any production environment 19 // disable in any production environment
20 // TODO: Change this to false when permissions are a desired default 20 // TODO: Change this to false when permissions are a desired default
21 // TODO: Move to configuration option. 21 // TODO: Move to configuration option.
22 private bool m_bypassPermissions = true; 22 private bool m_bypassPermissions = true;
23 public bool BypassPermissions 23 public bool BypassPermissions
24 { 24 {
25 get { return m_bypassPermissions; } 25 get { return m_bypassPermissions; }
26 set { m_bypassPermissions = value; } 26 set { m_bypassPermissions = value; }
27 } 27 }
28 28
29 29
30 public PermissionManager(Scene scene) 30 public PermissionManager(Scene scene)
31 { 31 {
32 m_scene = scene; 32 m_scene = scene;
33 } 33 }
34 34
35 protected virtual void SendPermissionError(LLUUID user, string reason) 35 protected virtual void SendPermissionError(LLUUID user, string reason)
36 { 36 {
37 m_scene.EventManager.TriggerPermissionError(user, reason); 37 m_scene.EventManager.TriggerPermissionError(user, reason);
38 } 38 }
39 39
40 protected virtual bool IsAdministrator(LLUUID user) 40 protected virtual bool IsAdministrator(LLUUID user)
41 { 41 {
42 if (m_bypassPermissions) 42 if (m_bypassPermissions)
43 { 43 {
44 return true; 44 return true;
45 } 45 }
46 46
47 return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; 47 return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
48 } 48 }
49 49
50 protected virtual bool IsEstateManager(LLUUID user) 50 protected virtual bool IsEstateManager(LLUUID user)
51 { 51 {
52 if (m_bypassPermissions) 52 if (m_bypassPermissions)
53 { 53 {
54 return true; 54 return true;
55 } 55 }
56 56
57 return false; 57 return false;
58 } 58 }
59 59
60 protected virtual bool IsGridUser(LLUUID user) 60 protected virtual bool IsGridUser(LLUUID user)
61 { 61 {
62 return true; 62 return true;
63 } 63 }
64 64
65 protected virtual bool IsGuest(LLUUID user) 65 protected virtual bool IsGuest(LLUUID user)
66 { 66 {
67 return false; 67 return false;
68 } 68 }
69 69
70 public virtual bool CanRezObject(LLUUID user, LLVector3 position) 70 public virtual bool CanRezObject(LLUUID user, LLVector3 position)
71 { 71 {
72 bool permission = false; 72 bool permission = false;
73 73
74 string reason = "Insufficient permission"; 74 string reason = "Insufficient permission";
75 75
76 if (IsAdministrator(user)) 76 if (IsAdministrator(user))
77 { 77 {
78 permission = true; 78 permission = true;
79 } 79 }
80 else 80 else
81 { 81 {
82 reason = "Not an administrator"; 82 reason = "Not an administrator";
83 } 83 }
84 84
85 if (GenericParcelPermission(user, position)) 85 if (GenericParcelPermission(user, position))
86 { 86 {
87 permission = true; 87 permission = true;
88 } 88 }
89 else 89 else
90 { 90 {
91 reason = "Not the parcel owner"; 91 reason = "Not the parcel owner";
92 } 92 }
93 93
94 if (!permission) 94 if (!permission)
95 SendPermissionError(user, reason); 95 SendPermissionError(user, reason);
96 96
97 return permission; 97 return permission;
98 } 98 }
99 99
100 #region Object Permissions 100 #region Object Permissions
101 101
102 protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) 102 protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId)
103 { 103 {
104 // Default: deny 104 // Default: deny
105 bool permission = false; 105 bool permission = false;
106 106
107 if( !m_scene.Entities.ContainsKey( objId )) 107 if( !m_scene.Entities.ContainsKey( objId ))
108 { 108 {
109 return false; 109 return false;
110 } 110 }
111 111
112 // If it's not an object, we cant edit it. 112 // If it's not an object, we cant edit it.
113 if (!(m_scene.Entities[objId] is SceneObjectGroup)) 113 if (!(m_scene.Entities[objId] is SceneObjectGroup))
114 { 114 {
115 return false; 115 return false;
116 } 116 }
117 117
118 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; 118 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId];
119 LLUUID taskOwner = null; 119 LLUUID taskOwner = null;
120 120
121 // Object owners should be able to edit their own content 121 // Object owners should be able to edit their own content
122 if (user == taskOwner) 122 if (user == taskOwner)
123 permission = true; 123 permission = true;
124 124
125 // Users should be able to edit what is over their land. 125 // Users should be able to edit what is over their land.
126 if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) 126 if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user)
127 permission = true; 127 permission = true;
128 128
129 // Estate users should be able to edit anything in the sim 129 // Estate users should be able to edit anything in the sim
130 if (IsEstateManager(user)) 130 if (IsEstateManager(user))
131 permission = true; 131 permission = true;
132 132
133 // Admin objects should not be editable by the above 133 // Admin objects should not be editable by the above
134 if (IsAdministrator(taskOwner)) 134 if (IsAdministrator(taskOwner))
135 permission = false; 135 permission = false;
136 136
137 // Admin should be able to edit anything in the sim (including admin objects) 137 // Admin should be able to edit anything in the sim (including admin objects)
138 if (IsAdministrator(user)) 138 if (IsAdministrator(user))
139 permission = true; 139 permission = true;
140 140
141 return permission; 141 return permission;
142 } 142 }
143 143
144 /// <summary> 144 /// <summary>
145 /// Permissions check - can user delete an object? 145 /// Permissions check - can user delete an object?
146 /// </summary> 146 /// </summary>
147 /// <param name="user">User attempting the delete</param> 147 /// <param name="user">User attempting the delete</param>
148 /// <param name="obj">Target object</param> 148 /// <param name="obj">Target object</param>
149 /// <returns>Has permission?</returns> 149 /// <returns>Has permission?</returns>
150 public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) 150 public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
151 { 151 {
152 return GenericObjectPermission(user, obj); 152 return GenericObjectPermission(user, obj);
153 } 153 }
154 154
155 public virtual bool CanEditObject(LLUUID user, LLUUID obj) 155 public virtual bool CanEditObject(LLUUID user, LLUUID obj)
156 { 156 {
157 return GenericObjectPermission(user, obj); 157 return GenericObjectPermission(user, obj);
158 } 158 }
159 159
160 public virtual bool CanReturnObject(LLUUID user, LLUUID obj) 160 public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
161 { 161 {
162 return GenericObjectPermission(user, obj); 162 return GenericObjectPermission(user, obj);
163 } 163 }
164 164
165 #endregion 165 #endregion
166 166
167 #region Communication Permissions 167 #region Communication Permissions
168 168
169 public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) 169 public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
170 { 170 {
171 bool permission = false; 171 bool permission = false;
172 string reason = "Only registered users may communicate with another account."; 172 string reason = "Only registered users may communicate with another account.";
173 173
174 if (IsGridUser(user)) 174 if (IsGridUser(user))
175 permission = true; 175 permission = true;
176 176
177 if (!IsGridUser(user)) 177 if (!IsGridUser(user))
178 { 178 {
179 permission = false; 179 permission = false;
180 reason = "The person that you are messaging is not a registered user."; 180 reason = "The person that you are messaging is not a registered user.";
181 } 181 }
182 if (IsAdministrator(user)) 182 if (IsAdministrator(user))
183 permission = true; 183 permission = true;
184 184
185 if (IsEstateManager(user)) 185 if (IsEstateManager(user))
186 permission = true; 186 permission = true;
187 187
188 if (!permission) 188 if (!permission)
189 SendPermissionError(user, reason); 189 SendPermissionError(user, reason);
190 190
191 return permission; 191 return permission;
192 } 192 }
193 193
194 public virtual bool CanInstantMessage(LLUUID user, LLUUID target) 194 public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
195 { 195 {
196 return GenericCommunicationPermission(user, target); 196 return GenericCommunicationPermission(user, target);
197 } 197 }
198 198
199 public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target) 199 public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
200 { 200 {
201 return GenericCommunicationPermission(user, target); 201 return GenericCommunicationPermission(user, target);
202 } 202 }
203 203
204 #endregion 204 #endregion
205 205
206 public virtual bool CanEditScript(LLUUID user, LLUUID script) 206 public virtual bool CanEditScript(LLUUID user, LLUUID script)
207 { 207 {
208 return IsAdministrator(user); 208 return IsAdministrator(user);
209 } 209 }
210 210
211 public virtual bool CanRunScript(LLUUID user, LLUUID script) 211 public virtual bool CanRunScript(LLUUID user, LLUUID script)
212 { 212 {
213 return IsAdministrator(user); 213 return IsAdministrator(user);
214 } 214 }
215 215
216 public virtual bool CanTerraform(LLUUID user, LLVector3 position) 216 public virtual bool CanTerraform(LLUUID user, LLVector3 position)
217 { 217 {
218 bool permission = false; 218 bool permission = false;
219 219
220 // Estate override 220 // Estate override
221 if (GenericEstatePermission(user)) 221 if (GenericEstatePermission(user))
222 permission = true; 222 permission = true;
223 223
224 // Land owner can terraform too 224 // Land owner can terraform too
225 if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y))) 225 if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y)))
226 permission = true; 226 permission = true;
227 227
228 if (!permission) 228 if (!permission)
229 SendPermissionError(user, "Not authorized to terraform at this location."); 229 SendPermissionError(user, "Not authorized to terraform at this location.");
230 230
231 return permission; 231 return permission;
232 } 232 }
233 233
234 #region Estate Permissions 234 #region Estate Permissions
235 235
236 protected virtual bool GenericEstatePermission(LLUUID user) 236 protected virtual bool GenericEstatePermission(LLUUID user)
237 { 237 {
238 // Default: deny 238 // Default: deny
239 bool permission = false; 239 bool permission = false;
240 240
241 // Estate admins should be able to use estate tools 241 // Estate admins should be able to use estate tools
242 if (IsEstateManager(user)) 242 if (IsEstateManager(user))
243 permission = true; 243 permission = true;
244 244
245 // Administrators always have permission 245 // Administrators always have permission
246 if (IsAdministrator(user)) 246 if (IsAdministrator(user))
247 permission = true; 247 permission = true;
248 248
249 return permission; 249 return permission;
250 } 250 }
251 251
252 public virtual bool CanEditEstateTerrain(LLUUID user) 252 public virtual bool CanEditEstateTerrain(LLUUID user)
253 { 253 {
254 return GenericEstatePermission(user); 254 return GenericEstatePermission(user);
255 } 255 }
256 256
257 #endregion 257 #endregion
258 258
259 #region Parcel Permissions 259 #region Parcel Permissions
260 260
261 protected virtual bool GenericParcelPermission(LLUUID user, Land parcel) 261 protected virtual bool GenericParcelPermission(LLUUID user, Land parcel)
262 { 262 {
263 bool permission = false; 263 bool permission = false;
264 264
265 if (parcel.landData.ownerID == user) 265 if (parcel.landData.ownerID == user)
266 permission = true; 266 permission = true;
267 267
268 if (parcel.landData.isGroupOwned) 268 if (parcel.landData.isGroupOwned)
269 { 269 {
270 // TODO: Need to do some extra checks here. Requires group code. 270 // TODO: Need to do some extra checks here. Requires group code.
271 } 271 }
272 272
273 if(IsEstateManager(user)) 273 if(IsEstateManager(user))
274 permission = true; 274 permission = true;
275 275
276 if (IsAdministrator(user)) 276 if (IsAdministrator(user))
277 permission = true; 277 permission = true;
278 278
279 return permission; 279 return permission;
280 } 280 }
281 281
282 protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) 282 protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos)
283 { 283 {
284 return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y)); 284 return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y));
285 } 285 }
286 286
287 public virtual bool CanEditParcel(LLUUID user, Land parcel) 287 public virtual bool CanEditParcel(LLUUID user, Land parcel)
288 { 288 {
289 return GenericParcelPermission(user, parcel); 289 return GenericParcelPermission(user, parcel);
290 } 290 }
291 291
292 public virtual bool CanSellParcel(LLUUID user, Land parcel) 292 public virtual bool CanSellParcel(LLUUID user, Land parcel)
293 { 293 {
294 return GenericParcelPermission(user, parcel); 294 return GenericParcelPermission(user, parcel);
295 } 295 }
296 296
297 public virtual bool CanAbandonParcel(LLUUID user, Land parcel) 297 public virtual bool CanAbandonParcel(LLUUID user, Land parcel)
298 { 298 {
299 return GenericParcelPermission(user, parcel); 299 return GenericParcelPermission(user, parcel);
300 } 300 }
301 301
302 #endregion 302 #endregion
303 303
304 } 304 }
305} 305}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 70b34cf..a259dd0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,427 +1,427 @@
1using System; 1using System;
2using System.IO; 2using System.IO;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.Communications.Caches; 8using OpenSim.Framework.Communications.Caches;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
11using OpenSim.Region.Physics.Manager; 11using OpenSim.Region.Physics.Manager;
12 12
13namespace OpenSim.Region.Environment.Scenes 13namespace OpenSim.Region.Environment.Scenes
14{ 14{
15 public partial class Scene 15 public partial class Scene
16 { 16 {
17 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete 17 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
18 // or at least some of they can be moved somewhere else 18 // or at least some of they can be moved somewhere else
19 19
20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item) 20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
21 { 21 {
22 if (this.Avatars.ContainsKey(userID)) 22 if (this.Avatars.ContainsKey(userID))
23 { 23 {
24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); 24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item);
25 } 25 }
26 } 26 }
27 27
28 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 28 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
29 { 29 {
30 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 30 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
31 if (userInfo != null) 31 if (userInfo != null)
32 { 32 {
33 userInfo.AddItem(remoteClient.AgentId, item); 33 userInfo.AddItem(remoteClient.AgentId, item);
34 remoteClient.SendInventoryItemUpdate(item); 34 remoteClient.SendInventoryItemUpdate(item);
35 } 35 }
36 } 36 }
37 37
38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) 38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
39 { 39 {
40 if (this.Avatars.ContainsKey(userID)) 40 if (this.Avatars.ContainsKey(userID))
41 { 41 {
42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); 42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data);
43 } 43 }
44 return LLUUID.Zero; 44 return LLUUID.Zero;
45 } 45 }
46 46
47 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) 47 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
48 { 48 {
49 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 49 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
50 if (userInfo != null) 50 if (userInfo != null)
51 { 51 {
52 if (userInfo.RootFolder != null) 52 if (userInfo.RootFolder != null)
53 { 53 {
54 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 54 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
55 if (item != null) 55 if (item != null)
56 { 56 {
57 AssetBase asset; 57 AssetBase asset;
58 asset = new AssetBase(); 58 asset = new AssetBase();
59 asset.FullID = LLUUID.Random(); 59 asset.FullID = LLUUID.Random();
60 asset.Type = (sbyte)item.assetType; 60 asset.Type = (sbyte)item.assetType;
61 asset.InvType = (sbyte)item.invType; 61 asset.InvType = (sbyte)item.invType;
62 asset.Name = item.inventoryName; 62 asset.Name = item.inventoryName;
63 asset.Data = data; 63 asset.Data = data;
64 commsManager.AssetCache.AddAsset(asset); 64 commsManager.AssetCache.AddAsset(asset);
65 65
66 item.assetID = asset.FullID; 66 item.assetID = asset.FullID;
67 userInfo.UpdateItem(remoteClient.AgentId, item); 67 userInfo.UpdateItem(remoteClient.AgentId, item);
68 68
69 // remoteClient.SendInventoryItemUpdate(item); 69 // remoteClient.SendInventoryItemUpdate(item);
70 if (item.invType == 7) 70 if (item.invType == 7)
71 { 71 {
72 //do we want to know about updated note cards? 72 //do we want to know about updated note cards?
73 } 73 }
74 else if (item.invType == 10) 74 else if (item.invType == 10)
75 { 75 {
76 // do we want to know about updated scripts 76 // do we want to know about updated scripts
77 } 77 }
78 78
79 return (asset.FullID); 79 return (asset.FullID);
80 } 80 }
81 } 81 }
82 } 82 }
83 return LLUUID.Zero; 83 return LLUUID.Zero;
84 } 84 }
85 85
86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) 86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID)
87 { 87 {
88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
89 if (userInfo != null) 89 if (userInfo != null)
90 { 90 {
91 if (userInfo.RootFolder != null) 91 if (userInfo.RootFolder != null)
92 { 92 {
93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
94 if (item != null) 94 if (item != null)
95 { 95 {
96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
97 if (transactions != null) 97 if (transactions != null)
98 { 98 {
99 AssetBase asset = null; 99 AssetBase asset = null;
100 bool addToCache = false; 100 bool addToCache = false;
101 101
102 asset = commsManager.AssetCache.GetAsset(assetID); 102 asset = commsManager.AssetCache.GetAsset(assetID);
103 if (asset == null) 103 if (asset == null)
104 { 104 {
105 asset = transactions.GetTransactionAsset(transactionID); 105 asset = transactions.GetTransactionAsset(transactionID);
106 addToCache = true; 106 addToCache = true;
107 } 107 }
108 108
109 if (asset != null) 109 if (asset != null)
110 { 110 {
111 if (asset.FullID == assetID) 111 if (asset.FullID == assetID)
112 { 112 {
113 asset.Name = item.inventoryName; 113 asset.Name = item.inventoryName;
114 asset.Description = item.inventoryDescription; 114 asset.Description = item.inventoryDescription;
115 asset.InvType = (sbyte)item.invType; 115 asset.InvType = (sbyte)item.invType;
116 asset.Type = (sbyte)item.assetType; 116 asset.Type = (sbyte)item.assetType;
117 item.assetID = asset.FullID; 117 item.assetID = asset.FullID;
118 118
119 if (addToCache) 119 if (addToCache)
120 { 120 {
121 commsManager.AssetCache.AddAsset(asset); 121 commsManager.AssetCache.AddAsset(asset);
122 } 122 }
123 123
124 userInfo.UpdateItem(remoteClient.AgentId, item); 124 userInfo.UpdateItem(remoteClient.AgentId, item);
125 } 125 }
126 } 126 }
127 } 127 }
128 } 128 }
129 } 129 }
130 } 130 }
131 } 131 }
132 132
133 /// <summary> 133 /// <summary>
134 /// temporary method to test out creating new inventory items 134 /// temporary method to test out creating new inventory items
135 /// </summary> 135 /// </summary>
136 /// <param name="remoteClient"></param> 136 /// <param name="remoteClient"></param>
137 /// <param name="transActionID"></param> 137 /// <param name="transActionID"></param>
138 /// <param name="folderID"></param> 138 /// <param name="folderID"></param>
139 /// <param name="callbackID"></param> 139 /// <param name="callbackID"></param>
140 /// <param name="description"></param> 140 /// <param name="description"></param>
141 /// <param name="name"></param> 141 /// <param name="name"></param>
142 /// <param name="invType"></param> 142 /// <param name="invType"></param>
143 /// <param name="type"></param> 143 /// <param name="type"></param>
144 /// <param name="wearableType"></param> 144 /// <param name="wearableType"></param>
145 /// <param name="nextOwnerMask"></param> 145 /// <param name="nextOwnerMask"></param>
146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask)
147 { 147 {
148 if (transActionID == LLUUID.Zero) 148 if (transActionID == LLUUID.Zero)
149 { 149 {
150 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 150 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
151 if (userInfo != null) 151 if (userInfo != null)
152 { 152 {
153 AssetBase asset = new AssetBase(); 153 AssetBase asset = new AssetBase();
154 asset.Name = name; 154 asset.Name = name;
155 asset.Description = description; 155 asset.Description = description;
156 asset.InvType = invType; 156 asset.InvType = invType;
157 asset.Type = type; 157 asset.Type = type;
158 asset.FullID = LLUUID.Random(); 158 asset.FullID = LLUUID.Random();
159 asset.Data = new byte[1]; 159 asset.Data = new byte[1];
160 this.commsManager.AssetCache.AddAsset(asset); 160 this.commsManager.AssetCache.AddAsset(asset);
161 161
162 InventoryItemBase item = new InventoryItemBase(); 162 InventoryItemBase item = new InventoryItemBase();
163 item.avatarID = remoteClient.AgentId; 163 item.avatarID = remoteClient.AgentId;
164 item.creatorsID = remoteClient.AgentId; 164 item.creatorsID = remoteClient.AgentId;
165 item.inventoryID = LLUUID.Random(); 165 item.inventoryID = LLUUID.Random();
166 item.assetID = asset.FullID; 166 item.assetID = asset.FullID;
167 item.inventoryDescription = description; 167 item.inventoryDescription = description;
168 item.inventoryName = name; 168 item.inventoryName = name;
169 item.assetType = invType; 169 item.assetType = invType;
170 item.invType = invType; 170 item.invType = invType;
171 item.parentFolderID = folderID; 171 item.parentFolderID = folderID;
172 item.inventoryCurrentPermissions = 2147483647; 172 item.inventoryCurrentPermissions = 2147483647;
173 item.inventoryNextPermissions = nextOwnerMask; 173 item.inventoryNextPermissions = nextOwnerMask;
174 174
175 userInfo.AddItem(remoteClient.AgentId, item); 175 userInfo.AddItem(remoteClient.AgentId, item);
176 remoteClient.SendInventoryItemUpdate(item); 176 remoteClient.SendInventoryItemUpdate(item);
177 } 177 }
178 } 178 }
179 else 179 else
180 { 180 {
181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
183 } 183 }
184 } 184 }
185 185
186 /// <summary> 186 /// <summary>
187 /// 187 ///
188 /// </summary> 188 /// </summary>
189 /// <param name="remoteClient"></param> 189 /// <param name="remoteClient"></param>
190 /// <param name="primLocalID"></param> 190 /// <param name="primLocalID"></param>
191 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) 191 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
192 { 192 {
193 bool hasPrim = false; 193 bool hasPrim = false;
194 foreach (EntityBase ent in Entities.Values) 194 foreach (EntityBase ent in Entities.Values)
195 { 195 {
196 if (ent is SceneObjectGroup) 196 if (ent is SceneObjectGroup)
197 { 197 {
198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
199 if (hasPrim != false) 199 if (hasPrim != false)
200 { 200 {
201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
202 if (fileChange) 202 if (fileChange)
203 { 203 {
204 if (this.XferManager != null) 204 if (this.XferManager != null)
205 { 205 {
206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); 206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager);
207 } 207 }
208 } 208 }
209 break; 209 break;
210 } 210 }
211 } 211 }
212 } 212 }
213 } 213 }
214 214
215 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) 215 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
216 { 216 {
217 bool hasPrim = false; 217 bool hasPrim = false;
218 foreach (EntityBase ent in Entities.Values) 218 foreach (EntityBase ent in Entities.Values)
219 { 219 {
220 if (ent is SceneObjectGroup) 220 if (ent is SceneObjectGroup)
221 { 221 {
222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
223 if (hasPrim != false) 223 if (hasPrim != false)
224 { 224 {
225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); 225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID);
226 ((SceneObjectGroup)ent).GetProperites(remoteClient); 226 ((SceneObjectGroup)ent).GetProperites(remoteClient);
227 if (type == 10) 227 if (type == 10)
228 { 228 {
229 this.EventManager.TriggerRemoveScript(localID, itemID); 229 this.EventManager.TriggerRemoveScript(localID, itemID);
230 } 230 }
231 } 231 }
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) 236 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
237 { 237 {
238 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 238 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
239 LLUUID copyID = LLUUID.Random(); 239 LLUUID copyID = LLUUID.Random();
240 if (userInfo != null) 240 if (userInfo != null)
241 { 241 {
242 if (userInfo.RootFolder != null) 242 if (userInfo.RootFolder != null)
243 { 243 {
244 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 244 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
245 if (item != null) 245 if (item != null)
246 { 246 {
247 bool isTexture = false; 247 bool isTexture = false;
248 bool rezzed = false; 248 bool rezzed = false;
249 if (item.invType == 0) 249 if (item.invType == 0)
250 { 250 {
251 isTexture = true; 251 isTexture = true;
252 } 252 }
253 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 253 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
254 if (rezAsset != null) 254 if (rezAsset != null)
255 { 255 {
256 string script = Util.FieldToString(rezAsset.Data); 256 string script = Util.FieldToString(rezAsset.Data);
257 //Console.WriteLine("rez script "+script); 257 //Console.WriteLine("rez script "+script);
258 this.EventManager.TriggerRezScript(localID, copyID, script); 258 this.EventManager.TriggerRezScript(localID, copyID, script);
259 rezzed = true; 259 rezzed = true;
260 } 260 }
261 else 261 else
262 { 262 {
263 //lets try once more incase the asset cache is being slow getting the asset from server 263 //lets try once more incase the asset cache is being slow getting the asset from server
264 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 264 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
265 if (rezAsset != null) 265 if (rezAsset != null)
266 { 266 {
267 string script = Util.FieldToString(rezAsset.Data); 267 string script = Util.FieldToString(rezAsset.Data);
268 // Console.WriteLine("rez script " + script); 268 // Console.WriteLine("rez script " + script);
269 this.EventManager.TriggerRezScript(localID, copyID, script); 269 this.EventManager.TriggerRezScript(localID, copyID, script);
270 rezzed = true; 270 rezzed = true;
271 } 271 }
272 } 272 }
273 273
274 if (rezzed) 274 if (rezzed)
275 { 275 {
276 bool hasPrim = false; 276 bool hasPrim = false;
277 foreach (EntityBase ent in Entities.Values) 277 foreach (EntityBase ent in Entities.Values)
278 { 278 {
279 if (ent is SceneObjectGroup) 279 if (ent is SceneObjectGroup)
280 { 280 {
281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
282 if (hasPrim != false) 282 if (hasPrim != false)
283 { 283 {
284 284
285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
286 ((SceneObjectGroup)ent).GetProperites(remoteClient); 286 ((SceneObjectGroup)ent).GetProperites(remoteClient);
287 } 287 }
288 } 288 }
289 } 289 }
290 } 290 }
291 } 291 }
292 } 292 }
293 } 293 }
294 } 294 }
295 295
296 /// <summary> 296 /// <summary>
297 /// 297 ///
298 /// </summary> 298 /// </summary>
299 /// <param name="packet"></param> 299 /// <param name="packet"></param>
300 /// <param name="simClient"></param> 300 /// <param name="simClient"></param>
301 public void DeRezObject(Packet packet, IClientAPI remoteClient) 301 public void DeRezObject(Packet packet, IClientAPI remoteClient)
302 { 302 {
303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
304 304
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 306 {
307 //currently following code not used (or don't know of any case of destination being zero 307 //currently following code not used (or don't know of any case of destination being zero
308 } 308 }
309 else 309 else
310 { 310 {
311 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) 311 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
312 { 312 {
313 EntityBase selectedEnt = null; 313 EntityBase selectedEnt = null;
314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
315 foreach (EntityBase ent in this.Entities.Values) 315 foreach (EntityBase ent in this.Entities.Values)
316 { 316 {
317 if (ent.LocalId == Data.ObjectLocalID) 317 if (ent.LocalId == Data.ObjectLocalID)
318 { 318 {
319 selectedEnt = ent; 319 selectedEnt = ent;
320 break; 320 break;
321 } 321 }
322 } 322 }
323 if (selectedEnt != null) 323 if (selectedEnt != null)
324 { 324 {
325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) 325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID))
326 { 326 {
327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); 327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString();
328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
329 if (userInfo != null) 329 if (userInfo != null)
330 { 330 {
331 AssetBase asset = new AssetBase(); 331 AssetBase asset = new AssetBase();
332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); 332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId);
333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); 333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
334 asset.InvType = 6; 334 asset.InvType = 6;
335 asset.Type = 6; 335 asset.Type = 6;
336 asset.FullID = LLUUID.Random(); 336 asset.FullID = LLUUID.Random();
337 asset.Data = Helpers.StringToField(sceneObjectXml); 337 asset.Data = Helpers.StringToField(sceneObjectXml);
338 commsManager.AssetCache.AddAsset(asset); 338 commsManager.AssetCache.AddAsset(asset);
339 339
340 340
341 InventoryItemBase item = new InventoryItemBase(); 341 InventoryItemBase item = new InventoryItemBase();
342 item.avatarID = remoteClient.AgentId; 342 item.avatarID = remoteClient.AgentId;
343 item.creatorsID = remoteClient.AgentId; 343 item.creatorsID = remoteClient.AgentId;
344 item.inventoryID = LLUUID.Random(); 344 item.inventoryID = LLUUID.Random();
345 item.assetID = asset.FullID; 345 item.assetID = asset.FullID;
346 item.inventoryDescription = asset.Description; 346 item.inventoryDescription = asset.Description;
347 item.inventoryName = asset.Name; 347 item.inventoryName = asset.Name;
348 item.assetType = asset.Type; 348 item.assetType = asset.Type;
349 item.invType = asset.InvType; 349 item.invType = asset.InvType;
350 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; 350 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
351 item.inventoryCurrentPermissions = 2147483647; 351 item.inventoryCurrentPermissions = 2147483647;
352 item.inventoryNextPermissions = 2147483647; 352 item.inventoryNextPermissions = 2147483647;
353 353
354 userInfo.AddItem(remoteClient.AgentId, item); 354 userInfo.AddItem(remoteClient.AgentId, item);
355 remoteClient.SendInventoryItemUpdate(item); 355 remoteClient.SendInventoryItemUpdate(item);
356 } 356 }
357 357
358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); 358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID);
359 if (rootPart.PhysActor != null) 359 if (rootPart.PhysActor != null)
360 { 360 {
361 this.phyScene.RemovePrim(rootPart.PhysActor); 361 this.phyScene.RemovePrim(rootPart.PhysActor);
362 rootPart.PhysActor = null; 362 rootPart.PhysActor = null;
363 } 363 }
364 364
365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); 365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
366 ((SceneObjectGroup)selectedEnt).DeleteGroup(); 366 ((SceneObjectGroup)selectedEnt).DeleteGroup();
367 367
368 lock (Entities) 368 lock (Entities)
369 { 369 {
370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); 370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID);
371 } 371 }
372 ((SceneObjectGroup)selectedEnt).DeleteParts(); 372 ((SceneObjectGroup)selectedEnt).DeleteParts();
373 } 373 }
374 } 374 }
375 } 375 }
376 } 376 }
377 } 377 }
378 378
379 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) 379 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
380 { 380 {
381 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 381 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
382 if (userInfo != null) 382 if (userInfo != null)
383 { 383 {
384 if (userInfo.RootFolder != null) 384 if (userInfo.RootFolder != null)
385 { 385 {
386 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 386 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
387 if (item != null) 387 if (item != null)
388 { 388 {
389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
390 if (rezAsset != null) 390 if (rezAsset != null)
391 { 391 {
392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
393 userInfo.DeleteItem(remoteClient.AgentId, item); 393 userInfo.DeleteItem(remoteClient.AgentId, item);
394 remoteClient.SendRemoveInventoryItem(itemID); 394 remoteClient.SendRemoveInventoryItem(itemID);
395 } 395 }
396 else 396 else
397 { 397 {
398 //lets try once more incase the asset cache is being slow getting the asset from server 398 //lets try once more incase the asset cache is being slow getting the asset from server
399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
400 if (rezAsset != null) 400 if (rezAsset != null)
401 { 401 {
402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
403 userInfo.DeleteItem(remoteClient.AgentId, item); 403 userInfo.DeleteItem(remoteClient.AgentId, item);
404 remoteClient.SendRemoveInventoryItem(itemID); 404 remoteClient.SendRemoveInventoryItem(itemID);
405 } 405 }
406 } 406 }
407 } 407 }
408 } 408 }
409 } 409 }
410 } 410 }
411 411
412 private void AddRezObject(string xmlData, LLVector3 pos) 412 private void AddRezObject(string xmlData, LLVector3 pos)
413 { 413 {
414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); 414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
415 this.AddEntity(group); 415 this.AddEntity(group);
416 group.AbsolutePosition = pos; 416 group.AbsolutePosition = pos;
417 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 417 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
419 rootPart.PhysActor = phyScene.AddPrim( 419 rootPart.PhysActor = phyScene.AddPrim(
420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
424 } 424 }
425 } 425 }
426 426
427} 427}
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index dfac406..4a99a80 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -1,237 +1,237 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using System; 2using System;
3using OpenSim.Framework.Console; 3using OpenSim.Framework.Console;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5 5
6namespace OpenSim.Region.Environment.Scenes 6namespace OpenSim.Region.Environment.Scenes
7{ 7{
8 public class SceneManager 8 public class SceneManager
9 { 9 {
10 private readonly List<Scene> m_localScenes; 10 private readonly List<Scene> m_localScenes;
11 private Scene m_currentScene = null; 11 private Scene m_currentScene = null;
12 public Scene CurrentScene 12 public Scene CurrentScene
13 { 13 {
14 get 14 get
15 { 15 {
16 return m_currentScene; 16 return m_currentScene;
17 } 17 }
18 } 18 }
19 19
20 private Scene CurrentOrFirstScene 20 private Scene CurrentOrFirstScene
21 { 21 {
22 get 22 get
23 { 23 {
24 if (m_currentScene == null) 24 if (m_currentScene == null)
25 { 25 {
26 return m_localScenes[0]; 26 return m_localScenes[0];
27 } 27 }
28 else 28 else
29 { 29 {
30 return m_currentScene; 30 return m_currentScene;
31 } 31 }
32 } 32 }
33 } 33 }
34 34
35 public SceneManager() 35 public SceneManager()
36 { 36 {
37 m_localScenes = new List<Scene>(); 37 m_localScenes = new List<Scene>();
38 } 38 }
39 39
40 public void Close() 40 public void Close()
41 { 41 {
42 for (int i = 0; i < m_localScenes.Count; i++) 42 for (int i = 0; i < m_localScenes.Count; i++)
43 { 43 {
44 m_localScenes[i].Close(); 44 m_localScenes[i].Close();
45 } 45 }
46 } 46 }
47 47
48 public void Add(Scene scene) 48 public void Add(Scene scene)
49 { 49 {
50 m_localScenes.Add(scene); 50 m_localScenes.Add(scene);
51 } 51 }
52 52
53 public void SavePrimsToXml(string filename) 53 public void SavePrimsToXml(string filename)
54 { 54 {
55 CurrentOrFirstScene.SavePrimsToXml(filename); 55 CurrentOrFirstScene.SavePrimsToXml(filename);
56 } 56 }
57 57
58 public void LoadPrimsFromXml(string filename) 58 public void LoadPrimsFromXml(string filename)
59 { 59 {
60 CurrentOrFirstScene.LoadPrimsFromXml(filename); 60 CurrentOrFirstScene.LoadPrimsFromXml(filename);
61 } 61 }
62 62
63 public bool RunTerrainCmd(string[] cmdparams, ref string result) 63 public bool RunTerrainCmd(string[] cmdparams, ref string result)
64 { 64 {
65 if (m_currentScene == null) 65 if (m_currentScene == null)
66 { 66 {
67 bool success = true; 67 bool success = true;
68 foreach (Scene scene in m_localScenes) 68 foreach (Scene scene in m_localScenes)
69 { 69 {
70 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) 70 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
71 { 71 {
72 success = false; 72 success = false;
73 } 73 }
74 } 74 }
75 75
76 return success; 76 return success;
77 } 77 }
78 else 78 else
79 { 79 {
80 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); 80 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
81 } 81 }
82 } 82 }
83 83
84 public void SendCommandToScripts(string[] cmdparams) 84 public void SendCommandToScripts(string[] cmdparams)
85 { 85 {
86 ForEach(delegate(Scene scene) 86 ForEach(delegate(Scene scene)
87 { 87 {
88 scene.SendCommandToScripts(cmdparams); 88 scene.SendCommandToScripts(cmdparams);
89 }); 89 });
90 } 90 }
91 91
92 public void BypassPermissions(bool bypassPermissions) 92 public void BypassPermissions(bool bypassPermissions)
93 { 93 {
94 ForEach(delegate(Scene scene) 94 ForEach(delegate(Scene scene)
95 { 95 {
96 scene.PermissionsMngr.BypassPermissions = bypassPermissions; 96 scene.PermissionsMngr.BypassPermissions = bypassPermissions;
97 }); 97 });
98 } 98 }
99 99
100 private void ForEach(Action<Scene> func) 100 private void ForEach(Action<Scene> func)
101 { 101 {
102 if (m_currentScene == null) 102 if (m_currentScene == null)
103 { 103 {
104 m_localScenes.ForEach(func); 104 m_localScenes.ForEach(func);
105 } 105 }
106 else 106 else
107 { 107 {
108 func(m_currentScene); 108 func(m_currentScene);
109 } 109 }
110 } 110 }
111 111
112 public void Backup() 112 public void Backup()
113 { 113 {
114 ForEach(delegate(Scene scene) 114 ForEach(delegate(Scene scene)
115 { 115 {
116 scene.Backup(); 116 scene.Backup();
117 }); 117 });
118 } 118 }
119 119
120 public void HandleAlertCommand(string[] cmdparams) 120 public void HandleAlertCommand(string[] cmdparams)
121 { 121 {
122 ForEach(delegate(Scene scene) 122 ForEach(delegate(Scene scene)
123 { 123 {
124 scene.HandleAlertCommand(cmdparams); 124 scene.HandleAlertCommand(cmdparams);
125 }); 125 });
126 } 126 }
127 127
128 public bool TrySetCurrentRegion(string regionName) 128 public bool TrySetCurrentRegion(string regionName)
129 { 129 {
130 if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) 130 if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
131 { 131 {
132 m_currentScene = null; 132 m_currentScene = null;
133 return true; 133 return true;
134 } 134 }
135 else 135 else
136 { 136 {
137 Console.WriteLine("Searching for Region: '" + regionName + "'"); 137 Console.WriteLine("Searching for Region: '" + regionName + "'");
138 Scene foundScene = null; 138 Scene foundScene = null;
139 139
140 foreach (Scene scene in m_localScenes) 140 foreach (Scene scene in m_localScenes)
141 { 141 {
142 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) 142 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
143 { 143 {
144 m_currentScene = scene; 144 m_currentScene = scene;
145 return true; 145 return true;
146 } 146 }
147 } 147 }
148 148
149 return false; 149 return false;
150 } 150 }
151 } 151 }
152 152
153 public void DebugPacket(LogBase log, int newDebug) 153 public void DebugPacket(LogBase log, int newDebug)
154 { 154 {
155 ForEach(delegate(Scene scene) 155 ForEach(delegate(Scene scene)
156 { 156 {
157 foreach (EntityBase entity in scene.Entities.Values) 157 foreach (EntityBase entity in scene.Entities.Values)
158 { 158 {
159 if (entity is ScenePresence) 159 if (entity is ScenePresence)
160 { 160 {
161 ScenePresence scenePrescence = entity as ScenePresence; 161 ScenePresence scenePrescence = entity as ScenePresence;
162 if (!scenePrescence.childAgent) 162 if (!scenePrescence.childAgent)
163 { 163 {
164 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 164 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
165 scenePrescence.Firstname, scenePrescence.Lastname, 165 scenePrescence.Firstname, scenePrescence.Lastname,
166 newDebug)); 166 newDebug));
167 167
168 scenePrescence.ControllingClient.SetDebug(newDebug); 168 scenePrescence.ControllingClient.SetDebug(newDebug);
169 } 169 }
170 } 170 }
171 } 171 }
172 }); 172 });
173 } 173 }
174 174
175 public List<ScenePresence> GetAvatars() 175 public List<ScenePresence> GetAvatars()
176 { 176 {
177 List<ScenePresence> avatars = new List<ScenePresence>(); 177 List<ScenePresence> avatars = new List<ScenePresence>();
178 178
179 ForEach(delegate(Scene scene) 179 ForEach(delegate(Scene scene)
180 { 180 {
181 foreach (EntityBase entity in scene.Entities.Values) 181 foreach (EntityBase entity in scene.Entities.Values)
182 { 182 {
183 if (entity is ScenePresence) 183 if (entity is ScenePresence)
184 { 184 {
185 ScenePresence scenePrescence = entity as ScenePresence; 185 ScenePresence scenePrescence = entity as ScenePresence;
186 if (!scenePrescence.childAgent) 186 if (!scenePrescence.childAgent)
187 { 187 {
188 avatars.Add(scenePrescence); 188 avatars.Add(scenePrescence);
189 } 189 }
190 } 190 }
191 } 191 }
192 }); 192 });
193 193
194 return avatars; 194 return avatars;
195 } 195 }
196 196
197 public RegionInfo GetRegionInfo(ulong regionHandle) 197 public RegionInfo GetRegionInfo(ulong regionHandle)
198 { 198 {
199 foreach (Scene scene in m_localScenes) 199 foreach (Scene scene in m_localScenes)
200 { 200 {
201 if (scene.RegionInfo.RegionHandle == regionHandle) 201 if (scene.RegionInfo.RegionHandle == regionHandle)
202 { 202 {
203 return scene.RegionInfo; 203 return scene.RegionInfo;
204 } 204 }
205 } 205 }
206 206
207 return null; 207 return null;
208 } 208 }
209 209
210 public void SetTimePhase(int timePhase) 210 public void SetTimePhase(int timePhase)
211 { 211 {
212 ForEach(delegate(Scene scene) 212 ForEach(delegate(Scene scene)
213 { 213 {
214 scene.SetTimePhase( 214 scene.SetTimePhase(
215 timePhase) 215 timePhase)
216 ; 216 ;
217 }); 217 });
218 } 218 }
219 219
220 220
221 public void ForceClientUpdate() 221 public void ForceClientUpdate()
222 { 222 {
223 ForEach(delegate(Scene scene) 223 ForEach(delegate(Scene scene)
224 { 224 {
225 scene.ForceClientUpdate(); 225 scene.ForceClientUpdate();
226 }); 226 });
227 } 227 }
228 228
229 public void HandleEditCommand(string[] cmdparams) 229 public void HandleEditCommand(string[] cmdparams)
230 { 230 {
231 ForEach(delegate(Scene scene) 231 ForEach(delegate(Scene scene)
232 { 232 {
233 scene.HandleEditCommand(cmdparams); 233 scene.HandleEditCommand(cmdparams);
234 }); 234 });
235 } 235 }
236 } 236 }
237} 237}
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
index 2f248ce..7cf9cb7 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
@@ -1,20 +1,20 @@
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.Environment.Scenes.Scripting 6namespace OpenSim.Region.Environment.Scenes.Scripting
7{ 7{
8 public interface IScriptHost 8 public interface IScriptHost
9 { 9 {
10 string Name { get; set;} 10 string Name { get; set;}
11 string SitName{ get; set;} 11 string SitName{ get; set;}
12 string TouchName { get; set;} 12 string TouchName { get; set;}
13 string Description { get; set; } 13 string Description { get; set; }
14 LLUUID UUID { get; } 14 LLUUID UUID { get; }
15 LLUUID ObjectOwner { get;} 15 LLUUID ObjectOwner { get;}
16 LLUUID ObjectCreator { get; } 16 LLUUID ObjectCreator { get; }
17 LLVector3 AbsolutePosition { get; } 17 LLVector3 AbsolutePosition { get; }
18 void SetText(string text, Axiom.Math.Vector3 color, double alpha); 18 void SetText(string text, Axiom.Math.Vector3 color, double alpha);
19 } 19 }
20} 20}
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
index 5e3dcae..875e4cb 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
@@ -1,56 +1,56 @@
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.Environment.Scenes.Scripting 6namespace OpenSim.Region.Environment.Scenes.Scripting
7{ 7{
8 public class NullScriptHost : IScriptHost 8 public class NullScriptHost : IScriptHost
9 { 9 {
10 10
11 LLVector3 m_pos = new LLVector3( 128, 128, 30 ); 11 LLVector3 m_pos = new LLVector3( 128, 128, 30 );
12 public string Name 12 public string Name
13 { 13 {
14 get { return "Object"; } 14 get { return "Object"; }
15 set { } 15 set { }
16 } 16 }
17 17
18 public string SitName 18 public string SitName
19 { 19 {
20 get { return ""; } 20 get { return ""; }
21 set { } 21 set { }
22 } 22 }
23 23
24 public string TouchName 24 public string TouchName
25 { 25 {
26 get { return ""; } 26 get { return ""; }
27 set { } 27 set { }
28 } 28 }
29 29
30 public string Description 30 public string Description
31 { 31 {
32 get { return ""; } 32 get { return ""; }
33 set { } 33 set { }
34 } 34 }
35 35
36 public LLUUID UUID 36 public LLUUID UUID
37 { 37 {
38 get { return LLUUID.Zero; } 38 get { return LLUUID.Zero; }
39 } 39 }
40 40
41 public LLUUID ObjectOwner 41 public LLUUID ObjectOwner
42 { get { return LLUUID.Zero; } } 42 { get { return LLUUID.Zero; } }
43 43
44 public LLUUID ObjectCreator { get { return LLUUID.Zero; } } 44 public LLUUID ObjectCreator { get { return LLUUID.Zero; } }
45 45
46 public LLVector3 AbsolutePosition 46 public LLVector3 AbsolutePosition
47 { 47 {
48 get { return m_pos; } 48 get { return m_pos; }
49 } 49 }
50 50
51 public void SetText(string text, Axiom.Math.Vector3 color, double alpha) 51 public void SetText(string text, Axiom.Math.Vector3 color, double alpha)
52 { 52 {
53 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); 53 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
54 } 54 }
55 } 55 }
56} 56}
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
index d3d58fe..5e8ff87 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
@@ -1,43 +1,43 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenSim.Region.Environment.Scenes.Scripting; 32using OpenSim.Region.Environment.Scenes.Scripting;
33 33
34//TODO: WHERE TO PLACE THIS? 34//TODO: WHERE TO PLACE THIS?
35namespace OpenSim.Region.Environment.Scenes.Scripting 35namespace OpenSim.Region.Environment.Scenes.Scripting
36{ 36{
37 public interface ScriptEngineInterface 37 public interface ScriptEngineInterface
38 { 38 {
39 void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); 39 void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger);
40 void Shutdown(); 40 void Shutdown();
41// void StartScript(string ScriptID, IScriptHost ObjectID); 41// void StartScript(string ScriptID, IScriptHost ObjectID);
42 } 42 }
43} 43}
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
index 3500545..83bd0ab 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
@@ -1,124 +1,124 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Text; 32using System.Text;
33using System.Reflection; 33using System.Reflection;
34 34
35namespace OpenSim.Region.Environment.Scenes.Scripting 35namespace OpenSim.Region.Environment.Scenes.Scripting
36{ 36{
37 public class ScriptEngineLoader 37 public class ScriptEngineLoader
38 { 38 {
39 private OpenSim.Framework.Console.LogBase m_log; 39 private OpenSim.Framework.Console.LogBase m_log;
40 public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger) 40 public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger)
41 { 41 {
42 m_log = logger; 42 m_log = logger;
43 } 43 }
44 44
45 public ScriptEngineInterface LoadScriptEngine(string EngineName) 45 public ScriptEngineInterface LoadScriptEngine(string EngineName)
46 { 46 {
47 ScriptEngineInterface ret = null; 47 ScriptEngineInterface ret = null;
48 try 48 try
49 { 49 {
50 ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), 50 ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
51 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); 51 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
52 } 52 }
53 catch (Exception e) 53 catch (Exception e)
54 { 54 {
55 m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); 55 m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString());
56 } 56 }
57 return ret; 57 return ret;
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
61 /// Does actual loading and initialization of script Assembly 61 /// Does actual loading and initialization of script Assembly
62 /// </summary> 62 /// </summary>
63 /// <param name="FreeAppDomain">AppDomain to load script into</param> 63 /// <param name="FreeAppDomain">AppDomain to load script into</param>
64 /// <param name="FileName">FileName of script assembly (.dll)</param> 64 /// <param name="FileName">FileName of script assembly (.dll)</param>
65 /// <returns></returns> 65 /// <returns></returns>
66 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace) 66 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
67 { 67 {
68 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); 68 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
69 // Load .Net Assembly (.dll) 69 // Load .Net Assembly (.dll)
70 // Initialize and return it 70 // Initialize and return it
71 71
72 // TODO: Add error handling 72 // TODO: Add error handling
73 73
74 Assembly a; 74 Assembly a;
75 //try 75 //try
76 //{ 76 //{
77 77
78 78
79 // Load to default appdomain (temporary) 79 // Load to default appdomain (temporary)
80 a = Assembly.LoadFrom(FileName); 80 a = Assembly.LoadFrom(FileName);
81 // Load to specified appdomain 81 // Load to specified appdomain
82 // TODO: Insert security 82 // TODO: Insert security
83 //a = FreeAppDomain.Load(FileName); 83 //a = FreeAppDomain.Load(FileName);
84 //} 84 //}
85 //catch (Exception e) 85 //catch (Exception e)
86 //{ 86 //{
87 // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString()); 87 // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString());
88 //} 88 //}
89 89
90 90
91 //Console.WriteLine("Loading: " + FileName); 91 //Console.WriteLine("Loading: " + FileName);
92 //foreach (Type _t in a.GetTypes()) 92 //foreach (Type _t in a.GetTypes())
93 //{ 93 //{
94 // Console.WriteLine("Type: " + _t.ToString()); 94 // Console.WriteLine("Type: " + _t.ToString());
95 //} 95 //}
96 96
97 Type t; 97 Type t;
98 //try 98 //try
99 //{ 99 //{
100 t = a.GetType(NameSpace, true); 100 t = a.GetType(NameSpace, true);
101 //} 101 //}
102 //catch (Exception e) 102 //catch (Exception e)
103 //{ 103 //{
104 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); 104 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
105 //} 105 //}
106 106
107 ScriptEngineInterface ret; 107 ScriptEngineInterface ret;
108 //try 108 //try
109 //{ 109 //{
110 ret = (ScriptEngineInterface)Activator.CreateInstance(t); 110 ret = (ScriptEngineInterface)Activator.CreateInstance(t);
111 //} 111 //}
112 //catch (Exception e) 112 //catch (Exception e)
113 //{ 113 //{
114 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); 114 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
115 //} 115 //}
116 116
117 return ret; 117 return ret;
118 118
119 119
120 } 120 }
121 121
122 122
123 } 123 }
124} 124}
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
index c7b0524..3b4dd9a 100644
--- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
+++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
@@ -1,167 +1,167 @@
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;
5 5
6namespace OpenSim.Region.Environment.Types 6namespace OpenSim.Region.Environment.Types
7{ 7{
8 public class BasicQuadTreeNode 8 public class BasicQuadTreeNode
9 { 9 {
10 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); 10 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
11 private BasicQuadTreeNode[] m_childNodes = null; 11 private BasicQuadTreeNode[] m_childNodes = null;
12 private BasicQuadTreeNode m_parent = null; 12 private BasicQuadTreeNode m_parent = null;
13 13
14 private short m_leftX; 14 private short m_leftX;
15 private short m_leftY; 15 private short m_leftY;
16 private short m_width; 16 private short m_width;
17 private short m_height; 17 private short m_height;
18 18
19 public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height) 19 public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height)
20 { 20 {
21 m_parent = parent; 21 m_parent = parent;
22 m_leftX = leftX; 22 m_leftX = leftX;
23 m_leftY = leftY; 23 m_leftY = leftY;
24 m_width = width; 24 m_width = width;
25 m_height = height; 25 m_height = height;
26 } 26 }
27 27
28 public void AddObject(SceneObjectGroup obj) 28 public void AddObject(SceneObjectGroup obj)
29 { 29 {
30 if (m_childNodes == null) 30 if (m_childNodes == null)
31 { 31 {
32 if (!m_objects.Contains(obj)) 32 if (!m_objects.Contains(obj))
33 { 33 {
34 m_objects.Add(obj); 34 m_objects.Add(obj);
35 } 35 }
36 } 36 }
37 else 37 else
38 { 38 {
39 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) 39 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2)))
40 { 40 {
41 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 41 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
42 { 42 {
43 m_childNodes[0].AddObject(obj); 43 m_childNodes[0].AddObject(obj);
44 } 44 }
45 else 45 else
46 { 46 {
47 m_childNodes[2].AddObject(obj); 47 m_childNodes[2].AddObject(obj);
48 } 48 }
49 } 49 }
50 else 50 else
51 { 51 {
52 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 52 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
53 { 53 {
54 m_childNodes[1].AddObject(obj); 54 m_childNodes[1].AddObject(obj);
55 } 55 }
56 else 56 else
57 { 57 {
58 m_childNodes[3].AddObject(obj); 58 m_childNodes[3].AddObject(obj);
59 } 59 }
60 } 60 }
61 } 61 }
62 } 62 }
63 63
64 public void Subdivide() 64 public void Subdivide()
65 { 65 {
66 if (m_childNodes == null) 66 if (m_childNodes == null)
67 { 67 {
68 m_childNodes = new BasicQuadTreeNode[4]; 68 m_childNodes = new BasicQuadTreeNode[4];
69 m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); 69 m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2));
70 m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2)); 70 m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2));
71 m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2)); 71 m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2));
72 m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2)); 72 m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2));
73 } 73 }
74 else 74 else
75 { 75 {
76 for (int i = 0; i < m_childNodes.Length; i++) 76 for (int i = 0; i < m_childNodes.Length; i++)
77 { 77 {
78 m_childNodes[i].Subdivide(); 78 m_childNodes[i].Subdivide();
79 } 79 }
80 } 80 }
81 } 81 }
82 82
83 public List<SceneObjectGroup> GetObjectsFrom(int x, int y) 83 public List<SceneObjectGroup> GetObjectsFrom(int x, int y)
84 { 84 {
85 if (m_childNodes == null) 85 if (m_childNodes == null)
86 { 86 {
87 return m_objects; 87 return m_objects;
88 } 88 }
89 else 89 else
90 { 90 {
91 if (x < (m_leftX + (m_width / 2))) 91 if (x < (m_leftX + (m_width / 2)))
92 { 92 {
93 if (y < (m_leftY + (m_height / 2))) 93 if (y < (m_leftY + (m_height / 2)))
94 { 94 {
95 return m_childNodes[0].GetObjectsFrom(x, y); 95 return m_childNodes[0].GetObjectsFrom(x, y);
96 } 96 }
97 else 97 else
98 { 98 {
99 return m_childNodes[2].GetObjectsFrom(x, y); 99 return m_childNodes[2].GetObjectsFrom(x, y);
100 } 100 }
101 } 101 }
102 else 102 else
103 { 103 {
104 if (y < (m_leftY + (m_height / 2))) 104 if (y < (m_leftY + (m_height / 2)))
105 { 105 {
106 return m_childNodes[1].GetObjectsFrom(x, y); 106 return m_childNodes[1].GetObjectsFrom(x, y);
107 } 107 }
108 else 108 else
109 { 109 {
110 return m_childNodes[3].GetObjectsFrom(x, y); 110 return m_childNodes[3].GetObjectsFrom(x, y);
111 } 111 }
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 public void Update() 116 public void Update()
117 { 117 {
118 if (m_childNodes != null) 118 if (m_childNodes != null)
119 { 119 {
120 for (int i = 0; i < 4; i++) 120 for (int i = 0; i < 4; i++)
121 { 121 {
122 m_childNodes[i].Update(); 122 m_childNodes[i].Update();
123 } 123 }
124 } 124 }
125 else 125 else
126 { 126 {
127 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); 127 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
128 foreach (SceneObjectGroup group in m_objects) 128 foreach (SceneObjectGroup group in m_objects)
129 { 129 {
130 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 130 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
131 { 131 {
132 //still in bounds 132 //still in bounds
133 } 133 }
134 else 134 else
135 { 135 {
136 outBounds.Add(group); 136 outBounds.Add(group);
137 } 137 }
138 } 138 }
139 139
140 foreach (SceneObjectGroup removee in outBounds) 140 foreach (SceneObjectGroup removee in outBounds)
141 { 141 {
142 m_objects.Remove(removee); 142 m_objects.Remove(removee);
143 if (m_parent != null) 143 if (m_parent != null)
144 { 144 {
145 m_parent.PassUp(removee); 145 m_parent.PassUp(removee);
146 } 146 }
147 } 147 }
148 outBounds.Clear(); 148 outBounds.Clear();
149 } 149 }
150 } 150 }
151 151
152 public void PassUp(SceneObjectGroup group) 152 public void PassUp(SceneObjectGroup group)
153 { 153 {
154 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 154 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
155 { 155 {
156 this.AddObject(group); 156 this.AddObject(group);
157 } 157 }
158 else 158 else
159 { 159 {
160 if (m_parent != null) 160 if (m_parent != null)
161 { 161 {
162 m_parent.PassUp(group); 162 m_parent.PassUp(group);
163 } 163 }
164 } 164 }
165 } 165 }
166 } 166 }
167} 167}
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index dab4258..3b7c182 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -1,54 +1,54 @@
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;
6 6
7namespace OpenSim.Region.Environment.Types 7namespace OpenSim.Region.Environment.Types
8{ 8{
9 public class UpdateQueue 9 public class UpdateQueue
10 { 10 {
11 private Queue<SceneObjectPart> m_queue; 11 private Queue<SceneObjectPart> m_queue;
12 12
13 private List<LLUUID> m_ids; 13 private List<LLUUID> m_ids;
14 14
15 public int Count 15 public int Count
16 { 16 {
17 get { return m_queue.Count; } 17 get { return m_queue.Count; }
18 } 18 }
19 19
20 public UpdateQueue() 20 public UpdateQueue()
21 { 21 {
22 m_queue = new Queue<SceneObjectPart>(); 22 m_queue = new Queue<SceneObjectPart>();
23 m_ids = new List<LLUUID>(); 23 m_ids = new List<LLUUID>();
24 } 24 }
25 25
26 public void Enqueue(SceneObjectPart part) 26 public void Enqueue(SceneObjectPart part)
27 { 27 {
28 lock (m_ids) 28 lock (m_ids)
29 { 29 {
30 if (!m_ids.Contains(part.UUID)) 30 if (!m_ids.Contains(part.UUID))
31 { 31 {
32 m_ids.Add(part.UUID); 32 m_ids.Add(part.UUID);
33 m_queue.Enqueue(part); 33 m_queue.Enqueue(part);
34 } 34 }
35 } 35 }
36 } 36 }
37 37
38 public SceneObjectPart Dequeue() 38 public SceneObjectPart Dequeue()
39 { 39 {
40 SceneObjectPart part = null; 40 SceneObjectPart part = null;
41 if (m_queue.Count > 0) 41 if (m_queue.Count > 0)
42 { 42 {
43 part = m_queue.Dequeue(); 43 part = m_queue.Dequeue();
44 lock (m_ids) 44 lock (m_ids)
45 { 45 {
46 m_ids.Remove(part.UUID); 46 m_ids.Remove(part.UUID);
47 } 47 }
48 } 48 }
49 49
50 return part; 50 return part;
51 } 51 }
52 52
53 } 53 }
54} 54}
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
index 01af4f0..50154de 100644
--- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
@@ -1,78 +1,78 @@
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 Axiom.Math; 5using Axiom.Math;
6using libsecondlife; 6using libsecondlife;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.Interfaces; 8using OpenSim.Framework.Interfaces;
9 9
10namespace SimpleApp 10namespace SimpleApp
11{ 11{
12 public class ComplexObject : SceneObjectGroup 12 public class ComplexObject : SceneObjectGroup
13 { 13 {
14 private LLQuaternion m_rotationDirection; 14 private LLQuaternion m_rotationDirection;
15 15
16 private class RotatingWheel : SceneObjectPart 16 private class RotatingWheel : SceneObjectPart
17 { 17 {
18 private LLQuaternion m_rotationDirection; 18 private LLQuaternion m_rotationDirection;
19 19
20 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) 20 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection)
21 : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition ) 21 : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition )
22 { 22 {
23 m_rotationDirection = rotationDirection; 23 m_rotationDirection = rotationDirection;
24 } 24 }
25 25
26 public override void UpdateMovement() 26 public override void UpdateMovement()
27 { 27 {
28 UpdateRotation(RotationOffset * m_rotationDirection); 28 UpdateRotation(RotationOffset * m_rotationDirection);
29 } 29 }
30 } 30 }
31 31
32 public override void UpdateMovement() 32 public override void UpdateMovement()
33 { 33 {
34 UpdateGroupRotation(GroupRotation * m_rotationDirection); 34 UpdateGroupRotation(GroupRotation * m_rotationDirection);
35 35
36 base.UpdateMovement(); 36 base.UpdateMovement();
37 } 37 }
38 38
39 39
40 40
41 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) 41 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos )
42 : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) 42 : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default )
43 { 43 {
44 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); 44 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f);
45 45
46 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0))); 46 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0)));
47 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0))); 47 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0)));
48 48
49 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f))); 49 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f)));
50 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f))); 50 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f)));
51 51
52 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f))); 52 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f)));
53 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f))); 53 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f)));
54 54
55 UpdateParentIDs(); 55 UpdateParentIDs();
56 } 56 }
57 57
58 public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient) 58 public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient)
59 { 59 {
60 m_parts.Remove(part.UUID); 60 m_parts.Remove(part.UUID);
61 remoteClient.SendKillObject(m_regionHandle, part.LocalID); 61 remoteClient.SendKillObject(m_regionHandle, part.LocalID);
62 remoteClient.AddMoney(1); 62 remoteClient.AddMoney(1);
63 remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); 63 remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero);
64 } 64 }
65 65
66 public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) 66 public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient)
67 { 67 {
68 if( m_parts.Count == 1 ) 68 if( m_parts.Count == 1 )
69 { 69 {
70 m_parts.Remove(m_rootPart.UUID); 70 m_parts.Remove(m_rootPart.UUID);
71 m_scene.RemoveEntity(this); 71 m_scene.RemoveEntity(this);
72 remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID); 72 remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID);
73 remoteClient.AddMoney(50); 73 remoteClient.AddMoney(50);
74 remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero); 74 remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero);
75 } 75 }
76 } 76 }
77 } 77 }
78} 78}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
index 1cf2989..d4b27fc 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
@@ -1,103 +1,103 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.CSharp 34namespace OpenSim.Region.ExtensionsScriptModule.CSharp
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.ClientStack.dll"); 50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); 51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
52 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll"); 52 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
53 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); 53 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
54 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); 54 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
55 compilerParams.ReferencedAssemblies.Add("System.dll"); 55 compilerParams.ReferencedAssemblies.Add("System.dll");
56 56
57 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 57 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
58 58
59 if (compilerResults.Errors.Count > 0) 59 if (compilerResults.Errors.Count > 0)
60 { 60 {
61 MainLog.Instance.Error("Compile errors"); 61 MainLog.Instance.Error("Compile errors");
62 foreach (CompilerError error in compilerResults.Errors) 62 foreach (CompilerError error in compilerResults.Errors)
63 { 63 {
64 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 64 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
65 } 65 }
66 } 66 }
67 else 67 else
68 { 68 {
69 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); 69 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>();
70 70
71 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 71 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
72 { 72 {
73 Type testInterface = pluginType.GetInterface("IScript", true); 73 Type testInterface = pluginType.GetInterface("IScript", true);
74 74
75 if (testInterface != null) 75 if (testInterface != null)
76 { 76 {
77 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 77 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
78 78
79 string scriptName = "C#/" + script.Name; 79 string scriptName = "C#/" + script.Name;
80 Console.WriteLine("Script: " + scriptName + " loaded."); 80 Console.WriteLine("Script: " + scriptName + " loaded.");
81 81
82 if (!scripts.ContainsKey(scriptName)) 82 if (!scripts.ContainsKey(scriptName))
83 { 83 {
84 scripts.Add(scriptName, script); 84 scripts.Add(scriptName, script);
85 } 85 }
86 else 86 else
87 { 87 {
88 scripts[scriptName] = script; 88 scripts[scriptName] = script;
89 } 89 }
90 } 90 }
91 } 91 }
92 return scripts; 92 return scripts;
93 } 93 }
94 return null; 94 return null;
95 } 95 }
96 96
97 public Dictionary<string,IScript> compile(string filename) 97 public Dictionary<string,IScript> compile(string filename)
98 { 98 {
99 CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); 99 CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
100 return LoadDotNetScript(csharpProvider, filename); 100 return LoadDotNetScript(csharpProvider, filename);
101 } 101 }
102 } 102 }
103} 103}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
index 90d3438..466a902 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
@@ -1,72 +1,72 @@
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.ExtensionsScriptModule.CSharp.Examples 9namespace OpenSim.Region.ExtensionsScriptModule.CSharp.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 Name 15 public string Name
16 { 16 {
17 get { return "LSL Export Script 0.1"; } 17 get { 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.SceneObjectPart prim) 54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart 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 LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); 59 LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w);
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 return ""; 69 return "";
70 } 70 }
71 } 71 }
72} \ No newline at end of file 72} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
index 4750848..4bde721 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
@@ -1,103 +1,103 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JScript 34namespace OpenSim.Region.ExtensionsScriptModule.JScript
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.ClientStack.dll"); 50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); 51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
52 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll"); 52 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
53 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); 53 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
54 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); 54 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
55 compilerParams.ReferencedAssemblies.Add("System.dll"); 55 compilerParams.ReferencedAssemblies.Add("System.dll");
56 56
57 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 57 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
58 58
59 if (compilerResults.Errors.Count > 0) 59 if (compilerResults.Errors.Count > 0)
60 { 60 {
61 MainLog.Instance.Error("Compile errors"); 61 MainLog.Instance.Error("Compile errors");
62 foreach (CompilerError error in compilerResults.Errors) 62 foreach (CompilerError error in compilerResults.Errors)
63 { 63 {
64 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 64 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
65 } 65 }
66 } 66 }
67 else 67 else
68 { 68 {
69 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); 69 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
70 70
71 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 71 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
72 { 72 {
73 Type testInterface = pluginType.GetInterface("IScript", true); 73 Type testInterface = pluginType.GetInterface("IScript", true);
74 74
75 if (testInterface != null) 75 if (testInterface != null)
76 { 76 {
77 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 77 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
78 78
79 string scriptName = "JS.NET/" + script.Name; 79 string scriptName = "JS.NET/" + script.Name;
80 Console.WriteLine("Script: " + scriptName + " loaded."); 80 Console.WriteLine("Script: " + scriptName + " loaded.");
81 81
82 if (!scripts.ContainsKey(scriptName)) 82 if (!scripts.ContainsKey(scriptName))
83 { 83 {
84 scripts.Add(scriptName, script); 84 scripts.Add(scriptName, script);
85 } 85 }
86 else 86 else
87 { 87 {
88 scripts[scriptName] = script; 88 scripts[scriptName] = script;
89 } 89 }
90 } 90 }
91 } 91 }
92 return scripts; 92 return scripts;
93 } 93 }
94 return null; 94 return null;
95 } 95 }
96 96
97 public Dictionary<string, IScript> compile(string filename) 97 public Dictionary<string, IScript> compile(string filename)
98 { 98 {
99 JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); 99 JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
100 return LoadDotNetScript(jscriptProvider, filename); 100 return LoadDotNetScript(jscriptProvider, filename);
101 } 101 }
102 } 102 }
103} 103}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
index a4b940d..6100c67 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32 32
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
34{ 34{
35 public class ClassInstance : Object 35 public class ClassInstance : Object
36 { 36 {
37 public int Size; 37 public int Size;
38 public ClassRecord ClassRec; 38 public ClassRecord ClassRec;
39 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); 39 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
40 40
41 public ClassInstance() 41 public ClassInstance()
42 { 42 {
43 43
44 } 44 }
45 } 45 }
46} 46}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
index 348a452..5c3629c 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
@@ -1,640 +1,640 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.Types; 32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
33using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 33using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
34 34
35namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 35namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
36{ 36{
37 public class ClassRecord 37 public class ClassRecord
38 { 38 {
39 private ushort m_majorVersion; 39 private ushort m_majorVersion;
40 private ushort m_minorVersion; 40 private ushort m_minorVersion;
41 private ushort m_constantPoolCount; 41 private ushort m_constantPoolCount;
42 private ushort m_accessFlags; 42 private ushort m_accessFlags;
43 private ushort m_thisClass; 43 private ushort m_thisClass;
44 private ushort m_supperClass; 44 private ushort m_supperClass;
45 private ushort m_interfaceCount; 45 private ushort m_interfaceCount;
46 private ushort m_fieldCount; 46 private ushort m_fieldCount;
47 private ushort m_methodCount; 47 private ushort m_methodCount;
48 //private ushort _attributeCount; 48 //private ushort _attributeCount;
49 //private string _name; 49 //private string _name;
50 public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); 50 public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>();
51 public PoolClass MClass; 51 public PoolClass MClass;
52 52
53 public List<PoolItem> m_constantsPool = new List<PoolItem>(); 53 public List<PoolItem> m_constantsPool = new List<PoolItem>();
54 private List<MethodInfo> m_methodsList = new List<MethodInfo>(); 54 private List<MethodInfo> m_methodsList = new List<MethodInfo>();
55 private List<FieldInfo> m_fieldList = new List<FieldInfo>(); 55 private List<FieldInfo> m_fieldList = new List<FieldInfo>();
56 56
57 public ClassRecord() 57 public ClassRecord()
58 { 58 {
59 59
60 } 60 }
61 61
62 public ClassInstance CreateNewInstance() 62 public ClassInstance CreateNewInstance()
63 { 63 {
64 ClassInstance classInst = new ClassInstance(); 64 ClassInstance classInst = new ClassInstance();
65 classInst.ClassRec = this; 65 classInst.ClassRec = this;
66 //TODO: set fields 66 //TODO: set fields
67 67
68 return classInst; 68 return classInst;
69 } 69 }
70 70
71 public void LoadClassFromFile(string fileName) 71 public void LoadClassFromFile(string fileName)
72 { 72 {
73 Console.WriteLine("loading script " + fileName); 73 Console.WriteLine("loading script " + fileName);
74 FileStream fs = File.OpenRead(fileName); 74 FileStream fs = File.OpenRead(fileName);
75 this.LoadClassFromBytes(ReadFully(fs)); 75 this.LoadClassFromBytes(ReadFully(fs));
76 fs.Close(); 76 fs.Close();
77 } 77 }
78 78
79 public void LoadClassFromBytes(byte[] data) 79 public void LoadClassFromBytes(byte[] data)
80 { 80 {
81 int i = 0; 81 int i = 0;
82 i += 4; 82 i += 4;
83 m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); 83 m_minorVersion = (ushort)((data[i++] << 8) + data[i++]);
84 m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); 84 m_majorVersion = (ushort)((data[i++] << 8) + data[i++]);
85 m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); 85 m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]);
86 Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); 86 Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool");
87 for (int count = 0; count < (m_constantPoolCount - 1); count++) 87 for (int count = 0; count < (m_constantPoolCount - 1); count++)
88 { 88 {
89 //read in the constant pool 89 //read in the constant pool
90 byte pooltype = data[i++]; 90 byte pooltype = data[i++];
91 Console.WriteLine("#" + count + ": new constant type = " + pooltype); 91 Console.WriteLine("#" + count + ": new constant type = " + pooltype);
92 //Console.WriteLine("start position is: " + i); 92 //Console.WriteLine("start position is: " + i);
93 switch (pooltype) 93 switch (pooltype)
94 { 94 {
95 case 1: //Utf8 95 case 1: //Utf8
96 ushort uLength = (ushort)((data[i++] << 8) + data[i++]); 96 ushort uLength = (ushort)((data[i++] << 8) + data[i++]);
97 97
98 // Console.WriteLine("new utf8 type, length is " + uLength); 98 // Console.WriteLine("new utf8 type, length is " + uLength);
99 PoolUtf8 utf8 = new PoolUtf8(); 99 PoolUtf8 utf8 = new PoolUtf8();
100 utf8.readValue(data, ref i, uLength); 100 utf8.readValue(data, ref i, uLength);
101 this.m_constantsPool.Add(utf8); 101 this.m_constantsPool.Add(utf8);
102 break; 102 break;
103 case 3: //Int 103 case 3: //Int
104 break; 104 break;
105 case 4: //Float 105 case 4: //Float
106 break; 106 break;
107 case 7: //Class 107 case 7: //Class
108 PoolClass pClass = new PoolClass(this); 108 PoolClass pClass = new PoolClass(this);
109 pClass.readValue(data, ref i); 109 pClass.readValue(data, ref i);
110 this.m_constantsPool.Add(pClass); 110 this.m_constantsPool.Add(pClass);
111 break; 111 break;
112 case 9: //FieldRef 112 case 9: //FieldRef
113 PoolFieldRef pField = new PoolFieldRef(this); 113 PoolFieldRef pField = new PoolFieldRef(this);
114 pField.readValue(data, ref i); 114 pField.readValue(data, ref i);
115 this.m_constantsPool.Add(pField); 115 this.m_constantsPool.Add(pField);
116 break; 116 break;
117 case 10: //Method 117 case 10: //Method
118 PoolMethodRef pMeth = new PoolMethodRef(this); 118 PoolMethodRef pMeth = new PoolMethodRef(this);
119 pMeth.readValue(data, ref i); 119 pMeth.readValue(data, ref i);
120 this.m_constantsPool.Add(pMeth); 120 this.m_constantsPool.Add(pMeth);
121 break; 121 break;
122 case 12: //NamedType 122 case 12: //NamedType
123 PoolNamedType pNamed = new PoolNamedType(this); 123 PoolNamedType pNamed = new PoolNamedType(this);
124 pNamed.readValue(data, ref i); 124 pNamed.readValue(data, ref i);
125 this.m_constantsPool.Add(pNamed); 125 this.m_constantsPool.Add(pNamed);
126 break; 126 break;
127 } 127 }
128 } 128 }
129 129
130 m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); 130 m_accessFlags = (ushort)((data[i++] << 8) + data[i++]);
131 m_thisClass = (ushort)((data[i++] << 8) + data[i++]); 131 m_thisClass = (ushort)((data[i++] << 8) + data[i++]);
132 m_supperClass = (ushort)((data[i++] << 8) + data[i++]); 132 m_supperClass = (ushort)((data[i++] << 8) + data[i++]);
133 133
134 if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) 134 if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass)
135 { 135 {
136 this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); 136 this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]);
137 } 137 }
138 138
139 m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); 139 m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]);
140 //should now read in the info for each interface 140 //should now read in the info for each interface
141 141
142 m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); 142 m_fieldCount = (ushort)((data[i++] << 8) + data[i++]);
143 //should now read in the info for each field 143 //should now read in the info for each field
144 for (int count = 0; count < m_fieldCount; count++) 144 for (int count = 0; count < m_fieldCount; count++)
145 { 145 {
146 FieldInfo fieldInf = new FieldInfo(this); 146 FieldInfo fieldInf = new FieldInfo(this);
147 fieldInf.ReadData(data, ref i); 147 fieldInf.ReadData(data, ref i);
148 this.m_fieldList.Add(fieldInf); 148 this.m_fieldList.Add(fieldInf);
149 } 149 }
150 150
151 m_methodCount = (ushort)((data[i++] << 8) + data[i++]); 151 m_methodCount = (ushort)((data[i++] << 8) + data[i++]);
152 for (int count = 0; count < m_methodCount; count++) 152 for (int count = 0; count < m_methodCount; count++)
153 { 153 {
154 MethodInfo methInf = new MethodInfo(this); 154 MethodInfo methInf = new MethodInfo(this);
155 methInf.ReadData(data, ref i); 155 methInf.ReadData(data, ref i);
156 this.m_methodsList.Add(methInf); 156 this.m_methodsList.Add(methInf);
157 } 157 }
158 } 158 }
159 159
160 public void AddMethodsToMemory(MethodMemory memory) 160 public void AddMethodsToMemory(MethodMemory memory)
161 { 161 {
162 for (int count = 0; count < m_methodCount; count++) 162 for (int count = 0; count < m_methodCount; count++)
163 { 163 {
164 this.m_methodsList[count].AddMethodCode(memory); 164 this.m_methodsList[count].AddMethodCode(memory);
165 } 165 }
166 } 166 }
167 167
168 public bool StartMethod(Thread thread, string methodName) 168 public bool StartMethod(Thread thread, string methodName)
169 { 169 {
170 for (int count = 0; count < m_methodCount; count++) 170 for (int count = 0; count < m_methodCount; count++)
171 { 171 {
172 if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) 172 if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8)
173 { 173 {
174 if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) 174 if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName)
175 { 175 {
176 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); 176 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
177 thread.SetPC(this.m_methodsList[count].CodePointer); 177 thread.SetPC(this.m_methodsList[count].CodePointer);
178 return true; 178 return true;
179 } 179 }
180 } 180 }
181 } 181 }
182 return false; 182 return false;
183 } 183 }
184 184
185 public void PrintToConsole() 185 public void PrintToConsole()
186 { 186 {
187 Console.WriteLine("Class File:"); 187 Console.WriteLine("Class File:");
188 Console.WriteLine("Major version: " + m_majorVersion); 188 Console.WriteLine("Major version: " + m_majorVersion);
189 Console.WriteLine("Minor version: " + m_minorVersion); 189 Console.WriteLine("Minor version: " + m_minorVersion);
190 Console.WriteLine("Pool size: " + m_constantPoolCount); 190 Console.WriteLine("Pool size: " + m_constantPoolCount);
191 191
192 for (int i = 0; i < m_constantsPool.Count; i++) 192 for (int i = 0; i < m_constantsPool.Count; i++)
193 { 193 {
194 this.m_constantsPool[i].Print(); 194 this.m_constantsPool[i].Print();
195 } 195 }
196 196
197 Console.WriteLine("Access flags: " + m_accessFlags); 197 Console.WriteLine("Access flags: " + m_accessFlags);
198 Console.WriteLine("This class: " + m_thisClass); 198 Console.WriteLine("This class: " + m_thisClass);
199 Console.WriteLine("Super class: " + m_supperClass); 199 Console.WriteLine("Super class: " + m_supperClass);
200 200
201 for (int count = 0; count < m_fieldCount; count++) 201 for (int count = 0; count < m_fieldCount; count++)
202 { 202 {
203 Console.WriteLine(); 203 Console.WriteLine();
204 this.m_fieldList[count].Print(); 204 this.m_fieldList[count].Print();
205 } 205 }
206 206
207 for (int count = 0; count < m_methodCount; count++) 207 for (int count = 0; count < m_methodCount; count++)
208 { 208 {
209 Console.WriteLine(); 209 Console.WriteLine();
210 this.m_methodsList[count].Print(); 210 this.m_methodsList[count].Print();
211 } 211 }
212 212
213 Console.WriteLine("class name is " + this.MClass.Name.Value); 213 Console.WriteLine("class name is " + this.MClass.Name.Value);
214 } 214 }
215 215
216 public static byte[] ReadFully(Stream stream) 216 public static byte[] ReadFully(Stream stream)
217 { 217 {
218 byte[] buffer = new byte[1024]; 218 byte[] buffer = new byte[1024];
219 using (MemoryStream ms = new MemoryStream()) 219 using (MemoryStream ms = new MemoryStream())
220 { 220 {
221 while (true) 221 while (true)
222 { 222 {
223 int read = stream.Read(buffer, 0, buffer.Length); 223 int read = stream.Read(buffer, 0, buffer.Length);
224 if (read <= 0) 224 if (read <= 0)
225 return ms.ToArray(); 225 return ms.ToArray();
226 ms.Write(buffer, 0, read); 226 ms.Write(buffer, 0, read);
227 } 227 }
228 } 228 }
229 } 229 }
230 230
231 #region nested classes 231 #region nested classes
232 public class PoolItem 232 public class PoolItem
233 { 233 {
234 public virtual void Print() 234 public virtual void Print()
235 { 235 {
236 236
237 } 237 }
238 } 238 }
239 239
240 public class PoolUtf8 : PoolItem 240 public class PoolUtf8 : PoolItem
241 { 241 {
242 public string Value = ""; 242 public string Value = "";
243 243
244 public void readValue(byte[] data, ref int pointer, int length) 244 public void readValue(byte[] data, ref int pointer, int length)
245 { 245 {
246 for (int i = 0; i < length; i++) 246 for (int i = 0; i < length; i++)
247 { 247 {
248 int a = (int)data[pointer++]; 248 int a = (int)data[pointer++];
249 if ((a & 0x80) == 0) 249 if ((a & 0x80) == 0)
250 { 250 {
251 Value = Value + (char)a; 251 Value = Value + (char)a;
252 } 252 }
253 else if ((a & 0x20) == 0) 253 else if ((a & 0x20) == 0)
254 { 254 {
255 int b = (int)data[pointer++]; 255 int b = (int)data[pointer++];
256 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); 256 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f));
257 } 257 }
258 else 258 else
259 { 259 {
260 int b = (int)data[pointer++]; 260 int b = (int)data[pointer++];
261 int c = (int)data[pointer++]; 261 int c = (int)data[pointer++];
262 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); 262 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f));
263 } 263 }
264 } 264 }
265 } 265 }
266 266
267 public override void Print() 267 public override void Print()
268 { 268 {
269 Console.WriteLine("Utf8 type: " + Value); 269 Console.WriteLine("Utf8 type: " + Value);
270 } 270 }
271 } 271 }
272 272
273 private class PoolInt : PoolItem 273 private class PoolInt : PoolItem
274 { 274 {
275 275
276 } 276 }
277 277
278 public class PoolClass : PoolItem 278 public class PoolClass : PoolItem
279 { 279 {
280 //public string name = ""; 280 //public string name = "";
281 public ushort namePointer = 0; 281 public ushort namePointer = 0;
282 private ClassRecord parent; 282 private ClassRecord parent;
283 public PoolUtf8 Name; 283 public PoolUtf8 Name;
284 284
285 public PoolClass(ClassRecord paren) 285 public PoolClass(ClassRecord paren)
286 { 286 {
287 parent = paren; 287 parent = paren;
288 } 288 }
289 289
290 public void readValue(byte[] data, ref int pointer) 290 public void readValue(byte[] data, ref int pointer)
291 { 291 {
292 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 292 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
293 } 293 }
294 294
295 public override void Print() 295 public override void Print()
296 { 296 {
297 this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); 297 this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]);
298 Console.Write("Class type: " + namePointer); 298 Console.Write("Class type: " + namePointer);
299 Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); 299 Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value);
300 300
301 } 301 }
302 } 302 }
303 303
304 public class PoolFieldRef : PoolItem 304 public class PoolFieldRef : PoolItem
305 { 305 {
306 public ushort classPointer = 0; 306 public ushort classPointer = 0;
307 public ushort nameTypePointer = 0; 307 public ushort nameTypePointer = 0;
308 public PoolNamedType mNameType; 308 public PoolNamedType mNameType;
309 public PoolClass mClass; 309 public PoolClass mClass;
310 private ClassRecord parent; 310 private ClassRecord parent;
311 311
312 public PoolFieldRef(ClassRecord paren) 312 public PoolFieldRef(ClassRecord paren)
313 { 313 {
314 parent = paren; 314 parent = paren;
315 } 315 }
316 316
317 public void readValue(byte[] data, ref int pointer) 317 public void readValue(byte[] data, ref int pointer)
318 { 318 {
319 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 319 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
320 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 320 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
321 } 321 }
322 322
323 public override void Print() 323 public override void Print()
324 { 324 {
325 this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); 325 this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]);
326 this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); 326 this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]);
327 Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); 327 Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer);
328 } 328 }
329 } 329 }
330 330
331 public class PoolMethodRef : PoolItem 331 public class PoolMethodRef : PoolItem
332 { 332 {
333 public ushort classPointer = 0; 333 public ushort classPointer = 0;
334 public ushort nameTypePointer = 0; 334 public ushort nameTypePointer = 0;
335 public PoolNamedType mNameType; 335 public PoolNamedType mNameType;
336 public PoolClass mClass; 336 public PoolClass mClass;
337 private ClassRecord parent; 337 private ClassRecord parent;
338 338
339 public PoolMethodRef(ClassRecord paren) 339 public PoolMethodRef(ClassRecord paren)
340 { 340 {
341 parent = paren; 341 parent = paren;
342 } 342 }
343 343
344 public void readValue(byte[] data, ref int pointer) 344 public void readValue(byte[] data, ref int pointer)
345 { 345 {
346 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 346 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
347 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 347 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
348 } 348 }
349 349
350 public override void Print() 350 public override void Print()
351 { 351 {
352 this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); 352 this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]);
353 this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); 353 this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]);
354 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); 354 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
355 } 355 }
356 } 356 }
357 357
358 public class PoolNamedType : PoolItem 358 public class PoolNamedType : PoolItem
359 { 359 {
360 public ushort namePointer = 0; 360 public ushort namePointer = 0;
361 public ushort typePointer = 0; 361 public ushort typePointer = 0;
362 private ClassRecord parent; 362 private ClassRecord parent;
363 public PoolUtf8 Name; 363 public PoolUtf8 Name;
364 public PoolUtf8 Type; 364 public PoolUtf8 Type;
365 365
366 public PoolNamedType(ClassRecord paren) 366 public PoolNamedType(ClassRecord paren)
367 { 367 {
368 parent = paren; 368 parent = paren;
369 } 369 }
370 370
371 public void readValue(byte[] data, ref int pointer) 371 public void readValue(byte[] data, ref int pointer)
372 { 372 {
373 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 373 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
374 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 374 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
375 } 375 }
376 376
377 public override void Print() 377 public override void Print()
378 { 378 {
379 Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); 379 Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]);
380 Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); 380 Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]);
381 Console.Write("Named type: " + namePointer + " , " + typePointer); 381 Console.Write("Named type: " + namePointer + " , " + typePointer);
382 Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); 382 Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value);
383 } 383 }
384 } 384 }
385 385
386 //*********************** 386 //***********************
387 public class MethodInfo 387 public class MethodInfo
388 { 388 {
389 public ushort AccessFlags = 0; 389 public ushort AccessFlags = 0;
390 public ushort NameIndex = 0; 390 public ushort NameIndex = 0;
391 public string Name = ""; 391 public string Name = "";
392 public ushort DescriptorIndex = 0; 392 public ushort DescriptorIndex = 0;
393 public ushort AttributeCount = 0; 393 public ushort AttributeCount = 0;
394 public List<MethodAttribute> Attributes = new List<MethodAttribute>(); 394 public List<MethodAttribute> Attributes = new List<MethodAttribute>();
395 private ClassRecord parent; 395 private ClassRecord parent;
396 public int CodePointer = 0; 396 public int CodePointer = 0;
397 397
398 public MethodInfo(ClassRecord paren) 398 public MethodInfo(ClassRecord paren)
399 { 399 {
400 parent = paren; 400 parent = paren;
401 } 401 }
402 402
403 public void AddMethodCode(MethodMemory memory) 403 public void AddMethodCode(MethodMemory memory)
404 { 404 {
405 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); 405 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length);
406 memory.Methodcount++; 406 memory.Methodcount++;
407 this.CodePointer = memory.NextMethodPC; 407 this.CodePointer = memory.NextMethodPC;
408 memory.NextMethodPC += this.Attributes[0].Code.Length; 408 memory.NextMethodPC += this.Attributes[0].Code.Length;
409 } 409 }
410 410
411 public void ReadData(byte[] data, ref int pointer) 411 public void ReadData(byte[] data, ref int pointer)
412 { 412 {
413 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); 413 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]);
414 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 414 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
415 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 415 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
416 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 416 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
417 for (int i = 0; i < AttributeCount; i++) 417 for (int i = 0; i < AttributeCount; i++)
418 { 418 {
419 MethodAttribute attri = new MethodAttribute(this.parent); 419 MethodAttribute attri = new MethodAttribute(this.parent);
420 attri.ReadData(data, ref pointer); 420 attri.ReadData(data, ref pointer);
421 this.Attributes.Add(attri); 421 this.Attributes.Add(attri);
422 } 422 }
423 } 423 }
424 424
425 public void Print() 425 public void Print()
426 { 426 {
427 Console.WriteLine("Method Info Struct: "); 427 Console.WriteLine("Method Info Struct: ");
428 Console.WriteLine("AccessFlags: " + AccessFlags); 428 Console.WriteLine("AccessFlags: " + AccessFlags);
429 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 429 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
430 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); 430 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value);
431 Console.WriteLine("Attribute Count:" + AttributeCount); 431 Console.WriteLine("Attribute Count:" + AttributeCount);
432 for (int i = 0; i < AttributeCount; i++) 432 for (int i = 0; i < AttributeCount; i++)
433 { 433 {
434 this.Attributes[i].Print(); 434 this.Attributes[i].Print();
435 } 435 }
436 } 436 }
437 437
438 public class MethodAttribute 438 public class MethodAttribute
439 { 439 {
440 public ushort NameIndex = 0; 440 public ushort NameIndex = 0;
441 public string Name = ""; 441 public string Name = "";
442 public Int32 Length = 0; 442 public Int32 Length = 0;
443 //for now only support code attribute 443 //for now only support code attribute
444 public ushort MaxStack = 0; 444 public ushort MaxStack = 0;
445 public ushort MaxLocals = 0; 445 public ushort MaxLocals = 0;
446 public Int32 CodeLength = 0; 446 public Int32 CodeLength = 0;
447 public byte[] Code; 447 public byte[] Code;
448 public ushort ExceptionTableLength = 0; 448 public ushort ExceptionTableLength = 0;
449 public ushort SubAttributeCount = 0; 449 public ushort SubAttributeCount = 0;
450 public List<SubAttribute> SubAttributes = new List<SubAttribute>(); 450 public List<SubAttribute> SubAttributes = new List<SubAttribute>();
451 private ClassRecord parent; 451 private ClassRecord parent;
452 452
453 public MethodAttribute(ClassRecord paren) 453 public MethodAttribute(ClassRecord paren)
454 { 454 {
455 parent = paren; 455 parent = paren;
456 } 456 }
457 457
458 public void ReadData(byte[] data, ref int pointer) 458 public void ReadData(byte[] data, ref int pointer)
459 { 459 {
460 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 460 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
461 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 461 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
462 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); 462 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]);
463 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); 463 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]);
464 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 464 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
465 Code = new byte[CodeLength]; 465 Code = new byte[CodeLength];
466 for (int i = 0; i < CodeLength; i++) 466 for (int i = 0; i < CodeLength; i++)
467 { 467 {
468 Code[i] = data[pointer++]; 468 Code[i] = data[pointer++];
469 } 469 }
470 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); 470 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]);
471 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 471 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
472 for (int i = 0; i < SubAttributeCount; i++) 472 for (int i = 0; i < SubAttributeCount; i++)
473 { 473 {
474 SubAttribute subAttri = new SubAttribute(this.parent); 474 SubAttribute subAttri = new SubAttribute(this.parent);
475 subAttri.ReadData(data, ref pointer); 475 subAttri.ReadData(data, ref pointer);
476 this.SubAttributes.Add(subAttri); 476 this.SubAttributes.Add(subAttri);
477 } 477 }
478 } 478 }
479 479
480 public void Print() 480 public void Print()
481 { 481 {
482 Console.WriteLine("Method Attribute: "); 482 Console.WriteLine("Method Attribute: ");
483 Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 483 Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
484 Console.WriteLine("Length: " + Length); 484 Console.WriteLine("Length: " + Length);
485 Console.WriteLine("MaxStack: " + MaxStack); 485 Console.WriteLine("MaxStack: " + MaxStack);
486 Console.WriteLine("MaxLocals: " + MaxLocals); 486 Console.WriteLine("MaxLocals: " + MaxLocals);
487 Console.WriteLine("CodeLength: " + CodeLength); 487 Console.WriteLine("CodeLength: " + CodeLength);
488 for (int i = 0; i < Code.Length; i++) 488 for (int i = 0; i < Code.Length; i++)
489 { 489 {
490 Console.WriteLine("OpCode #" + i + " is: " + Code[i]); 490 Console.WriteLine("OpCode #" + i + " is: " + Code[i]);
491 } 491 }
492 Console.WriteLine("SubAttributes: " + SubAttributeCount); 492 Console.WriteLine("SubAttributes: " + SubAttributeCount);
493 for (int i = 0; i < SubAttributeCount; i++) 493 for (int i = 0; i < SubAttributeCount; i++)
494 { 494 {
495 this.SubAttributes[i].Print(); 495 this.SubAttributes[i].Print();
496 } 496 }
497 } 497 }
498 498
499 public class SubAttribute 499 public class SubAttribute
500 { 500 {
501 public ushort NameIndex = 0; 501 public ushort NameIndex = 0;
502 public string Name = ""; 502 public string Name = "";
503 public Int32 Length = 0; 503 public Int32 Length = 0;
504 public byte[] Data; 504 public byte[] Data;
505 private ClassRecord parent; 505 private ClassRecord parent;
506 506
507 public SubAttribute(ClassRecord paren) 507 public SubAttribute(ClassRecord paren)
508 { 508 {
509 parent = paren; 509 parent = paren;
510 } 510 }
511 511
512 public void ReadData(byte[] data, ref int pointer) 512 public void ReadData(byte[] data, ref int pointer)
513 { 513 {
514 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 514 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
515 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 515 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
516 Data = new byte[Length]; 516 Data = new byte[Length];
517 for (int i = 0; i < Length; i++) 517 for (int i = 0; i < Length; i++)
518 { 518 {
519 Data[i] = data[pointer++]; 519 Data[i] = data[pointer++];
520 } 520 }
521 } 521 }
522 522
523 public void Print() 523 public void Print()
524 { 524 {
525 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 525 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
526 } 526 }
527 527
528 } 528 }
529 } 529 }
530 530
531 } 531 }
532 private class InterfaceInfo 532 private class InterfaceInfo
533 { 533 {
534 public void ReadData(byte[] data, ref int i) 534 public void ReadData(byte[] data, ref int i)
535 { 535 {
536 536
537 } 537 }
538 } 538 }
539 539
540 public class FieldInfo 540 public class FieldInfo
541 { 541 {
542 public ushort AccessFlags = 0; 542 public ushort AccessFlags = 0;
543 public ushort NameIndex = 0; 543 public ushort NameIndex = 0;
544 public string Name = ""; 544 public string Name = "";
545 public ushort DescriptorIndex = 0; 545 public ushort DescriptorIndex = 0;
546 public ushort AttributeCount = 0; 546 public ushort AttributeCount = 0;
547 public List<FieldAttribute> Attributes = new List<FieldAttribute>(); 547 public List<FieldAttribute> Attributes = new List<FieldAttribute>();
548 private ClassRecord parent; 548 private ClassRecord parent;
549 549
550 public FieldInfo(ClassRecord paren) 550 public FieldInfo(ClassRecord paren)
551 { 551 {
552 parent = paren; 552 parent = paren;
553 } 553 }
554 554
555 public void ReadData(byte[] data, ref int pointer) 555 public void ReadData(byte[] data, ref int pointer)
556 { 556 {
557 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); 557 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]);
558 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 558 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
559 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 559 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
560 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 560 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
561 for (int i = 0; i < AttributeCount; i++) 561 for (int i = 0; i < AttributeCount; i++)
562 { 562 {
563 FieldAttribute attri = new FieldAttribute(this.parent); 563 FieldAttribute attri = new FieldAttribute(this.parent);
564 attri.ReadData(data, ref pointer); 564 attri.ReadData(data, ref pointer);
565 this.Attributes.Add(attri); 565 this.Attributes.Add(attri);
566 } 566 }
567 } 567 }
568 568
569 public void Print() 569 public void Print()
570 { 570 {
571 Console.WriteLine("Field Info Struct: "); 571 Console.WriteLine("Field Info Struct: ");
572 Console.WriteLine("AccessFlags: " + AccessFlags); 572 Console.WriteLine("AccessFlags: " + AccessFlags);
573 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 573 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
574 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); 574 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value);
575 Console.WriteLine("Attribute Count:" + AttributeCount); 575 Console.WriteLine("Attribute Count:" + AttributeCount);
576 //if static, add to static field list 576 //if static, add to static field list
577 // if (this.AccessFlags == 9) //public and static 577 // if (this.AccessFlags == 9) //public and static
578 if ((this.AccessFlags & 0x08) != 0) 578 if ((this.AccessFlags & 0x08) != 0)
579 { 579 {
580 switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) 580 switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value)
581 { 581 {
582 case "I": 582 case "I":
583 Int newin = new Int(); 583 Int newin = new Int();
584 this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); 584 this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin);
585 break; 585 break;
586 case "F": 586 case "F":
587 Float newfl = new Float(); 587 Float newfl = new Float();
588 this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); 588 this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl);
589 break; 589 break;
590 } 590 }
591 591
592 } 592 }
593 for (int i = 0; i < AttributeCount; i++) 593 for (int i = 0; i < AttributeCount; i++)
594 { 594 {
595 this.Attributes[i].Print(); 595 this.Attributes[i].Print();
596 } 596 }
597 } 597 }
598 598
599 public class FieldAttribute 599 public class FieldAttribute
600 { 600 {
601 public ushort NameIndex = 0; 601 public ushort NameIndex = 0;
602 public string Name = ""; 602 public string Name = "";
603 public Int32 Length = 0; 603 public Int32 Length = 0;
604 public byte[] Data; 604 public byte[] Data;
605 private ClassRecord parent; 605 private ClassRecord parent;
606 606
607 public FieldAttribute(ClassRecord paren) 607 public FieldAttribute(ClassRecord paren)
608 { 608 {
609 parent = paren; 609 parent = paren;
610 } 610 }
611 611
612 public void ReadData(byte[] data, ref int pointer) 612 public void ReadData(byte[] data, ref int pointer)
613 { 613 {
614 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 614 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
615 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 615 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
616 Data = new byte[Length]; 616 Data = new byte[Length];
617 for (int i = 0; i < Length; i++) 617 for (int i = 0; i < Length; i++)
618 { 618 {
619 Data[i] = data[pointer++]; 619 Data[i] = data[pointer++];
620 } 620 }
621 } 621 }
622 622
623 public void Print() 623 public void Print()
624 { 624 {
625 Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 625 Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
626 } 626 }
627 } 627 }
628 } 628 }
629 629
630 private class AttributeInfo 630 private class AttributeInfo
631 { 631 {
632 public void ReadData(byte[] data, ref int i) 632 public void ReadData(byte[] data, ref int i)
633 { 633 {
634 634
635 } 635 }
636 } 636 }
637 #endregion 637 #endregion
638 638
639 } 639 }
640} \ No newline at end of file 640} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
index f681be1..c76767a 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
@@ -1,43 +1,43 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index 578dbc2..6b8930e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -1,551 +1,551 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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 (byte)(byte)OpCode.iconst_m1: 45 case (byte)(byte)OpCode.iconst_m1:
46 Int m_int = new Int(); 46 Int m_int = new Int();
47 m_int.mValue = -1; 47 m_int.mValue = -1;
48 this.m_thread.m_currentFrame.OpStack.Push(m_int); 48 this.m_thread.m_currentFrame.OpStack.Push(m_int);
49 result = true; 49 result = true;
50 break; 50 break;
51 case (byte)(byte)OpCode.iconst_0: 51 case (byte)(byte)OpCode.iconst_0:
52 m_int = new Int(); 52 m_int = new Int();
53 m_int.mValue = 0; 53 m_int.mValue = 0;
54 this.m_thread.m_currentFrame.OpStack.Push(m_int); 54 this.m_thread.m_currentFrame.OpStack.Push(m_int);
55 result = true; 55 result = true;
56 break; 56 break;
57 case (byte)(byte)OpCode.iconst_1: 57 case (byte)(byte)OpCode.iconst_1:
58 m_int = new Int(); 58 m_int = new Int();
59 m_int.mValue = 1; 59 m_int.mValue = 1;
60 this.m_thread.m_currentFrame.OpStack.Push(m_int); 60 this.m_thread.m_currentFrame.OpStack.Push(m_int);
61 result = true; 61 result = true;
62 break; 62 break;
63 case (byte)(byte)OpCode.iconst_2: 63 case (byte)(byte)OpCode.iconst_2:
64 m_int = new Int(); 64 m_int = new Int();
65 m_int.mValue = 2; 65 m_int.mValue = 2;
66 this.m_thread.m_currentFrame.OpStack.Push(m_int); 66 this.m_thread.m_currentFrame.OpStack.Push(m_int);
67 result = true; 67 result = true;
68 break; 68 break;
69 case (byte)(byte)OpCode.iconst_3: 69 case (byte)(byte)OpCode.iconst_3:
70 m_int = new Int(); 70 m_int = new Int();
71 m_int.mValue = 3; 71 m_int.mValue = 3;
72 this.m_thread.m_currentFrame.OpStack.Push(m_int); 72 this.m_thread.m_currentFrame.OpStack.Push(m_int);
73 break; 73 break;
74 case (byte)(byte)OpCode.iconst_4: 74 case (byte)(byte)OpCode.iconst_4:
75 m_int = new Int(); 75 m_int = new Int();
76 m_int.mValue = 4; 76 m_int.mValue = 4;
77 this.m_thread.m_currentFrame.OpStack.Push(m_int); 77 this.m_thread.m_currentFrame.OpStack.Push(m_int);
78 result = true; 78 result = true;
79 break; 79 break;
80 case (byte)OpCode.iconst_5: 80 case (byte)OpCode.iconst_5:
81 m_int = new Int(); 81 m_int = new Int();
82 m_int.mValue = 5; 82 m_int.mValue = 5;
83 this.m_thread.m_currentFrame.OpStack.Push(m_int); 83 this.m_thread.m_currentFrame.OpStack.Push(m_int);
84 result = true; 84 result = true;
85 break; 85 break;
86 case (byte)OpCode.fconst_0: 86 case (byte)OpCode.fconst_0:
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.m_thread.m_currentFrame.OpStack.Push(m_float); 89 this.m_thread.m_currentFrame.OpStack.Push(m_float);
90 result = true; 90 result = true;
91 break; 91 break;
92 case (byte)OpCode.fconst_1: 92 case (byte)OpCode.fconst_1:
93 m_float = new Float(); 93 m_float = new Float();
94 m_float.mValue = 1.0f; 94 m_float.mValue = 1.0f;
95 this.m_thread.m_currentFrame.OpStack.Push(m_float); 95 this.m_thread.m_currentFrame.OpStack.Push(m_float);
96 result = true; 96 result = true;
97 break; 97 break;
98 case (byte)OpCode.fconst_2: 98 case (byte)OpCode.fconst_2:
99 m_float = new Float(); 99 m_float = new Float();
100 m_float.mValue = 2.0f; 100 m_float.mValue = 2.0f;
101 this.m_thread.m_currentFrame.OpStack.Push(m_float); 101 this.m_thread.m_currentFrame.OpStack.Push(m_float);
102 result = true; 102 result = true;
103 break; 103 break;
104 case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? 104 case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int?
105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]; 105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC];
106 Int pushInt = new Int(); 106 Int pushInt = new Int();
107 pushInt.mValue = pushvalue; 107 pushInt.mValue = pushvalue;
108 this.m_thread.m_currentFrame.OpStack.Push(pushInt); 108 this.m_thread.m_currentFrame.OpStack.Push(pushInt);
109 this.m_thread.PC++; 109 this.m_thread.PC++;
110 result = true; 110 result = true;
111 break; 111 break;
112 case (byte)OpCode.sipush: 112 case (byte)OpCode.sipush:
113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
114 Int pushInt2 = new Int(); 114 Int pushInt2 = new Int();
115 pushInt2.mValue = pushvalue2; 115 pushInt2.mValue = pushvalue2;
116 this.m_thread.m_currentFrame.OpStack.Push(pushInt2); 116 this.m_thread.m_currentFrame.OpStack.Push(pushInt2);
117 this.m_thread.PC += 2; 117 this.m_thread.PC += 2;
118 result = true; 118 result = true;
119 break; 119 break;
120 case (byte)OpCode.fload: 120 case (byte)OpCode.fload:
121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]));
122 Float fload = new Float(); 122 Float fload = new Float();
123 if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) 123 if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null)
124 { 124 {
125 if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) 125 if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float)
126 { 126 {
127 fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; 127 fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue;
128 this.m_thread.m_currentFrame.OpStack.Push(fload); 128 this.m_thread.m_currentFrame.OpStack.Push(fload);
129 } 129 }
130 } 130 }
131 this.m_thread.PC++; 131 this.m_thread.PC++;
132 result = true; 132 result = true;
133 break; 133 break;
134 case (byte)OpCode.iload_0: 134 case (byte)OpCode.iload_0:
135 if (this.m_thread.m_currentFrame.LocalVariables[0] != null) 135 if (this.m_thread.m_currentFrame.LocalVariables[0] != null)
136 { 136 {
137 if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) 137 if (this.m_thread.m_currentFrame.LocalVariables[0] is Int)
138 { 138 {
139 Int newInt = new Int(); 139 Int newInt = new Int();
140 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; 140 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue;
141 this.m_thread.m_currentFrame.OpStack.Push(newInt); 141 this.m_thread.m_currentFrame.OpStack.Push(newInt);
142 } 142 }
143 } 143 }
144 result = true; 144 result = true;
145 break; 145 break;
146 case (byte)OpCode.iload_1: 146 case (byte)OpCode.iload_1:
147 if (this.m_thread.m_currentFrame.LocalVariables[1] != null) 147 if (this.m_thread.m_currentFrame.LocalVariables[1] != null)
148 { 148 {
149 if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) 149 if (this.m_thread.m_currentFrame.LocalVariables[1] is Int)
150 { 150 {
151 Int newInt = new Int(); 151 Int newInt = new Int();
152 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; 152 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue;
153 this.m_thread.m_currentFrame.OpStack.Push(newInt); 153 this.m_thread.m_currentFrame.OpStack.Push(newInt);
154 } 154 }
155 } 155 }
156 result = true; 156 result = true;
157 break; 157 break;
158 case (byte)OpCode.fload_0: 158 case (byte)OpCode.fload_0:
159 if (this.m_thread.m_currentFrame.LocalVariables[0] != null) 159 if (this.m_thread.m_currentFrame.LocalVariables[0] != null)
160 { 160 {
161 if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) 161 if (this.m_thread.m_currentFrame.LocalVariables[0] is Float)
162 { 162 {
163 Float newfloat = new Float(); 163 Float newfloat = new Float();
164 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; 164 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue;
165 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 165 this.m_thread.m_currentFrame.OpStack.Push(newfloat);
166 } 166 }
167 } 167 }
168 result = true; 168 result = true;
169 break; 169 break;
170 case (byte)OpCode.fload_1: 170 case (byte)OpCode.fload_1:
171 if (this.m_thread.m_currentFrame.LocalVariables[1] != null) 171 if (this.m_thread.m_currentFrame.LocalVariables[1] != null)
172 { 172 {
173 if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) 173 if (this.m_thread.m_currentFrame.LocalVariables[1] is Float)
174 { 174 {
175 Float newfloat = new Float(); 175 Float newfloat = new Float();
176 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; 176 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue;
177 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 177 this.m_thread.m_currentFrame.OpStack.Push(newfloat);
178 } 178 }
179 } 179 }
180 result = true; 180 result = true;
181 break; 181 break;
182 case (byte)OpCode.fload_2: 182 case (byte)OpCode.fload_2:
183 if (this.m_thread.m_currentFrame.LocalVariables[2] != null) 183 if (this.m_thread.m_currentFrame.LocalVariables[2] != null)
184 { 184 {
185 if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) 185 if (this.m_thread.m_currentFrame.LocalVariables[2] is Float)
186 { 186 {
187 Float newfloat = new Float(); 187 Float newfloat = new Float();
188 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; 188 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue;
189 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 189 this.m_thread.m_currentFrame.OpStack.Push(newfloat);
190 } 190 }
191 } 191 }
192 result = true; 192 result = true;
193 break; 193 break;
194 case (byte)OpCode.fload_3: 194 case (byte)OpCode.fload_3:
195 if (this.m_thread.m_currentFrame.LocalVariables[3] != null) 195 if (this.m_thread.m_currentFrame.LocalVariables[3] != null)
196 { 196 {
197 if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) 197 if (this.m_thread.m_currentFrame.LocalVariables[3] is Float)
198 { 198 {
199 Float newfloat = new Float(); 199 Float newfloat = new Float();
200 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; 200 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue;
201 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 201 this.m_thread.m_currentFrame.OpStack.Push(newfloat);
202 } 202 }
203 } 203 }
204 result = true; 204 result = true;
205 break; 205 break;
206 case (byte)OpCode.istore: 206 case (byte)OpCode.istore:
207 short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 207 short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]));
208 BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); 208 BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop();
209 if (istor is Int) 209 if (istor is Int)
210 { 210 {
211 this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; 211 this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor;
212 } 212 }
213 this.m_thread.PC++; 213 this.m_thread.PC++;
214 result = true; 214 result = true;
215 break; 215 break;
216 case (byte)OpCode.fstore: 216 case (byte)OpCode.fstore:
217 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 217 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]));
218 BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); 218 BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop();
219 if (fstor is Float) 219 if (fstor is Float)
220 { 220 {
221 this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; 221 this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor;
222 } 222 }
223 this.m_thread.PC++; 223 this.m_thread.PC++;
224 result = true; 224 result = true;
225 break; 225 break;
226 case (byte)OpCode.istore_0: 226 case (byte)OpCode.istore_0:
227 BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); 227 BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop();
228 if (baset is Int) 228 if (baset is Int)
229 { 229 {
230 this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; 230 this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset;
231 } 231 }
232 result = true; 232 result = true;
233 break; 233 break;
234 case (byte)OpCode.istore_1: 234 case (byte)OpCode.istore_1:
235 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 235 baset = this.m_thread.m_currentFrame.OpStack.Pop();
236 if (baset is Int) 236 if (baset is Int)
237 { 237 {
238 this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; 238 this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset;
239 } 239 }
240 result = true; 240 result = true;
241 break; 241 break;
242 case (byte)OpCode.fstore_0: 242 case (byte)OpCode.fstore_0:
243 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 243 baset = this.m_thread.m_currentFrame.OpStack.Pop();
244 if (baset is Float) 244 if (baset is Float)
245 { 245 {
246 this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; 246 this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset;
247 } 247 }
248 result = true; 248 result = true;
249 break; 249 break;
250 case (byte)OpCode.fstore_1: 250 case (byte)OpCode.fstore_1:
251 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 251 baset = this.m_thread.m_currentFrame.OpStack.Pop();
252 if (baset is Float) 252 if (baset is Float)
253 { 253 {
254 this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; 254 this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset;
255 } 255 }
256 result = true; 256 result = true;
257 break; 257 break;
258 case (byte)OpCode.fstore_2: 258 case (byte)OpCode.fstore_2:
259 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 259 baset = this.m_thread.m_currentFrame.OpStack.Pop();
260 if (baset is Float) 260 if (baset is Float)
261 { 261 {
262 this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; 262 this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset;
263 } 263 }
264 result = true; 264 result = true;
265 break; 265 break;
266 case (byte)OpCode.fstore_3: 266 case (byte)OpCode.fstore_3:
267 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 267 baset = this.m_thread.m_currentFrame.OpStack.Pop();
268 if (baset is Float) 268 if (baset is Float)
269 { 269 {
270 this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; 270 this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset;
271 } 271 }
272 result = true; 272 result = true;
273 break; 273 break;
274 case (byte)OpCode.pop: 274 case (byte)OpCode.pop:
275 this.m_thread.m_currentFrame.OpStack.Pop(); 275 this.m_thread.m_currentFrame.OpStack.Pop();
276 result = true; 276 result = true;
277 break; 277 break;
278 case (byte)OpCode.fadd: 278 case (byte)OpCode.fadd:
279 BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); 279 BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop();
280 BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); 280 BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop();
281 if (bf1 is Float && bf2 is Float) 281 if (bf1 is Float && bf2 is Float)
282 { 282 {
283 Float nflt = new Float(); 283 Float nflt = new Float();
284 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; 284 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
285 this.m_thread.m_currentFrame.OpStack.Push(nflt); 285 this.m_thread.m_currentFrame.OpStack.Push(nflt);
286 } 286 }
287 result = true; 287 result = true;
288 break; 288 break;
289 case (byte)OpCode.fsub: 289 case (byte)OpCode.fsub:
290 BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); 290 BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop();
291 BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); 291 BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop();
292 if (bsf1 is Float && bsf2 is Float) 292 if (bsf1 is Float && bsf2 is Float)
293 { 293 {
294 Float resf = new Float(); 294 Float resf = new Float();
295 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; 295 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
296 this.m_thread.m_currentFrame.OpStack.Push(resf); 296 this.m_thread.m_currentFrame.OpStack.Push(resf);
297 } 297 }
298 result = true; 298 result = true;
299 break; 299 break;
300 case (byte)OpCode.imul: //check the order of the two values off the stack is correct 300 case (byte)OpCode.imul: //check the order of the two values off the stack is correct
301 BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); 301 BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop();
302 BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); 302 BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop();
303 if (bs1 is Int && bs2 is Int) 303 if (bs1 is Int && bs2 is Int)
304 { 304 {
305 Int nInt = new Int(); 305 Int nInt = new Int();
306 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; 306 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
307 this.m_thread.m_currentFrame.OpStack.Push(nInt); 307 this.m_thread.m_currentFrame.OpStack.Push(nInt);
308 } 308 }
309 result = true; 309 result = true;
310 break; 310 break;
311 case (byte)OpCode.iinc: 311 case (byte)OpCode.iinc:
312 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) 312 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null)
313 { 313 {
314 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) 314 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int)
315 { 315 {
316 ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; 316 ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1];
317 } 317 }
318 } 318 }
319 this.m_thread.PC += 2; 319 this.m_thread.PC += 2;
320 result = true; 320 result = true;
321 break; 321 break;
322 case (byte)OpCode.f2i: 322 case (byte)OpCode.f2i:
323 BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); 323 BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop();
324 if (conv1 is Float) 324 if (conv1 is Float)
325 { 325 {
326 Int newconv = new Int(); 326 Int newconv = new Int();
327 newconv.mValue = (int)((Float)conv1).mValue; 327 newconv.mValue = (int)((Float)conv1).mValue;
328 this.m_thread.m_currentFrame.OpStack.Push(newconv); 328 this.m_thread.m_currentFrame.OpStack.Push(newconv);
329 } 329 }
330 result = true; 330 result = true;
331 break; 331 break;
332 case (byte)OpCode.fcmpl: 332 case (byte)OpCode.fcmpl:
333 BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); 333 BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop();
334 BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); 334 BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop();
335 if (flcom1 is Float && flcom2 is Float) 335 if (flcom1 is Float && flcom2 is Float)
336 { 336 {
337 Int compres = new Int(); 337 Int compres = new Int();
338 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 338 if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
339 { 339 {
340 compres.mValue = -1; 340 compres.mValue = -1;
341 } 341 }
342 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 342 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
343 { 343 {
344 compres.mValue = 1; 344 compres.mValue = 1;
345 } 345 }
346 else 346 else
347 { 347 {
348 compres.mValue = 0; 348 compres.mValue = 0;
349 } 349 }
350 this.m_thread.m_currentFrame.OpStack.Push(compres); 350 this.m_thread.m_currentFrame.OpStack.Push(compres);
351 } 351 }
352 result = true; 352 result = true;
353 break; 353 break;
354 case (byte)OpCode.fcmpg: 354 case (byte)OpCode.fcmpg:
355 flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); 355 flcom2 = this.m_thread.m_currentFrame.OpStack.Pop();
356 flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); 356 flcom1 = this.m_thread.m_currentFrame.OpStack.Pop();
357 if (flcom1 is Float && flcom2 is Float) 357 if (flcom1 is Float && flcom2 is Float)
358 { 358 {
359 Int compres = new Int(); 359 Int compres = new Int();
360 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 360 if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
361 { 361 {
362 compres.mValue = -1; 362 compres.mValue = -1;
363 } 363 }
364 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 364 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
365 { 365 {
366 compres.mValue = 1; 366 compres.mValue = 1;
367 } 367 }
368 else 368 else
369 { 369 {
370 compres.mValue = 0; 370 compres.mValue = 0;
371 } 371 }
372 this.m_thread.m_currentFrame.OpStack.Push(compres); 372 this.m_thread.m_currentFrame.OpStack.Push(compres);
373 } 373 }
374 result = true; 374 result = true;
375 break; 375 break;
376 case (byte)OpCode.ifge: 376 case (byte)OpCode.ifge:
377 short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 377 short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
378 BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); 378 BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop();
379 if (compe1 is Int) 379 if (compe1 is Int)
380 { 380 {
381 if (((Int)compe1).mValue >= 0) 381 if (((Int)compe1).mValue >= 0)
382 { 382 {
383 this.m_thread.PC += -1 + compareoffset2; 383 this.m_thread.PC += -1 + compareoffset2;
384 } 384 }
385 else 385 else
386 { 386 {
387 this.m_thread.PC += 2; 387 this.m_thread.PC += 2;
388 } 388 }
389 } 389 }
390 else 390 else
391 { 391 {
392 this.m_thread.PC += 2; 392 this.m_thread.PC += 2;
393 } 393 }
394 result = true; 394 result = true;
395 break; 395 break;
396 case (byte)OpCode.ifle: 396 case (byte)OpCode.ifle:
397 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 397 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
398 BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); 398 BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop();
399 if (comp1 is Int) 399 if (comp1 is Int)
400 { 400 {
401 if (((Int)comp1).mValue <= 0) 401 if (((Int)comp1).mValue <= 0)
402 { 402 {
403 this.m_thread.PC += -1 + compareoffset1; 403 this.m_thread.PC += -1 + compareoffset1;
404 } 404 }
405 else 405 else
406 { 406 {
407 this.m_thread.PC += 2; 407 this.m_thread.PC += 2;
408 } 408 }
409 } 409 }
410 else 410 else
411 { 411 {
412 this.m_thread.PC += 2; 412 this.m_thread.PC += 2;
413 } 413 }
414 result = true; 414 result = true;
415 break; 415 break;
416 case (byte)OpCode.if_icmpge: 416 case (byte)OpCode.if_icmpge:
417 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 417 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
418 BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); 418 BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop();
419 BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); 419 BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop();
420 if (bc1 is Int && bc2 is Int) 420 if (bc1 is Int && bc2 is Int)
421 { 421 {
422 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); 422 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
423 if (((Int)bc1).mValue >= ((Int)bc2).mValue) 423 if (((Int)bc1).mValue >= ((Int)bc2).mValue)
424 { 424 {
425 // Console.WriteLine("branch compare true , offset is " +compareoffset); 425 // Console.WriteLine("branch compare true , offset is " +compareoffset);
426 // Console.WriteLine("current PC is " + this._mThread.PC); 426 // Console.WriteLine("current PC is " + this._mThread.PC);
427 this.m_thread.PC += -1 + compareoffset; 427 this.m_thread.PC += -1 + compareoffset;
428 //Console.WriteLine("new PC is " + this._mThread.PC); 428 //Console.WriteLine("new PC is " + this._mThread.PC);
429 } 429 }
430 else 430 else
431 { 431 {
432 //Console.WriteLine("branch compare false"); 432 //Console.WriteLine("branch compare false");
433 this.m_thread.PC += 2; 433 this.m_thread.PC += 2;
434 } 434 }
435 } 435 }
436 else 436 else
437 { 437 {
438 this.m_thread.PC += 2; 438 this.m_thread.PC += 2;
439 } 439 }
440 result = true; 440 result = true;
441 break; 441 break;
442 case (byte)OpCode.if_icmple: 442 case (byte)OpCode.if_icmple:
443 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 443 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
444 BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); 444 BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop();
445 BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); 445 BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop();
446 if (bcl1 is Int && bcl2 is Int) 446 if (bcl1 is Int && bcl2 is Int)
447 { 447 {
448 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); 448 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
449 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) 449 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue)
450 { 450 {
451 // Console.WriteLine("branch compare true , offset is " + compareloffset); 451 // Console.WriteLine("branch compare true , offset is " + compareloffset);
452 // Console.WriteLine("current PC is " + this._mThread.PC); 452 // Console.WriteLine("current PC is " + this._mThread.PC);
453 this.m_thread.PC += -1 + compareloffset; 453 this.m_thread.PC += -1 + compareloffset;
454 // Console.WriteLine("new PC is " + this._mThread.PC); 454 // Console.WriteLine("new PC is " + this._mThread.PC);
455 } 455 }
456 else 456 else
457 { 457 {
458 //Console.WriteLine("branch compare false"); 458 //Console.WriteLine("branch compare false");
459 this.m_thread.PC += 2; 459 this.m_thread.PC += 2;
460 } 460 }
461 } 461 }
462 else 462 else
463 { 463 {
464 this.m_thread.PC += 2; 464 this.m_thread.PC += 2;
465 } 465 }
466 result = true; 466 result = true;
467 break; 467 break;
468 case (byte)OpCode._goto: 468 case (byte)OpCode._goto:
469 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 469 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
470 this.m_thread.PC += -1 + offset; 470 this.m_thread.PC += -1 + offset;
471 result = true; 471 result = true;
472 break; 472 break;
473 case (byte)OpCode.getstatic: 473 case (byte)OpCode.getstatic:
474 short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 474 short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
475 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) 475 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
476 { 476 {
477 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 477 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
478 { 478 {
479 //from this class 479 //from this class
480 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) 480 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
481 { 481 {
482 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) 482 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
483 { 483 {
484 Float retFloat = new Float(); 484 Float retFloat = new Float();
485 retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; 485 retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
486 this.m_thread.m_currentFrame.OpStack.Push(retFloat); 486 this.m_thread.m_currentFrame.OpStack.Push(retFloat);
487 } 487 }
488 else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) 488 else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
489 { 489 {
490 Int retInt = new Int(); 490 Int retInt = new Int();
491 retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; 491 retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
492 // Console.WriteLine("getting static field, " + retInt.mValue); 492 // Console.WriteLine("getting static field, " + retInt.mValue);
493 this.m_thread.m_currentFrame.OpStack.Push(retInt); 493 this.m_thread.m_currentFrame.OpStack.Push(retInt);
494 } 494 }
495 } 495 }
496 } 496 }
497 else 497 else
498 { 498 {
499 //get from a different class 499 //get from a different class
500 } 500 }
501 } 501 }
502 this.m_thread.PC += 2; 502 this.m_thread.PC += 2;
503 result = true; 503 result = true;
504 break; 504 break;
505 case (byte)OpCode.putstatic: 505 case (byte)OpCode.putstatic:
506 fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 506 fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
507 BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); 507 BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop();
508 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) 508 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
509 { 509 {
510 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 510 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
511 { 511 {
512 // this class 512 // this class
513 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) 513 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
514 { 514 {
515 if (addstatic is Float) 515 if (addstatic is Float)
516 { 516 {
517 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) 517 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
518 { 518 {
519 Float newf = new Float(); 519 Float newf = new Float();
520 newf.mValue = ((Float)addstatic).mValue; 520 newf.mValue = ((Float)addstatic).mValue;
521 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; 521 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf;
522 } 522 }
523 } 523 }
524 else if (addstatic is Int) 524 else if (addstatic is Int)
525 { 525 {
526 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) 526 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
527 { 527 {
528 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); 528 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue);
529 Int newi = new Int(); 529 Int newi = new Int();
530 newi.mValue = ((Int)addstatic).mValue; 530 newi.mValue = ((Int)addstatic).mValue;
531 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; 531 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi;
532 } 532 }
533 } 533 }
534 } 534 }
535 } 535 }
536 else 536 else
537 { 537 {
538 // a different class 538 // a different class
539 } 539 }
540 } 540 }
541 this.m_thread.PC += 2; 541 this.m_thread.PC += 2;
542 result = true; 542 result = true;
543 break; 543 break;
544 544
545 } 545 }
546 546
547 return result; 547 return result;
548 } 548 }
549 } 549 }
550 } 550 }
551} \ No newline at end of file 551} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
index 3a13fa1..8cde62e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
@@ -1,96 +1,96 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.Framework.Interfaces; 31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 34using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
35using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 35using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
36 36
37namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 37namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); 49 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]);
50 if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) 50 if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
51 { 51 {
52 string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; 52 string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_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.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 61 if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.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.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); 66 this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2));
67 } 67 }
68 else 68 else
69 { 69 {
70 this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); 70 this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.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.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") 78 if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
79 { 79 {
80 this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); 80 this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null);
81 } 81 }
82 } 82 }
83 } 83 }
84 else 84 else
85 { 85 {
86 this.m_thread.PC += 2; 86 this.m_thread.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/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
index d1cafa1..5a42285 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
@@ -1,40 +1,40 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
index c3611d4..698a518 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
@@ -1,135 +1,135 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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 m_thread; 40 private Thread m_thread;
41 41
42 public Interpreter(Thread parentThread) 42 public Interpreter(Thread parentThread)
43 { 43 {
44 m_thread = parentThread; 44 m_thread = 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.m_thread.PC++]; 50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.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.m_thread.stack.StackFrames.Count > 1) 63 if (this.m_thread.stack.StackFrames.Count > 1)
64 { 64 {
65 Console.WriteLine("returning int from function"); 65 Console.WriteLine("returning int from function");
66 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 66 int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
67 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 67 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
68 this.m_thread.stack.StackFrames.Pop(); 68 this.m_thread.stack.StackFrames.Pop();
69 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 69 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
70 this.m_thread.PC = retPC1; 70 this.m_thread.PC = retPC1;
71 if (bas1 is Int) 71 if (bas1 is Int)
72 { 72 {
73 this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); 73 this.m_thread.m_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.m_thread.stack.StackFrames.Pop(); 79 this.m_thread.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.m_thread.stack.StackFrames.Count > 1) 86 if (this.m_thread.stack.StackFrames.Count > 1)
87 { 87 {
88 Console.WriteLine("returning float from function"); 88 Console.WriteLine("returning float from function");
89 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 89 int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
90 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 90 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
91 this.m_thread.stack.StackFrames.Pop(); 91 this.m_thread.stack.StackFrames.Pop();
92 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 92 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
93 this.m_thread.PC = retPC1; 93 this.m_thread.PC = retPC1;
94 if (bas1 is Float) 94 if (bas1 is Float)
95 { 95 {
96 this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); 96 this.m_thread.m_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.m_thread.stack.StackFrames.Pop(); 102 this.m_thread.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.m_thread.stack.StackFrames.Count > 1) 109 if (this.m_thread.stack.StackFrames.Count > 1)
110 { 110 {
111 Console.WriteLine("returning from function"); 111 Console.WriteLine("returning from function");
112 int retPC = this.m_thread.m_currentFrame.ReturnPC; 112 int retPC = this.m_thread.m_currentFrame.ReturnPC;
113 this.m_thread.stack.StackFrames.Pop(); 113 this.m_thread.stack.StackFrames.Pop();
114 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 114 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
115 this.m_thread.PC = retPC; 115 this.m_thread.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.m_thread.stack.StackFrames.Pop(); 120 this.m_thread.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/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
index 5f9202e..34d4fc5 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
@@ -1,45 +1,45 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
index 58ed915..f470583 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
index bc79ce3..21e467a 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
@@ -1,37 +1,37 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 33{
34 public class Object 34 public class Object
35 { 35 {
36 } 36 }
37} 37}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs
index c6ac987..47b9eec 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs
@@ -1,56 +1,56 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 5namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
6{ 6{
7 public enum OpCode : byte 7 public enum OpCode : byte
8 { 8 {
9 iconst_m1 = 2, 9 iconst_m1 = 2,
10 iconst_0 = 3, 10 iconst_0 = 3,
11 iconst_1 = 4, 11 iconst_1 = 4,
12 iconst_2 = 5, 12 iconst_2 = 5,
13 iconst_3 = 6, 13 iconst_3 = 6,
14 iconst_4 = 7, 14 iconst_4 = 7,
15 iconst_5 = 8, 15 iconst_5 = 8,
16 fconst_0 = 11, 16 fconst_0 = 11,
17 fconst_1 = 12, 17 fconst_1 = 12,
18 fconst_2 = 13, 18 fconst_2 = 13,
19 bipush = 16, 19 bipush = 16,
20 sipush = 17, 20 sipush = 17,
21 fload = 23, 21 fload = 23,
22 iload_0 = 26, 22 iload_0 = 26,
23 iload_1 = 27, 23 iload_1 = 27,
24 fload_0 = 34, 24 fload_0 = 34,
25 fload_1 = 35, 25 fload_1 = 35,
26 fload_2 = 36, 26 fload_2 = 36,
27 fload_3 = 37, 27 fload_3 = 37,
28 istore = 54, 28 istore = 54,
29 fstore = 56, 29 fstore = 56,
30 istore_0 = 59, 30 istore_0 = 59,
31 istore_1 = 60, 31 istore_1 = 60,
32 istore_2 = 61, 32 istore_2 = 61,
33 istore_3 = 62, 33 istore_3 = 62,
34 fstore_0 = 67, 34 fstore_0 = 67,
35 fstore_1 = 68, 35 fstore_1 = 68,
36 fstore_2 = 69, 36 fstore_2 = 69,
37 fstore_3 = 70, 37 fstore_3 = 70,
38 pop = 87, 38 pop = 87,
39 fadd = 98, 39 fadd = 98,
40 fsub = 102, 40 fsub = 102,
41 imul = 104, 41 imul = 104,
42 iinc = 132, 42 iinc = 132,
43 f2i = 139, 43 f2i = 139,
44 fcmpl = 149, 44 fcmpl = 149,
45 fcmpg = 150, 45 fcmpg = 150,
46 ifge = 156, 46 ifge = 156,
47 ifgt = 157, 47 ifgt = 157,
48 ifle = 158, 48 ifle = 158,
49 if_icmpge = 162, 49 if_icmpge = 162,
50 if_icmpgt = 163, 50 if_icmpgt = 163,
51 if_icmple = 164, 51 if_icmple = 164,
52 _goto = 167, 52 _goto = 167,
53 getstatic = 178, 53 getstatic = 178,
54 putstatic = 179 54 putstatic = 179
55 } 55 }
56} 56}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
index 5d6d63e..56e02ff 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
@@ -1,42 +1,42 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
index 0a0d20a..a5f9029 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
@@ -1,49 +1,49 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32 32
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
index b386b82..b810676 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
@@ -1,119 +1,119 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.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.ExtensionsScriptModule; 36using OpenSim.Region.ExtensionsScriptModule;
37 37
38namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 38namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
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 m_Interpreter; 47 private Interpreter m_Interpreter;
48 public ClassRecord currentClass; 48 public ClassRecord currentClass;
49 public ClassInstance currentInstance; 49 public ClassInstance currentInstance;
50 private StackFrame m_currentFrame; 50 private StackFrame m_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.m_Interpreter = new Interpreter(this); 58 this.m_Interpreter = 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 m_currentFrame = new StackFrame(); 70 m_currentFrame = new StackFrame();
71 this.stack.StackFrames.Push(m_currentFrame); 71 this.stack.StackFrames.Push(m_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 m_currentFrame = new StackFrame(); 78 m_currentFrame = new StackFrame();
79 this.stack.StackFrames.Push(m_currentFrame); 79 this.stack.StackFrames.Push(m_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 m_currentFrame = new StackFrame(); 85 m_currentFrame = new StackFrame();
86 m_currentFrame.ReturnPC = returnPC; 86 m_currentFrame.ReturnPC = returnPC;
87 this.stack.StackFrames.Push(m_currentFrame); 87 this.stack.StackFrames.Push(m_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 = m_currentFrame.OpStack.Pop(); 95 BaseType bs1 = m_currentFrame.OpStack.Pop();
96 m_currentFrame = new StackFrame(); 96 m_currentFrame = new StackFrame();
97 m_currentFrame.ReturnPC = returnPC; 97 m_currentFrame.ReturnPC = returnPC;
98 this.stack.StackFrames.Push(m_currentFrame); 98 this.stack.StackFrames.Push(m_currentFrame);
99 m_currentFrame.LocalVariables[0] = ((Int)bs1); 99 m_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.m_Interpreter.Excute(); 116 return this.m_Interpreter.Excute();
117 } 117 }
118 } 118 }
119} 119}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs
index 28b9b33..82a32dd 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs
@@ -1,28 +1,28 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Region.ExtensionsScriptModule; 5using OpenSim.Region.ExtensionsScriptModule;
6 6
7namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine 7namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
8{ 8{
9 public class JavaEngine : IScriptCompiler 9 public class JavaEngine : IScriptCompiler
10 { 10 {
11 public string FileExt() 11 public string FileExt()
12 { 12 {
13 return ".java"; 13 return ".java";
14 } 14 }
15 15
16 public Dictionary<string, IScript> compile(string filename) 16 public Dictionary<string, IScript> compile(string filename)
17 { 17 {
18 JVMScript script = new JVMScript(); 18 JVMScript script = new JVMScript();
19 Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); 19 Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
20 20
21 script.LoadScript(filename); 21 script.LoadScript(filename);
22 22
23 returns.Add(filename, script); 23 returns.Add(filename, script);
24 24
25 return returns; 25 return returns;
26 } 26 }
27 } 27 }
28} 28}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
index 2abb3b7..5d4d4ab 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
@@ -1,171 +1,171 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
37using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; 37using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM;
38using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; 38using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread;
39 39
40namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine 40namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
41{ 41{
42 public class JVMScript : IScript 42 public class JVMScript : IScript
43 { 43 {
44 private List<Thread> _threads = new List<Thread>(); 44 private List<Thread> _threads = new List<Thread>();
45 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); 45 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
46 private MainMemory _mainMemory; 46 private MainMemory _mainMemory;
47 47
48 ScriptInfo scriptInfo; 48 ScriptInfo scriptInfo;
49 49
50 public void Initialise(ScriptInfo info) 50 public void Initialise(ScriptInfo info)
51 { 51 {
52 scriptInfo = info; 52 scriptInfo = info;
53 53
54 _mainMemory = new MainMemory(); 54 _mainMemory = new MainMemory();
55 Thread.GlobalMemory = this._mainMemory; 55 Thread.GlobalMemory = this._mainMemory;
56 Thread.World = info.world; 56 Thread.World = info.world;
57 CompileScript(); 57 CompileScript();
58 58
59 scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); 59 scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
60 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 60 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
61 } 61 }
62 62
63 void events_OnNewPresence(ScenePresence presence) 63 void events_OnNewPresence(ScenePresence presence)
64 { 64 {
65 for (int i = 0; i < this._threads.Count; i++) 65 for (int i = 0; i < this._threads.Count; i++)
66 { 66 {
67 if (!this._threads[i].running) 67 if (!this._threads[i].running)
68 { 68 {
69 this._threads[i].StartMethod("OnNewPresence"); 69 this._threads[i].StartMethod("OnNewPresence");
70 bool run = true; 70 bool run = true;
71 while (run) 71 while (run)
72 { 72 {
73 run = this._threads[i].Excute(); 73 run = this._threads[i].Excute();
74 } 74 }
75 } 75 }
76 } 76 }
77 } 77 }
78 78
79 void events_OnFrame() 79 void events_OnFrame()
80 { 80 {
81 for (int i = 0; i < this._threads.Count; i++) 81 for (int i = 0; i < this._threads.Count; i++)
82 { 82 {
83 if (!this._threads[i].running) 83 if (!this._threads[i].running)
84 { 84 {
85 this._threads[i].StartMethod("OnFrame"); 85 this._threads[i].StartMethod("OnFrame");
86 bool run = true; 86 bool run = true;
87 while (run) 87 while (run)
88 { 88 {
89 run = this._threads[i].Excute(); 89 run = this._threads[i].Excute();
90 } 90 }
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 public string Name 95 public string Name
96 { 96 {
97 get { return "JVM Scripting Engine"; } 97 get { return "JVM Scripting Engine"; }
98 } 98 }
99 99
100 public void LoadScript(string script) 100 public void LoadScript(string script)
101 { 101 {
102 Console.WriteLine("OpenSimJVM - loading new script: " + script); 102 Console.WriteLine("OpenSimJVM - loading new script: " + script);
103 CompileInfo comp = new CompileInfo(); 103 CompileInfo comp = new CompileInfo();
104 comp.script = script; 104 comp.script = script;
105 comp.scriptName = script; 105 comp.scriptName = script;
106 this.CompileScripts.Enqueue(comp); 106 this.CompileScripts.Enqueue(comp);
107 } 107 }
108 108
109 public void CompileScript() 109 public void CompileScript()
110 { 110 {
111 CompileInfo comp = this.CompileScripts.Dequeue(); 111 CompileInfo comp = this.CompileScripts.Dequeue();
112 string script = comp.script; 112 string script = comp.script;
113 string scriptName = comp.scriptName; 113 string scriptName = comp.scriptName;
114 try 114 try
115 { 115 {
116 //need to compile the script into a java class file 116 //need to compile the script into a java class file
117 117
118 //first save it to a java source file 118 //first save it to a java source file
119 TextWriter tw = new StreamWriter(scriptName + ".java"); 119 TextWriter tw = new StreamWriter(scriptName + ".java");
120 tw.WriteLine(script); 120 tw.WriteLine(script);
121 tw.Close(); 121 tw.Close();
122 122
123 //now compile 123 //now compile
124 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); 124 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
125 // psi.RedirectStandardOutput = true; 125 // psi.RedirectStandardOutput = true;
126 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 126 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
127 psi.UseShellExecute = false; 127 psi.UseShellExecute = false;
128 128
129 System.Diagnostics.Process javacomp; 129 System.Diagnostics.Process javacomp;
130 javacomp = System.Diagnostics.Process.Start(psi); 130 javacomp = System.Diagnostics.Process.Start(psi);
131 javacomp.WaitForExit(); 131 javacomp.WaitForExit();
132 132
133 133
134 //now load in class file 134 //now load in class file
135 ClassRecord class1 = new ClassRecord(); 135 ClassRecord class1 = new ClassRecord();
136 class1.LoadClassFromFile(scriptName + ".class"); 136 class1.LoadClassFromFile(scriptName + ".class");
137 class1.PrintToConsole(); 137 class1.PrintToConsole();
138 //Console.WriteLine(); 138 //Console.WriteLine();
139 this._mainMemory.MethodArea.Classes.Add(class1); 139 this._mainMemory.MethodArea.Classes.Add(class1);
140 class1.AddMethodsToMemory(this._mainMemory.MethodArea); 140 class1.AddMethodsToMemory(this._mainMemory.MethodArea);
141 141
142 Thread newThread = new Thread(); 142 Thread newThread = new Thread();
143 this._threads.Add(newThread); 143 this._threads.Add(newThread);
144 newThread.currentClass = class1; 144 newThread.currentClass = class1;
145 newThread.scriptInfo = scriptInfo; 145 newThread.scriptInfo = scriptInfo;
146 146
147 //now delete the created files 147 //now delete the created files
148 System.IO.File.Delete(scriptName + ".java"); 148 System.IO.File.Delete(scriptName + ".java");
149 System.IO.File.Delete(scriptName + ".class"); 149 System.IO.File.Delete(scriptName + ".class");
150 //this.OnFrame(); 150 //this.OnFrame();
151 } 151 }
152 catch (Exception e) 152 catch (Exception e)
153 { 153 {
154 Console.WriteLine("exception"); 154 Console.WriteLine("exception");
155 Console.WriteLine(e.StackTrace); 155 Console.WriteLine(e.StackTrace);
156 Console.WriteLine(e.Message); 156 Console.WriteLine(e.Message);
157 } 157 }
158 } 158 }
159 159
160 private class CompileInfo 160 private class CompileInfo
161 { 161 {
162 public string script; 162 public string script;
163 public string scriptName; 163 public string scriptName;
164 164
165 public CompileInfo() 165 public CompileInfo()
166 { 166 {
167 167
168 } 168 }
169 } 169 }
170 } 170 }
171} 171}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs
index 97753cf..b71c473 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/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.ExtensionsScriptModule.JVMEngine.Types 5namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
6{ 6{
7 public class ArrayReference :BaseType 7 public class ArrayReference :BaseType
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs
index d1689df..9261e7c 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/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.ExtensionsScriptModule.JVMEngine.Types 5namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
6{ 6{
7 public class BaseType : Object 7 public class BaseType : Object
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs
index 8e1d435..a0b35fb 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/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.ExtensionsScriptModule.JVMEngine.Types 5namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.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/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
index cfbbd19..4af15f4 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
@@ -1,11 +1,11 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 4using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
5 5
6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
7{ 7{
8 public class Byte : BaseType 8 public class Byte : BaseType
9 { 9 {
10 } 10 }
11} 11}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
index 650e1ed..3c934cf 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
@@ -1,11 +1,11 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 4using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
5 5
6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
7{ 7{
8 public class Char : BaseType 8 public class Char : BaseType
9 { 9 {
10 } 10 }
11} 11}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
index b5bcc64..f7a7366 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.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.Region.ExtensionsScriptModule.JVMEngine.Types; 4using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
5 5
6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
7{ 7{
8 public class Float : BaseType 8 public class Float : BaseType
9 { 9 {
10 public float mValue = 0; 10 public float mValue = 0;
11 11
12 public Float() 12 public Float()
13 { 13 {
14 14
15 } 15 }
16 } 16 }
17} 17}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
index df133af..74e27a1 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.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.Region.ExtensionsScriptModule.JVMEngine.Types; 4using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
5 5
6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 6namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
7{ 7{
8 public class Int : BaseType 8 public class Int : BaseType
9 { 9 {
10 public int mValue = 0; 10 public int mValue = 0;
11 11
12 public Int() 12 public Int()
13 { 13 {
14 14
15 } 15 }
16 } 16 }
17} 17}
diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs
index 0a2f3e8..251b8c3 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Script.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs
@@ -1,64 +1,64 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule 30namespace OpenSim.Region.ExtensionsScriptModule
31{ 31{
32 public interface IScript 32 public interface IScript
33 { 33 {
34 void Initialise(ScriptInfo scriptInfo); 34 void Initialise(ScriptInfo scriptInfo);
35 string Name { get; } 35 string Name { get; }
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 Name 42 public string Name
43 { 43 {
44 get { return "TestScript 0.1"; } 44 get { 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 += events_OnFrame; 50 script.events.OnFrame += events_OnFrame;
51 script.events.OnNewPresence += events_OnNewPresence; 51 script.events.OnNewPresence += 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/ExtensionsScriptModule/ScriptAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs
index d32de7c..924a402 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/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.ExtensionsScriptModule 12namespace OpenSim.Region.ExtensionsScriptModule
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, Key taskID) 21 public ScriptAPI(Scene world, Key taskID)
22 { 22 {
23 scene = world; 23 scene = world;
24 interpretedAPI = new ScriptInterpretedAPI(world, taskID); 24 interpretedAPI = new ScriptInterpretedAPI(world, taskID);
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/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
index 01e2e60..aaadd1f 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
@@ -1,63 +1,63 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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.ExtensionsScriptModule 31namespace OpenSim.Region.ExtensionsScriptModule
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(world, libsecondlife.LLUUID.Zero); 55 api = new ScriptAPI(world, libsecondlife.LLUUID.Zero);
56 } 56 }
57 57
58 public void CreateTaskAPI(libsecondlife.LLUUID task) 58 public void CreateTaskAPI(libsecondlife.LLUUID task)
59 { 59 {
60 api = new ScriptAPI(world, task); 60 api = new ScriptAPI(world, task);
61 } 61 }
62 } 62 }
63} 63}
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
index c880bce..517b95f 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
@@ -1,267 +1,267 @@
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;
10using OpenSim.Region.Environment.LandManagement; 10using OpenSim.Region.Environment.LandManagement;
11using libsecondlife; 11using libsecondlife;
12 12
13namespace OpenSim.Region.ExtensionsScriptModule 13namespace OpenSim.Region.ExtensionsScriptModule
14{ 14{
15 /// <summary> 15 /// <summary>
16 /// A class inteded to act as an API for LSL-styled interpreted languages 16 /// A class inteded to act as an API for LSL-styled interpreted languages
17 /// </summary> 17 /// </summary>
18 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> 18 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
19 class ScriptInterpretedAPI 19 class ScriptInterpretedAPI
20 { 20 {
21 protected LLUUID m_object; 21 protected LLUUID m_object;
22 protected Scene m_scene; 22 protected Scene m_scene;
23 23
24 /// <summary> 24 /// <summary>
25 /// The scene in which this script is acting 25 /// The scene in which this script is acting
26 /// </summary> 26 /// </summary>
27 public Scene Scene 27 public Scene Scene
28 { 28 {
29 get { return m_scene; } 29 get { return m_scene; }
30 } 30 }
31 31
32 /// <summary> 32 /// <summary>
33 /// The id of the object our script is supposed to be acting in 33 /// The id of the object our script is supposed to be acting in
34 /// </summary> 34 /// </summary>
35 public Key ObjectID 35 public Key ObjectID
36 { 36 {
37 get { return m_object; } 37 get { return m_object; }
38 } 38 }
39 39
40 /// <summary> 40 /// <summary>
41 /// The object our script is supposed to be in 41 /// The object our script is supposed to be in
42 /// </summary> 42 /// </summary>
43 public SceneObjectGroup Task 43 public SceneObjectGroup Task
44 { 44 {
45 get { return Scene.Objects[ObjectID]; } 45 get { return Scene.Objects[ObjectID]; }
46 } 46 }
47 47
48 /// <summary> 48 /// <summary>
49 /// Creates a new ScriptInterpretedAPI for a specified object 49 /// Creates a new ScriptInterpretedAPI for a specified object
50 /// </summary> 50 /// </summary>
51 /// <param name="world">The scene the object is located in</param> 51 /// <param name="world">The scene the object is located in</param>
52 /// <param name="member">The specific member being 'occupied' by the script</param> 52 /// <param name="member">The specific member being 'occupied' by the script</param>
53 public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) 53 public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member)
54 { 54 {
55 m_scene = world; 55 m_scene = world;
56 m_object = member; 56 m_object = member;
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// Returns the absolute number of a integer value. 60 /// Returns the absolute number of a integer value.
61 /// </summary> 61 /// </summary>
62 /// <param name="val">Input</param> 62 /// <param name="val">Input</param>
63 /// <returns>Absolute number of input</returns> 63 /// <returns>Absolute number of input</returns>
64 public int osAbs(int val) 64 public int osAbs(int val)
65 { 65 {
66 return Math.Abs(val); 66 return Math.Abs(val);
67 } 67 }
68 68
69 public float osAcos(float val) 69 public float osAcos(float val)
70 { 70 {
71 return (float)Math.Acos(val); 71 return (float)Math.Acos(val);
72 } 72 }
73 73
74 [Obsolete("Unimplemented")] 74 [Obsolete("Unimplemented")]
75 public void osAddToLandPassList(Key avatar, float hours) 75 public void osAddToLandPassList(Key avatar, float hours)
76 { 76 {
77 Vector myPosition = Task.AbsolutePosition; 77 Vector myPosition = Task.AbsolutePosition;
78 Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); 78 Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
79 79
80 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); 80 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
81 return; 81 return;
82 } 82 }
83 83
84 [Obsolete("Unimplemented")] 84 [Obsolete("Unimplemented")]
85 public void osAdjustSoundVolume(float volume) 85 public void osAdjustSoundVolume(float volume)
86 { 86 {
87 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); 87 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)");
88 return; 88 return;
89 } 89 }
90 90
91 [Obsolete("Unimplemented")] 91 [Obsolete("Unimplemented")]
92 public void osAllowInventoryDrop(int add) 92 public void osAllowInventoryDrop(int add)
93 { 93 {
94 return; 94 return;
95 } 95 }
96 96
97 [Obsolete("Unimplemented")] 97 [Obsolete("Unimplemented")]
98 public float osAngleBetween(Rotation a, Rotation b) 98 public float osAngleBetween(Rotation a, Rotation b)
99 { 99 {
100 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); 100 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z);
101 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); 101 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z);
102 102
103 return 0; 103 return 0;
104 } 104 }
105 105
106 [Obsolete("Unimplemented")] 106 [Obsolete("Unimplemented")]
107 public void osApplyImpulse(Vector force, int local) 107 public void osApplyImpulse(Vector force, int local)
108 { 108 {
109 return; 109 return;
110 } 110 }
111 111
112 [Obsolete("Unimplemented")] 112 [Obsolete("Unimplemented")]
113 public void osApplyRotationalImpulse(Vector force, int local) 113 public void osApplyRotationalImpulse(Vector force, int local)
114 { 114 {
115 return; 115 return;
116 } 116 }
117 117
118 public float osAsin(float val) 118 public float osAsin(float val)
119 { 119 {
120 return (float)Math.Asin(val); 120 return (float)Math.Asin(val);
121 } 121 }
122 122
123 public float osAtan2(float x, float y) 123 public float osAtan2(float x, float y)
124 { 124 {
125 return (float)Math.Atan2(x, y); 125 return (float)Math.Atan2(x, y);
126 } 126 }
127 127
128 [Obsolete("Unimplemented")] 128 [Obsolete("Unimplemented")]
129 public void osAttachToAvatar(Key avatar, int attachmentPoint) 129 public void osAttachToAvatar(Key avatar, int attachmentPoint)
130 { 130 {
131 return; 131 return;
132 } 132 }
133 133
134 [Obsolete("Unimplemented")] 134 [Obsolete("Unimplemented")]
135 public Key osAvatarOnSitTarget() 135 public Key osAvatarOnSitTarget()
136 { 136 {
137 //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences 137 //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences
138 /* 138 /*
139 foreach (KeyValuePair<Key, EntityBase> Child in Task.Children) 139 foreach (KeyValuePair<Key, EntityBase> Child in Task.Children)
140 { 140 {
141 if (Child.Value is ScenePresence) 141 if (Child.Value is ScenePresence)
142 { 142 {
143 return Child.Value.uuid; 143 return Child.Value.uuid;
144 } 144 }
145 } 145 }
146 */ 146 */
147 147
148 return Key.Zero; 148 return Key.Zero;
149 } 149 }
150 150
151 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) 151 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
152 { 152 {
153 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); 153 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion();
154 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); 154 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z);
155 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); 155 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z);
156 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); 156 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z);
157 157
158 axQ.FromAxes(axFwd, axLeft, axUp); 158 axQ.FromAxes(axFwd, axLeft, axUp);
159 159
160 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 160 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
161 } 161 }
162 162
163 public Rotation osAxisAngle2Rot(Vector axis, float angle) 163 public Rotation osAxisAngle2Rot(Vector axis, float angle)
164 { 164 {
165 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); 165 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z));
166 166
167 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 167 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
168 } 168 }
169 169
170 public string osBase64ToString(string str) 170 public string osBase64ToString(string str)
171 { 171 {
172 Encoding enc = System.Text.Encoding.UTF8; 172 Encoding enc = System.Text.Encoding.UTF8;
173 return enc.GetString(Convert.FromBase64String(str)); 173 return enc.GetString(Convert.FromBase64String(str));
174 } 174 }
175 175
176 [Obsolete("Unimplemented")] 176 [Obsolete("Unimplemented")]
177 public void osBreakAllLinks() 177 public void osBreakAllLinks()
178 { 178 {
179 return; 179 return;
180 } 180 }
181 181
182 [Obsolete("Unimplemented")] 182 [Obsolete("Unimplemented")]
183 public void osBreakLink() 183 public void osBreakLink()
184 { 184 {
185 return; 185 return;
186 } 186 }
187 187
188 public LSLList osCSV2List(string src) 188 public LSLList osCSV2List(string src)
189 { 189 {
190 LSLList retVal = new LSLList(); 190 LSLList retVal = new LSLList();
191 retVal.AddRange(src.Split(',')); 191 retVal.AddRange(src.Split(','));
192 192
193 return retVal; 193 return retVal;
194 } 194 }
195 195
196 public int osCeil(float val) 196 public int osCeil(float val)
197 { 197 {
198 return (int)Math.Ceiling(val); 198 return (int)Math.Ceiling(val);
199 } 199 }
200 200
201 [Obsolete("Unimplemented")] 201 [Obsolete("Unimplemented")]
202 public void osCloseRemoteDataChannel(Key channel) 202 public void osCloseRemoteDataChannel(Key channel)
203 { 203 {
204 return; 204 return;
205 } 205 }
206 206
207 [Obsolete("Unimplemented")] 207 [Obsolete("Unimplemented")]
208 public float osCloud(Vector offset) 208 public float osCloud(Vector offset)
209 { 209 {
210 return 0.0f; 210 return 0.0f;
211 } 211 }
212 212
213 [Obsolete("Unimplemented")] 213 [Obsolete("Unimplemented")]
214 public void osCollisionFilter(string name, Key id, int accept) 214 public void osCollisionFilter(string name, Key id, int accept)
215 { 215 {
216 return; 216 return;
217 } 217 }
218 218
219 [Obsolete("Unimplemented")] 219 [Obsolete("Unimplemented")]
220 public void osCollisionSprite(string impact_sprite) 220 public void osCollisionSprite(string impact_sprite)
221 { 221 {
222 return; 222 return;
223 } 223 }
224 224
225 public float osCos(float theta) 225 public float osCos(float theta)
226 { 226 {
227 return (float)Math.Cos(theta); 227 return (float)Math.Cos(theta);
228 } 228 }
229 229
230 public void osCreateLink(Key target, int parent) 230 public void osCreateLink(Key target, int parent)
231 { 231 {
232 if(Scene.Entities[target] is SceneObjectGroup) 232 if(Scene.Entities[target] is SceneObjectGroup)
233 Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); 233 Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]);
234 234
235 return; 235 return;
236 } 236 }
237 237
238 [Obsolete("Partially Unimplemented")] 238 [Obsolete("Partially Unimplemented")]
239 public LSLList osDeleteSubList(LSLList src, int start, int end) 239 public LSLList osDeleteSubList(LSLList src, int start, int end)
240 { 240 {
241 if (start < 0 || end < 0) 241 if (start < 0 || end < 0)
242 { 242 {
243 throw new Exception("Unsupported at this time."); 243 throw new Exception("Unsupported at this time.");
244 } 244 }
245 245
246 src.RemoveRange(start, start - end + 1); 246 src.RemoveRange(start, start - end + 1);
247 return src; 247 return src;
248 } 248 }
249 249
250 [Obsolete("Partially Unimplemented")] 250 [Obsolete("Partially Unimplemented")]
251 public string osDeleteSubString(string src, int start, int end) 251 public string osDeleteSubString(string src, int start, int end)
252 { 252 {
253 if (start < 0 || end < 0) 253 if (start < 0 || end < 0)
254 { 254 {
255 throw new Exception("Unsupported at this time."); 255 throw new Exception("Unsupported at this time.");
256 } 256 }
257 257
258 return src.Remove(start, start - end + 1); 258 return src.Remove(start, start - end + 1);
259 } 259 }
260 260
261 [Obsolete("Unimplemented")] 261 [Obsolete("Unimplemented")]
262 public void osDetachFromAvatar(Key avatar) 262 public void osDetachFromAvatar(Key avatar)
263 { 263 {
264 return; 264 return;
265 } 265 }
266 } 266 }
267} 267}
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs
index 92c67b7..472dd06 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs
@@ -1,23 +1,23 @@
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.ExtensionsScriptModule 8namespace OpenSim.Region.ExtensionsScriptModule
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
17 public void TriggerTouchStart(Key user) 17 public void TriggerTouchStart(Key user)
18 { 18 {
19 if (OnTouchStart != null) 19 if (OnTouchStart != null)
20 OnTouchStart(user); 20 OnTouchStart(user);
21 } 21 }
22 } 22 }
23} 23}
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index 27b9c00..ac5ac89 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -1,143 +1,143 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.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; 30using OpenSim.Region.Environment;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.ExtensionsScriptModule.CSharp; 33using OpenSim.Region.ExtensionsScriptModule.CSharp;
34using OpenSim.Region.ExtensionsScriptModule.JScript; 34using OpenSim.Region.ExtensionsScriptModule.JScript;
35using OpenSim.Region.ExtensionsScriptModule.JVMEngine; 35using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
36 36
37namespace OpenSim.Region.ExtensionsScriptModule 37namespace OpenSim.Region.ExtensionsScriptModule
38{ 38{
39 public class ScriptManager : IRegionModule 39 public class ScriptManager : IRegionModule
40 { 40 {
41 List<IScript> scripts = new List<IScript>(); 41 List<IScript> scripts = new List<IScript>();
42 Scene m_scene; 42 Scene m_scene;
43 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 43 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
44 44
45 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 45 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
46 { 46 {
47 foreach (KeyValuePair<string, IScript> script in compiledscripts) 47 foreach (KeyValuePair<string, IScript> script in compiledscripts)
48 { 48 {
49 ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 49 ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
50 MainLog.Instance.Verbose("Loading " + script.Key); 50 MainLog.Instance.Verbose("Loading " + script.Key);
51 script.Value.Initialise(scriptInfo); 51 script.Value.Initialise(scriptInfo);
52 scripts.Add(script.Value); 52 scripts.Add(script.Value);
53 } 53 }
54 MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); 54 MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
55 } 55 }
56 56
57 public ScriptManager() 57 public ScriptManager()
58 { 58 {
59 // Default Engines 59 // Default Engines
60 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); 60 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
61 compilers.Add(csharpCompiler.FileExt(), csharpCompiler); 61 compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
62 62
63 JScriptEngine jscriptCompiler = new JScriptEngine(); 63 JScriptEngine jscriptCompiler = new JScriptEngine();
64 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); 64 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
65 65
66 JavaEngine javaCompiler = new JavaEngine(); 66 JavaEngine javaCompiler = new JavaEngine();
67 compilers.Add(javaCompiler.FileExt(), javaCompiler); 67 compilers.Add(javaCompiler.FileExt(), javaCompiler);
68 } 68 }
69 69
70 public void Initialise(Scene scene) 70 public void Initialise(Scene scene)
71 { 71 {
72 System.Console.WriteLine("Initialising Extensions Scripting Module"); 72 System.Console.WriteLine("Initialising Extensions Scripting Module");
73 m_scene = scene; 73 m_scene = scene;
74 74
75 m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); 75 m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile));
76 m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript)); 76 m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript));
77 } 77 }
78 78
79 public void PostInitialise() 79 public void PostInitialise()
80 { 80 {
81 81
82 } 82 }
83 83
84 public void CloseDown() 84 public void CloseDown()
85 { 85 {
86 86
87 } 87 }
88 88
89 public string GetName() 89 public string GetName()
90 { 90 {
91 return "ExtensionsScriptingModule"; 91 return "ExtensionsScriptingModule";
92 } 92 }
93 93
94 public bool IsSharedModule() 94 public bool IsSharedModule()
95 { 95 {
96 return false; 96 return false;
97 } 97 }
98 98
99 public bool Compile(string filename) 99 public bool Compile(string filename)
100 { 100 {
101 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) 101 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
102 { 102 {
103 if (filename.EndsWith(compiler.Key)) 103 if (filename.EndsWith(compiler.Key))
104 { 104 {
105 LoadFromCompiler(compiler.Value.compile(filename)); 105 LoadFromCompiler(compiler.Value.compile(filename));
106 break; 106 break;
107 } 107 }
108 } 108 }
109 109
110 return true; 110 return true;
111 } 111 }
112 112
113 public void RunScriptCmd(string[] args) 113 public void RunScriptCmd(string[] args)
114 { 114 {
115 switch (args[0]) 115 switch (args[0])
116 { 116 {
117 case "load": 117 case "load":
118 Compile(args[1]); 118 Compile(args[1]);
119 break; 119 break;
120 120
121 default: 121 default:
122 MainLog.Instance.Error("Unknown script command"); 122 MainLog.Instance.Error("Unknown script command");
123 break; 123 break;
124 } 124 }
125 } 125 }
126 126
127 public bool AddPreCompiledScript(IScript script) 127 public bool AddPreCompiledScript(IScript script)
128 { 128 {
129 MainLog.Instance.Verbose("Loading script " + script.Name); 129 MainLog.Instance.Verbose("Loading script " + script.Name);
130 ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 130 ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
131 script.Initialise(scriptInfo); 131 script.Initialise(scriptInfo);
132 scripts.Add(script); 132 scripts.Add(script);
133 133
134 return true; 134 return true;
135 } 135 }
136 } 136 }
137 137
138 interface IScriptCompiler 138 interface IScriptCompiler
139 { 139 {
140 Dictionary<string, IScript> compile(string filename); 140 Dictionary<string, IScript> compile(string filename);
141 string FileExt(); 141 string FileExt();
142 } 142 }
143} 143}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index f7aa634..ff5c6bf 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
@@ -612,7 +612,7 @@ namespace OpenSim.Region.ScriptEngine.Common
612 //wiki: integer llGetRegionFlags() 612 //wiki: integer llGetRegionFlags()
613 int llGetRegionFlags(); 613 int llGetRegionFlags();
614 //wiki: string llXorBase64StringsCorrect(string str1, string str2) 614 //wiki: string llXorBase64StringsCorrect(string str1, string str2)
615 string llXorBase64StringsCorrect(string str1, string str2); 615 string llXorBase64StringsCorrect(string str1, string str2);
616 void llHTTPRequest(string url, List<string> parameters, string body); 616 void llHTTPRequest(string url, List<string> parameters, string body);
617 //wiki: llResetLandBanList() 617 //wiki: llResetLandBanList()
618 void llResetLandBanList(); 618 void llResetLandBanList();
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 78cfd21..6603323 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -1,120 +1,120 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using Microsoft.CSharp; 5using Microsoft.CSharp;
6using System.CodeDom.Compiler; 6using System.CodeDom.Compiler;
7using System.Reflection; 7using System.Reflection;
8 8
9namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 9namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
10{ 10{
11 11
12 public class Compiler 12 public class Compiler
13 { 13 {
14 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 14 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
15 private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); 15 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
16 private static UInt64 scriptCompileCounter = 0; 16 private static UInt64 scriptCompileCounter = 0;
17 //private ICodeCompiler icc = codeProvider.CreateCompiler(); 17 //private ICodeCompiler icc = codeProvider.CreateCompiler();
18 public string CompileFromFile(string LSOFileName) 18 public string CompileFromFile(string LSOFileName)
19 { 19 {
20 switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) 20 switch (System.IO.Path.GetExtension(LSOFileName).ToLower())
21 { 21 {
22 case ".txt": 22 case ".txt":
23 case ".lsl": 23 case ".lsl":
24 Common.SendToDebug("Source code is LSL, converting to CS"); 24 Common.SendToDebug("Source code is LSL, converting to CS");
25 return CompileFromLSLText(File.ReadAllText(LSOFileName)); 25 return CompileFromLSLText(File.ReadAllText(LSOFileName));
26 case ".cs": 26 case ".cs":
27 Common.SendToDebug("Source code is CS"); 27 Common.SendToDebug("Source code is CS");
28 return CompileFromCSText(File.ReadAllText(LSOFileName)); 28 return CompileFromCSText(File.ReadAllText(LSOFileName));
29 default: 29 default:
30 throw new Exception("Unknown script type."); 30 throw new Exception("Unknown script type.");
31 } 31 }
32 } 32 }
33 /// <summary> 33 /// <summary>
34 /// Converts script from LSL to CS and calls CompileFromCSText 34 /// Converts script from LSL to CS and calls CompileFromCSText
35 /// </summary> 35 /// </summary>
36 /// <param name="Script">LSL script</param> 36 /// <param name="Script">LSL script</param>
37 /// <returns>Filename to .dll assembly</returns> 37 /// <returns>Filename to .dll assembly</returns>
38 public string CompileFromLSLText(string Script) 38 public string CompileFromLSLText(string Script)
39 { 39 {
40 if (Script.Substring(0, 4).ToLower() == "//c#") 40 if (Script.Substring(0, 4).ToLower() == "//c#")
41 { 41 {
42 return CompileFromCSText( Script ); 42 return CompileFromCSText( Script );
43 } 43 }
44 else 44 else
45 { 45 {
46 return CompileFromCSText(LSL_Converter.Convert(Script)); 46 return CompileFromCSText(LSL_Converter.Convert(Script));
47 } 47 }
48 } 48 }
49 /// <summary> 49 /// <summary>
50 /// Compile CS script to .Net assembly (.dll) 50 /// Compile CS script to .Net assembly (.dll)
51 /// </summary> 51 /// </summary>
52 /// <param name="Script">CS script</param> 52 /// <param name="Script">CS script</param>
53 /// <returns>Filename to .dll assembly</returns> 53 /// <returns>Filename to .dll assembly</returns>
54 public string CompileFromCSText(string Script) 54 public string CompileFromCSText(string Script)
55 { 55 {
56 56
57 57
58 // Output assembly name 58 // Output assembly name
59 scriptCompileCounter++; 59 scriptCompileCounter++;
60 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); 60 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
61 try 61 try
62 { 62 {
63 System.IO.File.Delete(OutFile); 63 System.IO.File.Delete(OutFile);
64 } 64 }
65 catch (Exception e) 65 catch (Exception e)
66 { 66 {
67 Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString()); 67 Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString());
68 } 68 }
69 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); 69 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
70 70
71 // DEBUG - write source to disk 71 // DEBUG - write source to disk
72 try 72 try
73 { 73 {
74 File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); 74 File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script);
75 } 75 }
76 catch { } 76 catch { }
77 77
78 // Do actual compile 78 // Do actual compile
79 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); 79 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
80 parameters.IncludeDebugInformation = true; 80 parameters.IncludeDebugInformation = true;
81 // Add all available assemblies 81 // Add all available assemblies
82 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) 82 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
83 { 83 {
84 //Console.WriteLine("Adding assembly: " + asm.Location); 84 //Console.WriteLine("Adding assembly: " + asm.Location);
85 //parameters.ReferencedAssemblies.Add(asm.Location); 85 //parameters.ReferencedAssemblies.Add(asm.Location);
86 } 86 }
87 87
88 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 88 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
89 string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); 89 string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location);
90 //Console.WriteLine("Assembly location: " + rootPath); 90 //Console.WriteLine("Assembly location: " + rootPath);
91 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); 91 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
92 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); 92 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll"));
93 93
94 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); 94 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
95 parameters.GenerateExecutable = false; 95 parameters.GenerateExecutable = false;
96 parameters.OutputAssembly = OutFile; 96 parameters.OutputAssembly = OutFile;
97 parameters.IncludeDebugInformation = false; 97 parameters.IncludeDebugInformation = false;
98 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script); 98 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script);
99 99
100 // Go through errors 100 // Go through errors
101 // TODO: Return errors to user somehow 101 // TODO: Return errors to user somehow
102 if (results.Errors.Count > 0) 102 if (results.Errors.Count > 0)
103 { 103 {
104 104
105 string errtext = ""; 105 string errtext = "";
106 foreach (CompilerError CompErr in results.Errors) 106 foreach (CompilerError CompErr in results.Errors)
107 { 107 {
108 errtext += "Line number " + (CompErr.Line - 1) + 108 errtext += "Line number " + (CompErr.Line - 1) +
109 ", Error Number: " + CompErr.ErrorNumber + 109 ", Error Number: " + CompErr.ErrorNumber +
110 ", '" + CompErr.ErrorText + "'\r\n"; 110 ", '" + CompErr.ErrorText + "'\r\n";
111 } 111 }
112 throw new Exception(errtext); 112 throw new Exception(errtext);
113 } 113 }
114 114
115 115
116 return OutFile; 116 return OutFile;
117 } 117 }
118 118
119 } 119 }
120} 120}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index 1294213..18eddd0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
45 } 45 }
46 } 46 }
47 47
48 public LSL_BuiltIn_Commands_Interface m_LSL_Functions; 48 public LSL_BuiltIn_Commands_Interface m_LSL_Functions;
49 public string SourceCode = ""; 49 public string SourceCode = "";
50 50
51 public LSL_BaseClass() 51 public LSL_BaseClass()
@@ -453,7 +453,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
453 public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } 453 public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); }
454 public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } 454 public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); }
455 public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } 455 public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); }
456 public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } 456 public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); }
457 public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } 457 public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); }
458 public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } 458 public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); }
459 public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } 459 public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index eb72d5c..a2aa713 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -1,1031 +1,1031 @@
1using Axiom.Math; 1using Axiom.Math;
2using System; 2using System;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Scenes.Scripting; 7using OpenSim.Region.Environment.Scenes.Scripting;
8using OpenSim.Region.Environment.Interfaces; 8using OpenSim.Region.Environment.Interfaces;
9using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 9using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
10using OpenSim.Region.ScriptEngine.Common; 10using OpenSim.Region.ScriptEngine.Common;
11using OpenSim.Framework.Console; 11using OpenSim.Framework.Console;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13using System.Runtime.Remoting.Lifetime; 13using System.Runtime.Remoting.Lifetime;
14 14
15namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler 15namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
16{ 16{
17 // 17 //
18 // !!!IMPORTANT!!! 18 // !!!IMPORTANT!!!
19 // 19 //
20 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status 20 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status
21 // 21 //
22 22
23 /// <summary> 23 /// <summary>
24 /// Contains all LSL ll-functions. This class will be in Default AppDomain. 24 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
25 /// </summary> 25 /// </summary>
26 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface 26 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
27 { 27 {
28 28
29 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 29 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
30 private ScriptEngine m_ScriptEngine; 30 private ScriptEngine m_ScriptEngine;
31 private SceneObjectPart m_host; 31 private SceneObjectPart m_host;
32 private uint m_localID; 32 private uint m_localID;
33 private LLUUID m_itemID; 33 private LLUUID m_itemID;
34 private bool throwErrorOnNotImplemented = true; 34 private bool throwErrorOnNotImplemented = true;
35 35
36 36
37 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) 37 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
38 { 38 {
39 m_ScriptEngine = ScriptEngine; 39 m_ScriptEngine = ScriptEngine;
40 m_host = host; 40 m_host = host;
41 m_localID = localID; 41 m_localID = localID;
42 m_itemID = itemID; 42 m_itemID = itemID;
43 43
44 44
45 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 45 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
46 } 46 }
47 47
48 48
49 private string m_state = "default"; 49 private string m_state = "default";
50 50
51 public string State() 51 public string State()
52 { 52 {
53 return m_state; 53 return m_state;
54 } 54 }
55 55
56 // Object never expires 56 // Object never expires
57 public override Object InitializeLifetimeService() 57 public override Object InitializeLifetimeService()
58 { 58 {
59 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); 59 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
60 // return null; 60 // return null;
61 ILease lease = (ILease)base.InitializeLifetimeService(); 61 ILease lease = (ILease)base.InitializeLifetimeService();
62 62
63 if (lease.CurrentState == LeaseState.Initial) 63 if (lease.CurrentState == LeaseState.Initial)
64 { 64 {
65 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); 65 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
66 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); 66 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
67 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2); 67 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
68 } 68 }
69 return lease; 69 return lease;
70 } 70 }
71 71
72 72
73 public Scene World 73 public Scene World
74 { 74 {
75 get { return m_ScriptEngine.World; } 75 get { return m_ScriptEngine.World; }
76 } 76 }
77 77
78 //These are the implementations of the various ll-functions used by the LSL scripts. 78 //These are the implementations of the various ll-functions used by the LSL scripts.
79 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 79 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
80 public double llSin(double f) { return (double)Math.Sin(f); } 80 public double llSin(double f) { return (double)Math.Sin(f); }
81 public double llCos(double f) { return (double)Math.Cos(f); } 81 public double llCos(double f) { return (double)Math.Cos(f); }
82 public double llTan(double f) { return (double)Math.Tan(f); } 82 public double llTan(double f) { return (double)Math.Tan(f); }
83 public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } 83 public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); }
84 public double llSqrt(double f) { return (double)Math.Sqrt(f); } 84 public double llSqrt(double f) { return (double)Math.Sqrt(f); }
85 public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } 85 public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); }
86 public int llAbs(int i) { return (int)Math.Abs(i); } 86 public int llAbs(int i) { return (int)Math.Abs(i); }
87 public double llFabs(double f) { return (double)Math.Abs(f); } 87 public double llFabs(double f) { return (double)Math.Abs(f); }
88 88
89 public double llFrand(double mag) 89 public double llFrand(double mag)
90 { 90 {
91 lock (Util.RandomClass) 91 lock (Util.RandomClass)
92 { 92 {
93 return Util.RandomClass.Next((int)mag); 93 return Util.RandomClass.Next((int)mag);
94 } 94 }
95 } 95 }
96 96
97 public int llFloor(double f) { return (int)Math.Floor(f); } 97 public int llFloor(double f) { return (int)Math.Floor(f); }
98 public int llCeil(double f) { return (int)Math.Ceiling(f); } 98 public int llCeil(double f) { return (int)Math.Ceiling(f); }
99 public int llRound(double f) { return (int)Math.Round(f, 3); } 99 public int llRound(double f) { return (int)Math.Round(f, 3); }
100 100
101 //This next group are vector operations involving squaring and square root. ckrinke 101 //This next group are vector operations involving squaring and square root. ckrinke
102 public double llVecMag(LSL_Types.Vector3 v) 102 public double llVecMag(LSL_Types.Vector3 v)
103 { 103 {
104 return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); 104 return (v.X * v.X + v.Y * v.Y + v.Z * v.Z);
105 } 105 }
106 106
107 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 107 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
108 { 108 {
109 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; 109 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z;
110 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 110 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
111 nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; 111 nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag;
112 return nor; 112 return nor;
113 } 113 }
114 114
115 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 115 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
116 { 116 {
117 double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; 117 double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z;
118 return Math.Sqrt(dx * dx + dy * dy + dz * dz); 118 return Math.Sqrt(dx * dx + dy * dy + dz * dz);
119 } 119 }
120 120
121 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke 121 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
122 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 122 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
123 { 123 {
124 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke 124 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
125 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); 125 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R);
126 double m = (t.X + t.Y + t.Z + t.R); 126 double m = (t.X + t.Y + t.Z + t.R);
127 if (m == 0) return new LSL_Types.Vector3(); 127 if (m == 0) return new LSL_Types.Vector3();
128 double n = 2 * (r.Y * r.R + r.X * r.Z); 128 double n = 2 * (r.Y * r.R + r.X * r.Z);
129 double p = m * m - n * n; 129 double p = m * m - n * n;
130 if (p > 0) 130 if (p > 0)
131 return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)), 131 return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)),
132 Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R))); 132 Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R)));
133 else if (n > 0) 133 else if (n > 0)
134 return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 134 return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z));
135 else 135 else
136 return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 136 return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z));
137 } 137 }
138 138
139 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) 139 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
140 { 140 {
141 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 141 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
142 float err = 0.00001f; 142 float err = 0.00001f;
143 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); 143 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2);
144 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); 144 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2);
145 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); 145 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2);
146 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); 146 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw);
147 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); 147 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
148 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); 148 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
149 LSL_Types.Quaternion a = new LSL_Types.Quaternion(); 149 LSL_Types.Quaternion a = new LSL_Types.Quaternion();
150 //This multiplication doesnt compile, yet. a = a1 * a2 * a3; 150 //This multiplication doesnt compile, yet. a = a1 * a2 * a3;
151 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, 151 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz,
152 aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); 152 aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz);
153 LSL_Types.Quaternion c = new LSL_Types.Quaternion(); 153 LSL_Types.Quaternion c = new LSL_Types.Quaternion();
154 //This addition doesnt compile yet c = a + b; 154 //This addition doesnt compile yet c = a + b;
155 LSL_Types.Quaternion d = new LSL_Types.Quaternion(); 155 LSL_Types.Quaternion d = new LSL_Types.Quaternion();
156 //This addition doesnt compile yet d = a - b; 156 //This addition doesnt compile yet d = a - b;
157 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) || 157 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) ||
158 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) || 158 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) ||
159 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) || 159 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) ||
160 (Math.Abs(c.R) > err && Math.Abs(d.R) > err)) 160 (Math.Abs(c.R) > err && Math.Abs(d.R) > err))
161 { 161 {
162 //return a new Quaternion that is null until I figure this out 162 //return a new Quaternion that is null until I figure this out
163 // return b; 163 // return b;
164 // return a; 164 // return a;
165 } 165 }
166 return new LSL_Types.Quaternion(); 166 return new LSL_Types.Quaternion();
167 } 167 }
168 168
169 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } 169 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); }
170 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 170 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); }
171 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 171 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); }
172 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 172 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); }
173 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } 173 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); }
174 174
175 public void llWhisper(int channelID, string text) 175 public void llWhisper(int channelID, string text)
176 { 176 {
177 //type for whisper is 0 177 //type for whisper is 0
178 World.SimChat(Helpers.StringToField(text), 178 World.SimChat(Helpers.StringToField(text),
179 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 179 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
180 } 180 }
181 181
182 public void llSay(int channelID, string text) 182 public void llSay(int channelID, string text)
183 { 183 {
184 //type for say is 1 184 //type for say is 1
185 185
186 World.SimChat(Helpers.StringToField(text), 186 World.SimChat(Helpers.StringToField(text),
187 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 187 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
188 } 188 }
189 189
190 public void llShout(int channelID, string text) 190 public void llShout(int channelID, string text)
191 { 191 {
192 //type for shout is 2 192 //type for shout is 2
193 World.SimChat(Helpers.StringToField(text), 193 World.SimChat(Helpers.StringToField(text),
194 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 194 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
195 } 195 }
196 196
197 public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; } 197 public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; }
198 public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; } 198 public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; }
199 public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; } 199 public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; }
200 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } 200 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; }
201 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } 201 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; }
202 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } 202 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; }
203 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } 203 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; }
204 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } 204 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; }
205 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } 205 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; }
206 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } 206 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; }
207 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } 207 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); }
208 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } 208 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); }
209 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } 209 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); }
210 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } 210 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); }
211 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } 211 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; }
212 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } 212 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; }
213 public void llDie() { NotImplemented("llDie"); return; } 213 public void llDie() { NotImplemented("llDie"); return; }
214 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } 214 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; }
215 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } 215 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; }
216 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } 216 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); }
217 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } 217 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; }
218 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } 218 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; }
219 219
220 public void llSetScale(LSL_Types.Vector3 scale) 220 public void llSetScale(LSL_Types.Vector3 scale)
221 { 221 {
222 // TODO: this needs to trigger a persistance save as well 222 // TODO: this needs to trigger a persistance save as well
223 LLVector3 tmp = m_host.Scale; 223 LLVector3 tmp = m_host.Scale;
224 tmp.X = (float)scale.X; 224 tmp.X = (float)scale.X;
225 tmp.Y = (float)scale.Y; 225 tmp.Y = (float)scale.Y;
226 tmp.Z = (float)scale.Z; 226 tmp.Z = (float)scale.Z;
227 m_host.Scale = tmp; 227 m_host.Scale = tmp;
228 return; 228 return;
229 } 229 }
230 public LSL_Types.Vector3 llGetScale() 230 public LSL_Types.Vector3 llGetScale()
231 { 231 {
232 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); 232 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
233 } 233 }
234 234
235 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } 235 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; }
236 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } 236 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; }
237 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } 237 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; }
238 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } 238 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); }
239 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } 239 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; }
240 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } 240 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; }
241 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } 241 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; }
242 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } 242 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; }
243 243
244 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } 244 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; }
245 245
246 public void llSetPos(LSL_Types.Vector3 pos) 246 public void llSetPos(LSL_Types.Vector3 pos)
247 { 247 {
248 if (m_host.ParentID != 0) 248 if (m_host.ParentID != 0)
249 { 249 {
250 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 250 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z));
251 } 251 }
252 else 252 else
253 { 253 {
254 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 254 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z));
255 } 255 }
256 } 256 }
257 257
258 public LSL_Types.Vector3 llGetPos() 258 public LSL_Types.Vector3 llGetPos()
259 { 259 {
260 return new LSL_Types.Vector3(m_host.AbsolutePosition.X, 260 return new LSL_Types.Vector3(m_host.AbsolutePosition.X,
261 m_host.AbsolutePosition.Y, 261 m_host.AbsolutePosition.Y,
262 m_host.AbsolutePosition.Z); 262 m_host.AbsolutePosition.Z);
263 } 263 }
264 264
265 public LSL_Types.Vector3 llGetLocalPos() 265 public LSL_Types.Vector3 llGetLocalPos()
266 { 266 {
267 if (m_host.ParentID != 0) 267 if (m_host.ParentID != 0)
268 { 268 {
269 return new LSL_Types.Vector3(m_host.OffsetPosition.X, 269 return new LSL_Types.Vector3(m_host.OffsetPosition.X,
270 m_host.OffsetPosition.Y, 270 m_host.OffsetPosition.Y,
271 m_host.OffsetPosition.Z); 271 m_host.OffsetPosition.Z);
272 } 272 }
273 else 273 else
274 { 274 {
275 return new LSL_Types.Vector3(m_host.AbsolutePosition.X, 275 return new LSL_Types.Vector3(m_host.AbsolutePosition.X,
276 m_host.AbsolutePosition.Y, 276 m_host.AbsolutePosition.Y,
277 m_host.AbsolutePosition.Z); 277 m_host.AbsolutePosition.Z);
278 } 278 }
279 } 279 }
280 public void llSetRot(LSL_Types.Quaternion rot) 280 public void llSetRot(LSL_Types.Quaternion rot)
281 { 281 {
282 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); 282 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R));
283 } 283 }
284 public LSL_Types.Quaternion llGetRot() 284 public LSL_Types.Quaternion llGetRot()
285 { 285 {
286 LLQuaternion q = m_host.RotationOffset; 286 LLQuaternion q = m_host.RotationOffset;
287 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 287 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
288 } 288 }
289 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } 289 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); }
290 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } 290 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); }
291 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } 291 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); }
292 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } 292 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; }
293 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } 293 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); }
294 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } 294 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; }
295 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } 295 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); }
296 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } 296 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); }
297 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } 297 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); }
298 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } 298 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); }
299 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } 299 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); }
300 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } 300 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); }
301 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } 301 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); }
302 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } 302 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); }
303 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } 303 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); }
304 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } 304 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); }
305 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } 305 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); }
306 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } 306 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; }
307 307
308 public double llGetWallclock() 308 public double llGetWallclock()
309 { 309 {
310 return DateTime.Now.TimeOfDay.TotalSeconds; 310 return DateTime.Now.TimeOfDay.TotalSeconds;
311 } 311 }
312 312
313 public double llGetTime() { NotImplemented("llGetTime"); return 0; } 313 public double llGetTime() { NotImplemented("llGetTime"); return 0; }
314 public void llResetTime() { NotImplemented("llResetTime"); } 314 public void llResetTime() { NotImplemented("llResetTime"); }
315 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } 315 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; }
316 public void llSound() { NotImplemented("llSound"); } 316 public void llSound() { NotImplemented("llSound"); }
317 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } 317 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); }
318 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } 318 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); }
319 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } 319 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); }
320 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } 320 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); }
321 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } 321 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); }
322 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } 322 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); }
323 public void llStopSound() { NotImplemented("llStopSound"); } 323 public void llStopSound() { NotImplemented("llStopSound"); }
324 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } 324 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); }
325 325
326 public string llGetSubString(string src, int start, int end) 326 public string llGetSubString(string src, int start, int end)
327 { 327 {
328 return src.Substring(start, end); 328 return src.Substring(start, end);
329 } 329 }
330 330
331 public string llDeleteSubString(string src, int start, int end) 331 public string llDeleteSubString(string src, int start, int end)
332 { 332 {
333 return src.Remove(start, end - start); 333 return src.Remove(start, end - start);
334 } 334 }
335 public string llInsertString(string dst, int position, string src) 335 public string llInsertString(string dst, int position, string src)
336 { 336 {
337 return dst.Insert(position, src); 337 return dst.Insert(position, src);
338 } 338 }
339 public string llToUpper(string src) 339 public string llToUpper(string src)
340 { 340 {
341 return src.ToUpper(); 341 return src.ToUpper();
342 } 342 }
343 343
344 public string llToLower(string src) 344 public string llToLower(string src)
345 { 345 {
346 return src.ToLower(); 346 return src.ToLower();
347 } 347 }
348 348
349 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } 349 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; }
350 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } 350 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); }
351 public void llMakeFountain() { NotImplemented("llMakeFountain"); } 351 public void llMakeFountain() { NotImplemented("llMakeFountain"); }
352 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } 352 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); }
353 public void llMakeFire() { NotImplemented("llMakeFire"); } 353 public void llMakeFire() { NotImplemented("llMakeFire"); }
354 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } 354 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); }
355 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } 355 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); }
356 public void llStopLookAt() { NotImplemented("llStopLookAt"); } 356 public void llStopLookAt() { NotImplemented("llStopLookAt"); }
357 357
358 public void llSetTimerEvent(double sec) 358 public void llSetTimerEvent(double sec)
359 { 359 {
360 // Setting timer repeat 360 // Setting timer repeat
361 m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); 361 m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
362 } 362 }
363 363
364 public void llSleep(double sec) 364 public void llSleep(double sec)
365 { 365 {
366 System.Threading.Thread.Sleep((int)(sec * 1000)); 366 System.Threading.Thread.Sleep((int)(sec * 1000));
367 } 367 }
368 368
369 public double llGetMass() { NotImplemented("llGetMass"); return 0; } 369 public double llGetMass() { NotImplemented("llGetMass"); return 0; }
370 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } 370 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); }
371 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } 371 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); }
372 public void llReleaseControls() { NotImplemented("llReleaseControls"); } 372 public void llReleaseControls() { NotImplemented("llReleaseControls"); }
373 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } 373 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); }
374 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } 374 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); }
375 public void llTakeCamera() { NotImplemented("llTakeCamera"); } 375 public void llTakeCamera() { NotImplemented("llTakeCamera"); }
376 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } 376 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); }
377 377
378 public string llGetOwner() 378 public string llGetOwner()
379 { 379 {
380 return m_host.ObjectOwner.ToStringHyphenated(); 380 return m_host.ObjectOwner.ToStringHyphenated();
381 } 381 }
382 382
383 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } 383 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); }
384 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } 384 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); }
385 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } 385 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); }
386 386
387 public string llGetKey() 387 public string llGetKey()
388 { 388 {
389 return m_host.UUID.ToStringHyphenated(); 389 return m_host.UUID.ToStringHyphenated();
390 } 390 }
391 391
392 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } 392 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); }
393 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } 393 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); }
394 public void llStopHover() { NotImplemented("llStopHover"); } 394 public void llStopHover() { NotImplemented("llStopHover"); }
395 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } 395 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); }
396 public void llSoundPreload() { NotImplemented("llSoundPreload"); } 396 public void llSoundPreload() { NotImplemented("llSoundPreload"); }
397 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } 397 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); }
398 398
399 public int llStringLength(string str) 399 public int llStringLength(string str)
400 { 400 {
401 if (str.Length > 0) 401 if (str.Length > 0)
402 { 402 {
403 return str.Length; 403 return str.Length;
404 } 404 }
405 else 405 else
406 { 406 {
407 return 0; 407 return 0;
408 } 408 }
409 } 409 }
410 410
411 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } 411 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); }
412 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } 412 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); }
413 public void llPointAt() { NotImplemented("llPointAt"); } 413 public void llPointAt() { NotImplemented("llPointAt"); }
414 public void llStopPointAt() { NotImplemented("llStopPointAt"); } 414 public void llStopPointAt() { NotImplemented("llStopPointAt"); }
415 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } 415 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); }
416 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } 416 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; }
417 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } 417 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); }
418 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } 418 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); }
419 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } 419 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; }
420 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } 420 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; }
421 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } 421 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; }
422 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } 422 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); }
423 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } 423 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); }
424 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } 424 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); }
425 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } 425 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); }
426 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } 426 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; }
427 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } 427 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); }
428 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } 428 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; }
429 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } 429 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; }
430 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } 430 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); }
431 public double llGetEnergy() { return 1.0f; } 431 public double llGetEnergy() { return 1.0f; }
432 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } 432 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); }
433 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } 433 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); }
434 434
435 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 435 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
436 { 436 {
437 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); 437 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z);
438 m_host.SetText(text, av3, alpha); 438 m_host.SetText(text, av3, alpha);
439 } 439 }
440 440
441 441
442 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } 442 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; }
443 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } 443 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); }
444 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } 444 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; }
445 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } 445 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; }
446 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } 446 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); }
447 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } 447 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); }
448 public void llModifyLand(int action, int brush) { } 448 public void llModifyLand(int action, int brush) { }
449 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } 449 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); }
450 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } 450 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); }
451 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } 451 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; }
452 public void llResetScript() 452 public void llResetScript()
453 { 453 {
454 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); 454 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
455 } 455 }
456 public void llMessageLinked(int linknum, int num, string str, string id) { } 456 public void llMessageLinked(int linknum, int num, string str, string id) { }
457 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } 457 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { }
458 public void llPassCollisions(int pass) { } 458 public void llPassCollisions(int pass) { }
459 public string llGetScriptName() { return ""; } 459 public string llGetScriptName() { return ""; }
460 460
461 public int llGetNumberOfSides() { return 0; } 461 public int llGetNumberOfSides() { return 0; }
462 462
463 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } 463 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); }
464 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } 464 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); }
465 public void llRot2Angle() { } 465 public void llRot2Angle() { }
466 466
467 public double llAcos(double val) 467 public double llAcos(double val)
468 { 468 {
469 return (double)Math.Acos(val); 469 return (double)Math.Acos(val);
470 } 470 }
471 471
472 public double llAsin(double val) 472 public double llAsin(double val)
473 { 473 {
474 return (double)Math.Asin(val); 474 return (double)Math.Asin(val);
475 } 475 }
476 476
477 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } 477 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; }
478 public string llGetInventoryKey(string name) { return ""; } 478 public string llGetInventoryKey(string name) { return ""; }
479 public void llAllowInventoryDrop(int add) { } 479 public void llAllowInventoryDrop(int add) { }
480 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } 480 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); }
481 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } 481 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); }
482 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } 482 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); }
483 public double llGetTextureRot(int side) { return 0; } 483 public double llGetTextureRot(int side) { return 0; }
484 484
485 public int llSubStringIndex(string source, string pattern) 485 public int llSubStringIndex(string source, string pattern)
486 { 486 {
487 return source.IndexOf(pattern); 487 return source.IndexOf(pattern);
488 } 488 }
489 489
490 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } 490 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; }
491 491
492 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } 492 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); }
493 493
494 public List<string> llListSort(List<string> src, int stride, int ascending) 494 public List<string> llListSort(List<string> src, int stride, int ascending)
495 { 495 {
496 SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); 496 SortedList<string, List<string>> sorted = new SortedList<string, List<string>>();
497 // Add chunks to an array 497 // Add chunks to an array
498 int s = stride; 498 int s = stride;
499 if (s < 1) 499 if (s < 1)
500 s = 1; 500 s = 1;
501 int c = 0; 501 int c = 0;
502 List<string> chunk = new List<string>(); 502 List<string> chunk = new List<string>();
503 string chunkString = ""; 503 string chunkString = "";
504 foreach (string element in src) 504 foreach (string element in src)
505 { 505 {
506 c++; 506 c++;
507 if (c > s) 507 if (c > s)
508 { 508 {
509 sorted.Add(chunkString, chunk); 509 sorted.Add(chunkString, chunk);
510 chunkString = ""; 510 chunkString = "";
511 chunk = new List<string>(); 511 chunk = new List<string>();
512 c = 0; 512 c = 0;
513 } 513 }
514 chunk.Add(element); 514 chunk.Add(element);
515 chunkString += element.ToString(); 515 chunkString += element.ToString();
516 } 516 }
517 if (chunk.Count > 0) 517 if (chunk.Count > 0)
518 sorted.Add(chunkString, chunk); 518 sorted.Add(chunkString, chunk);
519 519
520 List<string> ret = new List<string>(); 520 List<string> ret = new List<string>();
521 foreach (List<string> ls in sorted.Values) 521 foreach (List<string> ls in sorted.Values)
522 { 522 {
523 ret.AddRange(ls); 523 ret.AddRange(ls);
524 } 524 }
525 525
526 if (ascending == LSL.LSL_BaseClass.TRUE) 526 if (ascending == LSL.LSL_BaseClass.TRUE)
527 return ret; 527 return ret;
528 ret.Reverse(); 528 ret.Reverse();
529 return ret; 529 return ret;
530 } 530 }
531 531
532 public int llGetListLength(List<string> src) 532 public int llGetListLength(List<string> src)
533 { 533 {
534 return src.Count; 534 return src.Count;
535 } 535 }
536 536
537 public int llList2Integer(List<string> src, int index) 537 public int llList2Integer(List<string> src, int index)
538 { 538 {
539 return Convert.ToInt32(src[index]); 539 return Convert.ToInt32(src[index]);
540 } 540 }
541 541
542 public double llList2double(List<string> src, int index) 542 public double llList2double(List<string> src, int index)
543 { 543 {
544 return Convert.ToDouble(src[index]); 544 return Convert.ToDouble(src[index]);
545 } 545 }
546 546
547 public float llList2Float(List<string> src, int index) 547 public float llList2Float(List<string> src, int index)
548 { 548 {
549 return Convert.ToSingle(src[index]); 549 return Convert.ToSingle(src[index]);
550 } 550 }
551 551
552 public string llList2String(List<string> src, int index) 552 public string llList2String(List<string> src, int index)
553 { 553 {
554 return src[index]; 554 return src[index];
555 } 555 }
556 556
557 public string llList2Key(List<string> src, int index) 557 public string llList2Key(List<string> src, int index)
558 { 558 {
559 //return OpenSim.Framework.Types.ToStringHyphenated(src[index]); 559 //return OpenSim.Framework.Types.ToStringHyphenated(src[index]);
560 return src[index].ToString(); 560 return src[index].ToString();
561 } 561 }
562 562
563 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 563 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
564 { 564 {
565 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); 565 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]));
566 } 566 }
567 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 567 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
568 { 568 {
569 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); 569 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3]));
570 } 570 }
571 public List<string> llList2List(List<string> src, int start, int end) 571 public List<string> llList2List(List<string> src, int start, int end)
572 { 572 {
573 if (end > start) 573 if (end > start)
574 { 574 {
575 // Simple straight forward chunk 575 // Simple straight forward chunk
576 return src.GetRange(start, end - start); 576 return src.GetRange(start, end - start);
577 } 577 }
578 else 578 else
579 { 579 {
580 // Some of the end + some of the beginning 580 // Some of the end + some of the beginning
581 // First chunk 581 // First chunk
582 List<string> ret = new List<string>(); 582 List<string> ret = new List<string>();
583 ret.AddRange(src.GetRange(start, src.Count - start)); 583 ret.AddRange(src.GetRange(start, src.Count - start));
584 ret.AddRange(src.GetRange(0, end)); 584 ret.AddRange(src.GetRange(0, end));
585 return ret; 585 return ret;
586 } 586 }
587 587
588 588
589 589
590 590
591 } 591 }
592 public List<string> llDeleteSubList(List<string> src, int start, int end) 592 public List<string> llDeleteSubList(List<string> src, int start, int end)
593 { 593 {
594 List<string> ret = new List<string>(src); 594 List<string> ret = new List<string>(src);
595 ret.RemoveRange(start, end - start); 595 ret.RemoveRange(start, end - start);
596 return ret; 596 return ret;
597 } 597 }
598 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } 598 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; }
599 public string llList2CSV(List<string> src) 599 public string llList2CSV(List<string> src)
600 { 600 {
601 string ret = ""; 601 string ret = "";
602 foreach (string s in src) 602 foreach (string s in src)
603 { 603 {
604 if (s.Length > 0) 604 if (s.Length > 0)
605 ret += ","; 605 ret += ",";
606 ret += s; 606 ret += s;
607 } 607 }
608 return ret; 608 return ret;
609 } 609 }
610 public List<string> llCSV2List(string src) 610 public List<string> llCSV2List(string src)
611 { 611 {
612 List<string> ret = new List<string>(); 612 List<string> ret = new List<string>();
613 foreach (string s in src.Split(",".ToCharArray())) 613 foreach (string s in src.Split(",".ToCharArray()))
614 { 614 {
615 ret.Add(s); 615 ret.Add(s);
616 } 616 }
617 return ret; 617 return ret;
618 } 618 }
619 public List<string> llListRandomize(List<string> src, int stride) 619 public List<string> llListRandomize(List<string> src, int stride)
620 { 620 {
621 int s = stride; 621 int s = stride;
622 if (s < 1) 622 if (s < 1)
623 s = 1; 623 s = 1;
624 624
625 // This is a cowardly way of doing it ;) 625 // This is a cowardly way of doing it ;)
626 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange 626 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange
627 List<List<string>> tmp = new List<List<string>>(); 627 List<List<string>> tmp = new List<List<string>>();
628 628
629 // Add chunks to an array 629 // Add chunks to an array
630 int c = 0; 630 int c = 0;
631 List<string> chunk = new List<string>(); 631 List<string> chunk = new List<string>();
632 foreach (string element in src) 632 foreach (string element in src)
633 { 633 {
634 c++; 634 c++;
635 if (c > s) 635 if (c > s)
636 { 636 {
637 tmp.Add(chunk); 637 tmp.Add(chunk);
638 chunk = new List<string>(); 638 chunk = new List<string>();
639 c = 0; 639 c = 0;
640 } 640 }
641 chunk.Add(element); 641 chunk.Add(element);
642 } 642 }
643 if (chunk.Count > 0) 643 if (chunk.Count > 0)
644 tmp.Add(chunk); 644 tmp.Add(chunk);
645 645
646 // Decreate (<- what kind of word is that? :D ) array back into a list 646 // Decreate (<- what kind of word is that? :D ) array back into a list
647 int rnd; 647 int rnd;
648 List<string> ret = new List<string>(); 648 List<string> ret = new List<string>();
649 while (tmp.Count > 0) 649 while (tmp.Count > 0)
650 { 650 {
651 rnd = Util.RandomClass.Next(tmp.Count); 651 rnd = Util.RandomClass.Next(tmp.Count);
652 foreach (string str in tmp[rnd]) 652 foreach (string str in tmp[rnd])
653 { 653 {
654 ret.Add(str); 654 ret.Add(str);
655 } 655 }
656 tmp.RemoveAt(rnd); 656 tmp.RemoveAt(rnd);
657 } 657 }
658 658
659 return ret; 659 return ret;
660 660
661 661
662 } 662 }
663 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 663 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
664 { 664 {
665 List<string> ret = new List<string>(); 665 List<string> ret = new List<string>();
666 int s = stride; 666 int s = stride;
667 if (s < 1) 667 if (s < 1)
668 s = 1; 668 s = 1;
669 669
670 int sc = s; 670 int sc = s;
671 for (int i = start; i < src.Count; i++) 671 for (int i = start; i < src.Count; i++)
672 { 672 {
673 sc--; 673 sc--;
674 if (sc == 0) 674 if (sc == 0)
675 { 675 {
676 sc = s; 676 sc = s;
677 // Addthis 677 // Addthis
678 ret.Add(src[i]); 678 ret.Add(src[i]);
679 } 679 }
680 if (i == end) 680 if (i == end)
681 break; 681 break;
682 } 682 }
683 return ret; 683 return ret;
684 } 684 }
685 685
686 public LSL_Types.Vector3 llGetRegionCorner() 686 public LSL_Types.Vector3 llGetRegionCorner()
687 { 687 {
688 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 688 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0);
689 } 689 }
690 690
691 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 691 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
692 { 692 {
693 693
694 List<string> ret = new List<string>(dest); 694 List<string> ret = new List<string>(dest);
695 //foreach (string s in src.Reverse()) 695 //foreach (string s in src.Reverse())
696 for (int ci = src.Count - 1; ci > -1; ci--) 696 for (int ci = src.Count - 1; ci > -1; ci--)
697 { 697 {
698 ret.Insert(start, src[ci]); 698 ret.Insert(start, src[ci]);
699 } 699 }
700 return ret; 700 return ret;
701 } 701 }
702 public int llListFindList(List<string> src, List<string> test) 702 public int llListFindList(List<string> src, List<string> test)
703 { 703 {
704 foreach (string s in test) 704 foreach (string s in test)
705 { 705 {
706 for (int ci = 0; ci < src.Count; ci++) 706 for (int ci = 0; ci < src.Count; ci++)
707 { 707 {
708 708
709 if (s == src[ci]) 709 if (s == src[ci])
710 return ci; 710 return ci;
711 } 711 }
712 } 712 }
713 return -1; 713 return -1;
714 } 714 }
715 715
716 public string llGetObjectName() 716 public string llGetObjectName()
717 { 717 {
718 return m_host.Name; 718 return m_host.Name;
719 } 719 }
720 720
721 public void llSetObjectName(string name) 721 public void llSetObjectName(string name)
722 { 722 {
723 m_host.Name = name; 723 m_host.Name = name;
724 } 724 }
725 725
726 public string llGetDate() 726 public string llGetDate()
727 { 727 {
728 DateTime date = DateTime.Now.ToUniversalTime(); 728 DateTime date = DateTime.Now.ToUniversalTime();
729 string result = date.ToString("yyyy-MM-dd"); 729 string result = date.ToString("yyyy-MM-dd");
730 return result; 730 return result;
731 } 731 }
732 732
733 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } 733 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; }
734 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } 734 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; }
735 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } 735 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); }
736 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } 736 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); }
737 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } 737 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); }
738 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } 738 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; }
739 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } 739 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); }
740 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } 740 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); }
741 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } 741 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); }
742 742
743 public void llParseString2List() { NotImplemented("llParseString2List"); } 743 public void llParseString2List() { NotImplemented("llParseString2List"); }
744 744
745 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } 745 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; }
746 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } 746 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; }
747 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } 747 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; }
748 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } 748 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); }
749 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } 749 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; }
750 public void llUnSit(string id) { NotImplemented("llUnSit"); } 750 public void llUnSit(string id) { NotImplemented("llUnSit"); }
751 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } 751 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); }
752 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } 752 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); }
753 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } 753 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); }
754 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } 754 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; }
755 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } 755 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; }
756 756
757 public string llGetRegionName() 757 public string llGetRegionName()
758 { 758 {
759 return World.RegionInfo.RegionName; 759 return World.RegionInfo.RegionName;
760 } 760 }
761 761
762 public double llGetRegionTimeDilation() { return 1.0f; } 762 public double llGetRegionTimeDilation() { return 1.0f; }
763 public double llGetRegionFPS() { return 10.0f; } 763 public double llGetRegionFPS() { return 10.0f; }
764 public void llParticleSystem(List<Object> rules) { NotImplemented("llParticleSystem"); } 764 public void llParticleSystem(List<Object> rules) { NotImplemented("llParticleSystem"); }
765 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } 765 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); }
766 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } 766 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); }
767 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } 767 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); }
768 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } 768 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); }
769 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } 769 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); }
770 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } 770 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); }
771 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } 771 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); }
772 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } 772 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); }
773 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } 773 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); }
774 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } 774 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; }
775 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } 775 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); }
776 776
777 public void llSetTouchText(string text) 777 public void llSetTouchText(string text)
778 { 778 {
779 m_host.TouchName = text; 779 m_host.TouchName = text;
780 } 780 }
781 781
782 public void llSetSitText(string text) 782 public void llSetSitText(string text)
783 { 783 {
784 m_host.SitName = text; 784 m_host.SitName = text;
785 } 785 }
786 786
787 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } 787 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); }
788 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } 788 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); }
789 public void llDumpList2String() { NotImplemented("llDumpList2String"); } 789 public void llDumpList2String() { NotImplemented("llDumpList2String"); }
790 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } 790 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); }
791 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); } 791 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); }
792 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); } 792 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); }
793 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); } 793 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); }
794 794
795 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } 795 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; }
796 796
797 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } 797 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); }
798 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } 798 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); }
799 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } 799 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); }
800 public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); } 800 public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); }
801 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } 801 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; }
802 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); } 802 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); }
803 public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); } 803 public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); }
804 804
805 public string llMD5String(string src, int nonce) 805 public string llMD5String(string src, int nonce)
806 { 806 {
807 return Util.Md5Hash(src + ":" + nonce.ToString()); 807 return Util.Md5Hash(src + ":" + nonce.ToString());
808 } 808 }
809 809
810 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } 810 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); }
811 public string llStringToBase64(string str) 811 public string llStringToBase64(string str)
812 { 812 {
813 813
814 try 814 try
815 { 815 {
816 byte[] encData_byte = new byte[str.Length]; 816 byte[] encData_byte = new byte[str.Length];
817 encData_byte = System.Text.Encoding.UTF8.GetBytes(str); 817 encData_byte = System.Text.Encoding.UTF8.GetBytes(str);
818 string encodedData = Convert.ToBase64String(encData_byte); 818 string encodedData = Convert.ToBase64String(encData_byte);
819 return encodedData; 819 return encodedData;
820 } 820 }
821 catch (Exception e) 821 catch (Exception e)
822 { 822 {
823 throw new Exception("Error in base64Encode" + e.Message); 823 throw new Exception("Error in base64Encode" + e.Message);
824 } 824 }
825 } 825 }
826 826
827 public string llBase64ToString(string str) 827 public string llBase64ToString(string str)
828 { 828 {
829 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 829 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
830 System.Text.Decoder utf8Decode = encoder.GetDecoder(); 830 System.Text.Decoder utf8Decode = encoder.GetDecoder();
831 try 831 try
832 { 832 {
833 833
834 byte[] todecode_byte = Convert.FromBase64String(str); 834 byte[] todecode_byte = Convert.FromBase64String(str);
835 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 835 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
836 char[] decoded_char = new char[charCount]; 836 char[] decoded_char = new char[charCount];
837 utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); 837 utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
838 string result = new String(decoded_char); 838 string result = new String(decoded_char);
839 return result; 839 return result;
840 } 840 }
841 catch (Exception e) 841 catch (Exception e)
842 { 842 {
843 throw new Exception("Error in base64Decode" + e.Message); 843 throw new Exception("Error in base64Decode" + e.Message);
844 } 844 }
845 } 845 }
846 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } 846 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); }
847 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } 847 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); }
848 public double llLog10(double val) { return (double)Math.Log10(val); } 848 public double llLog10(double val) { return (double)Math.Log10(val); }
849 public double llLog(double val) { return (double)Math.Log(val); } 849 public double llLog(double val) { return (double)Math.Log(val); }
850 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); } 850 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); }
851 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); } 851 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); }
852 852
853 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } 853 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); }
854 854
855 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } 855 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); }
856 856
857 public string llGetObjectDesc() 857 public string llGetObjectDesc()
858 { 858 {
859 return m_host.Description; 859 return m_host.Description;
860 } 860 }
861 861
862 public void llSetObjectDesc(string desc) 862 public void llSetObjectDesc(string desc)
863 { 863 {
864 m_host.Description = desc; 864 m_host.Description = desc;
865 } 865 }
866 866
867 public string llGetCreator() 867 public string llGetCreator()
868 { 868 {
869 return m_host.ObjectCreator.ToStringHyphenated(); 869 return m_host.ObjectCreator.ToStringHyphenated();
870 } 870 }
871 871
872 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } 872 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); }
873 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } 873 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); }
874 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } 874 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; }
875 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } 875 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; }
876 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } 876 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); }
877 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } 877 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); }
878 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } 878 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); }
879 public string llIntegerToBase64(int number) 879 public string llIntegerToBase64(int number)
880 { 880 {
881 NotImplemented("llIntegerToBase64"); return ""; 881 NotImplemented("llIntegerToBase64"); return "";
882 } 882 }
883 public int llBase64ToInteger(string str) 883 public int llBase64ToInteger(string str)
884 { 884 {
885 NotImplemented("llBase64ToInteger"); return 0; 885 NotImplemented("llBase64ToInteger"); return 0;
886 } 886 }
887 887
888 public double llGetGMTclock() 888 public double llGetGMTclock()
889 { 889 {
890 return DateTime.UtcNow.TimeOfDay.TotalSeconds; 890 return DateTime.UtcNow.TimeOfDay.TotalSeconds;
891 } 891 }
892 892
893 public string llGetSimulatorHostname() 893 public string llGetSimulatorHostname()
894 { 894 {
895 return System.Environment.MachineName; 895 return System.Environment.MachineName;
896 } 896 }
897 897
898 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } 898 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); }
899 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } 899 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); }
900 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } 900 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); }
901 901
902 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } 902 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; }
903 903
904 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } 904 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); }
905 905
906 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } 906 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); }
907 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } 907 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); }
908 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } 908 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; }
909 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } 909 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); }
910 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } 910 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); }
911 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } 911 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); }
912 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } 912 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; }
913 public void llListReplaceList() { NotImplemented("llListReplaceList"); } 913 public void llListReplaceList() { NotImplemented("llListReplaceList"); }
914 914
915 public void llLoadURL(string avatar_id, string message, string url) 915 public void llLoadURL(string avatar_id, string message, string url)
916 { 916 {
917 LLUUID avatarId = new LLUUID(avatar_id); 917 LLUUID avatarId = new LLUUID(avatar_id);
918 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); 918 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url);
919 } 919 }
920 920
921 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } 921 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); }
922 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } 922 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); }
923 923
924 public int llModPow(int a, int b, int c) 924 public int llModPow(int a, int b, int c)
925 { 925 {
926 Int64 tmp = 0; 926 Int64 tmp = 0;
927 Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); 927 Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
928 return Convert.ToInt32(tmp); 928 return Convert.ToInt32(tmp);
929 } 929 }
930 930
931 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } 931 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; }
932 932
933 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } 933 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); }
934 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } 934 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); }
935 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } 935 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); }
936 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } 936 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); }
937 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } 937 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); }
938 938
939 public string llEscapeURL(string url) 939 public string llEscapeURL(string url)
940 { 940 {
941 try 941 try
942 { 942 {
943 return Uri.EscapeUriString(url); 943 return Uri.EscapeUriString(url);
944 } 944 }
945 catch (Exception ex) 945 catch (Exception ex)
946 { 946 {
947 return "llEscapeURL: " + ex.ToString(); 947 return "llEscapeURL: " + ex.ToString();
948 } 948 }
949 } 949 }
950 950
951 public string llUnescapeURL(string url) 951 public string llUnescapeURL(string url)
952 { 952 {
953 try 953 try
954 { 954 {
955 return Uri.UnescapeDataString(url); 955 return Uri.UnescapeDataString(url);
956 } 956 }
957 catch (Exception ex) 957 catch (Exception ex)
958 { 958 {
959 return "llUnescapeURL: " + ex.ToString(); 959 return "llUnescapeURL: " + ex.ToString();
960 } 960 }
961 } 961 }
962 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } 962 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); }
963 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } 963 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); }
964 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } 964 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); }
965 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } 965 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); }
966 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } 966 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); }
967 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } 967 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); }
968 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } 968 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; }
969 969
970 public int llGetUnixTime() 970 public int llGetUnixTime()
971 { 971 {
972 return Util.UnixTimeSinceEpoch(); 972 return Util.UnixTimeSinceEpoch();
973 } 973 }
974 974
975 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } 975 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; }
976 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } 976 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; }
977 public string llXorBase64StringsCorrect(string str1, string str2) 977 public string llXorBase64StringsCorrect(string str1, string str2)
978 { 978 {
979 string ret = ""; 979 string ret = "";
980 string src1 = llBase64ToString(str1); 980 string src1 = llBase64ToString(str1);
981 string src2 = llBase64ToString(str2); 981 string src2 = llBase64ToString(str2);
982 int c = 0; 982 int c = 0;
983 for (int i = 0; i < src1.Length; i++) 983 for (int i = 0; i < src1.Length; i++)
984 { 984 {
985 ret += src1[i] ^ src2[c]; 985 ret += src1[i] ^ src2[c];
986 986
987 c++; 987 c++;
988 if (c > src2.Length) 988 if (c > src2.Length)
989 c = 0; 989 c = 0;
990 } 990 }
991 return llStringToBase64(ret); 991 return llStringToBase64(ret);
992 } 992 }
993 public void llHTTPRequest(string url, List<string> parameters, string body) 993 public void llHTTPRequest(string url, List<string> parameters, string body)
994 { 994 {
995 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); 995 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body);
996 } 996 }
997 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } 997 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); }
998 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } 998 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); }
999 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } 999 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; }
1000 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } 1000 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); }
1001 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } 1001 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; }
1002 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } 1002 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; }
1003 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } 1003 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); }
1004 1004
1005 // 1005 //
1006 // OpenSim functions 1006 // OpenSim functions
1007 // 1007 //
1008 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) 1008 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer)
1009 { 1009 {
1010 if (dynamicID == "") 1010 if (dynamicID == "")
1011 { 1011 {
1012 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); 1012 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>();
1013 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer); 1013 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer);
1014 return createdTexture.ToStringHyphenated(); 1014 return createdTexture.ToStringHyphenated();
1015 } 1015 }
1016 else 1016 else
1017 { 1017 {
1018 //TODO update existing dynamic textures 1018 //TODO update existing dynamic textures
1019 } 1019 }
1020 1020
1021 return LLUUID.Zero.ToStringHyphenated(); 1021 return LLUUID.Zero.ToStringHyphenated();
1022 } 1022 }
1023 1023
1024 private void NotImplemented(string Command) 1024 private void NotImplemented(string Command)
1025 { 1025 {
1026 if (throwErrorOnNotImplemented) 1026 if (throwErrorOnNotImplemented)
1027 throw new NotImplementedException("Command not implemented: " + Command); 1027 throw new NotImplementedException("Command not implemented: " + Command);
1028 } 1028 }
1029 1029
1030 } 1030 }
1031} 1031}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index a45de1e..8ab0c30 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -1,262 +1,262 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Threading; 4using System.Threading;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Region.ScriptEngine.Common; 6using OpenSim.Region.ScriptEngine.Common;
7 7
8namespace OpenSim.Region.ScriptEngine.DotNetEngine 8namespace OpenSim.Region.ScriptEngine.DotNetEngine
9{ 9{
10 /// <summary> 10 /// <summary>
11 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. 11 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
12 /// </summary> 12 /// </summary>
13 class LSLLongCmdHandler 13 class LSLLongCmdHandler
14 { 14 {
15 private Thread cmdHandlerThread; 15 private Thread cmdHandlerThread;
16 private int cmdHandlerThreadCycleSleepms = 100; 16 private int cmdHandlerThreadCycleSleepms = 100;
17 17
18 private ScriptEngine m_ScriptEngine; 18 private ScriptEngine m_ScriptEngine;
19 public LSLLongCmdHandler(ScriptEngine _ScriptEngine) 19 public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
20 { 20 {
21 m_ScriptEngine = _ScriptEngine; 21 m_ScriptEngine = _ScriptEngine;
22 22
23 // Start the thread that will be doing the work 23 // Start the thread that will be doing the work
24 cmdHandlerThread = new Thread(CmdHandlerThreadLoop); 24 cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
25 cmdHandlerThread.Name = "CmdHandlerThread"; 25 cmdHandlerThread.Name = "CmdHandlerThread";
26 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 26 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
27 cmdHandlerThread.IsBackground = true; 27 cmdHandlerThread.IsBackground = true;
28 cmdHandlerThread.Start(); 28 cmdHandlerThread.Start();
29 } 29 }
30 ~LSLLongCmdHandler() 30 ~LSLLongCmdHandler()
31 { 31 {
32 // Shut down thread 32 // Shut down thread
33 try 33 try
34 { 34 {
35 if (cmdHandlerThread != null) 35 if (cmdHandlerThread != null)
36 { 36 {
37 if (cmdHandlerThread.IsAlive == true) 37 if (cmdHandlerThread.IsAlive == true)
38 { 38 {
39 cmdHandlerThread.Abort(); 39 cmdHandlerThread.Abort();
40 cmdHandlerThread.Join(); 40 cmdHandlerThread.Join();
41 } 41 }
42 } 42 }
43 } 43 }
44 catch { } 44 catch { }
45 } 45 }
46 46
47 private void CmdHandlerThreadLoop() 47 private void CmdHandlerThreadLoop()
48 { 48 {
49 while (true) 49 while (true)
50 { 50 {
51 // Check timers 51 // Check timers
52 CheckTimerEvents(); 52 CheckTimerEvents();
53 // Check HttpRequests 53 // Check HttpRequests
54 CheckHttpRequests(); 54 CheckHttpRequests();
55 55
56 // Sleep before next cycle 56 // Sleep before next cycle
57 Thread.Sleep(cmdHandlerThreadCycleSleepms); 57 Thread.Sleep(cmdHandlerThreadCycleSleepms);
58 } 58 }
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// Remove a specific script (and all its pending commands) 62 /// Remove a specific script (and all its pending commands)
63 /// </summary> 63 /// </summary>
64 /// <param name="m_localID"></param> 64 /// <param name="m_localID"></param>
65 /// <param name="m_itemID"></param> 65 /// <param name="m_itemID"></param>
66 public void RemoveScript(uint localID, LLUUID itemID) 66 public void RemoveScript(uint localID, LLUUID itemID)
67 { 67 {
68 // Remove a specific script 68 // Remove a specific script
69 69
70 // Remove from: Timers 70 // Remove from: Timers
71 UnSetTimerEvents(localID, itemID); 71 UnSetTimerEvents(localID, itemID);
72 // Remove from: HttpRequest 72 // Remove from: HttpRequest
73 StopHttpRequest(localID, itemID); 73 StopHttpRequest(localID, itemID);
74 } 74 }
75 75
76 #region TIMER 76 #region TIMER
77 77
78 // 78 //
79 // TIMER 79 // TIMER
80 // 80 //
81 private class TimerClass 81 private class TimerClass
82 { 82 {
83 public uint localID; 83 public uint localID;
84 public LLUUID itemID; 84 public LLUUID itemID;
85 public double interval; 85 public double interval;
86 public DateTime next; 86 public DateTime next;
87 } 87 }
88 private List<TimerClass> Timers = new List<TimerClass>(); 88 private List<TimerClass> Timers = new List<TimerClass>();
89 private object TimerListLock = new object(); 89 private object TimerListLock = new object();
90 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) 90 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec)
91 { 91 {
92 Console.WriteLine("SetTimerEvent"); 92 Console.WriteLine("SetTimerEvent");
93 93
94 // Always remove first, in case this is a re-set 94 // Always remove first, in case this is a re-set
95 UnSetTimerEvents(m_localID, m_itemID); 95 UnSetTimerEvents(m_localID, m_itemID);
96 if (sec == 0) // Disabling timer 96 if (sec == 0) // Disabling timer
97 return; 97 return;
98 98
99 // Add to timer 99 // Add to timer
100 TimerClass ts = new TimerClass(); 100 TimerClass ts = new TimerClass();
101 ts.localID = m_localID; 101 ts.localID = m_localID;
102 ts.itemID = m_itemID; 102 ts.itemID = m_itemID;
103 ts.interval = sec; 103 ts.interval = sec;
104 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 104 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
105 lock (TimerListLock) 105 lock (TimerListLock)
106 { 106 {
107 Timers.Add(ts); 107 Timers.Add(ts);
108 } 108 }
109 } 109 }
110 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) 110 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID)
111 { 111 {
112 // Remove from timer 112 // Remove from timer
113 lock (TimerListLock) 113 lock (TimerListLock)
114 { 114 {
115 List<TimerClass> NewTimers = new List<TimerClass>(); 115 List<TimerClass> NewTimers = new List<TimerClass>();
116 foreach (TimerClass ts in Timers) 116 foreach (TimerClass ts in Timers)
117 { 117 {
118 if (ts.localID != m_localID && ts.itemID != m_itemID) 118 if (ts.localID != m_localID && ts.itemID != m_itemID)
119 { 119 {
120 NewTimers.Add(ts); 120 NewTimers.Add(ts);
121 } 121 }
122 } 122 }
123 Timers.Clear(); 123 Timers.Clear();
124 Timers = NewTimers; 124 Timers = NewTimers;
125 } 125 }
126 } 126 }
127 public void CheckTimerEvents() 127 public void CheckTimerEvents()
128 { 128 {
129 // Nothing to do here? 129 // Nothing to do here?
130 if (Timers.Count == 0) 130 if (Timers.Count == 0)
131 return; 131 return;
132 132
133 lock (TimerListLock) 133 lock (TimerListLock)
134 { 134 {
135 135
136 // Go through all timers 136 // Go through all timers
137 foreach (TimerClass ts in Timers) 137 foreach (TimerClass ts in Timers)
138 { 138 {
139 // Time has passed? 139 // Time has passed?
140 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 140 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
141 { 141 {
142 // Add it to queue 142 // Add it to queue
143 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); 143 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
144 // set next interval 144 // set next interval
145 145
146 146
147 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 147 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
148 } 148 }
149 } 149 }
150 } // lock 150 } // lock
151 } 151 }
152 #endregion 152 #endregion
153 153
154 #region HTTP REQUEST 154 #region HTTP REQUEST
155 155
156 // 156 //
157 // HTTP REAQUEST 157 // HTTP REAQUEST
158 // 158 //
159 private class HttpClass 159 private class HttpClass
160 { 160 {
161 public uint localID; 161 public uint localID;
162 public LLUUID itemID; 162 public LLUUID itemID;
163 public string url; 163 public string url;
164 public List<string> parameters; 164 public List<string> parameters;
165 public string body; 165 public string body;
166 public DateTime next; 166 public DateTime next;
167 167
168 public string response_request_id; 168 public string response_request_id;
169 public int response_status; 169 public int response_status;
170 public List<string> response_metadata; 170 public List<string> response_metadata;
171 public string response_body; 171 public string response_body;
172 172
173 public void SendRequest() 173 public void SendRequest()
174 { 174 {
175 // TODO: SEND REQUEST!!! 175 // TODO: SEND REQUEST!!!
176 } 176 }
177 public void Stop() 177 public void Stop()
178 { 178 {
179 // TODO: Cancel any ongoing request 179 // TODO: Cancel any ongoing request
180 } 180 }
181 public bool CheckResponse() 181 public bool CheckResponse()
182 { 182 {
183 // TODO: Check if we got a response yet, return true if so -- false if not 183 // TODO: Check if we got a response yet, return true if so -- false if not
184 return true; 184 return true;
185 185
186 // TODO: If we got a response, set the following then return true 186 // TODO: If we got a response, set the following then return true
187 //response_request_id 187 //response_request_id
188 //response_status 188 //response_status
189 //response_metadata 189 //response_metadata
190 //response_body 190 //response_body
191 191
192 } 192 }
193 } 193 }
194 private List<HttpClass> HttpRequests = new List<HttpClass>(); 194 private List<HttpClass> HttpRequests = new List<HttpClass>();
195 private object HttpListLock = new object(); 195 private object HttpListLock = new object();
196 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 196 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
197 { 197 {
198 Console.WriteLine("StartHttpRequest"); 198 Console.WriteLine("StartHttpRequest");
199 199
200 HttpClass htc = new HttpClass(); 200 HttpClass htc = new HttpClass();
201 htc.localID = localID; 201 htc.localID = localID;
202 htc.itemID = itemID; 202 htc.itemID = itemID;
203 htc.url = url; 203 htc.url = url;
204 htc.parameters = parameters; 204 htc.parameters = parameters;
205 htc.body = body; 205 htc.body = body;
206 lock (HttpListLock) 206 lock (HttpListLock)
207 { 207 {
208 208
209 //ADD REQUEST 209 //ADD REQUEST
210 HttpRequests.Add(htc); 210 HttpRequests.Add(htc);
211 } 211 }
212 } 212 }
213 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 213 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
214 { 214 {
215 // Remove from list 215 // Remove from list
216 lock (HttpListLock) 216 lock (HttpListLock)
217 { 217 {
218 List<HttpClass> NewHttpList = new List<HttpClass>(); 218 List<HttpClass> NewHttpList = new List<HttpClass>();
219 foreach (HttpClass ts in HttpRequests) 219 foreach (HttpClass ts in HttpRequests)
220 { 220 {
221 if (ts.localID != m_localID && ts.itemID != m_itemID) 221 if (ts.localID != m_localID && ts.itemID != m_itemID)
222 { 222 {
223 // Keeping this one 223 // Keeping this one
224 NewHttpList.Add(ts); 224 NewHttpList.Add(ts);
225 } 225 }
226 else 226 else
227 { 227 {
228 // Shutting this one down 228 // Shutting this one down
229 ts.Stop(); 229 ts.Stop();
230 } 230 }
231 } 231 }
232 HttpRequests.Clear(); 232 HttpRequests.Clear();
233 HttpRequests = NewHttpList; 233 HttpRequests = NewHttpList;
234 } 234 }
235 } 235 }
236 public void CheckHttpRequests() 236 public void CheckHttpRequests()
237 { 237 {
238 // Nothing to do here? 238 // Nothing to do here?
239 if (HttpRequests.Count == 0) 239 if (HttpRequests.Count == 0)
240 return; 240 return;
241 241
242 lock (HttpListLock) 242 lock (HttpListLock)
243 { 243 {
244 foreach (HttpClass ts in HttpRequests) 244 foreach (HttpClass ts in HttpRequests)
245 { 245 {
246 246
247 if (ts.CheckResponse() == true) 247 if (ts.CheckResponse() == true)
248 { 248 {
249 // Add it to event queue 249 // Add it to event queue
250 //key request_id, integer status, list metadata, string body 250 //key request_id, integer status, list metadata, string body
251 object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; 251 object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body };
252 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); 252 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj);
253 // Now stop it 253 // Now stop it
254 StopHttpRequest(ts.localID, ts.itemID); 254 StopHttpRequest(ts.localID, ts.itemID);
255 } 255 }
256 } 256 }
257 } // lock 257 } // lock
258 } 258 }
259 #endregion 259 #endregion
260 260
261 } 261 }
262} 262}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 20300c0..e1989c4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -246,12 +246,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
246 ls.localID = localID; 246 ls.localID = localID;
247 ls.itemID = itemID; 247 ls.itemID = itemID;
248 unloadQueue.Enqueue(ls); 248 unloadQueue.Enqueue(ls);
249 } 249 }
250 public void ResetScript(uint localID, LLUUID itemID) 250 public void ResetScript(uint localID, LLUUID itemID)
251 { 251 {
252 string script = GetScript(localID, itemID).SourceCode; 252 string script = GetScript(localID, itemID).SourceCode;
253 StopScript(localID, itemID); 253 StopScript(localID, itemID);
254 StartScript(localID, itemID, script); 254 StartScript(localID, itemID, script);
255 } 255 }
256 256
257 private void _StartScript(uint localID, LLUUID itemID, string Script) 257 private void _StartScript(uint localID, LLUUID itemID, string Script)
@@ -288,8 +288,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
288 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); 288 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
289#if DEBUG 289#if DEBUG
290 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 290 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
291#endif 291#endif
292 292
293 CompiledScript.SourceCode = ScriptSource; 293 CompiledScript.SourceCode = ScriptSource;
294 // Add it to our script memstruct 294 // Add it to our script memstruct
295 SetScript(localID, itemID, CompiledScript); 295 SetScript(localID, itemID, CompiledScript);
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
index 3f7ab68..60dbf62 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
@@ -1,52 +1,52 @@
1/* 1/*
2Redistribution and use in source and binary forms, with or without 2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are 3modification, are permitted provided that the following conditions are
4met: 4met:
5 5
6 * Redistributions of source code must retain the above copyright 6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer. 7 notice, this list of conditions and the following disclaimer.
8 8
9 * Redistributions in binary form must reproduce the above 9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following 10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided 11 disclaimer in the documentation and/or other materials provided
12 with the distribution. 12 with the distribution.
13 13
14 * Neither the name of libTerrain nor the names of 14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products 15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written 16 derived from this software without specific prior written
17 permission. 17 permission.
18 18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/ 30*/
31 31
32using System; 32using System;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using System.Text; 34using System.Text;
35 35
36namespace libTerrain 36namespace libTerrain
37{ 37{
38 class Tools 38 class Tools
39 { 39 {
40 public static double linearInterpolate(double a, double b, double amount) 40 public static double linearInterpolate(double a, double b, double amount)
41 { 41 {
42 return a + ((b - a) * amount); 42 return a + ((b - a) * amount);
43 } 43 }
44 public static double exponentialInterpolate(double a, double b, double amount) 44 public static double exponentialInterpolate(double a, double b, double amount)
45 { 45 {
46 a = Math.Pow(a, amount); 46 a = Math.Pow(a, amount);
47 b = Math.Pow(b - a, 1.0 - amount); 47 b = Math.Pow(b - a, 1.0 - amount);
48 return a+b; 48 return a+b;
49 } 49 }
50 public static int powerOf2Log2(int n) { 50 public static int powerOf2Log2(int n) {
51 for (int i = 0; i < 31; i++) { 51 for (int i = 0; i < 31; i++) {
52 if ((n & 1) == 1) { 52 if ((n & 1) == 1) {
@@ -55,6 +55,6 @@ namespace libTerrain
55 n >>= 1; 55 n >>= 1;
56 } 56 }
57 return 0; 57 return 0;
58 } 58 }
59 } 59 }
60} 60}