diff options
author | Sean Dague | 2007-09-17 12:52:03 +0000 |
---|---|---|
committer | Sean Dague | 2007-09-17 12:52:03 +0000 |
commit | b8d9737a47696952bedec33dface8f18df47341f (patch) | |
tree | 9279f45510f8a9285ac5b9c9165ab6c741009eac | |
parent | I think this is the last bits for a consistant pristine (diff) | |
download | opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.zip opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.tar.gz opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.tar.bz2 opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.tar.xz |
fixing me some line endings
Diffstat (limited to '')
89 files changed, 9444 insertions, 9444 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index 8c63b30..e5329ec 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs | |||
@@ -1,393 +1,393 @@ | |||
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 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Threading; | 30 | using System.Threading; |
31 | using Db4objects.Db4o; | 31 | using Db4objects.Db4o; |
32 | using Db4objects.Db4o.Query; | 32 | using Db4objects.Db4o.Query; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Interfaces; | 36 | using OpenSim.Framework.Interfaces; |
37 | using OpenSim.Framework.Types; | 37 | using OpenSim.Framework.Types; |
38 | using OpenSim.Framework.Utilities; | 38 | using OpenSim.Framework.Utilities; |
39 | 39 | ||
40 | namespace OpenSim.Framework.Communications.Caches | 40 | namespace OpenSim.Framework.Communications.Caches |
41 | { | 41 | { |
42 | 42 | ||
43 | public class LocalAssetServer : IAssetServer | 43 | public class LocalAssetServer : IAssetServer |
44 | { | 44 | { |
45 | private IAssetReceiver _receiver; | 45 | private IAssetReceiver _receiver; |
46 | private BlockingQueue<ARequest> _assetRequests; | 46 | private BlockingQueue<ARequest> _assetRequests; |
47 | private IObjectContainer db; | 47 | private IObjectContainer db; |
48 | private Thread _localAssetServerThread; | 48 | private Thread _localAssetServerThread; |
49 | 49 | ||
50 | public LocalAssetServer() | 50 | public LocalAssetServer() |
51 | { | 51 | { |
52 | System.Console.WriteLine("Starting Db4o asset storage system"); | 52 | System.Console.WriteLine("Starting Db4o asset storage system"); |
53 | bool yapfile; | 53 | bool yapfile; |
54 | this._assetRequests = new BlockingQueue<ARequest>(); | 54 | this._assetRequests = new BlockingQueue<ARequest>(); |
55 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); | 55 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); |
56 | 56 | ||
57 | MainLog.Instance.Verbose("Local Asset Server class created"); | 57 | MainLog.Instance.Verbose("Local Asset Server class created"); |
58 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); | 58 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); |
59 | MainLog.Instance.Verbose("Db4 Asset database creation"); | 59 | MainLog.Instance.Verbose("Db4 Asset database creation"); |
60 | 60 | ||
61 | if (!yapfile) | 61 | if (!yapfile) |
62 | { | 62 | { |
63 | this.SetUpAssetDatabase(); | 63 | this.SetUpAssetDatabase(); |
64 | } | 64 | } |
65 | 65 | ||
66 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); | 66 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); |
67 | this._localAssetServerThread.IsBackground = true; | 67 | this._localAssetServerThread.IsBackground = true; |
68 | this._localAssetServerThread.Start(); | 68 | this._localAssetServerThread.Start(); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | public void SetReceiver(IAssetReceiver receiver) | 72 | public void SetReceiver(IAssetReceiver receiver) |
73 | { | 73 | { |
74 | this._receiver = receiver; | 74 | this._receiver = receiver; |
75 | } | 75 | } |
76 | 76 | ||
77 | public void FetchAsset(LLUUID assetID, bool isTexture) | 77 | public void FetchAsset(LLUUID assetID, bool isTexture) |
78 | { | 78 | { |
79 | ARequest req = new ARequest(); | 79 | ARequest req = new ARequest(); |
80 | req.AssetID = assetID; | 80 | req.AssetID = assetID; |
81 | req.IsTexture = isTexture; | 81 | req.IsTexture = isTexture; |
82 | this._assetRequests.Enqueue(req); | 82 | this._assetRequests.Enqueue(req); |
83 | } | 83 | } |
84 | 84 | ||
85 | public void UpdateAsset(AssetBase asset) | 85 | public void UpdateAsset(AssetBase asset) |
86 | { | 86 | { |
87 | 87 | ||
88 | } | 88 | } |
89 | 89 | ||
90 | public void CreateAsset(AssetBase asset) | 90 | public void CreateAsset(AssetBase asset) |
91 | { | 91 | { |
92 | AssetStorage store = new AssetStorage(); | 92 | AssetStorage store = new AssetStorage(); |
93 | store.Data = asset.Data; | 93 | store.Data = asset.Data; |
94 | store.Name = asset.Name; | 94 | store.Name = asset.Name; |
95 | store.UUID = asset.FullID; | 95 | store.UUID = asset.FullID; |
96 | db.Set(store); | 96 | db.Set(store); |
97 | db.Commit(); | 97 | db.Commit(); |
98 | } | 98 | } |
99 | 99 | ||
100 | public void SetServerInfo(string ServerUrl, string ServerKey) | 100 | public void SetServerInfo(string ServerUrl, string ServerKey) |
101 | { | 101 | { |
102 | 102 | ||
103 | } | 103 | } |
104 | public void Close() | 104 | public void Close() |
105 | { | 105 | { |
106 | if (db != null) | 106 | if (db != null) |
107 | { | 107 | { |
108 | MainLog.Instance.Verbose("Closing local asset server database"); | 108 | MainLog.Instance.Verbose("Closing local asset server database"); |
109 | db.Close(); | 109 | db.Close(); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | private void RunRequests() | 113 | private void RunRequests() |
114 | { | 114 | { |
115 | while (true) | 115 | while (true) |
116 | { | 116 | { |
117 | byte[] idata = null; | 117 | byte[] idata = null; |
118 | bool found = false; | 118 | bool found = false; |
119 | AssetStorage foundAsset = null; | 119 | AssetStorage foundAsset = null; |
120 | ARequest req = this._assetRequests.Dequeue(); | 120 | ARequest req = this._assetRequests.Dequeue(); |
121 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); | 121 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); |
122 | if (result.Count > 0) | 122 | if (result.Count > 0) |
123 | { | 123 | { |
124 | foundAsset = (AssetStorage)result.Next(); | 124 | foundAsset = (AssetStorage)result.Next(); |
125 | found = true; | 125 | found = true; |
126 | } | 126 | } |
127 | 127 | ||
128 | AssetBase asset = new AssetBase(); | 128 | AssetBase asset = new AssetBase(); |
129 | if (found) | 129 | if (found) |
130 | { | 130 | { |
131 | asset.FullID = foundAsset.UUID; | 131 | asset.FullID = foundAsset.UUID; |
132 | asset.Type = foundAsset.Type; | 132 | asset.Type = foundAsset.Type; |
133 | asset.InvType = foundAsset.Type; | 133 | asset.InvType = foundAsset.Type; |
134 | asset.Name = foundAsset.Name; | 134 | asset.Name = foundAsset.Name; |
135 | idata = foundAsset.Data; | 135 | idata = foundAsset.Data; |
136 | asset.Data = idata; | 136 | asset.Data = idata; |
137 | _receiver.AssetReceived(asset, req.IsTexture); | 137 | _receiver.AssetReceived(asset, req.IsTexture); |
138 | } | 138 | } |
139 | else | 139 | else |
140 | { | 140 | { |
141 | //asset.FullID = ; | 141 | //asset.FullID = ; |
142 | _receiver.AssetNotFound(req.AssetID); | 142 | _receiver.AssetNotFound(req.AssetID); |
143 | } | 143 | } |
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | private void SetUpAssetDatabase() | 149 | private void SetUpAssetDatabase() |
150 | { | 150 | { |
151 | MainLog.Instance.Verbose("Setting up asset database"); | 151 | MainLog.Instance.Verbose("Setting up asset database"); |
152 | 152 | ||
153 | AssetBase Image = new AssetBase(); | 153 | AssetBase Image = new AssetBase(); |
154 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | 154 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); |
155 | Image.Name = "Bricks"; | 155 | Image.Name = "Bricks"; |
156 | this.LoadAsset(Image, true, "bricks.jp2"); | 156 | this.LoadAsset(Image, true, "bricks.jp2"); |
157 | AssetStorage store = new AssetStorage(); | 157 | AssetStorage store = new AssetStorage(); |
158 | store.Data = Image.Data; | 158 | store.Data = Image.Data; |
159 | store.Name = Image.Name; | 159 | store.Name = Image.Name; |
160 | store.UUID = Image.FullID; | 160 | store.UUID = Image.FullID; |
161 | db.Set(store); | 161 | db.Set(store); |
162 | db.Commit(); | 162 | db.Commit(); |
163 | 163 | ||
164 | Image = new AssetBase(); | 164 | Image = new AssetBase(); |
165 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | 165 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); |
166 | Image.Name = "Plywood"; | 166 | Image.Name = "Plywood"; |
167 | this.LoadAsset(Image, true, "plywood.jp2"); | 167 | this.LoadAsset(Image, true, "plywood.jp2"); |
168 | store = new AssetStorage(); | 168 | store = new AssetStorage(); |
169 | store.Data = Image.Data; | 169 | store.Data = Image.Data; |
170 | store.Name = Image.Name; | 170 | store.Name = Image.Name; |
171 | store.UUID = Image.FullID; | 171 | store.UUID = Image.FullID; |
172 | db.Set(store); | 172 | db.Set(store); |
173 | db.Commit(); | 173 | db.Commit(); |
174 | 174 | ||
175 | Image = new AssetBase(); | 175 | Image = new AssetBase(); |
176 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | 176 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); |
177 | Image.Name = "Rocks"; | 177 | Image.Name = "Rocks"; |
178 | this.LoadAsset(Image, true, "rocks.jp2"); | 178 | this.LoadAsset(Image, true, "rocks.jp2"); |
179 | store = new AssetStorage(); | 179 | store = new AssetStorage(); |
180 | store.Data = Image.Data; | 180 | store.Data = Image.Data; |
181 | store.Name = Image.Name; | 181 | store.Name = Image.Name; |
182 | store.UUID = Image.FullID; | 182 | store.UUID = Image.FullID; |
183 | db.Set(store); | 183 | db.Set(store); |
184 | db.Commit(); | 184 | db.Commit(); |
185 | 185 | ||
186 | Image = new AssetBase(); | 186 | Image = new AssetBase(); |
187 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | 187 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); |
188 | Image.Name = "Granite"; | 188 | Image.Name = "Granite"; |
189 | this.LoadAsset(Image, true, "granite.jp2"); | 189 | this.LoadAsset(Image, true, "granite.jp2"); |
190 | store = new AssetStorage(); | 190 | store = new AssetStorage(); |
191 | store.Data = Image.Data; | 191 | store.Data = Image.Data; |
192 | store.Name = Image.Name; | 192 | store.Name = Image.Name; |
193 | store.UUID = Image.FullID; | 193 | store.UUID = Image.FullID; |
194 | db.Set(store); | 194 | db.Set(store); |
195 | db.Commit(); | 195 | db.Commit(); |
196 | 196 | ||
197 | Image = new AssetBase(); | 197 | Image = new AssetBase(); |
198 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | 198 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); |
199 | Image.Name = "Hardwood"; | 199 | Image.Name = "Hardwood"; |
200 | this.LoadAsset(Image, true, "hardwood.jp2"); | 200 | this.LoadAsset(Image, true, "hardwood.jp2"); |
201 | store = new AssetStorage(); | 201 | store = new AssetStorage(); |
202 | store.Data = Image.Data; | 202 | store.Data = Image.Data; |
203 | store.Name = Image.Name; | 203 | store.Name = Image.Name; |
204 | store.UUID = Image.FullID; | 204 | store.UUID = Image.FullID; |
205 | db.Set(store); | 205 | db.Set(store); |
206 | db.Commit(); | 206 | db.Commit(); |
207 | 207 | ||
208 | Image = new AssetBase(); | 208 | Image = new AssetBase(); |
209 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | 209 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); |
210 | Image.Name = "Prim Base Texture"; | 210 | Image.Name = "Prim Base Texture"; |
211 | this.LoadAsset(Image, true, "plywood.jp2"); | 211 | this.LoadAsset(Image, true, "plywood.jp2"); |
212 | store = new AssetStorage(); | 212 | store = new AssetStorage(); |
213 | store.Data = Image.Data; | 213 | store.Data = Image.Data; |
214 | store.Name = Image.Name; | 214 | store.Name = Image.Name; |
215 | store.UUID = Image.FullID; | 215 | store.UUID = Image.FullID; |
216 | db.Set(store); | 216 | db.Set(store); |
217 | db.Commit(); | 217 | db.Commit(); |
218 | 218 | ||
219 | Image = new AssetBase(); | 219 | Image = new AssetBase(); |
220 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 220 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
221 | Image.Name = "Map Base Texture"; | 221 | Image.Name = "Map Base Texture"; |
222 | this.LoadAsset(Image, true, "map_base.jp2"); | 222 | this.LoadAsset(Image, true, "map_base.jp2"); |
223 | store = new AssetStorage(); | 223 | store = new AssetStorage(); |
224 | store.Data = Image.Data; | 224 | store.Data = Image.Data; |
225 | store.Name = Image.Name; | 225 | store.Name = Image.Name; |
226 | store.UUID = Image.FullID; | 226 | store.UUID = Image.FullID; |
227 | db.Set(store); | 227 | db.Set(store); |
228 | db.Commit(); | 228 | db.Commit(); |
229 | 229 | ||
230 | Image = new AssetBase(); | 230 | Image = new AssetBase(); |
231 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); | 231 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); |
232 | Image.Name = "Map Texture"; | 232 | Image.Name = "Map Texture"; |
233 | this.LoadAsset(Image, true, "map1.jp2"); | 233 | this.LoadAsset(Image, true, "map1.jp2"); |
234 | store = new AssetStorage(); | 234 | store = new AssetStorage(); |
235 | store.Data = Image.Data; | 235 | store.Data = Image.Data; |
236 | store.Name = Image.Name; | 236 | store.Name = Image.Name; |
237 | store.UUID = Image.FullID; | 237 | store.UUID = Image.FullID; |
238 | db.Set(store); | 238 | db.Set(store); |
239 | db.Commit(); | 239 | db.Commit(); |
240 | 240 | ||
241 | Image = new AssetBase(); | 241 | Image = new AssetBase(); |
242 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); | 242 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); |
243 | Image.Name = "Female Body Texture"; | 243 | Image.Name = "Female Body Texture"; |
244 | this.LoadAsset(Image, true, "femalebody.jp2"); | 244 | this.LoadAsset(Image, true, "femalebody.jp2"); |
245 | store = new AssetStorage(); | 245 | store = new AssetStorage(); |
246 | store.Data = Image.Data; | 246 | store.Data = Image.Data; |
247 | store.Name = Image.Name; | 247 | store.Name = Image.Name; |
248 | store.UUID = Image.FullID; | 248 | store.UUID = Image.FullID; |
249 | db.Set(store); | 249 | db.Set(store); |
250 | db.Commit(); | 250 | db.Commit(); |
251 | 251 | ||
252 | Image = new AssetBase(); | 252 | Image = new AssetBase(); |
253 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); | 253 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); |
254 | Image.Name = "Female Bottom Texture"; | 254 | Image.Name = "Female Bottom Texture"; |
255 | this.LoadAsset(Image, true, "femalebottom.jp2"); | 255 | this.LoadAsset(Image, true, "femalebottom.jp2"); |
256 | store = new AssetStorage(); | 256 | store = new AssetStorage(); |
257 | store.Data = Image.Data; | 257 | store.Data = Image.Data; |
258 | store.Name = Image.Name; | 258 | store.Name = Image.Name; |
259 | store.UUID = Image.FullID; | 259 | store.UUID = Image.FullID; |
260 | db.Set(store); | 260 | db.Set(store); |
261 | db.Commit(); | 261 | db.Commit(); |
262 | 262 | ||
263 | Image = new AssetBase(); | 263 | Image = new AssetBase(); |
264 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); | 264 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); |
265 | Image.Name = "Female Face Texture"; | 265 | Image.Name = "Female Face Texture"; |
266 | this.LoadAsset(Image, true, "femaleface.jp2"); | 266 | this.LoadAsset(Image, true, "femaleface.jp2"); |
267 | store = new AssetStorage(); | 267 | store = new AssetStorage(); |
268 | store.Data = Image.Data; | 268 | store.Data = Image.Data; |
269 | store.Name = Image.Name; | 269 | store.Name = Image.Name; |
270 | store.UUID = Image.FullID; | 270 | store.UUID = Image.FullID; |
271 | db.Set(store); | 271 | db.Set(store); |
272 | db.Commit(); | 272 | db.Commit(); |
273 | 273 | ||
274 | Image = new AssetBase(); | 274 | Image = new AssetBase(); |
275 | Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); | 275 | Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); |
276 | Image.Name = "Skin"; | 276 | Image.Name = "Skin"; |
277 | Image.Type = 13; | 277 | Image.Type = 13; |
278 | Image.InvType = 13; | 278 | Image.InvType = 13; |
279 | this.LoadAsset(Image, false, "base_skin.dat"); | 279 | this.LoadAsset(Image, false, "base_skin.dat"); |
280 | store = new AssetStorage(); | 280 | store = new AssetStorage(); |
281 | store.Data = Image.Data; | 281 | store.Data = Image.Data; |
282 | store.Name = Image.Name; | 282 | store.Name = Image.Name; |
283 | store.UUID = Image.FullID; | 283 | store.UUID = Image.FullID; |
284 | db.Set(store); | 284 | db.Set(store); |
285 | db.Commit(); | 285 | db.Commit(); |
286 | 286 | ||
287 | 287 | ||
288 | Image = new AssetBase(); | 288 | Image = new AssetBase(); |
289 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 289 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
290 | Image.Name = "Shape"; | 290 | Image.Name = "Shape"; |
291 | Image.Type = 13; | 291 | Image.Type = 13; |
292 | Image.InvType = 13; | 292 | Image.InvType = 13; |
293 | this.LoadAsset(Image, false, "base_shape.dat"); | 293 | this.LoadAsset(Image, false, "base_shape.dat"); |
294 | store = new AssetStorage(); | 294 | store = new AssetStorage(); |
295 | store.Data = Image.Data; | 295 | store.Data = Image.Data; |
296 | store.Name = Image.Name; | 296 | store.Name = Image.Name; |
297 | store.UUID = Image.FullID; | 297 | store.UUID = Image.FullID; |
298 | db.Set(store); | 298 | db.Set(store); |
299 | db.Commit(); | 299 | db.Commit(); |
300 | 300 | ||
301 | Image = new AssetBase(); | 301 | Image = new AssetBase(); |
302 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); | 302 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); |
303 | Image.Name = "Shirt"; | 303 | Image.Name = "Shirt"; |
304 | Image.Type = 5; | 304 | Image.Type = 5; |
305 | Image.InvType = 18; | 305 | Image.InvType = 18; |
306 | this.LoadAsset(Image, false, "newshirt.dat"); | 306 | this.LoadAsset(Image, false, "newshirt.dat"); |
307 | store = new AssetStorage(); | 307 | store = new AssetStorage(); |
308 | store.Data = Image.Data; | 308 | store.Data = Image.Data; |
309 | store.Name = Image.Name; | 309 | store.Name = Image.Name; |
310 | store.UUID = Image.FullID; | 310 | store.UUID = Image.FullID; |
311 | db.Set(store); | 311 | db.Set(store); |
312 | db.Commit(); | 312 | db.Commit(); |
313 | 313 | ||
314 | Image = new AssetBase(); | 314 | Image = new AssetBase(); |
315 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); | 315 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); |
316 | Image.Name = "Shirt"; | 316 | Image.Name = "Shirt"; |
317 | Image.Type = 5; | 317 | Image.Type = 5; |
318 | Image.InvType = 18; | 318 | Image.InvType = 18; |
319 | this.LoadAsset(Image, false, "newpants.dat"); | 319 | this.LoadAsset(Image, false, "newpants.dat"); |
320 | store = new AssetStorage(); | 320 | store = new AssetStorage(); |
321 | store.Data = Image.Data; | 321 | store.Data = Image.Data; |
322 | store.Name = Image.Name; | 322 | store.Name = Image.Name; |
323 | store.UUID = Image.FullID; | 323 | store.UUID = Image.FullID; |
324 | db.Set(store); | 324 | db.Set(store); |
325 | db.Commit(); | 325 | db.Commit(); |
326 | 326 | ||
327 | string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); | 327 | string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); |
328 | if (File.Exists(filePath)) | 328 | if (File.Exists(filePath)) |
329 | { | 329 | { |
330 | XmlConfigSource source = new XmlConfigSource(filePath); | 330 | XmlConfigSource source = new XmlConfigSource(filePath); |
331 | ReadAssetDetails(source); | 331 | ReadAssetDetails(source); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | protected void ReadAssetDetails(IConfigSource source) | 335 | protected void ReadAssetDetails(IConfigSource source) |
336 | { | 336 | { |
337 | AssetBase newAsset = null; | 337 | AssetBase newAsset = null; |
338 | for (int i = 0; i < source.Configs.Count; i++) | 338 | for (int i = 0; i < source.Configs.Count; i++) |
339 | { | 339 | { |
340 | newAsset = new AssetBase(); | 340 | newAsset = new AssetBase(); |
341 | newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); | 341 | newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); |
342 | newAsset.Name = source.Configs[i].GetString("name", ""); | 342 | newAsset.Name = source.Configs[i].GetString("name", ""); |
343 | newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); | 343 | newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); |
344 | newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); | 344 | newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); |
345 | string fileName = source.Configs[i].GetString("fileName", ""); | 345 | string fileName = source.Configs[i].GetString("fileName", ""); |
346 | if (fileName != "") | 346 | if (fileName != "") |
347 | { | 347 | { |
348 | this.LoadAsset(newAsset, false, fileName); | 348 | this.LoadAsset(newAsset, false, fileName); |
349 | AssetStorage store = new AssetStorage(); | 349 | AssetStorage store = new AssetStorage(); |
350 | store.Data = newAsset.Data; | 350 | store.Data = newAsset.Data; |
351 | store.Name = newAsset.Name; | 351 | store.Name = newAsset.Name; |
352 | store.UUID = newAsset.FullID; | 352 | store.UUID = newAsset.FullID; |
353 | db.Set(store); | 353 | db.Set(store); |
354 | db.Commit(); | 354 | db.Commit(); |
355 | } | 355 | } |
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | private void LoadAsset(AssetBase info, bool image, string filename) | 359 | private void LoadAsset(AssetBase info, bool image, string filename) |
360 | { | 360 | { |
361 | //should request Asset from storage manager | 361 | //should request Asset from storage manager |
362 | //but for now read from file | 362 | //but for now read from file |
363 | 363 | ||
364 | string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; | 364 | string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; |
365 | string fileName = Path.Combine(dataPath, filename); | 365 | string fileName = Path.Combine(dataPath, filename); |
366 | FileInfo fInfo = new FileInfo(fileName); | 366 | FileInfo fInfo = new FileInfo(fileName); |
367 | long numBytes = fInfo.Length; | 367 | long numBytes = fInfo.Length; |
368 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | 368 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); |
369 | byte[] idata = new byte[numBytes]; | 369 | byte[] idata = new byte[numBytes]; |
370 | BinaryReader br = new BinaryReader(fStream); | 370 | BinaryReader br = new BinaryReader(fStream); |
371 | idata = br.ReadBytes((int)numBytes); | 371 | idata = br.ReadBytes((int)numBytes); |
372 | br.Close(); | 372 | br.Close(); |
373 | fStream.Close(); | 373 | fStream.Close(); |
374 | info.Data = idata; | 374 | info.Data = idata; |
375 | //info.loaded=true; | 375 | //info.loaded=true; |
376 | } | 376 | } |
377 | } | 377 | } |
378 | public class AssetUUIDQuery : Predicate | 378 | public class AssetUUIDQuery : Predicate |
379 | { | 379 | { |
380 | private LLUUID _findID; | 380 | private LLUUID _findID; |
381 | 381 | ||
382 | public AssetUUIDQuery(LLUUID find) | 382 | public AssetUUIDQuery(LLUUID find) |
383 | { | 383 | { |
384 | _findID = find; | 384 | _findID = find; |
385 | } | 385 | } |
386 | public bool Match(AssetStorage asset) | 386 | public bool Match(AssetStorage asset) |
387 | { | 387 | { |
388 | return (asset.UUID == _findID); | 388 | return (asset.UUID == _findID); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index a965ee0..a64d195 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
44 | private IAssetReceiver _receiver; | 44 | private IAssetReceiver _receiver; |
45 | private BlockingQueue<ARequest> _assetRequests; | 45 | private BlockingQueue<ARequest> _assetRequests; |
46 | private Thread _localAssetServerThread; | 46 | private Thread _localAssetServerThread; |
47 | protected IAssetProvider m_plugin; | 47 | protected IAssetProvider m_plugin; |
48 | private object syncLock = new object(); | 48 | private object syncLock = new object(); |
49 | 49 | ||
50 | 50 | ||
@@ -102,20 +102,20 @@ namespace OpenSim.Framework.Communications.Caches | |||
102 | } | 102 | } |
103 | 103 | ||
104 | public void UpdateAsset(AssetBase asset) | 104 | public void UpdateAsset(AssetBase asset) |
105 | { | 105 | { |
106 | lock (syncLock) | 106 | lock (syncLock) |
107 | { | 107 | { |
108 | m_plugin.UpdateAsset(asset); | 108 | m_plugin.UpdateAsset(asset); |
109 | m_plugin.CommitAssets(); | 109 | m_plugin.CommitAssets(); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | public void CreateAsset(AssetBase asset) | 113 | public void CreateAsset(AssetBase asset) |
114 | { | 114 | { |
115 | lock (syncLock) | 115 | lock (syncLock) |
116 | { | 116 | { |
117 | m_plugin.CreateAsset(asset); | 117 | m_plugin.CreateAsset(asset); |
118 | m_plugin.CommitAssets(); | 118 | m_plugin.CommitAssets(); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
@@ -135,12 +135,12 @@ namespace OpenSim.Framework.Communications.Caches | |||
135 | { | 135 | { |
136 | ARequest req = this._assetRequests.Dequeue(); | 136 | ARequest req = this._assetRequests.Dequeue(); |
137 | 137 | ||
138 | MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); | 138 | MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); |
139 | 139 | ||
140 | AssetBase asset = null; | 140 | AssetBase asset = null; |
141 | lock (syncLock) | 141 | lock (syncLock) |
142 | { | 142 | { |
143 | asset = m_plugin.FetchAsset(req.AssetID); | 143 | asset = m_plugin.FetchAsset(req.AssetID); |
144 | } | 144 | } |
145 | if (asset != null) | 145 | if (asset != null) |
146 | { | 146 | { |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs index d47bb07..19220ac 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs | |||
@@ -1,17 +1,17 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Capabilities | 6 | namespace OpenSim.Region.Capabilities |
7 | { | 7 | { |
8 | [LLSDMap] | 8 | [LLSDMap] |
9 | public class LLSDItemUpdate | 9 | public class LLSDItemUpdate |
10 | { | 10 | { |
11 | public LLUUID item_id; | 11 | public LLUUID item_id; |
12 | 12 | ||
13 | public LLSDItemUpdate() | 13 | public LLSDItemUpdate() |
14 | { | 14 | { |
15 | } | 15 | } |
16 | } | 16 | } |
17 | } | 17 | } |
diff --git a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs index a2ef826..daf9d6d 100644 --- a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs +++ b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs | |||
@@ -1,18 +1,18 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Framework.Interfaces | 7 | namespace OpenSim.Framework.Interfaces |
8 | { | 8 | { |
9 | public interface IAssetProvider | 9 | public interface IAssetProvider |
10 | { | 10 | { |
11 | void Initialise(string dbfile, string dbname); | 11 | void Initialise(string dbfile, string dbname); |
12 | AssetBase FetchAsset(LLUUID uuid); | 12 | AssetBase FetchAsset(LLUUID uuid); |
13 | void CreateAsset(AssetBase asset); | 13 | void CreateAsset(AssetBase asset); |
14 | void UpdateAsset(AssetBase asset); | 14 | void UpdateAsset(AssetBase asset); |
15 | bool ExistsAsset(LLUUID uuid); | 15 | bool ExistsAsset(LLUUID uuid); |
16 | void CommitAssets(); // force a sync to the database | 16 | void CommitAssets(); // force a sync to the database |
17 | } | 17 | } |
18 | } \ No newline at end of file | 18 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/UserManager/CAPSService.cs b/OpenSim/Framework/UserManager/CAPSService.cs index 39af140..a8eac26 100644 --- a/OpenSim/Framework/UserManager/CAPSService.cs +++ b/OpenSim/Framework/UserManager/CAPSService.cs | |||
@@ -1,38 +1,38 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Reflection; | 4 | using System.Reflection; |
5 | using System.Security.Cryptography; | 5 | using System.Security.Cryptography; |
6 | using libsecondlife; | 6 | using libsecondlife; |
7 | using Nwc.XmlRpc; | 7 | using Nwc.XmlRpc; |
8 | using OpenSim.Framework.Console; | 8 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Data; | 9 | using OpenSim.Framework.Data; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Inventory; | 11 | using OpenSim.Framework.Inventory; |
12 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
13 | using OpenSim.Framework.Servers; | 13 | using OpenSim.Framework.Servers; |
14 | 14 | ||
15 | namespace OpenSim.Framework.UserManagement | 15 | namespace OpenSim.Framework.UserManagement |
16 | { | 16 | { |
17 | public class CAPSService | 17 | public class CAPSService |
18 | { | 18 | { |
19 | private BaseHttpServer m_server; | 19 | private BaseHttpServer m_server; |
20 | 20 | ||
21 | public CAPSService(BaseHttpServer httpServer) | 21 | public CAPSService(BaseHttpServer httpServer) |
22 | { | 22 | { |
23 | m_server = httpServer; | 23 | m_server = httpServer; |
24 | this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); | 24 | this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); |
25 | } | 25 | } |
26 | 26 | ||
27 | private void AddCapsSeedHandler(string path, RestMethod restMethod) | 27 | private void AddCapsSeedHandler(string path, RestMethod restMethod) |
28 | { | 28 | { |
29 | m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); | 29 | m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); |
30 | } | 30 | } |
31 | 31 | ||
32 | public string CapsRequest(string request, string path, string param) | 32 | public string CapsRequest(string request, string path, string param) |
33 | { | 33 | { |
34 | System.Console.WriteLine("new caps request " + request +" from path "+ path); | 34 | System.Console.WriteLine("new caps request " + request +" from path "+ path); |
35 | return ""; | 35 | return ""; |
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
diff --git a/OpenSim/Framework/UserManager/LoginService.cs b/OpenSim/Framework/UserManager/LoginService.cs index 0af341e..32f5565 100644 --- a/OpenSim/Framework/UserManager/LoginService.cs +++ b/OpenSim/Framework/UserManager/LoginService.cs | |||
@@ -1,290 +1,290 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Reflection; | 4 | using System.Reflection; |
5 | using System.Security.Cryptography; | 5 | using System.Security.Cryptography; |
6 | using libsecondlife; | 6 | using libsecondlife; |
7 | using Nwc.XmlRpc; | 7 | using Nwc.XmlRpc; |
8 | using OpenSim.Framework.Console; | 8 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Data; | 9 | using OpenSim.Framework.Data; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Inventory; | 11 | using OpenSim.Framework.Inventory; |
12 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
13 | 13 | ||
14 | using OpenSim.Framework.Configuration; | 14 | using OpenSim.Framework.Configuration; |
15 | using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; | 15 | using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; |
16 | 16 | ||
17 | namespace OpenSim.Framework.UserManagement | 17 | namespace OpenSim.Framework.UserManagement |
18 | { | 18 | { |
19 | public class LoginService | 19 | public class LoginService |
20 | { | 20 | { |
21 | protected string m_welcomeMessage = "Welcome to OpenSim"; | 21 | protected string m_welcomeMessage = "Welcome to OpenSim"; |
22 | protected UserManagerBase m_userManager = null; | 22 | protected UserManagerBase m_userManager = null; |
23 | 23 | ||
24 | public LoginService(UserManagerBase userManager, string welcomeMess) | 24 | public LoginService(UserManagerBase userManager, string welcomeMess) |
25 | { | 25 | { |
26 | m_userManager = userManager; | 26 | m_userManager = userManager; |
27 | if (welcomeMess != "") | 27 | if (welcomeMess != "") |
28 | { | 28 | { |
29 | m_welcomeMessage = welcomeMess; | 29 | m_welcomeMessage = welcomeMess; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | /// <summary> | 33 | /// <summary> |
34 | /// Main user login function | 34 | /// Main user login function |
35 | /// </summary> | 35 | /// </summary> |
36 | /// <param name="request">The XMLRPC request</param> | 36 | /// <param name="request">The XMLRPC request</param> |
37 | /// <returns>The response to send</returns> | 37 | /// <returns>The response to send</returns> |
38 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 38 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
39 | { | 39 | { |
40 | 40 | ||
41 | System.Console.WriteLine("Attempting login now..."); | 41 | System.Console.WriteLine("Attempting login now..."); |
42 | XmlRpcResponse response = new XmlRpcResponse(); | 42 | XmlRpcResponse response = new XmlRpcResponse(); |
43 | Hashtable requestData = (Hashtable)request.Params[0]; | 43 | Hashtable requestData = (Hashtable)request.Params[0]; |
44 | 44 | ||
45 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | 45 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); |
46 | bool GoodLogin = false; | 46 | bool GoodLogin = false; |
47 | string firstname = ""; | 47 | string firstname = ""; |
48 | string lastname = ""; | 48 | string lastname = ""; |
49 | string passwd = ""; | 49 | string passwd = ""; |
50 | 50 | ||
51 | UserProfileData userProfile; | 51 | UserProfileData userProfile; |
52 | LoginResponse logResponse = new LoginResponse(); | 52 | LoginResponse logResponse = new LoginResponse(); |
53 | 53 | ||
54 | if (GoodXML) | 54 | if (GoodXML) |
55 | { | 55 | { |
56 | firstname = (string)requestData["first"]; | 56 | firstname = (string)requestData["first"]; |
57 | lastname = (string)requestData["last"]; | 57 | lastname = (string)requestData["last"]; |
58 | passwd = (string)requestData["passwd"]; | 58 | passwd = (string)requestData["passwd"]; |
59 | 59 | ||
60 | userProfile = GetTheUser(firstname, lastname); | 60 | userProfile = GetTheUser(firstname, lastname); |
61 | if (userProfile == null) | 61 | if (userProfile == null) |
62 | return logResponse.CreateLoginFailedResponse(); | 62 | return logResponse.CreateLoginFailedResponse(); |
63 | 63 | ||
64 | GoodLogin = AuthenticateUser(userProfile, passwd); | 64 | GoodLogin = AuthenticateUser(userProfile, passwd); |
65 | } | 65 | } |
66 | else | 66 | else |
67 | { | 67 | { |
68 | return logResponse.CreateGridErrorResponse(); | 68 | return logResponse.CreateGridErrorResponse(); |
69 | } | 69 | } |
70 | 70 | ||
71 | if (!GoodLogin) | 71 | if (!GoodLogin) |
72 | { | 72 | { |
73 | return logResponse.CreateLoginFailedResponse(); | 73 | return logResponse.CreateLoginFailedResponse(); |
74 | } | 74 | } |
75 | else | 75 | else |
76 | { | 76 | { |
77 | // If we already have a session... | 77 | // If we already have a session... |
78 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) | 78 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) |
79 | { | 79 | { |
80 | // Reject the login | 80 | // Reject the login |
81 | return logResponse.CreateAlreadyLoggedInResponse(); | 81 | return logResponse.CreateAlreadyLoggedInResponse(); |
82 | } | 82 | } |
83 | // Otherwise... | 83 | // Otherwise... |
84 | // Create a new agent session | 84 | // Create a new agent session |
85 | CreateAgent(userProfile, request); | 85 | CreateAgent(userProfile, request); |
86 | 86 | ||
87 | try | 87 | try |
88 | { | 88 | { |
89 | LLUUID agentID = userProfile.UUID; | 89 | LLUUID agentID = userProfile.UUID; |
90 | 90 | ||
91 | // Inventory Library Section | 91 | // Inventory Library Section |
92 | InventoryData inventData = this.CreateInventoryData(agentID); | 92 | InventoryData inventData = this.CreateInventoryData(agentID); |
93 | ArrayList AgentInventoryArray = inventData.InventoryArray; | 93 | ArrayList AgentInventoryArray = inventData.InventoryArray; |
94 | 94 | ||
95 | Hashtable InventoryRootHash = new Hashtable(); | 95 | Hashtable InventoryRootHash = new Hashtable(); |
96 | InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); | 96 | InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); |
97 | ArrayList InventoryRoot = new ArrayList(); | 97 | ArrayList InventoryRoot = new ArrayList(); |
98 | InventoryRoot.Add(InventoryRootHash); | 98 | InventoryRoot.Add(InventoryRootHash); |
99 | userProfile.rootInventoryFolderID = inventData.RootFolderID; | 99 | userProfile.rootInventoryFolderID = inventData.RootFolderID; |
100 | 100 | ||
101 | // Circuit Code | 101 | // Circuit Code |
102 | uint circode = (uint)(Util.RandomClass.Next()); | 102 | uint circode = (uint)(Util.RandomClass.Next()); |
103 | 103 | ||
104 | logResponse.Lastname = userProfile.surname; | 104 | logResponse.Lastname = userProfile.surname; |
105 | logResponse.Firstname = userProfile.username; | 105 | logResponse.Firstname = userProfile.username; |
106 | logResponse.AgentID = agentID.ToStringHyphenated(); | 106 | logResponse.AgentID = agentID.ToStringHyphenated(); |
107 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); | 107 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); |
108 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); | 108 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); |
109 | logResponse.InventoryRoot = InventoryRoot; | 109 | logResponse.InventoryRoot = InventoryRoot; |
110 | logResponse.InventorySkeleton = AgentInventoryArray; | 110 | logResponse.InventorySkeleton = AgentInventoryArray; |
111 | logResponse.InventoryLibrary = this.GetInventoryLibrary(); | 111 | logResponse.InventoryLibrary = this.GetInventoryLibrary(); |
112 | logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); | 112 | logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); |
113 | logResponse.CircuitCode = (Int32)circode; | 113 | logResponse.CircuitCode = (Int32)circode; |
114 | //logResponse.RegionX = 0; //overwritten | 114 | //logResponse.RegionX = 0; //overwritten |
115 | //logResponse.RegionY = 0; //overwritten | 115 | //logResponse.RegionY = 0; //overwritten |
116 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | 116 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten |
117 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | 117 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; |
118 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | 118 | //logResponse.SimAddress = "127.0.0.1"; //overwritten |
119 | //logResponse.SimPort = 0; //overwritten | 119 | //logResponse.SimPort = 0; //overwritten |
120 | logResponse.Message = this.GetMessage(); | 120 | logResponse.Message = this.GetMessage(); |
121 | 121 | ||
122 | try | 122 | try |
123 | { | 123 | { |
124 | this.CustomiseResponse(logResponse, userProfile); | 124 | this.CustomiseResponse(logResponse, userProfile); |
125 | } | 125 | } |
126 | catch (Exception e) | 126 | catch (Exception e) |
127 | { | 127 | { |
128 | System.Console.WriteLine(e.ToString()); | 128 | System.Console.WriteLine(e.ToString()); |
129 | return logResponse.CreateDeadRegionResponse(); | 129 | return logResponse.CreateDeadRegionResponse(); |
130 | //return logResponse.ToXmlRpcResponse(); | 130 | //return logResponse.ToXmlRpcResponse(); |
131 | } | 131 | } |
132 | CommitAgent(ref userProfile); | 132 | CommitAgent(ref userProfile); |
133 | return logResponse.ToXmlRpcResponse(); | 133 | return logResponse.ToXmlRpcResponse(); |
134 | 134 | ||
135 | } | 135 | } |
136 | 136 | ||
137 | catch (Exception E) | 137 | catch (Exception E) |
138 | { | 138 | { |
139 | System.Console.WriteLine(E.ToString()); | 139 | System.Console.WriteLine(E.ToString()); |
140 | } | 140 | } |
141 | //} | 141 | //} |
142 | } | 142 | } |
143 | return response; | 143 | return response; |
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Customises the login response and fills in missing values. | 148 | /// Customises the login response and fills in missing values. |
149 | /// </summary> | 149 | /// </summary> |
150 | /// <param name="response">The existing response</param> | 150 | /// <param name="response">The existing response</param> |
151 | /// <param name="theUser">The user profile</param> | 151 | /// <param name="theUser">The user profile</param> |
152 | public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 152 | public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) |
153 | { | 153 | { |
154 | } | 154 | } |
155 | 155 | ||
156 | /// <summary> | 156 | /// <summary> |
157 | /// Saves a target agent to the database | 157 | /// Saves a target agent to the database |
158 | /// </summary> | 158 | /// </summary> |
159 | /// <param name="profile">The users profile</param> | 159 | /// <param name="profile">The users profile</param> |
160 | /// <returns>Successful?</returns> | 160 | /// <returns>Successful?</returns> |
161 | public bool CommitAgent(ref UserProfileData profile) | 161 | public bool CommitAgent(ref UserProfileData profile) |
162 | { | 162 | { |
163 | // Saves the agent to database | 163 | // Saves the agent to database |
164 | return true; | 164 | return true; |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// Checks a user against it's password hash | 169 | /// Checks a user against it's password hash |
170 | /// </summary> | 170 | /// </summary> |
171 | /// <param name="profile">The users profile</param> | 171 | /// <param name="profile">The users profile</param> |
172 | /// <param name="password">The supplied password</param> | 172 | /// <param name="password">The supplied password</param> |
173 | /// <returns>Authenticated?</returns> | 173 | /// <returns>Authenticated?</returns> |
174 | public virtual bool AuthenticateUser(UserProfileData profile, string password) | 174 | public virtual bool AuthenticateUser(UserProfileData profile, string password) |
175 | { | 175 | { |
176 | 176 | ||
177 | MainLog.Instance.Verbose( | 177 | MainLog.Instance.Verbose( |
178 | "Authenticating " + profile.username + " " + profile.surname); | 178 | "Authenticating " + profile.username + " " + profile.surname); |
179 | 179 | ||
180 | password = password.Remove(0, 3); //remove $1$ | 180 | password = password.Remove(0, 3); //remove $1$ |
181 | 181 | ||
182 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | 182 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); |
183 | 183 | ||
184 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); | 184 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); |
185 | } | 185 | } |
186 | 186 | ||
187 | /// <summary> | 187 | /// <summary> |
188 | /// | 188 | /// |
189 | /// </summary> | 189 | /// </summary> |
190 | /// <param name="profile"></param> | 190 | /// <param name="profile"></param> |
191 | /// <param name="request"></param> | 191 | /// <param name="request"></param> |
192 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 192 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
193 | { | 193 | { |
194 | this.m_userManager.CreateAgent(profile, request); | 194 | this.m_userManager.CreateAgent(profile, request); |
195 | } | 195 | } |
196 | 196 | ||
197 | /// <summary> | 197 | /// <summary> |
198 | /// | 198 | /// |
199 | /// </summary> | 199 | /// </summary> |
200 | /// <param name="firstname"></param> | 200 | /// <param name="firstname"></param> |
201 | /// <param name="lastname"></param> | 201 | /// <param name="lastname"></param> |
202 | /// <returns></returns> | 202 | /// <returns></returns> |
203 | public virtual UserProfileData GetTheUser(string firstname, string lastname) | 203 | public virtual UserProfileData GetTheUser(string firstname, string lastname) |
204 | { | 204 | { |
205 | return this.m_userManager.getUserProfile(firstname, lastname); | 205 | return this.m_userManager.getUserProfile(firstname, lastname); |
206 | } | 206 | } |
207 | 207 | ||
208 | /// <summary> | 208 | /// <summary> |
209 | /// | 209 | /// |
210 | /// </summary> | 210 | /// </summary> |
211 | /// <returns></returns> | 211 | /// <returns></returns> |
212 | public virtual string GetMessage() | 212 | public virtual string GetMessage() |
213 | { | 213 | { |
214 | return m_welcomeMessage; | 214 | return m_welcomeMessage; |
215 | } | 215 | } |
216 | 216 | ||
217 | /// <summary> | 217 | /// <summary> |
218 | /// | 218 | /// |
219 | /// </summary> | 219 | /// </summary> |
220 | /// <returns></returns> | 220 | /// <returns></returns> |
221 | protected virtual ArrayList GetInventoryLibrary() | 221 | protected virtual ArrayList GetInventoryLibrary() |
222 | { | 222 | { |
223 | //return new ArrayList(); | 223 | //return new ArrayList(); |
224 | Hashtable TempHash = new Hashtable(); | 224 | Hashtable TempHash = new Hashtable(); |
225 | TempHash["name"] = "OpenSim Library"; | 225 | TempHash["name"] = "OpenSim Library"; |
226 | TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); | 226 | TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); |
227 | TempHash["version"] = 1; | 227 | TempHash["version"] = 1; |
228 | TempHash["type_default"] = -1; | 228 | TempHash["type_default"] = -1; |
229 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | 229 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; |
230 | ArrayList temp = new ArrayList(); | 230 | ArrayList temp = new ArrayList(); |
231 | temp.Add(TempHash); | 231 | temp.Add(TempHash); |
232 | 232 | ||
233 | TempHash = new Hashtable(); | 233 | TempHash = new Hashtable(); |
234 | TempHash["name"] = "Texture Library"; | 234 | TempHash["name"] = "Texture Library"; |
235 | TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; | 235 | TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; |
236 | TempHash["version"] = 1; | 236 | TempHash["version"] = 1; |
237 | TempHash["type_default"] = -1; | 237 | TempHash["type_default"] = -1; |
238 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; | 238 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; |
239 | temp.Add(TempHash); | 239 | temp.Add(TempHash); |
240 | return temp; | 240 | return temp; |
241 | } | 241 | } |
242 | 242 | ||
243 | /// <summary> | 243 | /// <summary> |
244 | /// | 244 | /// |
245 | /// </summary> | 245 | /// </summary> |
246 | /// <returns></returns> | 246 | /// <returns></returns> |
247 | protected virtual ArrayList GetLibraryOwner() | 247 | protected virtual ArrayList GetLibraryOwner() |
248 | { | 248 | { |
249 | //for now create random inventory library owner | 249 | //for now create random inventory library owner |
250 | Hashtable TempHash = new Hashtable(); | 250 | Hashtable TempHash = new Hashtable(); |
251 | TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; | 251 | TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; |
252 | ArrayList inventoryLibOwner = new ArrayList(); | 252 | ArrayList inventoryLibOwner = new ArrayList(); |
253 | inventoryLibOwner.Add(TempHash); | 253 | inventoryLibOwner.Add(TempHash); |
254 | return inventoryLibOwner; | 254 | return inventoryLibOwner; |
255 | } | 255 | } |
256 | 256 | ||
257 | protected virtual InventoryData CreateInventoryData(LLUUID userID) | 257 | protected virtual InventoryData CreateInventoryData(LLUUID userID) |
258 | { | 258 | { |
259 | AgentInventory userInventory = new AgentInventory(); | 259 | AgentInventory userInventory = new AgentInventory(); |
260 | userInventory.CreateRootFolder(userID, false); | 260 | userInventory.CreateRootFolder(userID, false); |
261 | 261 | ||
262 | ArrayList AgentInventoryArray = new ArrayList(); | 262 | ArrayList AgentInventoryArray = new ArrayList(); |
263 | Hashtable TempHash; | 263 | Hashtable TempHash; |
264 | foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) | 264 | foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) |
265 | { | 265 | { |
266 | TempHash = new Hashtable(); | 266 | TempHash = new Hashtable(); |
267 | TempHash["name"] = InvFolder.FolderName; | 267 | TempHash["name"] = InvFolder.FolderName; |
268 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 268 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
269 | TempHash["version"] = (Int32)InvFolder.Version; | 269 | TempHash["version"] = (Int32)InvFolder.Version; |
270 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 270 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; |
271 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 271 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
272 | AgentInventoryArray.Add(TempHash); | 272 | AgentInventoryArray.Add(TempHash); |
273 | } | 273 | } |
274 | 274 | ||
275 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); | 275 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); |
276 | } | 276 | } |
277 | 277 | ||
278 | public class InventoryData | 278 | public class InventoryData |
279 | { | 279 | { |
280 | public ArrayList InventoryArray = null; | 280 | public ArrayList InventoryArray = null; |
281 | public LLUUID RootFolderID = LLUUID.Zero; | 281 | public LLUUID RootFolderID = LLUUID.Zero; |
282 | 282 | ||
283 | public InventoryData(ArrayList invList, LLUUID rootID) | 283 | public InventoryData(ArrayList invList, LLUUID rootID) |
284 | { | 284 | { |
285 | InventoryArray = invList; | 285 | InventoryArray = invList; |
286 | RootFolderID = rootID; | 286 | RootFolderID = rootID; |
287 | } | 287 | } |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 57652b0..3820575 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -1,80 +1,80 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Net; | 3 | using System.Net; |
4 | using Nwc.XmlRpc; | 4 | using Nwc.XmlRpc; |
5 | using OpenSim.Framework.Data; | 5 | using OpenSim.Framework.Data; |
6 | using OpenSim.Framework.UserManagement; | 6 | using OpenSim.Framework.UserManagement; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Framework.Configuration; | 8 | using OpenSim.Framework.Configuration; |
9 | 9 | ||
10 | namespace OpenSim.Grid.UserServer | 10 | namespace OpenSim.Grid.UserServer |
11 | { | 11 | { |
12 | public class UserLoginService : LoginService | 12 | public class UserLoginService : LoginService |
13 | { | 13 | { |
14 | public UserConfig m_config; | 14 | public UserConfig m_config; |
15 | 15 | ||
16 | public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) | 16 | public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) |
17 | : base(userManager, welcomeMess) | 17 | : base(userManager, welcomeMess) |
18 | { | 18 | { |
19 | m_config = config; | 19 | m_config = config; |
20 | } | 20 | } |
21 | 21 | ||
22 | /// <summary> | 22 | /// <summary> |
23 | /// Customises the login response and fills in missing values. | 23 | /// Customises the login response and fills in missing values. |
24 | /// </summary> | 24 | /// </summary> |
25 | /// <param name="response">The existing response</param> | 25 | /// <param name="response">The existing response</param> |
26 | /// <param name="theUser">The user profile</param> | 26 | /// <param name="theUser">The user profile</param> |
27 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 27 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) |
28 | { | 28 | { |
29 | // Load information from the gridserver | 29 | // Load information from the gridserver |
30 | SimProfileData SimInfo = new SimProfileData(); | 30 | SimProfileData SimInfo = new SimProfileData(); |
31 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 31 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); |
32 | 32 | ||
33 | // Customise the response | 33 | // Customise the response |
34 | // Home Location | 34 | // Home Location |
35 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + | 35 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + |
36 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 36 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + |
37 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 37 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; |
38 | 38 | ||
39 | // Destination | 39 | // Destination |
40 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); | 40 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); |
41 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); | 41 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); |
42 | response.SimPort = (Int32)SimInfo.serverPort; | 42 | response.SimPort = (Int32)SimInfo.serverPort; |
43 | response.RegionX = SimInfo.regionLocX; | 43 | response.RegionX = SimInfo.regionLocX; |
44 | response.RegionY = SimInfo.regionLocY; | 44 | response.RegionY = SimInfo.regionLocY; |
45 | 45 | ||
46 | //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI | 46 | //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI |
47 | string capsPath = Util.GetRandomCapsPath(); | 47 | string capsPath = Util.GetRandomCapsPath(); |
48 | response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; | 48 | response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; |
49 | 49 | ||
50 | // Notify the target of an incoming user | 50 | // Notify the target of an incoming user |
51 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); | 51 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); |
52 | 52 | ||
53 | // Prepare notification | 53 | // Prepare notification |
54 | Hashtable SimParams = new Hashtable(); | 54 | Hashtable SimParams = new Hashtable(); |
55 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); | 55 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); |
56 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); | 56 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); |
57 | SimParams["firstname"] = theUser.username; | 57 | SimParams["firstname"] = theUser.username; |
58 | SimParams["lastname"] = theUser.surname; | 58 | SimParams["lastname"] = theUser.surname; |
59 | SimParams["agent_id"] = theUser.UUID.ToString(); | 59 | SimParams["agent_id"] = theUser.UUID.ToString(); |
60 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | 60 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); |
61 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | 61 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); |
62 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | 62 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); |
63 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | 63 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); |
64 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); | 64 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); |
65 | SimParams["caps_path"] = capsPath; | 65 | SimParams["caps_path"] = capsPath; |
66 | ArrayList SendParams = new ArrayList(); | 66 | ArrayList SendParams = new ArrayList(); |
67 | SendParams.Add(SimParams); | 67 | SendParams.Add(SimParams); |
68 | 68 | ||
69 | // Update agent with target sim | 69 | // Update agent with target sim |
70 | theUser.currentAgent.currentRegion = SimInfo.UUID; | 70 | theUser.currentAgent.currentRegion = SimInfo.UUID; |
71 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; | 71 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; |
72 | 72 | ||
73 | System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); | 73 | System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); |
74 | // Send | 74 | // Send |
75 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 75 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
76 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); | 76 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Communications; | 4 | using OpenSim.Framework.Communications; |
5 | using OpenSim.Framework.Data; | 5 | using OpenSim.Framework.Data; |
6 | using OpenSim.Framework.Types; | 6 | using OpenSim.Framework.Types; |
7 | using OpenSim.Framework.UserManagement; | 7 | using OpenSim.Framework.UserManagement; |
8 | using OpenSim.Framework.Utilities; | 8 | using OpenSim.Framework.Utilities; |
9 | using OpenSim.Framework.InventoryServiceBase; | 9 | using OpenSim.Framework.InventoryServiceBase; |
10 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; | 10 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; |
11 | 11 | ||
12 | namespace OpenSim.Region.Communications.Local | 12 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Communications; | 5 | using OpenSim.Framework.Communications; |
6 | using OpenSim.Framework.Data; | 6 | using OpenSim.Framework.Data; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.UserManagement; | 8 | using OpenSim.Framework.UserManagement; |
9 | using OpenSim.Framework.Utilities; | 9 | using OpenSim.Framework.Utilities; |
10 | using OpenSim.Framework.Inventory; | 10 | using OpenSim.Framework.Inventory; |
11 | 11 | ||
12 | namespace OpenSim.Region.Communications.Local | 12 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Communications; | 4 | using OpenSim.Framework.Communications; |
5 | using OpenSim.Framework.Data; | 5 | using OpenSim.Framework.Data; |
6 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; | 6 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; |
7 | 7 | ||
8 | namespace OpenSim.Region.Communications.OGS1 | 8 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Interfaces | 7 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Interfaces | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Interfaces | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Interfaces | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Framework.Interfaces; | 4 | using OpenSim.Framework.Interfaces; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Interfaces | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Interfaces | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Reflection; | 3 | using System.Reflection; |
4 | using System.Text; | 4 | using System.Text; |
5 | using OpenSim.Framework.Console; | 5 | using OpenSim.Framework.Console; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | using OpenSim.Region.Environment.Modules; | 8 | using OpenSim.Region.Environment.Modules; |
9 | 9 | ||
10 | namespace OpenSim.Region.Environment | 10 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Net; | 4 | using System.Net; |
5 | using System.Net.Sockets; | 5 | using System.Net.Sockets; |
6 | using System.Threading; | 6 | using System.Threading; |
7 | using System.IO; | 7 | using System.IO; |
8 | using libsecondlife; | 8 | using libsecondlife; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Environment.Interfaces; | 10 | using OpenSim.Region.Environment.Interfaces; |
11 | using OpenSim.Framework.Interfaces; | 11 | using OpenSim.Framework.Interfaces; |
12 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
13 | using OpenSim.Framework.Console; | 13 | using OpenSim.Framework.Console; |
14 | 14 | ||
15 | namespace OpenSim.Region.Environment.Modules | 15 | namespace 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 @@ | |||
1 | using System.Text; | 1 | using System.Text; |
2 | using System.Net; | 2 | using System.Net; |
3 | using System.Net.Sockets; | 3 | using System.Net.Sockets; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using libsecondlife; | 7 | using libsecondlife; |
8 | using OpenSim.Region.Environment.Scenes; | 8 | using OpenSim.Region.Environment.Scenes; |
9 | using OpenSim.Region.Environment.Interfaces; | 9 | using OpenSim.Region.Environment.Interfaces; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Utilities; | 11 | using OpenSim.Framework.Utilities; |
12 | using OpenSim.Framework.Console; | 12 | using OpenSim.Framework.Console; |
13 | using OpenSim.Framework.Types; | 13 | using OpenSim.Framework.Types; |
14 | 14 | ||
15 | namespace OpenSim.Region.Environment.Modules | 15 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Region.Environment.Scenes; | 8 | using OpenSim.Region.Environment.Scenes; |
9 | using OpenSim.Region.Environment.Interfaces; | 9 | using OpenSim.Region.Environment.Interfaces; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Modules | 11 | namespace 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 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using OpenSim.Framework.Types; | 3 | using OpenSim.Framework.Types; |
4 | using OpenSim.Framework.Communications; | 4 | using OpenSim.Framework.Communications; |
5 | using OpenSim.Framework.Servers; | 5 | using OpenSim.Framework.Servers; |
6 | using OpenSim.Region.Capabilities; | 6 | using OpenSim.Region.Capabilities; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | using OpenSim.Region.Environment.LandManagement; | 8 | using OpenSim.Region.Environment.LandManagement; |
9 | 9 | ||
10 | using libsecondlife; | 10 | using libsecondlife; |
11 | 11 | ||
12 | namespace OpenSim.Region.Environment | 12 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using libsecondlife.Packets; | 5 | using libsecondlife.Packets; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Communications.Caches; | 8 | using OpenSim.Framework.Communications.Caches; |
9 | using OpenSim.Framework.Data; | 9 | using OpenSim.Framework.Data; |
10 | using OpenSim.Framework.Utilities; | 10 | using OpenSim.Framework.Utilities; |
11 | using OpenSim.Region.Physics.Manager; | 11 | using OpenSim.Region.Physics.Manager; |
12 | 12 | ||
13 | namespace OpenSim.Region.Environment.Scenes | 13 | namespace 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 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using System; | 2 | using System; |
3 | using OpenSim.Framework.Console; | 3 | using OpenSim.Framework.Console; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes.Scripting | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes.Scripting | 6 | namespace 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 */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Region.Environment.Scenes.Scripting; | 32 | using OpenSim.Region.Environment.Scenes.Scripting; |
33 | 33 | ||
34 | //TODO: WHERE TO PLACE THIS? | 34 | //TODO: WHERE TO PLACE THIS? |
35 | namespace OpenSim.Region.Environment.Scenes.Scripting | 35 | namespace 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 */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | 34 | ||
35 | namespace OpenSim.Region.Environment.Scenes.Scripting | 35 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Types | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Types | 7 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | using Axiom.Math; | 5 | using Axiom.Math; |
6 | using libsecondlife; | 6 | using libsecondlife; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Interfaces; | 8 | using OpenSim.Framework.Interfaces; |
9 | 9 | ||
10 | namespace SimpleApp | 10 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.CodeDom.Compiler; | 29 | using System.CodeDom.Compiler; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using Microsoft.CSharp; | 31 | using Microsoft.CSharp; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | 33 | ||
34 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp | 34 | namespace 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 @@ | |||
1 | using OpenSim.Framework.Console; | 1 | using OpenSim.Framework.Console; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using OpenSim.Region.Environment; | 3 | using OpenSim.Region.Environment; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using libsecondlife; | 7 | using libsecondlife; |
8 | 8 | ||
9 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples | 9 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.CodeDom.Compiler; | 29 | using System.CodeDom.Compiler; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using Microsoft.JScript; | 31 | using Microsoft.JScript; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | 33 | ||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JScript | 34 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 32 | ||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 33 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
33 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 33 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
34 | 34 | ||
35 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 35 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 33 | ||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 34 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Framework.Interfaces; | 31 | using OpenSim.Framework.Interfaces; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Types; | 33 | using OpenSim.Framework.Types; |
34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
36 | 36 | ||
37 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 37 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 33 | ||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 34 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 5 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 32 | ||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 33 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
36 | using OpenSim.Region.ExtensionsScriptModule; | 36 | using OpenSim.Region.ExtensionsScriptModule; |
37 | 37 | ||
38 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 38 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | using OpenSim.Region.ExtensionsScriptModule; | 5 | using OpenSim.Region.ExtensionsScriptModule; |
6 | 6 | ||
7 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 7 | namespace 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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; | 37 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; |
38 | using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; | 38 | using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; |
39 | 39 | ||
40 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 40 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 5 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
5 | 5 | ||
6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
5 | 5 | ||
6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
5 | 5 | ||
6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 6 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
5 | 5 | ||
6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 6 | namespace 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 | */ |
28 | using OpenSim.Region.Environment.Scenes; | 28 | using OpenSim.Region.Environment.Scenes; |
29 | 29 | ||
30 | namespace OpenSim.Region.ExtensionsScriptModule | 30 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Key = libsecondlife.LLUUID; | 4 | using Key = libsecondlife.LLUUID; |
5 | using Rotation = libsecondlife.LLQuaternion; | 5 | using Rotation = libsecondlife.LLQuaternion; |
6 | using Vector = libsecondlife.LLVector3; | 6 | using Vector = libsecondlife.LLVector3; |
7 | using LSLList = System.Collections.Generic.List<string>; | 7 | using LSLList = System.Collections.Generic.List<string>; |
8 | 8 | ||
9 | 9 | ||
10 | using OpenSim.Region.Environment.Scenes; | 10 | using OpenSim.Region.Environment.Scenes; |
11 | 11 | ||
12 | namespace OpenSim.Region.ExtensionsScriptModule | 12 | namespace 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 | */ |
28 | using OpenSim.Framework.Console; | 28 | using OpenSim.Framework.Console; |
29 | using OpenSim.Region.Environment.Scenes; | 29 | using OpenSim.Region.Environment.Scenes; |
30 | 30 | ||
31 | namespace OpenSim.Region.ExtensionsScriptModule | 31 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Key = libsecondlife.LLUUID; | 4 | using Key = libsecondlife.LLUUID; |
5 | using Rotation = libsecondlife.LLQuaternion; | 5 | using Rotation = libsecondlife.LLQuaternion; |
6 | using Vector = libsecondlife.LLVector3; | 6 | using Vector = libsecondlife.LLVector3; |
7 | using LSLList = System.Collections.Generic.List<string>; | 7 | using LSLList = System.Collections.Generic.List<string>; |
8 | 8 | ||
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Environment.LandManagement; | 10 | using OpenSim.Region.Environment.LandManagement; |
11 | using libsecondlife; | 11 | using libsecondlife; |
12 | 12 | ||
13 | namespace OpenSim.Region.ExtensionsScriptModule | 13 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Key = libsecondlife.LLUUID; | 6 | using Key = libsecondlife.LLUUID; |
7 | 7 | ||
8 | namespace OpenSim.Region.ExtensionsScriptModule | 8 | namespace 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 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Region.Environment; | 30 | using OpenSim.Region.Environment; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
33 | using OpenSim.Region.ExtensionsScriptModule.CSharp; | 33 | using OpenSim.Region.ExtensionsScriptModule.CSharp; |
34 | using OpenSim.Region.ExtensionsScriptModule.JScript; | 34 | using OpenSim.Region.ExtensionsScriptModule.JScript; |
35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; | 35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; |
36 | 36 | ||
37 | namespace OpenSim.Region.ExtensionsScriptModule | 37 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using Microsoft.CSharp; | 5 | using Microsoft.CSharp; |
6 | using System.CodeDom.Compiler; | 6 | using System.CodeDom.Compiler; |
7 | using System.Reflection; | 7 | using System.Reflection; |
8 | 8 | ||
9 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 9 | namespace 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 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using System; | 2 | using System; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Text; | 4 | using System.Text; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Scenes.Scripting; | 7 | using OpenSim.Region.Environment.Scenes.Scripting; |
8 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
9 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 9 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; |
10 | using OpenSim.Region.ScriptEngine.Common; | 10 | using OpenSim.Region.ScriptEngine.Common; |
11 | using OpenSim.Framework.Console; | 11 | using OpenSim.Framework.Console; |
12 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
13 | using System.Runtime.Remoting.Lifetime; | 13 | using System.Runtime.Remoting.Lifetime; |
14 | 14 | ||
15 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | 15 | namespace 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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Region.ScriptEngine.Common; | 6 | using OpenSim.Region.ScriptEngine.Common; |
7 | 7 | ||
8 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 8 | namespace 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 | /* |
2 | Redistribution and use in source and binary forms, with or without | 2 | Redistribution and use in source and binary forms, with or without |
3 | modification, are permitted provided that the following conditions are | 3 | modification, are permitted provided that the following conditions are |
4 | met: | 4 | met: |
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 | ||
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 19 | THIS 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 |
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 | THEORY 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 |
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | using System; | 32 | using System; |
33 | using System.Collections.Generic; | 33 | using System.Collections.Generic; |
34 | using System.Text; | 34 | using System.Text; |
35 | 35 | ||
36 | namespace libTerrain | 36 | namespace 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 | } |
diff --git a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs index 91b3f60..47ff65a 100644 --- a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs +++ b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs | |||
@@ -1,88 +1,88 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Windows.Forms; | 4 | using System.Windows.Forms; |
5 | 5 | ||
6 | namespace OpenSim.GUI | 6 | namespace OpenSim.GUI |
7 | { | 7 | { |
8 | class InputTextBoxControl:System.Windows.Forms.TextBox | 8 | class InputTextBoxControl:System.Windows.Forms.TextBox |
9 | { | 9 | { |
10 | public InputTextBoxControl() | 10 | public InputTextBoxControl() |
11 | { | 11 | { |
12 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown); | 12 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown); |
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | private List<string> CommandHistory = new List<string>(); | 16 | private List<string> CommandHistory = new List<string>(); |
17 | private bool InHistory = false; | 17 | private bool InHistory = false; |
18 | private int HistoryPosition = -1; | 18 | private int HistoryPosition = -1; |
19 | 19 | ||
20 | void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) | 20 | void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) |
21 | { | 21 | { |
22 | 22 | ||
23 | 23 | ||
24 | if (e.KeyCode == Keys.Enter && InHistory == false) | 24 | if (e.KeyCode == Keys.Enter && InHistory == false) |
25 | { | 25 | { |
26 | CommandHistory.Add(this.Text); | 26 | CommandHistory.Add(this.Text); |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) | 30 | if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) |
31 | { | 31 | { |
32 | // if not inside buffer, enter | 32 | // if not inside buffer, enter |
33 | // InBuffer = true | 33 | // InBuffer = true |
34 | //Console.WriteLine("History: Check"); | 34 | //Console.WriteLine("History: Check"); |
35 | if (InHistory == false) | 35 | if (InHistory == false) |
36 | { | 36 | { |
37 | if (this.Text != "") | 37 | if (this.Text != "") |
38 | { | 38 | { |
39 | //Console.WriteLine("History: Add"); | 39 | //Console.WriteLine("History: Add"); |
40 | CommandHistory.Add(this.Text); | 40 | CommandHistory.Add(this.Text); |
41 | HistoryPosition = CommandHistory.Count; | 41 | HistoryPosition = CommandHistory.Count; |
42 | } | 42 | } |
43 | else | 43 | else |
44 | { | 44 | { |
45 | //HistoryPosition = CommandHistory.Count + 1; | 45 | //HistoryPosition = CommandHistory.Count + 1; |
46 | } | 46 | } |
47 | //Console.WriteLine("History: InHistory"); | 47 | //Console.WriteLine("History: InHistory"); |
48 | InHistory = true; | 48 | InHistory = true; |
49 | } | 49 | } |
50 | 50 | ||
51 | if (e.KeyCode == Keys.Up) | 51 | if (e.KeyCode == Keys.Up) |
52 | HistoryPosition -= 1; | 52 | HistoryPosition -= 1; |
53 | if (e.KeyCode == Keys.Down) | 53 | if (e.KeyCode == Keys.Down) |
54 | HistoryPosition += 1; | 54 | HistoryPosition += 1; |
55 | 55 | ||
56 | if (HistoryPosition > CommandHistory.Count - 1) | 56 | if (HistoryPosition > CommandHistory.Count - 1) |
57 | HistoryPosition = -1; | 57 | HistoryPosition = -1; |
58 | if (HistoryPosition < -1) | 58 | if (HistoryPosition < -1) |
59 | HistoryPosition = CommandHistory.Count - 1; | 59 | HistoryPosition = CommandHistory.Count - 1; |
60 | 60 | ||
61 | //Console.WriteLine("History: Pos: " + HistoryPosition); | 61 | //Console.WriteLine("History: Pos: " + HistoryPosition); |
62 | //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count); | 62 | //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count); |
63 | if (CommandHistory.Count != 0) | 63 | if (CommandHistory.Count != 0) |
64 | { | 64 | { |
65 | if (HistoryPosition != -1) | 65 | if (HistoryPosition != -1) |
66 | { | 66 | { |
67 | //Console.WriteLine("History: Getting"); | 67 | //Console.WriteLine("History: Getting"); |
68 | //this.Text = CommandHistory.Item(HistoryPosition); | 68 | //this.Text = CommandHistory.Item(HistoryPosition); |
69 | this.Text = CommandHistory[HistoryPosition]; | 69 | this.Text = CommandHistory[HistoryPosition]; |
70 | this.SelectionStart = this.Text.Length; | 70 | this.SelectionStart = this.Text.Length; |
71 | this.SelectionLength = 0; | 71 | this.SelectionLength = 0; |
72 | } | 72 | } |
73 | else | 73 | else |
74 | { | 74 | { |
75 | //Console.WriteLine("History: Nothing"); | 75 | //Console.WriteLine("History: Nothing"); |
76 | this.Text = ""; | 76 | this.Text = ""; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | e.Handled = true; | 79 | e.Handled = true; |
80 | } else { | 80 | } else { |
81 | InHistory = false; | 81 | InHistory = false; |
82 | HistoryPosition = -1; | 82 | HistoryPosition = -1; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | 86 | ||
87 | } | 87 | } |
88 | } | 88 | } |
diff --git a/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs b/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs index 6350c57..c08f26d 100644 --- a/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs +++ b/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs | |||
@@ -1,393 +1,393 @@ | |||
1 | namespace OpenSim.GUI | 1 | namespace OpenSim.GUI |
2 | { | 2 | { |
3 | partial class Main | 3 | partial class Main |
4 | { | 4 | { |
5 | /// <summary> | 5 | /// <summary> |
6 | /// Required designer variable. | 6 | /// Required designer variable. |
7 | /// </summary> | 7 | /// </summary> |
8 | private System.ComponentModel.IContainer components = null; | 8 | private System.ComponentModel.IContainer components = null; |
9 | 9 | ||
10 | /// <summary> | 10 | /// <summary> |
11 | /// Clean up any resources being used. | 11 | /// Clean up any resources being used. |
12 | /// </summary> | 12 | /// </summary> |
13 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | 13 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
14 | protected override void Dispose(bool disposing) | 14 | protected override void Dispose(bool disposing) |
15 | { | 15 | { |
16 | if (disposing && (components != null)) | 16 | if (disposing && (components != null)) |
17 | { | 17 | { |
18 | components.Dispose(); | 18 | components.Dispose(); |
19 | } | 19 | } |
20 | base.Dispose(disposing); | 20 | base.Dispose(disposing); |
21 | } | 21 | } |
22 | 22 | ||
23 | #region Windows Form Designer generated code | 23 | #region Windows Form Designer generated code |
24 | 24 | ||
25 | /// <summary> | 25 | /// <summary> |
26 | /// Required method for Designer support - do not modify | 26 | /// Required method for Designer support - do not modify |
27 | /// the contents of this method with the code editor. | 27 | /// the contents of this method with the code editor. |
28 | /// </summary> | 28 | /// </summary> |
29 | private void InitializeComponent() | 29 | private void InitializeComponent() |
30 | { | 30 | { |
31 | this.tabLogs = new System.Windows.Forms.TabControl(); | 31 | this.tabLogs = new System.Windows.Forms.TabControl(); |
32 | this.tabMainLog = new System.Windows.Forms.TabPage(); | 32 | this.tabMainLog = new System.Windows.Forms.TabPage(); |
33 | this.txtMainLog = new System.Windows.Forms.TextBox(); | 33 | this.txtMainLog = new System.Windows.Forms.TextBox(); |
34 | this.tabRegionServer = new System.Windows.Forms.TabPage(); | 34 | this.tabRegionServer = new System.Windows.Forms.TabPage(); |
35 | this.label1 = new System.Windows.Forms.Label(); | 35 | this.label1 = new System.Windows.Forms.Label(); |
36 | this.txtInputRegionServer = new OpenSim.GUI.InputTextBoxControl(); | 36 | this.txtInputRegionServer = new OpenSim.GUI.InputTextBoxControl(); |
37 | this.txtOpenSim = new System.Windows.Forms.TextBox(); | 37 | this.txtOpenSim = new System.Windows.Forms.TextBox(); |
38 | this.tabUserServer = new System.Windows.Forms.TabPage(); | 38 | this.tabUserServer = new System.Windows.Forms.TabPage(); |
39 | this.label2 = new System.Windows.Forms.Label(); | 39 | this.label2 = new System.Windows.Forms.Label(); |
40 | this.txtInputUserServer = new OpenSim.GUI.InputTextBoxControl(); | 40 | this.txtInputUserServer = new OpenSim.GUI.InputTextBoxControl(); |
41 | this.txtUserServer = new System.Windows.Forms.TextBox(); | 41 | this.txtUserServer = new System.Windows.Forms.TextBox(); |
42 | this.tabAssetServer = new System.Windows.Forms.TabPage(); | 42 | this.tabAssetServer = new System.Windows.Forms.TabPage(); |
43 | this.label3 = new System.Windows.Forms.Label(); | 43 | this.label3 = new System.Windows.Forms.Label(); |
44 | this.txtInputAssetServer = new OpenSim.GUI.InputTextBoxControl(); | 44 | this.txtInputAssetServer = new OpenSim.GUI.InputTextBoxControl(); |
45 | this.txtAssetServer = new System.Windows.Forms.TextBox(); | 45 | this.txtAssetServer = new System.Windows.Forms.TextBox(); |
46 | this.tabGridServer = new System.Windows.Forms.TabPage(); | 46 | this.tabGridServer = new System.Windows.Forms.TabPage(); |
47 | this.label4 = new System.Windows.Forms.Label(); | 47 | this.label4 = new System.Windows.Forms.Label(); |
48 | this.txtInputGridServer = new OpenSim.GUI.InputTextBoxControl(); | 48 | this.txtInputGridServer = new OpenSim.GUI.InputTextBoxControl(); |
49 | this.txtGridServer = new System.Windows.Forms.TextBox(); | 49 | this.txtGridServer = new System.Windows.Forms.TextBox(); |
50 | this.gbLog = new System.Windows.Forms.GroupBox(); | 50 | this.gbLog = new System.Windows.Forms.GroupBox(); |
51 | this.btnStart = new System.Windows.Forms.Button(); | 51 | this.btnStart = new System.Windows.Forms.Button(); |
52 | this.btnStop = new System.Windows.Forms.Button(); | 52 | this.btnStop = new System.Windows.Forms.Button(); |
53 | this.rbGridRegionMode = new System.Windows.Forms.RadioButton(); | 53 | this.rbGridRegionMode = new System.Windows.Forms.RadioButton(); |
54 | this.rbStandAloneMode = new System.Windows.Forms.RadioButton(); | 54 | this.rbStandAloneMode = new System.Windows.Forms.RadioButton(); |
55 | this.rbGridServer = new System.Windows.Forms.RadioButton(); | 55 | this.rbGridServer = new System.Windows.Forms.RadioButton(); |
56 | this.tabLogs.SuspendLayout(); | 56 | this.tabLogs.SuspendLayout(); |
57 | this.tabMainLog.SuspendLayout(); | 57 | this.tabMainLog.SuspendLayout(); |
58 | this.tabRegionServer.SuspendLayout(); | 58 | this.tabRegionServer.SuspendLayout(); |
59 | this.tabUserServer.SuspendLayout(); | 59 | this.tabUserServer.SuspendLayout(); |
60 | this.tabAssetServer.SuspendLayout(); | 60 | this.tabAssetServer.SuspendLayout(); |
61 | this.tabGridServer.SuspendLayout(); | 61 | this.tabGridServer.SuspendLayout(); |
62 | this.gbLog.SuspendLayout(); | 62 | this.gbLog.SuspendLayout(); |
63 | this.SuspendLayout(); | 63 | this.SuspendLayout(); |
64 | // | 64 | // |
65 | // tabLogs | 65 | // tabLogs |
66 | // | 66 | // |
67 | this.tabLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 67 | this.tabLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
68 | | System.Windows.Forms.AnchorStyles.Left) | 68 | | System.Windows.Forms.AnchorStyles.Left) |
69 | | System.Windows.Forms.AnchorStyles.Right))); | 69 | | System.Windows.Forms.AnchorStyles.Right))); |
70 | this.tabLogs.Controls.Add(this.tabMainLog); | 70 | this.tabLogs.Controls.Add(this.tabMainLog); |
71 | this.tabLogs.Controls.Add(this.tabRegionServer); | 71 | this.tabLogs.Controls.Add(this.tabRegionServer); |
72 | this.tabLogs.Controls.Add(this.tabUserServer); | 72 | this.tabLogs.Controls.Add(this.tabUserServer); |
73 | this.tabLogs.Controls.Add(this.tabAssetServer); | 73 | this.tabLogs.Controls.Add(this.tabAssetServer); |
74 | this.tabLogs.Controls.Add(this.tabGridServer); | 74 | this.tabLogs.Controls.Add(this.tabGridServer); |
75 | this.tabLogs.Location = new System.Drawing.Point(6, 19); | 75 | this.tabLogs.Location = new System.Drawing.Point(6, 19); |
76 | this.tabLogs.Name = "tabLogs"; | 76 | this.tabLogs.Name = "tabLogs"; |
77 | this.tabLogs.SelectedIndex = 0; | 77 | this.tabLogs.SelectedIndex = 0; |
78 | this.tabLogs.Size = new System.Drawing.Size(562, 230); | 78 | this.tabLogs.Size = new System.Drawing.Size(562, 230); |
79 | this.tabLogs.TabIndex = 0; | 79 | this.tabLogs.TabIndex = 0; |
80 | // | 80 | // |
81 | // tabMainLog | 81 | // tabMainLog |
82 | // | 82 | // |
83 | this.tabMainLog.Controls.Add(this.txtMainLog); | 83 | this.tabMainLog.Controls.Add(this.txtMainLog); |
84 | this.tabMainLog.Location = new System.Drawing.Point(4, 22); | 84 | this.tabMainLog.Location = new System.Drawing.Point(4, 22); |
85 | this.tabMainLog.Name = "tabMainLog"; | 85 | this.tabMainLog.Name = "tabMainLog"; |
86 | this.tabMainLog.Size = new System.Drawing.Size(554, 204); | 86 | this.tabMainLog.Size = new System.Drawing.Size(554, 204); |
87 | this.tabMainLog.TabIndex = 4; | 87 | this.tabMainLog.TabIndex = 4; |
88 | this.tabMainLog.Text = "Main log"; | 88 | this.tabMainLog.Text = "Main log"; |
89 | this.tabMainLog.UseVisualStyleBackColor = true; | 89 | this.tabMainLog.UseVisualStyleBackColor = true; |
90 | // | 90 | // |
91 | // txtMainLog | 91 | // txtMainLog |
92 | // | 92 | // |
93 | this.txtMainLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 93 | this.txtMainLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
94 | | System.Windows.Forms.AnchorStyles.Left) | 94 | | System.Windows.Forms.AnchorStyles.Left) |
95 | | System.Windows.Forms.AnchorStyles.Right))); | 95 | | System.Windows.Forms.AnchorStyles.Right))); |
96 | this.txtMainLog.Location = new System.Drawing.Point(6, 5); | 96 | this.txtMainLog.Location = new System.Drawing.Point(6, 5); |
97 | this.txtMainLog.Multiline = true; | 97 | this.txtMainLog.Multiline = true; |
98 | this.txtMainLog.Name = "txtMainLog"; | 98 | this.txtMainLog.Name = "txtMainLog"; |
99 | this.txtMainLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; | 99 | this.txtMainLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
100 | this.txtMainLog.Size = new System.Drawing.Size(542, 195); | 100 | this.txtMainLog.Size = new System.Drawing.Size(542, 195); |
101 | this.txtMainLog.TabIndex = 1; | 101 | this.txtMainLog.TabIndex = 1; |
102 | // | 102 | // |
103 | // tabRegionServer | 103 | // tabRegionServer |
104 | // | 104 | // |
105 | this.tabRegionServer.Controls.Add(this.label1); | 105 | this.tabRegionServer.Controls.Add(this.label1); |
106 | this.tabRegionServer.Controls.Add(this.txtInputRegionServer); | 106 | this.tabRegionServer.Controls.Add(this.txtInputRegionServer); |
107 | this.tabRegionServer.Controls.Add(this.txtOpenSim); | 107 | this.tabRegionServer.Controls.Add(this.txtOpenSim); |
108 | this.tabRegionServer.Location = new System.Drawing.Point(4, 22); | 108 | this.tabRegionServer.Location = new System.Drawing.Point(4, 22); |
109 | this.tabRegionServer.Name = "tabRegionServer"; | 109 | this.tabRegionServer.Name = "tabRegionServer"; |
110 | this.tabRegionServer.Padding = new System.Windows.Forms.Padding(3); | 110 | this.tabRegionServer.Padding = new System.Windows.Forms.Padding(3); |
111 | this.tabRegionServer.Size = new System.Drawing.Size(554, 204); | 111 | this.tabRegionServer.Size = new System.Drawing.Size(554, 204); |
112 | this.tabRegionServer.TabIndex = 0; | 112 | this.tabRegionServer.TabIndex = 0; |
113 | this.tabRegionServer.Text = "Region server"; | 113 | this.tabRegionServer.Text = "Region server"; |
114 | this.tabRegionServer.UseVisualStyleBackColor = true; | 114 | this.tabRegionServer.UseVisualStyleBackColor = true; |
115 | // | 115 | // |
116 | // label1 | 116 | // label1 |
117 | // | 117 | // |
118 | this.label1.AutoSize = true; | 118 | this.label1.AutoSize = true; |
119 | this.label1.Location = new System.Drawing.Point(6, 183); | 119 | this.label1.Location = new System.Drawing.Point(6, 183); |
120 | this.label1.Name = "label1"; | 120 | this.label1.Name = "label1"; |
121 | this.label1.Size = new System.Drawing.Size(57, 13); | 121 | this.label1.Size = new System.Drawing.Size(57, 13); |
122 | this.label1.TabIndex = 4; | 122 | this.label1.TabIndex = 4; |
123 | this.label1.Text = "Command:"; | 123 | this.label1.Text = "Command:"; |
124 | // | 124 | // |
125 | // txtInputRegionServer | 125 | // txtInputRegionServer |
126 | // | 126 | // |
127 | this.txtInputRegionServer.Location = new System.Drawing.Point(69, 180); | 127 | this.txtInputRegionServer.Location = new System.Drawing.Point(69, 180); |
128 | this.txtInputRegionServer.Name = "txtInputRegionServer"; | 128 | this.txtInputRegionServer.Name = "txtInputRegionServer"; |
129 | this.txtInputRegionServer.Size = new System.Drawing.Size(479, 20); | 129 | this.txtInputRegionServer.Size = new System.Drawing.Size(479, 20); |
130 | this.txtInputRegionServer.TabIndex = 0; | 130 | this.txtInputRegionServer.TabIndex = 0; |
131 | // | 131 | // |
132 | // txtOpenSim | 132 | // txtOpenSim |
133 | // | 133 | // |
134 | this.txtOpenSim.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 134 | this.txtOpenSim.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
135 | | System.Windows.Forms.AnchorStyles.Left) | 135 | | System.Windows.Forms.AnchorStyles.Left) |
136 | | System.Windows.Forms.AnchorStyles.Right))); | 136 | | System.Windows.Forms.AnchorStyles.Right))); |
137 | this.txtOpenSim.Location = new System.Drawing.Point(6, 6); | 137 | this.txtOpenSim.Location = new System.Drawing.Point(6, 6); |
138 | this.txtOpenSim.Multiline = true; | 138 | this.txtOpenSim.Multiline = true; |
139 | this.txtOpenSim.Name = "txtOpenSim"; | 139 | this.txtOpenSim.Name = "txtOpenSim"; |
140 | this.txtOpenSim.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; | 140 | this.txtOpenSim.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
141 | this.txtOpenSim.Size = new System.Drawing.Size(542, 168); | 141 | this.txtOpenSim.Size = new System.Drawing.Size(542, 168); |
142 | this.txtOpenSim.TabIndex = 0; | 142 | this.txtOpenSim.TabIndex = 0; |
143 | // | 143 | // |
144 | // tabUserServer | 144 | // tabUserServer |
145 | // | 145 | // |
146 | this.tabUserServer.Controls.Add(this.label2); | 146 | this.tabUserServer.Controls.Add(this.label2); |
147 | this.tabUserServer.Controls.Add(this.txtInputUserServer); | 147 | this.tabUserServer.Controls.Add(this.txtInputUserServer); |
148 | this.tabUserServer.Controls.Add(this.txtUserServer); | 148 | this.tabUserServer.Controls.Add(this.txtUserServer); |
149 | this.tabUserServer.Location = new System.Drawing.Point(4, 22); | 149 | this.tabUserServer.Location = new System.Drawing.Point(4, 22); |
150 | this.tabUserServer.Name = "tabUserServer"; | 150 | this.tabUserServer.Name = "tabUserServer"; |
151 | this.tabUserServer.Padding = new System.Windows.Forms.Padding(3); | 151 | this.tabUserServer.Padding = new System.Windows.Forms.Padding(3); |
152 | this.tabUserServer.Size = new System.Drawing.Size(554, 204); | 152 | this.tabUserServer.Size = new System.Drawing.Size(554, 204); |
153 | this.tabUserServer.TabIndex = 1; | 153 | this.tabUserServer.TabIndex = 1; |
154 | this.tabUserServer.Text = "User server"; | 154 | this.tabUserServer.Text = "User server"; |
155 | this.tabUserServer.UseVisualStyleBackColor = true; | 155 | this.tabUserServer.UseVisualStyleBackColor = true; |
156 | // | 156 | // |
157 | // label2 | 157 | // label2 |
158 | // | 158 | // |
159 | this.label2.AutoSize = true; | 159 | this.label2.AutoSize = true; |
160 | this.label2.Location = new System.Drawing.Point(6, 181); | 160 | this.label2.Location = new System.Drawing.Point(6, 181); |
161 | this.label2.Name = "label2"; | 161 | this.label2.Name = "label2"; |
162 | this.label2.Size = new System.Drawing.Size(57, 13); | 162 | this.label2.Size = new System.Drawing.Size(57, 13); |
163 | this.label2.TabIndex = 6; | 163 | this.label2.TabIndex = 6; |
164 | this.label2.Text = "Command:"; | 164 | this.label2.Text = "Command:"; |
165 | // | 165 | // |
166 | // txtInputUserServer | 166 | // txtInputUserServer |
167 | // | 167 | // |
168 | this.txtInputUserServer.Location = new System.Drawing.Point(69, 178); | 168 | this.txtInputUserServer.Location = new System.Drawing.Point(69, 178); |
169 | this.txtInputUserServer.Name = "txtInputUserServer"; | 169 | this.txtInputUserServer.Name = "txtInputUserServer"; |
170 | this.txtInputUserServer.Size = new System.Drawing.Size(479, 20); | 170 | this.txtInputUserServer.Size = new System.Drawing.Size(479, 20); |
171 | this.txtInputUserServer.TabIndex = 5; | 171 | this.txtInputUserServer.TabIndex = 5; |
172 | // | 172 | // |
173 | // txtUserServer | 173 | // txtUserServer |
174 | // | 174 | // |
175 | this.txtUserServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 175 | this.txtUserServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
176 | | System.Windows.Forms.AnchorStyles.Left) | 176 | | System.Windows.Forms.AnchorStyles.Left) |
177 | | System.Windows.Forms.AnchorStyles.Right))); | 177 | | System.Windows.Forms.AnchorStyles.Right))); |
178 | this.txtUserServer.Location = new System.Drawing.Point(6, 5); | 178 | this.txtUserServer.Location = new System.Drawing.Point(6, 5); |
179 | this.txtUserServer.Multiline = true; | 179 | this.txtUserServer.Multiline = true; |
180 | this.txtUserServer.Name = "txtUserServer"; | 180 | this.txtUserServer.Name = "txtUserServer"; |
181 | this.txtUserServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; | 181 | this.txtUserServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
182 | this.txtUserServer.Size = new System.Drawing.Size(542, 168); | 182 | this.txtUserServer.Size = new System.Drawing.Size(542, 168); |
183 | this.txtUserServer.TabIndex = 1; | 183 | this.txtUserServer.TabIndex = 1; |
184 | // | 184 | // |
185 | // tabAssetServer | 185 | // tabAssetServer |
186 | // | 186 | // |
187 | this.tabAssetServer.Controls.Add(this.label3); | 187 | this.tabAssetServer.Controls.Add(this.label3); |
188 | this.tabAssetServer.Controls.Add(this.txtInputAssetServer); | 188 | this.tabAssetServer.Controls.Add(this.txtInputAssetServer); |
189 | this.tabAssetServer.Controls.Add(this.txtAssetServer); | 189 | this.tabAssetServer.Controls.Add(this.txtAssetServer); |
190 | this.tabAssetServer.Location = new System.Drawing.Point(4, 22); | 190 | this.tabAssetServer.Location = new System.Drawing.Point(4, 22); |
191 | this.tabAssetServer.Name = "tabAssetServer"; | 191 | this.tabAssetServer.Name = "tabAssetServer"; |
192 | this.tabAssetServer.Size = new System.Drawing.Size(554, 204); | 192 | this.tabAssetServer.Size = new System.Drawing.Size(554, 204); |
193 | this.tabAssetServer.TabIndex = 2; | 193 | this.tabAssetServer.TabIndex = 2; |
194 | this.tabAssetServer.Text = "Asset server"; | 194 | this.tabAssetServer.Text = "Asset server"; |
195 | this.tabAssetServer.UseVisualStyleBackColor = true; | 195 | this.tabAssetServer.UseVisualStyleBackColor = true; |
196 | // | 196 | // |
197 | // label3 | 197 | // label3 |
198 | // | 198 | // |
199 | this.label3.AutoSize = true; | 199 | this.label3.AutoSize = true; |
200 | this.label3.Location = new System.Drawing.Point(6, 182); | 200 | this.label3.Location = new System.Drawing.Point(6, 182); |
201 | this.label3.Name = "label3"; | 201 | this.label3.Name = "label3"; |
202 | this.label3.Size = new System.Drawing.Size(57, 13); | 202 | this.label3.Size = new System.Drawing.Size(57, 13); |
203 | this.label3.TabIndex = 6; | 203 | this.label3.TabIndex = 6; |
204 | this.label3.Text = "Command:"; | 204 | this.label3.Text = "Command:"; |
205 | // | 205 | // |
206 | // txtInputAssetServer | 206 | // txtInputAssetServer |
207 | // | 207 | // |
208 | this.txtInputAssetServer.Location = new System.Drawing.Point(69, 179); | 208 | this.txtInputAssetServer.Location = new System.Drawing.Point(69, 179); |
209 | this.txtInputAssetServer.Name = "txtInputAssetServer"; | 209 | this.txtInputAssetServer.Name = "txtInputAssetServer"; |
210 | this.txtInputAssetServer.Size = new System.Drawing.Size(479, 20); | 210 | this.txtInputAssetServer.Size = new System.Drawing.Size(479, 20); |
211 | this.txtInputAssetServer.TabIndex = 5; | 211 | this.txtInputAssetServer.TabIndex = 5; |
212 | // | 212 | // |
213 | // txtAssetServer | 213 | // txtAssetServer |
214 | // | 214 | // |
215 | this.txtAssetServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 215 | this.txtAssetServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
216 | | System.Windows.Forms.AnchorStyles.Left) | 216 | | System.Windows.Forms.AnchorStyles.Left) |
217 | | System.Windows.Forms.AnchorStyles.Right))); | 217 | | System.Windows.Forms.AnchorStyles.Right))); |
218 | this.txtAssetServer.Location = new System.Drawing.Point(6, 5); | 218 | this.txtAssetServer.Location = new System.Drawing.Point(6, 5); |
219 | this.txtAssetServer.Multiline = true; | 219 | this.txtAssetServer.Multiline = true; |
220 | this.txtAssetServer.Name = "txtAssetServer"; | 220 | this.txtAssetServer.Name = "txtAssetServer"; |
221 | this.txtAssetServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; | 221 | this.txtAssetServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
222 | this.txtAssetServer.Size = new System.Drawing.Size(542, 168); | 222 | this.txtAssetServer.Size = new System.Drawing.Size(542, 168); |
223 | this.txtAssetServer.TabIndex = 1; | 223 | this.txtAssetServer.TabIndex = 1; |
224 | // | 224 | // |
225 | // tabGridServer | 225 | // tabGridServer |
226 | // | 226 | // |
227 | this.tabGridServer.Controls.Add(this.label4); | 227 | this.tabGridServer.Controls.Add(this.label4); |
228 | this.tabGridServer.Controls.Add(this.txtInputGridServer); | 228 | this.tabGridServer.Controls.Add(this.txtInputGridServer); |
229 | this.tabGridServer.Controls.Add(this.txtGridServer); | 229 | this.tabGridServer.Controls.Add(this.txtGridServer); |
230 | this.tabGridServer.Location = new System.Drawing.Point(4, 22); | 230 | this.tabGridServer.Location = new System.Drawing.Point(4, 22); |
231 | this.tabGridServer.Name = "tabGridServer"; | 231 | this.tabGridServer.Name = "tabGridServer"; |
232 | this.tabGridServer.Size = new System.Drawing.Size(554, 204); | 232 | this.tabGridServer.Size = new System.Drawing.Size(554, 204); |
233 | this.tabGridServer.TabIndex = 3; | 233 | this.tabGridServer.TabIndex = 3; |
234 | this.tabGridServer.Text = "Grid server"; | 234 | this.tabGridServer.Text = "Grid server"; |
235 | this.tabGridServer.UseVisualStyleBackColor = true; | 235 | this.tabGridServer.UseVisualStyleBackColor = true; |
236 | // | 236 | // |
237 | // label4 | 237 | // label4 |
238 | // | 238 | // |
239 | this.label4.AutoSize = true; | 239 | this.label4.AutoSize = true; |
240 | this.label4.Location = new System.Drawing.Point(6, 182); | 240 | this.label4.Location = new System.Drawing.Point(6, 182); |
241 | this.label4.Name = "label4"; | 241 | this.label4.Name = "label4"; |
242 | this.label4.Size = new System.Drawing.Size(57, 13); | 242 | this.label4.Size = new System.Drawing.Size(57, 13); |
243 | this.label4.TabIndex = 6; | 243 | this.label4.TabIndex = 6; |
244 | this.label4.Text = "Command:"; | 244 | this.label4.Text = "Command:"; |
245 | // | 245 | // |
246 | // txtInputGridServer | 246 | // txtInputGridServer |
247 | // | 247 | // |
248 | this.txtInputGridServer.Location = new System.Drawing.Point(69, 179); | 248 | this.txtInputGridServer.Location = new System.Drawing.Point(69, 179); |
249 | this.txtInputGridServer.Name = "txtInputGridServer"; | 249 | this.txtInputGridServer.Name = "txtInputGridServer"; |
250 | this.txtInputGridServer.Size = new System.Drawing.Size(479, 20); | 250 | this.txtInputGridServer.Size = new System.Drawing.Size(479, 20); |
251 | this.txtInputGridServer.TabIndex = 5; | 251 | this.txtInputGridServer.TabIndex = 5; |
252 | // | 252 | // |
253 | // txtGridServer | 253 | // txtGridServer |
254 | // | 254 | // |
255 | this.txtGridServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 255 | this.txtGridServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
256 | | System.Windows.Forms.AnchorStyles.Left) | 256 | | System.Windows.Forms.AnchorStyles.Left) |
257 | | System.Windows.Forms.AnchorStyles.Right))); | 257 | | System.Windows.Forms.AnchorStyles.Right))); |
258 | this.txtGridServer.Location = new System.Drawing.Point(6, 5); | 258 | this.txtGridServer.Location = new System.Drawing.Point(6, 5); |
259 | this.txtGridServer.Multiline = true; | 259 | this.txtGridServer.Multiline = true; |
260 | this.txtGridServer.Name = "txtGridServer"; | 260 | this.txtGridServer.Name = "txtGridServer"; |
261 | this.txtGridServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; | 261 | this.txtGridServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
262 | this.txtGridServer.Size = new System.Drawing.Size(542, 168); | 262 | this.txtGridServer.Size = new System.Drawing.Size(542, 168); |
263 | this.txtGridServer.TabIndex = 1; | 263 | this.txtGridServer.TabIndex = 1; |
264 | // | 264 | // |
265 | // gbLog | 265 | // gbLog |
266 | // | 266 | // |
267 | this.gbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 267 | this.gbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
268 | | System.Windows.Forms.AnchorStyles.Left) | 268 | | System.Windows.Forms.AnchorStyles.Left) |
269 | | System.Windows.Forms.AnchorStyles.Right))); | 269 | | System.Windows.Forms.AnchorStyles.Right))); |
270 | this.gbLog.Controls.Add(this.tabLogs); | 270 | this.gbLog.Controls.Add(this.tabLogs); |
271 | this.gbLog.Location = new System.Drawing.Point(2, 41); | 271 | this.gbLog.Location = new System.Drawing.Point(2, 41); |
272 | this.gbLog.Name = "gbLog"; | 272 | this.gbLog.Name = "gbLog"; |
273 | this.gbLog.Size = new System.Drawing.Size(574, 255); | 273 | this.gbLog.Size = new System.Drawing.Size(574, 255); |
274 | this.gbLog.TabIndex = 1; | 274 | this.gbLog.TabIndex = 1; |
275 | this.gbLog.TabStop = false; | 275 | this.gbLog.TabStop = false; |
276 | this.gbLog.Text = "Logs"; | 276 | this.gbLog.Text = "Logs"; |
277 | // | 277 | // |
278 | // btnStart | 278 | // btnStart |
279 | // | 279 | // |
280 | this.btnStart.Location = new System.Drawing.Point(8, 12); | 280 | this.btnStart.Location = new System.Drawing.Point(8, 12); |
281 | this.btnStart.Name = "btnStart"; | 281 | this.btnStart.Name = "btnStart"; |
282 | this.btnStart.Size = new System.Drawing.Size(75, 23); | 282 | this.btnStart.Size = new System.Drawing.Size(75, 23); |
283 | this.btnStart.TabIndex = 2; | 283 | this.btnStart.TabIndex = 2; |
284 | this.btnStart.Text = "Start"; | 284 | this.btnStart.Text = "Start"; |
285 | this.btnStart.UseVisualStyleBackColor = true; | 285 | this.btnStart.UseVisualStyleBackColor = true; |
286 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click); | 286 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click); |
287 | // | 287 | // |
288 | // btnStop | 288 | // btnStop |
289 | // | 289 | // |
290 | this.btnStop.Location = new System.Drawing.Point(89, 12); | 290 | this.btnStop.Location = new System.Drawing.Point(89, 12); |
291 | this.btnStop.Name = "btnStop"; | 291 | this.btnStop.Name = "btnStop"; |
292 | this.btnStop.Size = new System.Drawing.Size(75, 23); | 292 | this.btnStop.Size = new System.Drawing.Size(75, 23); |
293 | this.btnStop.TabIndex = 3; | 293 | this.btnStop.TabIndex = 3; |
294 | this.btnStop.Text = "Stop"; | 294 | this.btnStop.Text = "Stop"; |
295 | this.btnStop.UseVisualStyleBackColor = true; | 295 | this.btnStop.UseVisualStyleBackColor = true; |
296 | this.btnStop.Click += new System.EventHandler(this.btnStop_Click); | 296 | this.btnStop.Click += new System.EventHandler(this.btnStop_Click); |
297 | // | 297 | // |
298 | // rbGridRegionMode | 298 | // rbGridRegionMode |
299 | // | 299 | // |
300 | this.rbGridRegionMode.AutoSize = true; | 300 | this.rbGridRegionMode.AutoSize = true; |
301 | this.rbGridRegionMode.Location = new System.Drawing.Point(407, 18); | 301 | this.rbGridRegionMode.Location = new System.Drawing.Point(407, 18); |
302 | this.rbGridRegionMode.Name = "rbGridRegionMode"; | 302 | this.rbGridRegionMode.Name = "rbGridRegionMode"; |
303 | this.rbGridRegionMode.Size = new System.Drawing.Size(76, 17); | 303 | this.rbGridRegionMode.Size = new System.Drawing.Size(76, 17); |
304 | this.rbGridRegionMode.TabIndex = 4; | 304 | this.rbGridRegionMode.TabIndex = 4; |
305 | this.rbGridRegionMode.Text = "Grid region"; | 305 | this.rbGridRegionMode.Text = "Grid region"; |
306 | this.rbGridRegionMode.UseVisualStyleBackColor = true; | 306 | this.rbGridRegionMode.UseVisualStyleBackColor = true; |
307 | this.rbGridRegionMode.CheckedChanged += new System.EventHandler(this.rbGridRegionMode_CheckedChanged); | 307 | this.rbGridRegionMode.CheckedChanged += new System.EventHandler(this.rbGridRegionMode_CheckedChanged); |
308 | // | 308 | // |
309 | // rbStandAloneMode | 309 | // rbStandAloneMode |
310 | // | 310 | // |
311 | this.rbStandAloneMode.AutoSize = true; | 311 | this.rbStandAloneMode.AutoSize = true; |
312 | this.rbStandAloneMode.Checked = true; | 312 | this.rbStandAloneMode.Checked = true; |
313 | this.rbStandAloneMode.Location = new System.Drawing.Point(319, 18); | 313 | this.rbStandAloneMode.Location = new System.Drawing.Point(319, 18); |
314 | this.rbStandAloneMode.Name = "rbStandAloneMode"; | 314 | this.rbStandAloneMode.Name = "rbStandAloneMode"; |
315 | this.rbStandAloneMode.Size = new System.Drawing.Size(82, 17); | 315 | this.rbStandAloneMode.Size = new System.Drawing.Size(82, 17); |
316 | this.rbStandAloneMode.TabIndex = 5; | 316 | this.rbStandAloneMode.TabIndex = 5; |
317 | this.rbStandAloneMode.TabStop = true; | 317 | this.rbStandAloneMode.TabStop = true; |
318 | this.rbStandAloneMode.Text = "Stand alone"; | 318 | this.rbStandAloneMode.Text = "Stand alone"; |
319 | this.rbStandAloneMode.UseVisualStyleBackColor = true; | 319 | this.rbStandAloneMode.UseVisualStyleBackColor = true; |
320 | this.rbStandAloneMode.CheckedChanged += new System.EventHandler(this.rbStandAloneMode_CheckedChanged); | 320 | this.rbStandAloneMode.CheckedChanged += new System.EventHandler(this.rbStandAloneMode_CheckedChanged); |
321 | // | 321 | // |
322 | // rbGridServer | 322 | // rbGridServer |
323 | // | 323 | // |
324 | this.rbGridServer.AutoSize = true; | 324 | this.rbGridServer.AutoSize = true; |
325 | this.rbGridServer.Location = new System.Drawing.Point(484, 18); | 325 | this.rbGridServer.Location = new System.Drawing.Point(484, 18); |
326 | this.rbGridServer.Name = "rbGridServer"; | 326 | this.rbGridServer.Name = "rbGridServer"; |
327 | this.rbGridServer.Size = new System.Drawing.Size(76, 17); | 327 | this.rbGridServer.Size = new System.Drawing.Size(76, 17); |
328 | this.rbGridServer.TabIndex = 6; | 328 | this.rbGridServer.TabIndex = 6; |
329 | this.rbGridServer.Text = "Grid server"; | 329 | this.rbGridServer.Text = "Grid server"; |
330 | this.rbGridServer.UseVisualStyleBackColor = true; | 330 | this.rbGridServer.UseVisualStyleBackColor = true; |
331 | this.rbGridServer.CheckedChanged += new System.EventHandler(this.rbGridServer_CheckedChanged); | 331 | this.rbGridServer.CheckedChanged += new System.EventHandler(this.rbGridServer_CheckedChanged); |
332 | // | 332 | // |
333 | // Main | 333 | // Main |
334 | // | 334 | // |
335 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | 335 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
336 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | 336 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
337 | this.ClientSize = new System.Drawing.Size(583, 299); | 337 | this.ClientSize = new System.Drawing.Size(583, 299); |
338 | this.Controls.Add(this.rbGridServer); | 338 | this.Controls.Add(this.rbGridServer); |
339 | this.Controls.Add(this.rbStandAloneMode); | 339 | this.Controls.Add(this.rbStandAloneMode); |
340 | this.Controls.Add(this.rbGridRegionMode); | 340 | this.Controls.Add(this.rbGridRegionMode); |
341 | this.Controls.Add(this.btnStop); | 341 | this.Controls.Add(this.btnStop); |
342 | this.Controls.Add(this.btnStart); | 342 | this.Controls.Add(this.btnStart); |
343 | this.Controls.Add(this.gbLog); | 343 | this.Controls.Add(this.gbLog); |
344 | this.Name = "Main"; | 344 | this.Name = "Main"; |
345 | this.Text = "OpenSim"; | 345 | this.Text = "OpenSim"; |
346 | this.Load += new System.EventHandler(this.Main_Load); | 346 | this.Load += new System.EventHandler(this.Main_Load); |
347 | this.tabLogs.ResumeLayout(false); | 347 | this.tabLogs.ResumeLayout(false); |
348 | this.tabMainLog.ResumeLayout(false); | 348 | this.tabMainLog.ResumeLayout(false); |
349 | this.tabMainLog.PerformLayout(); | 349 | this.tabMainLog.PerformLayout(); |
350 | this.tabRegionServer.ResumeLayout(false); | 350 | this.tabRegionServer.ResumeLayout(false); |
351 | this.tabRegionServer.PerformLayout(); | 351 | this.tabRegionServer.PerformLayout(); |
352 | this.tabUserServer.ResumeLayout(false); | 352 | this.tabUserServer.ResumeLayout(false); |
353 | this.tabUserServer.PerformLayout(); | 353 | this.tabUserServer.PerformLayout(); |
354 | this.tabAssetServer.ResumeLayout(false); | 354 | this.tabAssetServer.ResumeLayout(false); |
355 | this.tabAssetServer.PerformLayout(); | 355 | this.tabAssetServer.PerformLayout(); |
356 | this.tabGridServer.ResumeLayout(false); | 356 | this.tabGridServer.ResumeLayout(false); |
357 | this.tabGridServer.PerformLayout(); | 357 | this.tabGridServer.PerformLayout(); |
358 | this.gbLog.ResumeLayout(false); | 358 | this.gbLog.ResumeLayout(false); |
359 | this.ResumeLayout(false); | 359 | this.ResumeLayout(false); |
360 | this.PerformLayout(); | 360 | this.PerformLayout(); |
361 | 361 | ||
362 | } | 362 | } |
363 | 363 | ||
364 | #endregion | 364 | #endregion |
365 | 365 | ||
366 | private System.Windows.Forms.TabControl tabLogs; | 366 | private System.Windows.Forms.TabControl tabLogs; |
367 | private System.Windows.Forms.TabPage tabRegionServer; | 367 | private System.Windows.Forms.TabPage tabRegionServer; |
368 | private System.Windows.Forms.TabPage tabUserServer; | 368 | private System.Windows.Forms.TabPage tabUserServer; |
369 | private System.Windows.Forms.GroupBox gbLog; | 369 | private System.Windows.Forms.GroupBox gbLog; |
370 | private System.Windows.Forms.TextBox txtOpenSim; | 370 | private System.Windows.Forms.TextBox txtOpenSim; |
371 | private System.Windows.Forms.TextBox txtUserServer; | 371 | private System.Windows.Forms.TextBox txtUserServer; |
372 | private System.Windows.Forms.TabPage tabAssetServer; | 372 | private System.Windows.Forms.TabPage tabAssetServer; |
373 | private System.Windows.Forms.TextBox txtAssetServer; | 373 | private System.Windows.Forms.TextBox txtAssetServer; |
374 | private System.Windows.Forms.TabPage tabGridServer; | 374 | private System.Windows.Forms.TabPage tabGridServer; |
375 | private System.Windows.Forms.TextBox txtGridServer; | 375 | private System.Windows.Forms.TextBox txtGridServer; |
376 | private System.Windows.Forms.TabPage tabMainLog; | 376 | private System.Windows.Forms.TabPage tabMainLog; |
377 | private System.Windows.Forms.Button btnStart; | 377 | private System.Windows.Forms.Button btnStart; |
378 | private System.Windows.Forms.Button btnStop; | 378 | private System.Windows.Forms.Button btnStop; |
379 | private System.Windows.Forms.TextBox txtMainLog; | 379 | private System.Windows.Forms.TextBox txtMainLog; |
380 | private System.Windows.Forms.Label label1; | 380 | private System.Windows.Forms.Label label1; |
381 | private System.Windows.Forms.Label label2; | 381 | private System.Windows.Forms.Label label2; |
382 | private System.Windows.Forms.Label label3; | 382 | private System.Windows.Forms.Label label3; |
383 | private System.Windows.Forms.Label label4; | 383 | private System.Windows.Forms.Label label4; |
384 | private InputTextBoxControl txtInputRegionServer; | 384 | private InputTextBoxControl txtInputRegionServer; |
385 | private InputTextBoxControl txtInputUserServer; | 385 | private InputTextBoxControl txtInputUserServer; |
386 | private InputTextBoxControl txtInputAssetServer; | 386 | private InputTextBoxControl txtInputAssetServer; |
387 | private InputTextBoxControl txtInputGridServer; | 387 | private InputTextBoxControl txtInputGridServer; |
388 | private System.Windows.Forms.RadioButton rbGridRegionMode; | 388 | private System.Windows.Forms.RadioButton rbGridRegionMode; |
389 | private System.Windows.Forms.RadioButton rbStandAloneMode; | 389 | private System.Windows.Forms.RadioButton rbStandAloneMode; |
390 | private System.Windows.Forms.RadioButton rbGridServer; | 390 | private System.Windows.Forms.RadioButton rbGridServer; |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
diff --git a/OpenSim/Tools/OpenSim.GUI/Main.cs b/OpenSim/Tools/OpenSim.GUI/Main.cs index 0b5af28..5de4af4 100644 --- a/OpenSim/Tools/OpenSim.GUI/Main.cs +++ b/OpenSim/Tools/OpenSim.GUI/Main.cs | |||
@@ -1,242 +1,242 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.ComponentModel; | 3 | using System.ComponentModel; |
4 | using System.Data; | 4 | using System.Data; |
5 | using System.Drawing; | 5 | using System.Drawing; |
6 | using System.Text; | 6 | using System.Text; |
7 | using System.Windows.Forms; | 7 | using System.Windows.Forms; |
8 | 8 | ||
9 | namespace OpenSim.GUI | 9 | namespace OpenSim.GUI |
10 | { | 10 | { |
11 | public partial class Main : Form | 11 | public partial class Main : Form |
12 | { | 12 | { |
13 | 13 | ||
14 | public ProcessManager proc_OpenSim; | 14 | public ProcessManager proc_OpenSim; |
15 | public ProcessManager proc_UserServer; | 15 | public ProcessManager proc_UserServer; |
16 | public ProcessManager proc_GridServer; | 16 | public ProcessManager proc_GridServer; |
17 | public ProcessManager proc_AssetServer; | 17 | public ProcessManager proc_AssetServer; |
18 | 18 | ||
19 | public Main() | 19 | public Main() |
20 | { | 20 | { |
21 | InitializeComponent(); | 21 | InitializeComponent(); |
22 | } | 22 | } |
23 | 23 | ||
24 | private void Main_Load(object sender, EventArgs e) | 24 | private void Main_Load(object sender, EventArgs e) |
25 | { | 25 | { |
26 | txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress); | 26 | txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress); |
27 | txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress); | 27 | txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress); |
28 | txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress); | 28 | txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress); |
29 | txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress); | 29 | txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress); |
30 | 30 | ||
31 | tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected); | 31 | tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected); |
32 | 32 | ||
33 | UpdateTabVisibility(); | 33 | UpdateTabVisibility(); |
34 | } | 34 | } |
35 | 35 | ||
36 | void tabLogs_Selected(object sender, TabControlEventArgs e) | 36 | void tabLogs_Selected(object sender, TabControlEventArgs e) |
37 | { | 37 | { |
38 | if (e.TabPage == tabUserServer) | 38 | if (e.TabPage == tabUserServer) |
39 | txtInputUserServer.Focus(); | 39 | txtInputUserServer.Focus(); |
40 | if (e.TabPage == tabGridServer) | 40 | if (e.TabPage == tabGridServer) |
41 | txtInputGridServer.Focus(); | 41 | txtInputGridServer.Focus(); |
42 | if (e.TabPage == tabAssetServer) | 42 | if (e.TabPage == tabAssetServer) |
43 | txtInputAssetServer.Focus(); | 43 | txtInputAssetServer.Focus(); |
44 | if (e.TabPage == tabRegionServer) | 44 | if (e.TabPage == tabRegionServer) |
45 | txtInputRegionServer.Focus(); | 45 | txtInputRegionServer.Focus(); |
46 | } | 46 | } |
47 | 47 | ||
48 | void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e) | 48 | void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e) |
49 | { | 49 | { |
50 | 50 | ||
51 | if (e.KeyChar == 13) | 51 | if (e.KeyChar == 13) |
52 | { | 52 | { |
53 | // We got a command | 53 | // We got a command |
54 | e.Handled = true; | 54 | e.Handled = true; |
55 | proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n"); | 55 | proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n"); |
56 | txtInputUserServer.Text = ""; | 56 | txtInputUserServer.Text = ""; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e) | 60 | void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e) |
61 | { | 61 | { |
62 | if (e.KeyChar == 13) | 62 | if (e.KeyChar == 13) |
63 | { | 63 | { |
64 | // We got a command | 64 | // We got a command |
65 | e.Handled = true; | 65 | e.Handled = true; |
66 | proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n"); | 66 | proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n"); |
67 | txtInputGridServer.Text = ""; | 67 | txtInputGridServer.Text = ""; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e) | 71 | void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e) |
72 | { | 72 | { |
73 | if (e.KeyChar == 13) | 73 | if (e.KeyChar == 13) |
74 | { | 74 | { |
75 | // We got a command | 75 | // We got a command |
76 | e.Handled = true; | 76 | e.Handled = true; |
77 | proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n"); | 77 | proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n"); |
78 | txtInputAssetServer.Text = ""; | 78 | txtInputAssetServer.Text = ""; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e) | 82 | void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e) |
83 | { | 83 | { |
84 | if (e.KeyChar == 13) | 84 | if (e.KeyChar == 13) |
85 | { | 85 | { |
86 | // We got a command | 86 | // We got a command |
87 | e.Handled = true; | 87 | e.Handled = true; |
88 | proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n"); | 88 | proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n"); |
89 | txtInputRegionServer.Text = ""; | 89 | txtInputRegionServer.Text = ""; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | private void btnStart_Click(object sender, EventArgs e) | 93 | private void btnStart_Click(object sender, EventArgs e) |
94 | { | 94 | { |
95 | 95 | ||
96 | // | 96 | // |
97 | // THIS PART NEEDS TO BE MOVED TO A SEPARATE THREAD OR A TIMER OF SOME SORT | 97 | // THIS PART NEEDS TO BE MOVED TO A SEPARATE THREAD OR A TIMER OF SOME SORT |
98 | // should not block on wait | 98 | // should not block on wait |
99 | // ALSO - IF SOME SERVICES ARE NOT CONFIGURED, POP UP CONFIGURATION BOX FOR THAT SERVICE! | 99 | // ALSO - IF SOME SERVICES ARE NOT CONFIGURED, POP UP CONFIGURATION BOX FOR THAT SERVICE! |
100 | // | 100 | // |
101 | 101 | ||
102 | btnStart.Enabled = false; | 102 | btnStart.Enabled = false; |
103 | btnStop.Enabled = false; | 103 | btnStop.Enabled = false; |
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | if (rbGridServer.Checked) | 107 | if (rbGridServer.Checked) |
108 | { | 108 | { |
109 | // Start UserServer | 109 | // Start UserServer |
110 | proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", ""); | 110 | proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", ""); |
111 | txtMainLog.AppendText("Starting: User server" + "\r\n"); | 111 | txtMainLog.AppendText("Starting: User server" + "\r\n"); |
112 | proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); | 112 | proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); |
113 | proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); | 113 | proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); |
114 | proc_UserServer.StartProcess(); | 114 | proc_UserServer.StartProcess(); |
115 | System.Threading.Thread.Sleep(3000); | 115 | System.Threading.Thread.Sleep(3000); |
116 | 116 | ||
117 | // Start GridServer | 117 | // Start GridServer |
118 | proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", ""); | 118 | proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", ""); |
119 | txtMainLog.AppendText("Starting: Grid server" + "\r\n"); | 119 | txtMainLog.AppendText("Starting: Grid server" + "\r\n"); |
120 | proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); | 120 | proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); |
121 | proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); | 121 | proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); |
122 | proc_GridServer.StartProcess(); | 122 | proc_GridServer.StartProcess(); |
123 | System.Threading.Thread.Sleep(3000); | 123 | System.Threading.Thread.Sleep(3000); |
124 | 124 | ||
125 | // Start AssetServer | 125 | // Start AssetServer |
126 | proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", ""); | 126 | proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", ""); |
127 | txtMainLog.AppendText("Starting: Asset server" + "\r\n"); | 127 | txtMainLog.AppendText("Starting: Asset server" + "\r\n"); |
128 | proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); | 128 | proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); |
129 | proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); | 129 | proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); |
130 | proc_AssetServer.StartProcess(); | 130 | proc_AssetServer.StartProcess(); |
131 | System.Threading.Thread.Sleep(3000); | 131 | System.Threading.Thread.Sleep(3000); |
132 | } | 132 | } |
133 | 133 | ||
134 | // Start OpenSim | 134 | // Start OpenSim |
135 | string p = ""; | 135 | string p = ""; |
136 | if (rbGridServer.Checked) | 136 | if (rbGridServer.Checked) |
137 | p = "-gridmode=true"; | 137 | p = "-gridmode=true"; |
138 | 138 | ||
139 | proc_OpenSim = new ProcessManager("OpenSim.EXE", p); | 139 | proc_OpenSim = new ProcessManager("OpenSim.EXE", p); |
140 | txtMainLog.AppendText("Starting: OpenSim (Region server)" + "\r\n"); | 140 | txtMainLog.AppendText("Starting: OpenSim (Region server)" + "\r\n"); |
141 | proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); | 141 | proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); |
142 | proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); | 142 | proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); |
143 | proc_OpenSim.StartProcess(); | 143 | proc_OpenSim.StartProcess(); |
144 | 144 | ||
145 | btnStart.Enabled = false; | 145 | btnStart.Enabled = false; |
146 | btnStop.Enabled = true; | 146 | btnStop.Enabled = true; |
147 | 147 | ||
148 | } | 148 | } |
149 | public delegate void AppendText(string Text); | 149 | public delegate void AppendText(string Text); |
150 | void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) | 150 | void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) |
151 | { | 151 | { |
152 | this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" }); | 152 | this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" }); |
153 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" }); | 153 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" }); |
154 | } | 154 | } |
155 | void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) | 155 | void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) |
156 | { | 156 | { |
157 | this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" }); | 157 | this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" }); |
158 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" }); | 158 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" }); |
159 | } | 159 | } |
160 | void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) | 160 | void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) |
161 | { | 161 | { |
162 | this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" }); | 162 | this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" }); |
163 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" }); | 163 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" }); |
164 | } | 164 | } |
165 | void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) | 165 | void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) |
166 | { | 166 | { |
167 | this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" }); | 167 | this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" }); |
168 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" }); | 168 | this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" }); |
169 | } | 169 | } |
170 | 170 | ||
171 | private void btnStop_Click(object sender, EventArgs e) | 171 | private void btnStop_Click(object sender, EventArgs e) |
172 | { | 172 | { |
173 | btnStart.Enabled = false; | 173 | btnStart.Enabled = false; |
174 | btnStop.Enabled = false; | 174 | btnStop.Enabled = false; |
175 | 175 | ||
176 | if (proc_UserServer != null) | 176 | if (proc_UserServer != null) |
177 | { | 177 | { |
178 | txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime.ToString() + "\r\n"); | 178 | txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime.ToString() + "\r\n"); |
179 | proc_UserServer.StopProcess(); | 179 | proc_UserServer.StopProcess(); |
180 | } | 180 | } |
181 | if (proc_GridServer != null) | 181 | if (proc_GridServer != null) |
182 | { | 182 | { |
183 | txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime.ToString() + "\r\n"); | 183 | txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime.ToString() + "\r\n"); |
184 | proc_GridServer.StopProcess(); | 184 | proc_GridServer.StopProcess(); |
185 | } | 185 | } |
186 | if (proc_AssetServer != null) | 186 | if (proc_AssetServer != null) |
187 | { | 187 | { |
188 | txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime.ToString() + "\r\n"); | 188 | txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime.ToString() + "\r\n"); |
189 | proc_AssetServer.StopProcess(); | 189 | proc_AssetServer.StopProcess(); |
190 | } | 190 | } |
191 | if (proc_OpenSim != null) | 191 | if (proc_OpenSim != null) |
192 | { | 192 | { |
193 | txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime.ToString() + "\r\n"); | 193 | txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime.ToString() + "\r\n"); |
194 | proc_OpenSim.StopProcess(); | 194 | proc_OpenSim.StopProcess(); |
195 | } | 195 | } |
196 | 196 | ||
197 | btnStart.Enabled = true; | 197 | btnStart.Enabled = true; |
198 | btnStop.Enabled = false; | 198 | btnStop.Enabled = false; |
199 | 199 | ||
200 | 200 | ||
201 | } | 201 | } |
202 | 202 | ||
203 | private void UpdateTabVisibility() | 203 | private void UpdateTabVisibility() |
204 | { | 204 | { |
205 | if (rbStandAloneMode.Checked) | 205 | if (rbStandAloneMode.Checked) |
206 | { | 206 | { |
207 | if (tabLogs.TabPages.Contains(tabUserServer)) | 207 | if (tabLogs.TabPages.Contains(tabUserServer)) |
208 | tabLogs.TabPages.Remove(tabUserServer); | 208 | tabLogs.TabPages.Remove(tabUserServer); |
209 | if (tabLogs.TabPages.Contains(tabGridServer)) | 209 | if (tabLogs.TabPages.Contains(tabGridServer)) |
210 | tabLogs.TabPages.Remove(tabGridServer); | 210 | tabLogs.TabPages.Remove(tabGridServer); |
211 | if (tabLogs.TabPages.Contains(tabAssetServer)) | 211 | if (tabLogs.TabPages.Contains(tabAssetServer)) |
212 | tabLogs.TabPages.Remove(tabAssetServer); | 212 | tabLogs.TabPages.Remove(tabAssetServer); |
213 | } | 213 | } |
214 | else | 214 | else |
215 | { | 215 | { |
216 | if (!tabLogs.TabPages.Contains(tabUserServer)) | 216 | if (!tabLogs.TabPages.Contains(tabUserServer)) |
217 | tabLogs.TabPages.Add(tabUserServer); | 217 | tabLogs.TabPages.Add(tabUserServer); |
218 | if (!tabLogs.TabPages.Contains(tabGridServer)) | 218 | if (!tabLogs.TabPages.Contains(tabGridServer)) |
219 | tabLogs.TabPages.Add(tabGridServer); | 219 | tabLogs.TabPages.Add(tabGridServer); |
220 | if (!tabLogs.TabPages.Contains(tabAssetServer)) | 220 | if (!tabLogs.TabPages.Contains(tabAssetServer)) |
221 | tabLogs.TabPages.Add(tabAssetServer); | 221 | tabLogs.TabPages.Add(tabAssetServer); |
222 | } | 222 | } |
223 | 223 | ||
224 | } | 224 | } |
225 | 225 | ||
226 | private void rbStandAloneMode_CheckedChanged(object sender, EventArgs e) | 226 | private void rbStandAloneMode_CheckedChanged(object sender, EventArgs e) |
227 | { | 227 | { |
228 | UpdateTabVisibility(); | 228 | UpdateTabVisibility(); |
229 | } | 229 | } |
230 | 230 | ||
231 | private void rbGridRegionMode_CheckedChanged(object sender, EventArgs e) | 231 | private void rbGridRegionMode_CheckedChanged(object sender, EventArgs e) |
232 | { | 232 | { |
233 | UpdateTabVisibility(); | 233 | UpdateTabVisibility(); |
234 | } | 234 | } |
235 | 235 | ||
236 | private void rbGridServer_CheckedChanged(object sender, EventArgs e) | 236 | private void rbGridServer_CheckedChanged(object sender, EventArgs e) |
237 | { | 237 | { |
238 | UpdateTabVisibility(); | 238 | UpdateTabVisibility(); |
239 | } | 239 | } |
240 | 240 | ||
241 | } | 241 | } |
242 | } \ No newline at end of file | 242 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs index 0ab074e..8c019fb 100644 --- a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs +++ b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs | |||
@@ -1,71 +1,71 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Diagnostics; | 4 | using System.Diagnostics; |
5 | 5 | ||
6 | namespace OpenSim.GUI | 6 | namespace OpenSim.GUI |
7 | { | 7 | { |
8 | public class ProcessManager : Process | 8 | public class ProcessManager : Process |
9 | { | 9 | { |
10 | private string m_FileName; | 10 | private string m_FileName; |
11 | private string m_Arguments; | 11 | private string m_Arguments; |
12 | public ProcessManager(string FileName,string Arguments) | 12 | public ProcessManager(string FileName,string Arguments) |
13 | { | 13 | { |
14 | m_FileName = FileName; | 14 | m_FileName = FileName; |
15 | m_Arguments = Arguments; | 15 | m_Arguments = Arguments; |
16 | 16 | ||
17 | // MyProc = new Process(); | 17 | // MyProc = new Process(); |
18 | StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; | 18 | StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; |
19 | Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); | 19 | Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); |
20 | StartInfo.FileName = m_FileName; | 20 | StartInfo.FileName = m_FileName; |
21 | 21 | ||
22 | //p.StartInfo.Arguments = ""; | 22 | //p.StartInfo.Arguments = ""; |
23 | StartInfo.UseShellExecute = false; | 23 | StartInfo.UseShellExecute = false; |
24 | StartInfo.RedirectStandardError = true; | 24 | StartInfo.RedirectStandardError = true; |
25 | StartInfo.RedirectStandardInput = true; | 25 | StartInfo.RedirectStandardInput = true; |
26 | StartInfo.RedirectStandardOutput = true; | 26 | StartInfo.RedirectStandardOutput = true; |
27 | StartInfo.CreateNoWindow = true; | 27 | StartInfo.CreateNoWindow = true; |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | public void StartProcess() | 33 | public void StartProcess() |
34 | { | 34 | { |
35 | try | 35 | try |
36 | { | 36 | { |
37 | Start(); | 37 | Start(); |
38 | BeginOutputReadLine(); | 38 | BeginOutputReadLine(); |
39 | BeginErrorReadLine(); | 39 | BeginErrorReadLine(); |
40 | } | 40 | } |
41 | catch (Exception ex) | 41 | catch (Exception ex) |
42 | { | 42 | { |
43 | Console.WriteLine("Exception Occurred :{0},{1}", | 43 | Console.WriteLine("Exception Occurred :{0},{1}", |
44 | ex.Message, ex.StackTrace.ToString()); | 44 | ex.Message, ex.StackTrace.ToString()); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | public void StopProcess() | 47 | public void StopProcess() |
48 | { | 48 | { |
49 | try | 49 | try |
50 | { | 50 | { |
51 | CancelErrorRead(); | 51 | CancelErrorRead(); |
52 | CancelErrorRead(); | 52 | CancelErrorRead(); |
53 | if (!HasExited) | 53 | if (!HasExited) |
54 | { | 54 | { |
55 | StandardInput.WriteLine("quit"); | 55 | StandardInput.WriteLine("quit"); |
56 | StandardInput.WriteLine("shutdown"); | 56 | StandardInput.WriteLine("shutdown"); |
57 | System.Threading.Thread.Sleep(500); | 57 | System.Threading.Thread.Sleep(500); |
58 | if (!HasExited) | 58 | if (!HasExited) |
59 | { | 59 | { |
60 | Kill(); | 60 | Kill(); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
64 | catch (Exception ex) | 64 | catch (Exception ex) |
65 | { | 65 | { |
66 | Console.WriteLine("Exception Occurred :{0},{1}", | 66 | Console.WriteLine("Exception Occurred :{0},{1}", |
67 | ex.Message, ex.StackTrace.ToString()); | 67 | ex.Message, ex.StackTrace.ToString()); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
diff --git a/OpenSim/Tools/OpenSim.GUI/Program.cs b/OpenSim/Tools/OpenSim.GUI/Program.cs index a849b1b..3766ee6 100644 --- a/OpenSim/Tools/OpenSim.GUI/Program.cs +++ b/OpenSim/Tools/OpenSim.GUI/Program.cs | |||
@@ -1,20 +1,20 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Windows.Forms; | 3 | using System.Windows.Forms; |
4 | 4 | ||
5 | namespace OpenSim.GUI | 5 | namespace OpenSim.GUI |
6 | { | 6 | { |
7 | static class Program | 7 | static class Program |
8 | { | 8 | { |
9 | /// <summary> | 9 | /// <summary> |
10 | /// The main entry point for the application. | 10 | /// The main entry point for the application. |
11 | /// </summary> | 11 | /// </summary> |
12 | [STAThread] | 12 | [STAThread] |
13 | static void Main() | 13 | static void Main() |
14 | { | 14 | { |
15 | Application.EnableVisualStyles(); | 15 | Application.EnableVisualStyles(); |
16 | Application.SetCompatibleTextRenderingDefault(false); | 16 | Application.SetCompatibleTextRenderingDefault(false); |
17 | Application.Run(new Main()); | 17 | Application.Run(new Main()); |
18 | } | 18 | } |
19 | } | 19 | } |
20 | } \ No newline at end of file | 20 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs b/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs index 3e86b1c..adc2285 100644 --- a/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs +++ b/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.GUI")] | 8 | [assembly: AssemblyTitle("OpenSim.GUI")] |
9 | [assembly: AssemblyDescription("")] | 9 | [assembly: AssemblyDescription("")] |
10 | [assembly: AssemblyConfiguration("")] | 10 | [assembly: AssemblyConfiguration("")] |
11 | [assembly: AssemblyCompany("")] | 11 | [assembly: AssemblyCompany("")] |
12 | [assembly: AssemblyProduct("OpenSim.GUI")] | 12 | [assembly: AssemblyProduct("OpenSim.GUI")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 13 | [assembly: AssemblyCopyright("Copyright © 2007")] |
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("c8dbda49-66bd-476b-93b3-71774870b73e")] | 23 | [assembly: Guid("c8dbda49-66bd-476b-93b3-71774870b73e")] |
24 | 24 | ||
25 | // Version information for an assembly consists of the following four values: | 25 | // Version information for an assembly consists of the following four values: |
26 | // | 26 | // |
27 | // Major Version | 27 | // Major Version |
28 | // Minor Version | 28 | // Minor Version |
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs b/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs index f7de4f0..33e67d4 100644 --- a/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs +++ b/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs | |||
@@ -1,71 +1,71 @@ | |||
1 | //------------------------------------------------------------------------------ | 1 | //------------------------------------------------------------------------------ |
2 | // <auto-generated> | 2 | // <auto-generated> |
3 | // This code was generated by a tool. | 3 | // This code was generated by a tool. |
4 | // Runtime Version:2.0.50727.312 | 4 | // Runtime Version:2.0.50727.312 |
5 | // | 5 | // |
6 | // Changes to this file may cause incorrect behavior and will be lost if | 6 | // Changes to this file may cause incorrect behavior and will be lost if |
7 | // the code is regenerated. | 7 | // the code is regenerated. |
8 | // </auto-generated> | 8 | // </auto-generated> |
9 | //------------------------------------------------------------------------------ | 9 | //------------------------------------------------------------------------------ |
10 | 10 | ||
11 | namespace OpenSim.GUI.Properties | 11 | namespace OpenSim.GUI.Properties |
12 | { | 12 | { |
13 | 13 | ||
14 | 14 | ||
15 | /// <summary> | 15 | /// <summary> |
16 | /// A strongly-typed resource class, for looking up localized strings, etc. | 16 | /// A strongly-typed resource class, for looking up localized strings, etc. |
17 | /// </summary> | 17 | /// </summary> |
18 | // This class was auto-generated by the StronglyTypedResourceBuilder | 18 | // This class was auto-generated by the StronglyTypedResourceBuilder |
19 | // class via a tool like ResGen or Visual Studio. | 19 | // class via a tool like ResGen or Visual Studio. |
20 | // To add or remove a member, edit your .ResX file then rerun ResGen | 20 | // To add or remove a member, edit your .ResX file then rerun ResGen |
21 | // with the /str option, or rebuild your VS project. | 21 | // with the /str option, or rebuild your VS project. |
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] | 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] |
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
25 | internal class Resources | 25 | internal class Resources |
26 | { | 26 | { |
27 | 27 | ||
28 | private static global::System.Resources.ResourceManager resourceMan; | 28 | private static global::System.Resources.ResourceManager resourceMan; |
29 | 29 | ||
30 | private static global::System.Globalization.CultureInfo resourceCulture; | 30 | private static global::System.Globalization.CultureInfo resourceCulture; |
31 | 31 | ||
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
33 | internal Resources() | 33 | internal Resources() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | /// <summary> | 37 | /// <summary> |
38 | /// Returns the cached ResourceManager instance used by this class. | 38 | /// Returns the cached ResourceManager instance used by this class. |
39 | /// </summary> | 39 | /// </summary> |
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
41 | internal static global::System.Resources.ResourceManager ResourceManager | 41 | internal static global::System.Resources.ResourceManager ResourceManager |
42 | { | 42 | { |
43 | get | 43 | get |
44 | { | 44 | { |
45 | if ((resourceMan == null)) | 45 | if ((resourceMan == null)) |
46 | { | 46 | { |
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSim.GUI.Properties.Resources", typeof(Resources).Assembly); | 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSim.GUI.Properties.Resources", typeof(Resources).Assembly); |
48 | resourceMan = temp; | 48 | resourceMan = temp; |
49 | } | 49 | } |
50 | return resourceMan; | 50 | return resourceMan; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Overrides the current thread's CurrentUICulture property for all | 55 | /// Overrides the current thread's CurrentUICulture property for all |
56 | /// resource lookups using this strongly typed resource class. | 56 | /// resource lookups using this strongly typed resource class. |
57 | /// </summary> | 57 | /// </summary> |
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
59 | internal static global::System.Globalization.CultureInfo Culture | 59 | internal static global::System.Globalization.CultureInfo Culture |
60 | { | 60 | { |
61 | get | 61 | get |
62 | { | 62 | { |
63 | return resourceCulture; | 63 | return resourceCulture; |
64 | } | 64 | } |
65 | set | 65 | set |
66 | { | 66 | { |
67 | resourceCulture = value; | 67 | resourceCulture = value; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs b/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs index e23862a..dd1db86 100644 --- a/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs +++ b/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs | |||
@@ -1,30 +1,30 @@ | |||
1 | //------------------------------------------------------------------------------ | 1 | //------------------------------------------------------------------------------ |
2 | // <auto-generated> | 2 | // <auto-generated> |
3 | // This code was generated by a tool. | 3 | // This code was generated by a tool. |
4 | // Runtime Version:2.0.50727.312 | 4 | // Runtime Version:2.0.50727.312 |
5 | // | 5 | // |
6 | // Changes to this file may cause incorrect behavior and will be lost if | 6 | // Changes to this file may cause incorrect behavior and will be lost if |
7 | // the code is regenerated. | 7 | // the code is regenerated. |
8 | // </auto-generated> | 8 | // </auto-generated> |
9 | //------------------------------------------------------------------------------ | 9 | //------------------------------------------------------------------------------ |
10 | 10 | ||
11 | namespace OpenSim.GUI.Properties | 11 | namespace OpenSim.GUI.Properties |
12 | { | 12 | { |
13 | 13 | ||
14 | 14 | ||
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] | 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] |
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase | 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase |
18 | { | 18 | { |
19 | 19 | ||
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
21 | 21 | ||
22 | public static Settings Default | 22 | public static Settings Default |
23 | { | 23 | { |
24 | get | 24 | get |
25 | { | 25 | { |
26 | return defaultInstance; | 26 | return defaultInstance; |
27 | } | 27 | } |
28 | } | 28 | } |
29 | } | 29 | } |
30 | } | 30 | } |
diff --git a/OpenSim/Tools/OpenSim.GUI/frmConfiguration.Designer.cs b/OpenSim/Tools/OpenSim.GUI/frmConfiguration.Designer.cs index 1777fbc..bba9361 100644 --- a/OpenSim/Tools/OpenSim.GUI/frmConfiguration.Designer.cs +++ b/OpenSim/Tools/OpenSim.GUI/frmConfiguration.Designer.cs | |||
@@ -1,61 +1,61 @@ | |||
1 | namespace OpenSim.GUI | 1 | namespace OpenSim.GUI |
2 | { | 2 | { |
3 | partial class frmConfiguration | 3 | partial class frmConfiguration |
4 | { | 4 | { |
5 | /// <summary> | 5 | /// <summary> |
6 | /// Required designer variable. | 6 | /// Required designer variable. |
7 | /// </summary> | 7 | /// </summary> |
8 | private System.ComponentModel.IContainer components = null; | 8 | private System.ComponentModel.IContainer components = null; |
9 | 9 | ||
10 | /// <summary> | 10 | /// <summary> |
11 | /// Clean up any resources being used. | 11 | /// Clean up any resources being used. |
12 | /// </summary> | 12 | /// </summary> |
13 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | 13 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
14 | protected override void Dispose(bool disposing) | 14 | protected override void Dispose(bool disposing) |
15 | { | 15 | { |
16 | if (disposing && (components != null)) | 16 | if (disposing && (components != null)) |
17 | { | 17 | { |
18 | components.Dispose(); | 18 | components.Dispose(); |
19 | } | 19 | } |
20 | base.Dispose(disposing); | 20 | base.Dispose(disposing); |
21 | } | 21 | } |
22 | 22 | ||
23 | #region Windows Form Designer generated code | 23 | #region Windows Form Designer generated code |
24 | 24 | ||
25 | /// <summary> | 25 | /// <summary> |
26 | /// Required method for Designer support - do not modify | 26 | /// Required method for Designer support - do not modify |
27 | /// the contents of this method with the code editor. | 27 | /// the contents of this method with the code editor. |
28 | /// </summary> | 28 | /// </summary> |
29 | private void InitializeComponent() | 29 | private void InitializeComponent() |
30 | { | 30 | { |
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmConfiguration)); | 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmConfiguration)); |
32 | this.textBox1 = new System.Windows.Forms.TextBox(); | 32 | this.textBox1 = new System.Windows.Forms.TextBox(); |
33 | this.SuspendLayout(); | 33 | this.SuspendLayout(); |
34 | // | 34 | // |
35 | // textBox1 | 35 | // textBox1 |
36 | // | 36 | // |
37 | this.textBox1.Location = new System.Drawing.Point(12, 12); | 37 | this.textBox1.Location = new System.Drawing.Point(12, 12); |
38 | this.textBox1.Multiline = true; | 38 | this.textBox1.Multiline = true; |
39 | this.textBox1.Name = "textBox1"; | 39 | this.textBox1.Name = "textBox1"; |
40 | this.textBox1.Size = new System.Drawing.Size(570, 190); | 40 | this.textBox1.Size = new System.Drawing.Size(570, 190); |
41 | this.textBox1.TabIndex = 0; | 41 | this.textBox1.TabIndex = 0; |
42 | this.textBox1.Text = resources.GetString("textBox1.Text"); | 42 | this.textBox1.Text = resources.GetString("textBox1.Text"); |
43 | // | 43 | // |
44 | // frmConfiguration | 44 | // frmConfiguration |
45 | // | 45 | // |
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
48 | this.ClientSize = new System.Drawing.Size(664, 413); | 48 | this.ClientSize = new System.Drawing.Size(664, 413); |
49 | this.Controls.Add(this.textBox1); | 49 | this.Controls.Add(this.textBox1); |
50 | this.Name = "frmConfiguration"; | 50 | this.Name = "frmConfiguration"; |
51 | this.Text = "Configuration"; | 51 | this.Text = "Configuration"; |
52 | this.ResumeLayout(false); | 52 | this.ResumeLayout(false); |
53 | this.PerformLayout(); | 53 | this.PerformLayout(); |
54 | 54 | ||
55 | } | 55 | } |
56 | 56 | ||
57 | #endregion | 57 | #endregion |
58 | 58 | ||
59 | private System.Windows.Forms.TextBox textBox1; | 59 | private System.Windows.Forms.TextBox textBox1; |
60 | } | 60 | } |
61 | } \ No newline at end of file | 61 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/OpenSim.GUI/frmConfiguration.cs b/OpenSim/Tools/OpenSim.GUI/frmConfiguration.cs index 9acf305..c305657 100644 --- a/OpenSim/Tools/OpenSim.GUI/frmConfiguration.cs +++ b/OpenSim/Tools/OpenSim.GUI/frmConfiguration.cs | |||
@@ -1,18 +1,18 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.ComponentModel; | 3 | using System.ComponentModel; |
4 | using System.Data; | 4 | using System.Data; |
5 | using System.Drawing; | 5 | using System.Drawing; |
6 | using System.Text; | 6 | using System.Text; |
7 | using System.Windows.Forms; | 7 | using System.Windows.Forms; |
8 | 8 | ||
9 | namespace OpenSim.GUI | 9 | namespace OpenSim.GUI |
10 | { | 10 | { |
11 | public partial class frmConfiguration : Form | 11 | public partial class frmConfiguration : Form |
12 | { | 12 | { |
13 | public frmConfiguration() | 13 | public frmConfiguration() |
14 | { | 14 | { |
15 | InitializeComponent(); | 15 | InitializeComponent(); |
16 | } | 16 | } |
17 | } | 17 | } |
18 | } \ No newline at end of file | 18 | } \ No newline at end of file |