diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
353 files changed, 15368 insertions, 10247 deletions
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs index b60ef02..40f4006 100644 --- a/OpenSim/Framework/Communications/CAPSService.cs +++ b/OpenSim/Framework/Communications/CAPSService.cs | |||
@@ -37,17 +37,17 @@ namespace OpenSim.Framework.Communications | |||
37 | public CAPSService(BaseHttpServer httpServer) | 37 | public CAPSService(BaseHttpServer httpServer) |
38 | { | 38 | { |
39 | m_server = httpServer; | 39 | m_server = httpServer; |
40 | this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); | 40 | AddCapsSeedHandler("/CapsSeed/", CapsRequest); |
41 | } | 41 | } |
42 | 42 | ||
43 | private void AddCapsSeedHandler(string path, RestMethod restMethod) | 43 | private void AddCapsSeedHandler(string path, RestMethod restMethod) |
44 | { | 44 | { |
45 | m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); | 45 | m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); |
46 | } | 46 | } |
47 | 47 | ||
48 | public string CapsRequest(string request, string path, string param) | 48 | public string CapsRequest(string request, string path, string param) |
49 | { | 49 | { |
50 | System.Console.WriteLine("new caps request " + request +" from path "+ path); | 50 | System.Console.WriteLine("new caps request " + request + " from path " + path); |
51 | return ""; | 51 | return ""; |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 39e2887..ca2fc35 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -29,12 +29,9 @@ | |||
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.Reflection; | ||
33 | using System.Threading; | 32 | using System.Threading; |
34 | using libsecondlife; | 33 | using libsecondlife; |
35 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
39 | 36 | ||
40 | namespace OpenSim.Framework.Communications.Cache | 37 | namespace OpenSim.Framework.Communications.Cache |
@@ -51,18 +48,22 @@ namespace OpenSim.Framework.Communications.Cache | |||
51 | public Dictionary<LLUUID, AssetInfo> Assets; | 48 | public Dictionary<LLUUID, AssetInfo> Assets; |
52 | public Dictionary<LLUUID, TextureImage> Textures; | 49 | public Dictionary<LLUUID, TextureImage> Textures; |
53 | 50 | ||
54 | public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers | 51 | public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers |
55 | public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent | 52 | public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent |
56 | 53 | ||
57 | public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server | 54 | public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); |
58 | public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server | 55 | //Assets requested from the asset server |
56 | |||
57 | public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); | ||
58 | //Textures requested from the asset server | ||
59 | 59 | ||
60 | public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); | 60 | public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); |
61 | private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>(); | 61 | private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>(); |
62 | 62 | ||
63 | private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>(); | 63 | private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>(); |
64 | 64 | ||
65 | private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent = new Dictionary<LLUUID, Dictionary<LLUUID, int>>(); | 65 | private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent = |
66 | new Dictionary<LLUUID, Dictionary<LLUUID, int>>(); | ||
66 | 67 | ||
67 | public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>(); | 68 | public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>(); |
68 | 69 | ||
@@ -76,19 +77,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
76 | /// </summary> | 77 | /// </summary> |
77 | public AssetCache(IAssetServer assetServer) | 78 | public AssetCache(IAssetServer assetServer) |
78 | { | 79 | { |
79 | OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE","Creating Asset cache"); | 80 | MainLog.Instance.Verbose("ASSETSTORAGE", "Creating Asset cache"); |
80 | _assetServer = assetServer; | 81 | _assetServer = assetServer; |
81 | _assetServer.SetReceiver(this); | 82 | _assetServer.SetReceiver(this); |
82 | Assets = new Dictionary<LLUUID, AssetInfo>(); | 83 | Assets = new Dictionary<LLUUID, AssetInfo>(); |
83 | Textures = new Dictionary<LLUUID, TextureImage>(); | 84 | Textures = new Dictionary<LLUUID, TextureImage>(); |
84 | this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | 85 | _assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); |
85 | this._assetCacheThread.IsBackground = true; | 86 | _assetCacheThread.IsBackground = true; |
86 | this._assetCacheThread.Start(); | 87 | _assetCacheThread.Start(); |
87 | |||
88 | this.TextureSenderThread = new Thread(new ThreadStart(this.ProcessTextureSenders)); | ||
89 | this.TextureSenderThread.IsBackground = true; | ||
90 | this.TextureSenderThread.Start(); | ||
91 | 88 | ||
89 | TextureSenderThread = new Thread(new ThreadStart(ProcessTextureSenders)); | ||
90 | TextureSenderThread.IsBackground = true; | ||
91 | TextureSenderThread.Start(); | ||
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
100 | { | 100 | { |
101 | try | 101 | try |
102 | { | 102 | { |
103 | this.ProcessAssetQueue(); | 103 | ProcessAssetQueue(); |
104 | this.ProcessTextureQueue(); | 104 | ProcessTextureQueue(); |
105 | Thread.Sleep(500); | 105 | Thread.Sleep(500); |
106 | } | 106 | } |
107 | catch (Exception e) | 107 | catch (Exception e) |
@@ -115,13 +115,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
115 | public AssetBase GetAsset(LLUUID assetID) | 115 | public AssetBase GetAsset(LLUUID assetID) |
116 | { | 116 | { |
117 | AssetBase asset = null; | 117 | AssetBase asset = null; |
118 | if (this.Textures.ContainsKey(assetID)) | 118 | if (Textures.ContainsKey(assetID)) |
119 | { | 119 | { |
120 | asset = this.Textures[assetID]; | 120 | asset = Textures[assetID]; |
121 | } | 121 | } |
122 | else if (this.Assets.ContainsKey(assetID)) | 122 | else if (Assets.ContainsKey(assetID)) |
123 | { | 123 | { |
124 | asset = this.Assets[assetID]; | 124 | asset = Assets[assetID]; |
125 | } | 125 | } |
126 | return asset; | 126 | return asset; |
127 | } | 127 | } |
@@ -129,13 +129,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
129 | public void GetAsset(LLUUID assetID, AssetRequestCallback callback) | 129 | public void GetAsset(LLUUID assetID, AssetRequestCallback callback) |
130 | { | 130 | { |
131 | AssetBase asset = null; | 131 | AssetBase asset = null; |
132 | if (this.Textures.ContainsKey(assetID)) | 132 | if (Textures.ContainsKey(assetID)) |
133 | { | 133 | { |
134 | asset = this.Textures[assetID]; | 134 | asset = Textures[assetID]; |
135 | } | 135 | } |
136 | else if (this.Assets.ContainsKey(assetID)) | 136 | else if (Assets.ContainsKey(assetID)) |
137 | { | 137 | { |
138 | asset = this.Assets[assetID]; | 138 | asset = Assets[assetID]; |
139 | } | 139 | } |
140 | 140 | ||
141 | if (asset != null) | 141 | if (asset != null) |
@@ -145,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
145 | else | 145 | else |
146 | { | 146 | { |
147 | NewAssetRequest req = new NewAssetRequest(assetID, callback); | 147 | NewAssetRequest req = new NewAssetRequest(assetID, callback); |
148 | if (this.RequestLists.ContainsKey(assetID)) | 148 | if (RequestLists.ContainsKey(assetID)) |
149 | { | 149 | { |
150 | lock (RequestLists) | 150 | lock (RequestLists) |
151 | { | 151 | { |
@@ -161,7 +161,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
161 | RequestLists.Add(assetID, reqList); | 161 | RequestLists.Add(assetID, reqList); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | this._assetServer.FetchAsset(assetID, false); | 164 | _assetServer.FetchAsset(assetID, false); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
@@ -171,22 +171,23 @@ namespace OpenSim.Framework.Communications.Cache | |||
171 | AssetBase asset = GetAsset(assetID); | 171 | AssetBase asset = GetAsset(assetID); |
172 | if (asset == null) | 172 | if (asset == null) |
173 | { | 173 | { |
174 | this._assetServer.FetchAsset(assetID, isTexture); | 174 | _assetServer.FetchAsset(assetID, isTexture); |
175 | } | 175 | } |
176 | return asset; | 176 | return asset; |
177 | } | 177 | } |
178 | 178 | ||
179 | public void AddAsset(AssetBase asset) | 179 | public void AddAsset(AssetBase asset) |
180 | { | 180 | { |
181 | //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); | 181 | //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); |
182 | if (asset.Type == 0) | 182 | if (asset.Type == 0) |
183 | { | 183 | { |
184 | //Console.WriteLine("which is a texture"); | 184 | //Console.WriteLine("which is a texture"); |
185 | if (!Textures.ContainsKey(asset.FullID)) | 185 | if (!Textures.ContainsKey(asset.FullID)) |
186 | { //texture | 186 | { |
187 | //texture | ||
187 | TextureImage textur = new TextureImage(asset); | 188 | TextureImage textur = new TextureImage(asset); |
188 | Textures.Add(textur.FullID, textur); | 189 | Textures.Add(textur.FullID, textur); |
189 | if(!asset.Temporary) | 190 | if (!asset.Temporary) |
190 | _assetServer.StoreAndCommitAsset(asset); | 191 | _assetServer.StoreAndCommitAsset(asset); |
191 | } | 192 | } |
192 | else | 193 | else |
@@ -219,49 +220,47 @@ namespace OpenSim.Framework.Communications.Cache | |||
219 | /// </summary> | 220 | /// </summary> |
220 | private void ProcessTextureQueue() | 221 | private void ProcessTextureQueue() |
221 | { | 222 | { |
222 | if (this.TextureRequests.Count == 0) | 223 | if (TextureRequests.Count == 0) |
223 | { | 224 | { |
224 | //no requests waiting | 225 | //no requests waiting |
225 | return; | 226 | return; |
226 | } | 227 | } |
227 | int num; | 228 | int num; |
228 | num = this.TextureRequests.Count; | 229 | num = TextureRequests.Count; |
229 | 230 | ||
230 | AssetRequest req; | 231 | AssetRequest req; |
231 | for (int i = 0; i < num; i++) | 232 | for (int i = 0; i < num; i++) |
232 | { | 233 | { |
233 | req = (AssetRequest)this.TextureRequests[i]; | 234 | req = (AssetRequest) TextureRequests[i]; |
234 | if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) | 235 | if (!SendingTextures.ContainsKey(req.ImageInfo.FullID)) |
235 | { | 236 | { |
236 | //Console.WriteLine("new texture to send"); | 237 | //Console.WriteLine("new texture to send"); |
237 | TextureSender sender = new TextureSender(req); | 238 | TextureSender sender = new TextureSender(req); |
238 | //sender.OnComplete += this.TextureSent; | 239 | //sender.OnComplete += this.TextureSent; |
239 | this.SendingTextures.Add(req.ImageInfo.FullID, sender); | 240 | SendingTextures.Add(req.ImageInfo.FullID, sender); |
240 | this.QueueTextures.Enqueue(sender); | 241 | QueueTextures.Enqueue(sender); |
241 | } | 242 | } |
242 | |||
243 | } | 243 | } |
244 | 244 | ||
245 | this.TextureRequests.Clear(); | 245 | TextureRequests.Clear(); |
246 | } | 246 | } |
247 | 247 | ||
248 | public void ProcessTextureSenders() | 248 | public void ProcessTextureSenders() |
249 | { | 249 | { |
250 | while (true) | 250 | while (true) |
251 | { | 251 | { |
252 | TextureSender sender = this.QueueTextures.Dequeue(); | 252 | TextureSender sender = QueueTextures.Dequeue(); |
253 | 253 | ||
254 | bool finished = sender.SendTexture(); | 254 | bool finished = sender.SendTexture(); |
255 | if (finished) | 255 | if (finished) |
256 | { | 256 | { |
257 | this.TextureSent(sender); | 257 | TextureSent(sender); |
258 | } | 258 | } |
259 | else | 259 | else |
260 | { | 260 | { |
261 | // Console.WriteLine("readding texture"); | 261 | // Console.WriteLine("readding texture"); |
262 | this.QueueTextures.Enqueue(sender); | 262 | QueueTextures.Enqueue(sender); |
263 | } | 263 | } |
264 | |||
265 | } | 264 | } |
266 | } | 265 | } |
267 | 266 | ||
@@ -271,16 +270,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
271 | /// <param name="sender"></param> | 270 | /// <param name="sender"></param> |
272 | public void TextureSent(TextureSender sender) | 271 | public void TextureSent(TextureSender sender) |
273 | { | 272 | { |
274 | if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) | 273 | if (SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) |
275 | { | 274 | { |
276 | this.SendingTextures.Remove(sender.request.ImageInfo.FullID); | 275 | SendingTextures.Remove(sender.request.ImageInfo.FullID); |
277 | // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); | 276 | // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); |
278 | } | 277 | } |
279 | } | 278 | } |
280 | 279 | ||
281 | public void AssetReceived(AssetBase asset, bool IsTexture) | 280 | public void AssetReceived(AssetBase asset, bool IsTexture) |
282 | { | 281 | { |
283 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server | 282 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server |
284 | { | 283 | { |
285 | //check if it is a texture or not | 284 | //check if it is a texture or not |
286 | //then add to the correct cache list | 285 | //then add to the correct cache list |
@@ -292,48 +291,48 @@ namespace OpenSim.Framework.Communications.Cache | |||
292 | //Console.WriteLine("asset recieved from asset server"); | 291 | //Console.WriteLine("asset recieved from asset server"); |
293 | 292 | ||
294 | TextureImage image = new TextureImage(asset); | 293 | TextureImage image = new TextureImage(asset); |
295 | if (!this.Textures.ContainsKey(image.FullID)) | 294 | if (!Textures.ContainsKey(image.FullID)) |
296 | { | 295 | { |
297 | this.Textures.Add(image.FullID, image); | 296 | Textures.Add(image.FullID, image); |
298 | if (this.RequestedTextures.ContainsKey(image.FullID)) | 297 | if (RequestedTextures.ContainsKey(image.FullID)) |
299 | { | 298 | { |
300 | AssetRequest req = this.RequestedTextures[image.FullID]; | 299 | AssetRequest req = RequestedTextures[image.FullID]; |
301 | req.ImageInfo = image; | 300 | req.ImageInfo = image; |
302 | if (image.Data.LongLength > 600) | 301 | if (image.Data.LongLength > 600) |
303 | { | 302 | { |
304 | //over 600 bytes so split up file | 303 | //over 600 bytes so split up file |
305 | req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000; | 304 | req.NumPackets = 1 + (int) (image.Data.Length - 600)/1000; |
306 | } | 305 | } |
307 | else | 306 | else |
308 | { | 307 | { |
309 | req.NumPackets = 1; | 308 | req.NumPackets = 1; |
310 | } | 309 | } |
311 | this.RequestedTextures.Remove(image.FullID); | 310 | RequestedTextures.Remove(image.FullID); |
312 | this.TextureRequests.Add(req); | 311 | TextureRequests.Add(req); |
313 | } | 312 | } |
314 | } | 313 | } |
315 | } | 314 | } |
316 | else | 315 | else |
317 | { | 316 | { |
318 | AssetInfo assetInf = new AssetInfo(asset); | 317 | AssetInfo assetInf = new AssetInfo(asset); |
319 | if (!this.Assets.ContainsKey(assetInf.FullID)) | 318 | if (!Assets.ContainsKey(assetInf.FullID)) |
320 | { | 319 | { |
321 | this.Assets.Add(assetInf.FullID, assetInf); | 320 | Assets.Add(assetInf.FullID, assetInf); |
322 | if (this.RequestedAssets.ContainsKey(assetInf.FullID)) | 321 | if (RequestedAssets.ContainsKey(assetInf.FullID)) |
323 | { | 322 | { |
324 | AssetRequest req = this.RequestedAssets[assetInf.FullID]; | 323 | AssetRequest req = RequestedAssets[assetInf.FullID]; |
325 | req.AssetInf = assetInf; | 324 | req.AssetInf = assetInf; |
326 | if (assetInf.Data.LongLength > 600) | 325 | if (assetInf.Data.LongLength > 600) |
327 | { | 326 | { |
328 | //over 600 bytes so split up file | 327 | //over 600 bytes so split up file |
329 | req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; | 328 | req.NumPackets = 1 + (int) (assetInf.Data.Length - 600 + 999)/1000; |
330 | } | 329 | } |
331 | else | 330 | else |
332 | { | 331 | { |
333 | req.NumPackets = 1; | 332 | req.NumPackets = 1; |
334 | } | 333 | } |
335 | this.RequestedAssets.Remove(assetInf.FullID); | 334 | RequestedAssets.Remove(assetInf.FullID); |
336 | this.AssetRequests.Add(req); | 335 | AssetRequests.Add(req); |
337 | } | 336 | } |
338 | } | 337 | } |
339 | } | 338 | } |
@@ -345,7 +344,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
345 | { | 344 | { |
346 | req.Callback(asset.FullID, asset); | 345 | req.Callback(asset.FullID, asset); |
347 | } | 346 | } |
348 | 347 | ||
349 | lock (RequestLists) | 348 | lock (RequestLists) |
350 | { | 349 | { |
351 | RequestLists.Remove(asset.FullID); | 350 | RequestLists.Remove(asset.FullID); |
@@ -373,6 +372,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
373 | } | 372 | } |
374 | 373 | ||
375 | #region Assets | 374 | #region Assets |
375 | |||
376 | /// <summary> | 376 | /// <summary> |
377 | /// | 377 | /// |
378 | /// </summary> | 378 | /// </summary> |
@@ -396,11 +396,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
396 | } | 396 | } |
397 | //check to see if asset is in local cache, if not we need to request it from asset server. | 397 | //check to see if asset is in local cache, if not we need to request it from asset server. |
398 | //Console.WriteLine("asset request " + requestID); | 398 | //Console.WriteLine("asset request " + requestID); |
399 | if (!this.Assets.ContainsKey(requestID)) | 399 | if (!Assets.ContainsKey(requestID)) |
400 | { | 400 | { |
401 | //not found asset | 401 | //not found asset |
402 | // so request from asset server | 402 | // so request from asset server |
403 | if (!this.RequestedAssets.ContainsKey(requestID)) | 403 | if (!RequestedAssets.ContainsKey(requestID)) |
404 | { | 404 | { |
405 | AssetRequest request = new AssetRequest(); | 405 | AssetRequest request = new AssetRequest(); |
406 | request.RequestUser = userInfo; | 406 | request.RequestUser = userInfo; |
@@ -408,13 +408,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
408 | request.TransferRequestID = transferRequest.TransferInfo.TransferID; | 408 | request.TransferRequestID = transferRequest.TransferInfo.TransferID; |
409 | request.AssetRequestSource = source; | 409 | request.AssetRequestSource = source; |
410 | request.Params = transferRequest.TransferInfo.Params; | 410 | request.Params = transferRequest.TransferInfo.Params; |
411 | this.RequestedAssets.Add(requestID, request); | 411 | RequestedAssets.Add(requestID, request); |
412 | this._assetServer.FetchAsset(requestID, false); | 412 | _assetServer.FetchAsset(requestID, false); |
413 | } | 413 | } |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | //it is in our cache | 416 | //it is in our cache |
417 | AssetInfo asset = this.Assets[requestID]; | 417 | AssetInfo asset = Assets[requestID]; |
418 | 418 | ||
419 | //work out how many packets it should be sent in | 419 | //work out how many packets it should be sent in |
420 | // and add to the AssetRequests list | 420 | // and add to the AssetRequests list |
@@ -429,14 +429,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
429 | if (asset.Data.LongLength > 600) | 429 | if (asset.Data.LongLength > 600) |
430 | { | 430 | { |
431 | //over 600 bytes so split up file | 431 | //over 600 bytes so split up file |
432 | req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; | 432 | req.NumPackets = 1 + (int) (asset.Data.Length - 600 + 999)/1000; |
433 | } | 433 | } |
434 | else | 434 | else |
435 | { | 435 | { |
436 | req.NumPackets = 1; | 436 | req.NumPackets = 1; |
437 | } | 437 | } |
438 | 438 | ||
439 | this.AssetRequests.Add(req); | 439 | AssetRequests.Add(req); |
440 | } | 440 | } |
441 | 441 | ||
442 | /// <summary> | 442 | /// <summary> |
@@ -444,17 +444,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
444 | /// </summary> | 444 | /// </summary> |
445 | private void ProcessAssetQueue() | 445 | private void ProcessAssetQueue() |
446 | { | 446 | { |
447 | if (this.AssetRequests.Count == 0) | 447 | if (AssetRequests.Count == 0) |
448 | { | 448 | { |
449 | //no requests waiting | 449 | //no requests waiting |
450 | return; | 450 | return; |
451 | } | 451 | } |
452 | int num; | 452 | int num; |
453 | 453 | ||
454 | if (this.AssetRequests.Count < 5) | 454 | if (AssetRequests.Count < 5) |
455 | { | 455 | { |
456 | //lower than 5 so do all of them | 456 | //lower than 5 so do all of them |
457 | num = this.AssetRequests.Count; | 457 | num = AssetRequests.Count; |
458 | } | 458 | } |
459 | else | 459 | else |
460 | { | 460 | { |
@@ -463,7 +463,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
463 | AssetRequest req; | 463 | AssetRequest req; |
464 | for (int i = 0; i < num; i++) | 464 | for (int i = 0; i < num; i++) |
465 | { | 465 | { |
466 | req = (AssetRequest)this.AssetRequests[i]; | 466 | req = (AssetRequest) AssetRequests[i]; |
467 | //Console.WriteLine("sending asset " + req.RequestAssetID); | 467 | //Console.WriteLine("sending asset " + req.RequestAssetID); |
468 | TransferInfoPacket Transfer = new TransferInfoPacket(); | 468 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
469 | Transfer.TransferInfo.ChannelType = 2; | 469 | Transfer.TransferInfo.ChannelType = 2; |
@@ -473,7 +473,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
473 | { | 473 | { |
474 | Transfer.TransferInfo.Params = new byte[20]; | 474 | Transfer.TransferInfo.Params = new byte[20]; |
475 | Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); | 475 | Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); |
476 | int assType = (int)req.AssetInf.Type; | 476 | int assType = (int) req.AssetInf.Type; |
477 | Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); | 477 | Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); |
478 | } | 478 | } |
479 | else if (req.AssetRequestSource == 3) | 479 | else if (req.AssetRequestSource == 3) |
@@ -483,7 +483,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
483 | //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); | 483 | //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); |
484 | //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); | 484 | //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); |
485 | } | 485 | } |
486 | Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; | 486 | Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length; |
487 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | 487 | Transfer.TransferInfo.TransferID = req.TransferRequestID; |
488 | req.RequestUser.OutPacket(Transfer); | 488 | req.RequestUser.OutPacket(Transfer); |
489 | 489 | ||
@@ -533,19 +533,19 @@ namespace OpenSim.Framework.Communications.Cache | |||
533 | req.RequestUser.OutPacket(TransferPacket); | 533 | req.RequestUser.OutPacket(TransferPacket); |
534 | } | 534 | } |
535 | } | 535 | } |
536 | |||
537 | } | 536 | } |
538 | 537 | ||
539 | //remove requests that have been completed | 538 | //remove requests that have been completed |
540 | for (int i = 0; i < num; i++) | 539 | for (int i = 0; i < num; i++) |
541 | { | 540 | { |
542 | this.AssetRequests.RemoveAt(0); | 541 | AssetRequests.RemoveAt(0); |
543 | } | 542 | } |
544 | |||
545 | } | 543 | } |
544 | |||
546 | #endregion | 545 | #endregion |
547 | 546 | ||
548 | #region Textures | 547 | #region Textures |
548 | |||
549 | /// <summary> | 549 | /// <summary> |
550 | /// | 550 | /// |
551 | /// </summary> | 551 | /// </summary> |
@@ -553,21 +553,21 @@ namespace OpenSim.Framework.Communications.Cache | |||
553 | /// <param name="imageID"></param> | 553 | /// <param name="imageID"></param> |
554 | public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard) | 554 | public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard) |
555 | { | 555 | { |
556 | // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber); | 556 | // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber); |
557 | //check to see if texture is in local cache, if not request from asset server | 557 | //check to see if texture is in local cache, if not request from asset server |
558 | if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) | 558 | if (!AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) |
559 | { | 559 | { |
560 | this.AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>()); | 560 | AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>()); |
561 | } | 561 | } |
562 | /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) | 562 | /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) |
563 | { | 563 | { |
564 | //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them"); | 564 | //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them"); |
565 | return; | 565 | return; |
566 | }*/ | 566 | }*/ |
567 | 567 | ||
568 | if (!this.Textures.ContainsKey(imageID)) | 568 | if (!Textures.ContainsKey(imageID)) |
569 | { | 569 | { |
570 | if (!this.RequestedTextures.ContainsKey(imageID)) | 570 | if (!RequestedTextures.ContainsKey(imageID)) |
571 | { | 571 | { |
572 | //not is cache so request from asset server | 572 | //not is cache so request from asset server |
573 | AssetRequest request = new AssetRequest(); | 573 | AssetRequest request = new AssetRequest(); |
@@ -575,14 +575,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
575 | request.RequestAssetID = imageID; | 575 | request.RequestAssetID = imageID; |
576 | request.IsTextureRequest = true; | 576 | request.IsTextureRequest = true; |
577 | request.DiscardLevel = discard; | 577 | request.DiscardLevel = discard; |
578 | this.RequestedTextures.Add(imageID, request); | 578 | RequestedTextures.Add(imageID, request); |
579 | this._assetServer.FetchAsset(imageID, true); | 579 | _assetServer.FetchAsset(imageID, true); |
580 | } | 580 | } |
581 | return; | 581 | return; |
582 | } | 582 | } |
583 | 583 | ||
584 | // System.Console.WriteLine("texture already in cache"); | 584 | // System.Console.WriteLine("texture already in cache"); |
585 | TextureImage imag = this.Textures[imageID]; | 585 | TextureImage imag = Textures[imageID]; |
586 | AssetRequest req = new AssetRequest(); | 586 | AssetRequest req = new AssetRequest(); |
587 | req.RequestUser = userInfo; | 587 | req.RequestUser = userInfo; |
588 | req.RequestAssetID = imageID; | 588 | req.RequestAssetID = imageID; |
@@ -594,7 +594,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
594 | { | 594 | { |
595 | //Console.WriteLine("{0}", imag.Data.LongLength); | 595 | //Console.WriteLine("{0}", imag.Data.LongLength); |
596 | //over 600 bytes so split up file | 596 | //over 600 bytes so split up file |
597 | req.NumPackets = 2 + (int)(imag.Data.Length - 601) / 1000; | 597 | req.NumPackets = 2 + (int) (imag.Data.Length - 601)/1000; |
598 | //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets"); | 598 | //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets"); |
599 | } | 599 | } |
600 | else | 600 | else |
@@ -603,12 +603,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
603 | } | 603 | } |
604 | if (packetNumber != 0) | 604 | if (packetNumber != 0) |
605 | { | 605 | { |
606 | req.PacketCounter = (int)packetNumber; | 606 | req.PacketCounter = (int) packetNumber; |
607 | } | 607 | } |
608 | this.TextureRequests.Add(req); | 608 | TextureRequests.Add(req); |
609 | } | 609 | } |
610 | 610 | ||
611 | |||
612 | #endregion | 611 | #endregion |
613 | 612 | ||
614 | public class AssetRequest | 613 | public class AssetRequest |
@@ -630,7 +629,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
630 | 629 | ||
631 | public AssetRequest() | 630 | public AssetRequest() |
632 | { | 631 | { |
633 | |||
634 | } | 632 | } |
635 | } | 633 | } |
636 | 634 | ||
@@ -638,7 +636,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
638 | { | 636 | { |
639 | public AssetInfo() | 637 | public AssetInfo() |
640 | { | 638 | { |
641 | |||
642 | } | 639 | } |
643 | 640 | ||
644 | public AssetInfo(AssetBase aBase) | 641 | public AssetInfo(AssetBase aBase) |
@@ -656,7 +653,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
656 | { | 653 | { |
657 | public TextureImage() | 654 | public TextureImage() |
658 | { | 655 | { |
659 | |||
660 | } | 656 | } |
661 | 657 | ||
662 | public TextureImage(AssetBase aBase) | 658 | public TextureImage(AssetBase aBase) |
@@ -678,7 +674,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
678 | public TextureSender(AssetRequest req) | 674 | public TextureSender(AssetRequest req) |
679 | { | 675 | { |
680 | request = req; | 676 | request = req; |
681 | |||
682 | } | 677 | } |
683 | 678 | ||
684 | public bool SendTexture() | 679 | public bool SendTexture() |
@@ -686,7 +681,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
686 | SendPacket(); | 681 | SendPacket(); |
687 | counter++; | 682 | counter++; |
688 | 683 | ||
689 | if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | (request.DiscardLevel == -1)) | 684 | if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | |
685 | (request.DiscardLevel == -1)) | ||
690 | { | 686 | { |
691 | return true; | 687 | return true; |
692 | } | 688 | } |
@@ -707,7 +703,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
707 | im.Header.Reliable = false; | 703 | im.Header.Reliable = false; |
708 | im.ImageID.Packets = 1; | 704 | im.ImageID.Packets = 1; |
709 | im.ImageID.ID = req.ImageInfo.FullID; | 705 | im.ImageID.ID = req.ImageInfo.FullID; |
710 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | 706 | im.ImageID.Size = (uint) req.ImageInfo.Data.Length; |
711 | im.ImageData.Data = req.ImageInfo.Data; | 707 | im.ImageData.Data = req.ImageInfo.Data; |
712 | im.ImageID.Codec = 2; | 708 | im.ImageID.Codec = 2; |
713 | req.RequestUser.OutPacket(im); | 709 | req.RequestUser.OutPacket(im); |
@@ -721,9 +717,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
721 | //more than one packet so split file up | 717 | //more than one packet so split file up |
722 | ImageDataPacket im = new ImageDataPacket(); | 718 | ImageDataPacket im = new ImageDataPacket(); |
723 | im.Header.Reliable = false; | 719 | im.Header.Reliable = false; |
724 | im.ImageID.Packets = (ushort)(req.NumPackets); | 720 | im.ImageID.Packets = (ushort) (req.NumPackets); |
725 | im.ImageID.ID = req.ImageInfo.FullID; | 721 | im.ImageID.ID = req.ImageInfo.FullID; |
726 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | 722 | im.ImageID.Size = (uint) req.ImageInfo.Data.Length; |
727 | im.ImageData.Data = new byte[600]; | 723 | im.ImageData.Data = new byte[600]; |
728 | Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); | 724 | Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); |
729 | im.ImageID.Codec = 2; | 725 | im.ImageID.Codec = 2; |
@@ -742,19 +738,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
742 | //more than one packet so split file up | 738 | //more than one packet so split file up |
743 | ImagePacketPacket im = new ImagePacketPacket(); | 739 | ImagePacketPacket im = new ImagePacketPacket(); |
744 | im.Header.Reliable = false; | 740 | im.Header.Reliable = false; |
745 | im.ImageID.Packet = (ushort)(req.PacketCounter); | 741 | im.ImageID.Packet = (ushort) (req.PacketCounter); |
746 | im.ImageID.ID = req.ImageInfo.FullID; | 742 | im.ImageID.ID = req.ImageInfo.FullID; |
747 | int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1)); | 743 | int size = req.ImageInfo.Data.Length - 600 - (1000*(req.PacketCounter - 1)); |
748 | if (size > 1000) size = 1000; | 744 | if (size > 1000) size = 1000; |
749 | //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); | 745 | //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); |
750 | im.ImageData.Data = new byte[size]; | 746 | im.ImageData.Data = new byte[size]; |
751 | Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size); | 747 | Array.Copy(req.ImageInfo.Data, 600 + (1000*(req.PacketCounter - 1)), im.ImageData.Data, 0, size); |
752 | req.RequestUser.OutPacket(im); | 748 | req.RequestUser.OutPacket(im); |
753 | req.PacketCounter++; | 749 | req.PacketCounter++; |
754 | //req.ImageInfo.last_used = time; | 750 | //req.ImageInfo.last_used = time; |
755 | //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID); | 751 | //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID); |
756 | } | 752 | } |
757 | |||
758 | } | 753 | } |
759 | 754 | ||
760 | private void SaveAssetToFile(string filename, byte[] data) | 755 | private void SaveAssetToFile(string filename, byte[] data) |
@@ -789,7 +784,5 @@ namespace OpenSim.Framework.Communications.Cache | |||
789 | AssetID = assetID; | 784 | AssetID = assetID; |
790 | Callback = callback; | 785 | Callback = callback; |
791 | } | 786 | } |
792 | |||
793 | |||
794 | } | 787 | } |
795 | } | 788 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index c927571..fa421c7 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs | |||
@@ -25,18 +25,11 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | 28 | using System.IO; |
31 | using System.Threading; | ||
32 | using Db4objects.Db4o; | 29 | using Db4objects.Db4o; |
33 | using Db4objects.Db4o.Query; | 30 | using Db4objects.Db4o.Query; |
34 | using libsecondlife; | 31 | using libsecondlife; |
35 | using Nini.Config; | ||
36 | using OpenSim.Framework.Communications.Cache; | ||
37 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework; | ||
40 | 33 | ||
41 | namespace OpenSim.Framework.Communications.Cache | 34 | namespace OpenSim.Framework.Communications.Cache |
42 | { | 35 | { |
@@ -50,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
50 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); | 43 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); |
51 | 44 | ||
52 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); | 45 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); |
53 | MainLog.Instance.Verbose("ASSETS","Db4 Asset database creation"); | 46 | MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation"); |
54 | 47 | ||
55 | if (!yapfile) | 48 | if (!yapfile) |
56 | { | 49 | { |
@@ -68,29 +61,29 @@ namespace OpenSim.Framework.Communications.Cache | |||
68 | db.Commit(); | 61 | db.Commit(); |
69 | } | 62 | } |
70 | 63 | ||
71 | override public void Close() | 64 | public override void Close() |
72 | { | 65 | { |
73 | base.Close(); | 66 | base.Close(); |
74 | 67 | ||
75 | if (db != null) | 68 | if (db != null) |
76 | { | 69 | { |
77 | MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database"); | 70 | MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database"); |
78 | db.Close(); | 71 | db.Close(); |
79 | } | 72 | } |
80 | } | 73 | } |
81 | 74 | ||
82 | override protected void RunRequests() | 75 | protected override void RunRequests() |
83 | { | 76 | { |
84 | while (true) | 77 | while (true) |
85 | { | 78 | { |
86 | byte[] idata = null; | 79 | byte[] idata = null; |
87 | bool found = false; | 80 | bool found = false; |
88 | AssetStorage foundAsset = null; | 81 | AssetStorage foundAsset = null; |
89 | ARequest req = this._assetRequests.Dequeue(); | 82 | ARequest req = _assetRequests.Dequeue(); |
90 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); | 83 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); |
91 | if (result.Count > 0) | 84 | if (result.Count > 0) |
92 | { | 85 | { |
93 | foundAsset = (AssetStorage)result.Next(); | 86 | foundAsset = (AssetStorage) result.Next(); |
94 | found = true; | 87 | found = true; |
95 | } | 88 | } |
96 | 89 | ||
@@ -110,12 +103,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
110 | //asset.FullID = ; | 103 | //asset.FullID = ; |
111 | _receiver.AssetNotFound(req.AssetID); | 104 | _receiver.AssetNotFound(req.AssetID); |
112 | } | 105 | } |
113 | |||
114 | } | 106 | } |
115 | |||
116 | } | 107 | } |
117 | 108 | ||
118 | override protected void StoreAsset(AssetBase asset) | 109 | protected override void StoreAsset(AssetBase asset) |
119 | { | 110 | { |
120 | AssetStorage store = new AssetStorage(); | 111 | AssetStorage store = new AssetStorage(); |
121 | store.Data = asset.Data; | 112 | store.Data = asset.Data; |
@@ -148,6 +139,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
148 | { | 139 | { |
149 | _findID = find; | 140 | _findID = find; |
150 | } | 141 | } |
142 | |||
151 | public bool Match(AssetStorage asset) | 143 | public bool Match(AssetStorage asset) |
152 | { | 144 | { |
153 | return (asset.UUID == _findID); | 145 | return (asset.UUID == _findID); |
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 0771a20..7109910 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -5,8 +5,6 @@ using System.Threading; | |||
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Nini.Config; | 6 | using Nini.Config; |
7 | using OpenSim.Framework.Console; | 7 | using OpenSim.Framework.Console; |
8 | using OpenSim.Framework.Interfaces; | ||
9 | using OpenSim.Framework; | ||
10 | 8 | ||
11 | namespace OpenSim.Framework.Communications.Cache | 9 | namespace OpenSim.Framework.Communications.Cache |
12 | { | 10 | { |
@@ -36,13 +34,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
36 | 34 | ||
37 | public AssetServerBase() | 35 | public AssetServerBase() |
38 | { | 36 | { |
37 | MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system"); | ||
38 | _assetRequests = new BlockingQueue<ARequest>(); | ||
39 | 39 | ||
40 | OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSERVER","Starting asset storage system"); | 40 | _localAssetServerThread = new Thread(RunRequests); |
41 | this._assetRequests = new BlockingQueue<ARequest>(); | 41 | _localAssetServerThread.IsBackground = true; |
42 | 42 | _localAssetServerThread.Start(); | |
43 | this._localAssetServerThread = new Thread(RunRequests); | ||
44 | this._localAssetServerThread.IsBackground = true; | ||
45 | this._localAssetServerThread.Start(); | ||
46 | } | 43 | } |
47 | 44 | ||
48 | public void LoadAsset(AssetBase info, bool image, string filename) | 45 | public void LoadAsset(AssetBase info, bool image, string filename) |
@@ -57,7 +54,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
57 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | 54 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); |
58 | byte[] idata = new byte[numBytes]; | 55 | byte[] idata = new byte[numBytes]; |
59 | BinaryReader br = new BinaryReader(fStream); | 56 | BinaryReader br = new BinaryReader(fStream); |
60 | idata = br.ReadBytes((int)numBytes); | 57 | idata = br.ReadBytes((int) numBytes); |
61 | br.Close(); | 58 | br.Close(); |
62 | fStream.Close(); | 59 | fStream.Close(); |
63 | info.Data = idata; | 60 | info.Data = idata; |
@@ -66,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
66 | 63 | ||
67 | public void SetReceiver(IAssetReceiver receiver) | 64 | public void SetReceiver(IAssetReceiver receiver) |
68 | { | 65 | { |
69 | this._receiver = receiver; | 66 | _receiver = receiver; |
70 | } | 67 | } |
71 | 68 | ||
72 | public void FetchAsset(LLUUID assetID, bool isTexture) | 69 | public void FetchAsset(LLUUID assetID, bool isTexture) |
@@ -74,7 +71,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
74 | ARequest req = new ARequest(); | 71 | ARequest req = new ARequest(); |
75 | req.AssetID = assetID; | 72 | req.AssetID = assetID; |
76 | req.IsTexture = isTexture; | 73 | req.IsTexture = isTexture; |
77 | this._assetRequests.Enqueue(req); | 74 | _assetRequests.Enqueue(req); |
78 | } | 75 | } |
79 | 76 | ||
80 | public void UpdateAsset(AssetBase asset) | 77 | public void UpdateAsset(AssetBase asset) |
@@ -102,7 +99,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
102 | 99 | ||
103 | public void SetServerInfo(string ServerUrl, string ServerKey) | 100 | public void SetServerInfo(string ServerUrl, string ServerKey) |
104 | { | 101 | { |
105 | |||
106 | } | 102 | } |
107 | 103 | ||
108 | public virtual List<AssetBase> GetDefaultAssets() | 104 | public virtual List<AssetBase> GetDefaultAssets() |
@@ -175,8 +171,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
175 | // System.Console.WriteLine("loading asset into database"); | 171 | // System.Console.WriteLine("loading asset into database"); |
176 | string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); | 172 | string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); |
177 | string name = source.Configs[i].GetString("name", ""); | 173 | string name = source.Configs[i].GetString("name", ""); |
178 | sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); | 174 | sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); |
179 | sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); | 175 | sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0); |
180 | string fileName = source.Configs[i].GetString("fileName", ""); | 176 | string fileName = source.Configs[i].GetString("fileName", ""); |
181 | 177 | ||
182 | AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); | 178 | AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); |
@@ -189,4 +185,4 @@ namespace OpenSim.Framework.Communications.Cache | |||
189 | assets.ForEach(action); | 185 | assets.ForEach(action); |
190 | } | 186 | } |
191 | } | 187 | } |
192 | } | 188 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs index d622e02..55b255a 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs | |||
@@ -25,15 +25,8 @@ | |||
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; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using libsecondlife; | 29 | using libsecondlife; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Data; | ||
37 | 30 | ||
38 | namespace OpenSim.Framework.Communications.Cache | 31 | namespace OpenSim.Framework.Communications.Cache |
39 | { | 32 | { |
@@ -41,7 +34,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
41 | { | 34 | { |
42 | // Fields | 35 | // Fields |
43 | public CommunicationsManager CommsManager; | 36 | public CommunicationsManager CommsManager; |
44 | public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = new Dictionary<LLUUID, AgentAssetTransactions>(); | 37 | |
38 | public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = | ||
39 | new Dictionary<LLUUID, AgentAssetTransactions>(); | ||
40 | |||
45 | private bool m_dumpAssetsToFile; | 41 | private bool m_dumpAssetsToFile; |
46 | 42 | ||
47 | public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) | 43 | public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) |
@@ -53,10 +49,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
53 | // Methods | 49 | // Methods |
54 | public AgentAssetTransactions AddUser(LLUUID userID) | 50 | public AgentAssetTransactions AddUser(LLUUID userID) |
55 | { | 51 | { |
56 | if (!this.AgentTransactions.ContainsKey(userID)) | 52 | if (!AgentTransactions.ContainsKey(userID)) |
57 | { | 53 | { |
58 | AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); | 54 | AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); |
59 | this.AgentTransactions.Add(userID, transactions); | 55 | AgentTransactions.Add(userID, transactions); |
60 | return transactions; | 56 | return transactions; |
61 | } | 57 | } |
62 | return null; | 58 | return null; |
@@ -64,27 +60,30 @@ namespace OpenSim.Framework.Communications.Cache | |||
64 | 60 | ||
65 | public AgentAssetTransactions GetUserTransActions(LLUUID userID) | 61 | public AgentAssetTransactions GetUserTransActions(LLUUID userID) |
66 | { | 62 | { |
67 | if (this.AgentTransactions.ContainsKey(userID)) | 63 | if (AgentTransactions.ContainsKey(userID)) |
68 | { | 64 | { |
69 | return this.AgentTransactions[userID]; | 65 | return AgentTransactions[userID]; |
70 | } | 66 | } |
71 | return null; | 67 | return null; |
72 | } | 68 | } |
73 | 69 | ||
74 | public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | 70 | public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, |
71 | uint callbackID, string description, string name, sbyte invType, | ||
72 | sbyte type, byte wearableType, uint nextOwnerMask) | ||
75 | { | 73 | { |
76 | AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); | 74 | AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); |
77 | if (transactions != null) | 75 | if (transactions != null) |
78 | { | 76 | { |
79 | transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); | 77 | transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, |
78 | name, invType, type, wearableType, nextOwnerMask); | ||
80 | } | 79 | } |
81 | |||
82 | } | 80 | } |
83 | 81 | ||
84 | public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) | 82 | public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, |
83 | byte[] data, bool storeLocal) | ||
85 | { | 84 | { |
86 | // Console.WriteLine("asset upload of " + assetID); | 85 | // Console.WriteLine("asset upload of " + assetID); |
87 | AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); | 86 | AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); |
88 | if (transactions != null) | 87 | if (transactions != null) |
89 | { | 88 | { |
90 | AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); | 89 | AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); |
@@ -97,7 +96,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
97 | 96 | ||
98 | public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) | 97 | public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) |
99 | { | 98 | { |
100 | AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); | 99 | AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); |
101 | if (transactions != null) | 100 | if (transactions != null) |
102 | { | 101 | { |
103 | transactions.HandleXfer(xferID, packetID, data); | 102 | transactions.HandleXfer(xferID, packetID, data); |
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index e78f4f7..6b08fc9 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs | |||
@@ -26,17 +26,12 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | 30 | using System.IO; |
33 | using libsecondlife; | 31 | using libsecondlife; |
34 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
35 | using OpenSim.Framework.Communications.Cache; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Capabilities; | ||
39 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
34 | using OpenSim.Region.Capabilities; | ||
40 | 35 | ||
41 | namespace OpenSim.Framework.Communications.Cache | 36 | namespace OpenSim.Framework.Communications.Cache |
42 | { | 37 | { |
@@ -53,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
53 | // Methods | 48 | // Methods |
54 | public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) | 49 | public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) |
55 | { | 50 | { |
56 | this.UserID = agentID; | 51 | UserID = agentID; |
57 | Manager = manager; | 52 | Manager = manager; |
58 | m_dumpAssetsToFile = dumpAssetsToFile; | 53 | m_dumpAssetsToFile = dumpAssetsToFile; |
59 | } | 54 | } |
@@ -61,24 +56,24 @@ namespace OpenSim.Framework.Communications.Cache | |||
61 | public AssetCapsUploader RequestCapsUploader() | 56 | public AssetCapsUploader RequestCapsUploader() |
62 | { | 57 | { |
63 | AssetCapsUploader uploader = new AssetCapsUploader(); | 58 | AssetCapsUploader uploader = new AssetCapsUploader(); |
64 | this.CapsUploaders.Add(uploader); | 59 | CapsUploaders.Add(uploader); |
65 | return uploader; | 60 | return uploader; |
66 | } | 61 | } |
67 | 62 | ||
68 | public NoteCardCapsUpdate RequestNoteCardUpdater() | 63 | public NoteCardCapsUpdate RequestNoteCardUpdater() |
69 | { | 64 | { |
70 | NoteCardCapsUpdate update = new NoteCardCapsUpdate(); | 65 | NoteCardCapsUpdate update = new NoteCardCapsUpdate(); |
71 | this.NotecardUpdaters.Add(update); | 66 | NotecardUpdaters.Add(update); |
72 | return update; | 67 | return update; |
73 | } | 68 | } |
74 | 69 | ||
75 | public AssetXferUploader RequestXferUploader(LLUUID transactionID) | 70 | public AssetXferUploader RequestXferUploader(LLUUID transactionID) |
76 | { | 71 | { |
77 | if (!this.XferUploaders.ContainsKey(transactionID)) | 72 | if (!XferUploaders.ContainsKey(transactionID)) |
78 | { | 73 | { |
79 | AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); | 74 | AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); |
80 | 75 | ||
81 | this.XferUploaders.Add(transactionID, uploader); | 76 | XferUploaders.Add(transactionID, uploader); |
82 | return uploader; | 77 | return uploader; |
83 | } | 78 | } |
84 | return null; | 79 | return null; |
@@ -86,7 +81,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
86 | 81 | ||
87 | public void HandleXfer(ulong xferID, uint packetID, byte[] data) | 82 | public void HandleXfer(ulong xferID, uint packetID, byte[] data) |
88 | { | 83 | { |
89 | foreach (AssetXferUploader uploader in this.XferUploaders.Values) | 84 | foreach (AssetXferUploader uploader in XferUploaders.Values) |
90 | { | 85 | { |
91 | if (uploader.XferID == xferID) | 86 | if (uploader.XferID == xferID) |
92 | { | 87 | { |
@@ -96,17 +91,21 @@ namespace OpenSim.Framework.Communications.Cache | |||
96 | } | 91 | } |
97 | } | 92 | } |
98 | 93 | ||
99 | public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | 94 | public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, |
95 | uint callbackID, string description, string name, sbyte invType, | ||
96 | sbyte type, byte wearableType, uint nextOwnerMask) | ||
100 | { | 97 | { |
101 | if (this.XferUploaders.ContainsKey(transactionID)) | 98 | if (XferUploaders.ContainsKey(transactionID)) |
102 | { | 99 | { |
103 | this.XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); | 100 | XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID, |
101 | callbackID, description, name, invType, type, | ||
102 | wearableType, nextOwnerMask); | ||
104 | } | 103 | } |
105 | } | 104 | } |
106 | 105 | ||
107 | public AssetBase GetTransactionAsset(LLUUID transactionID) | 106 | public AssetBase GetTransactionAsset(LLUUID transactionID) |
108 | { | 107 | { |
109 | if (this.XferUploaders.ContainsKey(transactionID)) | 108 | if (XferUploaders.ContainsKey(transactionID)) |
110 | { | 109 | { |
111 | return XferUploaders[transactionID].GetAssetData(); | 110 | return XferUploaders[transactionID].GetAssetData(); |
112 | } | 111 | } |
@@ -130,15 +129,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
130 | public event UpLoadedAsset OnUpLoad; | 129 | public event UpLoadedAsset OnUpLoad; |
131 | 130 | ||
132 | // Methods | 131 | // Methods |
133 | public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile) | 132 | public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, |
133 | LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile) | ||
134 | { | 134 | { |
135 | this.m_assetName = assetName; | 135 | m_assetName = assetName; |
136 | this.m_assetDescription = assetDescription; | 136 | m_assetDescription = assetDescription; |
137 | this.m_folderID = folderID; | 137 | m_folderID = folderID; |
138 | this.newAssetID = assetID; | 138 | newAssetID = assetID; |
139 | this.inventoryItemID = inventoryItem; | 139 | inventoryItemID = inventoryItem; |
140 | this.uploaderPath = path; | 140 | uploaderPath = path; |
141 | this.httpListener = httpServer; | 141 | httpListener = httpServer; |
142 | m_dumpImageToFile = dumpImageToFile; | 142 | m_dumpImageToFile = dumpImageToFile; |
143 | } | 143 | } |
144 | 144 | ||
@@ -156,18 +156,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
156 | LLUUID inventoryItemID = this.inventoryItemID; | 156 | LLUUID inventoryItemID = this.inventoryItemID; |
157 | string text = ""; | 157 | string text = ""; |
158 | LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); | 158 | LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); |
159 | complete.new_asset = this.newAssetID.ToStringHyphenated(); | 159 | complete.new_asset = newAssetID.ToStringHyphenated(); |
160 | complete.new_inventory_item = inventoryItemID; | 160 | complete.new_inventory_item = inventoryItemID; |
161 | complete.state = "complete"; | 161 | complete.state = "complete"; |
162 | text = LLSDHelpers.SerialiseLLSDReply(complete); | 162 | text = LLSDHelpers.SerialiseLLSDReply(complete); |
163 | this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); | 163 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
164 | if (this.m_dumpImageToFile) | 164 | if (m_dumpImageToFile) |
165 | { | 165 | { |
166 | this.SaveImageToFile(this.m_assetName + ".jp2", data); | 166 | SaveImageToFile(m_assetName + ".jp2", data); |
167 | } | 167 | } |
168 | if (this.OnUpLoad != null) | 168 | if (OnUpLoad != null) |
169 | { | 169 | { |
170 | this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , ""); | 170 | OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", ""); |
171 | } | 171 | } |
172 | return text; | 172 | return text; |
173 | } | 173 | } |
@@ -196,90 +196,91 @@ namespace OpenSim.Framework.Communications.Cache | |||
196 | 196 | ||
197 | public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) | 197 | public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) |
198 | { | 198 | { |
199 | this.m_userTransactions = transactions; | 199 | m_userTransactions = transactions; |
200 | m_dumpAssetToFile = dumpAssetToFile; | 200 | m_dumpAssetToFile = dumpAssetToFile; |
201 | } | 201 | } |
202 | 202 | ||
203 | // Methods | 203 | // Methods |
204 | public void HandleXferPacket(ulong xferID, uint packetID, byte[] data) | 204 | public void HandleXferPacket(ulong xferID, uint packetID, byte[] data) |
205 | { | 205 | { |
206 | if (this.XferID == xferID) | 206 | if (XferID == xferID) |
207 | { | 207 | { |
208 | if (this.Asset.Data.Length > 1) | 208 | if (Asset.Data.Length > 1) |
209 | { | 209 | { |
210 | byte[] destinationArray = new byte[this.Asset.Data.Length + data.Length]; | 210 | byte[] destinationArray = new byte[Asset.Data.Length + data.Length]; |
211 | Array.Copy(this.Asset.Data, 0, destinationArray, 0, this.Asset.Data.Length); | 211 | Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length); |
212 | Array.Copy(data, 0, destinationArray, this.Asset.Data.Length, data.Length); | 212 | Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length); |
213 | this.Asset.Data = destinationArray; | 213 | Asset.Data = destinationArray; |
214 | } | 214 | } |
215 | else | 215 | else |
216 | { | 216 | { |
217 | byte[] buffer2 = new byte[data.Length - 4]; | 217 | byte[] buffer2 = new byte[data.Length - 4]; |
218 | Array.Copy(data, 4, buffer2, 0, data.Length - 4); | 218 | Array.Copy(data, 4, buffer2, 0, data.Length - 4); |
219 | this.Asset.Data = buffer2; | 219 | Asset.Data = buffer2; |
220 | } | 220 | } |
221 | ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket(); | 221 | ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket(); |
222 | newPack.XferID.ID = xferID; | 222 | newPack.XferID.ID = xferID; |
223 | newPack.XferID.Packet = packetID; | 223 | newPack.XferID.Packet = packetID; |
224 | this.ourClient.OutPacket(newPack); | 224 | ourClient.OutPacket(newPack); |
225 | if ((packetID & 0x80000000) != 0) | 225 | if ((packetID & 0x80000000) != 0) |
226 | { | 226 | { |
227 | this.SendCompleteMessage(); | 227 | SendCompleteMessage(); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) | 232 | public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, |
233 | bool storeLocal) | ||
233 | { | 234 | { |
234 | this.ourClient = remoteClient; | 235 | ourClient = remoteClient; |
235 | this.Asset = new AssetBase(); | 236 | Asset = new AssetBase(); |
236 | this.Asset.FullID = assetID; | 237 | Asset.FullID = assetID; |
237 | this.Asset.InvType = type; | 238 | Asset.InvType = type; |
238 | this.Asset.Type = type; | 239 | Asset.Type = type; |
239 | this.Asset.Data = data; | 240 | Asset.Data = data; |
240 | this.Asset.Name = "blank"; | 241 | Asset.Name = "blank"; |
241 | this.Asset.Description = "empty"; | 242 | Asset.Description = "empty"; |
242 | this.TransactionID = transaction; | 243 | TransactionID = transaction; |
243 | this.m_storeLocal = storeLocal; | 244 | m_storeLocal = storeLocal; |
244 | if (this.Asset.Data.Length > 2) | 245 | if (Asset.Data.Length > 2) |
245 | { | 246 | { |
246 | this.SendCompleteMessage(); | 247 | SendCompleteMessage(); |
247 | } | 248 | } |
248 | else | 249 | else |
249 | { | 250 | { |
250 | this.ReqestStartXfer(); | 251 | ReqestStartXfer(); |
251 | } | 252 | } |
252 | } | 253 | } |
253 | 254 | ||
254 | protected void ReqestStartXfer() | 255 | protected void ReqestStartXfer() |
255 | { | 256 | { |
256 | this.UploadComplete = false; | 257 | UploadComplete = false; |
257 | this.XferID = Util.GetNextXferID(); | 258 | XferID = Util.GetNextXferID(); |
258 | RequestXferPacket newPack = new RequestXferPacket(); | 259 | RequestXferPacket newPack = new RequestXferPacket(); |
259 | newPack.XferID.ID = this.XferID; | 260 | newPack.XferID.ID = XferID; |
260 | newPack.XferID.VFileType = this.Asset.Type; | 261 | newPack.XferID.VFileType = Asset.Type; |
261 | newPack.XferID.VFileID = this.Asset.FullID; | 262 | newPack.XferID.VFileID = Asset.FullID; |
262 | newPack.XferID.FilePath = 0; | 263 | newPack.XferID.FilePath = 0; |
263 | newPack.XferID.Filename = new byte[0]; | 264 | newPack.XferID.Filename = new byte[0]; |
264 | this.ourClient.OutPacket(newPack); | 265 | ourClient.OutPacket(newPack); |
265 | } | 266 | } |
266 | 267 | ||
267 | protected void SendCompleteMessage() | 268 | protected void SendCompleteMessage() |
268 | { | 269 | { |
269 | this.UploadComplete = true; | 270 | UploadComplete = true; |
270 | AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); | 271 | AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); |
271 | newPack.AssetBlock.Type = this.Asset.Type; | 272 | newPack.AssetBlock.Type = Asset.Type; |
272 | newPack.AssetBlock.Success = true; | 273 | newPack.AssetBlock.Success = true; |
273 | newPack.AssetBlock.UUID = this.Asset.FullID; | 274 | newPack.AssetBlock.UUID = Asset.FullID; |
274 | this.ourClient.OutPacket(newPack); | 275 | ourClient.OutPacket(newPack); |
275 | this.m_finished = true; | 276 | m_finished = true; |
276 | if (m_createItem) | 277 | if (m_createItem) |
277 | { | 278 | { |
278 | DoCreateItem(); | 279 | DoCreateItem(); |
279 | } | 280 | } |
280 | else if (m_storeLocal) | 281 | else if (m_storeLocal) |
281 | { | 282 | { |
282 | this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); | 283 | m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset); |
283 | } | 284 | } |
284 | 285 | ||
285 | // Console.WriteLine("upload complete "+ this.TransactionID); | 286 | // Console.WriteLine("upload complete "+ this.TransactionID); |
@@ -287,8 +288,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
287 | if (m_dumpAssetToFile) | 288 | if (m_dumpAssetToFile) |
288 | { | 289 | { |
289 | DateTime now = DateTime.Now; | 290 | DateTime now = DateTime.Now; |
290 | string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type ); | 291 | string filename = |
291 | SaveAssetToFile(filename, this.Asset.Data); | 292 | String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day, |
293 | now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type); | ||
294 | SaveAssetToFile(filename, Asset.Data); | ||
292 | } | 295 | } |
293 | } | 296 | } |
294 | 297 | ||
@@ -301,20 +304,22 @@ namespace OpenSim.Framework.Communications.Cache | |||
301 | fs.Close(); | 304 | fs.Close(); |
302 | } | 305 | } |
303 | 306 | ||
304 | public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | 307 | public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, |
308 | uint callbackID, string description, string name, sbyte invType, | ||
309 | sbyte type, byte wearableType, uint nextOwnerMask) | ||
305 | { | 310 | { |
306 | if (this.TransactionID == transactionID) | 311 | if (TransactionID == transactionID) |
307 | { | 312 | { |
308 | this.InventFolder = folderID; | 313 | InventFolder = folderID; |
309 | this.m_name = name; | 314 | m_name = name; |
310 | this.m_description = description; | 315 | m_description = description; |
311 | this.type = type; | 316 | this.type = type; |
312 | this.invType = invType; | 317 | this.invType = invType; |
313 | this.nextPerm = nextOwnerMask; | 318 | nextPerm = nextOwnerMask; |
314 | this.Asset.Name = name; | 319 | Asset.Name = name; |
315 | this.Asset.Description = description; | 320 | Asset.Description = description; |
316 | this.Asset.Type = type; | 321 | Asset.Type = type; |
317 | this.Asset.InvType = invType; | 322 | Asset.InvType = invType; |
318 | m_createItem = true; | 323 | m_createItem = true; |
319 | if (m_finished) | 324 | if (m_finished) |
320 | { | 325 | { |
@@ -326,22 +331,23 @@ namespace OpenSim.Framework.Communications.Cache | |||
326 | private void DoCreateItem() | 331 | private void DoCreateItem() |
327 | { | 332 | { |
328 | //really need to fix this call, if lbsa71 saw this he would die. | 333 | //really need to fix this call, if lbsa71 saw this he would die. |
329 | this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); | 334 | m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset); |
330 | CachedUserInfo userInfo = m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); | 335 | CachedUserInfo userInfo = |
336 | m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); | ||
331 | if (userInfo != null) | 337 | if (userInfo != null) |
332 | { | 338 | { |
333 | InventoryItemBase item = new InventoryItemBase(); | 339 | InventoryItemBase item = new InventoryItemBase(); |
334 | item.avatarID = this.ourClient.AgentId; | 340 | item.avatarID = ourClient.AgentId; |
335 | item.creatorsID = ourClient.AgentId; | 341 | item.creatorsID = ourClient.AgentId; |
336 | item.inventoryID = LLUUID.Random(); | 342 | item.inventoryID = LLUUID.Random(); |
337 | item.assetID = Asset.FullID; | 343 | item.assetID = Asset.FullID; |
338 | item.inventoryDescription = this.m_description; | 344 | item.inventoryDescription = m_description; |
339 | item.inventoryName = m_name; | 345 | item.inventoryName = m_name; |
340 | item.assetType = type; | 346 | item.assetType = type; |
341 | item.invType = this.invType; | 347 | item.invType = invType; |
342 | item.parentFolderID = this.InventFolder; | 348 | item.parentFolderID = InventFolder; |
343 | item.inventoryCurrentPermissions = 2147483647; | 349 | item.inventoryCurrentPermissions = 2147483647; |
344 | item.inventoryNextPermissions = this.nextPerm; | 350 | item.inventoryNextPermissions = nextPerm; |
345 | 351 | ||
346 | userInfo.AddItem(ourClient.AgentId, item); | 352 | userInfo.AddItem(ourClient.AgentId, item); |
347 | ourClient.SendInventoryItemUpdate(item); | 353 | ourClient.SendInventoryItemUpdate(item); |
@@ -350,14 +356,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
350 | 356 | ||
351 | public void UpdateInventoryItem(LLUUID itemID) | 357 | public void UpdateInventoryItem(LLUUID itemID) |
352 | { | 358 | { |
353 | |||
354 | } | 359 | } |
355 | 360 | ||
356 | public AssetBase GetAssetData() | 361 | public AssetBase GetAssetData() |
357 | { | 362 | { |
358 | if (m_finished) | 363 | if (m_finished) |
359 | { | 364 | { |
360 | return this.Asset; | 365 | return Asset; |
361 | } | 366 | } |
362 | return null; | 367 | return null; |
363 | } | 368 | } |
@@ -379,10 +384,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
379 | // Methods | 384 | // Methods |
380 | public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer) | 385 | public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer) |
381 | { | 386 | { |
382 | this.inventoryItemID = inventoryItem; | 387 | inventoryItemID = inventoryItem; |
383 | this.uploaderPath = path; | 388 | uploaderPath = path; |
384 | this.httpListener = httpServer; | 389 | httpListener = httpServer; |
385 | this.newAssetID = LLUUID.Random(); | 390 | newAssetID = LLUUID.Random(); |
386 | } | 391 | } |
387 | 392 | ||
388 | private void SaveImageToFile(string filename, byte[] data) | 393 | private void SaveImageToFile(string filename, byte[] data) |
@@ -399,18 +404,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
399 | LLUUID inventoryItemID = this.inventoryItemID; | 404 | LLUUID inventoryItemID = this.inventoryItemID; |
400 | string text = ""; | 405 | string text = ""; |
401 | LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); | 406 | LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); |
402 | complete.new_asset = this.newAssetID.ToStringHyphenated(); | 407 | complete.new_asset = newAssetID.ToStringHyphenated(); |
403 | complete.new_inventory_item = inventoryItemID; | 408 | complete.new_inventory_item = inventoryItemID; |
404 | complete.state = "complete"; | 409 | complete.state = "complete"; |
405 | text = LLSDHelpers.SerialiseLLSDReply(complete); | 410 | text = LLSDHelpers.SerialiseLLSDReply(complete); |
406 | this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); | 411 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
407 | if (this.SaveImages) | 412 | if (SaveImages) |
408 | { | 413 | { |
409 | this.SaveImageToFile(this.m_assetName + "notecard.txt", data); | 414 | SaveImageToFile(m_assetName + "notecard.txt", data); |
410 | } | 415 | } |
411 | if (this.OnUpLoad != null) | 416 | if (OnUpLoad != null) |
412 | { | 417 | { |
413 | this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "" ); | 418 | OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", ""); |
414 | } | 419 | } |
415 | return text; | 420 | return text; |
416 | } | 421 | } |
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 2d639d6..8fbc3fd 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using OpenSim.Framework; | ||
30 | 29 | ||
31 | namespace OpenSim.Framework.Communications.Cache | 30 | namespace OpenSim.Framework.Communications.Cache |
32 | { | 31 | { |
@@ -45,22 +44,22 @@ namespace OpenSim.Framework.Communications.Cache | |||
45 | // Methods | 44 | // Methods |
46 | public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) | 45 | public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) |
47 | { | 46 | { |
48 | if (userID == this.UserProfile.UUID) | 47 | if (userID == UserProfile.UUID) |
49 | { | 48 | { |
50 | if (this.RootFolder == null) | 49 | if (RootFolder == null) |
51 | { | 50 | { |
52 | if (folderInfo.parentID == LLUUID.Zero) | 51 | if (folderInfo.parentID == LLUUID.Zero) |
53 | { | 52 | { |
54 | this.RootFolder = folderInfo; | 53 | RootFolder = folderInfo; |
55 | } | 54 | } |
56 | } | 55 | } |
57 | else if (this.RootFolder.folderID == folderInfo.parentID) | 56 | else if (RootFolder.folderID == folderInfo.parentID) |
58 | { | 57 | { |
59 | this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | 58 | RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); |
60 | } | 59 | } |
61 | else | 60 | else |
62 | { | 61 | { |
63 | InventoryFolderImpl folder = this.RootFolder.HasSubFolder(folderInfo.parentID); | 62 | InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID); |
64 | if (folder != null) | 63 | if (folder != null) |
65 | { | 64 | { |
66 | folder.SubFolders.Add(folderInfo.folderID, folderInfo); | 65 | folder.SubFolders.Add(folderInfo.folderID, folderInfo); |
@@ -71,18 +70,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
71 | 70 | ||
72 | public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) | 71 | public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) |
73 | { | 72 | { |
74 | if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) | 73 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |
75 | { | 74 | { |
76 | if (itemInfo.parentFolderID == this.RootFolder.folderID) | 75 | if (itemInfo.parentFolderID == RootFolder.folderID) |
77 | { | 76 | { |
78 | this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); | 77 | RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); |
79 | } | 78 | } |
80 | else | 79 | else |
81 | { | 80 | { |
82 | InventoryFolderImpl folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); | 81 | InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID); |
83 | if (folder != null) | 82 | if (folder != null) |
84 | { | 83 | { |
85 | folder.Items.Add(itemInfo.inventoryID, itemInfo); | 84 | folder.Items.Add(itemInfo.inventoryID, itemInfo); |
86 | } | 85 | } |
87 | } | 86 | } |
88 | } | 87 | } |
@@ -90,30 +89,30 @@ namespace OpenSim.Framework.Communications.Cache | |||
90 | 89 | ||
91 | public void AddItem(LLUUID userID, InventoryItemBase itemInfo) | 90 | public void AddItem(LLUUID userID, InventoryItemBase itemInfo) |
92 | { | 91 | { |
93 | if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) | 92 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |
94 | { | 93 | { |
95 | this.ItemReceive(userID, itemInfo); | 94 | ItemReceive(userID, itemInfo); |
96 | this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); | 95 | m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); |
97 | } | 96 | } |
98 | } | 97 | } |
99 | 98 | ||
100 | public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) | 99 | public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) |
101 | { | 100 | { |
102 | if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) | 101 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |
103 | { | 102 | { |
104 | this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); | 103 | m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); |
105 | } | 104 | } |
106 | } | 105 | } |
107 | 106 | ||
108 | public bool DeleteItem(LLUUID userID, InventoryItemBase item) | 107 | public bool DeleteItem(LLUUID userID, InventoryItemBase item) |
109 | { | 108 | { |
110 | bool result = false; | 109 | bool result = false; |
111 | if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) | 110 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |
112 | { | 111 | { |
113 | result = RootFolder.DeleteItem(item.inventoryID); | 112 | result = RootFolder.DeleteItem(item.inventoryID); |
114 | if (result) | 113 | if (result) |
115 | { | 114 | { |
116 | this.m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); | 115 | m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); |
117 | } | 116 | } |
118 | } | 117 | } |
119 | return result; | 118 | return result; |
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 4904293..74a1ef4 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs | |||
@@ -25,19 +25,13 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
29 | using System.IO; | 31 | using System.IO; |
30 | using System.Threading; | ||
31 | using System.Reflection; | ||
32 | using System.Xml.Serialization; | 32 | using System.Xml.Serialization; |
33 | |||
34 | using libsecondlife; | 33 | using libsecondlife; |
35 | |||
36 | using Nini.Config; | ||
37 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Communications; | ||
41 | 35 | ||
42 | namespace OpenSim.Framework.Communications.Cache | 36 | namespace OpenSim.Framework.Communications.Cache |
43 | { | 37 | { |
@@ -63,7 +57,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
63 | Stream s = null; | 57 | Stream s = null; |
64 | try | 58 | try |
65 | { | 59 | { |
66 | |||
67 | MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); | 60 | MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); |
68 | 61 | ||
69 | RestClient rc = new RestClient(_assetServerUrl); | 62 | RestClient rc = new RestClient(_assetServerUrl); |
@@ -77,8 +70,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
77 | 70 | ||
78 | if (s.Length > 0) | 71 | if (s.Length > 0) |
79 | { | 72 | { |
80 | XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); | 73 | XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); |
81 | AssetBase asset = (AssetBase)xs.Deserialize(s); | 74 | AssetBase asset = (AssetBase) xs.Deserialize(s); |
82 | 75 | ||
83 | _receiver.AssetReceived(asset, isTexture); | 76 | _receiver.AssetReceived(asset, isTexture); |
84 | } | 77 | } |
@@ -106,7 +99,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
106 | { | 99 | { |
107 | MemoryStream s = new MemoryStream(); | 100 | MemoryStream s = new MemoryStream(); |
108 | 101 | ||
109 | XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); | 102 | XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); |
110 | xs.Serialize(s, asset); | 103 | xs.Serialize(s, asset); |
111 | RestClient rc = new RestClient(_assetServerUrl); | 104 | RestClient rc = new RestClient(_assetServerUrl); |
112 | rc.AddResourcePath("assets"); | 105 | rc.AddResourcePath("assets"); |
@@ -129,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
129 | throw new Exception("The method or operation is not implemented."); | 122 | throw new Exception("The method or operation is not implemented."); |
130 | } | 123 | } |
131 | 124 | ||
132 | public System.Collections.Generic.List<AssetBase> GetDefaultAssets() | 125 | public List<AssetBase> GetDefaultAssets() |
133 | { | 126 | { |
134 | throw new Exception("The method or operation is not implemented."); | 127 | throw new Exception("The method or operation is not implemented."); |
135 | } | 128 | } |
@@ -156,4 +149,4 @@ namespace OpenSim.Framework.Communications.Cache | |||
156 | 149 | ||
157 | #endregion | 150 | #endregion |
158 | } | 151 | } |
159 | } | 152 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs index 0905af8..3495e55 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs | |||
@@ -25,14 +25,8 @@ | |||
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; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using libsecondlife; | 29 | using libsecondlife; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | ||
36 | 30 | ||
37 | namespace OpenSim.Framework.Communications.Cache | 31 | namespace OpenSim.Framework.Communications.Cache |
38 | { | 32 | { |
@@ -44,17 +38,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
44 | 38 | ||
45 | public InventoryFolderImpl(InventoryFolderBase folderbase) | 39 | public InventoryFolderImpl(InventoryFolderBase folderbase) |
46 | { | 40 | { |
47 | this.agentID = folderbase.agentID; | 41 | agentID = folderbase.agentID; |
48 | this.folderID = folderbase.folderID; | 42 | folderID = folderbase.folderID; |
49 | this.name = folderbase.name; | 43 | name = folderbase.name; |
50 | this.parentID = folderbase.parentID; | 44 | parentID = folderbase.parentID; |
51 | this.type = folderbase.type; | 45 | type = folderbase.type; |
52 | this.version = folderbase.version; | 46 | version = folderbase.version; |
53 | } | 47 | } |
54 | 48 | ||
55 | public InventoryFolderImpl() | 49 | public InventoryFolderImpl() |
56 | { | 50 | { |
57 | |||
58 | } | 51 | } |
59 | 52 | ||
60 | // Methods | 53 | // Methods |
@@ -65,19 +58,19 @@ namespace OpenSim.Framework.Communications.Cache | |||
65 | subFold.folderID = folderID; | 58 | subFold.folderID = folderID; |
66 | subFold.type = (short) type; | 59 | subFold.type = (short) type; |
67 | subFold.parentID = this.folderID; | 60 | subFold.parentID = this.folderID; |
68 | subFold.agentID = this.agentID; | 61 | subFold.agentID = agentID; |
69 | this.SubFolders.Add(subFold.folderID, subFold); | 62 | SubFolders.Add(subFold.folderID, subFold); |
70 | return subFold; | 63 | return subFold; |
71 | } | 64 | } |
72 | 65 | ||
73 | public InventoryItemBase HasItem(LLUUID itemID) | 66 | public InventoryItemBase HasItem(LLUUID itemID) |
74 | { | 67 | { |
75 | InventoryItemBase base2 = null; | 68 | InventoryItemBase base2 = null; |
76 | if (this.Items.ContainsKey(itemID)) | 69 | if (Items.ContainsKey(itemID)) |
77 | { | 70 | { |
78 | return this.Items[itemID]; | 71 | return Items[itemID]; |
79 | } | 72 | } |
80 | foreach (InventoryFolderImpl folder in this.SubFolders.Values) | 73 | foreach (InventoryFolderImpl folder in SubFolders.Values) |
81 | { | 74 | { |
82 | base2 = folder.HasItem(itemID); | 75 | base2 = folder.HasItem(itemID); |
83 | if (base2 != null) | 76 | if (base2 != null) |
@@ -91,12 +84,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
91 | public bool DeleteItem(LLUUID itemID) | 84 | public bool DeleteItem(LLUUID itemID) |
92 | { | 85 | { |
93 | bool found = false; | 86 | bool found = false; |
94 | if (this.Items.ContainsKey(itemID)) | 87 | if (Items.ContainsKey(itemID)) |
95 | { | 88 | { |
96 | Items.Remove(itemID); | 89 | Items.Remove(itemID); |
97 | return true; | 90 | return true; |
98 | } | 91 | } |
99 | foreach (InventoryFolderImpl folder in this.SubFolders.Values) | 92 | foreach (InventoryFolderImpl folder in SubFolders.Values) |
100 | { | 93 | { |
101 | found = folder.DeleteItem(itemID); | 94 | found = folder.DeleteItem(itemID); |
102 | if (found == true) | 95 | if (found == true) |
@@ -111,13 +104,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
111 | public InventoryFolderImpl HasSubFolder(LLUUID folderID) | 104 | public InventoryFolderImpl HasSubFolder(LLUUID folderID) |
112 | { | 105 | { |
113 | InventoryFolderImpl returnFolder = null; | 106 | InventoryFolderImpl returnFolder = null; |
114 | if (this.SubFolders.ContainsKey(folderID)) | 107 | if (SubFolders.ContainsKey(folderID)) |
115 | { | 108 | { |
116 | returnFolder = this.SubFolders[folderID]; | 109 | returnFolder = SubFolders[folderID]; |
117 | } | 110 | } |
118 | else | 111 | else |
119 | { | 112 | { |
120 | foreach (InventoryFolderImpl folder in this.SubFolders.Values) | 113 | foreach (InventoryFolderImpl folder in SubFolders.Values) |
121 | { | 114 | { |
122 | returnFolder = folder.HasSubFolder(folderID); | 115 | returnFolder = folder.HasSubFolder(folderID); |
123 | if (returnFolder != null) | 116 | if (returnFolder != null) |
@@ -132,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
132 | public List<InventoryItemBase> RequestListOfItems() | 125 | public List<InventoryItemBase> RequestListOfItems() |
133 | { | 126 | { |
134 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); | 127 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); |
135 | foreach (InventoryItemBase item in this.Items.Values) | 128 | foreach (InventoryItemBase item in Items.Values) |
136 | { | 129 | { |
137 | itemList.Add(item); | 130 | itemList.Add(item); |
138 | } | 131 | } |
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index 60f9b6b..765c42e 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | |||
@@ -26,12 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.IO; | 29 | using System.IO; |
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | using libsecondlife; | 30 | using libsecondlife; |
34 | using OpenSim.Framework; | ||
35 | using Nini.Config; | 31 | using Nini.Config; |
36 | 32 | ||
37 | namespace OpenSim.Framework.Communications.Cache | 33 | namespace OpenSim.Framework.Communications.Cache |
@@ -40,43 +36,42 @@ namespace OpenSim.Framework.Communications.Cache | |||
40 | /// Basically a hack to give us a Inventory library while we don't have a inventory server | 36 | /// Basically a hack to give us a Inventory library while we don't have a inventory server |
41 | /// once the server is fully implemented then should read the data from that | 37 | /// once the server is fully implemented then should read the data from that |
42 | /// </summary> | 38 | /// </summary> |
43 | public class LibraryRootFolder : Cache.InventoryFolderImpl | 39 | public class LibraryRootFolder : InventoryFolderImpl |
44 | { | 40 | { |
45 | private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 41 | private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
46 | private Cache.InventoryFolderImpl m_textureFolder; | 42 | private InventoryFolderImpl m_textureFolder; |
47 | 43 | ||
48 | public LibraryRootFolder() | 44 | public LibraryRootFolder() |
49 | { | 45 | { |
50 | this.agentID = libOwner; | 46 | agentID = libOwner; |
51 | this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); | 47 | folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); |
52 | this.name = "OpenSim Library"; | 48 | name = "OpenSim Library"; |
53 | this.parentID = LLUUID.Zero; | 49 | parentID = LLUUID.Zero; |
54 | this.type = (short)-1; | 50 | type = (short) -1; |
55 | this.version = (ushort)1; | 51 | version = (ushort) 1; |
56 | 52 | ||
57 | Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl(); | 53 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); |
58 | folderInfo.agentID = libOwner; | 54 | folderInfo.agentID = libOwner; |
59 | folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); | 55 | folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); |
60 | folderInfo.name = "Texture Library"; | 56 | folderInfo.name = "Texture Library"; |
61 | folderInfo.parentID = this.folderID; | 57 | folderInfo.parentID = folderID; |
62 | folderInfo.type = -1; | 58 | folderInfo.type = -1; |
63 | folderInfo.version = 1; | 59 | folderInfo.version = 1; |
64 | this.SubFolders.Add(folderInfo.folderID, folderInfo); | 60 | SubFolders.Add(folderInfo.folderID, folderInfo); |
65 | this.m_textureFolder = folderInfo; | 61 | m_textureFolder = folderInfo; |
66 | 62 | ||
67 | this.CreateLibraryItems(); | 63 | CreateLibraryItems(); |
68 | 64 | ||
69 | string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); | 65 | string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); |
70 | if (File.Exists(filePath)) | 66 | if (File.Exists(filePath)) |
71 | { | 67 | { |
72 | XmlConfigSource source = new XmlConfigSource(filePath); | 68 | XmlConfigSource source = new XmlConfigSource(filePath); |
73 | this.ReadItemsFromFile(source); | 69 | ReadItemsFromFile(source); |
74 | } | 70 | } |
75 | } | 71 | } |
76 | 72 | ||
77 | private void CreateLibraryItems() | 73 | private void CreateLibraryItems() |
78 | { | 74 | { |
79 | |||
80 | InventoryItemBase item = new InventoryItemBase(); | 75 | InventoryItemBase item = new InventoryItemBase(); |
81 | item.avatarID = libOwner; | 76 | item.avatarID = libOwner; |
82 | item.creatorsID = libOwner; | 77 | item.creatorsID = libOwner; |
@@ -90,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
90 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | 85 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; |
91 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | 86 | item.inventoryCurrentPermissions = 0x7FFFFFFF; |
92 | item.inventoryNextPermissions = 0x7FFFFFFF; | 87 | item.inventoryNextPermissions = 0x7FFFFFFF; |
93 | this.m_textureFolder.Items.Add(item.inventoryID, item); | 88 | m_textureFolder.Items.Add(item.inventoryID, item); |
94 | 89 | ||
95 | item = new InventoryItemBase(); | 90 | item = new InventoryItemBase(); |
96 | item.avatarID = libOwner; | 91 | item.avatarID = libOwner; |
@@ -105,7 +100,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
105 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | 100 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; |
106 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | 101 | item.inventoryCurrentPermissions = 0x7FFFFFFF; |
107 | item.inventoryNextPermissions = 0x7FFFFFFF; | 102 | item.inventoryNextPermissions = 0x7FFFFFFF; |
108 | this.m_textureFolder.Items.Add(item.inventoryID, item); | 103 | m_textureFolder.Items.Add(item.inventoryID, item); |
109 | 104 | ||
110 | item = new InventoryItemBase(); | 105 | item = new InventoryItemBase(); |
111 | item.avatarID = libOwner; | 106 | item.avatarID = libOwner; |
@@ -120,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
120 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | 115 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; |
121 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | 116 | item.inventoryCurrentPermissions = 0x7FFFFFFF; |
122 | item.inventoryNextPermissions = 0x7FFFFFFF; | 117 | item.inventoryNextPermissions = 0x7FFFFFFF; |
123 | this.m_textureFolder.Items.Add(item.inventoryID, item); | 118 | m_textureFolder.Items.Add(item.inventoryID, item); |
124 | 119 | ||
125 | item = new InventoryItemBase(); | 120 | item = new InventoryItemBase(); |
126 | item.avatarID = libOwner; | 121 | item.avatarID = libOwner; |
@@ -135,7 +130,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
135 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | 130 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; |
136 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | 131 | item.inventoryCurrentPermissions = 0x7FFFFFFF; |
137 | item.inventoryNextPermissions = 0x7FFFFFFF; | 132 | item.inventoryNextPermissions = 0x7FFFFFFF; |
138 | this.m_textureFolder.Items.Add(item.inventoryID, item); | 133 | m_textureFolder.Items.Add(item.inventoryID, item); |
139 | 134 | ||
140 | item = new InventoryItemBase(); | 135 | item = new InventoryItemBase(); |
141 | item.avatarID = libOwner; | 136 | item.avatarID = libOwner; |
@@ -150,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
150 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | 145 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; |
151 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | 146 | item.inventoryCurrentPermissions = 0x7FFFFFFF; |
152 | item.inventoryNextPermissions = 0x7FFFFFFF; | 147 | item.inventoryNextPermissions = 0x7FFFFFFF; |
153 | this.m_textureFolder.Items.Add(item.inventoryID, item); | 148 | m_textureFolder.Items.Add(item.inventoryID, item); |
154 | 149 | ||
155 | item = new InventoryItemBase(); | 150 | item = new InventoryItemBase(); |
156 | item.avatarID = libOwner; | 151 | item.avatarID = libOwner; |
@@ -161,10 +156,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
161 | item.inventoryName = "Default Shape"; | 156 | item.inventoryName = "Default Shape"; |
162 | item.assetType = 13; | 157 | item.assetType = 13; |
163 | item.invType = 18; | 158 | item.invType = 18; |
164 | item.parentFolderID = this.folderID; | 159 | item.parentFolderID = folderID; |
165 | item.inventoryCurrentPermissions = 0; | 160 | item.inventoryCurrentPermissions = 0; |
166 | item.inventoryNextPermissions = 0; | 161 | item.inventoryNextPermissions = 0; |
167 | this.Items.Add(item.inventoryID, item); | 162 | Items.Add(item.inventoryID, item); |
168 | 163 | ||
169 | item = new InventoryItemBase(); | 164 | item = new InventoryItemBase(); |
170 | item.avatarID = libOwner; | 165 | item.avatarID = libOwner; |
@@ -175,10 +170,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
175 | item.inventoryName = "Default Skin"; | 170 | item.inventoryName = "Default Skin"; |
176 | item.assetType = 13; | 171 | item.assetType = 13; |
177 | item.invType = 18; | 172 | item.invType = 18; |
178 | item.parentFolderID = this.folderID; | 173 | item.parentFolderID = folderID; |
179 | item.inventoryCurrentPermissions = 0; | 174 | item.inventoryCurrentPermissions = 0; |
180 | item.inventoryNextPermissions = 0; | 175 | item.inventoryNextPermissions = 0; |
181 | this.Items.Add(item.inventoryID, item); | 176 | Items.Add(item.inventoryID, item); |
182 | 177 | ||
183 | item = new InventoryItemBase(); | 178 | item = new InventoryItemBase(); |
184 | item.avatarID = libOwner; | 179 | item.avatarID = libOwner; |
@@ -189,10 +184,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
189 | item.inventoryName = "Default Shirt"; | 184 | item.inventoryName = "Default Shirt"; |
190 | item.assetType = 5; | 185 | item.assetType = 5; |
191 | item.invType = 18; | 186 | item.invType = 18; |
192 | item.parentFolderID = this.folderID; | 187 | item.parentFolderID = folderID; |
193 | item.inventoryCurrentPermissions = 0; | 188 | item.inventoryCurrentPermissions = 0; |
194 | item.inventoryNextPermissions = 0; | 189 | item.inventoryNextPermissions = 0; |
195 | this.Items.Add(item.inventoryID, item); | 190 | Items.Add(item.inventoryID, item); |
196 | 191 | ||
197 | item = new InventoryItemBase(); | 192 | item = new InventoryItemBase(); |
198 | item.avatarID = libOwner; | 193 | item.avatarID = libOwner; |
@@ -203,11 +198,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
203 | item.inventoryName = "Default Pants"; | 198 | item.inventoryName = "Default Pants"; |
204 | item.assetType = 5; | 199 | item.assetType = 5; |
205 | item.invType = 18; | 200 | item.invType = 18; |
206 | item.parentFolderID = this.folderID; | 201 | item.parentFolderID = folderID; |
207 | item.inventoryCurrentPermissions = 0; | 202 | item.inventoryCurrentPermissions = 0; |
208 | item.inventoryNextPermissions = 0; | 203 | item.inventoryNextPermissions = 0; |
209 | this.Items.Add(item.inventoryID, item); | 204 | Items.Add(item.inventoryID, item); |
210 | |||
211 | } | 205 | } |
212 | 206 | ||
213 | private void ReadItemsFromFile(IConfigSource source) | 207 | private void ReadItemsFromFile(IConfigSource source) |
@@ -217,28 +211,28 @@ namespace OpenSim.Framework.Communications.Cache | |||
217 | InventoryItemBase item = new InventoryItemBase(); | 211 | InventoryItemBase item = new InventoryItemBase(); |
218 | item.avatarID = libOwner; | 212 | item.avatarID = libOwner; |
219 | item.creatorsID = libOwner; | 213 | item.creatorsID = libOwner; |
220 | item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); | 214 | item.inventoryID = |
215 | new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); | ||
221 | item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); | 216 | item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); |
222 | item.inventoryDescription = source.Configs[i].GetString("description", ""); | 217 | item.inventoryDescription = source.Configs[i].GetString("description", ""); |
223 | item.inventoryName = source.Configs[i].GetString("name", ""); | 218 | item.inventoryName = source.Configs[i].GetString("name", ""); |
224 | item.assetType = source.Configs[i].GetInt("assetType", 0); | 219 | item.assetType = source.Configs[i].GetInt("assetType", 0); |
225 | item.invType = source.Configs[i].GetInt("inventoryType", 0); | 220 | item.invType = source.Configs[i].GetInt("inventoryType", 0); |
226 | item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); | 221 | item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); |
227 | item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); | 222 | item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); |
228 | item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); | 223 | item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); |
229 | item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); | 224 | item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); |
230 | if (item.assetType == 0) | 225 | if (item.assetType == 0) |
231 | { | 226 | { |
232 | item.parentFolderID = this.m_textureFolder.folderID; | 227 | item.parentFolderID = m_textureFolder.folderID; |
233 | this.m_textureFolder.Items.Add(item.inventoryID, item); | 228 | m_textureFolder.Items.Add(item.inventoryID, item); |
234 | } | 229 | } |
235 | else | 230 | else |
236 | { | 231 | { |
237 | item.parentFolderID = this.folderID; | 232 | item.parentFolderID = folderID; |
238 | this.Items.Add(item.inventoryID, item); | 233 | Items.Add(item.inventoryID, item); |
239 | } | 234 | } |
240 | } | 235 | } |
241 | } | 236 | } |
242 | |||
243 | } | 237 | } |
244 | } \ No newline at end of file | 238 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 0953e19..b4f29db 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | |||
@@ -26,14 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Threading; | ||
31 | using System.Reflection; | 29 | using System.Reflection; |
32 | using libsecondlife; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework; | ||
37 | 31 | ||
38 | namespace OpenSim.Framework.Communications.Cache | 32 | namespace OpenSim.Framework.Communications.Cache |
39 | { | 33 | { |
@@ -62,11 +56,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
62 | 56 | ||
63 | if (typeInterface != null) | 57 | if (typeInterface != null) |
64 | { | 58 | { |
65 | IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 59 | IAssetProvider plug = |
60 | (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
66 | m_assetProviderPlugin = plug; | 61 | m_assetProviderPlugin = plug; |
67 | m_assetProviderPlugin.Initialise(); | 62 | m_assetProviderPlugin.Initialise(); |
68 | 63 | ||
69 | MainLog.Instance.Verbose("AssetStorage","Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); | 64 | MainLog.Instance.Verbose("AssetStorage", |
65 | "Added " + m_assetProviderPlugin.Name + " " + | ||
66 | m_assetProviderPlugin.Version); | ||
70 | } | 67 | } |
71 | 68 | ||
72 | typeInterface = null; | 69 | typeInterface = null; |
@@ -84,13 +81,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
84 | m_assetProviderPlugin.CommitAssets(); | 81 | m_assetProviderPlugin.CommitAssets(); |
85 | } | 82 | } |
86 | 83 | ||
87 | override protected void RunRequests() | 84 | protected override void RunRequests() |
88 | { | 85 | { |
89 | while (true) | 86 | while (true) |
90 | { | 87 | { |
91 | ARequest req = this._assetRequests.Dequeue(); | 88 | ARequest req = _assetRequests.Dequeue(); |
92 | 89 | ||
93 | //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID); | 90 | //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID); |
94 | 91 | ||
95 | AssetBase asset = null; | 92 | AssetBase asset = null; |
96 | lock (syncLock) | 93 | lock (syncLock) |
@@ -105,9 +102,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
105 | { | 102 | { |
106 | _receiver.AssetNotFound(req.AssetID); | 103 | _receiver.AssetNotFound(req.AssetID); |
107 | } | 104 | } |
108 | |||
109 | } | 105 | } |
110 | |||
111 | } | 106 | } |
112 | 107 | ||
113 | protected override void StoreAsset(AssetBase asset) | 108 | protected override void StoreAsset(AssetBase asset) |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index 8105556..fe943b0 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs | |||
@@ -25,16 +25,8 @@ | |||
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; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using libsecondlife; | 29 | using libsecondlife; |
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework; | ||
37 | |||
38 | 30 | ||
39 | namespace OpenSim.Framework.Communications.Cache | 31 | namespace OpenSim.Framework.Communications.Cache |
40 | { | 32 | { |
@@ -49,7 +41,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
49 | // Methods | 41 | // Methods |
50 | public UserProfileCache(CommunicationsManager parent) | 42 | public UserProfileCache(CommunicationsManager parent) |
51 | { | 43 | { |
52 | this.m_parent = parent; | 44 | m_parent = parent; |
53 | } | 45 | } |
54 | 46 | ||
55 | /// <summary> | 47 | /// <summary> |
@@ -62,14 +54,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
62 | // Potential fix - Multithreading issue. | 54 | // Potential fix - Multithreading issue. |
63 | lock (UserProfiles) | 55 | lock (UserProfiles) |
64 | { | 56 | { |
65 | if (!this.UserProfiles.ContainsKey(userID)) | 57 | if (!UserProfiles.ContainsKey(userID)) |
66 | { | 58 | { |
67 | CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); | 59 | CachedUserInfo userInfo = new CachedUserInfo(m_parent); |
68 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); | 60 | userInfo.UserProfile = RequestUserProfileForUser(userID); |
69 | if (userInfo.UserProfile != null) | 61 | if (userInfo.UserProfile != null) |
70 | { | 62 | { |
71 | this.RequestInventoryForUser(userID, userInfo); | 63 | RequestInventoryForUser(userID, userInfo); |
72 | this.UserProfiles.Add(userID, userInfo); | 64 | UserProfiles.Add(userID, userInfo); |
73 | } | 65 | } |
74 | else | 66 | else |
75 | { | 67 | { |
@@ -91,26 +83,28 @@ namespace OpenSim.Framework.Communications.Cache | |||
91 | 83 | ||
92 | public CachedUserInfo GetUserDetails(LLUUID userID) | 84 | public CachedUserInfo GetUserDetails(LLUUID userID) |
93 | { | 85 | { |
94 | if (this.UserProfiles.ContainsKey(userID)) | 86 | if (UserProfiles.ContainsKey(userID)) |
95 | { | 87 | { |
96 | return this.UserProfiles[userID]; | 88 | return UserProfiles[userID]; |
97 | } | 89 | } |
98 | return null; | 90 | return null; |
99 | } | 91 | } |
100 | 92 | ||
101 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) | 93 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, |
94 | string folderName, LLUUID parentID) | ||
102 | { | 95 | { |
103 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | 96 | if (UserProfiles.ContainsKey(remoteClient.AgentId)) |
104 | { | 97 | { |
105 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) | 98 | if (UserProfiles[remoteClient.AgentId].RootFolder != null) |
106 | { | 99 | { |
107 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; | 100 | CachedUserInfo info = UserProfiles[remoteClient.AgentId]; |
108 | if (info.RootFolder.folderID == parentID) | 101 | if (info.RootFolder.folderID == parentID) |
109 | { | 102 | { |
110 | InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | 103 | InventoryFolderImpl createdFolder = |
104 | info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
111 | if (createdFolder != null) | 105 | if (createdFolder != null) |
112 | { | 106 | { |
113 | this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); | 107 | m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); |
114 | } | 108 | } |
115 | } | 109 | } |
116 | else | 110 | else |
@@ -125,27 +119,30 @@ namespace OpenSim.Framework.Communications.Cache | |||
125 | } | 119 | } |
126 | } | 120 | } |
127 | 121 | ||
128 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | 122 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, |
123 | bool fetchFolders, bool fetchItems, int sortOrder) | ||
129 | { | 124 | { |
130 | InventoryFolderImpl fold = null; | 125 | InventoryFolderImpl fold = null; |
131 | if (folderID == libraryRoot.folderID ) | 126 | if (folderID == libraryRoot.folderID) |
132 | { | 127 | { |
133 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); | 128 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, |
129 | libraryRoot.RequestListOfItems()); | ||
134 | } | 130 | } |
135 | else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) | 131 | else if ((fold = libraryRoot.HasSubFolder(folderID)) != null) |
136 | { | 132 | { |
137 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); | 133 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); |
138 | } | 134 | } |
139 | else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | 135 | else if (UserProfiles.ContainsKey(remoteClient.AgentId)) |
140 | { | 136 | { |
141 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) | 137 | if (UserProfiles[remoteClient.AgentId].RootFolder != null) |
142 | { | 138 | { |
143 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; | 139 | CachedUserInfo info = UserProfiles[remoteClient.AgentId]; |
144 | if (info.RootFolder.folderID == folderID) | 140 | if (info.RootFolder.folderID == folderID) |
145 | { | 141 | { |
146 | if (fetchItems) | 142 | if (fetchItems) |
147 | { | 143 | { |
148 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, info.RootFolder.RequestListOfItems()); | 144 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, |
145 | info.RootFolder.RequestListOfItems()); | ||
149 | } | 146 | } |
150 | } | 147 | } |
151 | else | 148 | else |
@@ -153,7 +150,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
153 | InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); | 150 | InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); |
154 | if ((folder != null) && fetchItems) | 151 | if ((folder != null) && fetchItems) |
155 | { | 152 | { |
156 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems()); | 153 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, |
154 | folder.RequestListOfItems()); | ||
157 | } | 155 | } |
158 | } | 156 | } |
159 | } | 157 | } |
@@ -166,11 +164,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
166 | { | 164 | { |
167 | //Console.WriteLine("request info for library item"); | 165 | //Console.WriteLine("request info for library item"); |
168 | } | 166 | } |
169 | else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | 167 | else if (UserProfiles.ContainsKey(remoteClient.AgentId)) |
170 | { | 168 | { |
171 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) | 169 | if (UserProfiles[remoteClient.AgentId].RootFolder != null) |
172 | { | 170 | { |
173 | InventoryItemBase item = this.UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID); | 171 | InventoryItemBase item = UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID); |
174 | if (item != null) | 172 | if (item != null) |
175 | { | 173 | { |
176 | remoteClient.SendInventoryItemDetails(ownerID, item); | 174 | remoteClient.SendInventoryItemDetails(ownerID, item); |
@@ -185,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
185 | /// <param name="userID"></param> | 183 | /// <param name="userID"></param> |
186 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) | 184 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) |
187 | { | 185 | { |
188 | this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | 186 | m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); |
189 | } | 187 | } |
190 | 188 | ||
191 | /// <summary> | 189 | /// <summary> |
@@ -194,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
194 | /// <param name="userID"></param> | 192 | /// <param name="userID"></param> |
195 | private UserProfileData RequestUserProfileForUser(LLUUID userID) | 193 | private UserProfileData RequestUserProfileForUser(LLUUID userID) |
196 | { | 194 | { |
197 | return this.m_parent.UserService.GetUserProfile(userID); | 195 | return m_parent.UserService.GetUserProfile(userID); |
198 | } | 196 | } |
199 | 197 | ||
200 | /// <summary> | 198 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a114b64..23dfcc6 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -28,18 +28,23 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | 31 | using System.IO; |
33 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework; | ||
37 | 37 | ||
38 | namespace OpenSim.Region.Capabilities | 38 | namespace OpenSim.Region.Capabilities |
39 | { | 39 | { |
40 | public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); | 40 | public delegate void UpLoadedAsset( |
41 | string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, | ||
42 | string inventoryType, string assetType); | ||
43 | |||
41 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); | 44 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); |
45 | |||
42 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); | 46 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); |
47 | |||
43 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); | 48 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); |
44 | 49 | ||
45 | public class Caps | 50 | public class Caps |
@@ -62,7 +67,8 @@ namespace OpenSim.Region.Capabilities | |||
62 | public ItemUpdatedCallback ItemUpdatedCall = null; | 67 | public ItemUpdatedCallback ItemUpdatedCall = null; |
63 | private bool m_dumpAssetsToFile; | 68 | private bool m_dumpAssetsToFile; |
64 | 69 | ||
65 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) | 70 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, |
71 | LLUUID agent, bool dumpAssetsToFile) | ||
66 | { | 72 | { |
67 | assetCache = assetCach; | 73 | assetCache = assetCach; |
68 | m_capsObjectPath = capsPath; | 74 | m_capsObjectPath = capsPath; |
@@ -78,12 +84,17 @@ namespace OpenSim.Region.Capabilities | |||
78 | /// </summary> | 84 | /// </summary> |
79 | public void RegisterHandlers() | 85 | public void RegisterHandlers() |
80 | { | 86 | { |
81 | OpenSim.Framework.Console.MainLog.Instance.Verbose("CAPS","Registering CAPS handlers"); | 87 | MainLog.Instance.Verbose("CAPS", "Registering CAPS handlers"); |
82 | string capsBase = "/CAPS/" + m_capsObjectPath; | 88 | string capsBase = "/CAPS/" + m_capsObjectPath; |
83 | try | 89 | try |
84 | { | 90 | { |
85 | httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer)); | 91 | httpListener.AddStreamHandler( |
86 | httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); | 92 | new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, |
93 | GetMapLayer)); | ||
94 | httpListener.AddStreamHandler( | ||
95 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | ||
96 | capsBase + m_newInventory, | ||
97 | NewAgentInventoryRequest)); | ||
87 | 98 | ||
88 | AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); | 99 | AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); |
89 | //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); | 100 | //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); |
@@ -103,7 +114,7 @@ namespace OpenSim.Region.Capabilities | |||
103 | string capsBase = "/CAPS/" + m_capsObjectPath; | 114 | string capsBase = "/CAPS/" + m_capsObjectPath; |
104 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); | 115 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); |
105 | } | 116 | } |
106 | 117 | ||
107 | /// <summary> | 118 | /// <summary> |
108 | /// | 119 | /// |
109 | /// </summary> | 120 | /// </summary> |
@@ -113,8 +124,8 @@ namespace OpenSim.Region.Capabilities | |||
113 | /// <returns></returns> | 124 | /// <returns></returns> |
114 | public string CapsRequest(string request, string path, string param) | 125 | public string CapsRequest(string request, string path, string param) |
115 | { | 126 | { |
116 | // Console.WriteLine("caps request " + request); | 127 | // Console.WriteLine("caps request " + request); |
117 | string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); | 128 | string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities()); |
118 | return result; | 129 | return result; |
119 | } | 130 | } |
120 | 131 | ||
@@ -125,9 +136,10 @@ namespace OpenSim.Region.Capabilities | |||
125 | protected LLSDCapsDetails GetCapabilities() | 136 | protected LLSDCapsDetails GetCapabilities() |
126 | { | 137 | { |
127 | LLSDCapsDetails caps = new LLSDCapsDetails(); | 138 | LLSDCapsDetails caps = new LLSDCapsDetails(); |
128 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; | 139 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + |
140 | m_capsObjectPath; | ||
129 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; | 141 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; |
130 | // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; | 142 | // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; |
131 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; | 143 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; |
132 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; | 144 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
133 | caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; | 145 | caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
@@ -142,7 +154,7 @@ namespace OpenSim.Region.Capabilities | |||
142 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) | 154 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) |
143 | { | 155 | { |
144 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | 156 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); |
145 | mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); | 157 | mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse()); |
146 | return mapResponse; | 158 | return mapResponse; |
147 | } | 159 | } |
148 | 160 | ||
@@ -174,6 +186,7 @@ namespace OpenSim.Region.Capabilities | |||
174 | } | 186 | } |
175 | 187 | ||
176 | #region EventQueue (Currently not enabled) | 188 | #region EventQueue (Currently not enabled) |
189 | |||
177 | /// <summary> | 190 | /// <summary> |
178 | /// | 191 | /// |
179 | /// </summary> | 192 | /// </summary> |
@@ -184,10 +197,10 @@ namespace OpenSim.Region.Capabilities | |||
184 | public string ProcessEventQueue(string request, string path, string param) | 197 | public string ProcessEventQueue(string request, string path, string param) |
185 | { | 198 | { |
186 | string res = ""; | 199 | string res = ""; |
187 | 200 | ||
188 | if (this.CapsEventQueue.Count > 0) | 201 | if (CapsEventQueue.Count > 0) |
189 | { | 202 | { |
190 | lock (this.CapsEventQueue) | 203 | lock (CapsEventQueue) |
191 | { | 204 | { |
192 | string item = CapsEventQueue.Dequeue(); | 205 | string item = CapsEventQueue.Dequeue(); |
193 | res = item; | 206 | res = item; |
@@ -195,7 +208,7 @@ namespace OpenSim.Region.Capabilities | |||
195 | } | 208 | } |
196 | else | 209 | else |
197 | { | 210 | { |
198 | res = this.CreateEmptyEventResponse(); | 211 | res = CreateEmptyEventResponse(); |
199 | } | 212 | } |
200 | return res; | 213 | return res; |
201 | } | 214 | } |
@@ -214,8 +227,8 @@ namespace OpenSim.Region.Capabilities | |||
214 | eventItem.events.Array.Add(new LLSDEmpty()); | 227 | eventItem.events.Array.Add(new LLSDEmpty()); |
215 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | 228 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); |
216 | eventQueueCount++; | 229 | eventQueueCount++; |
217 | 230 | ||
218 | this.CapsEventQueue.Enqueue(res); | 231 | CapsEventQueue.Enqueue(res); |
219 | return res; | 232 | return res; |
220 | } | 233 | } |
221 | 234 | ||
@@ -232,6 +245,7 @@ namespace OpenSim.Region.Capabilities | |||
232 | eventQueueCount++; | 245 | eventQueueCount++; |
233 | return res; | 246 | return res; |
234 | } | 247 | } |
248 | |||
235 | #endregion | 249 | #endregion |
236 | 250 | ||
237 | /// <summary> | 251 | /// <summary> |
@@ -243,24 +257,27 @@ namespace OpenSim.Region.Capabilities | |||
243 | /// <returns></returns> | 257 | /// <returns></returns> |
244 | public string NoteCardAgentInventory(string request, string path, string param) | 258 | public string NoteCardAgentInventory(string request, string path, string param) |
245 | { | 259 | { |
246 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); | 260 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); |
247 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | 261 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); |
248 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 262 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
249 | 263 | ||
250 | string capsBase = "/CAPS/" + m_capsObjectPath; | 264 | string capsBase = "/CAPS/" + m_capsObjectPath; |
251 | LLUUID newInvItem = llsdRequest.item_id; | 265 | LLUUID newInvItem = llsdRequest.item_id; |
252 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 266 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
253 | 267 | ||
254 | ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); | 268 | ItemUpdater uploader = |
255 | uploader.OnUpLoad += this.ItemUpdated; | 269 | new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile); |
270 | uploader.OnUpLoad += ItemUpdated; | ||
256 | 271 | ||
257 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 272 | httpListener.AddStreamHandler( |
258 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | 273 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
274 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
275 | uploaderPath; | ||
259 | 276 | ||
260 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 277 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
261 | uploadResponse.uploader = uploaderURL; | 278 | uploadResponse.uploader = uploaderURL; |
262 | uploadResponse.state = "upload"; | 279 | uploadResponse.state = "upload"; |
263 | 280 | ||
264 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | 281 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
265 | } | 282 | } |
266 | 283 | ||
@@ -272,7 +289,7 @@ namespace OpenSim.Region.Capabilities | |||
272 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | 289 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) |
273 | { | 290 | { |
274 | //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); | 291 | //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); |
275 | 292 | ||
276 | string assetName = llsdRequest.name; | 293 | string assetName = llsdRequest.name; |
277 | string assetDes = llsdRequest.description; | 294 | string assetDes = llsdRequest.description; |
278 | string capsBase = "/CAPS/" + m_capsObjectPath; | 295 | string capsBase = "/CAPS/" + m_capsObjectPath; |
@@ -281,14 +298,18 @@ namespace OpenSim.Region.Capabilities | |||
281 | LLUUID parentFolder = llsdRequest.folder_id; | 298 | LLUUID parentFolder = llsdRequest.folder_id; |
282 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 299 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
283 | 300 | ||
284 | AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile); | 301 | AssetUploader uploader = |
285 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 302 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
286 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | 303 | llsdRequest.asset_type, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile); |
304 | httpListener.AddStreamHandler( | ||
305 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
306 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
307 | uploaderPath; | ||
287 | 308 | ||
288 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 309 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
289 | uploadResponse.uploader = uploaderURL; | 310 | uploadResponse.uploader = uploaderURL; |
290 | uploadResponse.state = "upload"; | 311 | uploadResponse.state = "upload"; |
291 | uploader.OnUpLoad += this.UploadCompleteHandler; | 312 | uploader.OnUpLoad += UploadCompleteHandler; |
292 | return uploadResponse; | 313 | return uploadResponse; |
293 | } | 314 | } |
294 | 315 | ||
@@ -298,7 +319,9 @@ namespace OpenSim.Region.Capabilities | |||
298 | /// <param name="assetID"></param> | 319 | /// <param name="assetID"></param> |
299 | /// <param name="inventoryItem"></param> | 320 | /// <param name="inventoryItem"></param> |
300 | /// <param name="data"></param> | 321 | /// <param name="data"></param> |
301 | public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType) | 322 | public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, |
323 | LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, | ||
324 | string assetType) | ||
302 | { | 325 | { |
303 | sbyte assType = 0; | 326 | sbyte assType = 0; |
304 | sbyte inType = 0; | 327 | sbyte inType = 0; |
@@ -319,14 +342,14 @@ namespace OpenSim.Region.Capabilities | |||
319 | asset.FullID = assetID; | 342 | asset.FullID = assetID; |
320 | asset.Type = assType; | 343 | asset.Type = assType; |
321 | asset.InvType = inType; | 344 | asset.InvType = inType; |
322 | asset.Name = assetName; | 345 | asset.Name = assetName; |
323 | asset.Data = data; | 346 | asset.Data = data; |
324 | this.assetCache.AddAsset(asset); | 347 | assetCache.AddAsset(asset); |
325 | 348 | ||
326 | InventoryItemBase item = new InventoryItemBase(); | 349 | InventoryItemBase item = new InventoryItemBase(); |
327 | item.avatarID = agentID; | 350 | item.avatarID = agentID; |
328 | item.creatorsID = agentID; | 351 | item.creatorsID = agentID; |
329 | item.inventoryID = inventoryItem; | 352 | item.inventoryID = inventoryItem; |
330 | item.assetID = asset.FullID; | 353 | item.assetID = asset.FullID; |
331 | item.inventoryDescription = assetDescription; | 354 | item.inventoryDescription = assetDescription; |
332 | item.inventoryName = assetName; | 355 | item.inventoryName = assetName; |
@@ -340,14 +363,13 @@ namespace OpenSim.Region.Capabilities | |||
340 | { | 363 | { |
341 | AddNewInventoryItem(agentID, item); | 364 | AddNewInventoryItem(agentID, item); |
342 | } | 365 | } |
343 | |||
344 | } | 366 | } |
345 | 367 | ||
346 | public LLUUID ItemUpdated(LLUUID itemID, byte[] data) | 368 | public LLUUID ItemUpdated(LLUUID itemID, byte[] data) |
347 | { | 369 | { |
348 | if (ItemUpdatedCall != null) | 370 | if (ItemUpdatedCall != null) |
349 | { | 371 | { |
350 | return ItemUpdatedCall(this.agentID, itemID, data); | 372 | return ItemUpdatedCall(agentID, itemID, data); |
351 | } | 373 | } |
352 | return LLUUID.Zero; | 374 | return LLUUID.Zero; |
353 | } | 375 | } |
@@ -359,7 +381,7 @@ namespace OpenSim.Region.Capabilities | |||
359 | private string uploaderPath = ""; | 381 | private string uploaderPath = ""; |
360 | private LLUUID newAssetID; | 382 | private LLUUID newAssetID; |
361 | private LLUUID inventoryItemID; | 383 | private LLUUID inventoryItemID; |
362 | private LLUUID parentFolder; | 384 | private LLUUID parentFolder; |
363 | private BaseHttpServer httpListener; | 385 | private BaseHttpServer httpListener; |
364 | private bool m_dumpAssetsToFile; | 386 | private bool m_dumpAssetsToFile; |
365 | private string m_assetName = ""; | 387 | private string m_assetName = ""; |
@@ -368,7 +390,9 @@ namespace OpenSim.Region.Capabilities | |||
368 | private string m_invType = ""; | 390 | private string m_invType = ""; |
369 | private string m_assetType = ""; | 391 | private string m_assetType = ""; |
370 | 392 | ||
371 | public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile) | 393 | public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, |
394 | LLUUID parentFolderID, string invType, string assetType, string path, | ||
395 | BaseHttpServer httpServer, bool dumpAssetsToFile) | ||
372 | { | 396 | { |
373 | m_assetName = assetName; | 397 | m_assetName = assetName; |
374 | m_assetDes = description; | 398 | m_assetDes = description; |
@@ -391,7 +415,7 @@ namespace OpenSim.Region.Capabilities | |||
391 | /// <returns></returns> | 415 | /// <returns></returns> |
392 | public string uploaderCaps(byte[] data, string path, string param) | 416 | public string uploaderCaps(byte[] data, string path, string param) |
393 | { | 417 | { |
394 | LLUUID inv = this.inventoryItemID; | 418 | LLUUID inv = inventoryItemID; |
395 | string res = ""; | 419 | string res = ""; |
396 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | 420 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); |
397 | uploadComplete.new_asset = newAssetID.ToStringHyphenated(); | 421 | uploadComplete.new_asset = newAssetID.ToStringHyphenated(); |
@@ -399,29 +423,29 @@ namespace OpenSim.Region.Capabilities | |||
399 | uploadComplete.state = "complete"; | 423 | uploadComplete.state = "complete"; |
400 | 424 | ||
401 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 425 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
402 | 426 | ||
403 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 427 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
404 | 428 | ||
405 | if (this.m_dumpAssetsToFile) | 429 | if (m_dumpAssetsToFile) |
406 | { | 430 | { |
407 | this.SaveAssetToFile(m_assetName + ".jp2", data); | 431 | SaveAssetToFile(m_assetName + ".jp2", data); |
408 | } | 432 | } |
409 | 433 | ||
410 | if (OnUpLoad != null) | 434 | if (OnUpLoad != null) |
411 | { | 435 | { |
412 | OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | 436 | OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); |
413 | } | 437 | } |
414 | 438 | ||
415 | return res; | 439 | return res; |
416 | } | 440 | } |
417 | 441 | ||
418 | private void SaveAssetToFile(string filename, byte[] data) | 442 | private void SaveAssetToFile(string filename, byte[] data) |
419 | { | 443 | { |
420 | FileStream fs = File.Create(filename); | 444 | FileStream fs = File.Create(filename); |
421 | BinaryWriter bw = new BinaryWriter(fs); | 445 | BinaryWriter bw = new BinaryWriter(fs); |
422 | bw.Write(data); | 446 | bw.Write(data); |
423 | bw.Close(); | 447 | bw.Close(); |
424 | fs.Close(); | 448 | fs.Close(); |
425 | } | 449 | } |
426 | } | 450 | } |
427 | 451 | ||
@@ -434,7 +458,7 @@ namespace OpenSim.Region.Capabilities | |||
434 | private BaseHttpServer httpListener; | 458 | private BaseHttpServer httpListener; |
435 | private bool m_dumpAssetToFile; | 459 | private bool m_dumpAssetToFile; |
436 | 460 | ||
437 | public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) | 461 | public ItemUpdater(LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) |
438 | { | 462 | { |
439 | m_dumpAssetToFile = dumpAssetToFile; | 463 | m_dumpAssetToFile = dumpAssetToFile; |
440 | 464 | ||
@@ -452,7 +476,7 @@ namespace OpenSim.Region.Capabilities | |||
452 | /// <returns></returns> | 476 | /// <returns></returns> |
453 | public string uploaderCaps(byte[] data, string path, string param) | 477 | public string uploaderCaps(byte[] data, string path, string param) |
454 | { | 478 | { |
455 | LLUUID inv = this.inventoryItemID; | 479 | LLUUID inv = inventoryItemID; |
456 | string res = ""; | 480 | string res = ""; |
457 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | 481 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); |
458 | LLUUID assetID = LLUUID.Zero; | 482 | LLUUID assetID = LLUUID.Zero; |
@@ -461,7 +485,7 @@ namespace OpenSim.Region.Capabilities | |||
461 | { | 485 | { |
462 | assetID = OnUpLoad(inv, data); | 486 | assetID = OnUpLoad(inv, data); |
463 | } | 487 | } |
464 | 488 | ||
465 | uploadComplete.new_asset = assetID.ToStringHyphenated(); | 489 | uploadComplete.new_asset = assetID.ToStringHyphenated(); |
466 | uploadComplete.new_inventory_item = inv; | 490 | uploadComplete.new_inventory_item = inv; |
467 | uploadComplete.state = "complete"; | 491 | uploadComplete.state = "complete"; |
@@ -470,9 +494,9 @@ namespace OpenSim.Region.Capabilities | |||
470 | 494 | ||
471 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 495 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
472 | 496 | ||
473 | if (this.m_dumpAssetToFile) | 497 | if (m_dumpAssetToFile) |
474 | { | 498 | { |
475 | this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); | 499 | SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); |
476 | } | 500 | } |
477 | 501 | ||
478 | return res; | 502 | return res; |
@@ -488,6 +512,4 @@ namespace OpenSim.Region.Capabilities | |||
488 | } | 512 | } |
489 | } | 513 | } |
490 | } | 514 | } |
491 | } | 515 | } \ No newline at end of file |
492 | |||
493 | |||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs index 2af5a4a..2ed7750 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs | |||
@@ -36,7 +36,6 @@ namespace OpenSim.Region.Capabilities | |||
36 | 36 | ||
37 | public LLSDArray() | 37 | public LLSDArray() |
38 | { | 38 | { |
39 | |||
40 | } | 39 | } |
41 | } | 40 | } |
42 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs index e65e741..d054386 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs | |||
@@ -39,7 +39,6 @@ namespace OpenSim.Region.Capabilities | |||
39 | 39 | ||
40 | public LLSDAssetUploadComplete() | 40 | public LLSDAssetUploadComplete() |
41 | { | 41 | { |
42 | |||
43 | } | 42 | } |
44 | } | 43 | } |
45 | } | 44 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs index 3a2fe20..7fed27a 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs | |||
@@ -26,9 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | 29 | using libsecondlife; |
33 | 30 | ||
34 | namespace OpenSim.Region.Capabilities | 31 | namespace OpenSim.Region.Capabilities |
@@ -46,4 +43,4 @@ namespace OpenSim.Region.Capabilities | |||
46 | { | 43 | { |
47 | } | 44 | } |
48 | } | 45 | } |
49 | } | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs index c7a9ee6..3ad618d 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.Capabilities | 29 | namespace OpenSim.Region.Capabilities |
34 | { | 30 | { |
35 | [LLSDMap] | 31 | [LLSDMap] |
@@ -40,7 +36,6 @@ namespace OpenSim.Region.Capabilities | |||
40 | 36 | ||
41 | public LLSDAssetUploadResponse() | 37 | public LLSDAssetUploadResponse() |
42 | { | 38 | { |
43 | |||
44 | } | 39 | } |
45 | } | 40 | } |
46 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs index d1894d4..06afac4 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs | |||
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities | |||
35 | 35 | ||
36 | public LLSDCapEvent() | 36 | public LLSDCapEvent() |
37 | { | 37 | { |
38 | |||
39 | } | 38 | } |
40 | } | 39 | } |
41 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs index 3184792..35caa15 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs | |||
@@ -34,18 +34,14 @@ namespace OpenSim.Region.Capabilities | |||
34 | public string MapLayer = ""; | 34 | public string MapLayer = ""; |
35 | public string NewFileAgentInventory = ""; | 35 | public string NewFileAgentInventory = ""; |
36 | //public string EventQueueGet = ""; | 36 | //public string EventQueueGet = ""; |
37 | // public string RequestTextureDownload = ""; | 37 | // public string RequestTextureDownload = ""; |
38 | // public string ChatSessionRequest = ""; | 38 | // public string ChatSessionRequest = ""; |
39 | public string UpdateNotecardAgentInventory = ""; | 39 | public string UpdateNotecardAgentInventory = ""; |
40 | public string UpdateScriptAgentInventory = ""; | 40 | public string UpdateScriptAgentInventory = ""; |
41 | // public string ParcelVoiceInfoRequest = ""; | 41 | // public string ParcelVoiceInfoRequest = ""; |
42 | 42 | ||
43 | public LLSDCapsDetails() | 43 | public LLSDCapsDetails() |
44 | { | 44 | { |
45 | |||
46 | } | 45 | } |
47 | } | 46 | } |
48 | } | 47 | } \ No newline at end of file |
49 | |||
50 | |||
51 | |||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs index 0169d3c..69c525c 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs | |||
@@ -32,7 +32,6 @@ namespace OpenSim.Region.Capabilities | |||
32 | { | 32 | { |
33 | public LLSDEmpty() | 33 | public LLSDEmpty() |
34 | { | 34 | { |
35 | |||
36 | } | 35 | } |
37 | } | 36 | } |
38 | } | 37 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index 8a2215f..8252a63 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Capabilities | |||
51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) | 51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) |
52 | { | 52 | { |
53 | Type myType = obj.GetType(); | 53 | Type myType = obj.GetType(); |
54 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | 54 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); |
55 | if (llsdattributes.Length > 0) | 55 | if (llsdattributes.Length > 0) |
56 | { | 56 | { |
57 | switch (llsdattributes[0].ObjectType) | 57 | switch (llsdattributes[0].ObjectType) |
@@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities | |||
62 | for (int i = 0; i < fields.Length; i++) | 62 | for (int i = 0; i < fields.Length; i++) |
63 | { | 63 | { |
64 | object fieldValue = fields[i].GetValue(obj); | 64 | object fieldValue = fields[i].GetValue(obj); |
65 | LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); | 65 | LLSDType[] fieldAttributes = |
66 | (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false); | ||
66 | if (fieldAttributes.Length > 0) | 67 | if (fieldAttributes.Length > 0) |
67 | { | 68 | { |
68 | writer.WriteStartElement(String.Empty, "key", String.Empty); | 69 | writer.WriteStartElement(String.Empty, "key", String.Empty); |
@@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities | |||
83 | case "ARRAY": | 84 | case "ARRAY": |
84 | // LLSDArray arrayObject = obj as LLSDArray; | 85 | // LLSDArray arrayObject = obj as LLSDArray; |
85 | // ArrayList a = arrayObject.Array; | 86 | // ArrayList a = arrayObject.Array; |
86 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); | 87 | ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj); |
87 | if (a != null) | 88 | if (a != null) |
88 | { | 89 | { |
89 | writer.WriteStartElement(String.Empty, "array", String.Empty); | 90 | writer.WriteStartElement(String.Empty, "array", String.Empty); |
@@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities | |||
105 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) | 106 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) |
106 | { | 107 | { |
107 | Type myType = obj.GetType(); | 108 | Type myType = obj.GetType(); |
108 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | 109 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); |
109 | if (llsdattributes.Length > 0) | 110 | if (llsdattributes.Length > 0) |
110 | { | 111 | { |
111 | switch (llsdattributes[0].ObjectType) | 112 | switch (llsdattributes[0].ObjectType) |
@@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities | |||
114 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); | 115 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); |
115 | while (enumerator.MoveNext()) | 116 | while (enumerator.MoveNext()) |
116 | { | 117 | { |
117 | FieldInfo field = myType.GetField((string)enumerator.Key); | 118 | FieldInfo field = myType.GetField((string) enumerator.Key); |
118 | if (field != null) | 119 | if (field != null) |
119 | { | 120 | { |
120 | if (enumerator.Value is Hashtable) | 121 | if (enumerator.Value is Hashtable) |
@@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities | |||
142 | return obj; | 143 | return obj; |
143 | } | 144 | } |
144 | } | 145 | } |
145 | 146 | } \ No newline at end of file | |
146 | |||
147 | |||
148 | |||
149 | |||
150 | |||
151 | |||
152 | |||
153 | |||
154 | |||
155 | |||
156 | |||
157 | |||
158 | |||
159 | |||
160 | |||
161 | |||
162 | |||
163 | |||
164 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs index 57fc9e8..3842058 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs | |||
@@ -26,9 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | 29 | using libsecondlife; |
33 | 30 | ||
34 | namespace OpenSim.Region.Capabilities | 31 | namespace OpenSim.Region.Capabilities |
@@ -42,4 +39,4 @@ namespace OpenSim.Region.Capabilities | |||
42 | { | 39 | { |
43 | } | 40 | } |
44 | } | 41 | } |
45 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs index 6d17bff..683e479 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs | |||
@@ -40,7 +40,6 @@ namespace OpenSim.Region.Capabilities | |||
40 | 40 | ||
41 | public LLSDMapLayer() | 41 | public LLSDMapLayer() |
42 | { | 42 | { |
43 | |||
44 | } | 43 | } |
45 | } | 44 | } |
46 | } | 45 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs index 7900290..1945a6c 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs | |||
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities | |||
35 | 35 | ||
36 | public LLSDMapLayerResponse() | 36 | public LLSDMapLayerResponse() |
37 | { | 37 | { |
38 | |||
39 | } | 38 | } |
40 | } | 39 | } |
41 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs index 5fa08c9..935f81d 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs | |||
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities | |||
35 | 35 | ||
36 | public LLSDMapRequest() | 36 | public LLSDMapRequest() |
37 | { | 37 | { |
38 | |||
39 | } | 38 | } |
40 | } | 39 | } |
41 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs index 67253ee..6bd47e1 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs | |||
@@ -26,11 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.Capabilities | 29 | namespace OpenSim.Region.Capabilities |
34 | { | 30 | { |
35 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); | 31 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); |
36 | } | 32 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs index 894b276..08e9563 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs | |||
@@ -26,13 +26,11 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Framework.Servers; | ||
33 | using System.IO; | ||
34 | using System.Collections; | 29 | using System.Collections; |
30 | using System.IO; | ||
31 | using System.Text; | ||
35 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Servers; | ||
36 | 34 | ||
37 | namespace OpenSim.Region.Capabilities | 35 | namespace OpenSim.Region.Capabilities |
38 | { | 36 | { |
@@ -42,11 +40,11 @@ namespace OpenSim.Region.Capabilities | |||
42 | private LLSDMethod<TRequest, TResponse> m_method; | 40 | private LLSDMethod<TRequest, TResponse> m_method; |
43 | 41 | ||
44 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) | 42 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) |
45 | : base(httpMethod, path ) | 43 | : base(httpMethod, path) |
46 | { | 44 | { |
47 | m_method = method; | 45 | m_method = method; |
48 | } | 46 | } |
49 | 47 | ||
50 | public override byte[] Handle(string path, Stream request) | 48 | public override byte[] Handle(string path, Stream request) |
51 | { | 49 | { |
52 | //Encoding encoding = Encoding.UTF8; | 50 | //Encoding encoding = Encoding.UTF8; |
@@ -55,16 +53,15 @@ namespace OpenSim.Region.Capabilities | |||
55 | //string requestBody = streamReader.ReadToEnd(); | 53 | //string requestBody = streamReader.ReadToEnd(); |
56 | //streamReader.Close(); | 54 | //streamReader.Close(); |
57 | 55 | ||
58 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); | 56 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request); |
59 | TRequest llsdRequest = new TRequest(); | 57 | TRequest llsdRequest = new TRequest(); |
60 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 58 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
61 | 59 | ||
62 | TResponse response = m_method(llsdRequest); | 60 | TResponse response = m_method(llsdRequest); |
63 | 61 | ||
64 | Encoding encoding = new UTF8Encoding(false); | 62 | Encoding encoding = new UTF8Encoding(false); |
65 | |||
66 | return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); | ||
67 | 63 | ||
64 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); | ||
68 | } | 65 | } |
69 | } | 66 | } |
70 | } | 67 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs index f70fa11..c2a6054 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs | |||
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities | |||
35 | 35 | ||
36 | public LLSDTest() | 36 | public LLSDTest() |
37 | { | 37 | { |
38 | |||
39 | } | 38 | } |
40 | } | 39 | } |
41 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs index 6af7f39..a90ae03 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs | |||
@@ -37,23 +37,19 @@ namespace OpenSim.Region.Capabilities | |||
37 | public LLSDType(string type) | 37 | public LLSDType(string type) |
38 | { | 38 | { |
39 | myType = type; | 39 | myType = type; |
40 | |||
41 | } | 40 | } |
42 | 41 | ||
43 | public string ObjectType | 42 | public string ObjectType |
44 | { | 43 | { |
45 | get | 44 | get { return myType; } |
46 | { | ||
47 | return myType; | ||
48 | } | ||
49 | } | 45 | } |
50 | } | 46 | } |
51 | 47 | ||
52 | [AttributeUsage(AttributeTargets.Class)] | 48 | [AttributeUsage(AttributeTargets.Class)] |
53 | public class LLSDMap : LLSDType | 49 | public class LLSDMap : LLSDType |
54 | { | 50 | { |
55 | public LLSDMap() : base( "MAP" ) | 51 | public LLSDMap() : base("MAP") |
56 | { | 52 | { |
57 | } | 53 | } |
58 | } | 54 | } |
59 | } | 55 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index d8d198b..77c7261 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -28,69 +28,77 @@ | |||
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Communications.Cache; | 30 | using OpenSim.Framework.Communications.Cache; |
31 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | 32 | using OpenSim.Framework.Interfaces; |
32 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | ||
35 | 34 | ||
36 | namespace OpenSim.Framework.Communications | 35 | namespace OpenSim.Framework.Communications |
37 | { | 36 | { |
38 | public class CommunicationsManager | 37 | public class CommunicationsManager |
39 | { | 38 | { |
40 | protected IUserService m_userService; | 39 | protected IUserService m_userService; |
40 | |||
41 | public IUserService UserService | 41 | public IUserService UserService |
42 | { | 42 | { |
43 | get { return m_userService; } | 43 | get { return m_userService; } |
44 | } | 44 | } |
45 | 45 | ||
46 | protected IGridServices m_gridService; | 46 | protected IGridServices m_gridService; |
47 | |||
47 | public IGridServices GridService | 48 | public IGridServices GridService |
48 | { | 49 | { |
49 | get { return m_gridService; } | 50 | get { return m_gridService; } |
50 | } | 51 | } |
51 | 52 | ||
52 | protected IInventoryServices m_inventoryService; | 53 | protected IInventoryServices m_inventoryService; |
54 | |||
53 | public IInventoryServices InventoryService | 55 | public IInventoryServices InventoryService |
54 | { | 56 | { |
55 | get { return m_inventoryService; } | 57 | get { return m_inventoryService; } |
56 | } | 58 | } |
57 | 59 | ||
58 | protected IInterRegionCommunications m_interRegion; | 60 | protected IInterRegionCommunications m_interRegion; |
61 | |||
59 | public IInterRegionCommunications InterRegion | 62 | public IInterRegionCommunications InterRegion |
60 | { | 63 | { |
61 | get { return m_interRegion; } | 64 | get { return m_interRegion; } |
62 | } | 65 | } |
63 | 66 | ||
64 | protected UserProfileCache m_userProfileCache; | 67 | protected UserProfileCache m_userProfileCache; |
68 | |||
65 | public UserProfileCache UserProfileCache | 69 | public UserProfileCache UserProfileCache |
66 | { | 70 | { |
67 | get { return m_userProfileCache; } | 71 | get { return m_userProfileCache; } |
68 | } | 72 | } |
69 | 73 | ||
70 | protected AssetTransactionManager m_transactionsManager; | 74 | protected AssetTransactionManager m_transactionsManager; |
75 | |||
71 | public AssetTransactionManager TransactionsManager | 76 | public AssetTransactionManager TransactionsManager |
72 | { | 77 | { |
73 | get { return m_transactionsManager; } | 78 | get { return m_transactionsManager; } |
74 | } | 79 | } |
75 | 80 | ||
76 | protected AssetCache m_assetCache; | 81 | protected AssetCache m_assetCache; |
82 | |||
77 | public AssetCache AssetCache | 83 | public AssetCache AssetCache |
78 | { | 84 | { |
79 | get { return m_assetCache; } | 85 | get { return m_assetCache; } |
80 | } | 86 | } |
81 | 87 | ||
82 | protected NetworkServersInfo m_networkServersInfo; | 88 | protected NetworkServersInfo m_networkServersInfo; |
89 | |||
83 | public NetworkServersInfo NetworkServersInfo | 90 | public NetworkServersInfo NetworkServersInfo |
84 | { | 91 | { |
85 | get { return m_networkServersInfo; } | 92 | get { return m_networkServersInfo; } |
86 | } | 93 | } |
87 | 94 | ||
88 | public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool dumpAssetsToFile) | 95 | public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, |
96 | bool dumpAssetsToFile) | ||
89 | { | 97 | { |
90 | m_networkServersInfo = serversInfo; | 98 | m_networkServersInfo = serversInfo; |
91 | m_assetCache = assetCache; | 99 | m_assetCache = assetCache; |
92 | m_userProfileCache = new UserProfileCache(this); | 100 | m_userProfileCache = new UserProfileCache(this); |
93 | m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile ); | 101 | m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile); |
94 | } | 102 | } |
95 | 103 | ||
96 | public void doCreate(string[] cmmdParams) | 104 | public void doCreate(string[] cmmdParams) |
@@ -106,7 +114,6 @@ namespace OpenSim.Framework.Communications | |||
106 | 114 | ||
107 | if (cmmdParams.Length < 2) | 115 | if (cmmdParams.Length < 2) |
108 | { | 116 | { |
109 | |||
110 | firstName = MainLog.Instance.CmdPrompt("First name", "Default"); | 117 | firstName = MainLog.Instance.CmdPrompt("First name", "Default"); |
111 | lastName = MainLog.Instance.CmdPrompt("Last name", "User"); | 118 | lastName = MainLog.Instance.CmdPrompt("Last name", "User"); |
112 | password = MainLog.Instance.PasswdPrompt("Password"); | 119 | password = MainLog.Instance.PasswdPrompt("Password"); |
@@ -120,7 +127,6 @@ namespace OpenSim.Framework.Communications | |||
120 | password = cmmdParams[3]; | 127 | password = cmmdParams[3]; |
121 | regX = Convert.ToUInt32(cmmdParams[4]); | 128 | regX = Convert.ToUInt32(cmmdParams[4]); |
122 | regY = Convert.ToUInt32(cmmdParams[5]); | 129 | regY = Convert.ToUInt32(cmmdParams[5]); |
123 | |||
124 | } | 130 | } |
125 | 131 | ||
126 | AddUser(firstName, lastName, password, regX, regY); | 132 | AddUser(firstName, lastName, password, regX, regY); |
@@ -140,7 +146,7 @@ namespace OpenSim.Framework.Communications | |||
140 | } | 146 | } |
141 | else | 147 | else |
142 | { | 148 | { |
143 | this.m_inventoryService.CreateNewUserInventory(userProf.UUID); | 149 | m_inventoryService.CreateNewUserInventory(userProf.UUID); |
144 | System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); | 150 | System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); |
145 | return userProf.UUID; | 151 | return userProf.UUID; |
146 | } | 152 | } |
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index ccbb729..ce6205f 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs | |||
@@ -27,10 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | ||
31 | using libsecondlife; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | 30 | ||
35 | namespace OpenSim.Framework.Communications | 31 | namespace OpenSim.Framework.Communications |
36 | { | 32 | { |
@@ -41,4 +37,4 @@ namespace OpenSim.Framework.Communications | |||
41 | RegionInfo RequestNeighbourInfo(ulong regionHandle); | 37 | RegionInfo RequestNeighbourInfo(ulong regionHandle); |
42 | List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); | 38 | List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); |
43 | } | 39 | } |
44 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 244747d..d4fb54b 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using OpenSim.Framework; | ||
30 | 29 | ||
31 | namespace OpenSim.Framework.Communications | 30 | namespace OpenSim.Framework.Communications |
32 | { | 31 | { |
@@ -36,4 +35,4 @@ namespace OpenSim.Framework.Communications | |||
36 | bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); | 35 | bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
37 | bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); | 36 | bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); |
38 | } | 37 | } |
39 | } | 38 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index e7758c4..fc301c2 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -26,16 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using libsecondlife; | 30 | using libsecondlife; |
33 | using OpenSim.Framework.Communications.Cache; | 31 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Framework; | ||
35 | 32 | ||
36 | namespace OpenSim.Framework.Communications | 33 | namespace OpenSim.Framework.Communications |
37 | { | 34 | { |
38 | public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo); | 35 | public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo); |
36 | |||
39 | public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); | 37 | public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); |
40 | 38 | ||
41 | public interface IInventoryServices | 39 | public interface IInventoryServices |
@@ -53,4 +51,4 @@ namespace OpenSim.Framework.Communications | |||
53 | /// <returns></returns> | 51 | /// <returns></returns> |
54 | List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); | 52 | List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); |
55 | } | 53 | } |
56 | } | 54 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 05183be..effe132 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -30,10 +30,8 @@ using System; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework; | ||
37 | 35 | ||
38 | namespace OpenSim.Framework.Communications | 36 | namespace OpenSim.Framework.Communications |
39 | { | 37 | { |
@@ -67,10 +65,10 @@ namespace OpenSim.Framework.Communications | |||
67 | if (typeInterface != null) | 65 | if (typeInterface != null) |
68 | { | 66 | { |
69 | IInventoryData plug = | 67 | IInventoryData plug = |
70 | (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 68 | (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
71 | plug.Initialise(); | 69 | plug.Initialise(); |
72 | this.m_plugins.Add(plug.getName(), plug); | 70 | m_plugins.Add(plug.getName(), plug); |
73 | MainLog.Instance.Verbose("INVENTORY","Added IInventoryData Interface"); | 71 | MainLog.Instance.Verbose("INVENTORY", "Added IInventoryData Interface"); |
74 | } | 72 | } |
75 | } | 73 | } |
76 | } | 74 | } |
@@ -168,7 +166,7 @@ namespace OpenSim.Framework.Communications | |||
168 | { | 166 | { |
169 | foreach (InventoryFolderBase folder in inventory.Folders.Values) | 167 | foreach (InventoryFolderBase folder in inventory.Folders.Values) |
170 | { | 168 | { |
171 | this.AddFolder(folder); | 169 | AddFolder(folder); |
172 | } | 170 | } |
173 | } | 171 | } |
174 | 172 | ||
@@ -176,7 +174,7 @@ namespace OpenSim.Framework.Communications | |||
176 | { | 174 | { |
177 | UsersInventory inven = new UsersInventory(); | 175 | UsersInventory inven = new UsersInventory(); |
178 | inven.CreateNewInventorySet(user); | 176 | inven.CreateNewInventorySet(user); |
179 | this.AddNewInventorySet(inven); | 177 | AddNewInventorySet(inven); |
180 | } | 178 | } |
181 | 179 | ||
182 | public class UsersInventory | 180 | public class UsersInventory |
@@ -186,7 +184,6 @@ namespace OpenSim.Framework.Communications | |||
186 | 184 | ||
187 | public UsersInventory() | 185 | public UsersInventory() |
188 | { | 186 | { |
189 | |||
190 | } | 187 | } |
191 | 188 | ||
192 | public virtual void CreateNewInventorySet(LLUUID user) | 189 | public virtual void CreateNewInventorySet(LLUUID user) |
@@ -231,9 +228,11 @@ namespace OpenSim.Framework.Communications | |||
231 | } | 228 | } |
232 | } | 229 | } |
233 | 230 | ||
234 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); | 231 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, |
232 | InventoryItemInfo itemCallBack); | ||
233 | |||
235 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); | 234 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); |
236 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 235 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
237 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 236 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
238 | } | 237 | } |
239 | } | 238 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 38bc016..4d1c35a 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs | |||
@@ -34,12 +34,10 @@ using OpenSim.Framework.Console; | |||
34 | 34 | ||
35 | namespace OpenSim.Framework.UserManagement | 35 | namespace OpenSim.Framework.UserManagement |
36 | { | 36 | { |
37 | |||
38 | /// <summary> | 37 | /// <summary> |
39 | /// A temp class to handle login response. | 38 | /// A temp class to handle login response. |
40 | /// Should make use of UserProfileManager where possible. | 39 | /// Should make use of UserProfileManager where possible. |
41 | /// </summary> | 40 | /// </summary> |
42 | |||
43 | public class LoginResponse | 41 | public class LoginResponse |
44 | { | 42 | { |
45 | private Hashtable loginFlagsHash; | 43 | private Hashtable loginFlagsHash; |
@@ -103,211 +101,222 @@ namespace OpenSim.Framework.UserManagement | |||
103 | 101 | ||
104 | public LoginResponse() | 102 | public LoginResponse() |
105 | { | 103 | { |
106 | this.loginFlags = new ArrayList(); | 104 | loginFlags = new ArrayList(); |
107 | this.globalTextures = new ArrayList(); | 105 | globalTextures = new ArrayList(); |
108 | this.eventCategories = new ArrayList(); | 106 | eventCategories = new ArrayList(); |
109 | this.uiConfig = new ArrayList(); | 107 | uiConfig = new ArrayList(); |
110 | this.classifiedCategories = new ArrayList(); | 108 | classifiedCategories = new ArrayList(); |
111 | 109 | ||
112 | this.loginError = new Hashtable(); | 110 | loginError = new Hashtable(); |
113 | this.uiConfigHash = new Hashtable(); | 111 | uiConfigHash = new Hashtable(); |
114 | 112 | ||
115 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | 113 | defaultXmlRpcResponse = new XmlRpcResponse(); |
116 | this.userProfile = new UserInfo(); | 114 | userProfile = new UserInfo(); |
117 | this.inventoryRoot = new ArrayList(); | 115 | inventoryRoot = new ArrayList(); |
118 | this.initialOutfit = new ArrayList(); | 116 | initialOutfit = new ArrayList(); |
119 | this.agentInventory = new ArrayList(); | 117 | agentInventory = new ArrayList(); |
120 | this.inventoryLibrary = new ArrayList(); | 118 | inventoryLibrary = new ArrayList(); |
121 | this.inventoryLibraryOwner = new ArrayList(); | 119 | inventoryLibraryOwner = new ArrayList(); |
122 | 120 | ||
123 | this.xmlRpcResponse = new XmlRpcResponse(); | 121 | xmlRpcResponse = new XmlRpcResponse(); |
124 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | 122 | defaultXmlRpcResponse = new XmlRpcResponse(); |
125 | 123 | ||
126 | this.SetDefaultValues(); | 124 | SetDefaultValues(); |
127 | } // LoginServer | 125 | } // LoginServer |
128 | 126 | ||
129 | public void SetDefaultValues() | 127 | public void SetDefaultValues() |
130 | { | 128 | { |
131 | this.DST = "N"; | 129 | DST = "N"; |
132 | this.StipendSinceLogin = "N"; | 130 | StipendSinceLogin = "N"; |
133 | this.Gendered = "Y"; | 131 | Gendered = "Y"; |
134 | this.EverLoggedIn = "Y"; | 132 | EverLoggedIn = "Y"; |
135 | this.login = "false"; | 133 | login = "false"; |
136 | this.firstname = "Test"; | 134 | firstname = "Test"; |
137 | this.lastname = "User"; | 135 | lastname = "User"; |
138 | this.agentAccess = "M"; | 136 | agentAccess = "M"; |
139 | this.startLocation = "last"; | 137 | startLocation = "last"; |
140 | this.allowFirstLife = "Y"; | 138 | allowFirstLife = "Y"; |
141 | 139 | ||
142 | this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; | 140 | SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; |
143 | this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | 141 | CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; |
144 | this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | 142 | MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; |
145 | 143 | ||
146 | this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; | 144 | ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; |
147 | this.ErrorReason = "key"; | 145 | ErrorReason = "key"; |
148 | this.welcomeMessage = "Welcome to OpenSim!"; | 146 | welcomeMessage = "Welcome to OpenSim!"; |
149 | this.seedCapability = ""; | 147 | seedCapability = ""; |
150 | this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; | 148 | home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" + |
151 | this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | 149 | userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + |
152 | this.RegionX = (uint)255232; | 150 | userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + |
153 | this.RegionY = (uint)254976; | 151 | userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; |
154 | 152 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | |
155 | // Classifieds; | 153 | RegionX = (uint) 255232; |
156 | this.AddClassifiedCategory((Int32)1, "Shopping"); | 154 | RegionY = (uint) 254976; |
157 | this.AddClassifiedCategory((Int32)2, "Land Rental"); | 155 | |
158 | this.AddClassifiedCategory((Int32)3, "Property Rental"); | 156 | // Classifieds; |
159 | this.AddClassifiedCategory((Int32)4, "Special Attraction"); | 157 | AddClassifiedCategory((Int32) 1, "Shopping"); |
160 | this.AddClassifiedCategory((Int32)5, "New Products"); | 158 | AddClassifiedCategory((Int32) 2, "Land Rental"); |
161 | this.AddClassifiedCategory((Int32)6, "Employment"); | 159 | AddClassifiedCategory((Int32) 3, "Property Rental"); |
162 | this.AddClassifiedCategory((Int32)7, "Wanted"); | 160 | AddClassifiedCategory((Int32) 4, "Special Attraction"); |
163 | this.AddClassifiedCategory((Int32)8, "Service"); | 161 | AddClassifiedCategory((Int32) 5, "New Products"); |
164 | this.AddClassifiedCategory((Int32)9, "Personal"); | 162 | AddClassifiedCategory((Int32) 6, "Employment"); |
165 | 163 | AddClassifiedCategory((Int32) 7, "Wanted"); | |
166 | 164 | AddClassifiedCategory((Int32) 8, "Service"); | |
167 | this.SessionID = LLUUID.Random(); | 165 | AddClassifiedCategory((Int32) 9, "Personal"); |
168 | this.SecureSessionID = LLUUID.Random(); | 166 | |
169 | this.AgentID = LLUUID.Random(); | 167 | |
170 | 168 | SessionID = LLUUID.Random(); | |
171 | Hashtable InitialOutfitHash = new Hashtable(); | 169 | SecureSessionID = LLUUID.Random(); |
172 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | 170 | AgentID = LLUUID.Random(); |
173 | InitialOutfitHash["gender"] = "female"; | 171 | |
174 | this.initialOutfit.Add(InitialOutfitHash); | 172 | Hashtable InitialOutfitHash = new Hashtable(); |
175 | 173 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | |
176 | 174 | InitialOutfitHash["gender"] = "female"; | |
175 | initialOutfit.Add(InitialOutfitHash); | ||
177 | } // SetDefaultValues | 176 | } // SetDefaultValues |
178 | 177 | ||
179 | #region Login Failure Methods | 178 | #region Login Failure Methods |
179 | |||
180 | public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) | 180 | public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) |
181 | { | 181 | { |
182 | // Overwrite any default values; | 182 | // Overwrite any default values; |
183 | this.xmlRpcResponse = new XmlRpcResponse(); | 183 | xmlRpcResponse = new XmlRpcResponse(); |
184 | 184 | ||
185 | // Ensure Login Failed message/reason; | 185 | // Ensure Login Failed message/reason; |
186 | this.ErrorMessage = message; | 186 | ErrorMessage = message; |
187 | this.ErrorReason = reason; | 187 | ErrorReason = reason; |
188 | 188 | ||
189 | this.loginError["reason"] = this.ErrorReason; | 189 | loginError["reason"] = ErrorReason; |
190 | this.loginError["message"] = this.ErrorMessage; | 190 | loginError["message"] = ErrorMessage; |
191 | this.loginError["login"] = login; | 191 | loginError["login"] = login; |
192 | this.xmlRpcResponse.Value = this.loginError; | 192 | xmlRpcResponse.Value = loginError; |
193 | return (this.xmlRpcResponse); | 193 | return (xmlRpcResponse); |
194 | } // GenerateResponse | 194 | } // GenerateResponse |
195 | 195 | ||
196 | public XmlRpcResponse CreateFailedResponse() | 196 | public XmlRpcResponse CreateFailedResponse() |
197 | { | 197 | { |
198 | return (this.CreateLoginFailedResponse()); | 198 | return (CreateLoginFailedResponse()); |
199 | } // CreateErrorConnectingToGridResponse() | 199 | } // CreateErrorConnectingToGridResponse() |
200 | 200 | ||
201 | public XmlRpcResponse CreateLoginFailedResponse() | 201 | public XmlRpcResponse CreateLoginFailedResponse() |
202 | { | 202 | { |
203 | return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); | 203 | return |
204 | (GenerateFailureResponse("key", | ||
205 | "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", | ||
206 | "false")); | ||
204 | } // LoginFailedResponse | 207 | } // LoginFailedResponse |
205 | 208 | ||
206 | public XmlRpcResponse CreateAlreadyLoggedInResponse() | 209 | public XmlRpcResponse CreateAlreadyLoggedInResponse() |
207 | { | 210 | { |
208 | return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); | 211 | return |
212 | (GenerateFailureResponse("presence", | ||
213 | "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", | ||
214 | "false")); | ||
209 | } // CreateAlreadyLoggedInResponse() | 215 | } // CreateAlreadyLoggedInResponse() |
210 | 216 | ||
211 | public XmlRpcResponse CreateDeadRegionResponse() | 217 | public XmlRpcResponse CreateDeadRegionResponse() |
212 | { | 218 | { |
213 | return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); | 219 | return |
220 | (GenerateFailureResponse("key", | ||
221 | "The region you are attempting to log into is not responding. Please select another region and try again.", | ||
222 | "false")); | ||
214 | } | 223 | } |
215 | 224 | ||
216 | public XmlRpcResponse CreateGridErrorResponse() | 225 | public XmlRpcResponse CreateGridErrorResponse() |
217 | { | 226 | { |
218 | return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); | 227 | return |
228 | (GenerateFailureResponse("key", | ||
229 | "Error connecting to grid. Could not percieve credentials from login XML.", | ||
230 | "false")); | ||
219 | } | 231 | } |
220 | 232 | ||
221 | #endregion | 233 | #endregion |
222 | 234 | ||
223 | public XmlRpcResponse ToXmlRpcResponse() | 235 | public XmlRpcResponse ToXmlRpcResponse() |
224 | { | 236 | { |
225 | try | 237 | try |
226 | { | 238 | { |
227 | |||
228 | Hashtable responseData = new Hashtable(); | 239 | Hashtable responseData = new Hashtable(); |
229 | 240 | ||
230 | this.loginFlagsHash = new Hashtable(); | 241 | loginFlagsHash = new Hashtable(); |
231 | this.loginFlagsHash["daylight_savings"] = this.DST; | 242 | loginFlagsHash["daylight_savings"] = DST; |
232 | this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; | 243 | loginFlagsHash["stipend_since_login"] = StipendSinceLogin; |
233 | this.loginFlagsHash["gendered"] = this.Gendered; | 244 | loginFlagsHash["gendered"] = Gendered; |
234 | this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; | 245 | loginFlagsHash["ever_logged_in"] = EverLoggedIn; |
235 | this.loginFlags.Add(this.loginFlagsHash); | 246 | loginFlags.Add(loginFlagsHash); |
236 | 247 | ||
237 | responseData["first_name"] = this.Firstname; | 248 | responseData["first_name"] = Firstname; |
238 | responseData["last_name"] = this.Lastname; | 249 | responseData["last_name"] = Lastname; |
239 | responseData["agent_access"] = this.agentAccess; | 250 | responseData["agent_access"] = agentAccess; |
240 | 251 | ||
241 | this.globalTexturesHash = new Hashtable(); | 252 | globalTexturesHash = new Hashtable(); |
242 | this.globalTexturesHash["sun_texture_id"] = this.SunTexture; | 253 | globalTexturesHash["sun_texture_id"] = SunTexture; |
243 | this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; | 254 | globalTexturesHash["cloud_texture_id"] = CloudTexture; |
244 | this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; | 255 | globalTexturesHash["moon_texture_id"] = MoonTexture; |
245 | this.globalTextures.Add(this.globalTexturesHash); | 256 | globalTextures.Add(globalTexturesHash); |
246 | // this.eventCategories.Add(this.eventCategoriesHash); | 257 | // this.eventCategories.Add(this.eventCategoriesHash); |
247 | 258 | ||
248 | this.AddToUIConfig("allow_first_life", this.allowFirstLife); | 259 | AddToUIConfig("allow_first_life", allowFirstLife); |
249 | this.uiConfig.Add(this.uiConfigHash); | 260 | uiConfig.Add(uiConfigHash); |
250 | 261 | ||
251 | responseData["sim_port"] =(Int32) this.SimPort; | 262 | responseData["sim_port"] = (Int32) SimPort; |
252 | responseData["sim_ip"] = this.SimAddress; | 263 | responseData["sim_ip"] = SimAddress; |
253 | 264 | ||
254 | responseData["agent_id"] = this.AgentID.ToStringHyphenated(); | 265 | responseData["agent_id"] = AgentID.ToStringHyphenated(); |
255 | responseData["session_id"] = this.SessionID.ToStringHyphenated(); | 266 | responseData["session_id"] = SessionID.ToStringHyphenated(); |
256 | responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); | 267 | responseData["secure_session_id"] = SecureSessionID.ToStringHyphenated(); |
257 | responseData["circuit_code"] = this.CircuitCode; | 268 | responseData["circuit_code"] = CircuitCode; |
258 | responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 269 | responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
259 | responseData["login-flags"] = this.loginFlags; | 270 | responseData["login-flags"] = loginFlags; |
260 | responseData["global-textures"] = this.globalTextures; | 271 | responseData["global-textures"] = globalTextures; |
261 | responseData["seed_capability"] = this.seedCapability; | 272 | responseData["seed_capability"] = seedCapability; |
262 | 273 | ||
263 | responseData["event_categories"] = this.eventCategories; | 274 | responseData["event_categories"] = eventCategories; |
264 | responseData["event_notifications"] = new ArrayList(); // todo | 275 | responseData["event_notifications"] = new ArrayList(); // todo |
265 | responseData["classified_categories"] = this.classifiedCategories; | 276 | responseData["classified_categories"] = classifiedCategories; |
266 | responseData["ui-config"] = this.uiConfig; | 277 | responseData["ui-config"] = uiConfig; |
267 | 278 | ||
268 | responseData["inventory-skeleton"] = this.agentInventory; | 279 | responseData["inventory-skeleton"] = agentInventory; |
269 | responseData["inventory-skel-lib"] = this.inventoryLibrary; | 280 | responseData["inventory-skel-lib"] = inventoryLibrary; |
270 | responseData["inventory-root"] = this.inventoryRoot; | 281 | responseData["inventory-root"] = inventoryRoot; |
271 | responseData["gestures"] = new ArrayList(); // todo | 282 | responseData["gestures"] = new ArrayList(); // todo |
272 | responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; | 283 | responseData["inventory-lib-owner"] = inventoryLibraryOwner; |
273 | responseData["initial-outfit"] = this.initialOutfit; | 284 | responseData["initial-outfit"] = initialOutfit; |
274 | responseData["start_location"] = this.startLocation; | 285 | responseData["start_location"] = startLocation; |
275 | responseData["seed_capability"] = this.seedCapability; | 286 | responseData["seed_capability"] = seedCapability; |
276 | responseData["home"] = this.home; | 287 | responseData["home"] = home; |
277 | responseData["look_at"] = this.lookAt; | 288 | responseData["look_at"] = lookAt; |
278 | responseData["message"] = this.welcomeMessage; | 289 | responseData["message"] = welcomeMessage; |
279 | responseData["region_x"] = (Int32)this.RegionX * 256; | 290 | responseData["region_x"] = (Int32) RegionX*256; |
280 | responseData["region_y"] = (Int32)this.RegionY * 256; | 291 | responseData["region_y"] = (Int32) RegionY*256; |
281 | 292 | ||
282 | //responseData["inventory-lib-root"] = new ArrayList(); // todo | 293 | //responseData["inventory-lib-root"] = new ArrayList(); // todo |
283 | //responseData["buddy-list"] = new ArrayList(); // todo | 294 | //responseData["buddy-list"] = new ArrayList(); // todo |
284 | 295 | ||
285 | responseData["login"] = "true"; | 296 | responseData["login"] = "true"; |
286 | this.xmlRpcResponse.Value = responseData; | 297 | xmlRpcResponse.Value = responseData; |
287 | 298 | ||
288 | return (this.xmlRpcResponse); | 299 | return (xmlRpcResponse); |
289 | } | 300 | } |
290 | catch (Exception e) | 301 | catch (Exception e) |
291 | { | 302 | { |
292 | MainLog.Instance.Warn( | 303 | MainLog.Instance.Warn( |
293 | "CLIENT", | 304 | "CLIENT", |
294 | "LoginResponse: Error creating XML-RPC Response: " + e.Message | 305 | "LoginResponse: Error creating XML-RPC Response: " + e.Message |
295 | ); | 306 | ); |
296 | return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); | 307 | return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); |
297 | |||
298 | } | 308 | } |
299 | |||
300 | } // ToXmlRpcResponse | 309 | } // ToXmlRpcResponse |
301 | 310 | ||
302 | public void SetEventCategories(string category, string value) | 311 | public void SetEventCategories(string category, string value) |
303 | { | 312 | { |
304 | // this.eventCategoriesHash[category] = value; | 313 | // this.eventCategoriesHash[category] = value; |
305 | //TODO | 314 | //TODO |
306 | } // SetEventCategories | 315 | } // SetEventCategories |
307 | 316 | ||
308 | public void AddToUIConfig(string itemName, string item) | 317 | public void AddToUIConfig(string itemName, string item) |
309 | { | 318 | { |
310 | this.uiConfigHash[itemName] = item; | 319 | uiConfigHash[itemName] = item; |
311 | } // SetUIConfig | 320 | } // SetUIConfig |
312 | 321 | ||
313 | public void AddClassifiedCategory(Int32 ID, string categoryName) | 322 | public void AddClassifiedCategory(Int32 ID, string categoryName) |
@@ -315,372 +324,193 @@ namespace OpenSim.Framework.UserManagement | |||
315 | Hashtable hash = new Hashtable(); | 324 | Hashtable hash = new Hashtable(); |
316 | hash["category_name"] = categoryName; | 325 | hash["category_name"] = categoryName; |
317 | hash["category_id"] = ID; | 326 | hash["category_id"] = ID; |
318 | this.classifiedCategories.Add(hash); | 327 | classifiedCategories.Add(hash); |
319 | // this.classifiedCategoriesHash.Clear(); | 328 | // this.classifiedCategoriesHash.Clear(); |
320 | } // SetClassifiedCategory | 329 | } // SetClassifiedCategory |
321 | 330 | ||
322 | #region Properties | 331 | #region Properties |
332 | |||
323 | public string Login | 333 | public string Login |
324 | { | 334 | { |
325 | get | 335 | get { return login; } |
326 | { | 336 | set { login = value; } |
327 | return this.login; | ||
328 | } | ||
329 | set | ||
330 | { | ||
331 | this.login = value; | ||
332 | } | ||
333 | } // Login | 337 | } // Login |
334 | 338 | ||
335 | public string DST | 339 | public string DST |
336 | { | 340 | { |
337 | get | 341 | get { return dst; } |
338 | { | 342 | set { dst = value; } |
339 | return this.dst; | ||
340 | } | ||
341 | set | ||
342 | { | ||
343 | this.dst = value; | ||
344 | } | ||
345 | } // DST | 343 | } // DST |
346 | 344 | ||
347 | public string StipendSinceLogin | 345 | public string StipendSinceLogin |
348 | { | 346 | { |
349 | get | 347 | get { return stipendSinceLogin; } |
350 | { | 348 | set { stipendSinceLogin = value; } |
351 | return this.stipendSinceLogin; | ||
352 | } | ||
353 | set | ||
354 | { | ||
355 | this.stipendSinceLogin = value; | ||
356 | } | ||
357 | } // StipendSinceLogin | 349 | } // StipendSinceLogin |
358 | 350 | ||
359 | public string Gendered | 351 | public string Gendered |
360 | { | 352 | { |
361 | get | 353 | get { return gendered; } |
362 | { | 354 | set { gendered = value; } |
363 | return this.gendered; | ||
364 | } | ||
365 | set | ||
366 | { | ||
367 | this.gendered = value; | ||
368 | } | ||
369 | } // Gendered | 355 | } // Gendered |
370 | 356 | ||
371 | public string EverLoggedIn | 357 | public string EverLoggedIn |
372 | { | 358 | { |
373 | get | 359 | get { return everLoggedIn; } |
374 | { | 360 | set { everLoggedIn = value; } |
375 | return this.everLoggedIn; | ||
376 | } | ||
377 | set | ||
378 | { | ||
379 | this.everLoggedIn = value; | ||
380 | } | ||
381 | } // EverLoggedIn | 361 | } // EverLoggedIn |
382 | 362 | ||
383 | public int SimPort | 363 | public int SimPort |
384 | { | 364 | { |
385 | get | 365 | get { return simPort; } |
386 | { | 366 | set { simPort = value; } |
387 | return this.simPort; | ||
388 | } | ||
389 | set | ||
390 | { | ||
391 | this.simPort = value; | ||
392 | } | ||
393 | } // SimPort | 367 | } // SimPort |
394 | 368 | ||
395 | public string SimAddress | 369 | public string SimAddress |
396 | { | 370 | { |
397 | get | 371 | get { return simAddress; } |
398 | { | 372 | set { simAddress = value; } |
399 | return this.simAddress; | ||
400 | } | ||
401 | set | ||
402 | { | ||
403 | this.simAddress = value; | ||
404 | } | ||
405 | } // SimAddress | 373 | } // SimAddress |
406 | 374 | ||
407 | public LLUUID AgentID | 375 | public LLUUID AgentID |
408 | { | 376 | { |
409 | get | 377 | get { return agentID; } |
410 | { | 378 | set { agentID = value; } |
411 | return this.agentID; | ||
412 | } | ||
413 | set | ||
414 | { | ||
415 | this.agentID = value; | ||
416 | } | ||
417 | } // AgentID | 379 | } // AgentID |
418 | 380 | ||
419 | public LLUUID SessionID | 381 | public LLUUID SessionID |
420 | { | 382 | { |
421 | get | 383 | get { return sessionID; } |
422 | { | 384 | set { sessionID = value; } |
423 | return this.sessionID; | ||
424 | } | ||
425 | set | ||
426 | { | ||
427 | this.sessionID = value; | ||
428 | } | ||
429 | } // SessionID | 385 | } // SessionID |
430 | 386 | ||
431 | public LLUUID SecureSessionID | 387 | public LLUUID SecureSessionID |
432 | { | 388 | { |
433 | get | 389 | get { return secureSessionID; } |
434 | { | 390 | set { secureSessionID = value; } |
435 | return this.secureSessionID; | ||
436 | } | ||
437 | set | ||
438 | { | ||
439 | this.secureSessionID = value; | ||
440 | } | ||
441 | } // SecureSessionID | 391 | } // SecureSessionID |
442 | 392 | ||
443 | public Int32 CircuitCode | 393 | public Int32 CircuitCode |
444 | { | 394 | { |
445 | get | 395 | get { return circuitCode; } |
446 | { | 396 | set { circuitCode = value; } |
447 | return this.circuitCode; | ||
448 | } | ||
449 | set | ||
450 | { | ||
451 | this.circuitCode = value; | ||
452 | } | ||
453 | } // CircuitCode | 397 | } // CircuitCode |
454 | 398 | ||
455 | public uint RegionX | 399 | public uint RegionX |
456 | { | 400 | { |
457 | get | 401 | get { return regionX; } |
458 | { | 402 | set { regionX = value; } |
459 | return this.regionX; | ||
460 | } | ||
461 | set | ||
462 | { | ||
463 | this.regionX = value; | ||
464 | } | ||
465 | } // RegionX | 403 | } // RegionX |
466 | 404 | ||
467 | public uint RegionY | 405 | public uint RegionY |
468 | { | 406 | { |
469 | get | 407 | get { return regionY; } |
470 | { | 408 | set { regionY = value; } |
471 | return this.regionY; | ||
472 | } | ||
473 | set | ||
474 | { | ||
475 | this.regionY = value; | ||
476 | } | ||
477 | } // RegionY | 409 | } // RegionY |
478 | 410 | ||
479 | public string SunTexture | 411 | public string SunTexture |
480 | { | 412 | { |
481 | get | 413 | get { return sunTexture; } |
482 | { | 414 | set { sunTexture = value; } |
483 | return this.sunTexture; | ||
484 | } | ||
485 | set | ||
486 | { | ||
487 | this.sunTexture = value; | ||
488 | } | ||
489 | } // SunTexture | 415 | } // SunTexture |
490 | 416 | ||
491 | public string CloudTexture | 417 | public string CloudTexture |
492 | { | 418 | { |
493 | get | 419 | get { return cloudTexture; } |
494 | { | 420 | set { cloudTexture = value; } |
495 | return this.cloudTexture; | ||
496 | } | ||
497 | set | ||
498 | { | ||
499 | this.cloudTexture = value; | ||
500 | } | ||
501 | } // CloudTexture | 421 | } // CloudTexture |
502 | 422 | ||
503 | public string MoonTexture | 423 | public string MoonTexture |
504 | { | 424 | { |
505 | get | 425 | get { return moonTexture; } |
506 | { | 426 | set { moonTexture = value; } |
507 | return this.moonTexture; | ||
508 | } | ||
509 | set | ||
510 | { | ||
511 | this.moonTexture = value; | ||
512 | } | ||
513 | } // MoonTexture | 427 | } // MoonTexture |
514 | 428 | ||
515 | public string Firstname | 429 | public string Firstname |
516 | { | 430 | { |
517 | get | 431 | get { return firstname; } |
518 | { | 432 | set { firstname = value; } |
519 | return this.firstname; | ||
520 | } | ||
521 | set | ||
522 | { | ||
523 | this.firstname = value; | ||
524 | } | ||
525 | } // Firstname | 433 | } // Firstname |
526 | 434 | ||
527 | public string Lastname | 435 | public string Lastname |
528 | { | 436 | { |
529 | get | 437 | get { return lastname; } |
530 | { | 438 | set { lastname = value; } |
531 | return this.lastname; | ||
532 | } | ||
533 | set | ||
534 | { | ||
535 | this.lastname = value; | ||
536 | } | ||
537 | } // Lastname | 439 | } // Lastname |
538 | 440 | ||
539 | public string AgentAccess | 441 | public string AgentAccess |
540 | { | 442 | { |
541 | get | 443 | get { return agentAccess; } |
542 | { | 444 | set { agentAccess = value; } |
543 | return this.agentAccess; | ||
544 | } | ||
545 | set | ||
546 | { | ||
547 | this.agentAccess = value; | ||
548 | } | ||
549 | } | 445 | } |
550 | 446 | ||
551 | public string StartLocation | 447 | public string StartLocation |
552 | { | 448 | { |
553 | get | 449 | get { return startLocation; } |
554 | { | 450 | set { startLocation = value; } |
555 | return this.startLocation; | ||
556 | } | ||
557 | set | ||
558 | { | ||
559 | this.startLocation = value; | ||
560 | } | ||
561 | } // StartLocation | 451 | } // StartLocation |
562 | 452 | ||
563 | public string LookAt | 453 | public string LookAt |
564 | { | 454 | { |
565 | get | 455 | get { return lookAt; } |
566 | { | 456 | set { lookAt = value; } |
567 | return this.lookAt; | ||
568 | } | ||
569 | set | ||
570 | { | ||
571 | this.lookAt = value; | ||
572 | } | ||
573 | } | 457 | } |
574 | 458 | ||
575 | public string SeedCapability | 459 | public string SeedCapability |
576 | { | 460 | { |
577 | get | 461 | get { return seedCapability; } |
578 | { | 462 | set { seedCapability = value; } |
579 | return this.seedCapability; | ||
580 | } | ||
581 | set | ||
582 | { | ||
583 | this.seedCapability = value; | ||
584 | } | ||
585 | } // SeedCapability | 463 | } // SeedCapability |
586 | 464 | ||
587 | public string ErrorReason | 465 | public string ErrorReason |
588 | { | 466 | { |
589 | get | 467 | get { return errorReason; } |
590 | { | 468 | set { errorReason = value; } |
591 | return this.errorReason; | ||
592 | } | ||
593 | set | ||
594 | { | ||
595 | this.errorReason = value; | ||
596 | } | ||
597 | } // ErrorReason | 469 | } // ErrorReason |
598 | 470 | ||
599 | public string ErrorMessage | 471 | public string ErrorMessage |
600 | { | 472 | { |
601 | get | 473 | get { return errorMessage; } |
602 | { | 474 | set { errorMessage = value; } |
603 | return this.errorMessage; | ||
604 | } | ||
605 | set | ||
606 | { | ||
607 | this.errorMessage = value; | ||
608 | } | ||
609 | } // ErrorMessage | 475 | } // ErrorMessage |
610 | 476 | ||
611 | public ArrayList InventoryRoot | 477 | public ArrayList InventoryRoot |
612 | { | 478 | { |
613 | get | 479 | get { return inventoryRoot; } |
614 | { | 480 | set { inventoryRoot = value; } |
615 | return this.inventoryRoot; | ||
616 | } | ||
617 | set | ||
618 | { | ||
619 | this.inventoryRoot = value; | ||
620 | } | ||
621 | } | 481 | } |
622 | 482 | ||
623 | public ArrayList InventorySkeleton | 483 | public ArrayList InventorySkeleton |
624 | { | 484 | { |
625 | get | 485 | get { return agentInventory; } |
626 | { | 486 | set { agentInventory = value; } |
627 | return this.agentInventory; | ||
628 | } | ||
629 | set | ||
630 | { | ||
631 | this.agentInventory = value; | ||
632 | } | ||
633 | } | 487 | } |
634 | 488 | ||
635 | public ArrayList InventoryLibrary | 489 | public ArrayList InventoryLibrary |
636 | { | 490 | { |
637 | get | 491 | get { return inventoryLibrary; } |
638 | { | 492 | set { inventoryLibrary = value; } |
639 | return this.inventoryLibrary; | ||
640 | } | ||
641 | set | ||
642 | { | ||
643 | this.inventoryLibrary = value; | ||
644 | } | ||
645 | } | 493 | } |
646 | 494 | ||
647 | public ArrayList InventoryLibraryOwner | 495 | public ArrayList InventoryLibraryOwner |
648 | { | 496 | { |
649 | get | 497 | get { return inventoryLibraryOwner; } |
650 | { | 498 | set { inventoryLibraryOwner = value; } |
651 | return this.inventoryLibraryOwner; | ||
652 | } | ||
653 | set | ||
654 | { | ||
655 | this.inventoryLibraryOwner = value; | ||
656 | } | ||
657 | } | 499 | } |
658 | 500 | ||
659 | public string Home | 501 | public string Home |
660 | { | 502 | { |
661 | get | 503 | get { return home; } |
662 | { | 504 | set { home = value; } |
663 | return this.home; | ||
664 | } | ||
665 | set | ||
666 | { | ||
667 | this.home = value; | ||
668 | } | ||
669 | } | 505 | } |
670 | 506 | ||
671 | public string Message | 507 | public string Message |
672 | { | 508 | { |
673 | get | 509 | get { return welcomeMessage; } |
674 | { | 510 | set { welcomeMessage = value; } |
675 | return this.welcomeMessage; | ||
676 | } | ||
677 | set | ||
678 | { | ||
679 | this.welcomeMessage = value; | ||
680 | } | ||
681 | } | 511 | } |
682 | #endregion | ||
683 | 512 | ||
513 | #endregion | ||
684 | 514 | ||
685 | public class UserInfo | 515 | public class UserInfo |
686 | { | 516 | { |
@@ -691,6 +521,4 @@ namespace OpenSim.Framework.UserManagement | |||
691 | public LLVector3 homelookat; | 521 | public LLVector3 homelookat; |
692 | } | 522 | } |
693 | } | 523 | } |
694 | } | 524 | } \ No newline at end of file |
695 | |||
696 | |||
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 66b91e1..497cc5d 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -28,16 +28,10 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using System.Security.Cryptography; | ||
34 | using libsecondlife; | 31 | using libsecondlife; |
35 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
36 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
37 | 34 | ||
38 | using OpenSim.Framework; | ||
39 | using InventoryFolder = OpenSim.Framework.InventoryFolder; | ||
40 | |||
41 | namespace OpenSim.Framework.UserManagement | 35 | namespace OpenSim.Framework.UserManagement |
42 | { | 36 | { |
43 | public class LoginService | 37 | public class LoginService |
@@ -61,12 +55,12 @@ namespace OpenSim.Framework.UserManagement | |||
61 | /// <returns>The response to send</returns> | 55 | /// <returns>The response to send</returns> |
62 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 56 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
63 | { | 57 | { |
64 | 58 | MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); | |
65 | MainLog.Instance.Verbose("LOGIN","Attempting login now..."); | ||
66 | XmlRpcResponse response = new XmlRpcResponse(); | 59 | XmlRpcResponse response = new XmlRpcResponse(); |
67 | Hashtable requestData = (Hashtable)request.Params[0]; | 60 | Hashtable requestData = (Hashtable) request.Params[0]; |
68 | 61 | ||
69 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | 62 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && |
63 | requestData.Contains("passwd")); | ||
70 | bool GoodLogin = false; | 64 | bool GoodLogin = false; |
71 | 65 | ||
72 | UserProfileData userProfile; | 66 | UserProfileData userProfile; |
@@ -74,9 +68,9 @@ namespace OpenSim.Framework.UserManagement | |||
74 | 68 | ||
75 | if (GoodXML) | 69 | if (GoodXML) |
76 | { | 70 | { |
77 | string firstname = (string)requestData["first"]; | 71 | string firstname = (string) requestData["first"]; |
78 | string lastname = (string)requestData["last"]; | 72 | string lastname = (string) requestData["last"]; |
79 | string passwd = (string)requestData["passwd"]; | 73 | string passwd = (string) requestData["passwd"]; |
80 | 74 | ||
81 | userProfile = GetTheUser(firstname, lastname); | 75 | userProfile = GetTheUser(firstname, lastname); |
82 | if (userProfile == null) | 76 | if (userProfile == null) |
@@ -110,7 +104,7 @@ namespace OpenSim.Framework.UserManagement | |||
110 | LLUUID agentID = userProfile.UUID; | 104 | LLUUID agentID = userProfile.UUID; |
111 | 105 | ||
112 | // Inventory Library Section | 106 | // Inventory Library Section |
113 | InventoryData inventData = this.CreateInventoryData(agentID); | 107 | InventoryData inventData = CreateInventoryData(agentID); |
114 | ArrayList AgentInventoryArray = inventData.InventoryArray; | 108 | ArrayList AgentInventoryArray = inventData.InventoryArray; |
115 | 109 | ||
116 | Hashtable InventoryRootHash = new Hashtable(); | 110 | Hashtable InventoryRootHash = new Hashtable(); |
@@ -120,7 +114,7 @@ namespace OpenSim.Framework.UserManagement | |||
120 | userProfile.rootInventoryFolderID = inventData.RootFolderID; | 114 | userProfile.rootInventoryFolderID = inventData.RootFolderID; |
121 | 115 | ||
122 | // Circuit Code | 116 | // Circuit Code |
123 | uint circode = (uint)(Util.RandomClass.Next()); | 117 | uint circode = (uint) (Util.RandomClass.Next()); |
124 | 118 | ||
125 | logResponse.Lastname = userProfile.surname; | 119 | logResponse.Lastname = userProfile.surname; |
126 | logResponse.Firstname = userProfile.username; | 120 | logResponse.Firstname = userProfile.username; |
@@ -129,20 +123,20 @@ namespace OpenSim.Framework.UserManagement | |||
129 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); | 123 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); |
130 | logResponse.InventoryRoot = InventoryRoot; | 124 | logResponse.InventoryRoot = InventoryRoot; |
131 | logResponse.InventorySkeleton = AgentInventoryArray; | 125 | logResponse.InventorySkeleton = AgentInventoryArray; |
132 | logResponse.InventoryLibrary = this.GetInventoryLibrary(); | 126 | logResponse.InventoryLibrary = GetInventoryLibrary(); |
133 | logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); | 127 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); |
134 | logResponse.CircuitCode = (Int32)circode; | 128 | logResponse.CircuitCode = (Int32) circode; |
135 | //logResponse.RegionX = 0; //overwritten | 129 | //logResponse.RegionX = 0; //overwritten |
136 | //logResponse.RegionY = 0; //overwritten | 130 | //logResponse.RegionY = 0; //overwritten |
137 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | 131 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten |
138 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | 132 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; |
139 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | 133 | //logResponse.SimAddress = "127.0.0.1"; //overwritten |
140 | //logResponse.SimPort = 0; //overwritten | 134 | //logResponse.SimPort = 0; //overwritten |
141 | logResponse.Message = this.GetMessage(); | 135 | logResponse.Message = GetMessage(); |
142 | 136 | ||
143 | try | 137 | try |
144 | { | 138 | { |
145 | this.CustomiseResponse(logResponse, userProfile); | 139 | CustomiseResponse(logResponse, userProfile); |
146 | } | 140 | } |
147 | catch (Exception e) | 141 | catch (Exception e) |
148 | { | 142 | { |
@@ -152,7 +146,6 @@ namespace OpenSim.Framework.UserManagement | |||
152 | } | 146 | } |
153 | CommitAgent(ref userProfile); | 147 | CommitAgent(ref userProfile); |
154 | return logResponse.ToXmlRpcResponse(); | 148 | return logResponse.ToXmlRpcResponse(); |
155 | |||
156 | } | 149 | } |
157 | 150 | ||
158 | catch (Exception E) | 151 | catch (Exception E) |
@@ -162,7 +155,6 @@ namespace OpenSim.Framework.UserManagement | |||
162 | //} | 155 | //} |
163 | } | 156 | } |
164 | return response; | 157 | return response; |
165 | |||
166 | } | 158 | } |
167 | 159 | ||
168 | /// <summary> | 160 | /// <summary> |
@@ -174,7 +166,7 @@ namespace OpenSim.Framework.UserManagement | |||
174 | { | 166 | { |
175 | } | 167 | } |
176 | 168 | ||
177 | /// <summary> | 169 | /// <summary> |
178 | /// Saves a target agent to the database | 170 | /// Saves a target agent to the database |
179 | /// </summary> | 171 | /// </summary> |
180 | /// <param name="profile">The users profile</param> | 172 | /// <param name="profile">The users profile</param> |
@@ -194,8 +186,7 @@ namespace OpenSim.Framework.UserManagement | |||
194 | /// <returns>Authenticated?</returns> | 186 | /// <returns>Authenticated?</returns> |
195 | public virtual bool AuthenticateUser(UserProfileData profile, string password) | 187 | public virtual bool AuthenticateUser(UserProfileData profile, string password) |
196 | { | 188 | { |
197 | 189 | MainLog.Instance.Verbose("LOGIN", "Authenticating " + profile.username + " " + profile.surname); | |
198 | MainLog.Instance.Verbose("LOGIN","Authenticating " + profile.username + " " + profile.surname); | ||
199 | 190 | ||
200 | password = password.Remove(0, 3); //remove $1$ | 191 | password = password.Remove(0, 3); //remove $1$ |
201 | 192 | ||
@@ -211,7 +202,7 @@ namespace OpenSim.Framework.UserManagement | |||
211 | /// <param name="request"></param> | 202 | /// <param name="request"></param> |
212 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 203 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
213 | { | 204 | { |
214 | this.m_userManager.CreateAgent(profile, request); | 205 | m_userManager.CreateAgent(profile, request); |
215 | } | 206 | } |
216 | 207 | ||
217 | /// <summary> | 208 | /// <summary> |
@@ -222,7 +213,7 @@ namespace OpenSim.Framework.UserManagement | |||
222 | /// <returns></returns> | 213 | /// <returns></returns> |
223 | public virtual UserProfileData GetTheUser(string firstname, string lastname) | 214 | public virtual UserProfileData GetTheUser(string firstname, string lastname) |
224 | { | 215 | { |
225 | return this.m_userManager.GetUserProfile(firstname, lastname); | 216 | return m_userManager.GetUserProfile(firstname, lastname); |
226 | } | 217 | } |
227 | 218 | ||
228 | /// <summary> | 219 | /// <summary> |
@@ -286,8 +277,8 @@ namespace OpenSim.Framework.UserManagement | |||
286 | TempHash = new Hashtable(); | 277 | TempHash = new Hashtable(); |
287 | TempHash["name"] = InvFolder.FolderName; | 278 | TempHash["name"] = InvFolder.FolderName; |
288 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 279 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
289 | TempHash["version"] = (Int32)InvFolder.Version; | 280 | TempHash["version"] = (Int32) InvFolder.Version; |
290 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 281 | TempHash["type_default"] = (Int32) InvFolder.DefaultType; |
291 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 282 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
292 | AgentInventoryArray.Add(TempHash); | 283 | AgentInventoryArray.Add(TempHash); |
293 | } | 284 | } |
@@ -307,4 +298,4 @@ namespace OpenSim.Framework.UserManagement | |||
307 | } | 298 | } |
308 | } | 299 | } |
309 | } | 300 | } |
310 | } | 301 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs index 43fce84..a812ac9 100644 --- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs | |||
@@ -1,4 +1,4 @@ | |||
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 | * |
@@ -27,25 +27,29 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // General Information about an assembly is controlled through the following | 31 | // General Information about an assembly is controlled through the following |
31 | // set of attributes. Change these attribute values to modify the information | 32 | // set of attributes. Change these attribute values to modify the information |
32 | // associated with an assembly. | 33 | // associated with an assembly. |
33 | [assembly: AssemblyTitle("OpenGrid.Framework.Communications")] | 34 | |
34 | [assembly: AssemblyDescription("")] | 35 | [assembly : AssemblyTitle("OpenGrid.Framework.Communications")] |
35 | [assembly: AssemblyConfiguration("")] | 36 | [assembly : AssemblyDescription("")] |
36 | [assembly: AssemblyCompany("")] | 37 | [assembly : AssemblyConfiguration("")] |
37 | [assembly: AssemblyProduct("OpenGrid.Framework.Communications")] | 38 | [assembly : AssemblyCompany("")] |
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | 39 | [assembly : AssemblyProduct("OpenGrid.Framework.Communications")] |
39 | [assembly: AssemblyTrademark("")] | 40 | [assembly : AssemblyCopyright("Copyright © 2007")] |
40 | [assembly: AssemblyCulture("")] | 41 | [assembly : AssemblyTrademark("")] |
42 | [assembly : AssemblyCulture("")] | ||
41 | 43 | ||
42 | // Setting ComVisible to false makes the types in this assembly not visible | 44 | // Setting ComVisible to false makes the types in this assembly not visible |
43 | // to COM components. If you need to access a type in this assembly from | 45 | // to COM components. If you need to access a type in this assembly from |
44 | // COM, set the ComVisible attribute to true on that type. | 46 | // COM, set the ComVisible attribute to true on that type. |
45 | [assembly: ComVisible(false)] | 47 | |
48 | [assembly : ComVisible(false)] | ||
46 | 49 | ||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 50 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
48 | [assembly: Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] | 51 | |
52 | [assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] | ||
49 | 53 | ||
50 | // Version information for an assembly consists of the following four values: | 54 | // Version information for an assembly consists of the following four values: |
51 | // | 55 | // |
@@ -56,5 +60,6 @@ using System.Runtime.InteropServices; | |||
56 | // | 60 | // |
57 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
58 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
59 | [assembly: AssemblyVersion("1.0.0.0")] | 63 | |
60 | [assembly: AssemblyFileVersion("1.0.0.0")] | 64 | [assembly : AssemblyVersion("1.0.0.0")] |
65 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs b/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs index c821fa4..72d8f65 100644 --- a/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs +++ b/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs | |||
@@ -1,13 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Threading; | 2 | using System.Threading; |
5 | 3 | ||
6 | namespace OpenSim.Framework.Communications | 4 | namespace OpenSim.Framework.Communications |
7 | { | 5 | { |
8 | internal class SimpleAsyncResult : IAsyncResult | 6 | internal class SimpleAsyncResult : IAsyncResult |
9 | { | 7 | { |
10 | |||
11 | private readonly AsyncCallback m_callback; | 8 | private readonly AsyncCallback m_callback; |
12 | 9 | ||
13 | /// <summary> | 10 | /// <summary> |
@@ -36,7 +33,6 @@ namespace OpenSim.Framework.Communications | |||
36 | m_completedSynchronously = 1; | 33 | m_completedSynchronously = 1; |
37 | } | 34 | } |
38 | 35 | ||
39 | |||
40 | #region IAsyncResult Members | 36 | #region IAsyncResult Members |
41 | 37 | ||
42 | public object AsyncState | 38 | public object AsyncState |
@@ -45,7 +41,6 @@ namespace OpenSim.Framework.Communications | |||
45 | } | 41 | } |
46 | 42 | ||
47 | 43 | ||
48 | |||
49 | public WaitHandle AsyncWaitHandle | 44 | public WaitHandle AsyncWaitHandle |
50 | { | 45 | { |
51 | get | 46 | get |
@@ -82,19 +77,18 @@ namespace OpenSim.Framework.Communications | |||
82 | get { return Thread.VolatileRead(ref m_completed) == 1; } | 77 | get { return Thread.VolatileRead(ref m_completed) == 1; } |
83 | } | 78 | } |
84 | 79 | ||
85 | |||
86 | #endregion | 80 | #endregion |
87 | 81 | ||
88 | |||
89 | #region class Methods | 82 | #region class Methods |
83 | |||
90 | internal void SetAsCompleted(bool completedSynchronously) | 84 | internal void SetAsCompleted(bool completedSynchronously) |
91 | { | 85 | { |
92 | m_completed = 1; | 86 | m_completed = 1; |
93 | if(completedSynchronously) | 87 | if (completedSynchronously) |
94 | m_completedSynchronously = 1; | 88 | m_completedSynchronously = 1; |
95 | else | 89 | else |
96 | m_completedSynchronously = 0; | 90 | m_completedSynchronously = 0; |
97 | 91 | ||
98 | SignalCompletion(); | 92 | SignalCompletion(); |
99 | } | 93 | } |
100 | 94 | ||
@@ -112,9 +106,9 @@ namespace OpenSim.Framework.Communications | |||
112 | 106 | ||
113 | private void SignalCompletion() | 107 | private void SignalCompletion() |
114 | { | 108 | { |
115 | if(m_waitHandle != null) m_waitHandle.Set(); | 109 | if (m_waitHandle != null) m_waitHandle.Set(); |
116 | 110 | ||
117 | if(m_callback != null) m_callback(this); | 111 | if (m_callback != null) m_callback(this); |
118 | } | 112 | } |
119 | 113 | ||
120 | public void EndInvoke() | 114 | public void EndInvoke() |
@@ -125,14 +119,14 @@ namespace OpenSim.Framework.Communications | |||
125 | // If the operation isn't done, wait for it | 119 | // If the operation isn't done, wait for it |
126 | AsyncWaitHandle.WaitOne(); | 120 | AsyncWaitHandle.WaitOne(); |
127 | AsyncWaitHandle.Close(); | 121 | AsyncWaitHandle.Close(); |
128 | m_waitHandle = null; // Allow early GC | 122 | m_waitHandle = null; // Allow early GC |
129 | } | 123 | } |
130 | 124 | ||
131 | // Operation is done: if an exception occured, throw it | 125 | // Operation is done: if an exception occured, throw it |
132 | if (m_exception != null) throw m_exception; | 126 | if (m_exception != null) throw m_exception; |
133 | } | 127 | } |
134 | 128 | ||
135 | #endregion | 129 | #endregion |
136 | } | 130 | } |
137 | 131 | ||
138 | internal class AsyncResult<T> : SimpleAsyncResult | 132 | internal class AsyncResult<T> : SimpleAsyncResult |
@@ -140,10 +134,12 @@ namespace OpenSim.Framework.Communications | |||
140 | private T m_result = default(T); | 134 | private T m_result = default(T); |
141 | 135 | ||
142 | public AsyncResult(AsyncCallback asyncCallback, Object state) : | 136 | public AsyncResult(AsyncCallback asyncCallback, Object state) : |
143 | base(asyncCallback, state) { } | 137 | base(asyncCallback, state) |
138 | { | ||
139 | } | ||
144 | 140 | ||
145 | 141 | ||
146 | public void SetAsCompleted(T result, bool completedSynchronously) | 142 | public void SetAsCompleted(T result, bool completedSynchronously) |
147 | { | 143 | { |
148 | // Save the asynchronous operation's result | 144 | // Save the asynchronous operation's result |
149 | m_result = result; | 145 | m_result = result; |
@@ -153,11 +149,10 @@ namespace OpenSim.Framework.Communications | |||
153 | base.SetAsCompleted(completedSynchronously); | 149 | base.SetAsCompleted(completedSynchronously); |
154 | } | 150 | } |
155 | 151 | ||
156 | new public T EndInvoke() | 152 | public new T EndInvoke() |
157 | { | 153 | { |
158 | base.EndInvoke(); | 154 | base.EndInvoke(); |
159 | return m_result; | 155 | return m_result; |
160 | } | 156 | } |
161 | |||
162 | } | 157 | } |
163 | } | 158 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs index 392669f..ac3a287 100644 --- a/OpenSim/Framework/Communications/RestClient/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs | |||
@@ -1,12 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
2 | using System.IO; | 3 | using System.IO; |
3 | using System.Net; | 4 | using System.Net; |
4 | using System.Web; | ||
5 | using System.Text; | 5 | using System.Text; |
6 | using System.Collections.Generic; | ||
7 | using System.Threading; | 6 | using System.Threading; |
8 | 7 | using System.Web; | |
9 | using OpenSim.Framework.Console; | ||
10 | 8 | ||
11 | namespace OpenSim.Framework.Communications | 9 | namespace OpenSim.Framework.Communications |
12 | { | 10 | { |
@@ -29,9 +27,10 @@ namespace OpenSim.Framework.Communications | |||
29 | /// </remarks> | 27 | /// </remarks> |
30 | public class RestClient | 28 | public class RestClient |
31 | { | 29 | { |
30 | private string realuri; | ||
32 | 31 | ||
33 | string realuri; | ||
34 | #region member variables | 32 | #region member variables |
33 | |||
35 | /// <summary> | 34 | /// <summary> |
36 | /// The base Uri of the web-service e.g. http://www.google.com | 35 | /// The base Uri of the web-service e.g. http://www.google.com |
37 | /// </summary> | 36 | /// </summary> |
@@ -60,7 +59,7 @@ namespace OpenSim.Framework.Communications | |||
60 | /// <summary> | 59 | /// <summary> |
61 | /// MemoryStream representing the resultiong resource | 60 | /// MemoryStream representing the resultiong resource |
62 | /// </summary> | 61 | /// </summary> |
63 | Stream _resource; | 62 | private Stream _resource; |
64 | 63 | ||
65 | /// <summary> | 64 | /// <summary> |
66 | /// WebRequest object, held as a member variable | 65 | /// WebRequest object, held as a member variable |
@@ -80,12 +79,12 @@ namespace OpenSim.Framework.Communications | |||
80 | /// <summary> | 79 | /// <summary> |
81 | /// Default time out period | 80 | /// Default time out period |
82 | /// </summary> | 81 | /// </summary> |
83 | const int DefaultTimeout = 10 * 1000; // 10 seconds timeout | 82 | private const int DefaultTimeout = 10*1000; // 10 seconds timeout |
84 | 83 | ||
85 | /// <summary> | 84 | /// <summary> |
86 | /// Default Buffer size of a block requested from the web-server | 85 | /// Default Buffer size of a block requested from the web-server |
87 | /// </summary> | 86 | /// </summary> |
88 | const int BufferSize = 4096; // Read blocks of 4 KB. | 87 | private const int BufferSize = 4096; // Read blocks of 4 KB. |
89 | 88 | ||
90 | 89 | ||
91 | /// <summary> | 90 | /// <summary> |
@@ -97,6 +96,7 @@ namespace OpenSim.Framework.Communications | |||
97 | #endregion member variables | 96 | #endregion member variables |
98 | 97 | ||
99 | #region constructors | 98 | #region constructors |
99 | |||
100 | /// <summary> | 100 | /// <summary> |
101 | /// Instantiate a new RestClient | 101 | /// Instantiate a new RestClient |
102 | /// </summary> | 102 | /// </summary> |
@@ -111,7 +111,8 @@ namespace OpenSim.Framework.Communications | |||
111 | _lock = new object(); | 111 | _lock = new object(); |
112 | } | 112 | } |
113 | 113 | ||
114 | object _lock; | 114 | private object _lock; |
115 | |||
115 | #endregion constructors | 116 | #endregion constructors |
116 | 117 | ||
117 | /// <summary> | 118 | /// <summary> |
@@ -120,8 +121,8 @@ namespace OpenSim.Framework.Communications | |||
120 | /// <param name="element">path entry</param> | 121 | /// <param name="element">path entry</param> |
121 | public void AddResourcePath(string element) | 122 | public void AddResourcePath(string element) |
122 | { | 123 | { |
123 | if(isSlashed(element)) | 124 | if (isSlashed(element)) |
124 | _pathElements.Add(element.Substring(0, element.Length-1)); | 125 | _pathElements.Add(element.Substring(0, element.Length - 1)); |
125 | else | 126 | else |
126 | _pathElements.Add(element); | 127 | _pathElements.Add(element); |
127 | } | 128 | } |
@@ -178,7 +179,7 @@ namespace OpenSim.Framework.Communications | |||
178 | /// Build a Uri based on the intial Url, path elements and parameters | 179 | /// Build a Uri based on the intial Url, path elements and parameters |
179 | /// </summary> | 180 | /// </summary> |
180 | /// <returns>fully constructed Uri</returns> | 181 | /// <returns>fully constructed Uri</returns> |
181 | Uri buildUri() | 182 | private Uri buildUri() |
182 | { | 183 | { |
183 | StringBuilder sb = new StringBuilder(); | 184 | StringBuilder sb = new StringBuilder(); |
184 | sb.Append(_url); | 185 | sb.Append(_url); |
@@ -196,7 +197,8 @@ namespace OpenSim.Framework.Communications | |||
196 | { | 197 | { |
197 | sb.Append("?"); | 198 | sb.Append("?"); |
198 | firstElement = false; | 199 | firstElement = false; |
199 | } else | 200 | } |
201 | else | ||
200 | sb.Append("&"); | 202 | sb.Append("&"); |
201 | 203 | ||
202 | sb.Append(kv.Key); | 204 | sb.Append(kv.Key); |
@@ -209,7 +211,9 @@ namespace OpenSim.Framework.Communications | |||
209 | realuri = sb.ToString(); | 211 | realuri = sb.ToString(); |
210 | return new Uri(sb.ToString()); | 212 | return new Uri(sb.ToString()); |
211 | } | 213 | } |
214 | |||
212 | #region Async communications with server | 215 | #region Async communications with server |
216 | |||
213 | /// <summary> | 217 | /// <summary> |
214 | /// Async method, invoked when a block of data has been received from the service | 218 | /// Async method, invoked when a block of data has been received from the service |
215 | /// </summary> | 219 | /// </summary> |
@@ -218,13 +222,14 @@ namespace OpenSim.Framework.Communications | |||
218 | { | 222 | { |
219 | try | 223 | try |
220 | { | 224 | { |
221 | Stream s = (Stream)ar.AsyncState; | 225 | Stream s = (Stream) ar.AsyncState; |
222 | int read = s.EndRead(ar); | 226 | int read = s.EndRead(ar); |
223 | 227 | ||
224 | if (read > 0) | 228 | if (read > 0) |
225 | { | 229 | { |
226 | _resource.Write(_readbuf, 0, read); | 230 | _resource.Write(_readbuf, 0, read); |
227 | IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | 231 | IAsyncResult asynchronousResult = |
232 | s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | ||
228 | 233 | ||
229 | // TODO! Implement timeout, without killing the server | 234 | // TODO! Implement timeout, without killing the server |
230 | //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); | 235 | //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); |
@@ -251,12 +256,13 @@ namespace OpenSim.Framework.Communications | |||
251 | try | 256 | try |
252 | { | 257 | { |
253 | // grab response | 258 | // grab response |
254 | WebRequest wr = (WebRequest)ar.AsyncState; | 259 | WebRequest wr = (WebRequest) ar.AsyncState; |
255 | _response = (HttpWebResponse)wr.EndGetResponse(ar); | 260 | _response = (HttpWebResponse) wr.EndGetResponse(ar); |
256 | 261 | ||
257 | // get response stream, and setup async reading | 262 | // get response stream, and setup async reading |
258 | Stream s = _response.GetResponseStream(); | 263 | Stream s = _response.GetResponseStream(); |
259 | IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | 264 | IAsyncResult asynchronousResult = |
265 | s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | ||
260 | 266 | ||
261 | // TODO! Implement timeout, without killing the server | 267 | // TODO! Implement timeout, without killing the server |
262 | // wait until completed, or we timed out | 268 | // wait until completed, or we timed out |
@@ -281,6 +287,7 @@ namespace OpenSim.Framework.Communications | |||
281 | } | 287 | } |
282 | } | 288 | } |
283 | } | 289 | } |
290 | |||
284 | #endregion Async communications with server | 291 | #endregion Async communications with server |
285 | 292 | ||
286 | /// <summary> | 293 | /// <summary> |
@@ -290,17 +297,17 @@ namespace OpenSim.Framework.Communications | |||
290 | { | 297 | { |
291 | lock (_lock) | 298 | lock (_lock) |
292 | { | 299 | { |
293 | _request = (HttpWebRequest)WebRequest.Create(buildUri()); | 300 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); |
294 | _request.KeepAlive = false; | 301 | _request.KeepAlive = false; |
295 | _request.ContentType = "application/xml"; | 302 | _request.ContentType = "application/xml"; |
296 | _request.Timeout = 200000; | 303 | _request.Timeout = 200000; |
297 | _asyncException = null; | 304 | _asyncException = null; |
298 | 305 | ||
299 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | 306 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); |
300 | _response = (HttpWebResponse)_request.GetResponse(); | 307 | _response = (HttpWebResponse) _request.GetResponse(); |
301 | Stream src = _response.GetResponseStream(); | 308 | Stream src = _response.GetResponseStream(); |
302 | int length = src.Read(_readbuf, 0, BufferSize); | 309 | int length = src.Read(_readbuf, 0, BufferSize); |
303 | while(length > 0) | 310 | while (length > 0) |
304 | { | 311 | { |
305 | _resource.Write(_readbuf, 0, length); | 312 | _resource.Write(_readbuf, 0, length); |
306 | length = src.Read(_readbuf, 0, BufferSize); | 313 | length = src.Read(_readbuf, 0, BufferSize); |
@@ -329,7 +336,7 @@ namespace OpenSim.Framework.Communications | |||
329 | 336 | ||
330 | public Stream Request(Stream src) | 337 | public Stream Request(Stream src) |
331 | { | 338 | { |
332 | _request = (HttpWebRequest)WebRequest.Create(buildUri()); | 339 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); |
333 | _request.KeepAlive = false; | 340 | _request.KeepAlive = false; |
334 | _request.ContentType = "application/xml"; | 341 | _request.ContentType = "application/xml"; |
335 | _request.Timeout = 900000; | 342 | _request.Timeout = 900000; |
@@ -340,13 +347,13 @@ namespace OpenSim.Framework.Communications | |||
340 | src.Seek(0, SeekOrigin.Begin); | 347 | src.Seek(0, SeekOrigin.Begin); |
341 | Stream dst = _request.GetRequestStream(); | 348 | Stream dst = _request.GetRequestStream(); |
342 | byte[] buf = new byte[1024]; | 349 | byte[] buf = new byte[1024]; |
343 | int length = src.Read(buf,0, 1024); | 350 | int length = src.Read(buf, 0, 1024); |
344 | while (length > 0) | 351 | while (length > 0) |
345 | { | 352 | { |
346 | dst.Write(buf, 0, length); | 353 | dst.Write(buf, 0, length); |
347 | length = src.Read(buf, 0, 1024); | 354 | length = src.Read(buf, 0, 1024); |
348 | } | 355 | } |
349 | _response = (HttpWebResponse)_request.GetResponse(); | 356 | _response = (HttpWebResponse) _request.GetResponse(); |
350 | 357 | ||
351 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | 358 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); |
352 | 359 | ||
@@ -357,8 +364,8 @@ namespace OpenSim.Framework.Communications | |||
357 | return null; | 364 | return null; |
358 | } | 365 | } |
359 | 366 | ||
360 | |||
361 | #region Async Invocation | 367 | #region Async Invocation |
368 | |||
362 | public IAsyncResult BeginRequest(AsyncCallback callback, object state) | 369 | public IAsyncResult BeginRequest(AsyncCallback callback, object state) |
363 | { | 370 | { |
364 | /// <summary> | 371 | /// <summary> |
@@ -371,7 +378,7 @@ namespace OpenSim.Framework.Communications | |||
371 | 378 | ||
372 | public Stream EndRequest(IAsyncResult asyncResult) | 379 | public Stream EndRequest(IAsyncResult asyncResult) |
373 | { | 380 | { |
374 | AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; | 381 | AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult; |
375 | 382 | ||
376 | // Wait for operation to complete, then return result or | 383 | // Wait for operation to complete, then return result or |
377 | // throw exception | 384 | // throw exception |
@@ -381,7 +388,7 @@ namespace OpenSim.Framework.Communications | |||
381 | private void RequestHelper(Object asyncResult) | 388 | private void RequestHelper(Object asyncResult) |
382 | { | 389 | { |
383 | // We know that it's really an AsyncResult<DateTime> object | 390 | // We know that it's really an AsyncResult<DateTime> object |
384 | AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; | 391 | AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult; |
385 | try | 392 | try |
386 | { | 393 | { |
387 | // Perform the operation; if sucessful set the result | 394 | // Perform the operation; if sucessful set the result |
@@ -394,6 +401,7 @@ namespace OpenSim.Framework.Communications | |||
394 | ar.HandleException(e, false); | 401 | ar.HandleException(e, false); |
395 | } | 402 | } |
396 | } | 403 | } |
404 | |||
397 | #endregion Async Invocation | 405 | #endregion Async Invocation |
398 | } | 406 | } |
399 | } | 407 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 006c8ee..cdc3baf 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -33,18 +33,15 @@ using System.Reflection; | |||
33 | using System.Security.Cryptography; | 33 | using System.Security.Cryptography; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Data; | ||
39 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
40 | 38 | ||
41 | |||
42 | namespace OpenSim.Framework.UserManagement | 39 | namespace OpenSim.Framework.UserManagement |
43 | { | 40 | { |
44 | public abstract class UserManagerBase : IUserService | 41 | public abstract class UserManagerBase : IUserService |
45 | { | 42 | { |
46 | public UserConfig _config; | 43 | public UserConfig _config; |
47 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | 44 | private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); |
48 | 45 | ||
49 | /// <summary> | 46 | /// <summary> |
50 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 47 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. |
@@ -78,11 +75,12 @@ namespace OpenSim.Framework.UserManagement | |||
78 | public void AddPlugin(IUserData plug) | 75 | public void AddPlugin(IUserData plug) |
79 | { | 76 | { |
80 | plug.Initialise(); | 77 | plug.Initialise(); |
81 | this._plugins.Add(plug.getName(), plug); | 78 | _plugins.Add(plug.getName(), plug); |
82 | MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); | 79 | MainLog.Instance.Verbose("Userstorage: Added IUserData Interface"); |
83 | } | 80 | } |
84 | 81 | ||
85 | #region Get UserProfile | 82 | #region Get UserProfile |
83 | |||
86 | /// <summary> | 84 | /// <summary> |
87 | /// Loads a user profile from a database by UUID | 85 | /// Loads a user profile from a database by UUID |
88 | /// </summary> | 86 | /// </summary> |
@@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement | |||
100 | } | 98 | } |
101 | catch (Exception e) | 99 | catch (Exception e) |
102 | { | 100 | { |
103 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 101 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
104 | } | 102 | } |
105 | } | 103 | } |
106 | 104 | ||
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.UserManagement | |||
126 | catch (Exception e) | 124 | catch (Exception e) |
127 | { | 125 | { |
128 | System.Console.WriteLine("EEK!"); | 126 | System.Console.WriteLine("EEK!"); |
129 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 127 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
130 | } | 128 | } |
131 | } | 129 | } |
132 | 130 | ||
@@ -145,7 +143,7 @@ namespace OpenSim.Framework.UserManagement | |||
145 | { | 143 | { |
146 | try | 144 | try |
147 | { | 145 | { |
148 | UserProfileData profile = plugin.Value.GetUserByName(fname,lname); | 146 | UserProfileData profile = plugin.Value.GetUserByName(fname, lname); |
149 | 147 | ||
150 | profile.currentAgent = getUserAgent(profile.UUID); | 148 | profile.currentAgent = getUserAgent(profile.UUID); |
151 | 149 | ||
@@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement | |||
153 | } | 151 | } |
154 | catch (Exception e) | 152 | catch (Exception e) |
155 | { | 153 | { |
156 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 154 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
157 | } | 155 | } |
158 | } | 156 | } |
159 | 157 | ||
@@ -170,20 +168,24 @@ namespace OpenSim.Framework.UserManagement | |||
170 | { | 168 | { |
171 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 169 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
172 | { | 170 | { |
173 | try { | 171 | try |
172 | { | ||
174 | plugin.Value.UpdateUserProfile(data); | 173 | plugin.Value.UpdateUserProfile(data); |
175 | return true; | 174 | return true; |
176 | } catch (Exception e) { | 175 | } |
177 | MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); | 176 | catch (Exception e) |
177 | { | ||
178 | MainLog.Instance.Verbose("Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
178 | } | 179 | } |
179 | } | 180 | } |
180 | 181 | ||
181 | return false; | 182 | return false; |
182 | } | 183 | } |
183 | 184 | ||
184 | #endregion | 185 | #endregion |
185 | 186 | ||
186 | #region Get UserAgent | 187 | #region Get UserAgent |
188 | |||
187 | /// <summary> | 189 | /// <summary> |
188 | /// Loads a user agent by uuid (not called directly) | 190 | /// Loads a user agent by uuid (not called directly) |
189 | /// </summary> | 191 | /// </summary> |
@@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement | |||
199 | } | 201 | } |
200 | catch (Exception e) | 202 | catch (Exception e) |
201 | { | 203 | { |
202 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 204 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
203 | } | 205 | } |
204 | } | 206 | } |
205 | 207 | ||
@@ -221,7 +223,7 @@ namespace OpenSim.Framework.UserManagement | |||
221 | } | 223 | } |
222 | catch (Exception e) | 224 | catch (Exception e) |
223 | { | 225 | { |
224 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 226 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
225 | } | 227 | } |
226 | } | 228 | } |
227 | 229 | ||
@@ -249,11 +251,11 @@ namespace OpenSim.Framework.UserManagement | |||
249 | { | 251 | { |
250 | try | 252 | try |
251 | { | 253 | { |
252 | return plugin.Value.GetAgentByName(fname,lname); | 254 | return plugin.Value.GetAgentByName(fname, lname); |
253 | } | 255 | } |
254 | catch (Exception e) | 256 | catch (Exception e) |
255 | { | 257 | { |
256 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 258 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
257 | } | 259 | } |
258 | } | 260 | } |
259 | 261 | ||
@@ -263,6 +265,7 @@ namespace OpenSim.Framework.UserManagement | |||
263 | #endregion | 265 | #endregion |
264 | 266 | ||
265 | #region CreateAgent | 267 | #region CreateAgent |
268 | |||
266 | /// <summary> | 269 | /// <summary> |
267 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB | 270 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB |
268 | /// </summary> | 271 | /// </summary> |
@@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement | |||
270 | /// <param name="request">The users loginrequest</param> | 273 | /// <param name="request">The users loginrequest</param> |
271 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 274 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
272 | { | 275 | { |
273 | Hashtable requestData = (Hashtable)request.Params[0]; | 276 | Hashtable requestData = (Hashtable) request.Params[0]; |
274 | 277 | ||
275 | UserAgentData agent = new UserAgentData(); | 278 | UserAgentData agent = new UserAgentData(); |
276 | 279 | ||
@@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement | |||
297 | // If user specified additional start, use that | 300 | // If user specified additional start, use that |
298 | if (requestData.ContainsKey("start")) | 301 | if (requestData.ContainsKey("start")) |
299 | { | 302 | { |
300 | string startLoc = ((string)requestData["start"]).Trim(); | 303 | string startLoc = ((string) requestData["start"]).Trim(); |
301 | if (!(startLoc == "last" || startLoc == "home")) | 304 | if (!(startLoc == "last" || startLoc == "home")) |
302 | { | 305 | { |
303 | // Format: uri:Ahern&162&213&34 | 306 | // Format: uri:Ahern&162&213&34 |
@@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement | |||
312 | } | 315 | } |
313 | catch (Exception) | 316 | catch (Exception) |
314 | { | 317 | { |
315 | |||
316 | } | 318 | } |
317 | } | 319 | } |
318 | } | 320 | } |
@@ -323,7 +325,7 @@ namespace OpenSim.Framework.UserManagement | |||
323 | 325 | ||
324 | // Current location | 326 | // Current location |
325 | agent.regionID = new LLUUID(); // Fill in later | 327 | agent.regionID = new LLUUID(); // Fill in later |
326 | agent.currentRegion = new LLUUID(); // Fill in later | 328 | agent.currentRegion = new LLUUID(); // Fill in later |
327 | 329 | ||
328 | profile.currentAgent = agent; | 330 | profile.currentAgent = agent; |
329 | } | 331 | } |
@@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement | |||
364 | try | 366 | try |
365 | { | 367 | { |
366 | plugin.Value.AddNewUserProfile(user); | 368 | plugin.Value.AddNewUserProfile(user); |
367 | |||
368 | } | 369 | } |
369 | catch (Exception e) | 370 | catch (Exception e) |
370 | { | 371 | { |
@@ -376,4 +377,4 @@ namespace OpenSim.Framework.UserManagement | |||
376 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName); | 377 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName); |
377 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); | 378 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); |
378 | } | 379 | } |
379 | } | 380 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index efe6ebb..0d48683 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -26,21 +26,18 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.IO; | 29 | using System.IO; |
30 | using System.Net; | ||
33 | using System.Text; | 31 | using System.Text; |
34 | 32 | using OpenSim.Framework.Console; | |
35 | using OpenSim.Framework; | ||
36 | 33 | ||
37 | namespace OpenSim.Framework.Configuration.HTTP | 34 | namespace OpenSim.Framework.Configuration.HTTP |
38 | { | 35 | { |
39 | public class HTTPConfiguration : IGenericConfig | 36 | public class HTTPConfiguration : IGenericConfig |
40 | { | 37 | { |
41 | RemoteConfigSettings remoteConfigSettings; | 38 | private RemoteConfigSettings remoteConfigSettings; |
42 | 39 | ||
43 | XmlConfiguration xmlConfig; | 40 | private XmlConfiguration xmlConfig; |
44 | 41 | ||
45 | private string configFileName = ""; | 42 | private string configFileName = ""; |
46 | 43 | ||
@@ -62,8 +59,9 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
62 | StringBuilder sb = new StringBuilder(); | 59 | StringBuilder sb = new StringBuilder(); |
63 | 60 | ||
64 | byte[] buf = new byte[8192]; | 61 | byte[] buf = new byte[8192]; |
65 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); | 62 | HttpWebRequest request = |
66 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | 63 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); |
64 | HttpWebResponse response = (HttpWebResponse) request.GetResponse(); | ||
67 | 65 | ||
68 | Stream resStream = response.GetResponseStream(); | 66 | Stream resStream = response.GetResponseStream(); |
69 | 67 | ||
@@ -78,13 +76,14 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
78 | tempString = Encoding.ASCII.GetString(buf, 0, count); | 76 | tempString = Encoding.ASCII.GetString(buf, 0, count); |
79 | sb.Append(tempString); | 77 | sb.Append(tempString); |
80 | } | 78 | } |
81 | } | 79 | } while (count > 0); |
82 | while (count > 0); | ||
83 | LoadDataFromString(sb.ToString()); | 80 | LoadDataFromString(sb.ToString()); |
84 | } | 81 | } |
85 | catch (WebException) | 82 | catch (WebException) |
86 | { | 83 | { |
87 | Console.MainLog.Instance.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); | 84 | MainLog.Instance.Warn("Unable to connect to remote configuration file (" + |
85 | remoteConfigSettings.baseConfigURL + configFileName + | ||
86 | "). Creating local file instead."); | ||
88 | xmlConfig.SetFileName(configFileName); | 87 | xmlConfig.SetFileName(configFileName); |
89 | xmlConfig.LoadData(); | 88 | xmlConfig.LoadData(); |
90 | } | 89 | } |
@@ -93,7 +92,6 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
93 | public void LoadDataFromString(string data) | 92 | public void LoadDataFromString(string data) |
94 | { | 93 | { |
95 | xmlConfig.LoadDataFromString(data); | 94 | xmlConfig.LoadDataFromString(data); |
96 | |||
97 | } | 95 | } |
98 | 96 | ||
99 | public string GetAttribute(string attributeName) | 97 | public string GetAttribute(string attributeName) |
@@ -114,4 +112,4 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
114 | { | 112 | { |
115 | } | 113 | } |
116 | } | 114 | } |
117 | } | 115 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs b/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs index 3ac03bb..332066c 100644 --- a/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs +++ b/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs | |||
@@ -26,12 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | |||
35 | namespace OpenSim.Framework.Configuration.HTTP | 29 | namespace OpenSim.Framework.Configuration.HTTP |
36 | { | 30 | { |
37 | public class RemoteConfigSettings | 31 | public class RemoteConfigSettings |
@@ -39,24 +33,30 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
39 | private ConfigurationMember configMember; | 33 | private ConfigurationMember configMember; |
40 | 34 | ||
41 | public string baseConfigURL = ""; | 35 | public string baseConfigURL = ""; |
36 | |||
42 | public RemoteConfigSettings(string filename) | 37 | public RemoteConfigSettings(string filename) |
43 | { | 38 | { |
44 | configMember = new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions, handleIncomingConfiguration); | 39 | configMember = |
40 | new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions, | ||
41 | handleIncomingConfiguration); | ||
45 | configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll"); | 42 | configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll"); |
46 | configMember.performConfigurationRetrieve(); | 43 | configMember.performConfigurationRetrieve(); |
47 | } | 44 | } |
48 | 45 | ||
49 | public void loadConfigurationOptions() | 46 | public void loadConfigurationOptions() |
50 | { | 47 | { |
51 | configMember.addConfigurationOption("base_config_url", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "URL Containing Configuration Files", "http://localhost/", false); | 48 | configMember.addConfigurationOption("base_config_url", |
49 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
50 | "URL Containing Configuration Files", "http://localhost/", false); | ||
52 | } | 51 | } |
52 | |||
53 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 53 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
54 | { | 54 | { |
55 | if (configuration_key == "base_config_url") | 55 | if (configuration_key == "base_config_url") |
56 | { | 56 | { |
57 | baseConfigURL = (string)configuration_result; | 57 | baseConfigURL = (string) configuration_result; |
58 | } | 58 | } |
59 | return true; | 59 | return true; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index 52db852..152dec5 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs | |||
@@ -25,12 +25,11 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
29 | using System.IO; | 30 | using System.IO; |
30 | using System.Xml; | 31 | using System.Xml; |
31 | 32 | ||
32 | using OpenSim.Framework; | ||
33 | |||
34 | namespace OpenSim.Framework.Configuration | 33 | namespace OpenSim.Framework.Configuration |
35 | { | 34 | { |
36 | public class XmlConfiguration : IGenericConfig | 35 | public class XmlConfiguration : IGenericConfig |
@@ -56,6 +55,7 @@ namespace OpenSim.Framework.Configuration | |||
56 | if (configNode.Name != "Config") | 55 | if (configNode.Name != "Config") |
57 | throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); | 56 | throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); |
58 | } | 57 | } |
58 | |||
59 | public void LoadData() | 59 | public void LoadData() |
60 | { | 60 | { |
61 | lock (this) | 61 | lock (this) |
@@ -81,7 +81,7 @@ namespace OpenSim.Framework.Configuration | |||
81 | 81 | ||
82 | if (createdFile) | 82 | if (createdFile) |
83 | { | 83 | { |
84 | this.Commit(); | 84 | Commit(); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
@@ -93,12 +93,13 @@ namespace OpenSim.Framework.Configuration | |||
93 | 93 | ||
94 | LoadDataToClass(); | 94 | LoadDataToClass(); |
95 | } | 95 | } |
96 | |||
96 | public string GetAttribute(string attributeName) | 97 | public string GetAttribute(string attributeName) |
97 | { | 98 | { |
98 | string result = null; | 99 | string result = null; |
99 | if (configNode.Attributes[attributeName] != null) | 100 | if (configNode.Attributes[attributeName] != null) |
100 | { | 101 | { |
101 | result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; | 102 | result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value; |
102 | } | 103 | } |
103 | return result; | 104 | return result; |
104 | } | 105 | } |
@@ -107,7 +108,7 @@ namespace OpenSim.Framework.Configuration | |||
107 | { | 108 | { |
108 | if (configNode.Attributes[attributeName] != null) | 109 | if (configNode.Attributes[attributeName] != null) |
109 | { | 110 | { |
110 | ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; | 111 | ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; |
111 | } | 112 | } |
112 | else | 113 | else |
113 | { | 114 | { |
@@ -124,7 +125,7 @@ namespace OpenSim.Framework.Configuration | |||
124 | if (!Directory.Exists(Util.configDir())) | 125 | if (!Directory.Exists(Util.configDir())) |
125 | { | 126 | { |
126 | Directory.CreateDirectory(Util.configDir()); | 127 | Directory.CreateDirectory(Util.configDir()); |
127 | } | 128 | } |
128 | doc.Save(fileName); | 129 | doc.Save(fileName); |
129 | } | 130 | } |
130 | 131 | ||
@@ -134,6 +135,5 @@ namespace OpenSim.Framework.Configuration | |||
134 | rootNode = null; | 135 | rootNode = null; |
135 | doc = null; | 136 | doc = null; |
136 | } | 137 | } |
137 | |||
138 | } | 138 | } |
139 | } | 139 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs index 7e7c77a..bfad5b7 100644 --- a/OpenSim/Framework/Console/AssemblyInfo.cs +++ b/OpenSim/Framework/Console/AssemblyInfo.cs | |||
@@ -27,24 +27,26 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // Information about this assembly is defined by the following | 31 | // Information about this assembly is defined by the following |
31 | // attributes. | 32 | // attributes. |
32 | // | 33 | // |
33 | // change them to the information which is associated with the assembly | 34 | // change them to the information which is associated with the assembly |
34 | // you compile. | 35 | // you compile. |
35 | 36 | ||
36 | [assembly: AssemblyTitle("ServerConsole")] | 37 | [assembly : AssemblyTitle("ServerConsole")] |
37 | [assembly: AssemblyDescription("")] | 38 | [assembly : AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 39 | [assembly : AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 40 | [assembly : AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("ServerConsole")] | 41 | [assembly : AssemblyProduct("ServerConsole")] |
41 | [assembly: AssemblyCopyright("")] | 42 | [assembly : AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 43 | [assembly : AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 44 | [assembly : AssemblyCulture("")] |
44 | 45 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 46 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 48 | |
49 | [assembly : ComVisible(false)] | ||
48 | 50 | ||
49 | // The assembly version has following format : | 51 | // The assembly version has following format : |
50 | // | 52 | // |
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices; | |||
53 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
55 | 57 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 58 | [assembly : AssemblyVersion("1.0.*")] \ No newline at end of file |
diff --git a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs index e079202..8eea702 100644 --- a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs +++ b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs | |||
@@ -26,10 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Framework.Console | 28 | namespace OpenSim.Framework.Console |
29 | { | 29 | { |
30 | public interface conscmd_callback | 30 | public interface conscmd_callback |
31 | { | 31 | { |
32 | void RunCmd(string cmd, string[] cmdparams); | 32 | void RunCmd(string cmd, string[] cmdparams); |
33 | void Show(string ShowWhat); | 33 | void Show(string ShowWhat); |
34 | } | 34 | } |
35 | } | 35 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index c976e2c..6651e5d 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs | |||
@@ -26,10 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Diagnostics; | ||
29 | using System.IO; | 31 | using System.IO; |
30 | using System.Net; | 32 | using System.Net; |
31 | using System.Diagnostics; | ||
32 | using System.Collections.Generic; | ||
33 | 33 | ||
34 | namespace OpenSim.Framework.Console | 34 | namespace OpenSim.Framework.Console |
35 | { | 35 | { |
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console | |||
48 | { | 48 | { |
49 | private object m_syncRoot = new object(); | 49 | private object m_syncRoot = new object(); |
50 | 50 | ||
51 | StreamWriter Log; | 51 | private StreamWriter Log; |
52 | public conscmd_callback cmdparser; | 52 | public conscmd_callback cmdparser; |
53 | public string componentname; | 53 | public string componentname; |
54 | private bool m_verbose; | 54 | private bool m_verbose; |
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Console | |||
57 | { | 57 | { |
58 | this.componentname = componentname; | 58 | this.componentname = componentname; |
59 | this.cmdparser = cmdparser; | 59 | this.cmdparser = cmdparser; |
60 | this.m_verbose = verbose; | 60 | m_verbose = verbose; |
61 | System.Console.WriteLine("Creating new local console"); | 61 | System.Console.WriteLine("Creating new local console"); |
62 | 62 | ||
63 | if (String.IsNullOrEmpty(LogFile)) | 63 | if (String.IsNullOrEmpty(LogFile)) |
@@ -87,8 +87,8 @@ namespace OpenSim.Framework.Console | |||
87 | /// <returns>an ansii color</returns> | 87 | /// <returns>an ansii color</returns> |
88 | private ConsoleColor DeriveColor(string input) | 88 | private ConsoleColor DeriveColor(string input) |
89 | { | 89 | { |
90 | int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; | 90 | int colIdx = (input.ToUpper().GetHashCode()%6) + 9; |
91 | return (ConsoleColor)colIdx; | 91 | return (ConsoleColor) colIdx; |
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
@@ -236,7 +236,7 @@ namespace OpenSim.Framework.Console | |||
236 | { | 236 | { |
237 | lock (m_syncRoot) | 237 | lock (m_syncRoot) |
238 | { | 238 | { |
239 | string now = System.DateTime.Now.ToString("[MM-dd hh:mm:ss] "); | 239 | string now = DateTime.Now.ToString("[MM-dd hh:mm:ss] "); |
240 | Log.Write(now); | 240 | Log.Write(now); |
241 | Log.WriteLine(format, args); | 241 | Log.WriteLine(format, args); |
242 | Log.Flush(); | 242 | Log.Flush(); |
@@ -306,7 +306,7 @@ namespace OpenSim.Framework.Console | |||
306 | public int Read() | 306 | public int Read() |
307 | { | 307 | { |
308 | int TempInt = System.Console.Read(); | 308 | int TempInt = System.Console.Read(); |
309 | Log.Write((char)TempInt); | 309 | Log.Write((char) TempInt); |
310 | return TempInt; | 310 | return TempInt; |
311 | } | 311 | } |
312 | 312 | ||
@@ -359,7 +359,7 @@ namespace OpenSim.Framework.Console | |||
359 | { | 359 | { |
360 | // FIXME: Needs to be better abstracted | 360 | // FIXME: Needs to be better abstracted |
361 | Log.WriteLine(prompt); | 361 | Log.WriteLine(prompt); |
362 | this.Notice(prompt); | 362 | Notice(prompt); |
363 | ConsoleColor oldfg = System.Console.ForegroundColor; | 363 | ConsoleColor oldfg = System.Console.ForegroundColor; |
364 | System.Console.ForegroundColor = System.Console.BackgroundColor; | 364 | System.Console.ForegroundColor = System.Console.BackgroundColor; |
365 | string temp = System.Console.ReadLine(); | 365 | string temp = System.Console.ReadLine(); |
@@ -370,8 +370,8 @@ namespace OpenSim.Framework.Console | |||
370 | // Displays a command prompt and waits for the user to enter a string, then returns that string | 370 | // Displays a command prompt and waits for the user to enter a string, then returns that string |
371 | public string CmdPrompt(string prompt) | 371 | public string CmdPrompt(string prompt) |
372 | { | 372 | { |
373 | this.Notice(String.Format("{0}: ", prompt)); | 373 | Notice(String.Format("{0}: ", prompt)); |
374 | return this.ReadLine(); | 374 | return ReadLine(); |
375 | } | 375 | } |
376 | 376 | ||
377 | // Displays a command prompt and returns a default value if the user simply presses enter | 377 | // Displays a command prompt and returns a default value if the user simply presses enter |
@@ -423,8 +423,7 @@ namespace OpenSim.Framework.Console | |||
423 | 423 | ||
424 | public void MainLogPrompt() | 424 | public void MainLogPrompt() |
425 | { | 425 | { |
426 | 426 | string tempstr = CmdPrompt(componentname + "# "); | |
427 | string tempstr = this.CmdPrompt(this.componentname + "# "); | ||
428 | MainLogRunCommand(tempstr); | 427 | MainLogRunCommand(tempstr); |
429 | } | 428 | } |
430 | 429 | ||
@@ -436,7 +435,7 @@ namespace OpenSim.Framework.Console | |||
436 | Array.Reverse(tempstrarray); | 435 | Array.Reverse(tempstrarray); |
437 | Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); | 436 | Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); |
438 | Array.Reverse(tempstrarray); | 437 | Array.Reverse(tempstrarray); |
439 | string[] cmdparams = (string[])tempstrarray; | 438 | string[] cmdparams = (string[]) tempstrarray; |
440 | try | 439 | try |
441 | { | 440 | { |
442 | RunCmd(cmd, cmdparams); | 441 | RunCmd(cmd, cmdparams); |
@@ -454,7 +453,7 @@ namespace OpenSim.Framework.Console | |||
454 | string result = String.Empty; | 453 | string result = String.Empty; |
455 | 454 | ||
456 | string stacktrace = Environment.StackTrace; | 455 | string stacktrace = Environment.StackTrace; |
457 | List<string> lines = new List<string>(stacktrace.Split(new string[] { "at " }, StringSplitOptions.None)); | 456 | List<string> lines = new List<string>(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None)); |
458 | 457 | ||
459 | if (lines.Count > 4) | 458 | if (lines.Count > 4) |
460 | { | 459 | { |
@@ -481,4 +480,4 @@ namespace OpenSim.Framework.Console | |||
481 | } | 480 | } |
482 | } | 481 | } |
483 | } | 482 | } |
484 | } | 483 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Console/MainLog.cs b/OpenSim/Framework/Console/MainLog.cs index 5c1a257..adf566c 100644 --- a/OpenSim/Framework/Console/MainLog.cs +++ b/OpenSim/Framework/Console/MainLog.cs | |||
@@ -27,15 +27,14 @@ | |||
27 | */ | 27 | */ |
28 | namespace OpenSim.Framework.Console | 28 | namespace OpenSim.Framework.Console |
29 | { | 29 | { |
30 | public class MainLog { | 30 | public class MainLog |
31 | 31 | { | |
32 | private static LogBase instance; | 32 | private static LogBase instance; |
33 | 33 | ||
34 | public static LogBase Instance | 34 | public static LogBase Instance |
35 | { | 35 | { |
36 | get { return instance; } | 36 | get { return instance; } |
37 | set { instance = value; } | 37 | set { instance = value; } |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | } \ No newline at end of file | |
41 | } | ||
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index bc7225a..a96d9bd 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs | |||
@@ -34,18 +34,19 @@ namespace OpenSim.Framework.Data.DB4o | |||
34 | /// <summary> | 34 | /// <summary> |
35 | /// A grid server storage mechanism employing the DB4o database system | 35 | /// A grid server storage mechanism employing the DB4o database system |
36 | /// </summary> | 36 | /// </summary> |
37 | class DB4oGridData : IGridData | 37 | internal class DB4oGridData : IGridData |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// The database manager object | 40 | /// The database manager object |
41 | /// </summary> | 41 | /// </summary> |
42 | DB4oGridManager manager; | 42 | private DB4oGridManager manager; |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Called when the plugin is first loaded (as constructors are not called) | 45 | /// Called when the plugin is first loaded (as constructors are not called) |
46 | /// </summary> | 46 | /// </summary> |
47 | public void Initialise() { | 47 | public void Initialise() |
48 | manager = new DB4oGridManager("gridserver.yap"); | 48 | { |
49 | manager = new DB4oGridManager("gridserver.yap"); | ||
49 | } | 50 | } |
50 | 51 | ||
51 | /// <summary> | 52 | /// <summary> |
@@ -93,7 +94,8 @@ namespace OpenSim.Framework.Data.DB4o | |||
93 | if (manager.simProfiles.ContainsKey(uuid)) | 94 | if (manager.simProfiles.ContainsKey(uuid)) |
94 | return manager.simProfiles[uuid]; | 95 | return manager.simProfiles[uuid]; |
95 | } | 96 | } |
96 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); | 97 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + |
98 | "). Total Registered Regions: " + manager.simProfiles.Count); | ||
97 | } | 99 | } |
98 | 100 | ||
99 | /// <summary> | 101 | /// <summary> |
@@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o | |||
123 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | 125 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> |
124 | /// <param name="key">The shared secret</param> | 126 | /// <param name="key">The shared secret</param> |
125 | /// <returns>Authenticated?</returns> | 127 | /// <returns>Authenticated?</returns> |
126 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | 128 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) |
129 | { | ||
127 | if (manager.simProfiles[uuid].regionRecvKey == key) | 130 | if (manager.simProfiles[uuid].regionRecvKey == key) |
128 | return true; | 131 | return true; |
129 | return false; | 132 | return false; |
@@ -160,4 +163,4 @@ namespace OpenSim.Framework.Data.DB4o | |||
160 | return null; | 163 | return null; |
161 | } | 164 | } |
162 | } | 165 | } |
163 | } | 166 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 9e8a03f..033413a 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs | |||
@@ -29,23 +29,23 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Db4objects.Db4o; | 30 | using Db4objects.Db4o; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework; | ||
33 | 32 | ||
34 | namespace OpenSim.Framework.Data.DB4o | 33 | namespace OpenSim.Framework.Data.DB4o |
35 | { | 34 | { |
36 | /// <summary> | 35 | /// <summary> |
37 | /// A Database manager for Db4o | 36 | /// A Database manager for Db4o |
38 | /// </summary> | 37 | /// </summary> |
39 | class DB4oGridManager | 38 | internal class DB4oGridManager |
40 | { | 39 | { |
41 | /// <summary> | 40 | /// <summary> |
42 | /// A list of the current regions connected (in-memory cache) | 41 | /// A list of the current regions connected (in-memory cache) |
43 | /// </summary> | 42 | /// </summary> |
44 | public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); | 43 | public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); |
44 | |||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Database File Name | 46 | /// Database File Name |
47 | /// </summary> | 47 | /// </summary> |
48 | string dbfl; | 48 | private string dbfl; |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Creates a new grid storage manager | 51 | /// Creates a new grid storage manager |
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
56 | dbfl = db4odb; | 56 | dbfl = db4odb; |
57 | IObjectContainer database; | 57 | IObjectContainer database; |
58 | database = Db4oFactory.OpenFile(dbfl); | 58 | database = Db4oFactory.OpenFile(dbfl); |
59 | IObjectSet result = database.Get(typeof(RegionProfileData)); | 59 | IObjectSet result = database.Get(typeof (RegionProfileData)); |
60 | // Loads the file into the in-memory cache | 60 | // Loads the file into the in-memory cache |
61 | foreach (RegionProfileData row in result) | 61 | foreach (RegionProfileData row in result) |
62 | { | 62 | { |
@@ -94,23 +94,22 @@ namespace OpenSim.Framework.Data.DB4o | |||
94 | return false; | 94 | return false; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | |||
98 | |||
99 | } | 97 | } |
100 | 98 | ||
101 | /// <summary> | 99 | /// <summary> |
102 | /// A manager for the DB4o database (user profiles) | 100 | /// A manager for the DB4o database (user profiles) |
103 | /// </summary> | 101 | /// </summary> |
104 | class DB4oUserManager | 102 | internal class DB4oUserManager |
105 | { | 103 | { |
106 | /// <summary> | 104 | /// <summary> |
107 | /// A list of the user profiles (in memory cache) | 105 | /// A list of the user profiles (in memory cache) |
108 | /// </summary> | 106 | /// </summary> |
109 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); | 107 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); |
108 | |||
110 | /// <summary> | 109 | /// <summary> |
111 | /// Database filename | 110 | /// Database filename |
112 | /// </summary> | 111 | /// </summary> |
113 | string dbfl; | 112 | private string dbfl; |
114 | 113 | ||
115 | /// <summary> | 114 | /// <summary> |
116 | /// Initialises a new DB manager | 115 | /// Initialises a new DB manager |
@@ -122,7 +121,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
122 | IObjectContainer database; | 121 | IObjectContainer database; |
123 | database = Db4oFactory.OpenFile(dbfl); | 122 | database = Db4oFactory.OpenFile(dbfl); |
124 | // Load to cache | 123 | // Load to cache |
125 | IObjectSet result = database.Get(typeof(UserProfileData)); | 124 | IObjectSet result = database.Get(typeof (UserProfileData)); |
126 | foreach (UserProfileData row in result) | 125 | foreach (UserProfileData row in result) |
127 | { | 126 | { |
128 | if (userProfiles.ContainsKey(row.UUID)) | 127 | if (userProfiles.ContainsKey(row.UUID)) |
@@ -144,7 +143,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
144 | /// <param name="record">The profile to update</param> | 143 | /// <param name="record">The profile to update</param> |
145 | /// <returns>true on success, false on fail to persist to db</returns> | 144 | /// <returns>true on success, false on fail to persist to db</returns> |
146 | public bool UpdateRecord(UserProfileData record) | 145 | public bool UpdateRecord(UserProfileData record) |
147 | { | 146 | { |
148 | if (userProfiles.ContainsKey(record.UUID)) | 147 | if (userProfiles.ContainsKey(record.UUID)) |
149 | { | 148 | { |
150 | userProfiles[record.UUID] = record; | 149 | userProfiles[record.UUID] = record; |
@@ -168,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o | |||
168 | } | 167 | } |
169 | } | 168 | } |
170 | } | 169 | } |
171 | } | 170 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index b00fd02..c7113bf 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs | |||
@@ -28,8 +28,6 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework; | ||
33 | 31 | ||
34 | namespace OpenSim.Framework.Data.DB4o | 32 | namespace OpenSim.Framework.Data.DB4o |
35 | { | 33 | { |
@@ -41,14 +39,14 @@ namespace OpenSim.Framework.Data.DB4o | |||
41 | /// <summary> | 39 | /// <summary> |
42 | /// The database manager | 40 | /// The database manager |
43 | /// </summary> | 41 | /// </summary> |
44 | DB4oUserManager manager; | 42 | private DB4oUserManager manager; |
45 | 43 | ||
46 | /// <summary> | 44 | /// <summary> |
47 | /// Artificial constructor called upon plugin load | 45 | /// Artificial constructor called upon plugin load |
48 | /// </summary> | 46 | /// </summary> |
49 | public void Initialise() | 47 | public void Initialise() |
50 | { | 48 | { |
51 | manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); | 49 | manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap")); |
52 | } | 50 | } |
53 | 51 | ||
54 | /// <summary> | 52 | /// <summary> |
@@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
58 | /// <returns>A user profile</returns> | 56 | /// <returns>A user profile</returns> |
59 | public UserProfileData GetUserByUUID(LLUUID uuid) | 57 | public UserProfileData GetUserByUUID(LLUUID uuid) |
60 | { | 58 | { |
61 | if(manager.userProfiles.ContainsKey(uuid)) | 59 | if (manager.userProfiles.ContainsKey(uuid)) |
62 | return manager.userProfiles[uuid]; | 60 | return manager.userProfiles[uuid]; |
63 | return null; | 61 | return null; |
64 | } | 62 | } |
@@ -95,7 +93,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
95 | /// <param name="uuid">The users account ID</param> | 93 | /// <param name="uuid">The users account ID</param> |
96 | /// <returns>A matching users profile</returns> | 94 | /// <returns>A matching users profile</returns> |
97 | public UserAgentData GetAgentByUUID(LLUUID uuid) | 95 | public UserAgentData GetAgentByUUID(LLUUID uuid) |
98 | { | 96 | { |
99 | try | 97 | try |
100 | { | 98 | { |
101 | return GetUserByUUID(uuid).currentAgent; | 99 | return GetUserByUUID(uuid).currentAgent; |
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
126 | { | 124 | { |
127 | try | 125 | try |
128 | { | 126 | { |
129 | return GetUserByName(fname,lname).currentAgent; | 127 | return GetUserByName(fname, lname).currentAgent; |
130 | } | 128 | } |
131 | catch (Exception) | 129 | catch (Exception) |
132 | { | 130 | { |
@@ -149,7 +147,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
149 | Console.WriteLine(e.ToString()); | 147 | Console.WriteLine(e.ToString()); |
150 | } | 148 | } |
151 | } | 149 | } |
152 | 150 | ||
153 | /// <summary> | 151 | /// <summary> |
154 | /// Creates a new user profile | 152 | /// Creates a new user profile |
155 | /// </summary> | 153 | /// </summary> |
@@ -157,15 +155,17 @@ namespace OpenSim.Framework.Data.DB4o | |||
157 | /// <returns>True on success, false on error</returns> | 155 | /// <returns>True on success, false on error</returns> |
158 | public bool UpdateUserProfile(UserProfileData user) | 156 | public bool UpdateUserProfile(UserProfileData user) |
159 | { | 157 | { |
160 | try { | 158 | try |
159 | { | ||
161 | return manager.UpdateRecord(user); | 160 | return manager.UpdateRecord(user); |
162 | } catch (Exception e) { | 161 | } |
162 | catch (Exception e) | ||
163 | { | ||
163 | Console.WriteLine(e.ToString()); | 164 | Console.WriteLine(e.ToString()); |
164 | return false; | 165 | return false; |
165 | } | 166 | } |
166 | } | 167 | } |
167 | 168 | ||
168 | |||
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// Creates a new user agent | 171 | /// Creates a new user agent |
@@ -219,4 +219,4 @@ namespace OpenSim.Framework.Data.DB4o | |||
219 | return "0.1"; | 219 | return "0.1"; |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs index 52d09fa..6183b6e 100644 --- a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | 24 | |
25 | [assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index e628882..1946790 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | |||
@@ -185,10 +185,10 @@ namespace OpenSim.Framework.Data.MSSQL | |||
185 | byte[] hash = HashProvider.ComputeHash(stream); | 185 | byte[] hash = HashProvider.ComputeHash(stream); |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | |||
188 | public ReservationData GetReservationAtPoint(uint x, uint y) | 189 | public ReservationData GetReservationAtPoint(uint x, uint y) |
189 | { | 190 | { |
190 | return null; | 191 | return null; |
191 | } | 192 | } |
192 | } | 193 | } |
193 | 194 | } \ No newline at end of file | |
194 | } | ||
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 77d29f7..c0b2edf 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | |||
@@ -36,12 +36,12 @@ namespace OpenSim.Framework.Data.MSSQL | |||
36 | /// <summary> | 36 | /// <summary> |
37 | /// A management class for the MS SQL Storage Engine | 37 | /// A management class for the MS SQL Storage Engine |
38 | /// </summary> | 38 | /// </summary> |
39 | class MSSqlManager | 39 | internal class MSSqlManager |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// The database connection object | 42 | /// The database connection object |
43 | /// </summary> | 43 | /// </summary> |
44 | IDbConnection dbcon; | 44 | private IDbConnection dbcon; |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Initialises and creates a new Sql connection and maintains it. | 47 | /// Initialises and creates a new Sql connection and maintains it. |
@@ -55,7 +55,8 @@ namespace OpenSim.Framework.Data.MSSQL | |||
55 | { | 55 | { |
56 | try | 56 | try |
57 | { | 57 | { |
58 | string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | 58 | string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + |
59 | ";Password=" + password + ";Pooling=" + cpooling + ";"; | ||
59 | dbcon = new SqlConnection(connectionString); | 60 | dbcon = new SqlConnection(connectionString); |
60 | 61 | ||
61 | dbcon.Open(); | 62 | dbcon.Open(); |
@@ -83,14 +84,14 @@ namespace OpenSim.Framework.Data.MSSQL | |||
83 | /// <returns>A Sql DB Command</returns> | 84 | /// <returns>A Sql DB Command</returns> |
84 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 85 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) |
85 | { | 86 | { |
86 | SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); | 87 | SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand(); |
87 | dbcommand.CommandText = sql; | 88 | dbcommand.CommandText = sql; |
88 | foreach (KeyValuePair<string, string> param in parameters) | 89 | foreach (KeyValuePair<string, string> param in parameters) |
89 | { | 90 | { |
90 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 91 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
91 | } | 92 | } |
92 | 93 | ||
93 | return (IDbCommand)dbcommand; | 94 | return (IDbCommand) dbcommand; |
94 | } | 95 | } |
95 | 96 | ||
96 | /// <summary> | 97 | /// <summary> |
@@ -105,42 +106,42 @@ namespace OpenSim.Framework.Data.MSSQL | |||
105 | if (reader.Read()) | 106 | if (reader.Read()) |
106 | { | 107 | { |
107 | // Region Main | 108 | // Region Main |
108 | regionprofile.regionHandle = (ulong)reader["regionHandle"]; | 109 | regionprofile.regionHandle = (ulong) reader["regionHandle"]; |
109 | regionprofile.regionName = (string)reader["regionName"]; | 110 | regionprofile.regionName = (string) reader["regionName"]; |
110 | regionprofile.UUID = new LLUUID((string)reader["uuid"]); | 111 | regionprofile.UUID = new LLUUID((string) reader["uuid"]); |
111 | 112 | ||
112 | // Secrets | 113 | // Secrets |
113 | regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; | 114 | regionprofile.regionRecvKey = (string) reader["regionRecvKey"]; |
114 | regionprofile.regionSecret = (string)reader["regionSecret"]; | 115 | regionprofile.regionSecret = (string) reader["regionSecret"]; |
115 | regionprofile.regionSendKey = (string)reader["regionSendKey"]; | 116 | regionprofile.regionSendKey = (string) reader["regionSendKey"]; |
116 | 117 | ||
117 | // Region Server | 118 | // Region Server |
118 | regionprofile.regionDataURI = (string)reader["regionDataURI"]; | 119 | regionprofile.regionDataURI = (string) reader["regionDataURI"]; |
119 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. | 120 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. |
120 | regionprofile.serverIP = (string)reader["serverIP"]; | 121 | regionprofile.serverIP = (string) reader["serverIP"]; |
121 | regionprofile.serverPort = (uint)reader["serverPort"]; | 122 | regionprofile.serverPort = (uint) reader["serverPort"]; |
122 | regionprofile.serverURI = (string)reader["serverURI"]; | 123 | regionprofile.serverURI = (string) reader["serverURI"]; |
123 | 124 | ||
124 | // Location | 125 | // Location |
125 | regionprofile.regionLocX = (uint)((int)reader["locX"]); | 126 | regionprofile.regionLocX = (uint) ((int) reader["locX"]); |
126 | regionprofile.regionLocY = (uint)((int)reader["locY"]); | 127 | regionprofile.regionLocY = (uint) ((int) reader["locY"]); |
127 | regionprofile.regionLocZ = (uint)((int)reader["locZ"]); | 128 | regionprofile.regionLocZ = (uint) ((int) reader["locZ"]); |
128 | 129 | ||
129 | // Neighbours - 0 = No Override | 130 | // Neighbours - 0 = No Override |
130 | regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | 131 | regionprofile.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"]; |
131 | regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | 132 | regionprofile.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"]; |
132 | regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | 133 | regionprofile.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"]; |
133 | regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | 134 | regionprofile.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"]; |
134 | 135 | ||
135 | // Assets | 136 | // Assets |
136 | regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; | 137 | regionprofile.regionAssetURI = (string) reader["regionAssetURI"]; |
137 | regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 138 | regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; |
138 | regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 139 | regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"]; |
139 | 140 | ||
140 | // Userserver | 141 | // Userserver |
141 | regionprofile.regionUserURI = (string)reader["regionUserURI"]; | 142 | regionprofile.regionUserURI = (string) reader["regionUserURI"]; |
142 | regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 143 | regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"]; |
143 | regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; | 144 | regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"]; |
144 | } | 145 | } |
145 | else | 146 | else |
146 | { | 147 | { |
@@ -156,12 +157,15 @@ namespace OpenSim.Framework.Data.MSSQL | |||
156 | /// <returns>Successful?</returns> | 157 | /// <returns>Successful?</returns> |
157 | public bool insertRow(RegionProfileData profile) | 158 | public bool insertRow(RegionProfileData profile) |
158 | { | 159 | { |
159 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 160 | string sql = |
160 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | 161 | "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
162 | sql += | ||
163 | "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
161 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | 164 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; |
162 | 165 | ||
163 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | 166 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; |
164 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | 167 | sql += |
168 | "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
165 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | 169 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; |
166 | 170 | ||
167 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 171 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
@@ -208,4 +212,4 @@ namespace OpenSim.Framework.Data.MSSQL | |||
208 | return returnval; | 212 | return returnval; |
209 | } | 213 | } |
210 | } | 214 | } |
211 | } | 215 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs index eeac06c..6846ecf 100644 --- a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Framework.Data.MSSQL")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Framework.Data.MSSQL")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] | 24 | |
25 | [assembly : Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index bf895c0..055cd92 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | |||
@@ -28,18 +28,17 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using MySql.Data.MySqlClient; | 31 | using System.Data; |
32 | |||
33 | using libsecondlife; | 32 | using libsecondlife; |
33 | using MySql.Data.MySqlClient; | ||
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework; | ||
37 | 35 | ||
38 | namespace OpenSim.Framework.Data.MySQL | 36 | namespace OpenSim.Framework.Data.MySQL |
39 | { | 37 | { |
40 | class MySQLAssetData : IAssetProvider | 38 | internal class MySQLAssetData : IAssetProvider |
41 | { | 39 | { |
42 | MySQLManager _dbConnection; | 40 | private MySQLManager _dbConnection; |
41 | |||
43 | #region IAssetProvider Members | 42 | #region IAssetProvider Members |
44 | 43 | ||
45 | private void UpgradeAssetsTable(string oldVersion) | 44 | private void UpgradeAssetsTable(string oldVersion) |
@@ -58,14 +57,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
58 | /// </summary> | 57 | /// </summary> |
59 | private void TestTables() | 58 | private void TestTables() |
60 | { | 59 | { |
61 | |||
62 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | 60 | Dictionary<string, string> tableList = new Dictionary<string, string>(); |
63 | 61 | ||
64 | tableList["assets"] = null; | 62 | tableList["assets"] = null; |
65 | _dbConnection.GetTableVersion(tableList); | 63 | _dbConnection.GetTableVersion(tableList); |
66 | 64 | ||
67 | UpgradeAssetsTable(tableList["assets"]); | 65 | UpgradeAssetsTable(tableList["assets"]); |
68 | |||
69 | } | 66 | } |
70 | 67 | ||
71 | public AssetBase FetchAsset(LLUUID assetID) | 68 | public AssetBase FetchAsset(LLUUID assetID) |
@@ -73,21 +70,24 @@ namespace OpenSim.Framework.Data.MySQL | |||
73 | AssetBase asset = null; | 70 | AssetBase asset = null; |
74 | lock (_dbConnection) | 71 | lock (_dbConnection) |
75 | { | 72 | { |
76 | MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection); | 73 | MySqlCommand cmd = |
74 | new MySqlCommand( | ||
75 | "SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", | ||
76 | _dbConnection.Connection); | ||
77 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); | 77 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); |
78 | p.Value = assetID.GetBytes(); | 78 | p.Value = assetID.GetBytes(); |
79 | using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) | 79 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
80 | { | 80 | { |
81 | if (dbReader.Read()) | 81 | if (dbReader.Read()) |
82 | { | 82 | { |
83 | asset = new AssetBase(); | 83 | asset = new AssetBase(); |
84 | asset.Data = (byte[])dbReader["data"]; | 84 | asset.Data = (byte[]) dbReader["data"]; |
85 | asset.Description = (string)dbReader["description"]; | 85 | asset.Description = (string) dbReader["description"]; |
86 | asset.FullID = assetID; | 86 | asset.FullID = assetID; |
87 | asset.InvType = (sbyte)dbReader["invType"]; | 87 | asset.InvType = (sbyte) dbReader["invType"]; |
88 | asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; | 88 | asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; |
89 | asset.Name = (string)dbReader["name"]; | 89 | asset.Name = (string) dbReader["name"]; |
90 | asset.Type = (sbyte)dbReader["assetType"]; | 90 | asset.Type = (sbyte) dbReader["assetType"]; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | } | 93 | } |
@@ -96,8 +96,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
96 | 96 | ||
97 | public void CreateAsset(AssetBase asset) | 97 | public void CreateAsset(AssetBase asset) |
98 | { | 98 | { |
99 | MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + | 99 | MySqlCommand cmd = |
100 | "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection); | 100 | new MySqlCommand( |
101 | "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + | ||
102 | "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", | ||
103 | _dbConnection.Connection); | ||
101 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); | 104 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); |
102 | p.Value = asset.FullID.GetBytes(); | 105 | p.Value = asset.FullID.GetBytes(); |
103 | cmd.Parameters.AddWithValue("?name", asset.Name); | 106 | cmd.Parameters.AddWithValue("?name", asset.Name); |
@@ -148,7 +151,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
148 | 151 | ||
149 | public string Version | 152 | public string Version |
150 | { | 153 | { |
151 | get { return _dbConnection.getVersion(); } | 154 | get { return _dbConnection.getVersion(); } |
152 | } | 155 | } |
153 | 156 | ||
154 | public string Name | 157 | public string Name |
@@ -158,4 +161,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
158 | 161 | ||
159 | #endregion | 162 | #endregion |
160 | } | 163 | } |
161 | } | 164 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 9876ab1..fdfc61c 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -25,13 +25,13 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Data; | 31 | using System.Data; |
31 | using System.Security.Cryptography; | 32 | using System.Security.Cryptography; |
32 | using System.Text; | 33 | using System.Text; |
33 | using libsecondlife; | 34 | using libsecondlife; |
34 | |||
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | 36 | ||
37 | namespace OpenSim.Framework.Data.MySQL | 37 | namespace OpenSim.Framework.Data.MySQL |
@@ -59,7 +59,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
59 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 59 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
60 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 60 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
61 | 61 | ||
62 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 62 | database = |
63 | new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, | ||
64 | settingPort); | ||
63 | } | 65 | } |
64 | 66 | ||
65 | /// <summary> | 67 | /// <summary> |
@@ -108,7 +110,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
108 | param["?xmax"] = xmax.ToString(); | 110 | param["?xmax"] = xmax.ToString(); |
109 | param["?ymax"] = ymax.ToString(); | 111 | param["?ymax"] = ymax.ToString(); |
110 | 112 | ||
111 | IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); | 113 | IDbCommand result = |
114 | database.Query( | ||
115 | "SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", | ||
116 | param); | ||
112 | IDataReader reader = result.ExecuteReader(); | 117 | IDataReader reader = result.ExecuteReader(); |
113 | 118 | ||
114 | RegionProfileData row; | 119 | RegionProfileData row; |
@@ -123,7 +128,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
123 | result.Dispose(); | 128 | result.Dispose(); |
124 | 129 | ||
125 | return rows.ToArray(); | 130 | return rows.ToArray(); |
126 | |||
127 | } | 131 | } |
128 | } | 132 | } |
129 | catch (Exception e) | 133 | catch (Exception e) |
@@ -266,7 +270,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
266 | Dictionary<string, string> param = new Dictionary<string, string>(); | 270 | Dictionary<string, string> param = new Dictionary<string, string>(); |
267 | param["?x"] = x.ToString(); | 271 | param["?x"] = x.ToString(); |
268 | param["?y"] = y.ToString(); | 272 | param["?y"] = y.ToString(); |
269 | IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); | 273 | IDbCommand result = |
274 | database.Query( | ||
275 | "SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", | ||
276 | param); | ||
270 | IDataReader reader = result.ExecuteReader(); | 277 | IDataReader reader = result.ExecuteReader(); |
271 | 278 | ||
272 | ReservationData row = database.readReservationRow(reader); | 279 | ReservationData row = database.readReservationRow(reader); |
@@ -284,6 +291,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
284 | } | 291 | } |
285 | } | 292 | } |
286 | } | 293 | } |
287 | 294 | } \ No newline at end of file | |
288 | |||
289 | } | ||
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index ded584e..f303a6b 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -26,13 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Data; | ||
31 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
32 | using libsecondlife; | 30 | using libsecondlife; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using MySql.Data.MySqlClient; | 31 | using MySql.Data.MySqlClient; |
32 | using OpenSim.Framework.Console; | ||
36 | 33 | ||
37 | namespace OpenSim.Framework.Data.MySQL | 34 | namespace OpenSim.Framework.Data.MySQL |
38 | { | 35 | { |
@@ -59,7 +56,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
59 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 56 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
60 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 57 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
61 | 58 | ||
62 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 59 | database = |
60 | new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, | ||
61 | settingPort); | ||
63 | TestTables(database.Connection); | 62 | TestTables(database.Connection); |
64 | } | 63 | } |
65 | 64 | ||
@@ -99,7 +98,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
99 | 98 | ||
100 | private void TestTables(MySqlConnection conn) | 99 | private void TestTables(MySqlConnection conn) |
101 | { | 100 | { |
102 | |||
103 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | 101 | Dictionary<string, string> tableList = new Dictionary<string, string>(); |
104 | 102 | ||
105 | tableList["inventoryfolders"] = null; | 103 | tableList["inventoryfolders"] = null; |
@@ -110,6 +108,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
110 | UpgradeFoldersTable(tableList["inventoryfolders"]); | 108 | UpgradeFoldersTable(tableList["inventoryfolders"]); |
111 | UpgradeItemsTable(tableList["inventoryitems"]); | 109 | UpgradeItemsTable(tableList["inventoryitems"]); |
112 | } | 110 | } |
111 | |||
113 | #endregion | 112 | #endregion |
114 | 113 | ||
115 | /// <summary> | 114 | /// <summary> |
@@ -151,11 +150,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
151 | { | 150 | { |
152 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 151 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
153 | 152 | ||
154 | MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", database.Connection); | 153 | MySqlCommand result = |
154 | new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", | ||
155 | database.Connection); | ||
155 | result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); | 156 | result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); |
156 | MySqlDataReader reader = result.ExecuteReader(); | 157 | MySqlDataReader reader = result.ExecuteReader(); |
157 | 158 | ||
158 | while(reader.Read()) | 159 | while (reader.Read()) |
159 | items.Add(readInventoryItem(reader)); | 160 | items.Add(readInventoryItem(reader)); |
160 | 161 | ||
161 | reader.Close(); | 162 | reader.Close(); |
@@ -183,13 +184,16 @@ namespace OpenSim.Framework.Data.MySQL | |||
183 | { | 184 | { |
184 | lock (database) | 185 | lock (database) |
185 | { | 186 | { |
186 | MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", database.Connection); | 187 | MySqlCommand result = |
188 | new MySqlCommand( | ||
189 | "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", | ||
190 | database.Connection); | ||
187 | result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); | 191 | result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); |
188 | result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); | 192 | result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); |
189 | MySqlDataReader reader = result.ExecuteReader(); | 193 | MySqlDataReader reader = result.ExecuteReader(); |
190 | 194 | ||
191 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 195 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
192 | while(reader.Read()) | 196 | while (reader.Read()) |
193 | items.Add(readInventoryFolder(reader)); | 197 | items.Add(readInventoryFolder(reader)); |
194 | 198 | ||
195 | 199 | ||
@@ -218,17 +222,21 @@ namespace OpenSim.Framework.Data.MySQL | |||
218 | { | 222 | { |
219 | lock (database) | 223 | lock (database) |
220 | { | 224 | { |
221 | MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", database.Connection); | 225 | MySqlCommand result = |
226 | new MySqlCommand( | ||
227 | "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", | ||
228 | database.Connection); | ||
222 | result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); | 229 | result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); |
223 | result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); | 230 | result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); |
224 | 231 | ||
225 | MySqlDataReader reader = result.ExecuteReader(); | 232 | MySqlDataReader reader = result.ExecuteReader(); |
226 | 233 | ||
227 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 234 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
228 | while(reader.Read()) | 235 | while (reader.Read()) |
229 | items.Add(readInventoryFolder(reader)); | 236 | items.Add(readInventoryFolder(reader)); |
230 | 237 | ||
231 | InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). | 238 | InventoryFolderBase rootFolder = items[0]; |
239 | //should only be one folder with parent set to zero (the root one). | ||
232 | reader.Close(); | 240 | reader.Close(); |
233 | result.Dispose(); | 241 | result.Dispose(); |
234 | 242 | ||
@@ -254,13 +262,15 @@ namespace OpenSim.Framework.Data.MySQL | |||
254 | { | 262 | { |
255 | lock (database) | 263 | lock (database) |
256 | { | 264 | { |
257 | MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", database.Connection); | 265 | MySqlCommand result = |
266 | new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", | ||
267 | database.Connection); | ||
258 | result.Parameters.AddWithValue("?uuid", parentID.ToStringHyphenated()); | 268 | result.Parameters.AddWithValue("?uuid", parentID.ToStringHyphenated()); |
259 | MySqlDataReader reader = result.ExecuteReader(); | 269 | MySqlDataReader reader = result.ExecuteReader(); |
260 | 270 | ||
261 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 271 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
262 | 272 | ||
263 | while(reader.Read()) | 273 | while (reader.Read()) |
264 | items.Add(readInventoryFolder(reader)); | 274 | items.Add(readInventoryFolder(reader)); |
265 | 275 | ||
266 | reader.Close(); | 276 | reader.Close(); |
@@ -288,19 +298,19 @@ namespace OpenSim.Framework.Data.MySQL | |||
288 | { | 298 | { |
289 | InventoryItemBase item = new InventoryItemBase(); | 299 | InventoryItemBase item = new InventoryItemBase(); |
290 | 300 | ||
291 | item.inventoryID = new LLUUID((string)reader["inventoryID"]); | 301 | item.inventoryID = new LLUUID((string) reader["inventoryID"]); |
292 | item.assetID = new LLUUID((string)reader["assetID"]); | 302 | item.assetID = new LLUUID((string) reader["assetID"]); |
293 | item.assetType = (int)reader["assetType"]; | 303 | item.assetType = (int) reader["assetType"]; |
294 | item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); | 304 | item.parentFolderID = new LLUUID((string) reader["parentFolderID"]); |
295 | item.avatarID = new LLUUID((string)reader["avatarID"]); | 305 | item.avatarID = new LLUUID((string) reader["avatarID"]); |
296 | item.inventoryName = (string)reader["inventoryName"]; | 306 | item.inventoryName = (string) reader["inventoryName"]; |
297 | item.inventoryDescription = (string)reader["inventoryDescription"]; | 307 | item.inventoryDescription = (string) reader["inventoryDescription"]; |
298 | item.inventoryNextPermissions = (uint)reader["inventoryNextPermissions"]; | 308 | item.inventoryNextPermissions = (uint) reader["inventoryNextPermissions"]; |
299 | item.inventoryCurrentPermissions = (uint)reader["inventoryCurrentPermissions"]; | 309 | item.inventoryCurrentPermissions = (uint) reader["inventoryCurrentPermissions"]; |
300 | item.invType = (int)reader["invType"]; | 310 | item.invType = (int) reader["invType"]; |
301 | item.creatorsID = new LLUUID((string)reader["creatorID"]); | 311 | item.creatorsID = new LLUUID((string) reader["creatorID"]); |
302 | item.inventoryBasePermissions = (uint)reader["inventoryBasePermissions"]; | 312 | item.inventoryBasePermissions = (uint) reader["inventoryBasePermissions"]; |
303 | item.inventoryEveryOnePermissions = (uint)reader["inventoryEveryOnePermissions"]; | 313 | item.inventoryEveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; |
304 | return item; | 314 | return item; |
305 | } | 315 | } |
306 | catch (MySqlException e) | 316 | catch (MySqlException e) |
@@ -324,12 +334,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
324 | { | 334 | { |
325 | Dictionary<string, string> param = new Dictionary<string, string>(); | 335 | Dictionary<string, string> param = new Dictionary<string, string>(); |
326 | 336 | ||
327 | MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); | 337 | MySqlCommand result = |
338 | new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); | ||
328 | result.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); | 339 | result.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); |
329 | MySqlDataReader reader = result.ExecuteReader(); | 340 | MySqlDataReader reader = result.ExecuteReader(); |
330 | 341 | ||
331 | InventoryItemBase item = null; | 342 | InventoryItemBase item = null; |
332 | if(reader.Read()) | 343 | if (reader.Read()) |
333 | item = readInventoryItem(reader); | 344 | item = readInventoryItem(reader); |
334 | 345 | ||
335 | reader.Close(); | 346 | reader.Close(); |
@@ -356,12 +367,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
356 | try | 367 | try |
357 | { | 368 | { |
358 | InventoryFolderBase folder = new InventoryFolderBase(); | 369 | InventoryFolderBase folder = new InventoryFolderBase(); |
359 | folder.agentID = new LLUUID((string)reader["agentID"]); | 370 | folder.agentID = new LLUUID((string) reader["agentID"]); |
360 | folder.parentID = new LLUUID((string)reader["parentFolderID"]); | 371 | folder.parentID = new LLUUID((string) reader["parentFolderID"]); |
361 | folder.folderID = new LLUUID((string)reader["folderID"]); | 372 | folder.folderID = new LLUUID((string) reader["folderID"]); |
362 | folder.name = (string)reader["folderName"]; | 373 | folder.name = (string) reader["folderName"]; |
363 | folder.type = (short)reader["type"]; | 374 | folder.type = (short) reader["type"]; |
364 | folder.version = (ushort)((int)reader["version"]); | 375 | folder.version = (ushort) ((int) reader["version"]); |
365 | return folder; | 376 | return folder; |
366 | } | 377 | } |
367 | catch (Exception e) | 378 | catch (Exception e) |
@@ -384,7 +395,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
384 | { | 395 | { |
385 | lock (database) | 396 | lock (database) |
386 | { | 397 | { |
387 | MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection); | 398 | MySqlCommand result = |
399 | new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection); | ||
388 | result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); | 400 | result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); |
389 | MySqlDataReader reader = result.ExecuteReader(); | 401 | MySqlDataReader reader = result.ExecuteReader(); |
390 | 402 | ||
@@ -410,8 +422,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
410 | /// <param name="item">The inventory item</param> | 422 | /// <param name="item">The inventory item</param> |
411 | public void addInventoryItem(InventoryItemBase item) | 423 | public void addInventoryItem(InventoryItemBase item) |
412 | { | 424 | { |
413 | string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; | 425 | string sql = |
414 | sql += "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; | 426 | "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; |
427 | sql += | ||
428 | "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; | ||
415 | 429 | ||
416 | try | 430 | try |
417 | { | 431 | { |
@@ -424,7 +438,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
424 | result.Parameters.AddWithValue("?inventoryName", item.inventoryName); | 438 | result.Parameters.AddWithValue("?inventoryName", item.inventoryName); |
425 | result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription); | 439 | result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription); |
426 | result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString()); | 440 | result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString()); |
427 | result.Parameters.AddWithValue("?inventoryCurrentPermissions", item.inventoryCurrentPermissions.ToString()); | 441 | result.Parameters.AddWithValue("?inventoryCurrentPermissions", |
442 | item.inventoryCurrentPermissions.ToString()); | ||
428 | result.Parameters.AddWithValue("?invType", item.invType); | 443 | result.Parameters.AddWithValue("?invType", item.invType); |
429 | result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToStringHyphenated()); | 444 | result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToStringHyphenated()); |
430 | result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions); | 445 | result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions); |
@@ -455,7 +470,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
455 | { | 470 | { |
456 | try | 471 | try |
457 | { | 472 | { |
458 | MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); | 473 | MySqlCommand cmd = |
474 | new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); | ||
459 | cmd.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); | 475 | cmd.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); |
460 | cmd.ExecuteNonQuery(); | 476 | cmd.ExecuteNonQuery(); |
461 | } | 477 | } |
@@ -472,7 +488,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
472 | /// <param name="folder">Folder to create</param> | 488 | /// <param name="folder">Folder to create</param> |
473 | public void addInventoryFolder(InventoryFolderBase folder) | 489 | public void addInventoryFolder(InventoryFolderBase folder) |
474 | { | 490 | { |
475 | string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; | 491 | string sql = |
492 | "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; | ||
476 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; | 493 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; |
477 | 494 | ||
478 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); | 495 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); |
@@ -480,9 +497,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
480 | cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated()); | 497 | cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated()); |
481 | cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated()); | 498 | cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated()); |
482 | cmd.Parameters.AddWithValue("?folderName", folder.name); | 499 | cmd.Parameters.AddWithValue("?folderName", folder.name); |
483 | cmd.Parameters.AddWithValue("?type", (short)folder.type); | 500 | cmd.Parameters.AddWithValue("?type", (short) folder.type); |
484 | cmd.Parameters.AddWithValue("?version", folder.version); | 501 | cmd.Parameters.AddWithValue("?version", folder.version); |
485 | 502 | ||
486 | try | 503 | try |
487 | { | 504 | { |
488 | cmd.ExecuteNonQuery(); | 505 | cmd.ExecuteNonQuery(); |
@@ -515,7 +532,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
515 | foreach (InventoryFolderBase f in subfolderList) | 532 | foreach (InventoryFolderBase f in subfolderList) |
516 | folders.Add(f); | 533 | folders.Add(f); |
517 | } | 534 | } |
518 | 535 | ||
519 | /// <summary> | 536 | /// <summary> |
520 | /// Returns all child folders in the hierarchy from the parent folder and down | 537 | /// Returns all child folders in the hierarchy from the parent folder and down |
521 | /// </summary> | 538 | /// </summary> |
@@ -536,7 +553,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
536 | { | 553 | { |
537 | try | 554 | try |
538 | { | 555 | { |
539 | MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); | 556 | MySqlCommand cmd = |
557 | new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); | ||
540 | cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); | 558 | cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); |
541 | cmd.ExecuteNonQuery(); | 559 | cmd.ExecuteNonQuery(); |
542 | } | 560 | } |
@@ -551,7 +569,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
551 | { | 569 | { |
552 | try | 570 | try |
553 | { | 571 | { |
554 | MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); | 572 | MySqlCommand cmd = |
573 | new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); | ||
555 | cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); | 574 | cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); |
556 | cmd.ExecuteNonQuery(); | 575 | cmd.ExecuteNonQuery(); |
557 | } | 576 | } |
@@ -586,4 +605,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
586 | } | 605 | } |
587 | } | 606 | } |
588 | } | 607 | } |
589 | } | 608 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs index bfb4b48..e8775a1 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs | |||
@@ -25,14 +25,12 @@ | |||
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; | ||
29 | |||
30 | namespace OpenSim.Framework.Data.MySQL | 28 | namespace OpenSim.Framework.Data.MySQL |
31 | { | 29 | { |
32 | /// <summary> | 30 | /// <summary> |
33 | /// An interface to the log database for MySQL | 31 | /// An interface to the log database for MySQL |
34 | /// </summary> | 32 | /// </summary> |
35 | class MySQLLogData : ILogData | 33 | internal class MySQLLogData : ILogData |
36 | { | 34 | { |
37 | /// <summary> | 35 | /// <summary> |
38 | /// The database manager | 36 | /// The database manager |
@@ -52,7 +50,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
52 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 50 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
53 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 51 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
54 | 52 | ||
55 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 53 | database = |
54 | new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, | ||
55 | settingPort); | ||
56 | } | 56 | } |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
@@ -64,7 +64,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
64 | /// <param name="arguments">The arguments passed to the method</param> | 64 | /// <param name="arguments">The arguments passed to the method</param> |
65 | /// <param name="priority">How critical is this?</param> | 65 | /// <param name="priority">How critical is this?</param> |
66 | /// <param name="logMessage">The message to log</param> | 66 | /// <param name="logMessage">The message to log</param> |
67 | public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | 67 | public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, |
68 | string logMessage) | ||
68 | { | 69 | { |
69 | try | 70 | try |
70 | { | 71 | { |
@@ -102,4 +103,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
102 | return "0.1"; | 103 | return "0.1"; |
103 | } | 104 | } |
104 | } | 105 | } |
105 | } | 106 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index 8fcf68b..778da06 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs | |||
@@ -25,16 +25,14 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
29 | using System.IO; | 30 | using System.Collections.Generic; |
30 | using System.Data; | 31 | using System.Data; |
32 | using System.IO; | ||
31 | using System.Reflection; | 33 | using System.Reflection; |
32 | using System.Collections.Generic; | ||
33 | using libsecondlife; | 34 | using libsecondlife; |
34 | |||
35 | using MySql.Data.MySqlClient; | 35 | using MySql.Data.MySqlClient; |
36 | |||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
39 | 37 | ||
40 | namespace OpenSim.Framework.Data.MySQL | 38 | namespace OpenSim.Framework.Data.MySQL |
@@ -42,16 +40,17 @@ namespace OpenSim.Framework.Data.MySQL | |||
42 | /// <summary> | 40 | /// <summary> |
43 | /// A MySQL Database manager | 41 | /// A MySQL Database manager |
44 | /// </summary> | 42 | /// </summary> |
45 | class MySQLManager | 43 | internal class MySQLManager |
46 | { | 44 | { |
47 | /// <summary> | 45 | /// <summary> |
48 | /// The database connection object | 46 | /// The database connection object |
49 | /// </summary> | 47 | /// </summary> |
50 | MySqlConnection dbcon; | 48 | private MySqlConnection dbcon; |
49 | |||
51 | /// <summary> | 50 | /// <summary> |
52 | /// Connection string for ADO.net | 51 | /// Connection string for ADO.net |
53 | /// </summary> | 52 | /// </summary> |
54 | string connectionString; | 53 | private string connectionString; |
55 | 54 | ||
56 | /// <summary> | 55 | /// <summary> |
57 | /// Initialises and creates a new MySQL connection and maintains it. | 56 | /// Initialises and creates a new MySQL connection and maintains it. |
@@ -61,11 +60,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
61 | /// <param name="username">The username logging into the database</param> | 60 | /// <param name="username">The username logging into the database</param> |
62 | /// <param name="password">The password for the user logging in</param> | 61 | /// <param name="password">The password for the user logging in</param> |
63 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | 62 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> |
64 | public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) | 63 | public MySQLManager(string hostname, string database, string username, string password, string cpooling, |
64 | string port) | ||
65 | { | 65 | { |
66 | try | 66 | try |
67 | { | 67 | { |
68 | connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | 68 | connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + |
69 | username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | ||
69 | dbcon = new MySqlConnection(connectionString); | 70 | dbcon = new MySqlConnection(connectionString); |
70 | 71 | ||
71 | dbcon.Open(); | 72 | dbcon.Open(); |
@@ -123,15 +124,17 @@ namespace OpenSim.Framework.Data.MySQL | |||
123 | /// <returns>A string containing the DB provider</returns> | 124 | /// <returns>A string containing the DB provider</returns> |
124 | public string getVersion() | 125 | public string getVersion() |
125 | { | 126 | { |
126 | System.Reflection.Module module = this.GetType().Module; | 127 | Module module = GetType().Module; |
127 | string dllName = module.Assembly.ManifestModule.Name; | 128 | string dllName = module.Assembly.ManifestModule.Name; |
128 | Version dllVersion = module.Assembly.GetName().Version; | 129 | Version dllVersion = module.Assembly.GetName().Version; |
129 | 130 | ||
130 | 131 | ||
131 | return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); | 132 | return |
133 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | ||
134 | dllVersion.Revision); | ||
132 | } | 135 | } |
133 | 136 | ||
134 | 137 | ||
135 | /// <summary> | 138 | /// <summary> |
136 | /// Extract a named string resource from the embedded resources | 139 | /// Extract a named string resource from the embedded resources |
137 | /// </summary> | 140 | /// </summary> |
@@ -139,7 +142,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
139 | /// <returns>string contained within the embedded resource</returns> | 142 | /// <returns>string contained within the embedded resource</returns> |
140 | private string getResourceString(string name) | 143 | private string getResourceString(string name) |
141 | { | 144 | { |
142 | Assembly assem = this.GetType().Assembly; | 145 | Assembly assem = GetType().Assembly; |
143 | string[] names = assem.GetManifestResourceNames(); | 146 | string[] names = assem.GetManifestResourceNames(); |
144 | 147 | ||
145 | foreach (string s in names) | 148 | foreach (string s in names) |
@@ -173,7 +176,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
173 | { | 176 | { |
174 | lock (dbcon) | 177 | lock (dbcon) |
175 | { | 178 | { |
176 | MySqlCommand tablesCmd = new MySqlCommand("SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", dbcon); | 179 | MySqlCommand tablesCmd = |
180 | new MySqlCommand( | ||
181 | "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", | ||
182 | dbcon); | ||
177 | tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); | 183 | tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); |
178 | using (MySqlDataReader tables = tablesCmd.ExecuteReader()) | 184 | using (MySqlDataReader tables = tablesCmd.ExecuteReader()) |
179 | { | 185 | { |
@@ -181,9 +187,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
181 | { | 187 | { |
182 | try | 188 | try |
183 | { | 189 | { |
184 | string tableName = (string)tables["TABLE_NAME"]; | 190 | string tableName = (string) tables["TABLE_NAME"]; |
185 | string comment = (string)tables["TABLE_COMMENT"]; | 191 | string comment = (string) tables["TABLE_COMMENT"]; |
186 | if(tableList.ContainsKey(tableName)) | 192 | if (tableList.ContainsKey(tableName)) |
187 | tableList[tableName] = comment; | 193 | tableList[tableName] = comment; |
188 | } | 194 | } |
189 | catch (Exception e) | 195 | catch (Exception e) |
@@ -198,7 +204,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
198 | 204 | ||
199 | 205 | ||
200 | // at some time this code should be cleaned up | 206 | // at some time this code should be cleaned up |
201 | 207 | ||
202 | /// <summary> | 208 | /// <summary> |
203 | /// Runs a query with protection against SQL Injection by using parameterised input. | 209 | /// Runs a query with protection against SQL Injection by using parameterised input. |
204 | /// </summary> | 210 | /// </summary> |
@@ -209,14 +215,14 @@ namespace OpenSim.Framework.Data.MySQL | |||
209 | { | 215 | { |
210 | try | 216 | try |
211 | { | 217 | { |
212 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | 218 | MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); |
213 | dbcommand.CommandText = sql; | 219 | dbcommand.CommandText = sql; |
214 | foreach (KeyValuePair<string, string> param in parameters) | 220 | foreach (KeyValuePair<string, string> param in parameters) |
215 | { | 221 | { |
216 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 222 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
217 | } | 223 | } |
218 | 224 | ||
219 | return (IDbCommand)dbcommand; | 225 | return (IDbCommand) dbcommand; |
220 | } | 226 | } |
221 | catch | 227 | catch |
222 | { | 228 | { |
@@ -227,7 +233,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
227 | { | 233 | { |
228 | dbcon.Close(); | 234 | dbcon.Close(); |
229 | } | 235 | } |
230 | catch { } | 236 | catch |
237 | { | ||
238 | } | ||
231 | 239 | ||
232 | // Try reopen it | 240 | // Try reopen it |
233 | try | 241 | try |
@@ -243,14 +251,14 @@ namespace OpenSim.Framework.Data.MySQL | |||
243 | // Run the query again | 251 | // Run the query again |
244 | try | 252 | try |
245 | { | 253 | { |
246 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | 254 | MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); |
247 | dbcommand.CommandText = sql; | 255 | dbcommand.CommandText = sql; |
248 | foreach (KeyValuePair<string, string> param in parameters) | 256 | foreach (KeyValuePair<string, string> param in parameters) |
249 | { | 257 | { |
250 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 258 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
251 | } | 259 | } |
252 | 260 | ||
253 | return (IDbCommand)dbcommand; | 261 | return (IDbCommand) dbcommand; |
254 | } | 262 | } |
255 | catch (Exception e) | 263 | catch (Exception e) |
256 | { | 264 | { |
@@ -275,20 +283,20 @@ namespace OpenSim.Framework.Data.MySQL | |||
275 | { | 283 | { |
276 | // Region Main | 284 | // Region Main |
277 | retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); | 285 | retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); |
278 | retval.regionName = (string)reader["regionName"]; | 286 | retval.regionName = (string) reader["regionName"]; |
279 | retval.UUID = new LLUUID((string)reader["uuid"]); | 287 | retval.UUID = new LLUUID((string) reader["uuid"]); |
280 | 288 | ||
281 | // Secrets | 289 | // Secrets |
282 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | 290 | retval.regionRecvKey = (string) reader["regionRecvKey"]; |
283 | retval.regionSecret = (string)reader["regionSecret"]; | 291 | retval.regionSecret = (string) reader["regionSecret"]; |
284 | retval.regionSendKey = (string)reader["regionSendKey"]; | 292 | retval.regionSendKey = (string) reader["regionSendKey"]; |
285 | 293 | ||
286 | // Region Server | 294 | // Region Server |
287 | retval.regionDataURI = (string)reader["regionDataURI"]; | 295 | retval.regionDataURI = (string) reader["regionDataURI"]; |
288 | retval.regionOnline = false; // Needs to be pinged before this can be set. | 296 | retval.regionOnline = false; // Needs to be pinged before this can be set. |
289 | retval.serverIP = (string)reader["serverIP"]; | 297 | retval.serverIP = (string) reader["serverIP"]; |
290 | retval.serverPort = (uint)reader["serverPort"]; | 298 | retval.serverPort = (uint) reader["serverPort"]; |
291 | retval.serverURI = (string)reader["serverURI"]; | 299 | retval.serverURI = (string) reader["serverURI"]; |
292 | retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); | 300 | retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); |
293 | retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); | 301 | retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); |
294 | 302 | ||
@@ -304,14 +312,14 @@ namespace OpenSim.Framework.Data.MySQL | |||
304 | retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); | 312 | retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); |
305 | 313 | ||
306 | // Assets | 314 | // Assets |
307 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | 315 | retval.regionAssetURI = (string) reader["regionAssetURI"]; |
308 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 316 | retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; |
309 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 317 | retval.regionAssetSendKey = (string) reader["regionAssetSendKey"]; |
310 | 318 | ||
311 | // Userserver | 319 | // Userserver |
312 | retval.regionUserURI = (string)reader["regionUserURI"]; | 320 | retval.regionUserURI = (string) reader["regionUserURI"]; |
313 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 321 | retval.regionUserRecvKey = (string) reader["regionUserRecvKey"]; |
314 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | 322 | retval.regionUserSendKey = (string) reader["regionUserSendKey"]; |
315 | 323 | ||
316 | // World Map Addition | 324 | // World Map Addition |
317 | string tempRegionMap = reader["regionMapTexture"].ToString(); | 325 | string tempRegionMap = reader["regionMapTexture"].ToString(); |
@@ -341,17 +349,16 @@ namespace OpenSim.Framework.Data.MySQL | |||
341 | ReservationData retval = new ReservationData(); | 349 | ReservationData retval = new ReservationData(); |
342 | if (reader.Read()) | 350 | if (reader.Read()) |
343 | { | 351 | { |
344 | retval.gridRecvKey = (string)reader["gridRecvKey"]; | 352 | retval.gridRecvKey = (string) reader["gridRecvKey"]; |
345 | retval.gridSendKey = (string)reader["gridSendKey"]; | 353 | retval.gridSendKey = (string) reader["gridSendKey"]; |
346 | retval.reservationCompany = (string)reader["resCompany"]; | 354 | retval.reservationCompany = (string) reader["resCompany"]; |
347 | retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); | 355 | retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); |
348 | retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); | 356 | retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); |
349 | retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); | 357 | retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); |
350 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); | 358 | retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); |
351 | retval.reservationName = (string)reader["resName"]; | 359 | retval.reservationName = (string) reader["resName"]; |
352 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; | 360 | retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; |
353 | retval.userUUID = new LLUUID((string)reader["userUUID"]); | 361 | retval.userUUID = new LLUUID((string) reader["userUUID"]); |
354 | |||
355 | } | 362 | } |
356 | else | 363 | else |
357 | { | 364 | { |
@@ -359,6 +366,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
359 | } | 366 | } |
360 | return retval; | 367 | return retval; |
361 | } | 368 | } |
369 | |||
362 | /// <summary> | 370 | /// <summary> |
363 | /// Reads an agent row from a database reader | 371 | /// Reads an agent row from a database reader |
364 | /// </summary> | 372 | /// </summary> |
@@ -371,12 +379,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
371 | if (reader.Read()) | 379 | if (reader.Read()) |
372 | { | 380 | { |
373 | // Agent IDs | 381 | // Agent IDs |
374 | retval.UUID = new LLUUID((string)reader["UUID"]); | 382 | retval.UUID = new LLUUID((string) reader["UUID"]); |
375 | retval.sessionID = new LLUUID((string)reader["sessionID"]); | 383 | retval.sessionID = new LLUUID((string) reader["sessionID"]); |
376 | retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); | 384 | retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]); |
377 | 385 | ||
378 | // Agent Who? | 386 | // Agent Who? |
379 | retval.agentIP = (string)reader["agentIP"]; | 387 | retval.agentIP = (string) reader["agentIP"]; |
380 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); | 388 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); |
381 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); | 389 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); |
382 | 390 | ||
@@ -385,9 +393,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
385 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); | 393 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); |
386 | 394 | ||
387 | // Current position | 395 | // Current position |
388 | retval.currentRegion = (string)reader["currentRegion"]; | 396 | retval.currentRegion = (string) reader["currentRegion"]; |
389 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); | 397 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); |
390 | LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); | 398 | LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos); |
391 | } | 399 | } |
392 | else | 400 | else |
393 | { | 401 | { |
@@ -407,12 +415,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
407 | 415 | ||
408 | if (reader.Read()) | 416 | if (reader.Read()) |
409 | { | 417 | { |
410 | retval.UUID = new LLUUID((string)reader["UUID"]); | 418 | retval.UUID = new LLUUID((string) reader["UUID"]); |
411 | retval.username = (string)reader["username"]; | 419 | retval.username = (string) reader["username"]; |
412 | retval.surname = (string)reader["lastname"]; | 420 | retval.surname = (string) reader["lastname"]; |
413 | 421 | ||
414 | retval.passwordHash = (string)reader["passwordHash"]; | 422 | retval.passwordHash = (string) reader["passwordHash"]; |
415 | retval.passwordSalt = (string)reader["passwordSalt"]; | 423 | retval.passwordSalt = (string) reader["passwordSalt"]; |
416 | 424 | ||
417 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); | 425 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); |
418 | retval.homeLocation = new LLVector3( | 426 | retval.homeLocation = new LLVector3( |
@@ -427,18 +435,17 @@ namespace OpenSim.Framework.Data.MySQL | |||
427 | retval.created = Convert.ToInt32(reader["created"].ToString()); | 435 | retval.created = Convert.ToInt32(reader["created"].ToString()); |
428 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); | 436 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); |
429 | 437 | ||
430 | retval.userInventoryURI = (string)reader["userInventoryURI"]; | 438 | retval.userInventoryURI = (string) reader["userInventoryURI"]; |
431 | retval.userAssetURI = (string)reader["userAssetURI"]; | 439 | retval.userAssetURI = (string) reader["userAssetURI"]; |
432 | 440 | ||
433 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); | 441 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); |
434 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); | 442 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); |
435 | 443 | ||
436 | retval.profileAboutText = (string)reader["profileAboutText"]; | 444 | retval.profileAboutText = (string) reader["profileAboutText"]; |
437 | retval.profileFirstText = (string)reader["profileFirstText"]; | 445 | retval.profileFirstText = (string) reader["profileFirstText"]; |
438 | |||
439 | retval.profileImage = new LLUUID((string)reader["profileImage"]); | ||
440 | retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); | ||
441 | 446 | ||
447 | retval.profileImage = new LLUUID((string) reader["profileImage"]); | ||
448 | retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]); | ||
442 | } | 449 | } |
443 | else | 450 | else |
444 | { | 451 | { |
@@ -448,7 +455,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
448 | } | 455 | } |
449 | 456 | ||
450 | 457 | ||
451 | |||
452 | /// <summary> | 458 | /// <summary> |
453 | /// Inserts a new row into the log database | 459 | /// Inserts a new row into the log database |
454 | /// </summary> | 460 | /// </summary> |
@@ -459,7 +465,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
459 | /// <param name="priority">How critical is this?</param> | 465 | /// <param name="priority">How critical is this?</param> |
460 | /// <param name="logMessage">Extra message info</param> | 466 | /// <param name="logMessage">Extra message info</param> |
461 | /// <returns>Saved successfully?</returns> | 467 | /// <returns>Saved successfully?</returns> |
462 | public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | 468 | public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, |
469 | string logMessage) | ||
463 | { | 470 | { |
464 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; | 471 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; |
465 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; | 472 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; |
@@ -493,89 +500,97 @@ namespace OpenSim.Framework.Data.MySQL | |||
493 | } | 500 | } |
494 | 501 | ||
495 | 502 | ||
496 | /// <summary> | 503 | /// <summary> |
497 | /// Creates a new user and inserts it into the database | 504 | /// Creates a new user and inserts it into the database |
498 | /// </summary> | 505 | /// </summary> |
499 | /// <param name="uuid">User ID</param> | 506 | /// <param name="uuid">User ID</param> |
500 | /// <param name="username">First part of the login</param> | 507 | /// <param name="username">First part of the login</param> |
501 | /// <param name="lastname">Second part of the login</param> | 508 | /// <param name="lastname">Second part of the login</param> |
502 | /// <param name="passwordHash">A salted hash of the users password</param> | 509 | /// <param name="passwordHash">A salted hash of the users password</param> |
503 | /// <param name="passwordSalt">The salt used for the password hash</param> | 510 | /// <param name="passwordSalt">The salt used for the password hash</param> |
504 | /// <param name="homeRegion">A regionHandle of the users home region</param> | 511 | /// <param name="homeRegion">A regionHandle of the users home region</param> |
505 | /// <param name="homeLocX">Home region position vector</param> | 512 | /// <param name="homeLocX">Home region position vector</param> |
506 | /// <param name="homeLocY">Home region position vector</param> | 513 | /// <param name="homeLocY">Home region position vector</param> |
507 | /// <param name="homeLocZ">Home region position vector</param> | 514 | /// <param name="homeLocZ">Home region position vector</param> |
508 | /// <param name="homeLookAtX">Home region 'look at' vector</param> | 515 | /// <param name="homeLookAtX">Home region 'look at' vector</param> |
509 | /// <param name="homeLookAtY">Home region 'look at' vector</param> | 516 | /// <param name="homeLookAtY">Home region 'look at' vector</param> |
510 | /// <param name="homeLookAtZ">Home region 'look at' vector</param> | 517 | /// <param name="homeLookAtZ">Home region 'look at' vector</param> |
511 | /// <param name="created">Account created (unix timestamp)</param> | 518 | /// <param name="created">Account created (unix timestamp)</param> |
512 | /// <param name="lastlogin">Last login (unix timestamp)</param> | 519 | /// <param name="lastlogin">Last login (unix timestamp)</param> |
513 | /// <param name="inventoryURI">Users inventory URI</param> | 520 | /// <param name="inventoryURI">Users inventory URI</param> |
514 | /// <param name="assetURI">Users asset URI</param> | 521 | /// <param name="assetURI">Users asset URI</param> |
515 | /// <param name="canDoMask">I can do mask</param> | 522 | /// <param name="canDoMask">I can do mask</param> |
516 | /// <param name="wantDoMask">I want to do mask</param> | 523 | /// <param name="wantDoMask">I want to do mask</param> |
517 | /// <param name="aboutText">Profile text</param> | 524 | /// <param name="aboutText">Profile text</param> |
518 | /// <param name="firstText">Firstlife text</param> | 525 | /// <param name="firstText">Firstlife text</param> |
519 | /// <param name="profileImage">UUID for profile image</param> | 526 | /// <param name="profileImage">UUID for profile image</param> |
520 | /// <param name="firstImage">UUID for firstlife image</param> | 527 | /// <param name="firstImage">UUID for firstlife image</param> |
521 | /// <returns>Success?</returns> | 528 | /// <returns>Success?</returns> |
522 | public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, | 529 | public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash, |
523 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, | 530 | string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, |
524 | libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) | 531 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, |
525 | { | 532 | string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, |
526 | string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, "; | 533 | string aboutText, string firstText, |
527 | sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; | 534 | LLUUID profileImage, LLUUID firstImage) |
528 | sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; | 535 | { |
529 | sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES "; | 536 | string sql = |
530 | 537 | "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, "; | |
531 | sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; | 538 | sql += |
532 | sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; | 539 | "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; |
533 | sql += "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; | 540 | sql += |
534 | sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; | 541 | "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; |
535 | 542 | sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES "; | |
536 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 543 | |
537 | parameters["?UUID"] = uuid.ToStringHyphenated(); | 544 | sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; |
538 | parameters["?username"] = username.ToString(); | 545 | sql += |
539 | parameters["?lastname"] = lastname.ToString(); | 546 | "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; |
540 | parameters["?passwordHash"] = passwordHash.ToString(); | 547 | sql += |
541 | parameters["?passwordSalt"] = passwordSalt.ToString(); | 548 | "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; |
542 | parameters["?homeRegion"] = homeRegion.ToString(); | 549 | sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; |
543 | parameters["?homeLocationX"] = homeLocX.ToString(); | 550 | |
544 | parameters["?homeLocationY"] = homeLocY.ToString(); | 551 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
545 | parameters["?homeLocationZ"] = homeLocZ.ToString(); | 552 | parameters["?UUID"] = uuid.ToStringHyphenated(); |
546 | parameters["?homeLookAtX"] = homeLookAtX.ToString(); | 553 | parameters["?username"] = username.ToString(); |
547 | parameters["?homeLookAtY"] = homeLookAtY.ToString(); | 554 | parameters["?lastname"] = lastname.ToString(); |
548 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); | 555 | parameters["?passwordHash"] = passwordHash.ToString(); |
549 | parameters["?created"] = created.ToString(); | 556 | parameters["?passwordSalt"] = passwordSalt.ToString(); |
550 | parameters["?lastLogin"] = lastlogin.ToString(); | 557 | parameters["?homeRegion"] = homeRegion.ToString(); |
551 | parameters["?userInventoryURI"] = ""; | 558 | parameters["?homeLocationX"] = homeLocX.ToString(); |
552 | parameters["?userAssetURI"] = ""; | 559 | parameters["?homeLocationY"] = homeLocY.ToString(); |
553 | parameters["?profileCanDoMask"] = "0"; | 560 | parameters["?homeLocationZ"] = homeLocZ.ToString(); |
554 | parameters["?profileWantDoMask"] = "0"; | 561 | parameters["?homeLookAtX"] = homeLookAtX.ToString(); |
555 | parameters["?profileAboutText"] = ""; | 562 | parameters["?homeLookAtY"] = homeLookAtY.ToString(); |
556 | parameters["?profileFirstText"] = ""; | 563 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); |
557 | parameters["?profileImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); | 564 | parameters["?created"] = created.ToString(); |
558 | parameters["?profileFirstImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); | 565 | parameters["?lastLogin"] = lastlogin.ToString(); |
559 | 566 | parameters["?userInventoryURI"] = ""; | |
560 | bool returnval = false; | 567 | parameters["?userAssetURI"] = ""; |
561 | 568 | parameters["?profileCanDoMask"] = "0"; | |
562 | try | 569 | parameters["?profileWantDoMask"] = "0"; |
563 | { | 570 | parameters["?profileAboutText"] = ""; |
564 | IDbCommand result = Query(sql, parameters); | 571 | parameters["?profileFirstText"] = ""; |
565 | 572 | parameters["?profileImage"] = LLUUID.Zero.ToStringHyphenated(); | |
566 | if (result.ExecuteNonQuery() == 1) | 573 | parameters["?profileFirstImage"] = LLUUID.Zero.ToStringHyphenated(); |
567 | returnval = true; | 574 | |
568 | 575 | bool returnval = false; | |
569 | result.Dispose(); | 576 | |
570 | } | 577 | try |
571 | catch (Exception e) | 578 | { |
572 | { | 579 | IDbCommand result = Query(sql, parameters); |
573 | MainLog.Instance.Error(e.ToString()); | 580 | |
574 | return false; | 581 | if (result.ExecuteNonQuery() == 1) |
575 | } | 582 | returnval = true; |
576 | 583 | ||
577 | return returnval; | 584 | result.Dispose(); |
578 | } | 585 | } |
586 | catch (Exception e) | ||
587 | { | ||
588 | MainLog.Instance.Error(e.ToString()); | ||
589 | return false; | ||
590 | } | ||
591 | |||
592 | return returnval; | ||
593 | } | ||
579 | 594 | ||
580 | 595 | ||
581 | /// <summary> | 596 | /// <summary> |
@@ -585,13 +600,18 @@ namespace OpenSim.Framework.Data.MySQL | |||
585 | /// <returns>Success?</returns> | 600 | /// <returns>Success?</returns> |
586 | public bool insertRegion(RegionProfileData regiondata) | 601 | public bool insertRegion(RegionProfileData regiondata) |
587 | { | 602 | { |
588 | string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 603 | string sql = |
589 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | 604 | "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
590 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; | 605 | sql += |
606 | "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
607 | sql += | ||
608 | "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; | ||
591 | 609 | ||
592 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; | 610 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; |
593 | sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; | 611 | sql += |
594 | sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; | 612 | "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; |
613 | sql += | ||
614 | "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; | ||
595 | 615 | ||
596 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 616 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
597 | 617 | ||
@@ -626,7 +646,6 @@ namespace OpenSim.Framework.Data.MySQL | |||
626 | 646 | ||
627 | try | 647 | try |
628 | { | 648 | { |
629 | |||
630 | IDbCommand result = Query(sql, parameters); | 649 | IDbCommand result = Query(sql, parameters); |
631 | 650 | ||
632 | //Console.WriteLine(result.CommandText); | 651 | //Console.WriteLine(result.CommandText); |
@@ -646,4 +665,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
646 | return returnval; | 665 | return returnval; |
647 | } | 666 | } |
648 | } | 667 | } |
649 | } | 668 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 27c9cf6..8846650 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | 30 | using System.Data; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
34 | 33 | ||
35 | namespace OpenSim.Framework.Data.MySQL | 34 | namespace OpenSim.Framework.Data.MySQL |
@@ -37,7 +36,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
37 | /// <summary> | 36 | /// <summary> |
38 | /// A database interface class to a user profile storage system | 37 | /// A database interface class to a user profile storage system |
39 | /// </summary> | 38 | /// </summary> |
40 | class MySQLUserData : IUserData | 39 | internal class MySQLUserData : IUserData |
41 | { | 40 | { |
42 | /// <summary> | 41 | /// <summary> |
43 | /// Database manager for MySQL | 42 | /// Database manager for MySQL |
@@ -59,7 +58,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
59 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | 58 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); |
60 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | 59 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); |
61 | 60 | ||
62 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 61 | database = |
62 | new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, | ||
63 | settingPort); | ||
63 | } | 64 | } |
64 | 65 | ||
65 | /// <summary> | 66 | /// <summary> |
@@ -88,11 +89,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
88 | param["?first"] = user; | 89 | param["?first"] = user; |
89 | param["?second"] = last; | 90 | param["?second"] = last; |
90 | 91 | ||
91 | IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); | 92 | IDbCommand result = |
93 | database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); | ||
92 | IDataReader reader = result.ExecuteReader(); | 94 | IDataReader reader = result.ExecuteReader(); |
93 | 95 | ||
94 | UserProfileData row = database.readUserRow(reader); | 96 | UserProfileData row = database.readUserRow(reader); |
95 | 97 | ||
96 | reader.Close(); | 98 | reader.Close(); |
97 | result.Dispose(); | 99 | result.Dispose(); |
98 | 100 | ||
@@ -201,21 +203,25 @@ namespace OpenSim.Framework.Data.MySQL | |||
201 | /// <param name="user">The user profile to create</param> | 203 | /// <param name="user">The user profile to create</param> |
202 | public void AddNewUserProfile(UserProfileData user) | 204 | public void AddNewUserProfile(UserProfileData user) |
203 | { | 205 | { |
204 | try | 206 | try |
205 | { | 207 | { |
206 | lock (database) | 208 | lock (database) |
207 | { | 209 | { |
208 | database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, | 210 | database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, |
209 | user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, | 211 | user.homeRegion, user.homeLocation.X, user.homeLocation.Y, |
210 | user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); | 212 | user.homeLocation.Z, |
211 | } | 213 | user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, |
212 | } | 214 | user.lastLogin, user.userInventoryURI, user.userAssetURI, |
213 | catch (Exception e) | 215 | user.profileCanDoMask, user.profileWantDoMask, |
214 | { | 216 | user.profileAboutText, user.profileFirstText, user.profileImage, |
215 | database.Reconnect(); | 217 | user.profileFirstImage); |
216 | MainLog.Instance.Error(e.ToString()); | 218 | } |
217 | } | 219 | } |
218 | 220 | catch (Exception e) | |
221 | { | ||
222 | database.Reconnect(); | ||
223 | MainLog.Instance.Error(e.ToString()); | ||
224 | } | ||
219 | } | 225 | } |
220 | 226 | ||
221 | /// <summary> | 227 | /// <summary> |
@@ -226,8 +232,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
226 | { | 232 | { |
227 | // Do nothing. | 233 | // Do nothing. |
228 | } | 234 | } |
229 | 235 | ||
230 | 236 | ||
231 | public bool UpdateUserProfile(UserProfileData user) | 237 | public bool UpdateUserProfile(UserProfileData user) |
232 | { | 238 | { |
233 | return true; | 239 | return true; |
@@ -277,4 +283,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
277 | return "0.1"; | 283 | return "0.1"; |
278 | } | 284 | } |
279 | } | 285 | } |
280 | } | 286 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs index 46c0ae0..7024bfa 100644 --- a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Framework.Data.MySQL")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Framework.Data.MySQL")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] | 24 | |
25 | [assembly : Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs index 75bb53d..6693c98 100644 --- a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Framework.Data.SQLite")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Framework.Data.SQLite")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] | 24 | |
25 | [assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("0.4.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("0.4.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs index a85ab4d..4187078 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs | |||
@@ -26,15 +26,11 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using libsecondlife; | ||
31 | using OpenSim.Framework; | ||
32 | using System.Data; | 29 | using System.Data; |
33 | using System.Data.SqlTypes; | 30 | using System.Reflection; |
31 | using libsecondlife; | ||
34 | using Mono.Data.SqliteClient; | 32 | using Mono.Data.SqliteClient; |
35 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | 34 | ||
39 | namespace OpenSim.Framework.Data.SQLite | 35 | namespace OpenSim.Framework.Data.SQLite |
40 | { | 36 | { |
@@ -46,11 +42,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
46 | /// <summary> | 42 | /// <summary> |
47 | /// The database manager | 43 | /// The database manager |
48 | /// </summary> | 44 | /// </summary> |
49 | |||
50 | /// <summary> | 45 | /// <summary> |
51 | /// Artificial constructor called upon plugin load | 46 | /// Artificial constructor called upon plugin load |
52 | /// </summary> | 47 | /// </summary> |
53 | private const string assetSelect = "select * from assets"; | 48 | private const string assetSelect = "select * from assets"; |
49 | |||
54 | private DataSet ds; | 50 | private DataSet ds; |
55 | private SqliteDataAdapter da; | 51 | private SqliteDataAdapter da; |
56 | 52 | ||
@@ -58,13 +54,14 @@ namespace OpenSim.Framework.Data.SQLite | |||
58 | { | 54 | { |
59 | SqliteConnection conn = new SqliteConnection("URI=file:" + dbfile + ",version=3"); | 55 | SqliteConnection conn = new SqliteConnection("URI=file:" + dbfile + ",version=3"); |
60 | TestTables(conn); | 56 | TestTables(conn); |
61 | 57 | ||
62 | ds = new DataSet(); | 58 | ds = new DataSet(); |
63 | da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); | 59 | da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); |
64 | 60 | ||
65 | lock (ds) { | 61 | lock (ds) |
62 | { | ||
66 | ds.Tables.Add(createAssetsTable()); | 63 | ds.Tables.Add(createAssetsTable()); |
67 | 64 | ||
68 | setupAssetCommands(da, conn); | 65 | setupAssetCommands(da, conn); |
69 | try | 66 | try |
70 | { | 67 | { |
@@ -75,11 +72,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
75 | MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table"); | 72 | MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table"); |
76 | } | 73 | } |
77 | } | 74 | } |
78 | 75 | ||
79 | return; | 76 | return; |
80 | } | 77 | } |
81 | 78 | ||
82 | public AssetBase FetchAsset(LLUUID uuid) | 79 | public AssetBase FetchAsset(LLUUID uuid) |
83 | { | 80 | { |
84 | AssetBase asset = new AssetBase(); | 81 | AssetBase asset = new AssetBase(); |
85 | DataRow row = ds.Tables["assets"].Rows.Find(uuid); | 82 | DataRow row = ds.Tables["assets"].Rows.Find(uuid); |
@@ -92,27 +89,28 @@ namespace OpenSim.Framework.Data.SQLite | |||
92 | return null; | 89 | return null; |
93 | } | 90 | } |
94 | } | 91 | } |
95 | 92 | ||
96 | public void CreateAsset(AssetBase asset) | 93 | public void CreateAsset(AssetBase asset) |
97 | { | 94 | { |
98 | // no difference for now | 95 | // no difference for now |
99 | UpdateAsset(asset); | 96 | UpdateAsset(asset); |
100 | } | 97 | } |
101 | 98 | ||
102 | public void UpdateAsset(AssetBase asset) | 99 | public void UpdateAsset(AssetBase asset) |
103 | { | 100 | { |
104 | LogAssetLoad(asset); | 101 | LogAssetLoad(asset); |
105 | 102 | ||
106 | DataTable assets = ds.Tables["assets"]; | 103 | DataTable assets = ds.Tables["assets"]; |
107 | lock(ds) { | 104 | lock (ds) |
105 | { | ||
108 | DataRow row = assets.Rows.Find(asset.FullID); | 106 | DataRow row = assets.Rows.Find(asset.FullID); |
109 | if (row == null) | 107 | if (row == null) |
110 | { | 108 | { |
111 | row = assets.NewRow(); | 109 | row = assets.NewRow(); |
112 | fillAssetRow(row, asset); | 110 | fillAssetRow(row, asset); |
113 | assets.Rows.Add(row); | 111 | assets.Rows.Add(row); |
114 | } | 112 | } |
115 | else | 113 | else |
116 | { | 114 | { |
117 | fillAssetRow(row, asset); | 115 | fillAssetRow(row, asset); |
118 | } | 116 | } |
@@ -124,9 +122,10 @@ namespace OpenSim.Framework.Data.SQLite | |||
124 | string temporary = asset.Temporary ? "Temporary" : "Stored"; | 122 | string temporary = asset.Temporary ? "Temporary" : "Stored"; |
125 | string local = asset.Local ? "Local" : "Remote"; | 123 | string local = asset.Local ? "Local" : "Remote"; |
126 | 124 | ||
127 | MainLog.Instance.Verbose("ASSETSTORAGE", | 125 | MainLog.Instance.Verbose("ASSETSTORAGE", |
128 | string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", | 126 | string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", |
129 | asset.FullID, asset.Name, asset.Description, asset.Type, asset.InvType, temporary, local, asset.Data.Length) ); | 127 | asset.FullID, asset.Name, asset.Description, asset.Type, |
128 | asset.InvType, temporary, local, asset.Data.Length)); | ||
130 | } | 129 | } |
131 | 130 | ||
132 | public bool ExistsAsset(LLUUID uuid) | 131 | public bool ExistsAsset(LLUUID uuid) |
@@ -137,23 +136,26 @@ namespace OpenSim.Framework.Data.SQLite | |||
137 | 136 | ||
138 | public void DeleteAsset(LLUUID uuid) | 137 | public void DeleteAsset(LLUUID uuid) |
139 | { | 138 | { |
140 | lock (ds) { | 139 | lock (ds) |
140 | { | ||
141 | DataRow row = ds.Tables["assets"].Rows.Find(uuid); | 141 | DataRow row = ds.Tables["assets"].Rows.Find(uuid); |
142 | if (row != null) { | 142 | if (row != null) |
143 | { | ||
143 | row.Delete(); | 144 | row.Delete(); |
144 | } | 145 | } |
145 | } | 146 | } |
146 | } | 147 | } |
147 | 148 | ||
148 | public void CommitAssets() // force a sync to the database | 149 | public void CommitAssets() // force a sync to the database |
149 | { | 150 | { |
150 | MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); | 151 | MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); |
151 | lock (ds) { | 152 | lock (ds) |
153 | { | ||
152 | da.Update(ds, "assets"); | 154 | da.Update(ds, "assets"); |
153 | ds.AcceptChanges(); | 155 | ds.AcceptChanges(); |
154 | } | 156 | } |
155 | } | 157 | } |
156 | 158 | ||
157 | /*********************************************************************** | 159 | /*********************************************************************** |
158 | * | 160 | * |
159 | * Database Definition Functions | 161 | * Database Definition Functions |
@@ -161,24 +163,24 @@ namespace OpenSim.Framework.Data.SQLite | |||
161 | * This should be db agnostic as we define them in ADO.NET terms | 163 | * This should be db agnostic as we define them in ADO.NET terms |
162 | * | 164 | * |
163 | **********************************************************************/ | 165 | **********************************************************************/ |
164 | 166 | ||
165 | private DataTable createAssetsTable() | 167 | private DataTable createAssetsTable() |
166 | { | 168 | { |
167 | DataTable assets = new DataTable("assets"); | 169 | DataTable assets = new DataTable("assets"); |
168 | 170 | ||
169 | createCol(assets, "UUID", typeof(System.String)); | 171 | createCol(assets, "UUID", typeof (String)); |
170 | createCol(assets, "Name", typeof(System.String)); | 172 | createCol(assets, "Name", typeof (String)); |
171 | createCol(assets, "Description", typeof(System.String)); | 173 | createCol(assets, "Description", typeof (String)); |
172 | createCol(assets, "Type", typeof(System.Int32)); | 174 | createCol(assets, "Type", typeof (Int32)); |
173 | createCol(assets, "InvType", typeof(System.Int32)); | 175 | createCol(assets, "InvType", typeof (Int32)); |
174 | createCol(assets, "Local", typeof(System.Boolean)); | 176 | createCol(assets, "Local", typeof (Boolean)); |
175 | createCol(assets, "Temporary", typeof(System.Boolean)); | 177 | createCol(assets, "Temporary", typeof (Boolean)); |
176 | createCol(assets, "Data", typeof(System.Byte[])); | 178 | createCol(assets, "Data", typeof (Byte[])); |
177 | // Add in contraints | 179 | // Add in contraints |
178 | assets.PrimaryKey = new DataColumn[] { assets.Columns["UUID"] }; | 180 | assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]}; |
179 | return assets; | 181 | return assets; |
180 | } | 182 | } |
181 | 183 | ||
182 | /*********************************************************************** | 184 | /*********************************************************************** |
183 | * | 185 | * |
184 | * Convert between ADO.NET <=> OpenSim Objects | 186 | * Convert between ADO.NET <=> OpenSim Objects |
@@ -193,19 +195,19 @@ namespace OpenSim.Framework.Data.SQLite | |||
193 | // interesting has to be done to actually get these values | 195 | // interesting has to be done to actually get these values |
194 | // back out. Not enough time to figure it out yet. | 196 | // back out. Not enough time to figure it out yet. |
195 | AssetBase asset = new AssetBase(); | 197 | AssetBase asset = new AssetBase(); |
196 | 198 | ||
197 | asset.FullID = new LLUUID((String)row["UUID"]); | 199 | asset.FullID = new LLUUID((String) row["UUID"]); |
198 | asset.Name = (String)row["Name"]; | 200 | asset.Name = (String) row["Name"]; |
199 | asset.Description = (String)row["Description"]; | 201 | asset.Description = (String) row["Description"]; |
200 | asset.Type = Convert.ToSByte(row["Type"]); | 202 | asset.Type = Convert.ToSByte(row["Type"]); |
201 | asset.InvType = Convert.ToSByte(row["InvType"]); | 203 | asset.InvType = Convert.ToSByte(row["InvType"]); |
202 | asset.Local = Convert.ToBoolean(row["Local"]); | 204 | asset.Local = Convert.ToBoolean(row["Local"]); |
203 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); | 205 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); |
204 | asset.Data = (byte[])row["Data"]; | 206 | asset.Data = (byte[]) row["Data"]; |
205 | return asset; | 207 | return asset; |
206 | } | 208 | } |
207 | 209 | ||
208 | 210 | ||
209 | private void fillAssetRow(DataRow row, AssetBase asset) | 211 | private void fillAssetRow(DataRow row, AssetBase asset) |
210 | { | 212 | { |
211 | row["UUID"] = asset.FullID; | 213 | row["UUID"] = asset.FullID; |
@@ -225,8 +227,10 @@ namespace OpenSim.Framework.Data.SQLite | |||
225 | row["Data"] = asset.Data; | 227 | row["Data"] = asset.Data; |
226 | 228 | ||
227 | // ADO.NET doesn't handle NULL very well | 229 | // ADO.NET doesn't handle NULL very well |
228 | foreach (DataColumn col in ds.Tables["assets"].Columns) { | 230 | foreach (DataColumn col in ds.Tables["assets"].Columns) |
229 | if (row[col] == null) { | 231 | { |
232 | if (row[col] == null) | ||
233 | { | ||
230 | row[col] = ""; | 234 | row[col] = ""; |
231 | } | 235 | } |
232 | } | 236 | } |
@@ -250,18 +254,18 @@ namespace OpenSim.Framework.Data.SQLite | |||
250 | da.UpdateCommand.Connection = conn; | 254 | da.UpdateCommand.Connection = conn; |
251 | 255 | ||
252 | SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID"); | 256 | SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID"); |
253 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); | 257 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); |
254 | delete.Connection = conn; | 258 | delete.Connection = conn; |
255 | da.DeleteCommand = delete; | 259 | da.DeleteCommand = delete; |
256 | } | 260 | } |
257 | 261 | ||
258 | private void InitDB(SqliteConnection conn) | 262 | private void InitDB(SqliteConnection conn) |
259 | { | 263 | { |
260 | string createAssets = defineTable(createAssetsTable()); | 264 | string createAssets = defineTable(createAssetsTable()); |
261 | SqliteCommand pcmd = new SqliteCommand(createAssets, conn); | 265 | SqliteCommand pcmd = new SqliteCommand(createAssets, conn); |
262 | conn.Open(); | 266 | conn.Open(); |
263 | pcmd.ExecuteNonQuery(); | 267 | pcmd.ExecuteNonQuery(); |
264 | conn.Close(); | 268 | conn.Close(); |
265 | } | 269 | } |
266 | 270 | ||
267 | private bool TestTables(SqliteConnection conn) | 271 | private bool TestTables(SqliteConnection conn) |
@@ -269,9 +273,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
269 | SqliteCommand cmd = new SqliteCommand(assetSelect, conn); | 273 | SqliteCommand cmd = new SqliteCommand(assetSelect, conn); |
270 | SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); | 274 | SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); |
271 | DataSet tmpDS = new DataSet(); | 275 | DataSet tmpDS = new DataSet(); |
272 | try { | 276 | try |
277 | { | ||
273 | pDa.Fill(tmpDS, "assets"); | 278 | pDa.Fill(tmpDS, "assets"); |
274 | } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { | 279 | } |
280 | catch (SqliteSyntaxException) | ||
281 | { | ||
275 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | 282 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); |
276 | InitDB(conn); | 283 | InitDB(conn); |
277 | } | 284 | } |
@@ -279,14 +286,18 @@ namespace OpenSim.Framework.Data.SQLite | |||
279 | } | 286 | } |
280 | 287 | ||
281 | #region IPlugin interface | 288 | #region IPlugin interface |
282 | public string Version { | 289 | |
290 | public string Version | ||
291 | { | ||
283 | get | 292 | get |
284 | { | 293 | { |
285 | System.Reflection.Module module = this.GetType().Module; | 294 | Module module = GetType().Module; |
286 | string dllName = module.Assembly.ManifestModule.Name; | 295 | string dllName = module.Assembly.ManifestModule.Name; |
287 | Version dllVersion = module.Assembly.GetName().Version; | 296 | Version dllVersion = module.Assembly.GetName().Version; |
288 | 297 | ||
289 | return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); | 298 | return |
299 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | ||
300 | dllVersion.Revision); | ||
290 | } | 301 | } |
291 | } | 302 | } |
292 | 303 | ||
@@ -295,9 +306,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
295 | Initialise("AssetStorage.db", ""); | 306 | Initialise("AssetStorage.db", ""); |
296 | } | 307 | } |
297 | 308 | ||
298 | public string Name { | 309 | public string Name |
310 | { | ||
299 | get { return "SQLite Asset storage engine"; } | 311 | get { return "SQLite Asset storage engine"; } |
300 | } | 312 | } |
313 | |||
301 | #endregion | 314 | #endregion |
302 | } | 315 | } |
303 | } | 316 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs index 4f237fd..157b4e6 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs | |||
@@ -26,13 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using libsecondlife; | ||
31 | using OpenSim.Framework; | ||
32 | using System.Data; | 29 | using System.Data; |
33 | using System.Data.SqlTypes; | ||
34 | using Mono.Data.SqliteClient; | 30 | using Mono.Data.SqliteClient; |
35 | using OpenSim.Framework.Console; | ||
36 | 31 | ||
37 | namespace OpenSim.Framework.Data.SQLite | 32 | namespace OpenSim.Framework.Data.SQLite |
38 | { | 33 | { |
@@ -48,8 +43,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
48 | * This should be db agnostic as we define them in ADO.NET terms | 43 | * This should be db agnostic as we define them in ADO.NET terms |
49 | * | 44 | * |
50 | **********************************************************************/ | 45 | **********************************************************************/ |
51 | 46 | ||
52 | protected static void createCol(DataTable dt, string name, System.Type type) | 47 | protected static void createCol(DataTable dt, string name, Type type) |
53 | { | 48 | { |
54 | DataColumn col = new DataColumn(name, type); | 49 | DataColumn col = new DataColumn(name, type); |
55 | dt.Columns.Add(col); | 50 | dt.Columns.Add(col); |
@@ -77,7 +72,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
77 | * generate these strings instead of typing them out. | 72 | * generate these strings instead of typing them out. |
78 | */ | 73 | */ |
79 | string[] cols = new string[dt.Columns.Count]; | 74 | string[] cols = new string[dt.Columns.Count]; |
80 | for (int i = 0; i < dt.Columns.Count; i++) { | 75 | for (int i = 0; i < dt.Columns.Count; i++) |
76 | { | ||
81 | DataColumn col = dt.Columns[i]; | 77 | DataColumn col = dt.Columns[i]; |
82 | cols[i] = col.ColumnName; | 78 | cols[i] = col.ColumnName; |
83 | } | 79 | } |
@@ -92,7 +88,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
92 | 88 | ||
93 | // this provides the binding for all our parameters, so | 89 | // this provides the binding for all our parameters, so |
94 | // much less code than it used to be | 90 | // much less code than it used to be |
95 | foreach (DataColumn col in dt.Columns) | 91 | foreach (DataColumn col in dt.Columns) |
96 | { | 92 | { |
97 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | 93 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); |
98 | } | 94 | } |
@@ -106,7 +102,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
106 | foreach (DataColumn col in dt.Columns) | 102 | foreach (DataColumn col in dt.Columns) |
107 | { | 103 | { |
108 | if (subsql.Length > 0) | 104 | if (subsql.Length > 0) |
109 | { // a map function would rock so much here | 105 | { |
106 | // a map function would rock so much here | ||
110 | subsql += ", "; | 107 | subsql += ", "; |
111 | } | 108 | } |
112 | subsql += col.ColumnName + "= :" + col.ColumnName; | 109 | subsql += col.ColumnName + "= :" + col.ColumnName; |
@@ -118,7 +115,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
118 | // this provides the binding for all our parameters, so | 115 | // this provides the binding for all our parameters, so |
119 | // much less code than it used to be | 116 | // much less code than it used to be |
120 | 117 | ||
121 | foreach (DataColumn col in dt.Columns) | 118 | foreach (DataColumn col in dt.Columns) |
122 | { | 119 | { |
123 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | 120 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); |
124 | } | 121 | } |
@@ -133,11 +130,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
133 | foreach (DataColumn col in dt.Columns) | 130 | foreach (DataColumn col in dt.Columns) |
134 | { | 131 | { |
135 | if (subsql.Length > 0) | 132 | if (subsql.Length > 0) |
136 | { // a map function would rock so much here | 133 | { |
134 | // a map function would rock so much here | ||
137 | subsql += ",\n"; | 135 | subsql += ",\n"; |
138 | } | 136 | } |
139 | subsql += col.ColumnName + " " + sqliteType(col.DataType); | 137 | subsql += col.ColumnName + " " + sqliteType(col.DataType); |
140 | if(col == dt.PrimaryKey[0]) | 138 | if (col == dt.PrimaryKey[0]) |
141 | { | 139 | { |
142 | subsql += " primary key"; | 140 | subsql += " primary key"; |
143 | } | 141 | } |
@@ -167,7 +165,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
167 | /// for us. | 165 | /// for us. |
168 | ///</summary> | 166 | ///</summary> |
169 | ///<returns>a built sqlite parameter</returns> | 167 | ///<returns>a built sqlite parameter</returns> |
170 | protected static SqliteParameter createSqliteParameter(string name, System.Type type) | 168 | protected static SqliteParameter createSqliteParameter(string name, Type type) |
171 | { | 169 | { |
172 | SqliteParameter param = new SqliteParameter(); | 170 | SqliteParameter param = new SqliteParameter(); |
173 | param.ParameterName = ":" + name; | 171 | param.ParameterName = ":" + name; |
@@ -182,53 +180,87 @@ namespace OpenSim.Framework.Data.SQLite | |||
182 | * Type conversion functions | 180 | * Type conversion functions |
183 | * | 181 | * |
184 | **********************************************************************/ | 182 | **********************************************************************/ |
185 | 183 | ||
186 | protected static DbType dbtypeFromType(Type type) | 184 | protected static DbType dbtypeFromType(Type type) |
187 | { | 185 | { |
188 | if (type == typeof(System.String)) { | 186 | if (type == typeof (String)) |
187 | { | ||
189 | return DbType.String; | 188 | return DbType.String; |
190 | } else if (type == typeof(System.Int32)) { | 189 | } |
190 | else if (type == typeof (Int32)) | ||
191 | { | ||
191 | return DbType.Int32; | 192 | return DbType.Int32; |
192 | } else if (type == typeof(System.UInt32)) { | 193 | } |
194 | else if (type == typeof (UInt32)) | ||
195 | { | ||
193 | return DbType.UInt32; | 196 | return DbType.UInt32; |
194 | } else if (type == typeof(System.Int64)) { | 197 | } |
198 | else if (type == typeof (Int64)) | ||
199 | { | ||
195 | return DbType.Int64; | 200 | return DbType.Int64; |
196 | } else if (type == typeof(System.UInt64)) { | 201 | } |
202 | else if (type == typeof (UInt64)) | ||
203 | { | ||
197 | return DbType.UInt64; | 204 | return DbType.UInt64; |
198 | } else if (type == typeof(System.Double)) { | 205 | } |
206 | else if (type == typeof (Double)) | ||
207 | { | ||
199 | return DbType.Double; | 208 | return DbType.Double; |
200 | } else if (type == typeof(System.Boolean)) { | 209 | } |
210 | else if (type == typeof (Boolean)) | ||
211 | { | ||
201 | return DbType.Boolean; | 212 | return DbType.Boolean; |
202 | } else if (type == typeof(System.Byte[])) { | 213 | } |
214 | else if (type == typeof (Byte[])) | ||
215 | { | ||
203 | return DbType.Binary; | 216 | return DbType.Binary; |
204 | } else { | 217 | } |
218 | else | ||
219 | { | ||
205 | return DbType.String; | 220 | return DbType.String; |
206 | } | 221 | } |
207 | } | 222 | } |
208 | 223 | ||
209 | // this is something we'll need to implement for each db | 224 | // this is something we'll need to implement for each db |
210 | // slightly differently. | 225 | // slightly differently. |
211 | protected static string sqliteType(Type type) | 226 | protected static string sqliteType(Type type) |
212 | { | 227 | { |
213 | if (type == typeof(System.String)) { | 228 | if (type == typeof (String)) |
229 | { | ||
214 | return "varchar(255)"; | 230 | return "varchar(255)"; |
215 | } else if (type == typeof(System.Int32)) { | 231 | } |
232 | else if (type == typeof (Int32)) | ||
233 | { | ||
216 | return "integer"; | 234 | return "integer"; |
217 | } else if (type == typeof(System.UInt32)) { | 235 | } |
236 | else if (type == typeof (UInt32)) | ||
237 | { | ||
218 | return "integer"; | 238 | return "integer"; |
219 | } else if (type == typeof(System.Int64)) { | 239 | } |
240 | else if (type == typeof (Int64)) | ||
241 | { | ||
220 | return "varchar(255)"; | 242 | return "varchar(255)"; |
221 | } else if (type == typeof(System.UInt64)) { | 243 | } |
244 | else if (type == typeof (UInt64)) | ||
245 | { | ||
222 | return "varchar(255)"; | 246 | return "varchar(255)"; |
223 | } else if (type == typeof(System.Double)) { | 247 | } |
248 | else if (type == typeof (Double)) | ||
249 | { | ||
224 | return "float"; | 250 | return "float"; |
225 | } else if (type == typeof(System.Boolean)) { | 251 | } |
252 | else if (type == typeof (Boolean)) | ||
253 | { | ||
226 | return "integer"; | 254 | return "integer"; |
227 | } else if (type == typeof(System.Byte[])) { | 255 | } |
256 | else if (type == typeof (Byte[])) | ||
257 | { | ||
228 | return "blob"; | 258 | return "blob"; |
229 | } else { | 259 | } |
260 | else | ||
261 | { | ||
230 | return "string"; | 262 | return "string"; |
231 | } | 263 | } |
232 | } | 264 | } |
233 | } | 265 | } |
234 | } | 266 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 2fc80b4..8f3e8aa 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | |||
@@ -192,4 +192,4 @@ namespace OpenSim.Framework.Data.SQLite | |||
192 | return null; | 192 | return null; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | } | 195 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index 82a8434..5e95878 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs | |||
@@ -28,22 +28,14 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Data; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | |||
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework; | ||
37 | using libsecondlife; | 33 | using libsecondlife; |
38 | |||
39 | using System.Data; | ||
40 | using System.Data.SqlTypes; | ||
41 | |||
42 | using Mono.Data.SqliteClient; | 34 | using Mono.Data.SqliteClient; |
35 | using OpenSim.Framework.Console; | ||
43 | 36 | ||
44 | namespace OpenSim.Framework.Data.SQLite | 37 | namespace OpenSim.Framework.Data.SQLite |
45 | { | 38 | { |
46 | |||
47 | public class SQLiteInventoryStore : SQLiteBase, IInventoryData | 39 | public class SQLiteInventoryStore : SQLiteBase, IInventoryData |
48 | { | 40 | { |
49 | private const string invItemsSelect = "select * from inventoryitems"; | 41 | private const string invItemsSelect = "select * from inventoryitems"; |
@@ -96,14 +88,14 @@ namespace OpenSim.Framework.Data.SQLite | |||
96 | public InventoryItemBase buildItem(DataRow row) | 88 | public InventoryItemBase buildItem(DataRow row) |
97 | { | 89 | { |
98 | InventoryItemBase item = new InventoryItemBase(); | 90 | InventoryItemBase item = new InventoryItemBase(); |
99 | item.inventoryID = new LLUUID((string)row["UUID"]); | 91 | item.inventoryID = new LLUUID((string) row["UUID"]); |
100 | item.assetID = new LLUUID((string)row["assetID"]); | 92 | item.assetID = new LLUUID((string) row["assetID"]); |
101 | item.assetType = Convert.ToInt32(row["assetType"]); | 93 | item.assetType = Convert.ToInt32(row["assetType"]); |
102 | item.invType = Convert.ToInt32(row["invType"]); | 94 | item.invType = Convert.ToInt32(row["invType"]); |
103 | item.parentFolderID = new LLUUID((string)row["parentFolderID"]); | 95 | item.parentFolderID = new LLUUID((string) row["parentFolderID"]); |
104 | item.avatarID = new LLUUID((string)row["avatarID"]); | 96 | item.avatarID = new LLUUID((string) row["avatarID"]); |
105 | item.creatorsID = new LLUUID((string)row["creatorsID"]); | 97 | item.creatorsID = new LLUUID((string) row["creatorsID"]); |
106 | item.inventoryName =(string) row["inventoryName"]; | 98 | item.inventoryName = (string) row["inventoryName"]; |
107 | item.inventoryDescription = (string) row["inventoryDescription"]; | 99 | item.inventoryDescription = (string) row["inventoryDescription"]; |
108 | 100 | ||
109 | item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); | 101 | item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); |
@@ -147,7 +139,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
147 | fillFolderRow(inventoryRow, folder); | 139 | fillFolderRow(inventoryRow, folder); |
148 | } | 140 | } |
149 | 141 | ||
150 | this.invFoldersDa.Update(ds, "inventoryfolders"); | 142 | invFoldersDa.Update(ds, "inventoryfolders"); |
151 | } | 143 | } |
152 | 144 | ||
153 | private void addItem(InventoryItemBase item) | 145 | private void addItem(InventoryItemBase item) |
@@ -165,7 +157,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
165 | { | 157 | { |
166 | fillItemRow(inventoryRow, item); | 158 | fillItemRow(inventoryRow, item); |
167 | } | 159 | } |
168 | this.invItemsDa.Update(ds, "inventoryitems"); | 160 | invItemsDa.Update(ds, "inventoryitems"); |
169 | } | 161 | } |
170 | 162 | ||
171 | public void Shutdown() | 163 | public void Shutdown() |
@@ -195,12 +187,14 @@ namespace OpenSim.Framework.Data.SQLite | |||
195 | /// <returns>A string containing the plugin version</returns> | 187 | /// <returns>A string containing the plugin version</returns> |
196 | public string getVersion() | 188 | public string getVersion() |
197 | { | 189 | { |
198 | System.Reflection.Module module = this.GetType().Module; | 190 | Module module = GetType().Module; |
199 | string dllName = module.Assembly.ManifestModule.Name; | 191 | string dllName = module.Assembly.ManifestModule.Name; |
200 | Version dllVersion = module.Assembly.GetName().Version; | 192 | Version dllVersion = module.Assembly.GetName().Version; |
201 | 193 | ||
202 | 194 | ||
203 | return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); | 195 | return |
196 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | ||
197 | dllVersion.Revision); | ||
204 | } | 198 | } |
205 | 199 | ||
206 | /// <summary> | 200 | /// <summary> |
@@ -306,7 +300,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
306 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 300 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
307 | getInventoryFolders(ref folders, parentID); | 301 | getInventoryFolders(ref folders, parentID); |
308 | 302 | ||
309 | for(int i=0; i<folders.Count; i++) | 303 | for (int i = 0; i < folders.Count; i++) |
310 | getInventoryFolders(ref folders, folders[i].folderID); | 304 | getInventoryFolders(ref folders, folders[i].folderID); |
311 | 305 | ||
312 | return folders; | 306 | return folders; |
@@ -320,9 +314,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
320 | public InventoryItemBase getInventoryItem(LLUUID item) | 314 | public InventoryItemBase getInventoryItem(LLUUID item) |
321 | { | 315 | { |
322 | DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); | 316 | DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); |
323 | if (row != null) { | 317 | if (row != null) |
318 | { | ||
324 | return buildItem(row); | 319 | return buildItem(row); |
325 | } else { | 320 | } |
321 | else | ||
322 | { | ||
326 | return null; | 323 | return null; |
327 | } | 324 | } |
328 | } | 325 | } |
@@ -334,19 +331,21 @@ namespace OpenSim.Framework.Data.SQLite | |||
334 | /// <returns>A class containing folder information</returns> | 331 | /// <returns>A class containing folder information</returns> |
335 | public InventoryFolderBase getInventoryFolder(LLUUID folder) | 332 | public InventoryFolderBase getInventoryFolder(LLUUID folder) |
336 | { | 333 | { |
337 | 334 | // TODO: Deep voodoo here. If you enable this code then | |
338 | // TODO: Deep voodoo here. If you enable this code then | 335 | // multi region breaks. No idea why, but I figured it was |
339 | // multi region breaks. No idea why, but I figured it was | 336 | // better to leave multi region at this point. It does mean |
340 | // better to leave multi region at this point. It does mean | 337 | // that you don't get to see system textures why creating |
341 | // that you don't get to see system textures why creating | 338 | // clothes and the like. :( |
342 | // clothes and the like. :( | 339 | |
343 | 340 | DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); | |
344 | DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); | 341 | if (row != null) |
345 | if (row != null) { | 342 | { |
346 | return buildFolder(row); | 343 | return buildFolder(row); |
347 | } else { | 344 | } |
345 | else | ||
346 | { | ||
348 | return null; | 347 | return null; |
349 | } | 348 | } |
350 | } | 349 | } |
351 | 350 | ||
352 | /// <summary> | 351 | /// <summary> |
@@ -355,7 +354,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
355 | /// <param name="item">The item to be created</param> | 354 | /// <param name="item">The item to be created</param> |
356 | public void addInventoryItem(InventoryItemBase item) | 355 | public void addInventoryItem(InventoryItemBase item) |
357 | { | 356 | { |
358 | this.addItem(item); | 357 | addItem(item); |
359 | } | 358 | } |
360 | 359 | ||
361 | /// <summary> | 360 | /// <summary> |
@@ -364,7 +363,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
364 | /// <param name="item">The updated item</param> | 363 | /// <param name="item">The updated item</param> |
365 | public void updateInventoryItem(InventoryItemBase item) | 364 | public void updateInventoryItem(InventoryItemBase item) |
366 | { | 365 | { |
367 | this.addItem(item); | 366 | addItem(item); |
368 | } | 367 | } |
369 | 368 | ||
370 | /// <summary> | 369 | /// <summary> |
@@ -376,12 +375,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
376 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; | 375 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; |
377 | 376 | ||
378 | DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID); | 377 | DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID); |
379 | if (inventoryRow != null) | 378 | if (inventoryRow != null) |
380 | { | 379 | { |
381 | inventoryRow.Delete(); | 380 | inventoryRow.Delete(); |
382 | } | 381 | } |
383 | 382 | ||
384 | this.invItemsDa.Update(ds, "inventoryitems"); | 383 | invItemsDa.Update(ds, "inventoryitems"); |
385 | } | 384 | } |
386 | 385 | ||
387 | 386 | ||
@@ -394,7 +393,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
394 | { | 393 | { |
395 | List<InventoryItemBase> items = getInventoryInFolder(folderId); | 394 | List<InventoryItemBase> items = getInventoryInFolder(folderId); |
396 | 395 | ||
397 | foreach(InventoryItemBase i in items) | 396 | foreach (InventoryItemBase i in items) |
398 | deleteInventoryItem(i.inventoryID); | 397 | deleteInventoryItem(i.inventoryID); |
399 | } | 398 | } |
400 | 399 | ||
@@ -404,7 +403,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
404 | /// <param name="folder">The inventory folder</param> | 403 | /// <param name="folder">The inventory folder</param> |
405 | public void addInventoryFolder(InventoryFolderBase folder) | 404 | public void addInventoryFolder(InventoryFolderBase folder) |
406 | { | 405 | { |
407 | this.addFolder(folder); | 406 | addFolder(folder); |
408 | } | 407 | } |
409 | 408 | ||
410 | /// <summary> | 409 | /// <summary> |
@@ -413,7 +412,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
413 | /// <param name="folder">The inventory folder</param> | 412 | /// <param name="folder">The inventory folder</param> |
414 | public void updateInventoryFolder(InventoryFolderBase folder) | 413 | public void updateInventoryFolder(InventoryFolderBase folder) |
415 | { | 414 | { |
416 | this.addFolder(folder); | 415 | addFolder(folder); |
417 | } | 416 | } |
418 | 417 | ||
419 | 418 | ||
@@ -427,7 +426,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
427 | public void deleteInventoryFolder(LLUUID folderID) | 426 | public void deleteInventoryFolder(LLUUID folderID) |
428 | { | 427 | { |
429 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); | 428 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); |
430 | 429 | ||
431 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | 430 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; |
432 | DataRow inventoryRow; | 431 | DataRow inventoryRow; |
433 | 432 | ||
@@ -450,7 +449,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
450 | inventoryRow.Delete(); | 449 | inventoryRow.Delete(); |
451 | } | 450 | } |
452 | 451 | ||
453 | this.invFoldersDa.Update(ds, "inventoryfolders"); | 452 | invFoldersDa.Update(ds, "inventoryfolders"); |
454 | } | 453 | } |
455 | 454 | ||
456 | /*********************************************************************** | 455 | /*********************************************************************** |
@@ -458,43 +457,43 @@ namespace OpenSim.Framework.Data.SQLite | |||
458 | * Data Table definitions | 457 | * Data Table definitions |
459 | * | 458 | * |
460 | **********************************************************************/ | 459 | **********************************************************************/ |
461 | 460 | ||
462 | private static DataTable createInventoryItemsTable() | 461 | private static DataTable createInventoryItemsTable() |
463 | { | 462 | { |
464 | DataTable inv = new DataTable("inventoryitems"); | 463 | DataTable inv = new DataTable("inventoryitems"); |
465 | 464 | ||
466 | createCol(inv, "UUID", typeof(System.String)); //inventoryID | 465 | createCol(inv, "UUID", typeof (String)); //inventoryID |
467 | createCol(inv, "assetID", typeof(System.String)); | 466 | createCol(inv, "assetID", typeof (String)); |
468 | createCol(inv, "assetType", typeof(System.Int32)); | 467 | createCol(inv, "assetType", typeof (Int32)); |
469 | createCol(inv, "invType", typeof(System.Int32)); | 468 | createCol(inv, "invType", typeof (Int32)); |
470 | createCol(inv, "parentFolderID", typeof(System.String)); | 469 | createCol(inv, "parentFolderID", typeof (String)); |
471 | createCol(inv, "avatarID", typeof(System.String)); | 470 | createCol(inv, "avatarID", typeof (String)); |
472 | createCol(inv, "creatorsID", typeof(System.String)); | 471 | createCol(inv, "creatorsID", typeof (String)); |
473 | 472 | ||
474 | createCol(inv, "inventoryName", typeof(System.String)); | 473 | createCol(inv, "inventoryName", typeof (String)); |
475 | createCol(inv, "inventoryDescription", typeof(System.String)); | 474 | createCol(inv, "inventoryDescription", typeof (String)); |
476 | // permissions | 475 | // permissions |
477 | createCol(inv, "inventoryNextPermissions", typeof(System.Int32)); | 476 | createCol(inv, "inventoryNextPermissions", typeof (Int32)); |
478 | createCol(inv, "inventoryCurrentPermissions", typeof(System.Int32)); | 477 | createCol(inv, "inventoryCurrentPermissions", typeof (Int32)); |
479 | createCol(inv, "inventoryBasePermissions", typeof(System.Int32)); | 478 | createCol(inv, "inventoryBasePermissions", typeof (Int32)); |
480 | createCol(inv, "inventoryEveryOnePermissions", typeof(System.Int32)); | 479 | createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); |
481 | 480 | ||
482 | inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] }; | 481 | inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]}; |
483 | return inv; | 482 | return inv; |
484 | } | 483 | } |
485 | 484 | ||
486 | private DataTable createInventoryFoldersTable() | 485 | private DataTable createInventoryFoldersTable() |
487 | { | 486 | { |
488 | DataTable fol = new DataTable("inventoryfolders"); | 487 | DataTable fol = new DataTable("inventoryfolders"); |
489 | 488 | ||
490 | createCol(fol, "UUID", typeof(System.String)); //folderID | 489 | createCol(fol, "UUID", typeof (String)); //folderID |
491 | createCol(fol, "name", typeof(System.String)); | 490 | createCol(fol, "name", typeof (String)); |
492 | createCol(fol, "agentID", typeof(System.String)); | 491 | createCol(fol, "agentID", typeof (String)); |
493 | createCol(fol, "parentID", typeof(System.String)); | 492 | createCol(fol, "parentID", typeof (String)); |
494 | createCol(fol, "type", typeof(System.Int32)); | 493 | createCol(fol, "type", typeof (Int32)); |
495 | createCol(fol, "version", typeof(System.Int32)); | 494 | createCol(fol, "version", typeof (Int32)); |
496 | 495 | ||
497 | fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; | 496 | fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]}; |
498 | return fol; | 497 | return fol; |
499 | } | 498 | } |
500 | 499 | ||
@@ -507,7 +506,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
507 | da.UpdateCommand.Connection = conn; | 506 | da.UpdateCommand.Connection = conn; |
508 | 507 | ||
509 | SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID"); | 508 | SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID"); |
510 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); | 509 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); |
511 | delete.Connection = conn; | 510 | delete.Connection = conn; |
512 | da.DeleteCommand = delete; | 511 | da.DeleteCommand = delete; |
513 | } | 512 | } |
@@ -521,7 +520,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
521 | da.UpdateCommand.Connection = conn; | 520 | da.UpdateCommand.Connection = conn; |
522 | 521 | ||
523 | SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID"); | 522 | SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID"); |
524 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); | 523 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); |
525 | delete.Connection = conn; | 524 | delete.Connection = conn; |
526 | da.DeleteCommand = delete; | 525 | da.DeleteCommand = delete; |
527 | } | 526 | } |
@@ -529,10 +528,10 @@ namespace OpenSim.Framework.Data.SQLite | |||
529 | private InventoryFolderBase buildFolder(DataRow row) | 528 | private InventoryFolderBase buildFolder(DataRow row) |
530 | { | 529 | { |
531 | InventoryFolderBase folder = new InventoryFolderBase(); | 530 | InventoryFolderBase folder = new InventoryFolderBase(); |
532 | folder.folderID = new LLUUID((string)row["UUID"]); | 531 | folder.folderID = new LLUUID((string) row["UUID"]); |
533 | folder.name = (string)row["name"]; | 532 | folder.name = (string) row["name"]; |
534 | folder.agentID = new LLUUID((string)row["agentID"]); | 533 | folder.agentID = new LLUUID((string) row["agentID"]); |
535 | folder.parentID = new LLUUID((string)row["parentID"]); | 534 | folder.parentID = new LLUUID((string) row["parentID"]); |
536 | folder.type = Convert.ToInt16(row["type"]); | 535 | folder.type = Convert.ToInt16(row["type"]); |
537 | folder.version = Convert.ToUInt16(row["version"]); | 536 | folder.version = Convert.ToUInt16(row["version"]); |
538 | return folder; | 537 | return folder; |
@@ -554,17 +553,18 @@ namespace OpenSim.Framework.Data.SQLite | |||
554 | * Test and Initialization code | 553 | * Test and Initialization code |
555 | * | 554 | * |
556 | **********************************************************************/ | 555 | **********************************************************************/ |
556 | |||
557 | private void InitDB(SqliteConnection conn) | 557 | private void InitDB(SqliteConnection conn) |
558 | { | 558 | { |
559 | string createInventoryItems = defineTable(createInventoryItemsTable()); | 559 | string createInventoryItems = defineTable(createInventoryItemsTable()); |
560 | string createInventoryFolders = defineTable(createInventoryFoldersTable()); | 560 | string createInventoryFolders = defineTable(createInventoryFoldersTable()); |
561 | 561 | ||
562 | SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn); | 562 | SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn); |
563 | SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn); | 563 | SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn); |
564 | conn.Open(); | 564 | conn.Open(); |
565 | pcmd.ExecuteNonQuery(); | 565 | pcmd.ExecuteNonQuery(); |
566 | scmd.ExecuteNonQuery(); | 566 | scmd.ExecuteNonQuery(); |
567 | conn.Close(); | 567 | conn.Close(); |
568 | } | 568 | } |
569 | 569 | ||
570 | private bool TestTables(SqliteConnection conn) | 570 | private bool TestTables(SqliteConnection conn) |
@@ -575,10 +575,13 @@ namespace OpenSim.Framework.Data.SQLite | |||
575 | SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd); | 575 | SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd); |
576 | 576 | ||
577 | DataSet tmpDS = new DataSet(); | 577 | DataSet tmpDS = new DataSet(); |
578 | try { | 578 | try |
579 | { | ||
579 | pDa.Fill(tmpDS, "inventoryitems"); | 580 | pDa.Fill(tmpDS, "inventoryitems"); |
580 | sDa.Fill(tmpDS, "inventoryfolders"); | 581 | sDa.Fill(tmpDS, "inventoryfolders"); |
581 | } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { | 582 | } |
583 | catch (SqliteSyntaxException) | ||
584 | { | ||
582 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | 585 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); |
583 | InitDB(conn); | 586 | InitDB(conn); |
584 | } | 587 | } |
@@ -586,14 +589,18 @@ namespace OpenSim.Framework.Data.SQLite | |||
586 | pDa.Fill(tmpDS, "inventoryitems"); | 589 | pDa.Fill(tmpDS, "inventoryitems"); |
587 | sDa.Fill(tmpDS, "inventoryfolders"); | 590 | sDa.Fill(tmpDS, "inventoryfolders"); |
588 | 591 | ||
589 | foreach (DataColumn col in createInventoryItemsTable().Columns) { | 592 | foreach (DataColumn col in createInventoryItemsTable().Columns) |
590 | if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName) ) { | 593 | { |
594 | if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName)) | ||
595 | { | ||
591 | MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); | 596 | MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); |
592 | return false; | 597 | return false; |
593 | } | 598 | } |
594 | } | 599 | } |
595 | foreach (DataColumn col in createInventoryFoldersTable().Columns) { | 600 | foreach (DataColumn col in createInventoryFoldersTable().Columns) |
596 | if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName) ) { | 601 | { |
602 | if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName)) | ||
603 | { | ||
597 | MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); | 604 | MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); |
598 | return false; | 605 | return false; |
599 | } | 606 | } |
@@ -601,8 +608,4 @@ namespace OpenSim.Framework.Data.SQLite | |||
601 | return true; | 608 | return true; |
602 | } | 609 | } |
603 | } | 610 | } |
604 | } | 611 | } \ No newline at end of file |
605 | |||
606 | |||
607 | |||
608 | |||
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index 5954fba..e102da3 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs | |||
@@ -30,13 +30,14 @@ using System.Collections.Generic; | |||
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Data.SQLite; | 31 | using System.Data.SQLite; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using Mono.Data.SqliteClient; | ||
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
34 | 35 | ||
35 | namespace OpenSim.Framework.Data.SQLite | 36 | namespace OpenSim.Framework.Data.SQLite |
36 | { | 37 | { |
37 | class SQLiteManager : SQLiteBase | 38 | internal class SQLiteManager : SQLiteBase |
38 | { | 39 | { |
39 | IDbConnection dbcon; | 40 | private IDbConnection dbcon; |
40 | 41 | ||
41 | /// <summary> | 42 | /// <summary> |
42 | /// Initialises and creates a new SQLite connection and maintains it. | 43 | /// Initialises and creates a new SQLite connection and maintains it. |
@@ -78,15 +79,15 @@ namespace OpenSim.Framework.Data.SQLite | |||
78 | /// <returns>A SQLite DB Command</returns> | 79 | /// <returns>A SQLite DB Command</returns> |
79 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 80 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) |
80 | { | 81 | { |
81 | SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); | 82 | SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand(); |
82 | dbcommand.CommandText = sql; | 83 | dbcommand.CommandText = sql; |
83 | foreach (KeyValuePair<string, string> param in parameters) | 84 | foreach (KeyValuePair<string, string> param in parameters) |
84 | { | 85 | { |
85 | SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); | 86 | SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value); |
86 | dbcommand.Parameters.Add(paramx); | 87 | dbcommand.Parameters.Add(paramx); |
87 | } | 88 | } |
88 | 89 | ||
89 | return (IDbCommand)dbcommand; | 90 | return (IDbCommand) dbcommand; |
90 | } | 91 | } |
91 | 92 | ||
92 | private bool TestTables(SQLiteConnection conn) | 93 | private bool TestTables(SQLiteConnection conn) |
@@ -98,7 +99,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
98 | { | 99 | { |
99 | pDa.Fill(tmpDS, "regions"); | 100 | pDa.Fill(tmpDS, "regions"); |
100 | } | 101 | } |
101 | catch (Mono.Data.SqliteClient.SqliteSyntaxException) | 102 | catch (SqliteSyntaxException) |
102 | { | 103 | { |
103 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | 104 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); |
104 | InitDB(conn); | 105 | InitDB(conn); |
@@ -110,39 +111,39 @@ namespace OpenSim.Framework.Data.SQLite | |||
110 | { | 111 | { |
111 | DataTable regions = new DataTable("regions"); | 112 | DataTable regions = new DataTable("regions"); |
112 | 113 | ||
113 | createCol(regions, "regionHandle", typeof(ulong)); | 114 | createCol(regions, "regionHandle", typeof (ulong)); |
114 | createCol(regions, "regionName", typeof(System.String)); | 115 | createCol(regions, "regionName", typeof (String)); |
115 | createCol(regions, "uuid", typeof(System.String)); | 116 | createCol(regions, "uuid", typeof (String)); |
116 | 117 | ||
117 | createCol(regions, "regionRecvKey", typeof(System.String)); | 118 | createCol(regions, "regionRecvKey", typeof (String)); |
118 | createCol(regions, "regionSecret", typeof(System.String)); | 119 | createCol(regions, "regionSecret", typeof (String)); |
119 | createCol(regions, "regionSendKey", typeof(System.String)); | 120 | createCol(regions, "regionSendKey", typeof (String)); |
120 | 121 | ||
121 | createCol(regions, "regionDataURI", typeof(System.String)); | 122 | createCol(regions, "regionDataURI", typeof (String)); |
122 | createCol(regions, "serverIP", typeof(System.String)); | 123 | createCol(regions, "serverIP", typeof (String)); |
123 | createCol(regions, "serverPort", typeof(System.String)); | 124 | createCol(regions, "serverPort", typeof (String)); |
124 | createCol(regions, "serverURI", typeof(System.String)); | 125 | createCol(regions, "serverURI", typeof (String)); |
125 | 126 | ||
126 | 127 | ||
127 | createCol(regions, "locX", typeof( uint)); | 128 | createCol(regions, "locX", typeof (uint)); |
128 | createCol(regions, "locY", typeof( uint)); | 129 | createCol(regions, "locY", typeof (uint)); |
129 | createCol(regions, "locZ", typeof( uint)); | 130 | createCol(regions, "locZ", typeof (uint)); |
130 | 131 | ||
131 | createCol(regions, "eastOverrideHandle", typeof( ulong )); | 132 | createCol(regions, "eastOverrideHandle", typeof (ulong)); |
132 | createCol(regions, "westOverrideHandle", typeof( ulong )); | 133 | createCol(regions, "westOverrideHandle", typeof (ulong)); |
133 | createCol(regions, "southOverrideHandle", typeof( ulong )); | 134 | createCol(regions, "southOverrideHandle", typeof (ulong)); |
134 | createCol(regions, "northOverrideHandle", typeof( ulong )); | 135 | createCol(regions, "northOverrideHandle", typeof (ulong)); |
135 | 136 | ||
136 | createCol(regions, "regionAssetURI", typeof(System.String)); | 137 | createCol(regions, "regionAssetURI", typeof (String)); |
137 | createCol(regions, "regionAssetRecvKey", typeof(System.String)); | 138 | createCol(regions, "regionAssetRecvKey", typeof (String)); |
138 | createCol(regions, "regionAssetSendKey", typeof(System.String)); | 139 | createCol(regions, "regionAssetSendKey", typeof (String)); |
139 | 140 | ||
140 | createCol(regions, "regionUserURI", typeof(System.String)); | 141 | createCol(regions, "regionUserURI", typeof (String)); |
141 | createCol(regions, "regionUserRecvKey", typeof(System.String)); | 142 | createCol(regions, "regionUserRecvKey", typeof (String)); |
142 | createCol(regions, "regionUserSendKey", typeof(System.String)); | 143 | createCol(regions, "regionUserSendKey", typeof (String)); |
143 | 144 | ||
144 | // Add in contraints | 145 | // Add in contraints |
145 | regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; | 146 | regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]}; |
146 | return regions; | 147 | return regions; |
147 | } | 148 | } |
148 | 149 | ||
@@ -168,42 +169,42 @@ namespace OpenSim.Framework.Data.SQLite | |||
168 | if (reader.Read()) | 169 | if (reader.Read()) |
169 | { | 170 | { |
170 | // Region Main | 171 | // Region Main |
171 | retval.regionHandle = (ulong)reader["regionHandle"]; | 172 | retval.regionHandle = (ulong) reader["regionHandle"]; |
172 | retval.regionName = (string)reader["regionName"]; | 173 | retval.regionName = (string) reader["regionName"]; |
173 | retval.UUID = new LLUUID((string)reader["uuid"]); | 174 | retval.UUID = new LLUUID((string) reader["uuid"]); |
174 | 175 | ||
175 | // Secrets | 176 | // Secrets |
176 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | 177 | retval.regionRecvKey = (string) reader["regionRecvKey"]; |
177 | retval.regionSecret = (string)reader["regionSecret"]; | 178 | retval.regionSecret = (string) reader["regionSecret"]; |
178 | retval.regionSendKey = (string)reader["regionSendKey"]; | 179 | retval.regionSendKey = (string) reader["regionSendKey"]; |
179 | 180 | ||
180 | // Region Server | 181 | // Region Server |
181 | retval.regionDataURI = (string)reader["regionDataURI"]; | 182 | retval.regionDataURI = (string) reader["regionDataURI"]; |
182 | retval.regionOnline = false; // Needs to be pinged before this can be set. | 183 | retval.regionOnline = false; // Needs to be pinged before this can be set. |
183 | retval.serverIP = (string)reader["serverIP"]; | 184 | retval.serverIP = (string) reader["serverIP"]; |
184 | retval.serverPort = (uint)reader["serverPort"]; | 185 | retval.serverPort = (uint) reader["serverPort"]; |
185 | retval.serverURI = (string)reader["serverURI"]; | 186 | retval.serverURI = (string) reader["serverURI"]; |
186 | 187 | ||
187 | // Location | 188 | // Location |
188 | retval.regionLocX = (uint)((int)reader["locX"]); | 189 | retval.regionLocX = (uint) ((int) reader["locX"]); |
189 | retval.regionLocY = (uint)((int)reader["locY"]); | 190 | retval.regionLocY = (uint) ((int) reader["locY"]); |
190 | retval.regionLocZ = (uint)((int)reader["locZ"]); | 191 | retval.regionLocZ = (uint) ((int) reader["locZ"]); |
191 | 192 | ||
192 | // Neighbours - 0 = No Override | 193 | // Neighbours - 0 = No Override |
193 | retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | 194 | retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"]; |
194 | retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | 195 | retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"]; |
195 | retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | 196 | retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"]; |
196 | retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | 197 | retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"]; |
197 | 198 | ||
198 | // Assets | 199 | // Assets |
199 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | 200 | retval.regionAssetURI = (string) reader["regionAssetURI"]; |
200 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 201 | retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; |
201 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 202 | retval.regionAssetSendKey = (string) reader["regionAssetSendKey"]; |
202 | 203 | ||
203 | // Userserver | 204 | // Userserver |
204 | retval.regionUserURI = (string)reader["regionUserURI"]; | 205 | retval.regionUserURI = (string) reader["regionUserURI"]; |
205 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 206 | retval.regionUserRecvKey = (string) reader["regionUserRecvKey"]; |
206 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | 207 | retval.regionUserSendKey = (string) reader["regionUserSendKey"]; |
207 | } | 208 | } |
208 | else | 209 | else |
209 | { | 210 | { |
@@ -219,12 +220,15 @@ namespace OpenSim.Framework.Data.SQLite | |||
219 | /// <returns>Success?</returns> | 220 | /// <returns>Success?</returns> |
220 | public bool insertRow(RegionProfileData profile) | 221 | public bool insertRow(RegionProfileData profile) |
221 | { | 222 | { |
222 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 223 | string sql = |
223 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | 224 | "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |
225 | sql += | ||
226 | "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
224 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | 227 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; |
225 | 228 | ||
226 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | 229 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; |
227 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | 230 | sql += |
231 | "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
228 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | 232 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; |
229 | 233 | ||
230 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 234 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
@@ -271,4 +275,4 @@ namespace OpenSim.Framework.Data.SQLite | |||
271 | return returnval; | 275 | return returnval; |
272 | } | 276 | } |
273 | } | 277 | } |
274 | } | 278 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index 37a8be5..d7a6b39 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | |||
@@ -26,12 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using libsecondlife; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework; | ||
33 | using System.Data; | 29 | using System.Data; |
34 | using System.Data.SqlTypes; | 30 | using libsecondlife; |
35 | using Mono.Data.SqliteClient; | 31 | using Mono.Data.SqliteClient; |
36 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
37 | 33 | ||
@@ -45,30 +41,31 @@ namespace OpenSim.Framework.Data.SQLite | |||
45 | /// <summary> | 41 | /// <summary> |
46 | /// The database manager | 42 | /// The database manager |
47 | /// </summary> | 43 | /// </summary> |
48 | |||
49 | /// <summary> | 44 | /// <summary> |
50 | /// Artificial constructor called upon plugin load | 45 | /// Artificial constructor called upon plugin load |
51 | /// </summary> | 46 | /// </summary> |
52 | private const string userSelect = "select * from users"; | 47 | private const string userSelect = "select * from users"; |
48 | |||
53 | private DataSet ds; | 49 | private DataSet ds; |
54 | private SqliteDataAdapter da; | 50 | private SqliteDataAdapter da; |
55 | 51 | ||
56 | public void Initialise() | 52 | public void Initialise() |
57 | { | 53 | { |
58 | SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); | 54 | SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); |
59 | TestTables(conn); | 55 | TestTables(conn); |
60 | 56 | ||
61 | ds = new DataSet(); | 57 | ds = new DataSet(); |
62 | da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); | 58 | da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); |
63 | 59 | ||
64 | lock (ds) { | 60 | lock (ds) |
61 | { | ||
65 | ds.Tables.Add(createUsersTable()); | 62 | ds.Tables.Add(createUsersTable()); |
66 | ds.Tables.Add(createUserAgentsTable()); | 63 | ds.Tables.Add(createUserAgentsTable()); |
67 | 64 | ||
68 | setupUserCommands(da, conn); | 65 | setupUserCommands(da, conn); |
69 | da.Fill(ds.Tables["users"]); | 66 | da.Fill(ds.Tables["users"]); |
70 | } | 67 | } |
71 | 68 | ||
72 | return; | 69 | return; |
73 | } | 70 | } |
74 | 71 | ||
@@ -79,16 +76,21 @@ namespace OpenSim.Framework.Data.SQLite | |||
79 | /// <returns>A user profile</returns> | 76 | /// <returns>A user profile</returns> |
80 | public UserProfileData GetUserByUUID(LLUUID uuid) | 77 | public UserProfileData GetUserByUUID(LLUUID uuid) |
81 | { | 78 | { |
82 | lock (ds) { | 79 | lock (ds) |
80 | { | ||
83 | DataRow row = ds.Tables["users"].Rows.Find(uuid); | 81 | DataRow row = ds.Tables["users"].Rows.Find(uuid); |
84 | if(row != null) { | 82 | if (row != null) |
83 | { | ||
85 | UserProfileData user = buildUserProfile(row); | 84 | UserProfileData user = buildUserProfile(row); |
86 | row = ds.Tables["useragents"].Rows.Find(uuid); | 85 | row = ds.Tables["useragents"].Rows.Find(uuid); |
87 | if(row != null) { | 86 | if (row != null) |
87 | { | ||
88 | user.currentAgent = buildUserAgent(row); | 88 | user.currentAgent = buildUserAgent(row); |
89 | } | 89 | } |
90 | return user; | 90 | return user; |
91 | } else { | 91 | } |
92 | else | ||
93 | { | ||
92 | return null; | 94 | return null; |
93 | } | 95 | } |
94 | } | 96 | } |
@@ -113,16 +115,21 @@ namespace OpenSim.Framework.Data.SQLite | |||
113 | public UserProfileData GetUserByName(string fname, string lname) | 115 | public UserProfileData GetUserByName(string fname, string lname) |
114 | { | 116 | { |
115 | string select = "surname = '" + lname + "' and username = '" + fname + "'"; | 117 | string select = "surname = '" + lname + "' and username = '" + fname + "'"; |
116 | lock (ds) { | 118 | lock (ds) |
119 | { | ||
117 | DataRow[] rows = ds.Tables["users"].Select(select); | 120 | DataRow[] rows = ds.Tables["users"].Select(select); |
118 | if(rows.Length > 0) { | 121 | if (rows.Length > 0) |
122 | { | ||
119 | UserProfileData user = buildUserProfile(rows[0]); | 123 | UserProfileData user = buildUserProfile(rows[0]); |
120 | DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID); | 124 | DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID); |
121 | if(row != null) { | 125 | if (row != null) |
126 | { | ||
122 | user.currentAgent = buildUserAgent(row); | 127 | user.currentAgent = buildUserAgent(row); |
123 | } | 128 | } |
124 | return user; | 129 | return user; |
125 | } else { | 130 | } |
131 | else | ||
132 | { | ||
126 | return null; | 133 | return null; |
127 | } | 134 | } |
128 | } | 135 | } |
@@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
134 | /// <param name="uuid">The users account ID</param> | 141 | /// <param name="uuid">The users account ID</param> |
135 | /// <returns>A matching users profile</returns> | 142 | /// <returns>A matching users profile</returns> |
136 | public UserAgentData GetAgentByUUID(LLUUID uuid) | 143 | public UserAgentData GetAgentByUUID(LLUUID uuid) |
137 | { | 144 | { |
138 | try | 145 | try |
139 | { | 146 | { |
140 | return GetUserByUUID(uuid).currentAgent; | 147 | return GetUserByUUID(uuid).currentAgent; |
@@ -165,7 +172,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
165 | { | 172 | { |
166 | try | 173 | try |
167 | { | 174 | { |
168 | return GetUserByName(fname,lname).currentAgent; | 175 | return GetUserByName(fname, lname).currentAgent; |
169 | } | 176 | } |
170 | catch (Exception) | 177 | catch (Exception) |
171 | { | 178 | { |
@@ -180,8 +187,9 @@ namespace OpenSim.Framework.Data.SQLite | |||
180 | public void AddNewUserProfile(UserProfileData user) | 187 | public void AddNewUserProfile(UserProfileData user) |
181 | { | 188 | { |
182 | DataTable users = ds.Tables["users"]; | 189 | DataTable users = ds.Tables["users"]; |
183 | lock (ds) { | 190 | lock (ds) |
184 | DataRow row = users.Rows.Find(user.UUID); | 191 | { |
192 | DataRow row = users.Rows.Find(user.UUID); | ||
185 | if (row == null) | 193 | if (row == null) |
186 | { | 194 | { |
187 | row = users.NewRow(); | 195 | row = users.NewRow(); |
@@ -192,10 +200,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
192 | { | 200 | { |
193 | fillUserRow(row, user); | 201 | fillUserRow(row, user); |
194 | } | 202 | } |
195 | 203 | ||
196 | if(user.currentAgent != null) { | 204 | if (user.currentAgent != null) |
205 | { | ||
197 | DataTable ua = ds.Tables["useragents"]; | 206 | DataTable ua = ds.Tables["useragents"]; |
198 | row = ua.Rows.Find(user.UUID); | 207 | row = ua.Rows.Find(user.UUID); |
199 | if (row == null) | 208 | if (row == null) |
200 | { | 209 | { |
201 | row = ua.NewRow(); | 210 | row = ua.NewRow(); |
@@ -207,12 +216,13 @@ namespace OpenSim.Framework.Data.SQLite | |||
207 | fillUserAgentRow(row, user.currentAgent); | 216 | fillUserAgentRow(row, user.currentAgent); |
208 | } | 217 | } |
209 | } | 218 | } |
210 | MainLog.Instance.Verbose("SQLITE", "Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored"); | 219 | MainLog.Instance.Verbose("SQLITE", |
220 | "Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored"); | ||
211 | // save changes off to disk | 221 | // save changes off to disk |
212 | da.Update(ds, "users"); | 222 | da.Update(ds, "users"); |
213 | } | 223 | } |
214 | } | 224 | } |
215 | 225 | ||
216 | /// <summary> | 226 | /// <summary> |
217 | /// Creates a new user profile | 227 | /// Creates a new user profile |
218 | /// </summary> | 228 | /// </summary> |
@@ -220,10 +230,13 @@ namespace OpenSim.Framework.Data.SQLite | |||
220 | /// <returns>True on success, false on error</returns> | 230 | /// <returns>True on success, false on error</returns> |
221 | public bool UpdateUserProfile(UserProfileData user) | 231 | public bool UpdateUserProfile(UserProfileData user) |
222 | { | 232 | { |
223 | try { | 233 | try |
234 | { | ||
224 | AddNewUserProfile(user); | 235 | AddNewUserProfile(user); |
225 | return true; | 236 | return true; |
226 | } catch (Exception) { | 237 | } |
238 | catch (Exception) | ||
239 | { | ||
227 | return false; | 240 | return false; |
228 | } | 241 | } |
229 | } | 242 | } |
@@ -279,51 +292,51 @@ namespace OpenSim.Framework.Data.SQLite | |||
279 | { | 292 | { |
280 | return "0.1"; | 293 | return "0.1"; |
281 | } | 294 | } |
282 | 295 | ||
283 | /*********************************************************************** | 296 | /*********************************************************************** |
284 | * | 297 | * |
285 | * DataTable creation | 298 | * DataTable creation |
286 | * | 299 | * |
287 | **********************************************************************/ | 300 | **********************************************************************/ |
288 | /*********************************************************************** | 301 | /*********************************************************************** |
289 | * | 302 | * |
290 | * Database Definition Functions | 303 | * Database Definition Functions |
291 | * | 304 | * |
292 | * This should be db agnostic as we define them in ADO.NET terms | 305 | * This should be db agnostic as we define them in ADO.NET terms |
293 | * | 306 | * |
294 | **********************************************************************/ | 307 | **********************************************************************/ |
295 | 308 | ||
296 | private DataTable createUsersTable() | 309 | private DataTable createUsersTable() |
297 | { | 310 | { |
298 | DataTable users = new DataTable("users"); | 311 | DataTable users = new DataTable("users"); |
299 | 312 | ||
300 | createCol(users, "UUID", typeof(System.String)); | 313 | createCol(users, "UUID", typeof (String)); |
301 | createCol(users, "username", typeof(System.String)); | 314 | createCol(users, "username", typeof (String)); |
302 | createCol(users, "surname", typeof(System.String)); | 315 | createCol(users, "surname", typeof (String)); |
303 | createCol(users, "passwordHash", typeof(System.String)); | 316 | createCol(users, "passwordHash", typeof (String)); |
304 | createCol(users, "passwordSalt", typeof(System.String)); | 317 | createCol(users, "passwordSalt", typeof (String)); |
305 | 318 | ||
306 | createCol(users, "homeRegionX", typeof(System.Int32)); | 319 | createCol(users, "homeRegionX", typeof (Int32)); |
307 | createCol(users, "homeRegionY", typeof(System.Int32)); | 320 | createCol(users, "homeRegionY", typeof (Int32)); |
308 | createCol(users, "homeLocationX", typeof(System.Double)); | 321 | createCol(users, "homeLocationX", typeof (Double)); |
309 | createCol(users, "homeLocationY", typeof(System.Double)); | 322 | createCol(users, "homeLocationY", typeof (Double)); |
310 | createCol(users, "homeLocationZ", typeof(System.Double)); | 323 | createCol(users, "homeLocationZ", typeof (Double)); |
311 | createCol(users, "homeLookAtX", typeof(System.Double)); | 324 | createCol(users, "homeLookAtX", typeof (Double)); |
312 | createCol(users, "homeLookAtY", typeof(System.Double)); | 325 | createCol(users, "homeLookAtY", typeof (Double)); |
313 | createCol(users, "homeLookAtZ", typeof(System.Double)); | 326 | createCol(users, "homeLookAtZ", typeof (Double)); |
314 | createCol(users, "created", typeof(System.Int32)); | 327 | createCol(users, "created", typeof (Int32)); |
315 | createCol(users, "lastLogin", typeof(System.Int32)); | 328 | createCol(users, "lastLogin", typeof (Int32)); |
316 | createCol(users, "rootInventoryFolderID", typeof(System.String)); | 329 | createCol(users, "rootInventoryFolderID", typeof (String)); |
317 | createCol(users, "userInventoryURI", typeof(System.String)); | 330 | createCol(users, "userInventoryURI", typeof (String)); |
318 | createCol(users, "userAssetURI", typeof(System.String)); | 331 | createCol(users, "userAssetURI", typeof (String)); |
319 | createCol(users, "profileCanDoMask", typeof(System.Int32)); | 332 | createCol(users, "profileCanDoMask", typeof (Int32)); |
320 | createCol(users, "profileWantDoMask", typeof(System.Int32)); | 333 | createCol(users, "profileWantDoMask", typeof (Int32)); |
321 | createCol(users, "profileAboutText", typeof(System.String)); | 334 | createCol(users, "profileAboutText", typeof (String)); |
322 | createCol(users, "profileFirstText", typeof(System.String)); | 335 | createCol(users, "profileFirstText", typeof (String)); |
323 | createCol(users, "profileImage", typeof(System.String)); | 336 | createCol(users, "profileImage", typeof (String)); |
324 | createCol(users, "profileFirstImage", typeof(System.String)); | 337 | createCol(users, "profileFirstImage", typeof (String)); |
325 | // Add in contraints | 338 | // Add in contraints |
326 | users.PrimaryKey = new DataColumn[] { users.Columns["UUID"] }; | 339 | users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]}; |
327 | return users; | 340 | return users; |
328 | } | 341 | } |
329 | 342 | ||
@@ -331,27 +344,27 @@ namespace OpenSim.Framework.Data.SQLite | |||
331 | { | 344 | { |
332 | DataTable ua = new DataTable("useragents"); | 345 | DataTable ua = new DataTable("useragents"); |
333 | // this is the UUID of the user | 346 | // this is the UUID of the user |
334 | createCol(ua, "UUID", typeof(System.String)); | 347 | createCol(ua, "UUID", typeof (String)); |
335 | createCol(ua, "agentIP", typeof(System.String)); | 348 | createCol(ua, "agentIP", typeof (String)); |
336 | createCol(ua, "agentPort", typeof(System.Int32)); | 349 | createCol(ua, "agentPort", typeof (Int32)); |
337 | createCol(ua, "agentOnline", typeof(System.Boolean)); | 350 | createCol(ua, "agentOnline", typeof (Boolean)); |
338 | createCol(ua, "sessionID", typeof(System.String)); | 351 | createCol(ua, "sessionID", typeof (String)); |
339 | createCol(ua, "secureSessionID", typeof(System.String)); | 352 | createCol(ua, "secureSessionID", typeof (String)); |
340 | createCol(ua, "regionID", typeof(System.String)); | 353 | createCol(ua, "regionID", typeof (String)); |
341 | createCol(ua, "loginTime", typeof(System.Int32)); | 354 | createCol(ua, "loginTime", typeof (Int32)); |
342 | createCol(ua, "logoutTime", typeof(System.Int32)); | 355 | createCol(ua, "logoutTime", typeof (Int32)); |
343 | createCol(ua, "currentRegion", typeof(System.String)); | 356 | createCol(ua, "currentRegion", typeof (String)); |
344 | createCol(ua, "currentHandle", typeof(System.Int32)); | 357 | createCol(ua, "currentHandle", typeof (Int32)); |
345 | // vectors | 358 | // vectors |
346 | createCol(ua, "currentPosX", typeof(System.Double)); | 359 | createCol(ua, "currentPosX", typeof (Double)); |
347 | createCol(ua, "currentPosY", typeof(System.Double)); | 360 | createCol(ua, "currentPosY", typeof (Double)); |
348 | createCol(ua, "currentPosZ", typeof(System.Double)); | 361 | createCol(ua, "currentPosZ", typeof (Double)); |
349 | // constraints | 362 | // constraints |
350 | ua.PrimaryKey = new DataColumn[] { ua.Columns["UUID"] }; | 363 | ua.PrimaryKey = new DataColumn[] {ua.Columns["UUID"]}; |
351 | 364 | ||
352 | return ua; | 365 | return ua; |
353 | } | 366 | } |
354 | 367 | ||
355 | /*********************************************************************** | 368 | /*********************************************************************** |
356 | * | 369 | * |
357 | * Convert between ADO.NET <=> OpenSim Objects | 370 | * Convert between ADO.NET <=> OpenSim Objects |
@@ -366,35 +379,35 @@ namespace OpenSim.Framework.Data.SQLite | |||
366 | // interesting has to be done to actually get these values | 379 | // interesting has to be done to actually get these values |
367 | // back out. Not enough time to figure it out yet. | 380 | // back out. Not enough time to figure it out yet. |
368 | UserProfileData user = new UserProfileData(); | 381 | UserProfileData user = new UserProfileData(); |
369 | user.UUID = new LLUUID((String)row["UUID"]); | 382 | user.UUID = new LLUUID((String) row["UUID"]); |
370 | user.username = (String)row["username"]; | 383 | user.username = (String) row["username"]; |
371 | user.surname = (String)row["surname"]; | 384 | user.surname = (String) row["surname"]; |
372 | user.passwordHash = (String)row["passwordHash"]; | 385 | user.passwordHash = (String) row["passwordHash"]; |
373 | user.passwordSalt = (String)row["passwordSalt"]; | 386 | user.passwordSalt = (String) row["passwordSalt"]; |
374 | 387 | ||
375 | user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); | 388 | user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); |
376 | user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); | 389 | user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); |
377 | user.homeLocation = new LLVector3( | 390 | user.homeLocation = new LLVector3( |
378 | Convert.ToSingle(row["homeLocationX"]), | 391 | Convert.ToSingle(row["homeLocationX"]), |
379 | Convert.ToSingle(row["homeLocationY"]), | 392 | Convert.ToSingle(row["homeLocationY"]), |
380 | Convert.ToSingle(row["homeLocationZ"]) | 393 | Convert.ToSingle(row["homeLocationZ"]) |
381 | ); | 394 | ); |
382 | user.homeLookAt = new LLVector3( | 395 | user.homeLookAt = new LLVector3( |
383 | Convert.ToSingle(row["homeLookAtX"]), | 396 | Convert.ToSingle(row["homeLookAtX"]), |
384 | Convert.ToSingle(row["homeLookAtY"]), | 397 | Convert.ToSingle(row["homeLookAtY"]), |
385 | Convert.ToSingle(row["homeLookAtZ"]) | 398 | Convert.ToSingle(row["homeLookAtZ"]) |
386 | ); | 399 | ); |
387 | user.created = Convert.ToInt32(row["created"]); | 400 | user.created = Convert.ToInt32(row["created"]); |
388 | user.lastLogin = Convert.ToInt32(row["lastLogin"]); | 401 | user.lastLogin = Convert.ToInt32(row["lastLogin"]); |
389 | user.rootInventoryFolderID = new LLUUID((String)row["rootInventoryFolderID"]); | 402 | user.rootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]); |
390 | user.userInventoryURI = (String)row["userInventoryURI"]; | 403 | user.userInventoryURI = (String) row["userInventoryURI"]; |
391 | user.userAssetURI = (String)row["userAssetURI"]; | 404 | user.userAssetURI = (String) row["userAssetURI"]; |
392 | user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); | 405 | user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); |
393 | user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); | 406 | user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); |
394 | user.profileAboutText = (String)row["profileAboutText"]; | 407 | user.profileAboutText = (String) row["profileAboutText"]; |
395 | user.profileFirstText = (String)row["profileFirstText"]; | 408 | user.profileFirstText = (String) row["profileFirstText"]; |
396 | user.profileImage = new LLUUID((String)row["profileImage"]); | 409 | user.profileImage = new LLUUID((String) row["profileImage"]); |
397 | user.profileFirstImage = new LLUUID((String)row["profileFirstImage"]); | 410 | user.profileFirstImage = new LLUUID((String) row["profileFirstImage"]); |
398 | return user; | 411 | return user; |
399 | } | 412 | } |
400 | 413 | ||
@@ -405,8 +418,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
405 | row["surname"] = user.surname; | 418 | row["surname"] = user.surname; |
406 | row["passwordHash"] = user.passwordHash; | 419 | row["passwordHash"] = user.passwordHash; |
407 | row["passwordSalt"] = user.passwordSalt; | 420 | row["passwordSalt"] = user.passwordSalt; |
408 | 421 | ||
409 | 422 | ||
410 | row["homeRegionX"] = user.homeRegionX; | 423 | row["homeRegionX"] = user.homeRegionX; |
411 | row["homeRegionY"] = user.homeRegionY; | 424 | row["homeRegionY"] = user.homeRegionY; |
412 | row["homeLocationX"] = user.homeLocation.X; | 425 | row["homeLocationX"] = user.homeLocation.X; |
@@ -427,10 +440,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
427 | row["profileFirstText"] = user.profileFirstText; | 440 | row["profileFirstText"] = user.profileFirstText; |
428 | row["profileImage"] = user.profileImage; | 441 | row["profileImage"] = user.profileImage; |
429 | row["profileFirstImage"] = user.profileFirstImage; | 442 | row["profileFirstImage"] = user.profileFirstImage; |
430 | 443 | ||
431 | // ADO.NET doesn't handle NULL very well | 444 | // ADO.NET doesn't handle NULL very well |
432 | foreach (DataColumn col in ds.Tables["users"].Columns) { | 445 | foreach (DataColumn col in ds.Tables["users"].Columns) |
433 | if (row[col] == null) { | 446 | { |
447 | if (row[col] == null) | ||
448 | { | ||
434 | row[col] = ""; | 449 | row[col] = ""; |
435 | } | 450 | } |
436 | } | 451 | } |
@@ -439,33 +454,33 @@ namespace OpenSim.Framework.Data.SQLite | |||
439 | private UserAgentData buildUserAgent(DataRow row) | 454 | private UserAgentData buildUserAgent(DataRow row) |
440 | { | 455 | { |
441 | UserAgentData ua = new UserAgentData(); | 456 | UserAgentData ua = new UserAgentData(); |
442 | 457 | ||
443 | ua.UUID = new LLUUID((String)row["UUID"]); | 458 | ua.UUID = new LLUUID((String) row["UUID"]); |
444 | ua.agentIP = (String)row["agentIP"]; | 459 | ua.agentIP = (String) row["agentIP"]; |
445 | ua.agentPort = Convert.ToUInt32(row["agentPort"]); | 460 | ua.agentPort = Convert.ToUInt32(row["agentPort"]); |
446 | ua.agentOnline = Convert.ToBoolean(row["agentOnline"]); | 461 | ua.agentOnline = Convert.ToBoolean(row["agentOnline"]); |
447 | ua.sessionID = new LLUUID((String)row["sessionID"]); | 462 | ua.sessionID = new LLUUID((String) row["sessionID"]); |
448 | ua.secureSessionID = new LLUUID((String)row["secureSessionID"]); | 463 | ua.secureSessionID = new LLUUID((String) row["secureSessionID"]); |
449 | ua.regionID = new LLUUID((String)row["regionID"]); | 464 | ua.regionID = new LLUUID((String) row["regionID"]); |
450 | ua.loginTime = Convert.ToInt32(row["loginTime"]); | 465 | ua.loginTime = Convert.ToInt32(row["loginTime"]); |
451 | ua.logoutTime = Convert.ToInt32(row["logoutTime"]); | 466 | ua.logoutTime = Convert.ToInt32(row["logoutTime"]); |
452 | ua.currentRegion = new LLUUID((String)row["currentRegion"]); | 467 | ua.currentRegion = new LLUUID((String) row["currentRegion"]); |
453 | ua.currentHandle = Convert.ToUInt32(row["currentHandle"]); | 468 | ua.currentHandle = Convert.ToUInt32(row["currentHandle"]); |
454 | ua.currentPos = new LLVector3( | 469 | ua.currentPos = new LLVector3( |
455 | Convert.ToSingle(row["currentPosX"]), | 470 | Convert.ToSingle(row["currentPosX"]), |
456 | Convert.ToSingle(row["currentPosY"]), | 471 | Convert.ToSingle(row["currentPosY"]), |
457 | Convert.ToSingle(row["currentPosZ"]) | 472 | Convert.ToSingle(row["currentPosZ"]) |
458 | ); | 473 | ); |
459 | return ua; | 474 | return ua; |
460 | } | 475 | } |
461 | 476 | ||
462 | private void fillUserAgentRow(DataRow row, UserAgentData ua) | 477 | private void fillUserAgentRow(DataRow row, UserAgentData ua) |
463 | { | 478 | { |
464 | row["UUID"] = ua.UUID; | 479 | row["UUID"] = ua.UUID; |
465 | row["agentIP"] = ua.agentIP; | 480 | row["agentIP"] = ua.agentIP; |
466 | row["agentPort"] = ua.agentPort; | 481 | row["agentPort"] = ua.agentPort; |
467 | row["agentOnline"] = ua.agentOnline; | 482 | row["agentOnline"] = ua.agentOnline; |
468 | row["sessionID"] = ua.sessionID; | 483 | row["sessionID"] = ua.sessionID; |
469 | row["secureSessionID"] = ua.secureSessionID; | 484 | row["secureSessionID"] = ua.secureSessionID; |
470 | row["regionID"] = ua.regionID; | 485 | row["regionID"] = ua.regionID; |
471 | row["loginTime"] = ua.loginTime; | 486 | row["loginTime"] = ua.loginTime; |
@@ -496,18 +511,18 @@ namespace OpenSim.Framework.Data.SQLite | |||
496 | da.UpdateCommand.Connection = conn; | 511 | da.UpdateCommand.Connection = conn; |
497 | 512 | ||
498 | SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID"); | 513 | SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID"); |
499 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); | 514 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); |
500 | delete.Connection = conn; | 515 | delete.Connection = conn; |
501 | da.DeleteCommand = delete; | 516 | da.DeleteCommand = delete; |
502 | } | 517 | } |
503 | 518 | ||
504 | private void InitDB(SqliteConnection conn) | 519 | private void InitDB(SqliteConnection conn) |
505 | { | 520 | { |
506 | string createUsers = defineTable(createUsersTable()); | 521 | string createUsers = defineTable(createUsersTable()); |
507 | SqliteCommand pcmd = new SqliteCommand(createUsers, conn); | 522 | SqliteCommand pcmd = new SqliteCommand(createUsers, conn); |
508 | conn.Open(); | 523 | conn.Open(); |
509 | pcmd.ExecuteNonQuery(); | 524 | pcmd.ExecuteNonQuery(); |
510 | conn.Close(); | 525 | conn.Close(); |
511 | } | 526 | } |
512 | 527 | ||
513 | private bool TestTables(SqliteConnection conn) | 528 | private bool TestTables(SqliteConnection conn) |
@@ -515,14 +530,16 @@ namespace OpenSim.Framework.Data.SQLite | |||
515 | SqliteCommand cmd = new SqliteCommand(userSelect, conn); | 530 | SqliteCommand cmd = new SqliteCommand(userSelect, conn); |
516 | SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); | 531 | SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); |
517 | DataSet tmpDS = new DataSet(); | 532 | DataSet tmpDS = new DataSet(); |
518 | try { | 533 | try |
534 | { | ||
519 | pDa.Fill(tmpDS, "users"); | 535 | pDa.Fill(tmpDS, "users"); |
520 | } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { | 536 | } |
537 | catch (SqliteSyntaxException) | ||
538 | { | ||
521 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | 539 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); |
522 | InitDB(conn); | 540 | InitDB(conn); |
523 | } | 541 | } |
524 | return true; | 542 | return true; |
525 | } | 543 | } |
526 | |||
527 | } | 544 | } |
528 | } | 545 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 2a5b8f6..b3b6ed7 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs | |||
@@ -106,6 +106,5 @@ namespace OpenSim.Framework.Data | |||
106 | DataResponse AddProfile(RegionProfileData profile); | 106 | DataResponse AddProfile(RegionProfileData profile); |
107 | 107 | ||
108 | ReservationData GetReservationAtPoint(uint x, uint y); | 108 | ReservationData GetReservationAtPoint(uint x, uint y); |
109 | |||
110 | } | 109 | } |
111 | } | 110 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs index b222a28..373d8e1 100644 --- a/OpenSim/Framework/Data/ILogData.cs +++ b/OpenSim/Framework/Data/ILogData.cs | |||
@@ -63,7 +63,9 @@ namespace OpenSim.Framework.Data | |||
63 | /// </summary> | 63 | /// </summary> |
64 | public interface ILogData | 64 | public interface ILogData |
65 | { | 65 | { |
66 | void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); | 66 | void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, |
67 | string logMessage); | ||
68 | |||
67 | /// <summary> | 69 | /// <summary> |
68 | /// Initialises the interface | 70 | /// Initialises the interface |
69 | /// </summary> | 71 | /// </summary> |
@@ -86,5 +88,4 @@ namespace OpenSim.Framework.Data | |||
86 | /// <returns>A string containing the plugin version</returns> | 88 | /// <returns>A string containing the plugin version</returns> |
87 | string getVersion(); | 89 | string getVersion(); |
88 | } | 90 | } |
89 | 91 | } \ No newline at end of file | |
90 | } | ||
diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs index f0f63b4..048b491 100644 --- a/OpenSim/Framework/Data/IniConfig.cs +++ b/OpenSim/Framework/Data/IniConfig.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Text.RegularExpressions; | 29 | using System.Text.RegularExpressions; |
30 | |||
30 | /* | 31 | /* |
31 | Taken from public code listing at by Alex Pinsker | 32 | Taken from public code listing at by Alex Pinsker |
32 | http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html | 33 | http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html |
@@ -52,7 +53,8 @@ namespace OpenSim.Framework.Data | |||
52 | RegexOptions.Compiled | | 53 | RegexOptions.Compiled | |
53 | RegexOptions.CultureInvariant); | 54 | RegexOptions.CultureInvariant); |
54 | } | 55 | } |
55 | static private Regex _iniKeyValuePatternRegex; | 56 | |
57 | private static Regex _iniKeyValuePatternRegex; | ||
56 | 58 | ||
57 | public IniFile(string iniFileName) | 59 | public IniFile(string iniFileName) |
58 | { | 60 | { |
@@ -62,7 +64,7 @@ namespace OpenSim.Framework.Data | |||
62 | public string ParseFileReadValue(string key) | 64 | public string ParseFileReadValue(string key) |
63 | { | 65 | { |
64 | using (StreamReader reader = | 66 | using (StreamReader reader = |
65 | new StreamReader(_iniFileName)) | 67 | new StreamReader(_iniFileName)) |
66 | { | 68 | { |
67 | do | 69 | do |
68 | { | 70 | { |
@@ -72,18 +74,16 @@ namespace OpenSim.Framework.Data | |||
72 | if (match.Success) | 74 | if (match.Success) |
73 | { | 75 | { |
74 | string currentKey = | 76 | string currentKey = |
75 | match.Groups["Key"].Value as string; | 77 | match.Groups["Key"].Value as string; |
76 | if (currentKey != null && | 78 | if (currentKey != null && |
77 | currentKey.Trim().CompareTo(key) == 0) | 79 | currentKey.Trim().CompareTo(key) == 0) |
78 | { | 80 | { |
79 | string value = | 81 | string value = |
80 | match.Groups["Value"].Value as string; | 82 | match.Groups["Value"].Value as string; |
81 | return value; | 83 | return value; |
82 | } | 84 | } |
83 | } | 85 | } |
84 | 86 | } while (reader.Peek() != -1); | |
85 | } | ||
86 | while (reader.Peek() != -1); | ||
87 | } | 87 | } |
88 | return null; | 88 | return null; |
89 | } | 89 | } |
@@ -91,6 +91,8 @@ namespace OpenSim.Framework.Data | |||
91 | public string IniFileName | 91 | public string IniFileName |
92 | { | 92 | { |
93 | get { return _iniFileName; } | 93 | get { return _iniFileName; } |
94 | } private string _iniFileName; | 94 | } |
95 | |||
96 | private string _iniFileName; | ||
95 | } | 97 | } |
96 | } | 98 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs index 556d589..51050d1 100644 --- a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Framework.Data")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Framework.Data")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] | 24 | |
25 | [assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index 5e5dac6..ab8771a 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs | |||
@@ -25,11 +25,11 @@ | |||
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 libsecondlife; | ||
29 | using Nwc.XmlRpc; | ||
30 | 28 | ||
31 | using System; | 29 | using System; |
32 | using System.Collections; | 30 | using System.Collections; |
31 | using libsecondlife; | ||
32 | using Nwc.XmlRpc; | ||
33 | 33 | ||
34 | namespace OpenSim.Framework.Data | 34 | namespace OpenSim.Framework.Data |
35 | { | 35 | { |
@@ -57,6 +57,7 @@ namespace OpenSim.Framework.Data | |||
57 | /// Coordinates of the region | 57 | /// Coordinates of the region |
58 | /// </summary> | 58 | /// </summary> |
59 | public uint regionLocX; | 59 | public uint regionLocX; |
60 | |||
60 | public uint regionLocY; | 61 | public uint regionLocY; |
61 | public uint regionLocZ; // Reserved (round-robin, layers, etc) | 62 | public uint regionLocZ; // Reserved (round-robin, layers, etc) |
62 | 63 | ||
@@ -65,6 +66,7 @@ namespace OpenSim.Framework.Data | |||
65 | /// </summary> | 66 | /// </summary> |
66 | /// <remarks>Not very secure, needs improvement.</remarks> | 67 | /// <remarks>Not very secure, needs improvement.</remarks> |
67 | public string regionSendKey = ""; | 68 | public string regionSendKey = ""; |
69 | |||
68 | public string regionRecvKey = ""; | 70 | public string regionRecvKey = ""; |
69 | public string regionSecret = ""; | 71 | public string regionSecret = ""; |
70 | 72 | ||
@@ -77,6 +79,7 @@ namespace OpenSim.Framework.Data | |||
77 | /// Information about the server that the region is currently hosted on | 79 | /// Information about the server that the region is currently hosted on |
78 | /// </summary> | 80 | /// </summary> |
79 | public string serverIP = ""; | 81 | public string serverIP = ""; |
82 | |||
80 | public uint serverPort; | 83 | public uint serverPort; |
81 | public string serverURI = ""; | 84 | public string serverURI = ""; |
82 | 85 | ||
@@ -88,6 +91,7 @@ namespace OpenSim.Framework.Data | |||
88 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. | 91 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. |
89 | /// </summary> | 92 | /// </summary> |
90 | public ulong regionNorthOverrideHandle; | 93 | public ulong regionNorthOverrideHandle; |
94 | |||
91 | public ulong regionSouthOverrideHandle; | 95 | public ulong regionSouthOverrideHandle; |
92 | public ulong regionEastOverrideHandle; | 96 | public ulong regionEastOverrideHandle; |
93 | public ulong regionWestOverrideHandle; | 97 | public ulong regionWestOverrideHandle; |
@@ -102,6 +106,7 @@ namespace OpenSim.Framework.Data | |||
102 | /// Region Asset Details | 106 | /// Region Asset Details |
103 | /// </summary> | 107 | /// </summary> |
104 | public string regionAssetURI = ""; | 108 | public string regionAssetURI = ""; |
109 | |||
105 | public string regionAssetSendKey = ""; | 110 | public string regionAssetSendKey = ""; |
106 | public string regionAssetRecvKey = ""; | 111 | public string regionAssetRecvKey = ""; |
107 | 112 | ||
@@ -109,6 +114,7 @@ namespace OpenSim.Framework.Data | |||
109 | /// Region Userserver Details | 114 | /// Region Userserver Details |
110 | /// </summary> | 115 | /// </summary> |
111 | public string regionUserURI = ""; | 116 | public string regionUserURI = ""; |
117 | |||
112 | public string regionUserSendKey = ""; | 118 | public string regionUserSendKey = ""; |
113 | public string regionUserRecvKey = ""; | 119 | public string regionUserRecvKey = ""; |
114 | 120 | ||
@@ -124,7 +130,8 @@ namespace OpenSim.Framework.Data | |||
124 | /// <param name="gridserver_url"></param> | 130 | /// <param name="gridserver_url"></param> |
125 | /// <param name="?"></param> | 131 | /// <param name="?"></param> |
126 | /// <returns></returns> | 132 | /// <returns></returns> |
127 | public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) | 133 | public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, |
134 | string gridserver_sendkey, string gridserver_recvkey) | ||
128 | { | 135 | { |
129 | Hashtable requestData = new Hashtable(); | 136 | Hashtable requestData = new Hashtable(); |
130 | requestData["region_uuid"] = region_uuid.UUID.ToString(); | 137 | requestData["region_uuid"] = region_uuid.UUID.ToString(); |
@@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data | |||
134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 141 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
135 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 142 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); |
136 | 143 | ||
137 | Hashtable responseData = (Hashtable)GridResp.Value; | 144 | Hashtable responseData = (Hashtable) GridResp.Value; |
138 | 145 | ||
139 | if (responseData.ContainsKey("error")) | 146 | if (responseData.ContainsKey("error")) |
140 | { | 147 | { |
@@ -142,21 +149,23 @@ namespace OpenSim.Framework.Data | |||
142 | } | 149 | } |
143 | 150 | ||
144 | RegionProfileData simData = new RegionProfileData(); | 151 | RegionProfileData simData = new RegionProfileData(); |
145 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | 152 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); |
146 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | 153 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); |
147 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); | 154 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256)); |
148 | simData.serverIP = (string)responseData["sim_ip"]; | 155 | simData.serverIP = (string) responseData["sim_ip"]; |
149 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | 156 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); |
150 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | 157 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); |
151 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 158 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); |
152 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 159 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; |
153 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 160 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
154 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | 161 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); |
155 | simData.regionName = (string)responseData["region_name"]; | 162 | simData.regionName = (string) responseData["region_name"]; |
156 | 163 | ||
157 | return simData; | 164 | return simData; |
158 | } | 165 | } |
159 | public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) | 166 | |
167 | public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, | ||
168 | string gridserver_sendkey, string gridserver_recvkey) | ||
160 | { | 169 | { |
161 | Hashtable requestData = new Hashtable(); | 170 | Hashtable requestData = new Hashtable(); |
162 | requestData["region_handle"] = region_handle.ToString(); | 171 | requestData["region_handle"] = region_handle.ToString(); |
@@ -166,7 +175,7 @@ namespace OpenSim.Framework.Data | |||
166 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 175 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
167 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 176 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); |
168 | 177 | ||
169 | Hashtable responseData = (Hashtable)GridResp.Value; | 178 | Hashtable responseData = (Hashtable) GridResp.Value; |
170 | 179 | ||
171 | if (responseData.ContainsKey("error")) | 180 | if (responseData.ContainsKey("error")) |
172 | { | 181 | { |
@@ -174,19 +183,19 @@ namespace OpenSim.Framework.Data | |||
174 | } | 183 | } |
175 | 184 | ||
176 | RegionProfileData simData = new RegionProfileData(); | 185 | RegionProfileData simData = new RegionProfileData(); |
177 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | 186 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); |
178 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | 187 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); |
179 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); | 188 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256)); |
180 | simData.serverIP = (string)responseData["sim_ip"]; | 189 | simData.serverIP = (string) responseData["sim_ip"]; |
181 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | 190 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); |
182 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | 191 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); |
183 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 192 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); |
184 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 193 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
185 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 194 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; |
186 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | 195 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); |
187 | simData.regionName = (string)responseData["region_name"]; | 196 | simData.regionName = (string) responseData["region_name"]; |
188 | 197 | ||
189 | return simData; | 198 | return simData; |
190 | } | 199 | } |
191 | } | 200 | } |
192 | } | 201 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs index 1e606ee..06adf04 100644 --- a/OpenSim/Framework/Data/ReservationData.cs +++ b/OpenSim/Framework/Data/ReservationData.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Data | |||
36 | public int reservationMinY = 0; | 36 | public int reservationMinY = 0; |
37 | public int reservationMaxX = 65536; | 37 | public int reservationMaxX = 65536; |
38 | public int reservationMaxY = 65536; | 38 | public int reservationMaxY = 65536; |
39 | 39 | ||
40 | public string reservationName = ""; | 40 | public string reservationName = ""; |
41 | public string reservationCompany = ""; | 41 | public string reservationCompany = ""; |
42 | public bool status = true; | 42 | public bool status = true; |
@@ -44,4 +44,4 @@ namespace OpenSim.Framework.Data | |||
44 | public string gridSendKey = ""; | 44 | public string gridSendKey = ""; |
45 | public string gridRecvKey = ""; | 45 | public string gridRecvKey = ""; |
46 | } | 46 | } |
47 | } | 47 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/ACL.cs b/OpenSim/Framework/General/ACL.cs index 348f0ae..0e9df19 100644 --- a/OpenSim/Framework/General/ACL.cs +++ b/OpenSim/Framework/General/ACL.cs | |||
@@ -27,7 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 30 | ||
32 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
33 | { | 32 | { |
@@ -37,15 +36,15 @@ namespace OpenSim.Framework | |||
37 | // permissions rather than just the first. Deny permissions will | 36 | // permissions rather than just the first. Deny permissions will |
38 | // override all others. | 37 | // override all others. |
39 | 38 | ||
40 | |||
41 | #region ACL Core Class | 39 | #region ACL Core Class |
40 | |||
42 | /// <summary> | 41 | /// <summary> |
43 | /// Access Control List Engine | 42 | /// Access Control List Engine |
44 | /// </summary> | 43 | /// </summary> |
45 | public class ACL | 44 | public class ACL |
46 | { | 45 | { |
47 | Dictionary<string, Role> Roles = new Dictionary<string, Role>(); | 46 | private Dictionary<string, Role> Roles = new Dictionary<string, Role>(); |
48 | Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); | 47 | private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); |
49 | 48 | ||
50 | public ACL AddRole(Role role) | 49 | public ACL AddRole(Role role) |
51 | { | 50 | { |
@@ -114,9 +113,11 @@ namespace OpenSim.Framework | |||
114 | return this; | 113 | return this; |
115 | } | 114 | } |
116 | } | 115 | } |
116 | |||
117 | #endregion | 117 | #endregion |
118 | 118 | ||
119 | #region Exceptions | 119 | #region Exceptions |
120 | |||
120 | /// <summary> | 121 | /// <summary> |
121 | /// Thrown when an ACL attempts to add a duplicate role. | 122 | /// Thrown when an ACL attempts to add a duplicate role. |
122 | /// </summary> | 123 | /// </summary> |
@@ -139,6 +140,7 @@ namespace OpenSim.Framework | |||
139 | return "This ACL already contains a role called '" + m_role.Name + "'."; | 140 | return "This ACL already contains a role called '" + m_role.Name + "'."; |
140 | } | 141 | } |
141 | } | 142 | } |
143 | |||
142 | #endregion | 144 | #endregion |
143 | 145 | ||
144 | #region Roles and Resources | 146 | #region Roles and Resources |
@@ -146,7 +148,12 @@ namespace OpenSim.Framework | |||
146 | /// <summary> | 148 | /// <summary> |
147 | /// Does this Role have permission to access a specified Resource? | 149 | /// Does this Role have permission to access a specified Resource? |
148 | /// </summary> | 150 | /// </summary> |
149 | public enum Permission { Deny, None, Allow }; | 151 | public enum Permission |
152 | { | ||
153 | Deny, | ||
154 | None, | ||
155 | Allow | ||
156 | } ; | ||
150 | 157 | ||
151 | /// <summary> | 158 | /// <summary> |
152 | /// A role class, for use with Users or Groups | 159 | /// A role class, for use with Users or Groups |
@@ -227,7 +234,7 @@ namespace OpenSim.Framework | |||
227 | 234 | ||
228 | #region Tests | 235 | #region Tests |
229 | 236 | ||
230 | class ACLTester | 237 | internal class ACLTester |
231 | { | 238 | { |
232 | public ACLTester() | 239 | public ACLTester() |
233 | { | 240 | { |
@@ -249,9 +256,8 @@ namespace OpenSim.Framework | |||
249 | acl.GrantPermission("Guests", "CanBuild"); | 256 | acl.GrantPermission("Guests", "CanBuild"); |
250 | 257 | ||
251 | acl.HasPermission("JoeGuest", "CanBuild"); | 258 | acl.HasPermission("JoeGuest", "CanBuild"); |
252 | |||
253 | } | 259 | } |
254 | } | 260 | } |
255 | 261 | ||
256 | #endregion | 262 | #endregion |
257 | } | 263 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AgentCircuitManager.cs b/OpenSim/Framework/General/AgentCircuitManager.cs index 578cc67..3658feb 100644 --- a/OpenSim/Framework/General/AgentCircuitManager.cs +++ b/OpenSim/Framework/General/AgentCircuitManager.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Interfaces; | ||
31 | using OpenSim.Framework; | ||
32 | 30 | ||
33 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
34 | { | 32 | { |
@@ -38,15 +36,14 @@ namespace OpenSim.Framework | |||
38 | 36 | ||
39 | public AgentCircuitManager() | 37 | public AgentCircuitManager() |
40 | { | 38 | { |
41 | |||
42 | } | 39 | } |
43 | 40 | ||
44 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | 41 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) |
45 | { | 42 | { |
46 | AgentCircuitData validcircuit = null; | 43 | AgentCircuitData validcircuit = null; |
47 | if (this.AgentCircuits.ContainsKey(circuitcode)) | 44 | if (AgentCircuits.ContainsKey(circuitcode)) |
48 | { | 45 | { |
49 | validcircuit = this.AgentCircuits[circuitcode]; | 46 | validcircuit = AgentCircuits[circuitcode]; |
50 | } | 47 | } |
51 | AuthenticateResponse user = new AuthenticateResponse(); | 48 | AuthenticateResponse user = new AuthenticateResponse(); |
52 | if (validcircuit == null) | 49 | if (validcircuit == null) |
@@ -79,50 +76,50 @@ namespace OpenSim.Framework | |||
79 | 76 | ||
80 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) | 77 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) |
81 | { | 78 | { |
82 | if (this.AgentCircuits.ContainsKey(circuitCode)) | 79 | if (AgentCircuits.ContainsKey(circuitCode)) |
83 | { | 80 | { |
84 | this.AgentCircuits[circuitCode] = agentData; | 81 | AgentCircuits[circuitCode] = agentData; |
85 | } | 82 | } |
86 | else | 83 | else |
87 | { | 84 | { |
88 | this.AgentCircuits.Add(circuitCode, agentData); | 85 | AgentCircuits.Add(circuitCode, agentData); |
89 | } | 86 | } |
90 | } | 87 | } |
91 | 88 | ||
92 | public LLVector3 GetPosition(uint circuitCode) | 89 | public LLVector3 GetPosition(uint circuitCode) |
93 | { | 90 | { |
94 | LLVector3 vec = new LLVector3(); | 91 | LLVector3 vec = new LLVector3(); |
95 | if (this.AgentCircuits.ContainsKey(circuitCode)) | 92 | if (AgentCircuits.ContainsKey(circuitCode)) |
96 | { | 93 | { |
97 | vec = this.AgentCircuits[circuitCode].startpos; | 94 | vec = AgentCircuits[circuitCode].startpos; |
98 | } | 95 | } |
99 | return vec; | 96 | return vec; |
100 | } | 97 | } |
101 | 98 | ||
102 | public void UpdateAgentData(AgentCircuitData agentData) | 99 | public void UpdateAgentData(AgentCircuitData agentData) |
103 | { | 100 | { |
104 | if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) | 101 | if (AgentCircuits.ContainsKey((uint) agentData.circuitcode)) |
105 | { | 102 | { |
106 | this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; | 103 | AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; |
107 | this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; | 104 | AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; |
108 | this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; | 105 | AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; |
109 | // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); | 106 | // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); |
110 | } | 107 | } |
111 | } | 108 | } |
112 | 109 | ||
113 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) | 110 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) |
114 | { | 111 | { |
115 | if (this.AgentCircuits.ContainsKey(circuitcode)) | 112 | if (AgentCircuits.ContainsKey(circuitcode)) |
116 | { | 113 | { |
117 | this.AgentCircuits[circuitcode].child = childstatus; | 114 | AgentCircuits[circuitcode].child = childstatus; |
118 | } | 115 | } |
119 | } | 116 | } |
120 | 117 | ||
121 | public bool GetAgentChildStatus(uint circuitcode) | 118 | public bool GetAgentChildStatus(uint circuitcode) |
122 | { | 119 | { |
123 | if (this.AgentCircuits.ContainsKey(circuitcode)) | 120 | if (AgentCircuits.ContainsKey(circuitcode)) |
124 | { | 121 | { |
125 | return this.AgentCircuits[circuitcode].child; | 122 | return AgentCircuits[circuitcode].child; |
126 | } | 123 | } |
127 | return false; | 124 | return false; |
128 | } | 125 | } |
diff --git a/OpenSim/Framework/General/AgentCiruitData.cs b/OpenSim/Framework/General/AgentCiruitData.cs index 0924d36..95cac60 100644 --- a/OpenSim/Framework/General/AgentCiruitData.cs +++ b/OpenSim/Framework/General/AgentCiruitData.cs | |||
@@ -25,15 +25,18 @@ | |||
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 libsecondlife; | ||
29 | using System; | 28 | using System; |
29 | using libsecondlife; | ||
30 | 30 | ||
31 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
32 | { | 32 | { |
33 | [Serializable] | 33 | [Serializable] |
34 | public class AgentCircuitData | 34 | public class AgentCircuitData |
35 | { | 35 | { |
36 | public AgentCircuitData() { } | 36 | public AgentCircuitData() |
37 | { | ||
38 | } | ||
39 | |||
37 | public LLUUID AgentID; | 40 | public LLUUID AgentID; |
38 | public LLUUID SessionID; | 41 | public LLUUID SessionID; |
39 | public LLUUID SecureSessionID; | 42 | public LLUUID SecureSessionID; |
@@ -44,6 +47,6 @@ namespace OpenSim.Framework | |||
44 | public bool child; | 47 | public bool child; |
45 | public LLUUID InventoryFolder; | 48 | public LLUUID InventoryFolder; |
46 | public LLUUID BaseFolder; | 49 | public LLUUID BaseFolder; |
47 | public string CapsPath = ""; | 50 | public string CapsPath = ""; |
48 | } | 51 | } |
49 | } | 52 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AgentInventory.cs b/OpenSim/Framework/General/AgentInventory.cs index cf110cb..7a1174a 100644 --- a/OpenSim/Framework/General/AgentInventory.cs +++ b/OpenSim/Framework/General/AgentInventory.cs | |||
@@ -28,8 +28,6 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
31 | using OpenSim.Framework; | ||
32 | |||
33 | 31 | ||
34 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
35 | { | 33 | { |
@@ -39,7 +37,7 @@ namespace OpenSim.Framework | |||
39 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; | 37 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; |
40 | public Dictionary<LLUUID, InventoryItem> InventoryItems; | 38 | public Dictionary<LLUUID, InventoryItem> InventoryItems; |
41 | public InventoryFolder InventoryRoot; | 39 | public InventoryFolder InventoryRoot; |
42 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server | 40 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server |
43 | public LLUUID AgentID; | 41 | public LLUUID AgentID; |
44 | public AvatarWearable[] Wearables; | 42 | public AvatarWearable[] Wearables; |
45 | 43 | ||
@@ -47,12 +45,12 @@ namespace OpenSim.Framework | |||
47 | { | 45 | { |
48 | InventoryFolders = new Dictionary<LLUUID, InventoryFolder>(); | 46 | InventoryFolders = new Dictionary<LLUUID, InventoryFolder>(); |
49 | InventoryItems = new Dictionary<LLUUID, InventoryItem>(); | 47 | InventoryItems = new Dictionary<LLUUID, InventoryItem>(); |
50 | this.Initialise(); | 48 | Initialise(); |
51 | } | 49 | } |
52 | 50 | ||
53 | public virtual void Initialise() | 51 | public virtual void Initialise() |
54 | { | 52 | { |
55 | Wearables = new AvatarWearable[13]; | 53 | Wearables = new AvatarWearable[13]; |
56 | for (int i = 0; i < 13; i++) | 54 | for (int i = 0; i < 13; i++) |
57 | { | 55 | { |
58 | Wearables[i] = new AvatarWearable(); | 56 | Wearables[i] = new AvatarWearable(); |
@@ -63,27 +61,27 @@ namespace OpenSim.Framework | |||
63 | { | 61 | { |
64 | InventoryFolder Folder = new InventoryFolder(); | 62 | InventoryFolder Folder = new InventoryFolder(); |
65 | Folder.FolderID = folderID; | 63 | Folder.FolderID = folderID; |
66 | Folder.OwnerID = this.AgentID; | 64 | Folder.OwnerID = AgentID; |
67 | Folder.DefaultType = type; | 65 | Folder.DefaultType = type; |
68 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 66 | InventoryFolders.Add(Folder.FolderID, Folder); |
69 | return (true); | 67 | return (true); |
70 | } | 68 | } |
71 | 69 | ||
72 | public void CreateRootFolder(LLUUID newAgentID, bool createTextures) | 70 | public void CreateRootFolder(LLUUID newAgentID, bool createTextures) |
73 | { | 71 | { |
74 | this.AgentID = newAgentID; | 72 | AgentID = newAgentID; |
75 | InventoryRoot = new InventoryFolder(); | 73 | InventoryRoot = new InventoryFolder(); |
76 | InventoryRoot.FolderID = LLUUID.Random(); | 74 | InventoryRoot.FolderID = LLUUID.Random(); |
77 | InventoryRoot.ParentID = new LLUUID(); | 75 | InventoryRoot.ParentID = new LLUUID(); |
78 | InventoryRoot.Version = 1; | 76 | InventoryRoot.Version = 1; |
79 | InventoryRoot.DefaultType = 8; | 77 | InventoryRoot.DefaultType = 8; |
80 | InventoryRoot.OwnerID = this.AgentID; | 78 | InventoryRoot.OwnerID = AgentID; |
81 | InventoryRoot.FolderName = "My Inventory"; | 79 | InventoryRoot.FolderName = "My Inventory"; |
82 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); | 80 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); |
83 | InventoryRoot.OwnerID = this.AgentID; | 81 | InventoryRoot.OwnerID = AgentID; |
84 | if (createTextures) | 82 | if (createTextures) |
85 | { | 83 | { |
86 | this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); | 84 | CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); |
87 | } | 85 | } |
88 | } | 86 | } |
89 | 87 | ||
@@ -91,32 +89,32 @@ namespace OpenSim.Framework | |||
91 | { | 89 | { |
92 | InventoryFolder Folder = new InventoryFolder(); | 90 | InventoryFolder Folder = new InventoryFolder(); |
93 | Folder.FolderID = folderID; | 91 | Folder.FolderID = folderID; |
94 | Folder.OwnerID = this.AgentID; | 92 | Folder.OwnerID = AgentID; |
95 | Folder.DefaultType = type; | 93 | Folder.DefaultType = type; |
96 | Folder.FolderName = folderName; | 94 | Folder.FolderName = folderName; |
97 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 95 | InventoryFolders.Add(Folder.FolderID, Folder); |
98 | return (true); | 96 | return (true); |
99 | } | 97 | } |
100 | 98 | ||
101 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) | 99 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) |
102 | { | 100 | { |
103 | if (!this.InventoryFolders.ContainsKey(folderID)) | 101 | if (!InventoryFolders.ContainsKey(folderID)) |
104 | { | 102 | { |
105 | System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); | 103 | System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); |
106 | InventoryFolder Folder = new InventoryFolder(); | 104 | InventoryFolder Folder = new InventoryFolder(); |
107 | Folder.FolderID = folderID; | 105 | Folder.FolderID = folderID; |
108 | Folder.OwnerID = this.AgentID; | 106 | Folder.OwnerID = AgentID; |
109 | Folder.DefaultType = type; | 107 | Folder.DefaultType = type; |
110 | Folder.FolderName = folderName; | 108 | Folder.FolderName = folderName; |
111 | Folder.ParentID = parentID; | 109 | Folder.ParentID = parentID; |
112 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 110 | InventoryFolders.Add(Folder.FolderID, Folder); |
113 | } | 111 | } |
114 | return (true); | 112 | return (true); |
115 | } | 113 | } |
116 | 114 | ||
117 | public bool HasFolder(LLUUID folderID) | 115 | public bool HasFolder(LLUUID folderID) |
118 | { | 116 | { |
119 | if (this.InventoryFolders.ContainsKey(folderID)) | 117 | if (InventoryFolders.ContainsKey(folderID)) |
120 | { | 118 | { |
121 | return true; | 119 | return true; |
122 | } | 120 | } |
@@ -125,7 +123,7 @@ namespace OpenSim.Framework | |||
125 | 123 | ||
126 | public LLUUID GetFolderID(string folderName) | 124 | public LLUUID GetFolderID(string folderName) |
127 | { | 125 | { |
128 | foreach (InventoryFolder inv in this.InventoryFolders.Values) | 126 | foreach (InventoryFolder inv in InventoryFolders.Values) |
129 | { | 127 | { |
130 | if (inv.FolderName == folderName) | 128 | if (inv.FolderName == folderName) |
131 | { | 129 | { |
@@ -137,11 +135,12 @@ namespace OpenSim.Framework | |||
137 | 135 | ||
138 | public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) | 136 | public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) |
139 | { | 137 | { |
140 | if(this.InventoryItems.ContainsKey(itemID)) | 138 | if (InventoryItems.ContainsKey(itemID)) |
141 | { | 139 | { |
142 | InventoryItem Item = this.InventoryItems[itemID]; | 140 | InventoryItem Item = InventoryItems[itemID]; |
143 | Item.AssetID = asset.FullID; | 141 | Item.AssetID = asset.FullID; |
144 | System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); | 142 | System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + |
143 | " so it now is set to asset " + asset.FullID.ToStringHyphenated()); | ||
145 | //TODO need to update the rest of the info | 144 | //TODO need to update the rest of the info |
146 | } | 145 | } |
147 | return true; | 146 | return true; |
@@ -150,10 +149,10 @@ namespace OpenSim.Framework | |||
150 | public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) | 149 | public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) |
151 | { | 150 | { |
152 | System.Console.WriteLine("updating inventory item details"); | 151 | System.Console.WriteLine("updating inventory item details"); |
153 | if (this.InventoryItems.ContainsKey(itemID)) | 152 | if (InventoryItems.ContainsKey(itemID)) |
154 | { | 153 | { |
155 | System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name)); | 154 | System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name)); |
156 | InventoryItem Item = this.InventoryItems[itemID]; | 155 | InventoryItem Item = InventoryItems[itemID]; |
157 | Item.Name = Util.FieldToString(packet.Name); | 156 | Item.Name = Util.FieldToString(packet.Name); |
158 | System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); | 157 | System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); |
159 | //TODO need to update the rest of the info | 158 | //TODO need to update the rest of the info |
@@ -163,7 +162,7 @@ namespace OpenSim.Framework | |||
163 | 162 | ||
164 | public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) | 163 | public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) |
165 | { | 164 | { |
166 | if (this.InventoryFolders.ContainsKey(folderID)) | 165 | if (InventoryFolders.ContainsKey(folderID)) |
167 | { | 166 | { |
168 | LLUUID NewItemID = LLUUID.Random(); | 167 | LLUUID NewItemID = LLUUID.Random(); |
169 | 168 | ||
@@ -176,7 +175,7 @@ namespace OpenSim.Framework | |||
176 | Item.Name = asset.Name; | 175 | Item.Name = asset.Name; |
177 | Item.Description = asset.Description; | 176 | Item.Description = asset.Description; |
178 | Item.InvType = asset.InvType; | 177 | Item.InvType = asset.InvType; |
179 | this.InventoryItems.Add(Item.ItemID, Item); | 178 | InventoryItems.Add(Item.ItemID, Item); |
180 | InventoryFolder Folder = InventoryFolders[Item.FolderID]; | 179 | InventoryFolder Folder = InventoryFolders[Item.FolderID]; |
181 | Folder.Items.Add(Item); | 180 | Folder.Items.Add(Item); |
182 | return (Item.ItemID); | 181 | return (Item.ItemID); |
@@ -190,10 +189,10 @@ namespace OpenSim.Framework | |||
190 | public bool DeleteFromInventory(LLUUID itemID) | 189 | public bool DeleteFromInventory(LLUUID itemID) |
191 | { | 190 | { |
192 | bool res = false; | 191 | bool res = false; |
193 | if (this.InventoryItems.ContainsKey(itemID)) | 192 | if (InventoryItems.ContainsKey(itemID)) |
194 | { | 193 | { |
195 | InventoryItem item = this.InventoryItems[itemID]; | 194 | InventoryItem item = InventoryItems[itemID]; |
196 | this.InventoryItems.Remove(itemID); | 195 | InventoryItems.Remove(itemID); |
197 | foreach (InventoryFolder fold in InventoryFolders.Values) | 196 | foreach (InventoryFolder fold in InventoryFolders.Values) |
198 | { | 197 | { |
199 | if (fold.Items.Contains(item)) | 198 | if (fold.Items.Contains(item)) |
@@ -203,7 +202,6 @@ namespace OpenSim.Framework | |||
203 | } | 202 | } |
204 | } | 203 | } |
205 | res = true; | 204 | res = true; |
206 | |||
207 | } | 205 | } |
208 | return res; | 206 | return res; |
209 | } | 207 | } |
@@ -225,7 +223,6 @@ namespace OpenSim.Framework | |||
225 | Items = new List<InventoryItem>(); | 223 | Items = new List<InventoryItem>(); |
226 | //Subfolders = new List<InventoryFolder>(); | 224 | //Subfolders = new List<InventoryFolder>(); |
227 | } | 225 | } |
228 | |||
229 | } | 226 | } |
230 | 227 | ||
231 | public class InventoryItem | 228 | public class InventoryItem |
@@ -237,12 +234,12 @@ namespace OpenSim.Framework | |||
237 | public LLUUID CreatorID; | 234 | public LLUUID CreatorID; |
238 | public sbyte InvType; | 235 | public sbyte InvType; |
239 | public sbyte Type; | 236 | public sbyte Type; |
240 | public string Name =""; | 237 | public string Name = ""; |
241 | public string Description; | 238 | public string Description; |
242 | 239 | ||
243 | public InventoryItem() | 240 | public InventoryItem() |
244 | { | 241 | { |
245 | this.CreatorID = LLUUID.Zero; | 242 | CreatorID = LLUUID.Zero; |
246 | } | 243 | } |
247 | 244 | ||
248 | public string ExportString() | 245 | public string ExportString() |
@@ -251,11 +248,11 @@ namespace OpenSim.Framework | |||
251 | string result = ""; | 248 | string result = ""; |
252 | result += "\tinv_object\t0\n\t{\n"; | 249 | result += "\tinv_object\t0\n\t{\n"; |
253 | result += "\t\tobj_id\t%s\n"; | 250 | result += "\t\tobj_id\t%s\n"; |
254 | result += "\t\tparent_id\t"+ ItemID.ToString() +"\n"; | 251 | result += "\t\tparent_id\t" + ItemID.ToString() + "\n"; |
255 | result += "\t\ttype\t"+ typ +"\n"; | 252 | result += "\t\ttype\t" + typ + "\n"; |
256 | result += "\t\tname\t" + Name+"|\n"; | 253 | result += "\t\tname\t" + Name + "|\n"; |
257 | result += "\t}\n"; | 254 | result += "\t}\n"; |
258 | return result; | 255 | return result; |
259 | } | 256 | } |
260 | } | 257 | } |
261 | } | 258 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AgentWearable.cs b/OpenSim/Framework/General/AgentWearable.cs index af8a630..c2d4db3 100644 --- a/OpenSim/Framework/General/AgentWearable.cs +++ b/OpenSim/Framework/General/AgentWearable.cs | |||
@@ -36,10 +36,9 @@ namespace OpenSim.Framework | |||
36 | 36 | ||
37 | public AvatarWearable() | 37 | public AvatarWearable() |
38 | { | 38 | { |
39 | |||
40 | } | 39 | } |
41 | 40 | ||
42 | public AvatarWearable( LLUUID itemId, LLUUID assetId ) | 41 | public AvatarWearable(LLUUID itemId, LLUUID assetId) |
43 | { | 42 | { |
44 | AssetID = assetId; | 43 | AssetID = assetId; |
45 | ItemID = itemId; | 44 | ItemID = itemId; |
@@ -69,4 +68,4 @@ namespace OpenSim.Framework | |||
69 | } | 68 | } |
70 | } | 69 | } |
71 | } | 70 | } |
72 | } | 71 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AssetBase.cs b/OpenSim/Framework/General/AssetBase.cs index 9c69eb8..f0367f0 100644 --- a/OpenSim/Framework/General/AssetBase.cs +++ b/OpenSim/Framework/General/AssetBase.cs | |||
@@ -44,7 +44,6 @@ namespace OpenSim.Framework | |||
44 | 44 | ||
45 | public AssetBase() | 45 | public AssetBase() |
46 | { | 46 | { |
47 | |||
48 | } | 47 | } |
49 | 48 | ||
50 | public AssetBase(LLUUID assetId, string name) | 49 | public AssetBase(LLUUID assetId, string name) |
@@ -53,4 +52,4 @@ namespace OpenSim.Framework | |||
53 | Name = name; | 52 | Name = name; |
54 | } | 53 | } |
55 | } | 54 | } |
56 | } | 55 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AssetConfig.cs b/OpenSim/Framework/General/AssetConfig.cs index 457369d..81cf899 100644 --- a/OpenSim/Framework/General/AssetConfig.cs +++ b/OpenSim/Framework/General/AssetConfig.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework | 29 | namespace OpenSim.Framework |
34 | { | 30 | { |
35 | /// <summary> | 31 | /// <summary> |
@@ -48,18 +44,22 @@ namespace OpenSim.Framework | |||
48 | 44 | ||
49 | public AssetConfig(string description, string filename) | 45 | public AssetConfig(string description, string filename) |
50 | { | 46 | { |
51 | configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); | 47 | configMember = |
48 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
52 | configMember.performConfigurationRetrieve(); | 49 | configMember.performConfigurationRetrieve(); |
53 | } | 50 | } |
54 | 51 | ||
55 | public void loadConfigurationOptions() | 52 | public void loadConfigurationOptions() |
56 | { | 53 | { |
57 | configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); | 54 | configMember.addConfigurationOption("default_startup_message", |
58 | 55 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | |
59 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | 56 | "Default Startup Message", "Welcome to OGS", false); |
60 | 57 | ||
61 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); | 58 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
59 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | ||
62 | 60 | ||
61 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
62 | "Http Listener port", DefaultHttpPort.ToString(), false); | ||
63 | } | 63 | } |
64 | 64 | ||
65 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 65 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -67,17 +67,17 @@ namespace OpenSim.Framework | |||
67 | switch (configuration_key) | 67 | switch (configuration_key) |
68 | { | 68 | { |
69 | case "default_startup_message": | 69 | case "default_startup_message": |
70 | this.DefaultStartupMsg = (string)configuration_result; | 70 | DefaultStartupMsg = (string) configuration_result; |
71 | break; | 71 | break; |
72 | case "database_provider": | 72 | case "database_provider": |
73 | this.DatabaseProvider = (string)configuration_result; | 73 | DatabaseProvider = (string) configuration_result; |
74 | break; | 74 | break; |
75 | case "http_port": | 75 | case "http_port": |
76 | HttpPort = (uint)configuration_result; | 76 | HttpPort = (uint) configuration_result; |
77 | break; | 77 | break; |
78 | } | 78 | } |
79 | 79 | ||
80 | return true; | 80 | return true; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | } | 83 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AssetLandmark.cs b/OpenSim/Framework/General/AssetLandmark.cs index 9f05531..a62a85b 100644 --- a/OpenSim/Framework/General/AssetLandmark.cs +++ b/OpenSim/Framework/General/AssetLandmark.cs | |||
@@ -38,22 +38,22 @@ namespace OpenSim.Framework | |||
38 | 38 | ||
39 | public AssetLandmark(AssetBase a) | 39 | public AssetLandmark(AssetBase a) |
40 | { | 40 | { |
41 | this.Data = a.Data; | 41 | Data = a.Data; |
42 | this.FullID = a.FullID; | 42 | FullID = a.FullID; |
43 | this.Type = a.Type; | 43 | Type = a.Type; |
44 | this.InvType = a.InvType; | 44 | InvType = a.InvType; |
45 | this.Name = a.Name; | 45 | Name = a.Name; |
46 | this.Description = a.Description; | 46 | Description = a.Description; |
47 | InternData(); | 47 | InternData(); |
48 | } | 48 | } |
49 | 49 | ||
50 | private void InternData() | 50 | private void InternData() |
51 | { | 51 | { |
52 | string temp = Encoding.UTF8.GetString(Data).Trim(); | 52 | string temp = Encoding.UTF8.GetString(Data).Trim(); |
53 | string[] parts = temp.Split('\n'); | 53 | string[] parts = temp.Split('\n'); |
54 | int.TryParse(parts[0].Substring(17, 1), out Version); | 54 | int.TryParse(parts[0].Substring(17, 1), out Version); |
55 | LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); | 55 | LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); |
56 | LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); | 56 | LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | } | 59 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/AssetStorage.cs b/OpenSim/Framework/General/AssetStorage.cs index e3193ed..b39ceeb 100644 --- a/OpenSim/Framework/General/AssetStorage.cs +++ b/OpenSim/Framework/General/AssetStorage.cs | |||
@@ -29,19 +29,20 @@ using libsecondlife; | |||
29 | 29 | ||
30 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
31 | { | 31 | { |
32 | public class AssetStorage | 32 | public class AssetStorage |
33 | { | 33 | { |
34 | public AssetStorage() | ||
35 | { | ||
36 | } | ||
34 | 37 | ||
35 | public AssetStorage() { | 38 | public AssetStorage(LLUUID assetUUID) |
36 | } | 39 | { |
40 | UUID = assetUUID; | ||
41 | } | ||
37 | 42 | ||
38 | public AssetStorage(LLUUID assetUUID) { | 43 | public byte[] Data; |
39 | UUID=assetUUID; | 44 | public sbyte Type; |
40 | } | 45 | public string Name; |
41 | 46 | public LLUUID UUID; | |
42 | public byte[] Data; | 47 | } |
43 | public sbyte Type; | 48 | } \ No newline at end of file |
44 | public string Name; | ||
45 | public LLUUID UUID; | ||
46 | } | ||
47 | } | ||
diff --git a/OpenSim/Framework/General/AuthenticateResponse.cs b/OpenSim/Framework/General/AuthenticateResponse.cs index 25bb0dd..0bf356e 100644 --- a/OpenSim/Framework/General/AuthenticateResponse.cs +++ b/OpenSim/Framework/General/AuthenticateResponse.cs | |||
@@ -25,8 +25,6 @@ | |||
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; | ||
29 | |||
30 | namespace OpenSim.Framework | 28 | namespace OpenSim.Framework |
31 | { | 29 | { |
32 | public class AuthenticateResponse | 30 | public class AuthenticateResponse |
@@ -36,8 +34,6 @@ namespace OpenSim.Framework | |||
36 | 34 | ||
37 | public AuthenticateResponse() | 35 | public AuthenticateResponse() |
38 | { | 36 | { |
39 | |||
40 | } | 37 | } |
41 | |||
42 | } | 38 | } |
43 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/BlockingQueue.cs b/OpenSim/Framework/General/BlockingQueue.cs index 2d59db4..006fbc8 100644 --- a/OpenSim/Framework/General/BlockingQueue.cs +++ b/OpenSim/Framework/General/BlockingQueue.cs | |||
@@ -55,4 +55,4 @@ namespace OpenSim.Framework | |||
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |
58 | } | 58 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs index c3b3d94..e34c051 100644 --- a/OpenSim/Framework/General/ClientManager.cs +++ b/OpenSim/Framework/General/ClientManager.cs | |||
@@ -26,16 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.Framework.Interfaces; | ||
34 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | ||
35 | 32 | ||
36 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
37 | { | 34 | { |
38 | public delegate void ForEachClientDelegate(IClientAPI client); | 35 | public delegate void ForEachClientDelegate(IClientAPI client); |
36 | |||
39 | public class ClientManager | 37 | public class ClientManager |
40 | { | 38 | { |
41 | private Dictionary<uint, IClientAPI> m_clients; | 39 | private Dictionary<uint, IClientAPI> m_clients; |
@@ -63,7 +61,7 @@ namespace OpenSim.Framework | |||
63 | m_clients.Add(id, client); | 61 | m_clients.Add(id, client); |
64 | } | 62 | } |
65 | 63 | ||
66 | public void InPacket(uint circuitCode, libsecondlife.Packets.Packet packet) | 64 | public void InPacket(uint circuitCode, Packet packet) |
67 | { | 65 | { |
68 | IClientAPI client; | 66 | IClientAPI client; |
69 | 67 | ||
@@ -83,10 +81,10 @@ namespace OpenSim.Framework | |||
83 | } | 81 | } |
84 | } | 82 | } |
85 | 83 | ||
86 | public void CloseAllCircuits( LLUUID agentId ) | 84 | public void CloseAllCircuits(LLUUID agentId) |
87 | { | 85 | { |
88 | uint[] circuits = GetAllCircuits(agentId); | 86 | uint[] circuits = GetAllCircuits(agentId); |
89 | foreach (uint circuit in circuits ) | 87 | foreach (uint circuit in circuits) |
90 | { | 88 | { |
91 | IClientAPI client; | 89 | IClientAPI client; |
92 | if (m_clients.TryGetValue(circuit, out client)) | 90 | if (m_clients.TryGetValue(circuit, out client)) |
@@ -94,7 +92,7 @@ namespace OpenSim.Framework | |||
94 | Remove(circuit); | 92 | Remove(circuit); |
95 | client.Close(); | 93 | client.Close(); |
96 | } | 94 | } |
97 | } | 95 | } |
98 | } | 96 | } |
99 | 97 | ||
100 | private uint[] GetAllCircuits(LLUUID agentId) | 98 | private uint[] GetAllCircuits(LLUUID agentId) |
@@ -103,16 +101,16 @@ namespace OpenSim.Framework | |||
103 | 101 | ||
104 | foreach (KeyValuePair<uint, IClientAPI> pair in m_clients) | 102 | foreach (KeyValuePair<uint, IClientAPI> pair in m_clients) |
105 | { | 103 | { |
106 | if( pair.Value.AgentId == agentId ) | 104 | if (pair.Value.AgentId == agentId) |
107 | { | 105 | { |
108 | circuits.Add( pair.Key ); | 106 | circuits.Add(pair.Key); |
109 | } | 107 | } |
110 | } | 108 | } |
111 | 109 | ||
112 | return circuits.ToArray(); | 110 | return circuits.ToArray(); |
113 | } | 111 | } |
114 | 112 | ||
115 | 113 | ||
116 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) | 114 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) |
117 | { | 115 | { |
118 | ViewerEffectPacket packet = new ViewerEffectPacket(); | 116 | ViewerEffectPacket packet = new ViewerEffectPacket(); |
@@ -134,4 +132,4 @@ namespace OpenSim.Framework | |||
134 | return m_clients.TryGetValue(circuitId, out user); | 132 | return m_clients.TryGetValue(circuitId, out user); |
135 | } | 133 | } |
136 | } | 134 | } |
137 | } | 135 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/ConfigurationMember.cs b/OpenSim/Framework/General/ConfigurationMember.cs index c71982a..5883d73 100644 --- a/OpenSim/Framework/General/ConfigurationMember.cs +++ b/OpenSim/Framework/General/ConfigurationMember.cs | |||
@@ -27,22 +27,19 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Reflection; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
33 | using System.Text; | 31 | using System.Globalization; |
34 | using System.Net; | 32 | using System.Net; |
35 | 33 | using System.Reflection; | |
36 | using libsecondlife; | 34 | using libsecondlife; |
37 | |||
38 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
39 | using System.Globalization; | ||
40 | 36 | ||
41 | namespace OpenSim.Framework | 37 | namespace OpenSim.Framework |
42 | { | 38 | { |
43 | public class ConfigurationMember | 39 | public class ConfigurationMember |
44 | { | 40 | { |
45 | public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); | 41 | public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); |
42 | |||
46 | public delegate void ConfigurationOptionsLoad(); | 43 | public delegate void ConfigurationOptionsLoad(); |
47 | 44 | ||
48 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); | 45 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); |
@@ -53,22 +50,26 @@ namespace OpenSim.Framework | |||
53 | private ConfigurationOptionResult resultFunction; | 50 | private ConfigurationOptionResult resultFunction; |
54 | 51 | ||
55 | private IGenericConfig configurationPlugin = null; | 52 | private IGenericConfig configurationPlugin = null; |
53 | |||
56 | /// <summary> | 54 | /// <summary> |
57 | /// This is the default configuration DLL loaded | 55 | /// This is the default configuration DLL loaded |
58 | /// </summary> | 56 | /// </summary> |
59 | private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; | 57 | private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; |
60 | public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) | 58 | |
59 | public ConfigurationMember(string configuration_filename, string configuration_description, | ||
60 | ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) | ||
61 | { | 61 | { |
62 | this.configurationFilename = configuration_filename; | 62 | configurationFilename = configuration_filename; |
63 | this.configurationDescription = configuration_description; | 63 | configurationDescription = configuration_description; |
64 | this.loadFunction = load_function; | 64 | loadFunction = load_function; |
65 | this.resultFunction = result_function; | 65 | resultFunction = result_function; |
66 | } | 66 | } |
67 | 67 | ||
68 | public void setConfigurationFilename(string filename) | 68 | public void setConfigurationFilename(string filename) |
69 | { | 69 | { |
70 | configurationFilename = filename; | 70 | configurationFilename = filename; |
71 | } | 71 | } |
72 | |||
72 | public void setConfigurationDescription(string desc) | 73 | public void setConfigurationDescription(string desc) |
73 | { | 74 | { |
74 | configurationDescription = desc; | 75 | configurationDescription = desc; |
@@ -83,7 +84,11 @@ namespace OpenSim.Framework | |||
83 | { | 84 | { |
84 | configurationPluginFilename = dll_filename; | 85 | configurationPluginFilename = dll_filename; |
85 | } | 86 | } |
86 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) | 87 | |
88 | public void addConfigurationOption(string configuration_key, | ||
89 | ConfigurationOption.ConfigurationTypes configuration_type, | ||
90 | string configuration_question, string configuration_default, | ||
91 | bool use_default_no_prompt) | ||
87 | { | 92 | { |
88 | ConfigurationOption configOption = new ConfigurationOption(); | 93 | ConfigurationOption configOption = new ConfigurationOption(); |
89 | configOption.configurationKey = configuration_key; | 94 | configOption.configurationKey = configuration_key; |
@@ -92,7 +97,8 @@ namespace OpenSim.Framework | |||
92 | configOption.configurationType = configuration_type; | 97 | configOption.configurationType = configuration_type; |
93 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; | 98 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; |
94 | 99 | ||
95 | if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt)) | 100 | if ((configuration_key != "" && configuration_question != "") || |
101 | (configuration_key != "" && use_default_no_prompt)) | ||
96 | { | 102 | { |
97 | if (!configurationOptions.Contains(configOption)) | 103 | if (!configurationOptions.Contains(configOption)) |
98 | { | 104 | { |
@@ -101,32 +107,37 @@ namespace OpenSim.Framework | |||
101 | } | 107 | } |
102 | else | 108 | else |
103 | { | 109 | { |
104 | MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); | 110 | MainLog.Instance.Notice( |
111 | "Required fields for adding a configuration option is invalid. Will not add this option (" + | ||
112 | configuration_key + ")"); | ||
105 | } | 113 | } |
106 | } | 114 | } |
107 | 115 | ||
108 | public void performConfigurationRetrieve() | 116 | public void performConfigurationRetrieve() |
109 | { | 117 | { |
110 | configurationPlugin = this.LoadConfigDll(configurationPluginFilename); | 118 | configurationPlugin = LoadConfigDll(configurationPluginFilename); |
111 | configurationOptions.Clear(); | 119 | configurationOptions.Clear(); |
112 | if(loadFunction == null) | 120 | if (loadFunction == null) |
113 | { | 121 | { |
114 | MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); | 122 | MainLog.Instance.Error("Load Function for '" + configurationDescription + |
123 | "' is null. Refusing to run configuration."); | ||
115 | return; | 124 | return; |
116 | } | 125 | } |
117 | 126 | ||
118 | if(resultFunction == null) | 127 | if (resultFunction == null) |
119 | { | 128 | { |
120 | MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); | 129 | MainLog.Instance.Error("Result Function for '" + configurationDescription + |
130 | "' is null. Refusing to run configuration."); | ||
121 | return; | 131 | return; |
122 | } | 132 | } |
123 | 133 | ||
124 | MainLog.Instance.Verbose("Calling Configuration Load Function..."); | 134 | MainLog.Instance.Verbose("Calling Configuration Load Function..."); |
125 | this.loadFunction(); | 135 | loadFunction(); |
126 | 136 | ||
127 | if(configurationOptions.Count <= 0) | 137 | if (configurationOptions.Count <= 0) |
128 | { | 138 | { |
129 | MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); | 139 | MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions + |
140 | "'. Refusing to continue configuration."); | ||
130 | return; | 141 | return; |
131 | } | 142 | } |
132 | 143 | ||
@@ -157,7 +168,6 @@ namespace OpenSim.Framework | |||
157 | bool ignoreNextFromConfig = false; | 168 | bool ignoreNextFromConfig = false; |
158 | while (convertSuccess == false) | 169 | while (convertSuccess == false) |
159 | { | 170 | { |
160 | |||
161 | string console_result = ""; | 171 | string console_result = ""; |
162 | string attribute = null; | 172 | string attribute = null; |
163 | if (useFile) | 173 | if (useFile) |
@@ -180,16 +190,20 @@ namespace OpenSim.Framework | |||
180 | } | 190 | } |
181 | else | 191 | else |
182 | { | 192 | { |
183 | |||
184 | if (configurationDescription.Trim() != "") | 193 | if (configurationDescription.Trim() != "") |
185 | { | 194 | { |
186 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); | 195 | console_result = |
196 | MainLog.Instance.CmdPrompt( | ||
197 | configurationDescription + ": " + configOption.configurationQuestion, | ||
198 | configOption.configurationDefault); | ||
187 | } | 199 | } |
188 | else | 200 | else |
189 | { | 201 | { |
190 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); | 202 | console_result = |
203 | MainLog.Instance.CmdPrompt(configOption.configurationQuestion, | ||
204 | configOption.configurationDefault); | ||
191 | } | 205 | } |
192 | } | 206 | } |
193 | } | 207 | } |
194 | else | 208 | else |
195 | { | 209 | { |
@@ -252,7 +266,6 @@ namespace OpenSim.Framework | |||
252 | { | 266 | { |
253 | convertSuccess = true; | 267 | convertSuccess = true; |
254 | return_result = intResult; | 268 | return_result = intResult; |
255 | |||
256 | } | 269 | } |
257 | errorMessage = "a signed 32 bit integer (int)"; | 270 | errorMessage = "a signed 32 bit integer (int)"; |
258 | break; | 271 | break; |
@@ -307,7 +320,6 @@ namespace OpenSim.Framework | |||
307 | { | 320 | { |
308 | convertSuccess = true; | 321 | convertSuccess = true; |
309 | return_result = uintResult; | 322 | return_result = uintResult; |
310 | |||
311 | } | 323 | } |
312 | errorMessage = "an unsigned 32 bit integer (uint)"; | 324 | errorMessage = "an unsigned 32 bit integer (uint)"; |
313 | break; | 325 | break; |
@@ -322,7 +334,9 @@ namespace OpenSim.Framework | |||
322 | break; | 334 | break; |
323 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: | 335 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: |
324 | float floatResult; | 336 | float floatResult; |
325 | if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult)) | 337 | if ( |
338 | float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | ||
339 | out floatResult)) | ||
326 | { | 340 | { |
327 | convertSuccess = true; | 341 | convertSuccess = true; |
328 | return_result = floatResult; | 342 | return_result = floatResult; |
@@ -331,7 +345,9 @@ namespace OpenSim.Framework | |||
331 | break; | 345 | break; |
332 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: | 346 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: |
333 | double doubleResult; | 347 | double doubleResult; |
334 | if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult)) | 348 | if ( |
349 | Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | ||
350 | out doubleResult)) | ||
335 | { | 351 | { |
336 | convertSuccess = true; | 352 | convertSuccess = true; |
337 | return_result = doubleResult; | 353 | return_result = doubleResult; |
@@ -348,9 +364,10 @@ namespace OpenSim.Framework | |||
348 | } | 364 | } |
349 | 365 | ||
350 | 366 | ||
351 | if (!this.resultFunction(configOption.configurationKey, return_result)) | 367 | if (!resultFunction(configOption.configurationKey, return_result)) |
352 | { | 368 | { |
353 | Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); | 369 | MainLog.Instance.Notice( |
370 | "The handler for the last configuration option denied that input, please try again."); | ||
354 | convertSuccess = false; | 371 | convertSuccess = false; |
355 | ignoreNextFromConfig = true; | 372 | ignoreNextFromConfig = true; |
356 | } | 373 | } |
@@ -359,19 +376,27 @@ namespace OpenSim.Framework | |||
359 | { | 376 | { |
360 | if (configOption.configurationUseDefaultNoPrompt) | 377 | if (configOption.configurationUseDefaultNoPrompt) |
361 | { | 378 | { |
362 | MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); | 379 | MainLog.Instance.Error("CONFIG", |
380 | string.Format( | ||
381 | "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", | ||
382 | configOption.configurationKey, console_result, errorMessage, | ||
383 | configurationFilename)); | ||
363 | convertSuccess = true; | 384 | convertSuccess = true; |
364 | } | 385 | } |
365 | else | 386 | else |
366 | { | 387 | { |
367 | MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); | 388 | MainLog.Instance.Warn("CONFIG", |
389 | string.Format( | ||
390 | "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", | ||
391 | configOption.configurationKey, console_result, errorMessage, | ||
392 | configurationFilename)); | ||
368 | ignoreNextFromConfig = true; | 393 | ignoreNextFromConfig = true; |
369 | } | 394 | } |
370 | } | 395 | } |
371 | } | 396 | } |
372 | } | 397 | } |
373 | 398 | ||
374 | if(useFile) | 399 | if (useFile) |
375 | { | 400 | { |
376 | configurationPlugin.Commit(); | 401 | configurationPlugin.Commit(); |
377 | configurationPlugin.Close(); | 402 | configurationPlugin.Close(); |
@@ -393,7 +418,8 @@ namespace OpenSim.Framework | |||
393 | 418 | ||
394 | if (typeInterface != null) | 419 | if (typeInterface != null) |
395 | { | 420 | { |
396 | plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 421 | plug = |
422 | (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
397 | } | 423 | } |
398 | } | 424 | } |
399 | } | 425 | } |
@@ -405,10 +431,10 @@ namespace OpenSim.Framework | |||
405 | 431 | ||
406 | public void forceSetConfigurationOption(string configuration_key, string configuration_value) | 432 | public void forceSetConfigurationOption(string configuration_key, string configuration_value) |
407 | { | 433 | { |
408 | this.configurationPlugin.LoadData(); | 434 | configurationPlugin.LoadData(); |
409 | this.configurationPlugin.SetAttribute(configuration_key, configuration_value); | 435 | configurationPlugin.SetAttribute(configuration_key, configuration_value); |
410 | this.configurationPlugin.Commit(); | 436 | configurationPlugin.Commit(); |
411 | this.configurationPlugin.Close(); | 437 | configurationPlugin.Close(); |
412 | } | 438 | } |
413 | } | 439 | } |
414 | } | 440 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/ConfigurationOption.cs b/OpenSim/Framework/General/ConfigurationOption.cs index 792e697..5a8fd08 100644 --- a/OpenSim/Framework/General/ConfigurationOption.cs +++ b/OpenSim/Framework/General/ConfigurationOption.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework | 29 | namespace OpenSim.Framework |
34 | { | 30 | { |
35 | public class ConfigurationOption | 31 | public class ConfigurationOption |
@@ -40,7 +36,7 @@ namespace OpenSim.Framework | |||
40 | TYPE_STRING_NOT_EMPTY, | 36 | TYPE_STRING_NOT_EMPTY, |
41 | TYPE_UINT16, | 37 | TYPE_UINT16, |
42 | TYPE_UINT32, | 38 | TYPE_UINT32, |
43 | TYPE_UINT64, | 39 | TYPE_UINT64, |
44 | TYPE_INT16, | 40 | TYPE_INT16, |
45 | TYPE_INT32, | 41 | TYPE_INT32, |
46 | TYPE_INT64, | 42 | TYPE_INT64, |
@@ -52,7 +48,7 @@ namespace OpenSim.Framework | |||
52 | TYPE_LLVECTOR3, | 48 | TYPE_LLVECTOR3, |
53 | TYPE_FLOAT, | 49 | TYPE_FLOAT, |
54 | TYPE_DOUBLE | 50 | TYPE_DOUBLE |
55 | }; | 51 | } ; |
56 | 52 | ||
57 | public string configurationKey = ""; | 53 | public string configurationKey = ""; |
58 | public string configurationQuestion = ""; | 54 | public string configurationQuestion = ""; |
@@ -61,4 +57,4 @@ namespace OpenSim.Framework | |||
61 | public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; | 57 | public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; |
62 | public bool configurationUseDefaultNoPrompt = false; | 58 | public bool configurationUseDefaultNoPrompt = false; |
63 | } | 59 | } |
64 | } | 60 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/Culture.cs b/OpenSim/Framework/General/Culture.cs index 54eae7c..f8cadfe 100644 --- a/OpenSim/Framework/General/Culture.cs +++ b/OpenSim/Framework/General/Culture.cs | |||
@@ -27,31 +27,23 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Globalization; | 30 | using System.Globalization; |
32 | using System.Text; | ||
33 | using System.Threading; | 31 | using System.Threading; |
34 | 32 | ||
35 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
36 | { | 34 | { |
37 | public class Culture | 35 | public class Culture |
38 | { | 36 | { |
39 | private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true); | 37 | private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true); |
40 | 38 | ||
41 | public static NumberFormatInfo NumberFormatInfo | 39 | public static NumberFormatInfo NumberFormatInfo |
42 | { | 40 | { |
43 | get | 41 | get { return m_cultureInfo.NumberFormat; } |
44 | { | ||
45 | return m_cultureInfo.NumberFormat; | ||
46 | } | ||
47 | } | 42 | } |
48 | 43 | ||
49 | public static IFormatProvider FormatProvider | 44 | public static IFormatProvider FormatProvider |
50 | { | 45 | { |
51 | get | 46 | get { return m_cultureInfo; } |
52 | { | ||
53 | return m_cultureInfo; | ||
54 | } | ||
55 | } | 47 | } |
56 | 48 | ||
57 | public static void SetCurrentCulture() | 49 | public static void SetCurrentCulture() |
@@ -59,4 +51,4 @@ namespace OpenSim.Framework | |||
59 | Thread.CurrentThread.CurrentCulture = m_cultureInfo; | 51 | Thread.CurrentThread.CurrentCulture = m_cultureInfo; |
60 | } | 52 | } |
61 | } | 53 | } |
62 | } | 54 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/EstateSettings.cs b/OpenSim/Framework/General/EstateSettings.cs index 3e99424..c70b6ca 100644 --- a/OpenSim/Framework/General/EstateSettings.cs +++ b/OpenSim/Framework/General/EstateSettings.cs | |||
@@ -25,24 +25,20 @@ | |||
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.IO; | 29 | using System.IO; |
29 | using libsecondlife; | 30 | using libsecondlife; |
30 | using OpenSim.Framework; | ||
31 | using System.Globalization; | ||
32 | 31 | ||
33 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
34 | { | 33 | { |
35 | public class EstateSettings | 34 | public class EstateSettings |
36 | { | 35 | { |
37 | |||
38 | //Settings to this island | 36 | //Settings to this island |
39 | private float m_billableFactor; | 37 | private float m_billableFactor; |
38 | |||
40 | public float billableFactor | 39 | public float billableFactor |
41 | { | 40 | { |
42 | get | 41 | get { return m_billableFactor; } |
43 | { | ||
44 | return m_billableFactor; | ||
45 | } | ||
46 | set | 42 | set |
47 | { | 43 | { |
48 | m_billableFactor = value; | 44 | m_billableFactor = value; |
@@ -52,12 +48,10 @@ namespace OpenSim.Framework | |||
52 | 48 | ||
53 | 49 | ||
54 | private uint m_estateID; | 50 | private uint m_estateID; |
51 | |||
55 | public uint estateID | 52 | public uint estateID |
56 | { | 53 | { |
57 | get | 54 | get { return m_estateID; } |
58 | { | ||
59 | return m_estateID; | ||
60 | } | ||
61 | set | 55 | set |
62 | { | 56 | { |
63 | m_estateID = value; | 57 | m_estateID = value; |
@@ -67,12 +61,10 @@ namespace OpenSim.Framework | |||
67 | 61 | ||
68 | 62 | ||
69 | private uint m_parentEstateID; | 63 | private uint m_parentEstateID; |
64 | |||
70 | public uint parentEstateID | 65 | public uint parentEstateID |
71 | { | 66 | { |
72 | get | 67 | get { return m_parentEstateID; } |
73 | { | ||
74 | return m_parentEstateID; | ||
75 | } | ||
76 | set | 68 | set |
77 | { | 69 | { |
78 | m_parentEstateID = value; | 70 | m_parentEstateID = value; |
@@ -81,12 +73,10 @@ namespace OpenSim.Framework | |||
81 | } | 73 | } |
82 | 74 | ||
83 | private byte m_maxAgents; | 75 | private byte m_maxAgents; |
76 | |||
84 | public byte maxAgents | 77 | public byte maxAgents |
85 | { | 78 | { |
86 | get | 79 | get { return m_maxAgents; } |
87 | { | ||
88 | return m_maxAgents; | ||
89 | } | ||
90 | set | 80 | set |
91 | { | 81 | { |
92 | m_maxAgents = value; | 82 | m_maxAgents = value; |
@@ -95,12 +85,10 @@ namespace OpenSim.Framework | |||
95 | } | 85 | } |
96 | 86 | ||
97 | private float m_objectBonusFactor; | 87 | private float m_objectBonusFactor; |
88 | |||
98 | public float objectBonusFactor | 89 | public float objectBonusFactor |
99 | { | 90 | { |
100 | get | 91 | get { return m_objectBonusFactor; } |
101 | { | ||
102 | return m_objectBonusFactor; | ||
103 | } | ||
104 | set | 92 | set |
105 | { | 93 | { |
106 | m_objectBonusFactor = value; | 94 | m_objectBonusFactor = value; |
@@ -109,12 +97,10 @@ namespace OpenSim.Framework | |||
109 | } | 97 | } |
110 | 98 | ||
111 | private int m_redirectGridX; | 99 | private int m_redirectGridX; |
100 | |||
112 | public int redirectGridX | 101 | public int redirectGridX |
113 | { | 102 | { |
114 | get | 103 | get { return m_redirectGridX; } |
115 | { | ||
116 | return m_redirectGridX; | ||
117 | } | ||
118 | set | 104 | set |
119 | { | 105 | { |
120 | m_redirectGridX = value; | 106 | m_redirectGridX = value; |
@@ -123,12 +109,10 @@ namespace OpenSim.Framework | |||
123 | } | 109 | } |
124 | 110 | ||
125 | private int m_redirectGridY; | 111 | private int m_redirectGridY; |
112 | |||
126 | public int redirectGridY | 113 | public int redirectGridY |
127 | { | 114 | { |
128 | get | 115 | get { return m_redirectGridY; } |
129 | { | ||
130 | return m_redirectGridY; | ||
131 | } | ||
132 | set | 116 | set |
133 | { | 117 | { |
134 | m_redirectGridY = value; | 118 | m_redirectGridY = value; |
@@ -137,12 +121,10 @@ namespace OpenSim.Framework | |||
137 | } | 121 | } |
138 | 122 | ||
139 | private Simulator.RegionFlags m_regionFlags; | 123 | private Simulator.RegionFlags m_regionFlags; |
124 | |||
140 | public Simulator.RegionFlags regionFlags | 125 | public Simulator.RegionFlags regionFlags |
141 | { | 126 | { |
142 | get | 127 | get { return m_regionFlags; } |
143 | { | ||
144 | return m_regionFlags; | ||
145 | } | ||
146 | set | 128 | set |
147 | { | 129 | { |
148 | m_regionFlags = value; | 130 | m_regionFlags = value; |
@@ -152,12 +134,10 @@ namespace OpenSim.Framework | |||
152 | 134 | ||
153 | 135 | ||
154 | private Simulator.SimAccess m_simAccess; | 136 | private Simulator.SimAccess m_simAccess; |
137 | |||
155 | public Simulator.SimAccess simAccess | 138 | public Simulator.SimAccess simAccess |
156 | { | 139 | { |
157 | get | 140 | get { return m_simAccess; } |
158 | { | ||
159 | return m_simAccess; | ||
160 | } | ||
161 | set | 141 | set |
162 | { | 142 | { |
163 | m_simAccess = value; | 143 | m_simAccess = value; |
@@ -166,12 +146,10 @@ namespace OpenSim.Framework | |||
166 | } | 146 | } |
167 | 147 | ||
168 | private float m_sunHour; | 148 | private float m_sunHour; |
149 | |||
169 | public float sunHour | 150 | public float sunHour |
170 | { | 151 | { |
171 | get | 152 | get { return m_sunHour; } |
172 | { | ||
173 | return m_sunHour; | ||
174 | } | ||
175 | set | 153 | set |
176 | { | 154 | { |
177 | m_sunHour = value; | 155 | m_sunHour = value; |
@@ -180,12 +158,10 @@ namespace OpenSim.Framework | |||
180 | } | 158 | } |
181 | 159 | ||
182 | private float m_terrainRaiseLimit; | 160 | private float m_terrainRaiseLimit; |
161 | |||
183 | public float terrainRaiseLimit | 162 | public float terrainRaiseLimit |
184 | { | 163 | { |
185 | get | 164 | get { return m_terrainRaiseLimit; } |
186 | { | ||
187 | return m_terrainRaiseLimit; | ||
188 | } | ||
189 | set | 165 | set |
190 | { | 166 | { |
191 | m_terrainRaiseLimit = value; | 167 | m_terrainRaiseLimit = value; |
@@ -194,12 +170,10 @@ namespace OpenSim.Framework | |||
194 | } | 170 | } |
195 | 171 | ||
196 | private float m_terrainLowerLimit; | 172 | private float m_terrainLowerLimit; |
173 | |||
197 | public float terrainLowerLimit | 174 | public float terrainLowerLimit |
198 | { | 175 | { |
199 | get | 176 | get { return m_terrainLowerLimit; } |
200 | { | ||
201 | return m_terrainLowerLimit; | ||
202 | } | ||
203 | set | 177 | set |
204 | { | 178 | { |
205 | m_terrainLowerLimit = value; | 179 | m_terrainLowerLimit = value; |
@@ -208,12 +182,10 @@ namespace OpenSim.Framework | |||
208 | } | 182 | } |
209 | 183 | ||
210 | private bool m_useFixedSun; | 184 | private bool m_useFixedSun; |
185 | |||
211 | public bool useFixedSun | 186 | public bool useFixedSun |
212 | { | 187 | { |
213 | get | 188 | get { return m_useFixedSun; } |
214 | { | ||
215 | return m_useFixedSun; | ||
216 | } | ||
217 | set | 189 | set |
218 | { | 190 | { |
219 | m_useFixedSun = value; | 191 | m_useFixedSun = value; |
@@ -223,12 +195,10 @@ namespace OpenSim.Framework | |||
223 | 195 | ||
224 | 196 | ||
225 | private int m_pricePerMeter; | 197 | private int m_pricePerMeter; |
198 | |||
226 | public int pricePerMeter | 199 | public int pricePerMeter |
227 | { | 200 | { |
228 | get | 201 | get { return m_pricePerMeter; } |
229 | { | ||
230 | return m_pricePerMeter; | ||
231 | } | ||
232 | set | 202 | set |
233 | { | 203 | { |
234 | m_pricePerMeter = value; | 204 | m_pricePerMeter = value; |
@@ -238,12 +208,10 @@ namespace OpenSim.Framework | |||
238 | 208 | ||
239 | 209 | ||
240 | private ushort m_regionWaterHeight; | 210 | private ushort m_regionWaterHeight; |
211 | |||
241 | public ushort regionWaterHeight | 212 | public ushort regionWaterHeight |
242 | { | 213 | { |
243 | get | 214 | get { return m_regionWaterHeight; } |
244 | { | ||
245 | return m_regionWaterHeight; | ||
246 | } | ||
247 | set | 215 | set |
248 | { | 216 | { |
249 | m_regionWaterHeight = value; | 217 | m_regionWaterHeight = value; |
@@ -253,12 +221,10 @@ namespace OpenSim.Framework | |||
253 | 221 | ||
254 | 222 | ||
255 | private bool m_regionAllowTerraform; | 223 | private bool m_regionAllowTerraform; |
224 | |||
256 | public bool regionAllowTerraform | 225 | public bool regionAllowTerraform |
257 | { | 226 | { |
258 | get | 227 | get { return m_regionAllowTerraform; } |
259 | { | ||
260 | return m_regionAllowTerraform; | ||
261 | } | ||
262 | set | 228 | set |
263 | { | 229 | { |
264 | m_regionAllowTerraform = value; | 230 | m_regionAllowTerraform = value; |
@@ -266,16 +232,14 @@ namespace OpenSim.Framework | |||
266 | } | 232 | } |
267 | } | 233 | } |
268 | 234 | ||
269 | 235 | ||
270 | // Region Information | 236 | // Region Information |
271 | // Low resolution 'base' textures. No longer used. | 237 | // Low resolution 'base' textures. No longer used. |
272 | private LLUUID m_terrainBase0; | 238 | private LLUUID m_terrainBase0; |
239 | |||
273 | public LLUUID terrainBase0 | 240 | public LLUUID terrainBase0 |
274 | { | 241 | { |
275 | get | 242 | get { return m_terrainBase0; } |
276 | { | ||
277 | return m_terrainBase0; | ||
278 | } | ||
279 | set | 243 | set |
280 | { | 244 | { |
281 | m_terrainBase0 = value; | 245 | m_terrainBase0 = value; |
@@ -284,12 +248,10 @@ namespace OpenSim.Framework | |||
284 | } | 248 | } |
285 | 249 | ||
286 | private LLUUID m_terrainBase1; | 250 | private LLUUID m_terrainBase1; |
251 | |||
287 | public LLUUID terrainBase1 | 252 | public LLUUID terrainBase1 |
288 | { | 253 | { |
289 | get | 254 | get { return m_terrainBase1; } |
290 | { | ||
291 | return m_terrainBase1; | ||
292 | } | ||
293 | set | 255 | set |
294 | { | 256 | { |
295 | m_terrainBase1 = value; | 257 | m_terrainBase1 = value; |
@@ -298,12 +260,10 @@ namespace OpenSim.Framework | |||
298 | } | 260 | } |
299 | 261 | ||
300 | private LLUUID m_terrainBase2; | 262 | private LLUUID m_terrainBase2; |
263 | |||
301 | public LLUUID terrainBase2 | 264 | public LLUUID terrainBase2 |
302 | { | 265 | { |
303 | get | 266 | get { return m_terrainBase2; } |
304 | { | ||
305 | return m_terrainBase2; | ||
306 | } | ||
307 | set | 267 | set |
308 | { | 268 | { |
309 | m_terrainBase2 = value; | 269 | m_terrainBase2 = value; |
@@ -312,12 +272,10 @@ namespace OpenSim.Framework | |||
312 | } | 272 | } |
313 | 273 | ||
314 | private LLUUID m_terrainBase3; | 274 | private LLUUID m_terrainBase3; |
275 | |||
315 | public LLUUID terrainBase3 | 276 | public LLUUID terrainBase3 |
316 | { | 277 | { |
317 | get | 278 | get { return m_terrainBase3; } |
318 | { | ||
319 | return m_terrainBase3; | ||
320 | } | ||
321 | set | 279 | set |
322 | { | 280 | { |
323 | m_terrainBase3 = value; | 281 | m_terrainBase3 = value; |
@@ -328,53 +286,46 @@ namespace OpenSim.Framework | |||
328 | 286 | ||
329 | // Higher resolution terrain textures | 287 | // Higher resolution terrain textures |
330 | private LLUUID m_terrainDetail0; | 288 | private LLUUID m_terrainDetail0; |
289 | |||
331 | public LLUUID terrainDetail0 | 290 | public LLUUID terrainDetail0 |
332 | { | 291 | { |
333 | get | 292 | get { return m_terrainDetail0; } |
334 | { | ||
335 | return m_terrainDetail0; | ||
336 | } | ||
337 | set | 293 | set |
338 | { | 294 | { |
339 | |||
340 | m_terrainDetail0 = value; | 295 | m_terrainDetail0 = value; |
341 | configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); | 296 | configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); |
342 | } | 297 | } |
343 | } | 298 | } |
344 | 299 | ||
345 | private LLUUID m_terrainDetail1; | 300 | private LLUUID m_terrainDetail1; |
301 | |||
346 | public LLUUID terrainDetail1 | 302 | public LLUUID terrainDetail1 |
347 | { | 303 | { |
348 | get | 304 | get { return m_terrainDetail1; } |
349 | { | ||
350 | return m_terrainDetail1; | ||
351 | } | ||
352 | set | 305 | set |
353 | { | 306 | { |
354 | m_terrainDetail1 = value; | 307 | m_terrainDetail1 = value; |
355 | configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); | 308 | configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); |
356 | } | 309 | } |
357 | } | 310 | } |
311 | |||
358 | private LLUUID m_terrainDetail2; | 312 | private LLUUID m_terrainDetail2; |
313 | |||
359 | public LLUUID terrainDetail2 | 314 | public LLUUID terrainDetail2 |
360 | { | 315 | { |
361 | get | 316 | get { return m_terrainDetail2; } |
362 | { | ||
363 | return m_terrainDetail2; | ||
364 | } | ||
365 | set | 317 | set |
366 | { | 318 | { |
367 | m_terrainDetail2 = value; | 319 | m_terrainDetail2 = value; |
368 | configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); | 320 | configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); |
369 | } | 321 | } |
370 | } | 322 | } |
323 | |||
371 | private LLUUID m_terrainDetail3; | 324 | private LLUUID m_terrainDetail3; |
325 | |||
372 | public LLUUID terrainDetail3 | 326 | public LLUUID terrainDetail3 |
373 | { | 327 | { |
374 | get | 328 | get { return m_terrainDetail3; } |
375 | { | ||
376 | return m_terrainDetail3; | ||
377 | } | ||
378 | set | 329 | set |
379 | { | 330 | { |
380 | m_terrainDetail3 = value; | 331 | m_terrainDetail3 = value; |
@@ -384,12 +335,10 @@ namespace OpenSim.Framework | |||
384 | 335 | ||
385 | // First quad - each point is bilinearly interpolated at each meter of terrain | 336 | // First quad - each point is bilinearly interpolated at each meter of terrain |
386 | private float m_terrainStartHeight0; | 337 | private float m_terrainStartHeight0; |
338 | |||
387 | public float terrainStartHeight0 | 339 | public float terrainStartHeight0 |
388 | { | 340 | { |
389 | get | 341 | get { return m_terrainStartHeight0; } |
390 | { | ||
391 | return m_terrainStartHeight0; | ||
392 | } | ||
393 | set | 342 | set |
394 | { | 343 | { |
395 | m_terrainStartHeight0 = value; | 344 | m_terrainStartHeight0 = value; |
@@ -399,12 +348,10 @@ namespace OpenSim.Framework | |||
399 | 348 | ||
400 | 349 | ||
401 | private float m_terrainStartHeight1; | 350 | private float m_terrainStartHeight1; |
351 | |||
402 | public float terrainStartHeight1 | 352 | public float terrainStartHeight1 |
403 | { | 353 | { |
404 | get | 354 | get { return m_terrainStartHeight1; } |
405 | { | ||
406 | return m_terrainStartHeight1; | ||
407 | } | ||
408 | set | 355 | set |
409 | { | 356 | { |
410 | m_terrainStartHeight1 = value; | 357 | m_terrainStartHeight1 = value; |
@@ -413,12 +360,10 @@ namespace OpenSim.Framework | |||
413 | } | 360 | } |
414 | 361 | ||
415 | private float m_terrainStartHeight2; | 362 | private float m_terrainStartHeight2; |
363 | |||
416 | public float terrainStartHeight2 | 364 | public float terrainStartHeight2 |
417 | { | 365 | { |
418 | get | 366 | get { return m_terrainStartHeight2; } |
419 | { | ||
420 | return m_terrainStartHeight2; | ||
421 | } | ||
422 | set | 367 | set |
423 | { | 368 | { |
424 | m_terrainStartHeight2 = value; | 369 | m_terrainStartHeight2 = value; |
@@ -427,28 +372,25 @@ namespace OpenSim.Framework | |||
427 | } | 372 | } |
428 | 373 | ||
429 | private float m_terrainStartHeight3; | 374 | private float m_terrainStartHeight3; |
375 | |||
430 | public float terrainStartHeight3 | 376 | public float terrainStartHeight3 |
431 | { | 377 | { |
432 | get | 378 | get { return m_terrainStartHeight3; } |
433 | { | ||
434 | return m_terrainStartHeight3; | ||
435 | } | ||
436 | set | 379 | set |
437 | { | 380 | { |
438 | m_terrainStartHeight3 = value; | 381 | m_terrainStartHeight3 = value; |
439 | configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); | 382 | configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); |
440 | } | 383 | } |
441 | } | 384 | } |
385 | |||
442 | // Second quad - also bilinearly interpolated. | 386 | // Second quad - also bilinearly interpolated. |
443 | // Terrain texturing is done that: | 387 | // Terrain texturing is done that: |
444 | // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] | 388 | // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] |
445 | private float m_terrainHeightRange0; | 389 | private float m_terrainHeightRange0; |
390 | |||
446 | public float terrainHeightRange0 | 391 | public float terrainHeightRange0 |
447 | { | 392 | { |
448 | get | 393 | get { return m_terrainHeightRange0; } |
449 | { | ||
450 | return m_terrainHeightRange0; | ||
451 | } | ||
452 | set | 394 | set |
453 | { | 395 | { |
454 | m_terrainHeightRange0 = value; | 396 | m_terrainHeightRange0 = value; |
@@ -457,12 +399,10 @@ namespace OpenSim.Framework | |||
457 | } | 399 | } |
458 | 400 | ||
459 | private float m_terrainHeightRange1; | 401 | private float m_terrainHeightRange1; |
402 | |||
460 | public float terrainHeightRange1 | 403 | public float terrainHeightRange1 |
461 | { | 404 | { |
462 | get | 405 | get { return m_terrainHeightRange1; } |
463 | { | ||
464 | return m_terrainHeightRange1; | ||
465 | } | ||
466 | set | 406 | set |
467 | { | 407 | { |
468 | m_terrainHeightRange1 = value; | 408 | m_terrainHeightRange1 = value; |
@@ -471,12 +411,10 @@ namespace OpenSim.Framework | |||
471 | } | 411 | } |
472 | 412 | ||
473 | private float m_terrainHeightRange2; | 413 | private float m_terrainHeightRange2; |
414 | |||
474 | public float terrainHeightRange2 | 415 | public float terrainHeightRange2 |
475 | { | 416 | { |
476 | get | 417 | get { return m_terrainHeightRange2; } |
477 | { | ||
478 | return m_terrainHeightRange2; | ||
479 | } | ||
480 | set | 418 | set |
481 | { | 419 | { |
482 | m_terrainHeightRange2 = value; | 420 | m_terrainHeightRange2 = value; |
@@ -485,26 +423,23 @@ namespace OpenSim.Framework | |||
485 | } | 423 | } |
486 | 424 | ||
487 | private float m_terrainHeightRange3; | 425 | private float m_terrainHeightRange3; |
426 | |||
488 | public float terrainHeightRange3 | 427 | public float terrainHeightRange3 |
489 | { | 428 | { |
490 | get | 429 | get { return m_terrainHeightRange3; } |
491 | { | ||
492 | return m_terrainHeightRange3; | ||
493 | } | ||
494 | set | 430 | set |
495 | { | 431 | { |
496 | m_terrainHeightRange3 = value; | 432 | m_terrainHeightRange3 = value; |
497 | configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); | 433 | configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); |
498 | } | 434 | } |
499 | } | 435 | } |
436 | |||
500 | // Terrain Default (Must be in F32 Format!) | 437 | // Terrain Default (Must be in F32 Format!) |
501 | private string m_terrainFile; | 438 | private string m_terrainFile; |
439 | |||
502 | public string terrainFile | 440 | public string terrainFile |
503 | { | 441 | { |
504 | get | 442 | get { return m_terrainFile; } |
505 | { | ||
506 | return m_terrainFile; | ||
507 | } | ||
508 | set | 443 | set |
509 | { | 444 | { |
510 | m_terrainFile = value; | 445 | m_terrainFile = value; |
@@ -513,12 +448,10 @@ namespace OpenSim.Framework | |||
513 | } | 448 | } |
514 | 449 | ||
515 | private double m_terrainMultiplier; | 450 | private double m_terrainMultiplier; |
451 | |||
516 | public double terrainMultiplier | 452 | public double terrainMultiplier |
517 | { | 453 | { |
518 | get | 454 | get { return m_terrainMultiplier; } |
519 | { | ||
520 | return m_terrainMultiplier; | ||
521 | } | ||
522 | set | 455 | set |
523 | { | 456 | { |
524 | m_terrainMultiplier = value; | 457 | m_terrainMultiplier = value; |
@@ -527,12 +460,10 @@ namespace OpenSim.Framework | |||
527 | } | 460 | } |
528 | 461 | ||
529 | private float m_waterHeight; | 462 | private float m_waterHeight; |
463 | |||
530 | public float waterHeight | 464 | public float waterHeight |
531 | { | 465 | { |
532 | get | 466 | get { return m_waterHeight; } |
533 | { | ||
534 | return m_waterHeight; | ||
535 | } | ||
536 | set | 467 | set |
537 | { | 468 | { |
538 | m_waterHeight = value; | 469 | m_waterHeight = value; |
@@ -541,73 +472,112 @@ namespace OpenSim.Framework | |||
541 | } | 472 | } |
542 | 473 | ||
543 | private LLUUID m_terrainImageID; | 474 | private LLUUID m_terrainImageID; |
475 | |||
544 | public LLUUID terrainImageID | 476 | public LLUUID terrainImageID |
545 | { | 477 | { |
546 | get | 478 | get { return m_terrainImageID; } |
547 | { | ||
548 | return m_terrainImageID; | ||
549 | } | ||
550 | set | 479 | set |
551 | { | 480 | { |
552 | m_terrainImageID = value; | 481 | m_terrainImageID = value; |
553 | configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); | 482 | configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); |
554 | } | 483 | } |
555 | } | 484 | } |
485 | |||
556 | private ConfigurationMember configMember; | 486 | private ConfigurationMember configMember; |
487 | |||
557 | public EstateSettings() | 488 | public EstateSettings() |
558 | { | 489 | { |
559 | // Temporary hack to prevent multiple loadings. | 490 | // Temporary hack to prevent multiple loadings. |
560 | if (configMember == null) | 491 | if (configMember == null) |
561 | { | 492 | { |
562 | configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration); | 493 | configMember = |
494 | new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", | ||
495 | loadConfigurationOptions, handleIncomingConfiguration); | ||
563 | configMember.performConfigurationRetrieve(); | 496 | configMember.performConfigurationRetrieve(); |
564 | } | 497 | } |
565 | } | 498 | } |
566 | 499 | ||
567 | public void loadConfigurationOptions() | 500 | public void loadConfigurationOptions() |
568 | { | 501 | { |
569 | configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "","0.0",true); | 502 | configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", |
570 | configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "","0",true); | 503 | "0.0", true); |
571 | configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); | 504 | configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", |
572 | configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", true); | 505 | true); |
573 | 506 | configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | |
574 | configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "1.0", true); | 507 | "", "0", true); |
575 | configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); | 508 | configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", |
576 | configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); | 509 | true); |
577 | configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); | 510 | |
578 | configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", true); | 511 | configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, |
579 | configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); | 512 | "", "1.0", true); |
580 | configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); | 513 | configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", |
581 | configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); | 514 | "0", true); |
582 | configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "false", true); | 515 | configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", |
583 | configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "1", true); | 516 | "0", true); |
584 | configMember.addConfigurationOption("region_water_height", ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true); | 517 | configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", |
585 | configMember.addConfigurationOption("region_allow_terraform", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true); | 518 | "0", true); |
586 | 519 | configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", | |
587 | configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); | 520 | true); |
588 | configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "abb783e6-3e93-26c0-248a-247666855da3", true); | 521 | configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", |
589 | configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "179cdabd-398a-9b6b-1391-4dc333ba321f", true); | 522 | true); |
590 | configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "beb169c7-11ea-fff2-efe5-0f24dc881df2", true); | 523 | configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, |
591 | 524 | "", "0", true); | |
592 | configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); | 525 | configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, |
593 | configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); | 526 | "", "0", true); |
594 | configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); | 527 | configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", |
595 | configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); | 528 | "false", true); |
596 | 529 | configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | |
597 | configMember.addConfigurationOption("terrain_start_height_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | 530 | "", "1", true); |
598 | configMember.addConfigurationOption("terrain_start_height_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | 531 | configMember.addConfigurationOption("region_water_height", |
599 | configMember.addConfigurationOption("terrain_start_height_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | 532 | ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true); |
600 | configMember.addConfigurationOption("terrain_start_height_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | 533 | configMember.addConfigurationOption("region_allow_terraform", |
601 | 534 | ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true); | |
602 | configMember.addConfigurationOption("terrain_height_range_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | 535 | |
603 | configMember.addConfigurationOption("terrain_height_range_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | 536 | configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", |
604 | configMember.addConfigurationOption("terrain_height_range_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | 537 | "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); |
605 | configMember.addConfigurationOption("terrain_height_range_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | 538 | configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", |
606 | 539 | "abb783e6-3e93-26c0-248a-247666855da3", true); | |
607 | configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", "default.r32", true); | 540 | configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", |
608 | configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | 541 | "179cdabd-398a-9b6b-1391-4dc333ba321f", true); |
609 | configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", "20.0", true); | 542 | configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", |
610 | configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); | 543 | "beb169c7-11ea-fff2-efe5-0f24dc881df2", true); |
544 | |||
545 | configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
546 | "", "00000000-0000-0000-0000-000000000000", true); | ||
547 | configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
548 | "", "00000000-0000-0000-0000-000000000000", true); | ||
549 | configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
550 | "", "00000000-0000-0000-0000-000000000000", true); | ||
551 | configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
552 | "", "00000000-0000-0000-0000-000000000000", true); | ||
553 | |||
554 | configMember.addConfigurationOption("terrain_start_height_0", | ||
555 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | ||
556 | configMember.addConfigurationOption("terrain_start_height_1", | ||
557 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | ||
558 | configMember.addConfigurationOption("terrain_start_height_2", | ||
559 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | ||
560 | configMember.addConfigurationOption("terrain_start_height_3", | ||
561 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); | ||
562 | |||
563 | configMember.addConfigurationOption("terrain_height_range_0", | ||
564 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | ||
565 | configMember.addConfigurationOption("terrain_height_range_1", | ||
566 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | ||
567 | configMember.addConfigurationOption("terrain_height_range_2", | ||
568 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | ||
569 | configMember.addConfigurationOption("terrain_height_range_3", | ||
570 | ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); | ||
571 | |||
572 | configMember.addConfigurationOption("terrain_file", | ||
573 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", | ||
574 | "default.r32", true); | ||
575 | configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, | ||
576 | "", "60.0", true); | ||
577 | configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", | ||
578 | "20.0", true); | ||
579 | configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, | ||
580 | "", "00000000-0000-0000-0000-000000000000", true); | ||
611 | } | 581 | } |
612 | 582 | ||
613 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 583 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -615,123 +585,123 @@ namespace OpenSim.Framework | |||
615 | switch (configuration_key) | 585 | switch (configuration_key) |
616 | { | 586 | { |
617 | case "billable_factor": | 587 | case "billable_factor": |
618 | this.m_billableFactor = (float)configuration_result; | 588 | m_billableFactor = (float) configuration_result; |
619 | break; | 589 | break; |
620 | case "estate_id": | 590 | case "estate_id": |
621 | this.m_estateID = (uint)configuration_result; | 591 | m_estateID = (uint) configuration_result; |
622 | break; | 592 | break; |
623 | case "parent_estate_id": | 593 | case "parent_estate_id": |
624 | this.m_parentEstateID = (uint)configuration_result; | 594 | m_parentEstateID = (uint) configuration_result; |
625 | break; | 595 | break; |
626 | case "max_agents": | 596 | case "max_agents": |
627 | this.m_maxAgents = (byte)configuration_result; | 597 | m_maxAgents = (byte) configuration_result; |
628 | break; | 598 | break; |
629 | 599 | ||
630 | case "object_bonus_factor": | 600 | case "object_bonus_factor": |
631 | this.m_objectBonusFactor = (float)configuration_result; | 601 | m_objectBonusFactor = (float) configuration_result; |
632 | break; | 602 | break; |
633 | case "redirect_grid_x": | 603 | case "redirect_grid_x": |
634 | this.m_redirectGridX = (int)configuration_result; | 604 | m_redirectGridX = (int) configuration_result; |
635 | break; | 605 | break; |
636 | case "redirect_grid_y": | 606 | case "redirect_grid_y": |
637 | this.m_redirectGridY = (int)configuration_result; | 607 | m_redirectGridY = (int) configuration_result; |
638 | break; | 608 | break; |
639 | case "region_flags": | 609 | case "region_flags": |
640 | this.m_regionFlags = (Simulator.RegionFlags)((uint)configuration_result); | 610 | m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result); |
641 | break; | 611 | break; |
642 | case "sim_access": | 612 | case "sim_access": |
643 | this.m_simAccess = (Simulator.SimAccess)((byte)configuration_result); | 613 | m_simAccess = (Simulator.SimAccess) ((byte) configuration_result); |
644 | break; | 614 | break; |
645 | case "sun_hour": | 615 | case "sun_hour": |
646 | this.m_sunHour = (float)configuration_result; | 616 | m_sunHour = (float) configuration_result; |
647 | break; | 617 | break; |
648 | case "terrain_raise_limit": | 618 | case "terrain_raise_limit": |
649 | this.m_terrainRaiseLimit = (float)configuration_result; | 619 | m_terrainRaiseLimit = (float) configuration_result; |
650 | break; | 620 | break; |
651 | case "terrain_lower_limit": | 621 | case "terrain_lower_limit": |
652 | this.m_terrainLowerLimit = (float)configuration_result; | 622 | m_terrainLowerLimit = (float) configuration_result; |
653 | break; | 623 | break; |
654 | case "use_fixed_sun": | 624 | case "use_fixed_sun": |
655 | this.m_useFixedSun = (bool)configuration_result; | 625 | m_useFixedSun = (bool) configuration_result; |
656 | break; | 626 | break; |
657 | case "price_per_meter": | 627 | case "price_per_meter": |
658 | this.m_pricePerMeter = System.Convert.ToInt32(configuration_result); | 628 | m_pricePerMeter = Convert.ToInt32(configuration_result); |
659 | break; | 629 | break; |
660 | case "region_water_height": | 630 | case "region_water_height": |
661 | this.m_regionWaterHeight = (ushort)configuration_result; | 631 | m_regionWaterHeight = (ushort) configuration_result; |
662 | break; | 632 | break; |
663 | case "region_allow_terraform": | 633 | case "region_allow_terraform": |
664 | this.m_regionAllowTerraform = (bool)configuration_result; | 634 | m_regionAllowTerraform = (bool) configuration_result; |
665 | break; | 635 | break; |
666 | 636 | ||
667 | case "terrain_base_0": | 637 | case "terrain_base_0": |
668 | this.m_terrainBase0 = (LLUUID)configuration_result; | 638 | m_terrainBase0 = (LLUUID) configuration_result; |
669 | break; | 639 | break; |
670 | case "terrain_base_1": | 640 | case "terrain_base_1": |
671 | this.m_terrainBase1 = (LLUUID)configuration_result; | 641 | m_terrainBase1 = (LLUUID) configuration_result; |
672 | break; | 642 | break; |
673 | case "terrain_base_2": | 643 | case "terrain_base_2": |
674 | this.m_terrainBase2 = (LLUUID)configuration_result; | 644 | m_terrainBase2 = (LLUUID) configuration_result; |
675 | break; | 645 | break; |
676 | case "terrain_base_3": | 646 | case "terrain_base_3": |
677 | this.m_terrainBase3 = (LLUUID)configuration_result; | 647 | m_terrainBase3 = (LLUUID) configuration_result; |
678 | break; | 648 | break; |
679 | 649 | ||
680 | case "terrain_detail_0": | 650 | case "terrain_detail_0": |
681 | this.m_terrainDetail0 = (LLUUID)configuration_result; | 651 | m_terrainDetail0 = (LLUUID) configuration_result; |
682 | break; | 652 | break; |
683 | case "terrain_detail_1": | 653 | case "terrain_detail_1": |
684 | this.m_terrainDetail1 = (LLUUID)configuration_result; | 654 | m_terrainDetail1 = (LLUUID) configuration_result; |
685 | break; | 655 | break; |
686 | case "terrain_detail_2": | 656 | case "terrain_detail_2": |
687 | this.m_terrainDetail2 = (LLUUID)configuration_result; | 657 | m_terrainDetail2 = (LLUUID) configuration_result; |
688 | break; | 658 | break; |
689 | case "terrain_detail_3": | 659 | case "terrain_detail_3": |
690 | this.m_terrainDetail3 = (LLUUID)configuration_result; | 660 | m_terrainDetail3 = (LLUUID) configuration_result; |
691 | break; | 661 | break; |
692 | 662 | ||
693 | case "terrain_start_height_0": | 663 | case "terrain_start_height_0": |
694 | this.m_terrainStartHeight0 = (float)configuration_result; | 664 | m_terrainStartHeight0 = (float) configuration_result; |
695 | break; | 665 | break; |
696 | case "terrain_start_height_1": | 666 | case "terrain_start_height_1": |
697 | this.m_terrainStartHeight1 = (float)configuration_result; | 667 | m_terrainStartHeight1 = (float) configuration_result; |
698 | break; | 668 | break; |
699 | case "terrain_start_height_2": | 669 | case "terrain_start_height_2": |
700 | this.m_terrainStartHeight2 = (float)configuration_result; | 670 | m_terrainStartHeight2 = (float) configuration_result; |
701 | break; | 671 | break; |
702 | case "terrain_start_height_3": | 672 | case "terrain_start_height_3": |
703 | this.m_terrainStartHeight3 = (float)configuration_result; | 673 | m_terrainStartHeight3 = (float) configuration_result; |
704 | break; | 674 | break; |
705 | 675 | ||
706 | case "terrain_height_range_0": | 676 | case "terrain_height_range_0": |
707 | this.m_terrainHeightRange0 = (float)configuration_result; | 677 | m_terrainHeightRange0 = (float) configuration_result; |
708 | break; | 678 | break; |
709 | case "terrain_height_range_1": | 679 | case "terrain_height_range_1": |
710 | this.m_terrainHeightRange1 = (float)configuration_result; | 680 | m_terrainHeightRange1 = (float) configuration_result; |
711 | break; | 681 | break; |
712 | case "terrain_height_range_2": | 682 | case "terrain_height_range_2": |
713 | this.m_terrainHeightRange2 = (float)configuration_result; | 683 | m_terrainHeightRange2 = (float) configuration_result; |
714 | break; | 684 | break; |
715 | case "terrain_height_range_3": | 685 | case "terrain_height_range_3": |
716 | this.m_terrainHeightRange3 = (float)configuration_result; | 686 | m_terrainHeightRange3 = (float) configuration_result; |
717 | break; | 687 | break; |
718 | 688 | ||
719 | case "terrain_file": | 689 | case "terrain_file": |
720 | this.m_terrainFile = (string)configuration_result; | 690 | m_terrainFile = (string) configuration_result; |
721 | break; | 691 | break; |
722 | case "terrain_multiplier": | 692 | case "terrain_multiplier": |
723 | this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result); | 693 | m_terrainMultiplier = Convert.ToDouble(configuration_result); |
724 | break; | 694 | break; |
725 | case "water_height": | 695 | case "water_height": |
726 | double tmpVal = (double) configuration_result; | 696 | double tmpVal = (double) configuration_result; |
727 | this.m_waterHeight = (float) tmpVal; | 697 | m_waterHeight = (float) tmpVal; |
728 | break; | 698 | break; |
729 | case "terrain_image_id": | 699 | case "terrain_image_id": |
730 | this.m_terrainImageID = (LLUUID)configuration_result; | 700 | m_terrainImageID = (LLUUID) configuration_result; |
731 | break; | 701 | break; |
732 | } | 702 | } |
733 | 703 | ||
734 | return true; | 704 | return true; |
735 | } | 705 | } |
736 | } | 706 | } |
737 | } | 707 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/GridConfig.cs b/OpenSim/Framework/General/GridConfig.cs index 64ce3b1..66d6c3a 100644 --- a/OpenSim/Framework/General/GridConfig.cs +++ b/OpenSim/Framework/General/GridConfig.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework | 29 | namespace OpenSim.Framework |
34 | { | 30 | { |
35 | public class GridConfig | 31 | public class GridConfig |
@@ -50,30 +46,49 @@ namespace OpenSim.Framework | |||
50 | 46 | ||
51 | public static uint DefaultHttpPort = 8001; | 47 | public static uint DefaultHttpPort = 8001; |
52 | public uint HttpPort = DefaultHttpPort; | 48 | public uint HttpPort = DefaultHttpPort; |
53 | 49 | ||
54 | private ConfigurationMember configMember; | 50 | private ConfigurationMember configMember; |
51 | |||
55 | public GridConfig(string description, string filename) | 52 | public GridConfig(string description, string filename) |
56 | { | 53 | { |
57 | configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); | 54 | configMember = |
55 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
58 | configMember.performConfigurationRetrieve(); | 56 | configMember.performConfigurationRetrieve(); |
59 | } | 57 | } |
60 | 58 | ||
61 | public void loadConfigurationOptions() | 59 | public void loadConfigurationOptions() |
62 | { | 60 | { |
63 | configMember.addConfigurationOption("grid_owner", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "OGS Grid Owner", "OGS development team", false); | 61 | configMember.addConfigurationOption("grid_owner", |
64 | configMember.addConfigurationOption("default_asset_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Asset Server URI", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/", false); | 62 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
65 | configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to asset server", "null", false); | 63 | "OGS Grid Owner", "OGS development team", false); |
66 | configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from asset server", "null", false); | 64 | configMember.addConfigurationOption("default_asset_server", |
65 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
66 | "Default Asset Server URI", | ||
67 | "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/", | ||
68 | false); | ||
69 | configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
70 | "Key to send to asset server", "null", false); | ||
71 | configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
72 | "Key to expect from asset server", "null", false); | ||
67 | 73 | ||
68 | configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false); | 74 | configMember.addConfigurationOption("default_user_server", |
69 | configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); | 75 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
70 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); | 76 | "Default User Server URI", |
77 | "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false); | ||
78 | configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
79 | "Key to send to user server", "null", false); | ||
80 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
81 | "Key to expect from user server", "null", false); | ||
71 | 82 | ||
72 | configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to a simulator", "null", false); | 83 | configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
73 | configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from a simulator", "null", false); | 84 | "Key to send to a simulator", "null", false); |
74 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | 85 | configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, |
86 | "Key to expect from a simulator", "null", false); | ||
87 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
88 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | ||
75 | 89 | ||
76 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); | 90 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
91 | "Http Listener port", DefaultHttpPort.ToString(), false); | ||
77 | } | 92 | } |
78 | 93 | ||
79 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 94 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -81,41 +96,41 @@ namespace OpenSim.Framework | |||
81 | switch (configuration_key) | 96 | switch (configuration_key) |
82 | { | 97 | { |
83 | case "grid_owner": | 98 | case "grid_owner": |
84 | this.GridOwner = (string)configuration_result; | 99 | GridOwner = (string) configuration_result; |
85 | break; | 100 | break; |
86 | case "default_asset_server": | 101 | case "default_asset_server": |
87 | this.DefaultAssetServer = (string)configuration_result; | 102 | DefaultAssetServer = (string) configuration_result; |
88 | break; | 103 | break; |
89 | case "asset_send_key": | 104 | case "asset_send_key": |
90 | this.AssetSendKey = (string)configuration_result; | 105 | AssetSendKey = (string) configuration_result; |
91 | break; | 106 | break; |
92 | case "asset_recv_key": | 107 | case "asset_recv_key": |
93 | this.AssetRecvKey = (string)configuration_result; | 108 | AssetRecvKey = (string) configuration_result; |
94 | break; | 109 | break; |
95 | case "default_user_server": | 110 | case "default_user_server": |
96 | this.DefaultUserServer = (string)configuration_result; | 111 | DefaultUserServer = (string) configuration_result; |
97 | break; | 112 | break; |
98 | case "user_send_key": | 113 | case "user_send_key": |
99 | this.UserSendKey = (string)configuration_result; | 114 | UserSendKey = (string) configuration_result; |
100 | break; | 115 | break; |
101 | case "user_recv_key": | 116 | case "user_recv_key": |
102 | this.UserRecvKey = (string)configuration_result; | 117 | UserRecvKey = (string) configuration_result; |
103 | break; | 118 | break; |
104 | case "sim_send_key": | 119 | case "sim_send_key": |
105 | this.SimSendKey = (string)configuration_result; | 120 | SimSendKey = (string) configuration_result; |
106 | break; | 121 | break; |
107 | case "sim_recv_key": | 122 | case "sim_recv_key": |
108 | this.SimRecvKey = (string)configuration_result; | 123 | SimRecvKey = (string) configuration_result; |
109 | break; | 124 | break; |
110 | case "database_provider": | 125 | case "database_provider": |
111 | this.DatabaseProvider = (string)configuration_result; | 126 | DatabaseProvider = (string) configuration_result; |
112 | break; | 127 | break; |
113 | case "http_port": | 128 | case "http_port": |
114 | HttpPort = (uint)configuration_result; | 129 | HttpPort = (uint) configuration_result; |
115 | break; | 130 | break; |
116 | } | 131 | } |
117 | 132 | ||
118 | return true; | 133 | return true; |
119 | } | 134 | } |
120 | } | 135 | } |
121 | } | 136 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IAssetProvider.cs b/OpenSim/Framework/General/IAssetProvider.cs index 42dbf1f..f452822 100644 --- a/OpenSim/Framework/General/IAssetProvider.cs +++ b/OpenSim/Framework/General/IAssetProvider.cs | |||
@@ -26,15 +26,11 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Framework; | ||
33 | using libsecondlife; | 29 | using libsecondlife; |
34 | 30 | ||
35 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
36 | { | 32 | { |
37 | public interface IAssetProvider : IPlugin | 33 | public interface IAssetProvider : IPlugin |
38 | { | 34 | { |
39 | AssetBase FetchAsset(LLUUID uuid); | 35 | AssetBase FetchAsset(LLUUID uuid); |
40 | void CreateAsset(AssetBase asset); | 36 | void CreateAsset(AssetBase asset); |
@@ -42,4 +38,4 @@ namespace OpenSim.Framework | |||
42 | bool ExistsAsset(LLUUID uuid); | 38 | bool ExistsAsset(LLUUID uuid); |
43 | void CommitAssets(); // force a sync to the database | 39 | void CommitAssets(); // force a sync to the database |
44 | } | 40 | } |
45 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IAssetServer.cs b/OpenSim/Framework/General/IAssetServer.cs index ae86c8c..f4cb533 100644 --- a/OpenSim/Framework/General/IAssetServer.cs +++ b/OpenSim/Framework/General/IAssetServer.cs | |||
@@ -28,14 +28,12 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
32 | 31 | ||
33 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
34 | { | 33 | { |
35 | /// <summary> | 34 | /// <summary> |
36 | /// Description of IAssetServer. | 35 | /// Description of IAssetServer. |
37 | /// </summary> | 36 | /// </summary> |
38 | |||
39 | public interface IAssetServer | 37 | public interface IAssetServer |
40 | { | 38 | { |
41 | void SetReceiver(IAssetReceiver receiver); | 39 | void SetReceiver(IAssetReceiver receiver); |
@@ -68,4 +66,4 @@ namespace OpenSim.Framework | |||
68 | public LLUUID AssetID; | 66 | public LLUUID AssetID; |
69 | public bool IsTexture; | 67 | public bool IsTexture; |
70 | } | 68 | } |
71 | } | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IClientAPI.cs b/OpenSim/Framework/General/IClientAPI.cs index 8c81eae..c7ec514 100644 --- a/OpenSim/Framework/General/IClientAPI.cs +++ b/OpenSim/Framework/General/IClientAPI.cs | |||
@@ -30,31 +30,28 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | ||
34 | 33 | ||
35 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
36 | { | 35 | { |
37 | // Base Args Interface | 36 | // Base Args Interface |
38 | public interface IEventArgs | 37 | public interface IEventArgs |
39 | { | 38 | { |
40 | IScene Scene | 39 | IScene Scene { get; set; } |
41 | { | ||
42 | get; | ||
43 | set; | ||
44 | } | ||
45 | 40 | ||
46 | IClientAPI Sender | 41 | IClientAPI Sender { get; set; } |
47 | { | ||
48 | get; | ||
49 | set; | ||
50 | } | ||
51 | } | 42 | } |
52 | 43 | ||
53 | public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); | 44 | public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); |
54 | 45 | ||
55 | public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e); | 46 | public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e); |
56 | 47 | ||
57 | public enum ChatTypeEnum { Whisper = 0, Say = 1, Shout = 2, Broadcast = 0xFF }; | 48 | public enum ChatTypeEnum |
49 | { | ||
50 | Whisper = 0, | ||
51 | Say = 1, | ||
52 | Shout = 2, | ||
53 | Broadcast = 0xFF | ||
54 | } ; | ||
58 | 55 | ||
59 | /// <summary> | 56 | /// <summary> |
60 | /// ChatFromViewer Arguments | 57 | /// ChatFromViewer Arguments |
@@ -163,68 +160,127 @@ namespace OpenSim.Framework | |||
163 | 160 | ||
164 | public delegate void TextureRequest(Object sender, TextureRequestArgs e); | 161 | public delegate void TextureRequest(Object sender, TextureRequestArgs e); |
165 | 162 | ||
166 | public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list | 163 | public delegate void ImprovedInstantMessage( |
164 | LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, | ||
165 | string fromAgentName, string message, byte dialog); // Cut down from full list | ||
167 | public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); | 166 | public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); |
168 | public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); | 167 | |
168 | public delegate void ModifyTerrain( | ||
169 | float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); | ||
170 | |||
169 | public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); | 171 | public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); |
172 | |||
170 | public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); | 173 | public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); |
174 | |||
171 | public delegate void LinkObjects(uint parent, List<uint> children); | 175 | public delegate void LinkObjects(uint parent, List<uint> children); |
176 | |||
172 | public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); | 177 | public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); |
173 | public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); | 178 | |
179 | public delegate void TeleportLocationRequest( | ||
180 | IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); | ||
181 | |||
174 | public delegate void DisconnectUser(); | 182 | public delegate void DisconnectUser(); |
183 | |||
175 | public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); | 184 | public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); |
176 | 185 | ||
177 | public delegate void GenericCall(IClientAPI remoteClient); | 186 | public delegate void GenericCall(IClientAPI remoteClient); |
187 | |||
178 | public delegate void GenericCall2(); | 188 | public delegate void GenericCall2(); |
179 | public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. | 189 | |
190 | public delegate void GenericCall3(Packet packet); | ||
191 | |||
192 | // really don't want to be passing packets in these events, so this is very temporary. | ||
180 | public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); | 193 | public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); |
194 | |||
181 | public delegate void GenericCall5(IClientAPI remoteClient, bool status); | 195 | public delegate void GenericCall5(IClientAPI remoteClient, bool status); |
196 | |||
182 | public delegate void GenericCall6(LLUUID uid); | 197 | public delegate void GenericCall6(LLUUID uid); |
198 | |||
183 | public delegate void GenericCall7(uint localID, string message); | 199 | public delegate void GenericCall7(uint localID, string message); |
184 | 200 | ||
185 | public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); | 201 | public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); |
202 | |||
186 | public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); | 203 | public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); |
204 | |||
187 | public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); | 205 | public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); |
206 | |||
188 | public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); | 207 | public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); |
208 | |||
189 | public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); | 209 | public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); |
210 | |||
190 | public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); | 211 | public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); |
212 | |||
191 | public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); | 213 | public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); |
214 | |||
192 | public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); | 215 | public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); |
216 | |||
193 | public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); | 217 | public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); |
194 | public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); | 218 | |
219 | public delegate void UpdatePrimGroupRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); | ||
220 | |||
195 | public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); | 221 | public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); |
222 | |||
196 | public delegate void StatusChange(bool status); | 223 | public delegate void StatusChange(bool status); |
224 | |||
197 | public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); | 225 | public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); |
226 | |||
198 | public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); | 227 | public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); |
228 | |||
199 | public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID); | 229 | public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID); |
230 | |||
200 | public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); | 231 | public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); |
232 | |||
201 | public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); | 233 | public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); |
202 | 234 | ||
203 | public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); | 235 | public delegate void ParcelPropertiesRequest( |
236 | int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); | ||
237 | |||
204 | public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); | 238 | public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); |
239 | |||
205 | public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); | 240 | public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); |
241 | |||
206 | public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); | 242 | public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); |
243 | |||
207 | public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client); | 244 | public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client); |
245 | |||
208 | public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); | 246 | public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); |
247 | |||
209 | public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); | 248 | public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); |
210 | 249 | ||
211 | public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); | 250 | public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); |
212 | 251 | ||
213 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); | 252 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); |
214 | 253 | ||
215 | public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); | 254 | public delegate void CreateInventoryFolder( |
216 | public delegate void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); | 255 | IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); |
217 | public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); | 256 | |
257 | public delegate void CreateNewInventoryItem( | ||
258 | IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, | ||
259 | sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); | ||
260 | |||
261 | public delegate void FetchInventoryDescendents( | ||
262 | IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); | ||
263 | |||
218 | public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); | 264 | public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); |
265 | |||
219 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); | 266 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); |
220 | public delegate void UpdateInventoryItemTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); | 267 | |
268 | public delegate void UpdateInventoryItemTransaction( | ||
269 | IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); | ||
270 | |||
221 | public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); | 271 | public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); |
272 | |||
222 | public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); | 273 | public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); |
274 | |||
223 | public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); | 275 | public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); |
224 | 276 | ||
225 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal); | 277 | public delegate void UDPAssetUploadRequest( |
278 | IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal); | ||
279 | |||
226 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); | 280 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); |
281 | |||
227 | public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); | 282 | public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); |
283 | |||
228 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); | 284 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); |
229 | 285 | ||
230 | public interface IClientAPI | 286 | public interface IClientAPI |
@@ -298,37 +354,17 @@ namespace OpenSim.Framework | |||
298 | event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; | 354 | event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; |
299 | event EstateOwnerMessageRequest OnEstateOwnerMessage; | 355 | event EstateOwnerMessageRequest OnEstateOwnerMessage; |
300 | 356 | ||
301 | LLVector3 StartPos | 357 | LLVector3 StartPos { get; set; } |
302 | { | ||
303 | get; | ||
304 | set; | ||
305 | } | ||
306 | 358 | ||
307 | LLUUID AgentId | 359 | LLUUID AgentId { get; } |
308 | { | ||
309 | get; | ||
310 | } | ||
311 | 360 | ||
312 | LLUUID SessionId | 361 | LLUUID SessionId { get; } |
313 | { | ||
314 | get; | ||
315 | } | ||
316 | 362 | ||
317 | string FirstName | 363 | string FirstName { get; } |
318 | { | ||
319 | get; | ||
320 | } | ||
321 | 364 | ||
322 | string LastName | 365 | string LastName { get; } |
323 | { | ||
324 | get; | ||
325 | } | ||
326 | 366 | ||
327 | uint CircuitCode | 367 | uint CircuitCode { get; set; } |
328 | { | ||
329 | get; | ||
330 | set; | ||
331 | } | ||
332 | 368 | ||
333 | void OutPacket(Packet newPack); | 369 | void OutPacket(Packet newPack); |
334 | void SendWearables(AvatarWearable[] wearables); | 370 | void SendWearables(AvatarWearable[] wearables); |
@@ -339,28 +375,46 @@ namespace OpenSim.Framework | |||
339 | void SendRegionHandshake(RegionInfo regionInfo); | 375 | void SendRegionHandshake(RegionInfo regionInfo); |
340 | void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); | 376 | void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); |
341 | void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); | 377 | void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); |
342 | void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp); | 378 | |
379 | void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, | ||
380 | LLUUID imSessionID, string fromName, byte dialog, uint timeStamp); | ||
381 | |||
343 | void SendLayerData(float[] map); | 382 | void SendLayerData(float[] map); |
344 | void SendLayerData(int px, int py, float[] map); | 383 | void SendLayerData(int px, int py, float[] map); |
345 | void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); | 384 | void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); |
346 | void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint ); | 385 | void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); |
347 | AgentCircuitData RequestClientInfo(); | 386 | AgentCircuitData RequestClientInfo(); |
348 | void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL ); | 387 | |
388 | void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, | ||
389 | string capsURL); | ||
390 | |||
349 | void SendMapBlock(List<MapBlockData> mapBlocks); | 391 | void SendMapBlock(List<MapBlockData> mapBlocks); |
350 | void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); | 392 | void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); |
351 | void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL); | 393 | |
394 | void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, | ||
395 | uint flags, string capsURL); | ||
396 | |||
352 | void SendTeleportCancel(); | 397 | void SendTeleportCancel(); |
353 | void SendTeleportLocationStart(); | 398 | void SendTeleportLocationStart(); |
354 | void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); | 399 | void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); |
355 | 400 | ||
356 | void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID); | 401 | void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, |
357 | void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation); | 402 | LLVector3 Pos, byte[] textureEntry, uint parentID); |
403 | |||
404 | void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | ||
405 | LLVector3 velocity, LLQuaternion rotation); | ||
406 | |||
358 | void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations); | 407 | void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations); |
359 | 408 | ||
360 | void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); | 409 | void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); |
361 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation); | 410 | |
362 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); | 411 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, |
363 | 412 | LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, | |
413 | uint parentID, byte[] particleSystem, LLQuaternion rotation); | ||
414 | |||
415 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | ||
416 | LLQuaternion rotation); | ||
417 | |||
364 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); | 418 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); |
365 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); | 419 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); |
366 | void SendInventoryItemUpdate(InventoryItemBase Item); | 420 | void SendInventoryItemUpdate(InventoryItemBase Item); |
@@ -375,10 +429,13 @@ namespace OpenSim.Framework | |||
375 | void SendAlertMessage(string message); | 429 | void SendAlertMessage(string message); |
376 | void SendAgentAlertMessage(string message, bool modal); | 430 | void SendAgentAlertMessage(string message, bool modal); |
377 | void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); | 431 | void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); |
378 | bool AddMoney( int debit ); | 432 | bool AddMoney(int debit); |
379 | 433 | ||
380 | void SendViewerTime(int phase); | 434 | void SendViewerTime(int phase); |
381 | void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); | 435 | |
436 | void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, | ||
437 | uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); | ||
438 | |||
382 | void SetDebug(int newDebug); | 439 | void SetDebug(int newDebug); |
383 | void InPacket(Packet NewPack); | 440 | void InPacket(Packet NewPack); |
384 | void Close(); | 441 | void Close(); |
@@ -387,4 +444,4 @@ namespace OpenSim.Framework | |||
387 | event Action<IClientAPI> OnConnectionClosed; | 444 | event Action<IClientAPI> OnConnectionClosed; |
388 | void SendLogoutPacket(); | 445 | void SendLogoutPacket(); |
389 | } | 446 | } |
390 | } | 447 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IGenericConfig.cs b/OpenSim/Framework/General/IGenericConfig.cs index 8d45d47..0c9ee1e 100644 --- a/OpenSim/Framework/General/IGenericConfig.cs +++ b/OpenSim/Framework/General/IGenericConfig.cs | |||
@@ -37,4 +37,4 @@ namespace OpenSim.Framework | |||
37 | void Commit(); | 37 | void Commit(); |
38 | void Close(); | 38 | void Close(); |
39 | } | 39 | } |
40 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IPlugin.cs b/OpenSim/Framework/General/IPlugin.cs index 6926ef4..cc835da 100644 --- a/OpenSim/Framework/General/IPlugin.cs +++ b/OpenSim/Framework/General/IPlugin.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework | 29 | namespace OpenSim.Framework |
34 | { | 30 | { |
35 | /// <summary> | 31 | /// <summary> |
@@ -54,4 +50,4 @@ namespace OpenSim.Framework | |||
54 | /// </summary> | 50 | /// </summary> |
55 | void Initialise(); | 51 | void Initialise(); |
56 | } | 52 | } |
57 | } | 53 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IRegionCommsListener.cs b/OpenSim/Framework/General/IRegionCommsListener.cs index 9ac9988..1a24469 100644 --- a/OpenSim/Framework/General/IRegionCommsListener.cs +++ b/OpenSim/Framework/General/IRegionCommsListener.cs | |||
@@ -27,14 +27,15 @@ | |||
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Interfaces; | ||
31 | using OpenSim.Framework; | ||
32 | 30 | ||
33 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
34 | { | 32 | { |
35 | public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); | 33 | public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); |
34 | |||
36 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); | 35 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); |
36 | |||
37 | public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); | 37 | public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
38 | |||
38 | public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); | 39 | public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); |
39 | 40 | ||
40 | public interface IRegionCommsListener | 41 | public interface IRegionCommsListener |
@@ -45,4 +46,4 @@ namespace OpenSim.Framework | |||
45 | event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; | 46 | event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; |
46 | event UpdateNeighbours OnNeighboursUpdate; | 47 | event UpdateNeighbours OnNeighboursUpdate; |
47 | } | 48 | } |
48 | } | 49 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IScene.cs b/OpenSim/Framework/General/IScene.cs index 9f03a04..cf5ee93 100644 --- a/OpenSim/Framework/General/IScene.cs +++ b/OpenSim/Framework/General/IScene.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using OpenSim.Framework; | ||
30 | 29 | ||
31 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
32 | { | 31 | { |
@@ -34,14 +33,11 @@ namespace OpenSim.Framework | |||
34 | { | 33 | { |
35 | void AddNewClient(IClientAPI client, bool child); | 34 | void AddNewClient(IClientAPI client, bool child); |
36 | void RemoveClient(LLUUID agentID); | 35 | void RemoveClient(LLUUID agentID); |
37 | 36 | ||
38 | RegionInfo RegionInfo { get; } | 37 | RegionInfo RegionInfo { get; } |
39 | object SyncRoot { get; } | 38 | object SyncRoot { get; } |
40 | uint NextLocalId { get; } | 39 | uint NextLocalId { get; } |
41 | 40 | ||
42 | ClientManager ClientManager | 41 | ClientManager ClientManager { get; } |
43 | { | ||
44 | get; | ||
45 | } | ||
46 | } | 42 | } |
47 | } | 43 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IUserData.cs b/OpenSim/Framework/General/IUserData.cs index e1e9c99..b955ef1 100644 --- a/OpenSim/Framework/General/IUserData.cs +++ b/OpenSim/Framework/General/IUserData.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using OpenSim.Framework; | ||
30 | 29 | ||
31 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
32 | { | 31 | { |
@@ -132,4 +131,4 @@ namespace OpenSim.Framework | |||
132 | /// </summary> | 131 | /// </summary> |
133 | void Initialise(); | 132 | void Initialise(); |
134 | } | 133 | } |
135 | } | 134 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/IUserService.cs b/OpenSim/Framework/General/IUserService.cs index 400c12b..bf1c7e8 100644 --- a/OpenSim/Framework/General/IUserService.cs +++ b/OpenSim/Framework/General/IUserService.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using OpenSim.Framework; | ||
30 | 29 | ||
31 | namespace OpenSim.Framework.Interfaces | 30 | namespace OpenSim.Framework.Interfaces |
32 | { | 31 | { |
diff --git a/OpenSim/Framework/General/InventoryItemBase.cs b/OpenSim/Framework/General/InventoryItemBase.cs index 27124d9..45700ae 100644 --- a/OpenSim/Framework/General/InventoryItemBase.cs +++ b/OpenSim/Framework/General/InventoryItemBase.cs | |||
@@ -39,50 +39,62 @@ namespace OpenSim.Framework | |||
39 | /// A UUID containing the ID for the inventory item itself | 39 | /// A UUID containing the ID for the inventory item itself |
40 | /// </summary> | 40 | /// </summary> |
41 | public LLUUID inventoryID; | 41 | public LLUUID inventoryID; |
42 | |||
42 | /// <summary> | 43 | /// <summary> |
43 | /// The UUID of the associated asset on the asset server | 44 | /// The UUID of the associated asset on the asset server |
44 | /// </summary> | 45 | /// </summary> |
45 | public LLUUID assetID; | 46 | public LLUUID assetID; |
47 | |||
46 | /// <summary> | 48 | /// <summary> |
47 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | 49 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) |
48 | /// </summary> | 50 | /// </summary> |
49 | public int assetType; | 51 | public int assetType; |
52 | |||
50 | /// <summary> | 53 | /// <summary> |
51 | /// The type of inventory item. (Can be slightly different to the asset type | 54 | /// The type of inventory item. (Can be slightly different to the asset type |
52 | /// </summary> | 55 | /// </summary> |
53 | public int invType; | 56 | public int invType; |
57 | |||
54 | /// <summary> | 58 | /// <summary> |
55 | /// The folder this item is contained in | 59 | /// The folder this item is contained in |
56 | /// </summary> | 60 | /// </summary> |
57 | public LLUUID parentFolderID; | 61 | public LLUUID parentFolderID; |
62 | |||
58 | /// <summary> | 63 | /// <summary> |
59 | /// The owner of this inventory item | 64 | /// The owner of this inventory item |
60 | /// </summary> | 65 | /// </summary> |
61 | public LLUUID avatarID; | 66 | public LLUUID avatarID; |
67 | |||
62 | /// <summary> | 68 | /// <summary> |
63 | /// The creator of this item | 69 | /// The creator of this item |
64 | /// </summary> | 70 | /// </summary> |
65 | public LLUUID creatorsID; | 71 | public LLUUID creatorsID; |
72 | |||
66 | /// <summary> | 73 | /// <summary> |
67 | /// The name of the inventory item (must be less than 64 characters) | 74 | /// The name of the inventory item (must be less than 64 characters) |
68 | /// </summary> | 75 | /// </summary> |
69 | public string inventoryName; | 76 | public string inventoryName; |
77 | |||
70 | /// <summary> | 78 | /// <summary> |
71 | /// The description of the inventory item (must be less than 64 characters) | 79 | /// The description of the inventory item (must be less than 64 characters) |
72 | /// </summary> | 80 | /// </summary> |
73 | public string inventoryDescription; | 81 | public string inventoryDescription; |
82 | |||
74 | /// <summary> | 83 | /// <summary> |
75 | /// A mask containing the permissions for the next owner (cannot be enforced) | 84 | /// A mask containing the permissions for the next owner (cannot be enforced) |
76 | /// </summary> | 85 | /// </summary> |
77 | public uint inventoryNextPermissions; | 86 | public uint inventoryNextPermissions; |
87 | |||
78 | /// <summary> | 88 | /// <summary> |
79 | /// A mask containing permissions for the current owner (cannot be enforced) | 89 | /// A mask containing permissions for the current owner (cannot be enforced) |
80 | /// </summary> | 90 | /// </summary> |
81 | public uint inventoryCurrentPermissions; | 91 | public uint inventoryCurrentPermissions; |
92 | |||
82 | /// <summary> | 93 | /// <summary> |
83 | /// | 94 | /// |
84 | /// </summary> | 95 | /// </summary> |
85 | public uint inventoryBasePermissions; | 96 | public uint inventoryBasePermissions; |
97 | |||
86 | /// <summary> | 98 | /// <summary> |
87 | /// | 99 | /// |
88 | /// </summary> | 100 | /// </summary> |
@@ -98,22 +110,27 @@ namespace OpenSim.Framework | |||
98 | /// The name of the folder (64 characters or less) | 110 | /// The name of the folder (64 characters or less) |
99 | /// </summary> | 111 | /// </summary> |
100 | public string name; | 112 | public string name; |
113 | |||
101 | /// <summary> | 114 | /// <summary> |
102 | /// The agent who's inventory this is contained by | 115 | /// The agent who's inventory this is contained by |
103 | /// </summary> | 116 | /// </summary> |
104 | public LLUUID agentID; | 117 | public LLUUID agentID; |
118 | |||
105 | /// <summary> | 119 | /// <summary> |
106 | /// The folder this folder is contained in | 120 | /// The folder this folder is contained in |
107 | /// </summary> | 121 | /// </summary> |
108 | public LLUUID parentID; | 122 | public LLUUID parentID; |
123 | |||
109 | /// <summary> | 124 | /// <summary> |
110 | /// The UUID for this folder | 125 | /// The UUID for this folder |
111 | /// </summary> | 126 | /// </summary> |
112 | public LLUUID folderID; | 127 | public LLUUID folderID; |
128 | |||
113 | /// <summary> | 129 | /// <summary> |
114 | /// Tyep of Items normally stored in this folder | 130 | /// Tyep of Items normally stored in this folder |
115 | /// </summary> | 131 | /// </summary> |
116 | public short type; | 132 | public short type; |
133 | |||
117 | /// <summary> | 134 | /// <summary> |
118 | /// | 135 | /// |
119 | /// </summary> | 136 | /// </summary> |
@@ -225,4 +242,4 @@ namespace OpenSim.Framework | |||
225 | /// <param name="folder">The id of the folder</param> | 242 | /// <param name="folder">The id of the folder</param> |
226 | void deleteInventoryFolder(LLUUID folder); | 243 | void deleteInventoryFolder(LLUUID folder); |
227 | } | 244 | } |
228 | } | 245 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/LandData.cs b/OpenSim/Framework/General/LandData.cs index 414b613..cab71a9 100644 --- a/OpenSim/Framework/General/LandData.cs +++ b/OpenSim/Framework/General/LandData.cs | |||
@@ -29,92 +29,95 @@ using libsecondlife; | |||
29 | 29 | ||
30 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
31 | { | 31 | { |
32 | 32 | public class LandData | |
33 | public class LandData | 33 | { |
34 | { | 34 | public byte[] landBitmapByteArray = new byte[512]; |
35 | public byte[] landBitmapByteArray = new byte[512]; | 35 | public string landName = "Your Parcel"; |
36 | public string landName = "Your Parcel"; | 36 | public string landDesc = ""; |
37 | public string landDesc = ""; | 37 | public LLUUID ownerID = new LLUUID(); |
38 | public LLUUID ownerID = new LLUUID(); | 38 | public bool isGroupOwned = false; |
39 | public bool isGroupOwned = false; | 39 | public LLVector3 AABBMin = new LLVector3(); |
40 | public LLVector3 AABBMin = new LLVector3(); | 40 | public LLVector3 AABBMax = new LLVector3(); |
41 | public LLVector3 AABBMax = new LLVector3(); | 41 | public int area = 0; |
42 | public int area = 0; | 42 | public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned |
43 | public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned | 43 | public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID |
44 | public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID | 44 | public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category |
45 | public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category | 45 | public int claimDate = 0; //Unemplemented |
46 | public int claimDate = 0; //Unemplemented | 46 | public int claimPrice = 0; //Unemplemented |
47 | public int claimPrice = 0; //Unemplemented | 47 | public LLUUID groupID = new LLUUID(); //Unemplemented |
48 | public LLUUID groupID = new LLUUID(); //Unemplemented | 48 | public int groupPrims = 0; |
49 | public int groupPrims = 0; | 49 | public int otherPrims = 0; |
50 | public int otherPrims = 0; | 50 | public int ownerPrims = 0; |
51 | public int ownerPrims = 0; | 51 | public int selectedPrims = 0; |
52 | public int selectedPrims = 0; | 52 | public int simwidePrims = 0; |
53 | public int simwidePrims = 0; | 53 | public int simwideArea = 0; |
54 | public int simwideArea = 0; | 54 | public int salePrice = 0; //Unemeplemented. Parcels price. |
55 | public int salePrice = 0; //Unemeplemented. Parcels price. | 55 | public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; |
56 | public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; | 56 | |
57 | public uint landFlags = (uint)Parcel.ParcelFlags.AllowFly | (uint)Parcel.ParcelFlags.AllowLandmark | (uint)Parcel.ParcelFlags.AllowAllObjectEntry | (uint)Parcel.ParcelFlags.AllowDeedToGroup | (uint)Parcel.ParcelFlags.AllowTerraform | (uint)Parcel.ParcelFlags.CreateObjects | (uint)Parcel.ParcelFlags.AllowOtherScripts | (uint)Parcel.ParcelFlags.SoundLocal ; | 57 | public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark | |
58 | public byte landingType = 0; | 58 | (uint) Parcel.ParcelFlags.AllowAllObjectEntry | |
59 | public byte mediaAutoScale = 0; | 59 | (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform | |
60 | public LLUUID mediaID = LLUUID.Zero; | 60 | (uint) Parcel.ParcelFlags.CreateObjects | (uint) Parcel.ParcelFlags.AllowOtherScripts | |
61 | public int localID = 0; | 61 | (uint) Parcel.ParcelFlags.SoundLocal; |
62 | public LLUUID globalID = new LLUUID(); | 62 | |
63 | public byte landingType = 0; | ||
64 | public byte mediaAutoScale = 0; | ||
65 | public LLUUID mediaID = LLUUID.Zero; | ||
66 | public int localID = 0; | ||
67 | public LLUUID globalID = new LLUUID(); | ||
63 | 68 | ||
64 | public string mediaURL = ""; | 69 | public string mediaURL = ""; |
65 | public string musicURL = ""; | 70 | public string musicURL = ""; |
66 | public float passHours = 0; | 71 | public float passHours = 0; |
67 | public int passPrice = 0; | 72 | public int passPrice = 0; |
68 | public LLUUID snapshotID = LLUUID.Zero; | 73 | public LLUUID snapshotID = LLUUID.Zero; |
69 | public LLVector3 userLocation = new LLVector3(); | 74 | public LLVector3 userLocation = new LLVector3(); |
70 | public LLVector3 userLookAt = new LLVector3(); | 75 | public LLVector3 userLookAt = new LLVector3(); |
71 | 76 | ||
72 | public LandData() | 77 | public LandData() |
73 | { | 78 | { |
74 | globalID = LLUUID.Random(); | 79 | globalID = LLUUID.Random(); |
75 | } | 80 | } |
76 | 81 | ||
77 | public LandData Copy() | 82 | public LandData Copy() |
78 | { | 83 | { |
79 | LandData landData = new LandData(); | 84 | LandData landData = new LandData(); |
80 | 85 | ||
81 | landData.AABBMax = this.AABBMax; | 86 | landData.AABBMax = AABBMax; |
82 | landData.AABBMin = this.AABBMin; | 87 | landData.AABBMin = AABBMin; |
83 | landData.area = this.area; | 88 | landData.area = area; |
84 | landData.auctionID = this.auctionID; | 89 | landData.auctionID = auctionID; |
85 | landData.authBuyerID = this.authBuyerID; | 90 | landData.authBuyerID = authBuyerID; |
86 | landData.category = this.category; | 91 | landData.category = category; |
87 | landData.claimDate = this.claimDate; | 92 | landData.claimDate = claimDate; |
88 | landData.claimPrice = this.claimPrice; | 93 | landData.claimPrice = claimPrice; |
89 | landData.globalID = this.globalID; | 94 | landData.globalID = globalID; |
90 | landData.groupID = this.groupID; | 95 | landData.groupID = groupID; |
91 | landData.groupPrims = this.groupPrims; | 96 | landData.groupPrims = groupPrims; |
92 | landData.otherPrims = this.otherPrims; | 97 | landData.otherPrims = otherPrims; |
93 | landData.ownerPrims = this.ownerPrims; | 98 | landData.ownerPrims = ownerPrims; |
94 | landData.selectedPrims = this.selectedPrims; | 99 | landData.selectedPrims = selectedPrims; |
95 | landData.isGroupOwned = this.isGroupOwned; | 100 | landData.isGroupOwned = isGroupOwned; |
96 | landData.localID = this.localID; | 101 | landData.localID = localID; |
97 | landData.landingType = this.landingType; | 102 | landData.landingType = landingType; |
98 | landData.mediaAutoScale = this.mediaAutoScale; | 103 | landData.mediaAutoScale = mediaAutoScale; |
99 | landData.mediaID = this.mediaID; | 104 | landData.mediaID = mediaID; |
100 | landData.mediaURL = this.mediaURL; | 105 | landData.mediaURL = mediaURL; |
101 | landData.musicURL = this.musicURL; | 106 | landData.musicURL = musicURL; |
102 | landData.ownerID = this.ownerID; | 107 | landData.ownerID = ownerID; |
103 | landData.landBitmapByteArray = (byte[])this.landBitmapByteArray.Clone(); | 108 | landData.landBitmapByteArray = (byte[]) landBitmapByteArray.Clone(); |
104 | landData.landDesc = this.landDesc; | 109 | landData.landDesc = landDesc; |
105 | landData.landFlags = this.landFlags; | 110 | landData.landFlags = landFlags; |
106 | landData.landName = this.landName; | 111 | landData.landName = landName; |
107 | landData.landStatus = this.landStatus; | 112 | landData.landStatus = landStatus; |
108 | landData.passHours = this.passHours; | 113 | landData.passHours = passHours; |
109 | landData.passPrice = this.passPrice; | 114 | landData.passPrice = passPrice; |
110 | landData.salePrice = this.salePrice; | 115 | landData.salePrice = salePrice; |
111 | landData.snapshotID = this.snapshotID; | 116 | landData.snapshotID = snapshotID; |
112 | landData.userLocation = this.userLocation; | 117 | landData.userLocation = userLocation; |
113 | landData.userLookAt = this.userLookAt; | 118 | landData.userLookAt = userLookAt; |
114 | 119 | ||
115 | return landData; | 120 | return landData; |
116 | |||
117 | } | ||
118 | } | 121 | } |
119 | 122 | } | |
120 | } | 123 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/Login.cs b/OpenSim/Framework/General/Login.cs index a55fd57..d9a5ab2 100644 --- a/OpenSim/Framework/General/Login.cs +++ b/OpenSim/Framework/General/Login.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Framework | |||
39 | public LLUUID InventoryFolder; | 39 | public LLUUID InventoryFolder; |
40 | public LLUUID BaseFolder; | 40 | public LLUUID BaseFolder; |
41 | public uint CircuitCode; | 41 | public uint CircuitCode; |
42 | public string CapsPath =""; | 42 | public string CapsPath = ""; |
43 | public LLVector3 StartPos; | 43 | public LLVector3 StartPos; |
44 | 44 | ||
45 | public Login() | 45 | public Login() |
@@ -47,4 +47,4 @@ namespace OpenSim.Framework | |||
47 | StartPos = new LLVector3(128, 128, 70); | 47 | StartPos = new LLVector3(128, 128, 70); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | } | 50 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/MapBlockData.cs b/OpenSim/Framework/General/MapBlockData.cs index eafd65d..d794015 100644 --- a/OpenSim/Framework/General/MapBlockData.cs +++ b/OpenSim/Framework/General/MapBlockData.cs | |||
@@ -45,7 +45,6 @@ namespace OpenSim.Framework | |||
45 | 45 | ||
46 | public MapBlockData() | 46 | public MapBlockData() |
47 | { | 47 | { |
48 | |||
49 | } | 48 | } |
50 | } | 49 | } |
51 | } | 50 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/NeighbourInfo.cs b/OpenSim/Framework/General/NeighbourInfo.cs index 771b844..457f7d0 100644 --- a/OpenSim/Framework/General/NeighbourInfo.cs +++ b/OpenSim/Framework/General/NeighbourInfo.cs | |||
@@ -39,4 +39,4 @@ namespace OpenSim.Framework | |||
39 | public string sim_ip; | 39 | public string sim_ip; |
40 | public uint sim_port; | 40 | public uint sim_port; |
41 | } | 41 | } |
42 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/NetworkServersInfo.cs b/OpenSim/Framework/General/NetworkServersInfo.cs index 358e496..98d489e 100644 --- a/OpenSim/Framework/General/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/NetworkServersInfo.cs | |||
@@ -25,12 +25,9 @@ | |||
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; | ||
29 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Framework.Interfaces; | ||
31 | using OpenSim.Framework; | ||
32 | 28 | ||
33 | using Nini.Config; | 29 | using Nini.Config; |
30 | |||
34 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
35 | { | 32 | { |
36 | public class NetworkServersInfo | 33 | public class NetworkServersInfo |
@@ -63,12 +60,14 @@ namespace OpenSim.Framework | |||
63 | } | 60 | } |
64 | 61 | ||
65 | private uint? m_defaultHomeLocX; | 62 | private uint? m_defaultHomeLocX; |
63 | |||
66 | public uint DefaultHomeLocX | 64 | public uint DefaultHomeLocX |
67 | { | 65 | { |
68 | get { return m_defaultHomeLocX.Value; } | 66 | get { return m_defaultHomeLocX.Value; } |
69 | } | 67 | } |
70 | 68 | ||
71 | private uint? m_defaultHomeLocY; | 69 | private uint? m_defaultHomeLocY; |
70 | |||
72 | public uint DefaultHomeLocY | 71 | public uint DefaultHomeLocY |
73 | { | 72 | { |
74 | get { return m_defaultHomeLocY.Value; } | 73 | get { return m_defaultHomeLocY.Value; } |
@@ -76,19 +75,22 @@ namespace OpenSim.Framework | |||
76 | 75 | ||
77 | public void loadFromConfiguration(IConfigSource config) | 76 | public void loadFromConfiguration(IConfigSource config) |
78 | { | 77 | { |
79 | m_defaultHomeLocX = (uint)config.Configs["StandAlone"].GetInt("default_location_x", 1000); | 78 | m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); |
80 | m_defaultHomeLocY = (uint)config.Configs["StandAlone"].GetInt("default_location_y", 1000); | 79 | m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); |
81 | 80 | ||
82 | HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); | 81 | HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); |
83 | RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); | 82 | RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); |
84 | GridURL = config.Configs["Network"].GetString("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); | 83 | GridURL = |
84 | config.Configs["Network"].GetString("grid_server_url", | ||
85 | "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); | ||
85 | GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null"); | 86 | GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null"); |
86 | GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null"); | 87 | GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null"); |
87 | UserURL = config.Configs["Network"].GetString("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); | 88 | UserURL = |
89 | config.Configs["Network"].GetString("user_server_url", | ||
90 | "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); | ||
88 | UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); | 91 | UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); |
89 | UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); | 92 | UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); |
90 | AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); | 93 | AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); |
91 | |||
92 | } | 94 | } |
93 | } | 95 | } |
94 | } | 96 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/PrimitiveBaseShape.cs b/OpenSim/Framework/General/PrimitiveBaseShape.cs index 1799fb8..2123ecb 100644 --- a/OpenSim/Framework/General/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/PrimitiveBaseShape.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | using System.Xml.Serialization; | 29 | using System.Xml.Serialization; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | ||
32 | 31 | ||
33 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
34 | { | 33 | { |
@@ -93,47 +92,39 @@ namespace OpenSim.Framework | |||
93 | 92 | ||
94 | public ProfileShape ProfileShape | 93 | public ProfileShape ProfileShape |
95 | { | 94 | { |
96 | get | 95 | get { return (ProfileShape) (ProfileCurve & 0xf); } |
97 | { | ||
98 | return (ProfileShape)(ProfileCurve & 0xf); | ||
99 | } | ||
100 | set | 96 | set |
101 | { | 97 | { |
102 | byte oldValueMasked = (byte)(ProfileCurve & 0xf0); | 98 | byte oldValueMasked = (byte) (ProfileCurve & 0xf0); |
103 | ProfileCurve = (byte)(oldValueMasked | (byte)value); | 99 | ProfileCurve = (byte) (oldValueMasked | (byte) value); |
104 | } | 100 | } |
105 | } | 101 | } |
106 | 102 | ||
107 | [XmlIgnore] | 103 | [XmlIgnore] |
108 | public HollowShape HollowShape | 104 | public HollowShape HollowShape |
109 | { | 105 | { |
110 | get | 106 | get { return (HollowShape) (ProfileHollow & 0xf0); } |
111 | { | ||
112 | return (HollowShape)(ProfileHollow & 0xf0); | ||
113 | } | ||
114 | set | 107 | set |
115 | { | 108 | { |
116 | byte oldValueMasked = (byte)(ProfileHollow & 0xf0); | 109 | byte oldValueMasked = (byte) (ProfileHollow & 0xf0); |
117 | ProfileHollow = (byte)(oldValueMasked | (byte)value); | 110 | ProfileHollow = (byte) (oldValueMasked | (byte) value); |
118 | } | 111 | } |
119 | } | 112 | } |
120 | 113 | ||
121 | public LLVector3 PrimScale | 114 | public LLVector3 PrimScale |
122 | { | 115 | { |
123 | get | 116 | get { return Scale; } |
124 | { | ||
125 | return this.Scale; | ||
126 | } | ||
127 | } | 117 | } |
128 | 118 | ||
129 | static PrimitiveBaseShape() | 119 | static PrimitiveBaseShape() |
130 | { | 120 | { |
131 | m_defaultTextureEntry = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); | 121 | m_defaultTextureEntry = |
122 | new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); | ||
132 | } | 123 | } |
133 | 124 | ||
134 | public PrimitiveBaseShape() | 125 | public PrimitiveBaseShape() |
135 | { | 126 | { |
136 | PCode = (byte)PCodeEnum.Primitive; | 127 | PCode = (byte) PCodeEnum.Primitive; |
137 | ExtraParams = new byte[1]; | 128 | ExtraParams = new byte[1]; |
138 | TextureEntry = m_defaultTextureEntry; | 129 | TextureEntry = m_defaultTextureEntry; |
139 | } | 130 | } |
@@ -141,12 +132,11 @@ namespace OpenSim.Framework | |||
141 | //void returns need to change of course | 132 | //void returns need to change of course |
142 | public virtual void GetMesh() | 133 | public virtual void GetMesh() |
143 | { | 134 | { |
144 | |||
145 | } | 135 | } |
146 | 136 | ||
147 | public PrimitiveBaseShape Copy() | 137 | public PrimitiveBaseShape Copy() |
148 | { | 138 | { |
149 | return (PrimitiveBaseShape)this.MemberwiseClone(); | 139 | return (PrimitiveBaseShape) MemberwiseClone(); |
150 | } | 140 | } |
151 | } | 141 | } |
152 | 142 | ||
@@ -155,7 +145,6 @@ namespace OpenSim.Framework | |||
155 | public GenericShape() | 145 | public GenericShape() |
156 | : base() | 146 | : base() |
157 | { | 147 | { |
158 | |||
159 | } | 148 | } |
160 | } | 149 | } |
161 | 150 | ||
@@ -164,7 +153,7 @@ namespace OpenSim.Framework | |||
164 | public BoxShape() | 153 | public BoxShape() |
165 | : base() | 154 | : base() |
166 | { | 155 | { |
167 | PathCurve = (byte)Extrusion.Straight; | 156 | PathCurve = (byte) Extrusion.Straight; |
168 | ProfileShape = ProfileShape.Square; | 157 | ProfileShape = ProfileShape.Square; |
169 | PathScaleX = 100; | 158 | PathScaleX = 100; |
170 | PathScaleY = 100; | 159 | PathScaleY = 100; |
@@ -193,12 +182,13 @@ namespace OpenSim.Framework | |||
193 | } | 182 | } |
194 | } | 183 | } |
195 | } | 184 | } |
185 | |||
196 | public class CylinderShape : PrimitiveBaseShape | 186 | public class CylinderShape : PrimitiveBaseShape |
197 | { | 187 | { |
198 | public CylinderShape() | 188 | public CylinderShape() |
199 | : base() | 189 | : base() |
200 | { | 190 | { |
201 | PathCurve = (byte)Extrusion.Straight; | 191 | PathCurve = (byte) Extrusion.Straight; |
202 | ProfileShape = ProfileShape.Circle; | 192 | ProfileShape = ProfileShape.Circle; |
203 | PathScaleX = 100; | 193 | PathScaleX = 100; |
204 | PathScaleY = 100; | 194 | PathScaleY = 100; |
@@ -218,7 +208,7 @@ namespace OpenSim.Framework | |||
218 | 208 | ||
219 | private void SetRadius(float radius) | 209 | private void SetRadius(float radius) |
220 | { | 210 | { |
221 | Scale.X = Scale.Y = radius * 2f; | 211 | Scale.X = Scale.Y = radius*2f; |
222 | } | 212 | } |
223 | } | 213 | } |
224 | } | 214 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/Properties/AssemblyInfo.cs b/OpenSim/Framework/General/Properties/AssemblyInfo.cs index 655cffc..b3206a7 100644 --- a/OpenSim/Framework/General/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/General/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.FrameWork")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.FrameWork")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.FrameWork")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.FrameWork")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] | 24 | |
25 | [assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices; | |||
27 | // Build Number | 31 | // Build Number |
28 | // Revision | 32 | // Revision |
29 | // | 33 | // |
30 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
31 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Framework/General/RegionCommsListener.cs b/OpenSim/Framework/General/RegionCommsListener.cs index caa4af7..ee0d503 100644 --- a/OpenSim/Framework/General/RegionCommsListener.cs +++ b/OpenSim/Framework/General/RegionCommsListener.cs | |||
@@ -25,15 +25,13 @@ | |||
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 libsecondlife; | ||
29 | using OpenSim.Framework.Interfaces; | ||
30 | using OpenSim.Framework; | ||
31 | 28 | ||
32 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | ||
33 | 31 | ||
34 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
35 | { | 33 | { |
36 | public class RegionCommsListener :IRegionCommsListener | 34 | public class RegionCommsListener : IRegionCommsListener |
37 | { | 35 | { |
38 | public event ExpectUserDelegate OnExpectUser; | 36 | public event ExpectUserDelegate OnExpectUser; |
39 | public event GenericCall2 OnExpectChildAgent; | 37 | public event GenericCall2 OnExpectChildAgent; |
@@ -46,11 +44,10 @@ namespace OpenSim.Framework | |||
46 | /// </summary> | 44 | /// </summary> |
47 | /// <param name="agent"></param> | 45 | /// <param name="agent"></param> |
48 | /// <returns></returns> | 46 | /// <returns></returns> |
49 | public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) | 47 | public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) |
50 | { | 48 | { |
51 | if(OnExpectUser != null) | 49 | if (OnExpectUser != null) |
52 | { | 50 | { |
53 | |||
54 | OnExpectUser(regionHandle, agent); | 51 | OnExpectUser(regionHandle, agent); |
55 | return true; | 52 | return true; |
56 | } | 53 | } |
@@ -58,7 +55,8 @@ namespace OpenSim.Framework | |||
58 | return false; | 55 | return false; |
59 | } | 56 | } |
60 | 57 | ||
61 | public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 58 | public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, |
59 | bool isFlying) | ||
62 | { | 60 | { |
63 | if (OnAvatarCrossingIntoRegion != null) | 61 | if (OnAvatarCrossingIntoRegion != null) |
64 | { | 62 | { |
@@ -111,4 +109,4 @@ namespace OpenSim.Framework | |||
111 | return false; | 109 | return false; |
112 | } | 110 | } |
113 | } | 111 | } |
114 | } | 112 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/RegionHandle.cs b/OpenSim/Framework/General/RegionHandle.cs index d800e57..807a17c 100644 --- a/OpenSim/Framework/General/RegionHandle.cs +++ b/OpenSim/Framework/General/RegionHandle.cs | |||
@@ -28,13 +28,14 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Net.Sockets; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
33 | { | 34 | { |
34 | /// <summary> | 35 | /// <summary> |
35 | /// A class for manipulating RegionHandle coordinates | 36 | /// A class for manipulating RegionHandle coordinates |
36 | /// </summary> | 37 | /// </summary> |
37 | class RegionHandle | 38 | internal class RegionHandle |
38 | { | 39 | { |
39 | private UInt64 handle; | 40 | private UInt64 handle; |
40 | 41 | ||
@@ -48,28 +49,28 @@ namespace OpenSim.Framework | |||
48 | { | 49 | { |
49 | IPAddress addr = IPAddress.Parse(ip); | 50 | IPAddress addr = IPAddress.Parse(ip); |
50 | 51 | ||
51 | if (addr.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) | 52 | if (addr.AddressFamily != AddressFamily.InterNetwork) |
52 | throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); | 53 | throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); |
53 | 54 | ||
54 | uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); | 55 | uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); |
55 | 56 | ||
56 | // Split the IP address in half | 57 | // Split the IP address in half |
57 | short a = (short)((baseHandle << 16) & 0xFFFF); | 58 | short a = (short) ((baseHandle << 16) & 0xFFFF); |
58 | short b = (short)((baseHandle << 0) & 0xFFFF); | 59 | short b = (short) ((baseHandle << 0) & 0xFFFF); |
59 | 60 | ||
60 | // Raise the bounds a little | 61 | // Raise the bounds a little |
61 | uint nx = (uint)x; | 62 | uint nx = (uint) x; |
62 | uint ny = (uint)y; | 63 | uint ny = (uint) y; |
63 | 64 | ||
64 | // Multiply grid coords to get region coords | 65 | // Multiply grid coords to get region coords |
65 | nx *= 256; | 66 | nx *= 256; |
66 | ny *= 256; | 67 | ny *= 256; |
67 | 68 | ||
68 | // Stuff the IP address in too | 69 | // Stuff the IP address in too |
69 | nx = (uint)a << 16; | 70 | nx = (uint) a << 16; |
70 | ny = (uint)b << 16; | 71 | ny = (uint) b << 16; |
71 | 72 | ||
72 | handle = ((UInt64)nx << 32) | (uint)ny; | 73 | handle = ((UInt64) nx << 32) | (uint) ny; |
73 | } | 74 | } |
74 | 75 | ||
75 | /// <summary> | 76 | /// <summary> |
@@ -79,7 +80,7 @@ namespace OpenSim.Framework | |||
79 | /// <param name="y">Grid Y Coordinate</param> | 80 | /// <param name="y">Grid Y Coordinate</param> |
80 | public RegionHandle(uint x, uint y) | 81 | public RegionHandle(uint x, uint y) |
81 | { | 82 | { |
82 | handle = ((x * 256) << 32) | (y * 256); | 83 | handle = ((x*256) << 32) | (y*256); |
83 | } | 84 | } |
84 | 85 | ||
85 | /// <summary> | 86 | /// <summary> |
@@ -118,10 +119,10 @@ namespace OpenSim.Framework | |||
118 | /// <returns>Grid Server IP Address</returns> | 119 | /// <returns>Grid Server IP Address</returns> |
119 | public IPAddress getGridIP() | 120 | public IPAddress getGridIP() |
120 | { | 121 | { |
121 | uint a = (uint)((handle >> 16) & 0xFFFF); | 122 | uint a = (uint) ((handle >> 16) & 0xFFFF); |
122 | uint b = (uint)((handle >> 48) & 0xFFFF); | 123 | uint b = (uint) ((handle >> 48) & 0xFFFF); |
123 | 124 | ||
124 | return new IPAddress((long)(a << 16) | (long)b); | 125 | return new IPAddress((long) (a << 16) | (long) b); |
125 | } | 126 | } |
126 | 127 | ||
127 | /// <summary> | 128 | /// <summary> |
@@ -130,7 +131,7 @@ namespace OpenSim.Framework | |||
130 | /// <returns>X Coordinate</returns> | 131 | /// <returns>X Coordinate</returns> |
131 | public uint getGridX() | 132 | public uint getGridX() |
132 | { | 133 | { |
133 | uint x = (uint)((handle >> 32) & 0xFFFF); | 134 | uint x = (uint) ((handle >> 32) & 0xFFFF); |
134 | 135 | ||
135 | return x; | 136 | return x; |
136 | } | 137 | } |
@@ -141,9 +142,9 @@ namespace OpenSim.Framework | |||
141 | /// <returns>Y Coordinate</returns> | 142 | /// <returns>Y Coordinate</returns> |
142 | public uint getGridY() | 143 | public uint getGridY() |
143 | { | 144 | { |
144 | uint y = (uint)((handle >> 0) & 0xFFFF); | 145 | uint y = (uint) ((handle >> 0) & 0xFFFF); |
145 | 146 | ||
146 | return y; | 147 | return y; |
147 | } | 148 | } |
148 | } | 149 | } |
149 | } | 150 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/RegionInfo.cs b/OpenSim/Framework/General/RegionInfo.cs index 32f0c76..c14afd2 100644 --- a/OpenSim/Framework/General/RegionInfo.cs +++ b/OpenSim/Framework/General/RegionInfo.cs | |||
@@ -26,14 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Globalization; | ||
30 | using System.Net; | 29 | using System.Net; |
31 | using System.Net.Sockets; | 30 | using System.Net.Sockets; |
32 | using Nini.Config; | ||
33 | using libsecondlife; | 31 | using libsecondlife; |
34 | using OpenSim.Framework.Console; | 32 | using Nini.Config; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework; | ||
37 | 33 | ||
38 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
39 | { | 35 | { |
@@ -45,7 +41,6 @@ namespace OpenSim.Framework | |||
45 | 41 | ||
46 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 42 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
47 | { | 43 | { |
48 | |||
49 | m_regionLocX = regionLocX; | 44 | m_regionLocX = regionLocX; |
50 | m_regionLocY = regionLocY; | 45 | m_regionLocY = regionLocY; |
51 | 46 | ||
@@ -55,7 +50,6 @@ namespace OpenSim.Framework | |||
55 | 50 | ||
56 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) | 51 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) |
57 | { | 52 | { |
58 | |||
59 | m_regionLocX = regionLocX; | 53 | m_regionLocX = regionLocX; |
60 | m_regionLocY = regionLocY; | 54 | m_regionLocY = regionLocY; |
61 | 55 | ||
@@ -67,16 +61,11 @@ namespace OpenSim.Framework | |||
67 | public LLUUID RegionID = new LLUUID(); | 61 | public LLUUID RegionID = new LLUUID(); |
68 | 62 | ||
69 | private uint m_remotingPort; | 63 | private uint m_remotingPort; |
64 | |||
70 | public uint RemotingPort | 65 | public uint RemotingPort |
71 | { | 66 | { |
72 | get | 67 | get { return m_remotingPort; } |
73 | { | 68 | set { m_remotingPort = value; } |
74 | return m_remotingPort; | ||
75 | } | ||
76 | set | ||
77 | { | ||
78 | m_remotingPort = value; | ||
79 | } | ||
80 | } | 69 | } |
81 | 70 | ||
82 | public string RemotingAddress; | 71 | public string RemotingAddress; |
@@ -109,76 +98,49 @@ namespace OpenSim.Framework | |||
109 | ia = Adr; | 98 | ia = Adr; |
110 | break; | 99 | break; |
111 | } | 100 | } |
112 | |||
113 | } | 101 | } |
114 | 102 | ||
115 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 103 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
116 | } | 104 | } |
117 | 105 | ||
118 | set | 106 | set { m_externalHostName = value.ToString(); } |
119 | { | ||
120 | m_externalHostName = value.ToString(); | ||
121 | } | ||
122 | } | 107 | } |
123 | 108 | ||
124 | protected string m_externalHostName; | 109 | protected string m_externalHostName; |
110 | |||
125 | public string ExternalHostName | 111 | public string ExternalHostName |
126 | { | 112 | { |
127 | get | 113 | get { return m_externalHostName; } |
128 | { | 114 | set { m_externalHostName = value; } |
129 | return m_externalHostName; | ||
130 | } | ||
131 | set | ||
132 | { | ||
133 | m_externalHostName = value; | ||
134 | } | ||
135 | } | 115 | } |
136 | 116 | ||
137 | protected IPEndPoint m_internalEndPoint; | 117 | protected IPEndPoint m_internalEndPoint; |
118 | |||
138 | public IPEndPoint InternalEndPoint | 119 | public IPEndPoint InternalEndPoint |
139 | { | 120 | { |
140 | get | 121 | get { return m_internalEndPoint; } |
141 | { | 122 | set { m_internalEndPoint = value; } |
142 | return m_internalEndPoint; | ||
143 | } | ||
144 | set | ||
145 | { | ||
146 | m_internalEndPoint = value; | ||
147 | } | ||
148 | } | 123 | } |
149 | 124 | ||
150 | protected uint? m_regionLocX; | 125 | protected uint? m_regionLocX; |
126 | |||
151 | public uint RegionLocX | 127 | public uint RegionLocX |
152 | { | 128 | { |
153 | get | 129 | get { return m_regionLocX.Value; } |
154 | { | 130 | set { m_regionLocX = value; } |
155 | return m_regionLocX.Value; | ||
156 | } | ||
157 | set | ||
158 | { | ||
159 | m_regionLocX = value; | ||
160 | } | ||
161 | } | 131 | } |
162 | 132 | ||
163 | protected uint? m_regionLocY; | 133 | protected uint? m_regionLocY; |
134 | |||
164 | public uint RegionLocY | 135 | public uint RegionLocY |
165 | { | 136 | { |
166 | get | 137 | get { return m_regionLocY.Value; } |
167 | { | 138 | set { m_regionLocY = value; } |
168 | return m_regionLocY.Value; | ||
169 | } | ||
170 | set | ||
171 | { | ||
172 | m_regionLocY = value; | ||
173 | } | ||
174 | } | 139 | } |
175 | 140 | ||
176 | public ulong RegionHandle | 141 | public ulong RegionHandle |
177 | { | 142 | { |
178 | get | 143 | get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } |
179 | { | ||
180 | return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
181 | } | ||
182 | } | 144 | } |
183 | } | 145 | } |
184 | 146 | ||
@@ -196,80 +158,81 @@ namespace OpenSim.Framework | |||
196 | 158 | ||
197 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 159 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
198 | private static EstateSettings m_estateSettings; | 160 | private static EstateSettings m_estateSettings; |
161 | |||
199 | public EstateSettings EstateSettings | 162 | public EstateSettings EstateSettings |
200 | { | 163 | { |
201 | get | 164 | get |
202 | { | 165 | { |
203 | if( m_estateSettings == null ) | 166 | if (m_estateSettings == null) |
204 | { | 167 | { |
205 | m_estateSettings = new EstateSettings(); | 168 | m_estateSettings = new EstateSettings(); |
206 | } | 169 | } |
207 | 170 | ||
208 | return m_estateSettings; | 171 | return m_estateSettings; |
209 | } | 172 | } |
210 | |||
211 | } | 173 | } |
212 | 174 | ||
213 | public ConfigurationMember configMember; | 175 | public ConfigurationMember configMember; |
176 | |||
214 | public RegionInfo(string description, string filename) | 177 | public RegionInfo(string description, string filename) |
215 | { | 178 | { |
216 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | 179 | configMember = |
180 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
217 | configMember.performConfigurationRetrieve(); | 181 | configMember.performConfigurationRetrieve(); |
218 | } | 182 | } |
219 | 183 | ||
220 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : | 184 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : |
221 | base(regionLocX, regionLocY, internalEndPoint, externalUri) | 185 | base(regionLocX, regionLocY, internalEndPoint, externalUri) |
222 | { | 186 | { |
223 | |||
224 | |||
225 | } | 187 | } |
226 | 188 | ||
227 | public RegionInfo() | 189 | public RegionInfo() |
228 | { | 190 | { |
229 | |||
230 | } | 191 | } |
231 | 192 | ||
232 | //not in use, should swap to nini though. | 193 | //not in use, should swap to nini though. |
233 | public void LoadFromNiniSource(IConfigSource source) | 194 | public void LoadFromNiniSource(IConfigSource source) |
234 | { | 195 | { |
235 | this.LoadFromNiniSource(source, "RegionInfo"); | 196 | LoadFromNiniSource(source, "RegionInfo"); |
236 | } | 197 | } |
237 | 198 | ||
238 | //not in use, should swap to nini though. | 199 | //not in use, should swap to nini though. |
239 | public void LoadFromNiniSource(IConfigSource source, string sectionName) | 200 | public void LoadFromNiniSource(IConfigSource source, string sectionName) |
240 | { | 201 | { |
241 | string errorMessage = ""; | 202 | string errorMessage = ""; |
242 | this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); | 203 | RegionID = |
243 | this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); | 204 | new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); |
244 | this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); | 205 | RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); |
245 | this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); | 206 | m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); |
246 | this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | 207 | m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); |
208 | DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | ||
247 | 209 | ||
248 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); | 210 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); |
249 | IPAddress ipAddressResult; | 211 | IPAddress ipAddressResult; |
250 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) | 212 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) |
251 | { | 213 | { |
252 | this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); | 214 | m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); |
253 | } | 215 | } |
254 | else | 216 | else |
255 | { | 217 | { |
256 | errorMessage = "needs an IP Address (IPAddress)"; | 218 | errorMessage = "needs an IP Address (IPAddress)"; |
257 | } | 219 | } |
258 | this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); | 220 | m_internalEndPoint.Port = |
221 | source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); | ||
259 | 222 | ||
260 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); | 223 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); |
261 | if (externalHost != "SYSTEMIP") | 224 | if (externalHost != "SYSTEMIP") |
262 | { | 225 | { |
263 | this.m_externalHostName = externalHost; | 226 | m_externalHostName = externalHost; |
264 | } | 227 | } |
265 | else | 228 | else |
266 | { | 229 | { |
267 | this.m_externalHostName = Util.GetLocalHost().ToString(); | 230 | m_externalHostName = Util.GetLocalHost().ToString(); |
268 | } | 231 | } |
269 | 232 | ||
270 | this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); | 233 | MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); |
271 | this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); | 234 | MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); |
272 | this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); | 235 | MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); |
273 | 236 | ||
274 | if (errorMessage != "") | 237 | if (errorMessage != "") |
275 | { | 238 | { |
@@ -279,17 +242,36 @@ namespace OpenSim.Framework | |||
279 | 242 | ||
280 | public void loadConfigurationOptions() | 243 | public void loadConfigurationOptions() |
281 | { | 244 | { |
282 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); | 245 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, |
283 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); | 246 | "UUID of Region (Default is recommended, random UUID)", |
284 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); | 247 | LLUUID.Random().ToString(), true); |
285 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); | 248 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
286 | configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); | 249 | "Region Name", "OpenSim Test", false); |
287 | configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); | 250 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
288 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); | 251 | "Grid Location (X Axis)", "1000", false); |
289 | configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); | 252 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
290 | configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); | 253 | "Grid Location (Y Axis)", "1000", false); |
291 | configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); | 254 | configMember.addConfigurationOption("datastore", |
292 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); | 255 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
256 | "Filename for local storage", "OpenSim.db", false); | ||
257 | configMember.addConfigurationOption("internal_ip_address", | ||
258 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | ||
259 | "Internal IP Address for incoming UDP client connections", "0.0.0.0", | ||
260 | false); | ||
261 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
262 | "Internal IP Port for incoming UDP client connections", | ||
263 | NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); | ||
264 | configMember.addConfigurationOption("external_host_name", | ||
265 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
266 | "External Host Name", "127.0.0.1", false); | ||
267 | configMember.addConfigurationOption("master_avatar_first", | ||
268 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
269 | "First Name of Master Avatar", "Test", false); | ||
270 | configMember.addConfigurationOption("master_avatar_last", | ||
271 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
272 | "Last Name of Master Avatar", "User", false); | ||
273 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
274 | "(Sandbox Mode Only)Password for Master Avatar account", "test", false); | ||
293 | } | 275 | } |
294 | 276 | ||
295 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 277 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -297,51 +279,50 @@ namespace OpenSim.Framework | |||
297 | switch (configuration_key) | 279 | switch (configuration_key) |
298 | { | 280 | { |
299 | case "sim_UUID": | 281 | case "sim_UUID": |
300 | this.RegionID = (LLUUID)configuration_result; | 282 | RegionID = (LLUUID) configuration_result; |
301 | break; | 283 | break; |
302 | case "sim_name": | 284 | case "sim_name": |
303 | this.RegionName = (string)configuration_result; | 285 | RegionName = (string) configuration_result; |
304 | break; | 286 | break; |
305 | case "sim_location_x": | 287 | case "sim_location_x": |
306 | this.m_regionLocX = (uint)configuration_result; | 288 | m_regionLocX = (uint) configuration_result; |
307 | break; | 289 | break; |
308 | case "sim_location_y": | 290 | case "sim_location_y": |
309 | this.m_regionLocY = (uint)configuration_result; | 291 | m_regionLocY = (uint) configuration_result; |
310 | break; | 292 | break; |
311 | case "datastore": | 293 | case "datastore": |
312 | this.DataStore = (string)configuration_result; | 294 | DataStore = (string) configuration_result; |
313 | break; | 295 | break; |
314 | case "internal_ip_address": | 296 | case "internal_ip_address": |
315 | IPAddress address = (IPAddress)configuration_result; | 297 | IPAddress address = (IPAddress) configuration_result; |
316 | this.m_internalEndPoint = new IPEndPoint(address, 0); | 298 | m_internalEndPoint = new IPEndPoint(address, 0); |
317 | break; | 299 | break; |
318 | case "internal_ip_port": | 300 | case "internal_ip_port": |
319 | this.m_internalEndPoint.Port = (int)configuration_result; | 301 | m_internalEndPoint.Port = (int) configuration_result; |
320 | break; | 302 | break; |
321 | case "external_host_name": | 303 | case "external_host_name": |
322 | if ((string)configuration_result != "SYSTEMIP") | 304 | if ((string) configuration_result != "SYSTEMIP") |
323 | { | 305 | { |
324 | this.m_externalHostName = (string)configuration_result; | 306 | m_externalHostName = (string) configuration_result; |
325 | } | 307 | } |
326 | else | 308 | else |
327 | { | 309 | { |
328 | this.m_externalHostName = Util.GetLocalHost().ToString(); | 310 | m_externalHostName = Util.GetLocalHost().ToString(); |
329 | } | 311 | } |
330 | break; | 312 | break; |
331 | case "master_avatar_first": | 313 | case "master_avatar_first": |
332 | this.MasterAvatarFirstName = (string)configuration_result; | 314 | MasterAvatarFirstName = (string) configuration_result; |
333 | break; | 315 | break; |
334 | case "master_avatar_last": | 316 | case "master_avatar_last": |
335 | this.MasterAvatarLastName = (string)configuration_result; | 317 | MasterAvatarLastName = (string) configuration_result; |
336 | break; | 318 | break; |
337 | case "master_avatar_pass": | 319 | case "master_avatar_pass": |
338 | string tempMD5Passwd = (string)configuration_result; | 320 | string tempMD5Passwd = (string) configuration_result; |
339 | this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 321 | MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
340 | break; | 322 | break; |
341 | } | 323 | } |
342 | 324 | ||
343 | return true; | 325 | return true; |
344 | } | 326 | } |
345 | |||
346 | } | 327 | } |
347 | } | 328 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/Remoting.cs b/OpenSim/Framework/General/Remoting.cs index 330c078..667ae69 100644 --- a/OpenSim/Framework/General/Remoting.cs +++ b/OpenSim/Framework/General/Remoting.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Framework | |||
41 | /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para> | 41 | /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para> |
42 | /// <para>Both hosts should be performing these operations for this to be effective.</para> | 42 | /// <para>Both hosts should be performing these operations for this to be effective.</para> |
43 | /// </remarks> | 43 | /// </remarks> |
44 | class RemoteDigest | 44 | internal class RemoteDigest |
45 | { | 45 | { |
46 | private byte[] currentHash; | 46 | private byte[] currentHash; |
47 | private byte[] secret; | 47 | private byte[] secret; |
@@ -58,7 +58,7 @@ namespace OpenSim.Framework | |||
58 | public RemoteDigest(string sharedSecret, byte[] salt, string challenge) | 58 | public RemoteDigest(string sharedSecret, byte[] salt, string challenge) |
59 | { | 59 | { |
60 | SHA512 = new SHA512Managed(); | 60 | SHA512 = new SHA512Managed(); |
61 | Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt); | 61 | Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt); |
62 | secret = RFC2898.GetBytes(512); | 62 | secret = RFC2898.GetBytes(512); |
63 | ASCIIEncoding ASCII = new ASCIIEncoding(); | 63 | ASCIIEncoding ASCII = new ASCIIEncoding(); |
64 | 64 | ||
@@ -108,7 +108,7 @@ namespace OpenSim.Framework | |||
108 | byte[] bytes = new byte[64]; | 108 | byte[] bytes = new byte[64]; |
109 | RNG.GetBytes(bytes); | 109 | RNG.GetBytes(bytes); |
110 | 110 | ||
111 | StringBuilder sb = new StringBuilder(bytes.Length * 2); | 111 | StringBuilder sb = new StringBuilder(bytes.Length*2); |
112 | foreach (byte b in bytes) | 112 | foreach (byte b in bytes) |
113 | { | 113 | { |
114 | sb.AppendFormat("{0:x2}", b); | 114 | sb.AppendFormat("{0:x2}", b); |
@@ -130,6 +130,5 @@ namespace OpenSim.Framework | |||
130 | Buffer.BlockCopy(b, 0, c, a.Length, b.Length); | 130 | Buffer.BlockCopy(b, 0, c, a.Length, b.Length); |
131 | return c; | 131 | return c; |
132 | } | 132 | } |
133 | |||
134 | } | 133 | } |
135 | } | 134 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/UUID.cs b/OpenSim/Framework/General/UUID.cs index 4327f40..f27cd6c 100644 --- a/OpenSim/Framework/General/UUID.cs +++ b/OpenSim/Framework/General/UUID.cs | |||
@@ -31,7 +31,7 @@ using libsecondlife; | |||
31 | 31 | ||
32 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
33 | { | 33 | { |
34 | class UUID | 34 | internal class UUID |
35 | { | 35 | { |
36 | public LLUUID llUUID; | 36 | public LLUUID llUUID; |
37 | 37 | ||
@@ -73,7 +73,7 @@ namespace OpenSim.Framework | |||
73 | n = BitConverter.GetBytes(fourth); | 73 | n = BitConverter.GetBytes(fourth); |
74 | n.CopyTo(uuid, 12); | 74 | n.CopyTo(uuid, 12); |
75 | 75 | ||
76 | llUUID = new LLUUID(uuid,0); | 76 | llUUID = new LLUUID(uuid, 0); |
77 | } | 77 | } |
78 | 78 | ||
79 | public override string ToString() | 79 | public override string ToString() |
@@ -152,4 +152,4 @@ namespace OpenSim.Framework | |||
152 | return !a.Equals(b); | 152 | return !a.Equals(b); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | } | 155 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/UserConfig.cs b/OpenSim/Framework/General/UserConfig.cs index 3d79fc9..9abe61f 100644 --- a/OpenSim/Framework/General/UserConfig.cs +++ b/OpenSim/Framework/General/UserConfig.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework | 29 | namespace OpenSim.Framework |
34 | { | 30 | { |
35 | /// <summary> | 31 | /// <summary> |
@@ -51,21 +47,30 @@ namespace OpenSim.Framework | |||
51 | 47 | ||
52 | public UserConfig(string description, string filename) | 48 | public UserConfig(string description, string filename) |
53 | { | 49 | { |
54 | configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); | 50 | configMember = |
51 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
55 | configMember.performConfigurationRetrieve(); | 52 | configMember.performConfigurationRetrieve(); |
56 | } | 53 | } |
57 | 54 | ||
58 | public void loadConfigurationOptions() | 55 | public void loadConfigurationOptions() |
59 | { | 56 | { |
60 | configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); | 57 | configMember.addConfigurationOption("default_startup_message", |
61 | 58 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | |
62 | configMember.addConfigurationOption("default_grid_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Grid Server URI", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); | 59 | "Default Startup Message", "Welcome to OGS", false); |
63 | configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null", false); | ||
64 | configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null", false); | ||
65 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | ||
66 | 60 | ||
67 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); | 61 | configMember.addConfigurationOption("default_grid_server", |
62 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
63 | "Default Grid Server URI", | ||
64 | "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); | ||
65 | configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
66 | "Key to send to grid server", "null", false); | ||
67 | configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
68 | "Key to expect from grid server", "null", false); | ||
69 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
70 | "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | ||
68 | 71 | ||
72 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
73 | "Http Listener port", DefaultHttpPort.ToString(), false); | ||
69 | } | 74 | } |
70 | 75 | ||
71 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 76 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -73,26 +78,26 @@ namespace OpenSim.Framework | |||
73 | switch (configuration_key) | 78 | switch (configuration_key) |
74 | { | 79 | { |
75 | case "default_startup_message": | 80 | case "default_startup_message": |
76 | this.DefaultStartupMsg = (string)configuration_result; | 81 | DefaultStartupMsg = (string) configuration_result; |
77 | break; | 82 | break; |
78 | case "default_grid_server": | 83 | case "default_grid_server": |
79 | this.GridServerURL = (string)configuration_result; | 84 | GridServerURL = (string) configuration_result; |
80 | break; | 85 | break; |
81 | case "grid_send_key": | 86 | case "grid_send_key": |
82 | this.GridSendKey = (string)configuration_result; | 87 | GridSendKey = (string) configuration_result; |
83 | break; | 88 | break; |
84 | case "grid_recv_key": | 89 | case "grid_recv_key": |
85 | this.GridRecvKey = (string)configuration_result; | 90 | GridRecvKey = (string) configuration_result; |
86 | break; | 91 | break; |
87 | case "database_provider": | 92 | case "database_provider": |
88 | this.DatabaseProvider = (string)configuration_result; | 93 | DatabaseProvider = (string) configuration_result; |
89 | break; | 94 | break; |
90 | case "http_port": | 95 | case "http_port": |
91 | HttpPort = (uint)configuration_result; | 96 | HttpPort = (uint) configuration_result; |
92 | break; | 97 | break; |
93 | } | 98 | } |
94 | 99 | ||
95 | return true; | 100 | return true; |
96 | } | 101 | } |
97 | } | 102 | } |
98 | } | 103 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/General/UserProfileData.cs b/OpenSim/Framework/General/UserProfileData.cs index 444d811..ed70246 100644 --- a/OpenSim/Framework/General/UserProfileData.cs +++ b/OpenSim/Framework/General/UserProfileData.cs | |||
@@ -44,6 +44,7 @@ namespace OpenSim.Framework | |||
44 | /// The first component of a users account name | 44 | /// The first component of a users account name |
45 | /// </summary> | 45 | /// </summary> |
46 | public string username; | 46 | public string username; |
47 | |||
47 | /// <summary> | 48 | /// <summary> |
48 | /// The second component of a users account name | 49 | /// The second component of a users account name |
49 | /// </summary> | 50 | /// </summary> |
@@ -54,6 +55,7 @@ namespace OpenSim.Framework | |||
54 | /// </summary> | 55 | /// </summary> |
55 | /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> | 56 | /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> |
56 | public string passwordHash; | 57 | public string passwordHash; |
58 | |||
57 | /// <summary> | 59 | /// <summary> |
58 | /// The salt used for the users hash, should be 32 bytes or longer | 60 | /// The salt used for the users hash, should be 32 bytes or longer |
59 | /// </summary> | 61 | /// </summary> |
@@ -64,18 +66,22 @@ namespace OpenSim.Framework | |||
64 | /// </summary> | 66 | /// </summary> |
65 | public ulong homeRegion | 67 | public ulong homeRegion |
66 | { | 68 | { |
67 | get { return Helpers.UIntsToLong((homeRegionX * 256), (homeRegionY * 256)); } | 69 | get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); } |
68 | set { | 70 | set |
69 | homeRegionX = (uint)(value >> 40); | 71 | { |
70 | homeRegionY = (((uint)(value)) >> 8); | 72 | homeRegionX = (uint) (value >> 40); |
73 | homeRegionY = (((uint) (value)) >> 8); | ||
71 | } | 74 | } |
72 | } | 75 | } |
76 | |||
73 | public uint homeRegionX; | 77 | public uint homeRegionX; |
74 | public uint homeRegionY; | 78 | public uint homeRegionY; |
79 | |||
75 | /// <summary> | 80 | /// <summary> |
76 | /// The coordinates inside the region of the home location | 81 | /// The coordinates inside the region of the home location |
77 | /// </summary> | 82 | /// </summary> |
78 | public LLVector3 homeLocation; | 83 | public LLVector3 homeLocation; |
84 | |||
79 | /// <summary> | 85 | /// <summary> |
80 | /// Where the user will be looking when they rez. | 86 | /// Where the user will be looking when they rez. |
81 | /// </summary> | 87 | /// </summary> |
@@ -85,6 +91,7 @@ namespace OpenSim.Framework | |||
85 | /// A UNIX Timestamp (seconds since epoch) for the users creation | 91 | /// A UNIX Timestamp (seconds since epoch) for the users creation |
86 | /// </summary> | 92 | /// </summary> |
87 | public int created; | 93 | public int created; |
94 | |||
88 | /// <summary> | 95 | /// <summary> |
89 | /// A UNIX Timestamp for the users last login date / time | 96 | /// A UNIX Timestamp for the users last login date / time |
90 | /// </summary> | 97 | /// </summary> |
@@ -96,6 +103,7 @@ namespace OpenSim.Framework | |||
96 | /// A URI to the users inventory server, used for foreigners and large grids | 103 | /// A URI to the users inventory server, used for foreigners and large grids |
97 | /// </summary> | 104 | /// </summary> |
98 | public string userInventoryURI = String.Empty; | 105 | public string userInventoryURI = String.Empty; |
106 | |||
99 | /// <summary> | 107 | /// <summary> |
100 | /// A URI to the users asset server, used for foreigners and large grids. | 108 | /// A URI to the users asset server, used for foreigners and large grids. |
101 | /// </summary> | 109 | /// </summary> |
@@ -105,6 +113,7 @@ namespace OpenSim.Framework | |||
105 | /// A uint mask containing the "I can do" fields of the users profile | 113 | /// A uint mask containing the "I can do" fields of the users profile |
106 | /// </summary> | 114 | /// </summary> |
107 | public uint profileCanDoMask; | 115 | public uint profileCanDoMask; |
116 | |||
108 | /// <summary> | 117 | /// <summary> |
109 | /// A uint mask containing the "I want to do" part of the users profile | 118 | /// A uint mask containing the "I want to do" part of the users profile |
110 | /// </summary> | 119 | /// </summary> |
@@ -114,6 +123,7 @@ namespace OpenSim.Framework | |||
114 | /// The about text listed in a users profile. | 123 | /// The about text listed in a users profile. |
115 | /// </summary> | 124 | /// </summary> |
116 | public string profileAboutText = String.Empty; | 125 | public string profileAboutText = String.Empty; |
126 | |||
117 | /// <summary> | 127 | /// <summary> |
118 | /// The first life about text listed in a users profile | 128 | /// The first life about text listed in a users profile |
119 | /// </summary> | 129 | /// </summary> |
@@ -123,10 +133,12 @@ namespace OpenSim.Framework | |||
123 | /// The profile image for an avatar stored on the asset server | 133 | /// The profile image for an avatar stored on the asset server |
124 | /// </summary> | 134 | /// </summary> |
125 | public LLUUID profileImage; | 135 | public LLUUID profileImage; |
136 | |||
126 | /// <summary> | 137 | /// <summary> |
127 | /// The profile image for the users first life tab | 138 | /// The profile image for the users first life tab |
128 | /// </summary> | 139 | /// </summary> |
129 | public LLUUID profileFirstImage; | 140 | public LLUUID profileFirstImage; |
141 | |||
130 | /// <summary> | 142 | /// <summary> |
131 | /// The users last registered agent (filled in on the user server) | 143 | /// The users last registered agent (filled in on the user server) |
132 | /// </summary> | 144 | /// </summary> |
@@ -142,47 +154,58 @@ namespace OpenSim.Framework | |||
142 | /// The UUID of the users avatar (not the agent!) | 154 | /// The UUID of the users avatar (not the agent!) |
143 | /// </summary> | 155 | /// </summary> |
144 | public LLUUID UUID; | 156 | public LLUUID UUID; |
157 | |||
145 | /// <summary> | 158 | /// <summary> |
146 | /// The IP address of the user | 159 | /// The IP address of the user |
147 | /// </summary> | 160 | /// </summary> |
148 | public string agentIP = String.Empty; | 161 | public string agentIP = String.Empty; |
162 | |||
149 | /// <summary> | 163 | /// <summary> |
150 | /// The port of the user | 164 | /// The port of the user |
151 | /// </summary> | 165 | /// </summary> |
152 | public uint agentPort; | 166 | public uint agentPort; |
167 | |||
153 | /// <summary> | 168 | /// <summary> |
154 | /// Is the user online? | 169 | /// Is the user online? |
155 | /// </summary> | 170 | /// </summary> |
156 | public bool agentOnline; | 171 | public bool agentOnline; |
172 | |||
157 | /// <summary> | 173 | /// <summary> |
158 | /// The session ID for the user (also the agent ID) | 174 | /// The session ID for the user (also the agent ID) |
159 | /// </summary> | 175 | /// </summary> |
160 | public LLUUID sessionID; | 176 | public LLUUID sessionID; |
177 | |||
161 | /// <summary> | 178 | /// <summary> |
162 | /// The "secure" session ID for the user | 179 | /// The "secure" session ID for the user |
163 | /// </summary> | 180 | /// </summary> |
164 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> | 181 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> |
165 | public LLUUID secureSessionID; | 182 | public LLUUID secureSessionID; |
183 | |||
166 | /// <summary> | 184 | /// <summary> |
167 | /// The region the user logged into initially | 185 | /// The region the user logged into initially |
168 | /// </summary> | 186 | /// </summary> |
169 | public LLUUID regionID; | 187 | public LLUUID regionID; |
188 | |||
170 | /// <summary> | 189 | /// <summary> |
171 | /// A unix timestamp from when the user logged in | 190 | /// A unix timestamp from when the user logged in |
172 | /// </summary> | 191 | /// </summary> |
173 | public int loginTime; | 192 | public int loginTime; |
193 | |||
174 | /// <summary> | 194 | /// <summary> |
175 | /// When this agent expired and logged out, 0 if still online | 195 | /// When this agent expired and logged out, 0 if still online |
176 | /// </summary> | 196 | /// </summary> |
177 | public int logoutTime; | 197 | public int logoutTime; |
198 | |||
178 | /// <summary> | 199 | /// <summary> |
179 | /// Current region the user is logged into | 200 | /// Current region the user is logged into |
180 | /// </summary> | 201 | /// </summary> |
181 | public LLUUID currentRegion; | 202 | public LLUUID currentRegion; |
203 | |||
182 | /// <summary> | 204 | /// <summary> |
183 | /// Region handle of the current region the user is in | 205 | /// Region handle of the current region the user is in |
184 | /// </summary> | 206 | /// </summary> |
185 | public ulong currentHandle; | 207 | public ulong currentHandle; |
208 | |||
186 | /// <summary> | 209 | /// <summary> |
187 | /// The position of the user within the region | 210 | /// The position of the user within the region |
188 | /// </summary> | 211 | /// </summary> |
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index e3b156d..c731561 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs | |||
@@ -25,14 +25,16 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Data; | ||
30 | using System.IO; | 32 | using System.IO; |
31 | using System.Security.Cryptography; | ||
32 | using System.Net; | 33 | using System.Net; |
34 | using System.Net.Sockets; | ||
35 | using System.Security.Cryptography; | ||
33 | using System.Text; | 36 | using System.Text; |
34 | using libsecondlife; | 37 | using libsecondlife; |
35 | |||
36 | using Nini.Config; | 38 | using Nini.Config; |
37 | 39 | ||
38 | namespace OpenSim.Framework | 40 | namespace OpenSim.Framework |
@@ -52,16 +54,13 @@ namespace OpenSim.Framework | |||
52 | 54 | ||
53 | public static Random RandomClass | 55 | public static Random RandomClass |
54 | { | 56 | { |
55 | get | 57 | get { return randomClass; } |
56 | { | ||
57 | return randomClass; | ||
58 | } | ||
59 | } | 58 | } |
60 | 59 | ||
61 | public static uint GetNextXferID() | 60 | public static uint GetNextXferID() |
62 | { | 61 | { |
63 | uint id = 0; | 62 | uint id = 0; |
64 | lock(XferLock) | 63 | lock (XferLock) |
65 | { | 64 | { |
66 | id = nextXferID; | 65 | id = nextXferID; |
67 | nextXferID++; | 66 | nextXferID++; |
@@ -71,25 +70,24 @@ namespace OpenSim.Framework | |||
71 | 70 | ||
72 | public Util() | 71 | public Util() |
73 | { | 72 | { |
74 | |||
75 | } | 73 | } |
76 | 74 | ||
77 | public static string GetFileName(string file) | 75 | public static string GetFileName(string file) |
78 | { | 76 | { |
79 | // Return just the filename on UNIX platforms | 77 | // Return just the filename on UNIX platforms |
80 | // TODO: this should be customisable with a prefix, but that's something to do later. | 78 | // TODO: this should be customisable with a prefix, but that's something to do later. |
81 | if (System.Environment.OSVersion.Platform == PlatformID.Unix) | 79 | if (Environment.OSVersion.Platform == PlatformID.Unix) |
82 | { | 80 | { |
83 | return file; | 81 | return file; |
84 | } | 82 | } |
85 | 83 | ||
86 | // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA | 84 | // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA |
87 | // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData | 85 | // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData |
88 | if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) | 86 | if (Environment.OSVersion.Platform == PlatformID.Win32NT) |
89 | { | 87 | { |
90 | if (!System.IO.Directory.Exists("%APPDATA%\\OpenSim\\")) | 88 | if (!Directory.Exists("%APPDATA%\\OpenSim\\")) |
91 | { | 89 | { |
92 | System.IO.Directory.CreateDirectory("%APPDATA%\\OpenSim"); | 90 | Directory.CreateDirectory("%APPDATA%\\OpenSim"); |
93 | } | 91 | } |
94 | 92 | ||
95 | return "%APPDATA%\\OpenSim\\" + file; | 93 | return "%APPDATA%\\OpenSim\\" + file; |
@@ -103,23 +101,23 @@ namespace OpenSim.Framework | |||
103 | public static bool IsEnvironmentSupported(ref string reason) | 101 | public static bool IsEnvironmentSupported(ref string reason) |
104 | { | 102 | { |
105 | // Must have .NET 2.0 (Generics / libsl) | 103 | // Must have .NET 2.0 (Generics / libsl) |
106 | if (System.Environment.Version.Major < 2) | 104 | if (Environment.Version.Major < 2) |
107 | { | 105 | { |
108 | reason = ".NET 1.0/1.1 lacks components that is used by OpenSim"; | 106 | reason = ".NET 1.0/1.1 lacks components that is used by OpenSim"; |
109 | return false; | 107 | return false; |
110 | } | 108 | } |
111 | 109 | ||
112 | // Windows 95/98/ME are unsupported | 110 | // Windows 95/98/ME are unsupported |
113 | if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows && | 111 | if (Environment.OSVersion.Platform == PlatformID.Win32Windows && |
114 | System.Environment.OSVersion.Platform != PlatformID.Win32NT) | 112 | Environment.OSVersion.Platform != PlatformID.Win32NT) |
115 | { | 113 | { |
116 | reason = "Windows 95/98/ME will not run OpenSim"; | 114 | reason = "Windows 95/98/ME will not run OpenSim"; |
117 | return false; | 115 | return false; |
118 | } | 116 | } |
119 | 117 | ||
120 | // Windows 2000 / Pre-SP2 XP | 118 | // Windows 2000 / Pre-SP2 XP |
121 | if (System.Environment.OSVersion.Version.Major == 5 && ( | 119 | if (Environment.OSVersion.Version.Major == 5 && ( |
122 | System.Environment.OSVersion.Version.Minor == 0)) | 120 | Environment.OSVersion.Version.Minor == 0)) |
123 | { | 121 | { |
124 | reason = "Please update to Windows XP Service Pack 2 or Server2003"; | 122 | reason = "Please update to Windows XP Service Pack 2 or Server2003"; |
125 | return false; | 123 | return false; |
@@ -131,7 +129,7 @@ namespace OpenSim.Framework | |||
131 | public static int UnixTimeSinceEpoch() | 129 | public static int UnixTimeSinceEpoch() |
132 | { | 130 | { |
133 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); | 131 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); |
134 | int timestamp = (int)t.TotalSeconds; | 132 | int timestamp = (int) t.TotalSeconds; |
135 | return timestamp; | 133 | return timestamp; |
136 | } | 134 | } |
137 | 135 | ||
@@ -155,10 +153,10 @@ namespace OpenSim.Framework | |||
155 | 153 | ||
156 | public static int fast_distance2d(int x, int y) | 154 | public static int fast_distance2d(int x, int y) |
157 | { | 155 | { |
158 | x = System.Math.Abs(x); | 156 | x = Math.Abs(x); |
159 | y = System.Math.Abs(y); | 157 | y = Math.Abs(y); |
160 | 158 | ||
161 | int min = System.Math.Min(x, y); | 159 | int min = Math.Min(x, y); |
162 | 160 | ||
163 | return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); | 161 | return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); |
164 | } | 162 | } |
@@ -233,7 +231,7 @@ namespace OpenSim.Framework | |||
233 | for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) | 231 | for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) |
234 | { | 232 | { |
235 | if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) | 233 | if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) |
236 | output.Append((char)bytes[i + j]); | 234 | output.Append((char) bytes[i + j]); |
237 | else | 235 | else |
238 | output.Append("."); | 236 | output.Append("."); |
239 | } | 237 | } |
@@ -250,7 +248,6 @@ namespace OpenSim.Framework | |||
250 | /// <returns>An IP address, or null</returns> | 248 | /// <returns>An IP address, or null</returns> |
251 | public static IPAddress GetHostFromDNS(string dnsAddress) | 249 | public static IPAddress GetHostFromDNS(string dnsAddress) |
252 | { | 250 | { |
253 | |||
254 | // Is it already a valid IP? No need to look it up. | 251 | // Is it already a valid IP? No need to look it up. |
255 | IPAddress ipa; | 252 | IPAddress ipa; |
256 | if (IPAddress.TryParse(dnsAddress, out ipa)) | 253 | if (IPAddress.TryParse(dnsAddress, out ipa)) |
@@ -261,7 +258,7 @@ namespace OpenSim.Framework | |||
261 | 258 | ||
262 | foreach (IPAddress host in hosts) | 259 | foreach (IPAddress host in hosts) |
263 | { | 260 | { |
264 | if (host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) | 261 | if (host.AddressFamily == AddressFamily.InterNetwork) |
265 | { | 262 | { |
266 | return host; | 263 | return host; |
267 | } | 264 | } |
@@ -281,7 +278,7 @@ namespace OpenSim.Framework | |||
281 | 278 | ||
282 | foreach (IPAddress host in hosts) | 279 | foreach (IPAddress host in hosts) |
283 | { | 280 | { |
284 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) | 281 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) |
285 | { | 282 | { |
286 | return host; | 283 | return host; |
287 | } | 284 | } |
@@ -302,7 +299,7 @@ namespace OpenSim.Framework | |||
302 | string temp; | 299 | string temp; |
303 | // string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); | 300 | // string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); |
304 | // temp = Path.Combine(personal,".OpenSim"); | 301 | // temp = Path.Combine(personal,".OpenSim"); |
305 | temp="."; | 302 | temp = "."; |
306 | return temp; | 303 | return temp; |
307 | } | 304 | } |
308 | 305 | ||
@@ -349,9 +346,9 @@ namespace OpenSim.Framework | |||
349 | } | 346 | } |
350 | 347 | ||
351 | // Nini (config) related Methods | 348 | // Nini (config) related Methods |
352 | public static IConfigSource ConvertDataRowToXMLConfig(System.Data.DataRow row, string fileName) | 349 | public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) |
353 | { | 350 | { |
354 | if(!File.Exists(fileName)) | 351 | if (!File.Exists(fileName)) |
355 | { | 352 | { |
356 | //create new file | 353 | //create new file |
357 | } | 354 | } |
@@ -362,13 +359,13 @@ namespace OpenSim.Framework | |||
362 | return config; | 359 | return config; |
363 | } | 360 | } |
364 | 361 | ||
365 | public static void AddDataRowToConfig(IConfigSource config, System.Data.DataRow row) | 362 | public static void AddDataRowToConfig(IConfigSource config, DataRow row) |
366 | { | 363 | { |
367 | config.Configs.Add((string)row[0]); | 364 | config.Configs.Add((string) row[0]); |
368 | for (int i = 0; i < row.Table.Columns.Count; i++) | 365 | for (int i = 0; i < row.Table.Columns.Count; i++) |
369 | { | 366 | { |
370 | config.Configs[(string)row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); | 367 | config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); |
371 | } | 368 | } |
372 | } | 369 | } |
373 | } | 370 | } |
374 | } | 371 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 179a651..52d2a2c 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -31,11 +31,10 @@ using System.Collections.Generic; | |||
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Net; | 32 | using System.Net; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Text.RegularExpressions; | ||
35 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Xml; | ||
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using System.Xml; | ||
39 | 38 | ||
40 | namespace OpenSim.Framework.Servers | 39 | namespace OpenSim.Framework.Servers |
41 | { | 40 | { |
@@ -50,7 +49,7 @@ namespace OpenSim.Framework.Servers | |||
50 | 49 | ||
51 | public int Port | 50 | public int Port |
52 | { | 51 | { |
53 | get { return m_port; } | 52 | get { return m_port; } |
54 | } | 53 | } |
55 | 54 | ||
56 | public BaseHttpServer(int port) | 55 | public BaseHttpServer(int port) |
@@ -58,11 +57,11 @@ namespace OpenSim.Framework.Servers | |||
58 | m_port = port; | 57 | m_port = port; |
59 | } | 58 | } |
60 | 59 | ||
61 | public void AddStreamHandler( IStreamHandler handler) | 60 | public void AddStreamHandler(IStreamHandler handler) |
62 | { | 61 | { |
63 | string httpMethod = handler.HttpMethod; | 62 | string httpMethod = handler.HttpMethod; |
64 | string path = handler.Path; | 63 | string path = handler.Path; |
65 | 64 | ||
66 | string handlerKey = GetHandlerKey(httpMethod, path); | 65 | string handlerKey = GetHandlerKey(httpMethod, path); |
67 | m_streamHandlers.Add(handlerKey, handler); | 66 | m_streamHandlers.Add(handlerKey, handler); |
68 | } | 67 | } |
@@ -74,9 +73,9 @@ namespace OpenSim.Framework.Servers | |||
74 | 73 | ||
75 | public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) | 74 | public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) |
76 | { | 75 | { |
77 | if (!this.m_rpcHandlers.ContainsKey(method)) | 76 | if (!m_rpcHandlers.ContainsKey(method)) |
78 | { | 77 | { |
79 | this.m_rpcHandlers.Add(method, handler); | 78 | m_rpcHandlers.Add(method, handler); |
80 | return true; | 79 | return true; |
81 | } | 80 | } |
82 | 81 | ||
@@ -87,7 +86,7 @@ namespace OpenSim.Framework.Servers | |||
87 | 86 | ||
88 | public virtual void HandleRequest(Object stateinfo) | 87 | public virtual void HandleRequest(Object stateinfo) |
89 | { | 88 | { |
90 | HttpListenerContext context = (HttpListenerContext)stateinfo; | 89 | HttpListenerContext context = (HttpListenerContext) stateinfo; |
91 | 90 | ||
92 | HttpListenerRequest request = context.Request; | 91 | HttpListenerRequest request = context.Request; |
93 | HttpListenerResponse response = context.Response; | 92 | HttpListenerResponse response = context.Response; |
@@ -96,11 +95,11 @@ namespace OpenSim.Framework.Servers | |||
96 | response.SendChunked = false; | 95 | response.SendChunked = false; |
97 | 96 | ||
98 | string path = request.RawUrl; | 97 | string path = request.RawUrl; |
99 | string handlerKey = GetHandlerKey( request.HttpMethod, path ); | 98 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
100 | 99 | ||
101 | IStreamHandler streamHandler; | 100 | IStreamHandler streamHandler; |
102 | 101 | ||
103 | if (TryGetStreamHandler( handlerKey, out streamHandler)) | 102 | if (TryGetStreamHandler(handlerKey, out streamHandler)) |
104 | { | 103 | { |
105 | byte[] buffer = streamHandler.Handle(path, request.InputStream); | 104 | byte[] buffer = streamHandler.Handle(path, request.InputStream); |
106 | request.InputStream.Close(); | 105 | request.InputStream.Close(); |
@@ -159,11 +158,11 @@ namespace OpenSim.Framework.Servers | |||
159 | 158 | ||
160 | try | 159 | try |
161 | { | 160 | { |
162 | xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | 161 | xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); |
163 | } | 162 | } |
164 | catch ( XmlException e ) | 163 | catch (XmlException e) |
165 | { | 164 | { |
166 | responseString = String.Format( "XmlException:\n{0}",e.Message ); | 165 | responseString = String.Format("XmlException:\n{0}", e.Message); |
167 | } | 166 | } |
168 | 167 | ||
169 | if (xmlRprcRequest != null) | 168 | if (xmlRprcRequest != null) |
@@ -173,7 +172,7 @@ namespace OpenSim.Framework.Servers | |||
173 | XmlRpcResponse xmlRpcResponse; | 172 | XmlRpcResponse xmlRpcResponse; |
174 | 173 | ||
175 | XmlRpcMethod method; | 174 | XmlRpcMethod method; |
176 | if (this.m_rpcHandlers.TryGetValue(methodName, out method)) | 175 | if (m_rpcHandlers.TryGetValue(methodName, out method)) |
177 | { | 176 | { |
178 | xmlRpcResponse = method(xmlRprcRequest); | 177 | xmlRpcResponse = method(xmlRprcRequest); |
179 | } | 178 | } |
@@ -181,7 +180,8 @@ namespace OpenSim.Framework.Servers | |||
181 | { | 180 | { |
182 | xmlRpcResponse = new XmlRpcResponse(); | 181 | xmlRpcResponse = new XmlRpcResponse(); |
183 | Hashtable unknownMethodError = new Hashtable(); | 182 | Hashtable unknownMethodError = new Hashtable(); |
184 | unknownMethodError["reason"] = "XmlRequest"; ; | 183 | unknownMethodError["reason"] = "XmlRequest"; |
184 | ; | ||
185 | unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; | 185 | unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; |
186 | unknownMethodError["login"] = "false"; | 186 | unknownMethodError["login"] = "false"; |
187 | xmlRpcResponse.Value = unknownMethodError; | 187 | xmlRpcResponse.Value = unknownMethodError; |
@@ -249,4 +249,4 @@ namespace OpenSim.Framework.Servers | |||
249 | m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); | 249 | m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | } | 252 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs index 4b609c3..cd99183 100644 --- a/OpenSim/Framework/Servers/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs | |||
@@ -26,37 +26,36 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | 29 | using System.IO; |
33 | 30 | ||
34 | namespace OpenSim.Framework.Servers | 31 | namespace OpenSim.Framework.Servers |
35 | { | 32 | { |
36 | public abstract class BaseStreamHandler : IStreamHandler | 33 | public abstract class BaseStreamHandler : IStreamHandler |
37 | { | 34 | { |
38 | virtual public string ContentType | 35 | public virtual string ContentType |
39 | { | 36 | { |
40 | get { return "application/xml"; } | 37 | get { return "application/xml"; } |
41 | } | 38 | } |
42 | 39 | ||
43 | private string m_httpMethod; | 40 | private string m_httpMethod; |
44 | virtual public string HttpMethod | 41 | |
42 | public virtual string HttpMethod | ||
45 | { | 43 | { |
46 | get { return m_httpMethod; } | 44 | get { return m_httpMethod; } |
47 | } | 45 | } |
48 | 46 | ||
49 | private string m_path; | 47 | private string m_path; |
50 | virtual public string Path | 48 | |
49 | public virtual string Path | ||
51 | { | 50 | { |
52 | get { return m_path; } | 51 | get { return m_path; } |
53 | } | 52 | } |
54 | 53 | ||
55 | protected string GetParam( string path ) | 54 | protected string GetParam(string path) |
56 | { | 55 | { |
57 | return path.Substring( m_path.Length ); | 56 | return path.Substring(m_path.Length); |
58 | } | 57 | } |
59 | 58 | ||
60 | public abstract byte[] Handle(string path, Stream request); | 59 | public abstract byte[] Handle(string path, Stream request); |
61 | 60 | ||
62 | protected BaseStreamHandler(string httpMethod, string path) | 61 | protected BaseStreamHandler(string httpMethod, string path) |
@@ -65,4 +64,4 @@ namespace OpenSim.Framework.Servers | |||
65 | m_path = path; | 64 | m_path = path; |
66 | } | 65 | } |
67 | } | 66 | } |
68 | } | 67 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs index 4cc6fc7..65fa3c9 100644 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs | |||
@@ -26,10 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | 29 | using System.IO; |
30 | using System.Text; | ||
33 | 31 | ||
34 | namespace OpenSim.Framework.Servers | 32 | namespace OpenSim.Framework.Servers |
35 | { | 33 | { |
@@ -37,14 +35,14 @@ namespace OpenSim.Framework.Servers | |||
37 | 35 | ||
38 | public class BinaryStreamHandler : BaseStreamHandler | 36 | public class BinaryStreamHandler : BaseStreamHandler |
39 | { | 37 | { |
40 | BinaryMethod m_method; | 38 | private BinaryMethod m_method; |
41 | 39 | ||
42 | override public byte[] Handle(string path, Stream request) | 40 | public override byte[] Handle(string path, Stream request) |
43 | { | 41 | { |
44 | byte[] data = ReadFully(request); | 42 | byte[] data = ReadFully(request); |
45 | string param = GetParam(path); | 43 | string param = GetParam(path); |
46 | string responseString = m_method(data, path, param); | 44 | string responseString = m_method(data, path, param); |
47 | 45 | ||
48 | return Encoding.UTF8.GetBytes(responseString); | 46 | return Encoding.UTF8.GetBytes(responseString); |
49 | } | 47 | } |
50 | 48 | ||
@@ -67,11 +65,10 @@ namespace OpenSim.Framework.Servers | |||
67 | { | 65 | { |
68 | return ms.ToArray(); | 66 | return ms.ToArray(); |
69 | } | 67 | } |
70 | 68 | ||
71 | ms.Write(buffer, 0, read); | 69 | ms.Write(buffer, 0, read); |
72 | } | 70 | } |
73 | } | 71 | } |
74 | } | 72 | } |
75 | } | 73 | } |
76 | 74 | } \ No newline at end of file | |
77 | } | ||
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs index 62e5ea0..ef4c0ee 100644 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ b/OpenSim/Framework/Servers/CheckSumServer.cs | |||
@@ -26,7 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Framework.Servers | 28 | namespace OpenSim.Framework.Servers |
29 | {/* | 29 | { |
30 | /* | ||
30 | public class CheckSumServer : UDPServerBase | 31 | public class CheckSumServer : UDPServerBase |
31 | { | 32 | { |
32 | //protected ConsoleBase m_log; | 33 | //protected ConsoleBase m_log; |
@@ -123,5 +124,4 @@ namespace OpenSim.Framework.Servers | |||
123 | } | 124 | } |
124 | * } | 125 | * } |
125 | */ | 126 | */ |
126 | |||
127 | } \ No newline at end of file | 127 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs index d97b37f..d674172 100644 --- a/OpenSim/Framework/Servers/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/IStreamHandler.cs | |||
@@ -26,9 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | 29 | using System.IO; |
33 | 30 | ||
34 | namespace OpenSim.Framework.Servers | 31 | namespace OpenSim.Framework.Servers |
@@ -36,15 +33,15 @@ namespace OpenSim.Framework.Servers | |||
36 | public interface IStreamHandler | 33 | public interface IStreamHandler |
37 | { | 34 | { |
38 | // Handle request stream, return byte array | 35 | // Handle request stream, return byte array |
39 | byte[] Handle(string path, Stream request ); | 36 | byte[] Handle(string path, Stream request); |
40 | 37 | ||
41 | // Return response content type | 38 | // Return response content type |
42 | string ContentType { get; } | 39 | string ContentType { get; } |
43 | 40 | ||
44 | // Return required http method | 41 | // Return required http method |
45 | string HttpMethod { get;} | 42 | string HttpMethod { get; } |
46 | 43 | ||
47 | // Return path | 44 | // Return path |
48 | string Path { get; } | 45 | string Path { get; } |
49 | } | 46 | } |
50 | } | 47 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs index 80c6451..83f9e71 100644 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ b/OpenSim/Framework/Servers/RestMethod.cs | |||
@@ -27,5 +27,5 @@ | |||
27 | */ | 27 | */ |
28 | namespace OpenSim.Framework.Servers | 28 | namespace OpenSim.Framework.Servers |
29 | { | 29 | { |
30 | public delegate string RestMethod( string request, string path, string param ); | 30 | public delegate string RestMethod(string request, string path, string param); |
31 | } | 31 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 1b1876e..0450387 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs | |||
@@ -26,18 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | 29 | using System.IO; |
30 | using System.Text; | ||
33 | 31 | ||
34 | namespace OpenSim.Framework.Servers | 32 | namespace OpenSim.Framework.Servers |
35 | { | 33 | { |
36 | public class RestStreamHandler : BaseStreamHandler | 34 | public class RestStreamHandler : BaseStreamHandler |
37 | { | 35 | { |
38 | RestMethod m_restMethod; | 36 | private RestMethod m_restMethod; |
39 | 37 | ||
40 | override public byte[] Handle(string path, Stream request ) | 38 | public override byte[] Handle(string path, Stream request) |
41 | { | 39 | { |
42 | Encoding encoding = Encoding.UTF8; | 40 | Encoding encoding = Encoding.UTF8; |
43 | StreamReader streamReader = new StreamReader(request, encoding); | 41 | StreamReader streamReader = new StreamReader(request, encoding); |
@@ -46,14 +44,14 @@ namespace OpenSim.Framework.Servers | |||
46 | streamReader.Close(); | 44 | streamReader.Close(); |
47 | 45 | ||
48 | string param = GetParam(path); | 46 | string param = GetParam(path); |
49 | string responseString = m_restMethod(requestBody, path, param ); | 47 | string responseString = m_restMethod(requestBody, path, param); |
50 | 48 | ||
51 | return Encoding.UTF8.GetBytes(responseString); | 49 | return Encoding.UTF8.GetBytes(responseString); |
52 | } | 50 | } |
53 | 51 | ||
54 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path ) | 52 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path) |
55 | { | 53 | { |
56 | m_restMethod = restMethod; | 54 | m_restMethod = restMethod; |
57 | } | 55 | } |
58 | } | 56 | } |
59 | } | 57 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs index 8fc32ff..017168f 100644 --- a/OpenSim/Framework/Servers/UDPServerBase.cs +++ b/OpenSim/Framework/Servers/UDPServerBase.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers | |||
51 | protected virtual void OnReceivedData(IAsyncResult result) | 51 | protected virtual void OnReceivedData(IAsyncResult result) |
52 | { | 52 | { |
53 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 53 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
54 | epSender = (EndPoint)ipeSender; | 54 | epSender = (EndPoint) ipeSender; |
55 | Packet packet = null; | 55 | Packet packet = null; |
56 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | 56 | int numBytes = Server.EndReceiveFrom(result, ref epSender); |
57 | int packetEnd = numBytes - 1; | 57 | int packetEnd = numBytes - 1; |
@@ -67,21 +67,18 @@ namespace OpenSim.Framework.Servers | |||
67 | 67 | ||
68 | public virtual void ServerListener() | 68 | public virtual void ServerListener() |
69 | { | 69 | { |
70 | |||
71 | ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); | 70 | ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); |
72 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | 71 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
73 | Server.Bind(ServerIncoming); | 72 | Server.Bind(ServerIncoming); |
74 | 73 | ||
75 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 74 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
76 | epSender = (EndPoint)ipeSender; | 75 | epSender = (EndPoint) ipeSender; |
77 | ReceivedData = new AsyncCallback(this.OnReceivedData); | 76 | ReceivedData = new AsyncCallback(OnReceivedData); |
78 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 77 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
79 | } | 78 | } |
80 | 79 | ||
81 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) | 80 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
82 | { | 81 | { |
83 | |||
84 | } | 82 | } |
85 | } | 83 | } |
86 | } | 84 | } \ No newline at end of file |
87 | |||
diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs index ef14cf6..c3817ca 100644 --- a/OpenSim/Framework/Servers/XmlRpcMethod.cs +++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs | |||
@@ -29,5 +29,5 @@ using Nwc.XmlRpc; | |||
29 | 29 | ||
30 | namespace OpenSim.Framework.Servers | 30 | namespace OpenSim.Framework.Servers |
31 | { | 31 | { |
32 | public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request ); | 32 | public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request); |
33 | } | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index e7e5d27..61427fa 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -29,17 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | |||
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using Nini.Config; | 33 | using Nini.Config; |
35 | |||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Communications.Cache; | ||
38 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
40 | using OpenSim.Framework.Interfaces; | ||
41 | using OpenSim.Framework.Servers; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
44 | 37 | ||
45 | namespace OpenSim.Grid.AssetServer | 38 | namespace OpenSim.Grid.AssetServer |
@@ -79,11 +72,12 @@ namespace OpenSim.Grid.AssetServer | |||
79 | 72 | ||
80 | private OpenAsset_Main() | 73 | private OpenAsset_Main() |
81 | { | 74 | { |
82 | if(!Directory.Exists(Util.logDir())) | 75 | if (!Directory.Exists(Util.logDir())) |
83 | { | 76 | { |
84 | Directory.CreateDirectory(Util.logDir()); | 77 | Directory.CreateDirectory(Util.logDir()); |
85 | } | 78 | } |
86 | m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-AssetServer-console.log")), "OpenAsset", this, true); | 79 | m_console = |
80 | new LogBase((Path.Combine(Util.logDir(), "opengrid-AssetServer-console.log")), "OpenAsset", this, true); | ||
87 | MainLog.Instance = m_console; | 81 | MainLog.Instance = m_console; |
88 | } | 82 | } |
89 | 83 | ||
@@ -96,9 +90,9 @@ namespace OpenSim.Grid.AssetServer | |||
96 | 90 | ||
97 | m_console.Verbose("ASSET", "Loading default asset set.."); | 91 | m_console.Verbose("ASSET", "Loading default asset set.."); |
98 | LoadDefaultAssets(); | 92 | LoadDefaultAssets(); |
99 | 93 | ||
100 | m_console.Verbose("ASSET", "Starting HTTP process"); | 94 | m_console.Verbose("ASSET", "Starting HTTP process"); |
101 | BaseHttpServer httpServer = new BaseHttpServer((int)m_config.HttpPort); | 95 | BaseHttpServer httpServer = new BaseHttpServer((int) m_config.HttpPort); |
102 | 96 | ||
103 | httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider)); | 97 | httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider)); |
104 | httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); | 98 | httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); |
@@ -125,7 +119,8 @@ namespace OpenSim.Grid.AssetServer | |||
125 | 119 | ||
126 | if (typeInterface != null) | 120 | if (typeInterface != null) |
127 | { | 121 | { |
128 | IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 122 | IAssetProvider plug = |
123 | (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
129 | assetPlugin = plug; | 124 | assetPlugin = plug; |
130 | assetPlugin.Initialise(); | 125 | assetPlugin.Initialise(); |
131 | 126 | ||
@@ -174,7 +169,7 @@ namespace OpenSim.Grid.AssetServer | |||
174 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | 169 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); |
175 | byte[] idata = new byte[numBytes]; | 170 | byte[] idata = new byte[numBytes]; |
176 | BinaryReader br = new BinaryReader(fStream); | 171 | BinaryReader br = new BinaryReader(fStream); |
177 | idata = br.ReadBytes((int)numBytes); | 172 | idata = br.ReadBytes((int) numBytes); |
178 | br.Close(); | 173 | br.Close(); |
179 | fStream.Close(); | 174 | fStream.Close(); |
180 | info.Data = idata; | 175 | info.Data = idata; |
@@ -213,8 +208,8 @@ namespace OpenSim.Grid.AssetServer | |||
213 | { | 208 | { |
214 | string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); | 209 | string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); |
215 | string name = source.Configs[i].GetString("name", ""); | 210 | string name = source.Configs[i].GetString("name", ""); |
216 | sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); | 211 | sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); |
217 | sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); | 212 | sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0); |
218 | string fileName = source.Configs[i].GetString("fileName", ""); | 213 | string fileName = source.Configs[i].GetString("fileName", ""); |
219 | 214 | ||
220 | AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); | 215 | AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); |
@@ -247,4 +242,4 @@ namespace OpenSim.Grid.AssetServer | |||
247 | { | 242 | { |
248 | } | 243 | } |
249 | } | 244 | } |
250 | } | 245 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs index 63213f6..87a7f67 100644 --- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs | |||
@@ -27,25 +27,29 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // General Information about an assembly is controlled through the following | 31 | // General Information about an assembly is controlled through the following |
31 | // set of attributes. Change these attribute values to modify the information | 32 | // set of attributes. Change these attribute values to modify the information |
32 | // associated with an assembly. | 33 | // associated with an assembly. |
33 | [assembly: AssemblyTitle("OGS-AssetServer")] | 34 | |
34 | [assembly: AssemblyDescription("")] | 35 | [assembly : AssemblyTitle("OGS-AssetServer")] |
35 | [assembly: AssemblyConfiguration("")] | 36 | [assembly : AssemblyDescription("")] |
36 | [assembly: AssemblyCompany("")] | 37 | [assembly : AssemblyConfiguration("")] |
37 | [assembly: AssemblyProduct("OGS-AssetServer")] | 38 | [assembly : AssemblyCompany("")] |
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | 39 | [assembly : AssemblyProduct("OGS-AssetServer")] |
39 | [assembly: AssemblyTrademark("")] | 40 | [assembly : AssemblyCopyright("Copyright © 2007")] |
40 | [assembly: AssemblyCulture("")] | 41 | [assembly : AssemblyTrademark("")] |
42 | [assembly : AssemblyCulture("")] | ||
41 | 43 | ||
42 | // Setting ComVisible to false makes the types in this assembly not visible | 44 | // Setting ComVisible to false makes the types in this assembly not visible |
43 | // to COM components. If you need to access a type in this assembly from | 45 | // to COM components. If you need to access a type in this assembly from |
44 | // COM, set the ComVisible attribute to true on that type. | 46 | // COM, set the ComVisible attribute to true on that type. |
45 | [assembly: ComVisible(false)] | 47 | |
48 | [assembly : ComVisible(false)] | ||
46 | 49 | ||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 50 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | 51 | |
52 | [assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | ||
49 | 53 | ||
50 | // Version information for an assembly consists of the following four values: | 54 | // Version information for an assembly consists of the following four values: |
51 | // | 55 | // |
@@ -54,5 +58,6 @@ using System.Runtime.InteropServices; | |||
54 | // Build Number | 58 | // Build Number |
55 | // Revision | 59 | // Revision |
56 | // | 60 | // |
57 | [assembly: AssemblyVersion("1.0.0.0")] | 61 | |
58 | [assembly: AssemblyFileVersion("1.0.0.0")] | 62 | [assembly : AssemblyVersion("1.0.0.0")] |
63 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 6993019..0cad643 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs | |||
@@ -1,29 +1,27 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Text; | ||
3 | using System.Xml; | 4 | using System.Xml; |
4 | using System.Xml.Serialization; | 5 | using System.Xml.Serialization; |
5 | using System.Text; | ||
6 | |||
7 | using libsecondlife; | 6 | using libsecondlife; |
8 | using OpenSim.Framework; | 7 | using OpenSim.Framework; |
9 | using OpenSim.Framework.Servers; | ||
10 | using OpenSim.Framework.Interfaces; | ||
11 | using OpenSim.Framework.Console; | 8 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Servers; | ||
12 | 10 | ||
13 | namespace OpenSim.Grid.AssetServer | 11 | namespace OpenSim.Grid.AssetServer |
14 | { | 12 | { |
15 | public class GetAssetStreamHandler : BaseStreamHandler | 13 | public class GetAssetStreamHandler : BaseStreamHandler |
16 | { | 14 | { |
17 | OpenAsset_Main m_assetManager; | 15 | private OpenAsset_Main m_assetManager; |
18 | IAssetProvider m_assetProvider; | 16 | private IAssetProvider m_assetProvider; |
19 | 17 | ||
20 | override public byte[] Handle(string path, Stream request) | 18 | public override byte[] Handle(string path, Stream request) |
21 | { | 19 | { |
22 | string param = GetParam(path); | 20 | string param = GetParam(path); |
23 | byte[] result = new byte[] { }; | 21 | byte[] result = new byte[] {}; |
24 | try { | 22 | try |
25 | 23 | { | |
26 | string[] p = param.Split(new char[] { '/', '?', '&' }, StringSplitOptions.RemoveEmptyEntries); | 24 | string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); |
27 | 25 | ||
28 | if (p.Length > 0) | 26 | if (p.Length > 0) |
29 | { | 27 | { |
@@ -42,7 +40,7 @@ namespace OpenSim.Grid.AssetServer | |||
42 | { | 40 | { |
43 | MainLog.Instance.Debug("REST", "GET:/asset found {0}, {1}", assetID, asset.Name); | 41 | MainLog.Instance.Debug("REST", "GET:/asset found {0}, {1}", assetID, asset.Name); |
44 | 42 | ||
45 | XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); | 43 | XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); |
46 | MemoryStream ms = new MemoryStream(); | 44 | MemoryStream ms = new MemoryStream(); |
47 | XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); | 45 | XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); |
48 | xw.Formatting = Formatting.Indented; | 46 | xw.Formatting = Formatting.Indented; |
@@ -53,7 +51,7 @@ namespace OpenSim.Grid.AssetServer | |||
53 | StreamReader sr = new StreamReader(ms); | 51 | StreamReader sr = new StreamReader(ms); |
54 | 52 | ||
55 | result = ms.GetBuffer(); | 53 | result = ms.GetBuffer(); |
56 | Array.Resize<byte>(ref result, (int)ms.Length); | 54 | Array.Resize<byte>(ref result, (int) ms.Length); |
57 | } | 55 | } |
58 | else | 56 | else |
59 | { | 57 | { |
@@ -69,7 +67,7 @@ namespace OpenSim.Grid.AssetServer | |||
69 | } | 67 | } |
70 | 68 | ||
71 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) | 69 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) |
72 | : base("GET", "/assets" ) | 70 | : base("GET", "/assets") |
73 | { | 71 | { |
74 | m_assetManager = assetManager; | 72 | m_assetManager = assetManager; |
75 | m_assetProvider = assetProvider; | 73 | m_assetProvider = assetProvider; |
@@ -78,25 +76,25 @@ namespace OpenSim.Grid.AssetServer | |||
78 | 76 | ||
79 | public class PostAssetStreamHandler : BaseStreamHandler | 77 | public class PostAssetStreamHandler : BaseStreamHandler |
80 | { | 78 | { |
81 | OpenAsset_Main m_assetManager; | 79 | private OpenAsset_Main m_assetManager; |
82 | IAssetProvider m_assetProvider; | 80 | private IAssetProvider m_assetProvider; |
83 | 81 | ||
84 | override public byte[] Handle(string path, Stream request) | 82 | public override byte[] Handle(string path, Stream request) |
85 | { | 83 | { |
86 | string param = GetParam(path); | 84 | string param = GetParam(path); |
87 | 85 | ||
88 | LLUUID assetId; | 86 | LLUUID assetId; |
89 | if(param.Length > 0) | 87 | if (param.Length > 0) |
90 | LLUUID.TryParse(param, out assetId); | 88 | LLUUID.TryParse(param, out assetId); |
91 | byte[] txBuffer = new byte[4096]; | 89 | byte[] txBuffer = new byte[4096]; |
92 | 90 | ||
93 | XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); | 91 | XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); |
94 | AssetBase asset = (AssetBase)xs.Deserialize(request); | 92 | AssetBase asset = (AssetBase) xs.Deserialize(request); |
95 | 93 | ||
96 | MainLog.Instance.Verbose("REST", "StoreAndCommitAsset {0}", asset.FullID); | 94 | MainLog.Instance.Verbose("REST", "StoreAndCommitAsset {0}", asset.FullID); |
97 | m_assetProvider.CreateAsset(asset); | 95 | m_assetProvider.CreateAsset(asset); |
98 | 96 | ||
99 | return new byte[] { }; | 97 | return new byte[] {}; |
100 | } | 98 | } |
101 | 99 | ||
102 | public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) | 100 | public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) |
@@ -106,4 +104,4 @@ namespace OpenSim.Grid.AssetServer | |||
106 | m_assetProvider = assetProvider; | 104 | m_assetProvider = assetProvider; |
107 | } | 105 | } |
108 | } | 106 | } |
109 | } | 107 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 8ac7d6a..0d966dd 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -25,27 +25,24 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
29 | using System.Collections; | 30 | using System.Collections; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Net; | ||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Xml; | 33 | using System.Xml; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Data; | 38 | using OpenSim.Framework.Data; |
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework; | ||
40 | |||
41 | using OpenSim.Framework; | ||
42 | 39 | ||
43 | namespace OpenSim.Grid.GridServer | 40 | namespace OpenSim.Grid.GridServer |
44 | { | 41 | { |
45 | class GridManager | 42 | internal class GridManager |
46 | { | 43 | { |
47 | Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); | 44 | private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); |
48 | Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); | 45 | private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); |
49 | 46 | ||
50 | public GridConfig config; | 47 | public GridConfig config; |
51 | 48 | ||
@@ -54,13 +51,13 @@ namespace OpenSim.Grid.GridServer | |||
54 | /// </summary> | 51 | /// </summary> |
55 | /// <param name="FileName">The filename to the grid server plugin DLL</param> | 52 | /// <param name="FileName">The filename to the grid server plugin DLL</param> |
56 | public void AddPlugin(string FileName) | 53 | public void AddPlugin(string FileName) |
57 | { | 54 | { |
58 | MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); | 55 | MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); |
59 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 56 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
60 | 57 | ||
61 | MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 58 | MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
62 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 59 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
63 | { | 60 | { |
64 | if (!pluginType.IsAbstract) | 61 | if (!pluginType.IsAbstract) |
65 | { | 62 | { |
66 | // Regions go here | 63 | // Regions go here |
@@ -68,9 +65,10 @@ namespace OpenSim.Grid.GridServer | |||
68 | 65 | ||
69 | if (typeInterface != null) | 66 | if (typeInterface != null) |
70 | { | 67 | { |
71 | IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 68 | IGridData plug = |
69 | (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
72 | plug.Initialise(); | 70 | plug.Initialise(); |
73 | this._plugins.Add(plug.getName(), plug); | 71 | _plugins.Add(plug.getName(), plug); |
74 | MainLog.Instance.Verbose("Storage: Added IGridData Interface"); | 72 | MainLog.Instance.Verbose("Storage: Added IGridData Interface"); |
75 | } | 73 | } |
76 | 74 | ||
@@ -81,17 +79,18 @@ namespace OpenSim.Grid.GridServer | |||
81 | 79 | ||
82 | if (typeInterface != null) | 80 | if (typeInterface != null) |
83 | { | 81 | { |
84 | ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 82 | ILogData plug = |
83 | (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
85 | plug.Initialise(); | 84 | plug.Initialise(); |
86 | this._logplugins.Add(plug.getName(), plug); | 85 | _logplugins.Add(plug.getName(), plug); |
87 | MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); | 86 | MainLog.Instance.Verbose("Storage: Added ILogData Interface"); |
88 | } | 87 | } |
89 | 88 | ||
90 | typeInterface = null; | 89 | typeInterface = null; |
91 | } | 90 | } |
92 | } | 91 | } |
93 | 92 | ||
94 | pluginAssembly = null; | 93 | pluginAssembly = null; |
95 | } | 94 | } |
96 | 95 | ||
97 | /// <summary> | 96 | /// <summary> |
@@ -124,7 +123,8 @@ namespace OpenSim.Grid.GridServer | |||
124 | /// <returns>A SimProfileData for the region</returns> | 123 | /// <returns>A SimProfileData for the region</returns> |
125 | public RegionProfileData getRegion(LLUUID uuid) | 124 | public RegionProfileData getRegion(LLUUID uuid) |
126 | { | 125 | { |
127 | foreach(KeyValuePair<string,IGridData> kvp in _plugins) { | 126 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
127 | { | ||
128 | try | 128 | try |
129 | { | 129 | { |
130 | return kvp.Value.GetProfileByLLUUID(uuid); | 130 | return kvp.Value.GetProfileByLLUUID(uuid); |
@@ -182,7 +182,6 @@ namespace OpenSim.Grid.GridServer | |||
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | |||
186 | /// <summary> | 185 | /// <summary> |
187 | /// Returns a XML String containing a list of the neighbouring regions | 186 | /// Returns a XML String containing a list of the neighbouring regions |
188 | /// </summary> | 187 | /// </summary> |
@@ -193,11 +192,18 @@ namespace OpenSim.Grid.GridServer | |||
193 | string response = ""; | 192 | string response = ""; |
194 | RegionProfileData central_region = getRegion(reqhandle); | 193 | RegionProfileData central_region = getRegion(reqhandle); |
195 | RegionProfileData neighbour; | 194 | RegionProfileData neighbour; |
196 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | 195 | for (int x = -1; x < 2; x++) |
196 | for (int y = -1; y < 2; y++) | ||
197 | { | 197 | { |
198 | if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) | 198 | if ( |
199 | getRegion( | ||
200 | Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256), | ||
201 | (uint) (central_region.regionLocY + y)*256)) != null) | ||
199 | { | 202 | { |
200 | neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); | 203 | neighbour = |
204 | getRegion( | ||
205 | Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256), | ||
206 | (uint) (central_region.regionLocY + y)*256)); | ||
201 | response += "<neighbour>"; | 207 | response += "<neighbour>"; |
202 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; | 208 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; |
203 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; | 209 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; |
@@ -205,7 +211,6 @@ namespace OpenSim.Grid.GridServer | |||
205 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; | 211 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; |
206 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; | 212 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; |
207 | response += "</neighbour>"; | 213 | response += "</neighbour>"; |
208 | |||
209 | } | 214 | } |
210 | } | 215 | } |
211 | return response; | 216 | return response; |
@@ -218,23 +223,21 @@ namespace OpenSim.Grid.GridServer | |||
218 | /// <returns>Startup parameters</returns> | 223 | /// <returns>Startup parameters</returns> |
219 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) | 224 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) |
220 | { | 225 | { |
221 | |||
222 | XmlRpcResponse response = new XmlRpcResponse(); | 226 | XmlRpcResponse response = new XmlRpcResponse(); |
223 | Hashtable responseData = new Hashtable(); | 227 | Hashtable responseData = new Hashtable(); |
224 | response.Value = responseData; | 228 | response.Value = responseData; |
225 | 229 | ||
226 | RegionProfileData TheSim = null; | 230 | RegionProfileData TheSim = null; |
227 | Hashtable requestData = (Hashtable)request.Params[0]; | 231 | Hashtable requestData = (Hashtable) request.Params[0]; |
228 | string myword; | 232 | string myword; |
229 | if (requestData.ContainsKey("UUID")) | 233 | if (requestData.ContainsKey("UUID")) |
230 | { | 234 | { |
231 | TheSim = getRegion(new LLUUID((string)requestData["UUID"])); | 235 | TheSim = getRegion(new LLUUID((string) requestData["UUID"])); |
232 | 236 | ||
233 | // logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); | 237 | // logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); |
234 | } | 238 | } |
235 | else if (requestData.ContainsKey("region_handle")) | 239 | else if (requestData.ContainsKey("region_handle")) |
236 | { | 240 | { |
237 | |||
238 | // TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); | 241 | // TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); |
239 | // logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); | 242 | // logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); |
240 | } | 243 | } |
@@ -254,65 +257,68 @@ namespace OpenSim.Grid.GridServer | |||
254 | myword = "connection"; | 257 | myword = "connection"; |
255 | } | 258 | } |
256 | 259 | ||
257 | TheSim = new RegionProfileData(); | 260 | TheSim = new RegionProfileData(); |
258 | 261 | ||
259 | TheSim.regionRecvKey = config.SimRecvKey; | 262 | TheSim.regionRecvKey = config.SimRecvKey; |
260 | TheSim.regionSendKey = config.SimSendKey; | 263 | TheSim.regionSendKey = config.SimSendKey; |
261 | TheSim.regionSecret = config.SimRecvKey; | 264 | TheSim.regionSecret = config.SimRecvKey; |
262 | TheSim.regionDataURI = ""; | 265 | TheSim.regionDataURI = ""; |
263 | TheSim.regionAssetURI = config.DefaultAssetServer; | 266 | TheSim.regionAssetURI = config.DefaultAssetServer; |
264 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | 267 | TheSim.regionAssetRecvKey = config.AssetRecvKey; |
265 | TheSim.regionAssetSendKey = config.AssetSendKey; | 268 | TheSim.regionAssetSendKey = config.AssetSendKey; |
266 | TheSim.regionUserURI = config.DefaultUserServer; | 269 | TheSim.regionUserURI = config.DefaultUserServer; |
267 | TheSim.regionUserSendKey = config.UserSendKey; | 270 | TheSim.regionUserSendKey = config.UserSendKey; |
268 | TheSim.regionUserRecvKey = config.UserRecvKey; | 271 | TheSim.regionUserRecvKey = config.UserRecvKey; |
269 | |||
270 | TheSim.serverIP = (string)requestData["sim_ip"]; | ||
271 | TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); | ||
272 | TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); | ||
273 | TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); | ||
274 | TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); | ||
275 | TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); | ||
276 | TheSim.regionLocZ = 0; | ||
277 | TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); | ||
278 | |||
279 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | ||
280 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | ||
281 | System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.serverURI); | ||
282 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; | ||
283 | |||
284 | |||
285 | TheSim.regionName = (string)requestData["sim_name"]; | ||
286 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); | ||
287 | 272 | ||
288 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 273 | TheSim.serverIP = (string) requestData["sim_ip"]; |
274 | TheSim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]); | ||
275 | TheSim.httpPort = Convert.ToUInt32((string) requestData["http_port"]); | ||
276 | TheSim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]); | ||
277 | TheSim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]); | ||
278 | TheSim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]); | ||
279 | TheSim.regionLocZ = 0; | ||
280 | TheSim.regionMapTextureID = new LLUUID((string) requestData["map-image-id"]); | ||
281 | |||
282 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256)); | ||
283 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | ||
284 | Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + | ||
285 | TheSim.serverURI); | ||
286 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; | ||
287 | |||
288 | |||
289 | TheSim.regionName = (string) requestData["sim_name"]; | ||
290 | TheSim.UUID = new LLUUID((string) requestData["UUID"]); | ||
291 | |||
292 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
293 | { | ||
294 | try | ||
289 | { | 295 | { |
290 | try | 296 | DataResponse insertResponse = kvp.Value.AddProfile(TheSim); |
291 | { | 297 | switch (insertResponse) |
292 | DataResponse insertResponse = kvp.Value.AddProfile(TheSim); | ||
293 | switch(insertResponse) | ||
294 | { | ||
295 | case DataResponse.RESPONSE_OK: | ||
296 | OpenSim.Framework.Console.MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName); | ||
297 | break; | ||
298 | case DataResponse.RESPONSE_ERROR: | ||
299 | OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName); | ||
300 | break; | ||
301 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | ||
302 | OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Invalid Credentials): " + TheSim.regionName); | ||
303 | break; | ||
304 | case DataResponse.RESPONSE_AUTHREQUIRED: | ||
305 | OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Authentication Required): " + TheSim.regionName); | ||
306 | break; | ||
307 | } | ||
308 | |||
309 | } | ||
310 | catch (Exception e) | ||
311 | { | 298 | { |
312 | OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); | 299 | case DataResponse.RESPONSE_OK: |
313 | OpenSim.Framework.Console.MainLog.Instance.Warn("storage", e.ToString()); | 300 | MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName); |
301 | break; | ||
302 | case DataResponse.RESPONSE_ERROR: | ||
303 | MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName); | ||
304 | break; | ||
305 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | ||
306 | MainLog.Instance.Warn("storage", | ||
307 | "New sim creation failed (Invalid Credentials): " + TheSim.regionName); | ||
308 | break; | ||
309 | case DataResponse.RESPONSE_AUTHREQUIRED: | ||
310 | MainLog.Instance.Warn("storage", | ||
311 | "New sim creation failed (Authentication Required): " + | ||
312 | TheSim.regionName); | ||
313 | break; | ||
314 | } | 314 | } |
315 | 315 | } | |
316 | catch (Exception e) | ||
317 | { | ||
318 | MainLog.Instance.Warn("storage", | ||
319 | "Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); | ||
320 | MainLog.Instance.Warn("storage", e.ToString()); | ||
321 | } | ||
316 | 322 | ||
317 | 323 | ||
318 | if (getRegion(TheSim.regionHandle) == null) | 324 | if (getRegion(TheSim.regionHandle) == null) |
@@ -321,7 +327,7 @@ namespace OpenSim.Grid.GridServer | |||
321 | return response; | 327 | return response; |
322 | } | 328 | } |
323 | } | 329 | } |
324 | 330 | ||
325 | 331 | ||
326 | ArrayList SimNeighboursData = new ArrayList(); | 332 | ArrayList SimNeighboursData = new ArrayList(); |
327 | 333 | ||
@@ -332,7 +338,9 @@ namespace OpenSim.Grid.GridServer | |||
332 | 338 | ||
333 | if (fastMode) | 339 | if (fastMode) |
334 | { | 340 | { |
335 | Dictionary<ulong, RegionProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); | 341 | Dictionary<ulong, RegionProfileData> neighbours = |
342 | getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, | ||
343 | TheSim.regionLocY + 1); | ||
336 | 344 | ||
337 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) | 345 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) |
338 | { | 346 | { |
@@ -349,11 +357,18 @@ namespace OpenSim.Grid.GridServer | |||
349 | } | 357 | } |
350 | else | 358 | else |
351 | { | 359 | { |
352 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | 360 | for (int x = -1; x < 2; x++) |
361 | for (int y = -1; y < 2; y++) | ||
353 | { | 362 | { |
354 | if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) | 363 | if ( |
364 | getRegion( | ||
365 | Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256), | ||
366 | (uint) (TheSim.regionLocY + y)*256)) != null) | ||
355 | { | 367 | { |
356 | neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); | 368 | neighbour = |
369 | getRegion( | ||
370 | Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256), | ||
371 | (uint) (TheSim.regionLocY + y)*256)); | ||
357 | 372 | ||
358 | NeighbourBlock = new Hashtable(); | 373 | NeighbourBlock = new Hashtable(); |
359 | NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); | 374 | NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); |
@@ -386,24 +401,24 @@ namespace OpenSim.Grid.GridServer | |||
386 | 401 | ||
387 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) | 402 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) |
388 | responseData["data_uri"] = TheSim.regionDataURI; | 403 | responseData["data_uri"] = TheSim.regionDataURI; |
389 | |||
390 | 404 | ||
391 | return response; | 405 | |
406 | return response; | ||
392 | } | 407 | } |
393 | 408 | ||
394 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) | 409 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) |
395 | { | 410 | { |
396 | Hashtable requestData = (Hashtable)request.Params[0]; | 411 | Hashtable requestData = (Hashtable) request.Params[0]; |
397 | Hashtable responseData = new Hashtable(); | 412 | Hashtable responseData = new Hashtable(); |
398 | RegionProfileData simData = null; | 413 | RegionProfileData simData = null; |
399 | if (requestData.ContainsKey("region_UUID")) | 414 | if (requestData.ContainsKey("region_UUID")) |
400 | { | 415 | { |
401 | simData = getRegion(new LLUUID((string)requestData["region_UUID"])); | 416 | simData = getRegion(new LLUUID((string) requestData["region_UUID"])); |
402 | } | 417 | } |
403 | else if (requestData.ContainsKey("region_handle")) | 418 | else if (requestData.ContainsKey("region_handle")) |
404 | { | 419 | { |
405 | Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); | 420 | Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); |
406 | simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); | 421 | simData = getRegion(Convert.ToUInt64((string) requestData["region_handle"])); |
407 | } | 422 | } |
408 | 423 | ||
409 | if (simData == null) | 424 | if (simData == null) |
@@ -419,7 +434,7 @@ namespace OpenSim.Grid.GridServer | |||
419 | responseData["sim_port"] = simData.serverPort.ToString(); | 434 | responseData["sim_port"] = simData.serverPort.ToString(); |
420 | responseData["http_port"] = simData.httpPort.ToString(); | 435 | responseData["http_port"] = simData.httpPort.ToString(); |
421 | responseData["remoting_port"] = simData.remotingPort.ToString(); | 436 | responseData["remoting_port"] = simData.remotingPort.ToString(); |
422 | responseData["region_locx"] = simData.regionLocX.ToString() ; | 437 | responseData["region_locx"] = simData.regionLocX.ToString(); |
423 | responseData["region_locy"] = simData.regionLocY.ToString(); | 438 | responseData["region_locy"] = simData.regionLocY.ToString(); |
424 | responseData["region_UUID"] = simData.UUID.UUID.ToString(); | 439 | responseData["region_UUID"] = simData.UUID.UUID.ToString(); |
425 | responseData["region_name"] = simData.regionName; | 440 | responseData["region_name"] = simData.regionName; |
@@ -432,24 +447,24 @@ namespace OpenSim.Grid.GridServer | |||
432 | 447 | ||
433 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) | 448 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) |
434 | { | 449 | { |
435 | int xmin=980, ymin=980, xmax=1020, ymax=1020; | 450 | int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; |
436 | 451 | ||
437 | Hashtable requestData = (Hashtable)request.Params[0]; | 452 | Hashtable requestData = (Hashtable) request.Params[0]; |
438 | if (requestData.ContainsKey("xmin")) | 453 | if (requestData.ContainsKey("xmin")) |
439 | { | 454 | { |
440 | xmin = (Int32)requestData["xmin"]; | 455 | xmin = (Int32) requestData["xmin"]; |
441 | } | 456 | } |
442 | if (requestData.ContainsKey("ymin")) | 457 | if (requestData.ContainsKey("ymin")) |
443 | { | 458 | { |
444 | ymin = (Int32)requestData["ymin"]; | 459 | ymin = (Int32) requestData["ymin"]; |
445 | } | 460 | } |
446 | if (requestData.ContainsKey("xmax")) | 461 | if (requestData.ContainsKey("xmax")) |
447 | { | 462 | { |
448 | xmax = (Int32)requestData["xmax"]; | 463 | xmax = (Int32) requestData["xmax"]; |
449 | } | 464 | } |
450 | if (requestData.ContainsKey("ymax")) | 465 | if (requestData.ContainsKey("ymax")) |
451 | { | 466 | { |
452 | ymax = (Int32)requestData["ymax"]; | 467 | ymax = (Int32) requestData["ymax"]; |
453 | } | 468 | } |
454 | 469 | ||
455 | XmlRpcResponse response = new XmlRpcResponse(); | 470 | XmlRpcResponse response = new XmlRpcResponse(); |
@@ -461,14 +476,16 @@ namespace OpenSim.Grid.GridServer | |||
461 | 476 | ||
462 | if (fastMode) | 477 | if (fastMode) |
463 | { | 478 | { |
464 | Dictionary<ulong, RegionProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); | 479 | Dictionary<ulong, RegionProfileData> neighbours = |
480 | getRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax); | ||
465 | 481 | ||
466 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) | 482 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) |
467 | { | 483 | { |
468 | Hashtable simProfileBlock = new Hashtable(); | 484 | Hashtable simProfileBlock = new Hashtable(); |
469 | simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); | 485 | simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); |
470 | simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); | 486 | simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); |
471 | System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); | 487 | Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + |
488 | aSim.Value.regionLocY.ToString()); | ||
472 | simProfileBlock["name"] = aSim.Value.regionName; | 489 | simProfileBlock["name"] = aSim.Value.regionName; |
473 | simProfileBlock["access"] = 21; | 490 | simProfileBlock["access"] = 21; |
474 | simProfileBlock["region-flags"] = 512; | 491 | simProfileBlock["region-flags"] = 512; |
@@ -486,16 +503,17 @@ namespace OpenSim.Grid.GridServer | |||
486 | 503 | ||
487 | simProfileList.Add(simProfileBlock); | 504 | simProfileList.Add(simProfileBlock); |
488 | } | 505 | } |
489 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); | 506 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + |
507 | " region(s) in range via FastMode"); | ||
490 | } | 508 | } |
491 | else | 509 | else |
492 | { | 510 | { |
493 | RegionProfileData simProfile; | 511 | RegionProfileData simProfile; |
494 | for (int x = xmin; x < xmax+1; x++) | 512 | for (int x = xmin; x < xmax + 1; x++) |
495 | { | 513 | { |
496 | for (int y = ymin; y < ymax+1; y++) | 514 | for (int y = ymin; y < ymax + 1; y++) |
497 | { | 515 | { |
498 | ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); | 516 | ulong regHandle = Helpers.UIntsToLong((uint) (x*256), (uint) (y*256)); |
499 | simProfile = getRegion(regHandle); | 517 | simProfile = getRegion(regHandle); |
500 | if (simProfile != null) | 518 | if (simProfile != null) |
501 | { | 519 | { |
@@ -520,7 +538,8 @@ namespace OpenSim.Grid.GridServer | |||
520 | } | 538 | } |
521 | } | 539 | } |
522 | } | 540 | } |
523 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); | 541 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + |
542 | " region(s) in range via Standard Mode"); | ||
524 | } | 543 | } |
525 | 544 | ||
526 | responseData["sim-profiles"] = simProfileList; | 545 | responseData["sim-profiles"] = simProfileList; |
@@ -529,7 +548,6 @@ namespace OpenSim.Grid.GridServer | |||
529 | } | 548 | } |
530 | 549 | ||
531 | 550 | ||
532 | |||
533 | /// <summary> | 551 | /// <summary> |
534 | /// Performs a REST Get Operation | 552 | /// Performs a REST Get Operation |
535 | /// </summary> | 553 | /// </summary> |
@@ -654,13 +672,13 @@ namespace OpenSim.Grid.GridServer | |||
654 | break; | 672 | break; |
655 | 673 | ||
656 | case "region_locx": | 674 | case "region_locx": |
657 | TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 675 | TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText); |
658 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | 676 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256)); |
659 | break; | 677 | break; |
660 | 678 | ||
661 | case "region_locy": | 679 | case "region_locy": |
662 | TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 680 | TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText); |
663 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | 681 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256)); |
664 | break; | 682 | break; |
665 | } | 683 | } |
666 | } | 684 | } |
@@ -670,7 +688,10 @@ namespace OpenSim.Grid.GridServer | |||
670 | bool requirePublic = false; | 688 | bool requirePublic = false; |
671 | bool requireValid = true; | 689 | bool requireValid = true; |
672 | 690 | ||
673 | if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) | 691 | if (requirePublic && |
692 | (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || | ||
693 | TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || | ||
694 | TheSim.serverIP.StartsWith("255."))) | ||
674 | { | 695 | { |
675 | return "ERROR! Servers must register with public addresses."; | 696 | return "ERROR! Servers must register with public addresses."; |
676 | } | 697 | } |
@@ -680,7 +701,7 @@ namespace OpenSim.Grid.GridServer | |||
680 | return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; | 701 | return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; |
681 | } | 702 | } |
682 | 703 | ||
683 | 704 | ||
684 | try | 705 | try |
685 | { | 706 | { |
686 | MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); | 707 | MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); |
@@ -689,22 +710,28 @@ namespace OpenSim.Grid.GridServer | |||
689 | try | 710 | try |
690 | { | 711 | { |
691 | //Check reservations | 712 | //Check reservations |
692 | ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); | 713 | ReservationData reserveData = |
693 | if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) | 714 | kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); |
715 | if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || | ||
716 | (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) | ||
694 | { | 717 | { |
695 | kvp.Value.AddProfile(TheSim); | 718 | kvp.Value.AddProfile(TheSim); |
696 | MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); | 719 | MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); |
697 | logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); | 720 | logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, |
721 | "Region successfully updated and connected to grid."); | ||
698 | } | 722 | } |
699 | else | 723 | else |
700 | { | 724 | { |
701 | MainLog.Instance.Warn("grid", "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); | 725 | MainLog.Instance.Warn("grid", |
726 | "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); | ||
727 | // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); | ||
702 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; | 728 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; |
703 | } | 729 | } |
704 | } | 730 | } |
705 | catch (Exception e) | 731 | catch (Exception e) |
706 | { | 732 | { |
707 | MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); | 733 | MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + |
734 | e.ToString()); | ||
708 | } | 735 | } |
709 | } | 736 | } |
710 | return "OK"; | 737 | return "OK"; |
@@ -714,6 +741,5 @@ namespace OpenSim.Grid.GridServer | |||
714 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; | 741 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; |
715 | } | 742 | } |
716 | } | 743 | } |
717 | |||
718 | } | 744 | } |
719 | } | 745 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index ae1e244..9b1892d 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -28,16 +28,10 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | 31 | using System.Timers; |
32 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework; | ||
39 | |||
40 | using Timer=System.Timers.Timer; | ||
41 | 35 | ||
42 | namespace OpenSim.Grid.GridServer | 36 | namespace OpenSim.Grid.GridServer |
43 | { | 37 | { |
@@ -90,10 +84,9 @@ namespace OpenSim.Grid.GridServer | |||
90 | { | 84 | { |
91 | Directory.CreateDirectory(Util.logDir()); | 85 | Directory.CreateDirectory(Util.logDir()); |
92 | } | 86 | } |
93 | m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-gridserver-console.log")), "OpenGrid", this, true); | 87 | m_console = |
88 | new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true); | ||
94 | MainLog.Instance = m_console; | 89 | MainLog.Instance = m_console; |
95 | |||
96 | |||
97 | } | 90 | } |
98 | 91 | ||
99 | public void managercallback(string cmd) | 92 | public void managercallback(string cmd) |
@@ -109,28 +102,28 @@ namespace OpenSim.Grid.GridServer | |||
109 | 102 | ||
110 | public void Startup() | 103 | public void Startup() |
111 | { | 104 | { |
112 | 105 | Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); | |
113 | this.Cfg = new GridConfig("GRID SERVER",(Path.Combine(Util.configDir(),"GridServer_Config.xml"))); //Yeah srsly, that's it. | 106 | //Yeah srsly, that's it. |
114 | if (setuponly) Environment.Exit(0); | 107 | if (setuponly) Environment.Exit(0); |
115 | 108 | ||
116 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); | 109 | m_console.Verbose("Main.cs:Startup() - Connecting to Storage Server"); |
117 | m_gridManager = new GridManager(); | 110 | m_gridManager = new GridManager(); |
118 | m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win | 111 | m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win |
119 | m_gridManager.config = Cfg; | 112 | m_gridManager.config = Cfg; |
120 | 113 | ||
121 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); | 114 | m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); |
122 | BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); | 115 | BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort); |
123 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); | 116 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); |
124 | 117 | ||
125 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 118 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); |
126 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | 119 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); |
127 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | 120 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); |
128 | 121 | ||
129 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); | 122 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod)); |
130 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); | 123 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod)); |
131 | 124 | ||
132 | httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); | 125 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod)); |
133 | httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); | 126 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod)); |
134 | 127 | ||
135 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); | 128 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); |
136 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | 129 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); |
@@ -139,9 +132,9 @@ namespace OpenSim.Grid.GridServer | |||
139 | 132 | ||
140 | httpServer.Start(); | 133 | httpServer.Start(); |
141 | 134 | ||
142 | m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); | 135 | m_console.Verbose("Main.cs:Startup() - Starting sim status checker"); |
143 | 136 | ||
144 | Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. | 137 | Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. |
145 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | 138 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); |
146 | simCheckTimer.Enabled = true; | 139 | simCheckTimer.Enabled = true; |
147 | } | 140 | } |
@@ -225,4 +218,4 @@ namespace OpenSim.Grid.GridServer | |||
225 | } | 218 | } |
226 | }*/ | 219 | }*/ |
227 | } | 220 | } |
228 | } | 221 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs index 5059199..d46be9e 100644 --- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | |||
@@ -1,4 +1,4 @@ | |||
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 | * |
@@ -27,25 +27,29 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // General Information about an assembly is controlled through the following | 31 | // General Information about an assembly is controlled through the following |
31 | // set of attributes. Change these attribute values to modify the information | 32 | // set of attributes. Change these attribute values to modify the information |
32 | // associated with an assembly. | 33 | // associated with an assembly. |
33 | [assembly: AssemblyTitle("OGS-GridServer")] | 34 | |
34 | [assembly: AssemblyDescription("")] | 35 | [assembly : AssemblyTitle("OGS-GridServer")] |
35 | [assembly: AssemblyConfiguration("")] | 36 | [assembly : AssemblyDescription("")] |
36 | [assembly: AssemblyCompany("")] | 37 | [assembly : AssemblyConfiguration("")] |
37 | [assembly: AssemblyProduct("OGS-GridServer")] | 38 | [assembly : AssemblyCompany("")] |
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | 39 | [assembly : AssemblyProduct("OGS-GridServer")] |
39 | [assembly: AssemblyTrademark("")] | 40 | [assembly : AssemblyCopyright("Copyright © 2007")] |
40 | [assembly: AssemblyCulture("")] | 41 | [assembly : AssemblyTrademark("")] |
42 | [assembly : AssemblyCulture("")] | ||
41 | 43 | ||
42 | // Setting ComVisible to false makes the types in this assembly not visible | 44 | // Setting ComVisible to false makes the types in this assembly not visible |
43 | // to COM components. If you need to access a type in this assembly from | 45 | // to COM components. If you need to access a type in this assembly from |
44 | // COM, set the ComVisible attribute to true on that type. | 46 | // COM, set the ComVisible attribute to true on that type. |
45 | [assembly: ComVisible(false)] | 47 | |
48 | [assembly : ComVisible(false)] | ||
46 | 49 | ||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 50 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | 51 | |
52 | [assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | ||
49 | 53 | ||
50 | // Version information for an assembly consists of the following four values: | 54 | // Version information for an assembly consists of the following four values: |
51 | // | 55 | // |
@@ -54,5 +58,6 @@ using System.Runtime.InteropServices; | |||
54 | // Build Number | 58 | // Build Number |
55 | // Revision | 59 | // Revision |
56 | // | 60 | // |
57 | [assembly: AssemblyVersion("1.0.0.0")] | 61 | |
58 | [assembly: AssemblyFileVersion("1.0.0.0")] | 62 | [assembly : AssemblyVersion("1.0.0.0")] |
63 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/ScriptEngine/Common/Executor.cs b/OpenSim/Grid/ScriptEngine/Common/Executor.cs index 0732cbc..495c267 100644 --- a/OpenSim/Grid/ScriptEngine/Common/Executor.cs +++ b/OpenSim/Grid/ScriptEngine/Common/Executor.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
34 | 33 | ||
@@ -53,7 +52,7 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
53 | { | 52 | { |
54 | //Console.WriteLine("Executor: InitializeLifetimeService()"); | 53 | //Console.WriteLine("Executor: InitializeLifetimeService()"); |
55 | // return null; | 54 | // return null; |
56 | ILease lease = (ILease)base.InitializeLifetimeService(); | 55 | ILease lease = (ILease) base.InitializeLifetimeService(); |
57 | 56 | ||
58 | if (lease.CurrentState == LeaseState.Initial) | 57 | if (lease.CurrentState == LeaseState.Initial) |
59 | { | 58 | { |
@@ -75,56 +74,56 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
75 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 74 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
76 | //try | 75 | //try |
77 | //{ | 76 | //{ |
78 | if (m_Running == false) | 77 | if (m_Running == false) |
79 | { | 78 | { |
80 | // Script is inactive, do not execute! | 79 | // Script is inactive, do not execute! |
81 | return; | 80 | return; |
82 | } | 81 | } |
83 | 82 | ||
84 | string EventName = m_Script.State() + "_event_" + FunctionName; | 83 | string EventName = m_Script.State() + "_event_" + FunctionName; |
85 | 84 | ||
86 | //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); | 85 | //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); |
87 | 86 | ||
88 | //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); | 87 | //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); |
89 | 88 | ||
90 | if (Events.ContainsKey(EventName) == false) | 89 | if (Events.ContainsKey(EventName) == false) |
90 | { | ||
91 | // Not found, create | ||
92 | Type type = m_Script.GetType(); | ||
93 | try | ||
91 | { | 94 | { |
92 | // Not found, create | 95 | MethodInfo mi = type.GetMethod(EventName); |
93 | Type type = m_Script.GetType(); | 96 | Events.Add(EventName, mi); |
94 | try | ||
95 | { | ||
96 | MethodInfo mi = type.GetMethod(EventName); | ||
97 | Events.Add(EventName, mi); | ||
98 | } | ||
99 | catch | ||
100 | { | ||
101 | // Event name not found, cache it as not found | ||
102 | Events.Add(EventName, null); | ||
103 | } | ||
104 | } | 97 | } |
105 | 98 | catch | |
106 | // Get event | ||
107 | MethodInfo ev = null; | ||
108 | Events.TryGetValue(EventName, out ev); | ||
109 | |||
110 | if (ev == null) // No event by that name! | ||
111 | { | 99 | { |
112 | //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); | 100 | // Event name not found, cache it as not found |
113 | return; | 101 | Events.Add(EventName, null); |
114 | } | 102 | } |
103 | } | ||
104 | |||
105 | // Get event | ||
106 | MethodInfo ev = null; | ||
107 | Events.TryGetValue(EventName, out ev); | ||
108 | |||
109 | if (ev == null) // No event by that name! | ||
110 | { | ||
111 | //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); | ||
112 | return; | ||
113 | } | ||
115 | 114 | ||
116 | // Found | 115 | // Found |
117 | //try | 116 | //try |
118 | //{ | 117 | //{ |
119 | // Invoke it | 118 | // Invoke it |
120 | ev.Invoke(m_Script, args); | 119 | ev.Invoke(m_Script, args); |
121 | 120 | ||
122 | //} | 121 | //} |
123 | //catch (Exception e) | 122 | //catch (Exception e) |
124 | //{ | 123 | //{ |
125 | // // TODO: Send to correct place | 124 | // // TODO: Send to correct place |
126 | // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); | 125 | // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); |
127 | //} | 126 | //} |
128 | 127 | ||
129 | 128 | ||
130 | //} | 129 | //} |
@@ -136,8 +135,5 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
136 | { | 135 | { |
137 | m_Running = false; | 136 | m_Running = false; |
138 | } | 137 | } |
139 | |||
140 | |||
141 | } | 138 | } |
142 | 139 | } \ No newline at end of file | |
143 | } | ||
diff --git a/OpenSim/Grid/ScriptEngine/Common/IScript.cs b/OpenSim/Grid/ScriptEngine/Common/IScript.cs index 7d51c50..eb8205b 100644 --- a/OpenSim/Grid/ScriptEngine/Common/IScript.cs +++ b/OpenSim/Grid/ScriptEngine/Common/IScript.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Grid.ScriptEngine.Common | 29 | namespace OpenSim.Grid.ScriptEngine.Common |
34 | { | 30 | { |
35 | public interface IScript | 31 | public interface IScript |
@@ -37,4 +33,4 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
37 | string State(); | 33 | string State(); |
38 | Executor Exec { get; } | 34 | Executor Exec { get; } |
39 | } | 35 | } |
40 | } | 36 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 7bd6f43..9630d6e 100644 --- a/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -26,15 +26,12 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Grid.ScriptEngine.Common | 31 | namespace OpenSim.Grid.ScriptEngine.Common |
34 | { | 32 | { |
35 | public interface LSL_BuiltIn_Commands_Interface | 33 | public interface LSL_BuiltIn_Commands_Interface |
36 | { | 34 | { |
37 | |||
38 | string State(); | 35 | string State(); |
39 | 36 | ||
40 | double llSin(double f); | 37 | double llSin(double f); |
@@ -404,7 +401,9 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
404 | //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) | 401 | //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) |
405 | void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); | 402 | void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); |
406 | //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) | 403 | //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) |
407 | void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west); | 404 | void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, |
405 | LSL_Types.Vector3 bottom_south_west); | ||
406 | |||
408 | //wiki: llEjectFromLand(key pest) | 407 | //wiki: llEjectFromLand(key pest) |
409 | void llEjectFromLand(string pest); | 408 | void llEjectFromLand(string pest); |
410 | void llParseString2List(); | 409 | void llParseString2List(); |
@@ -437,7 +436,7 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
437 | //wiki: double llGetRegionFPS() | 436 | //wiki: double llGetRegionFPS() |
438 | double llGetRegionFPS(); | 437 | double llGetRegionFPS(); |
439 | //wiki: llParticleSystem(List<Object> rules | 438 | //wiki: llParticleSystem(List<Object> rules |
440 | void llParticleSystem(List<Object> rules); | 439 | void llParticleSystem(List<object> rules); |
441 | //wiki: llGroundRepel(double height, integer water, double tau) | 440 | //wiki: llGroundRepel(double height, integer water, double tau) |
442 | void llGroundRepel(double height, int water, double tau); | 441 | void llGroundRepel(double height, int water, double tau); |
443 | void llGiveInventoryList(); | 442 | void llGiveInventoryList(); |
@@ -548,7 +547,9 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
548 | //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) | 547 | //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) |
549 | List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); | 548 | List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); |
550 | //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) | 549 | //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) |
551 | void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param); | 550 | void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, |
551 | LSL_Types.Quaternion rot, int param); | ||
552 | |||
552 | //wiki: integer llGetObjectPermMask(integer mask) | 553 | //wiki: integer llGetObjectPermMask(integer mask) |
553 | int llGetObjectPermMask(int mask); | 554 | int llGetObjectPermMask(int mask); |
554 | //wiki: llSetObjectPermMask(integer mask, integer value) | 555 | //wiki: llSetObjectPermMask(integer mask, integer value) |
@@ -632,4 +633,4 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
632 | //OpenSim functions | 633 | //OpenSim functions |
633 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | 634 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); |
634 | } | 635 | } |
635 | } | 636 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs index 02f9e9a..d10a5ef 100644 --- a/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs | |||
@@ -41,11 +41,12 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
41 | public double Z; | 41 | public double Z; |
42 | 42 | ||
43 | public Vector3(Vector3 vector) | 43 | public Vector3(Vector3 vector) |
44 | { | 44 | { |
45 | X = (float)vector.X; | 45 | X = (float) vector.X; |
46 | Y = (float)vector.Y; | 46 | Y = (float) vector.Y; |
47 | Z = (float)vector.Z; | 47 | Z = (float) vector.Z; |
48 | } | 48 | } |
49 | |||
49 | public Vector3(double x, double y, double z) | 50 | public Vector3(double x, double y, double z) |
50 | { | 51 | { |
51 | X = x; | 52 | X = x; |
@@ -53,6 +54,7 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
53 | Z = z; | 54 | Z = z; |
54 | } | 55 | } |
55 | } | 56 | } |
57 | |||
56 | [Serializable] | 58 | [Serializable] |
57 | public struct Quaternion | 59 | public struct Quaternion |
58 | { | 60 | { |
@@ -62,12 +64,13 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
62 | public double R; | 64 | public double R; |
63 | 65 | ||
64 | public Quaternion(Quaternion Quat) | 66 | public Quaternion(Quaternion Quat) |
65 | { | 67 | { |
66 | X = (float)Quat.X; | 68 | X = (float) Quat.X; |
67 | Y = (float)Quat.Y; | 69 | Y = (float) Quat.Y; |
68 | Z = (float)Quat.Z; | 70 | Z = (float) Quat.Z; |
69 | R = (float)Quat.R; | 71 | R = (float) Quat.R; |
70 | } | 72 | } |
73 | |||
71 | public Quaternion(double x, double y, double z, double r) | 74 | public Quaternion(double x, double y, double z, double r) |
72 | { | 75 | { |
73 | X = x; | 76 | X = x; |
@@ -75,7 +78,6 @@ namespace OpenSim.Grid.ScriptEngine.Common | |||
75 | Z = z; | 78 | Z = z; |
76 | R = r; | 79 | R = r; |
77 | } | 80 | } |
78 | |||
79 | } | 81 | } |
80 | } | 82 | } |
81 | } | 83 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs index 44a4f29..1d5911b 100644 --- a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Grid.ScriptEngine.Common")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Grid.ScriptEngine.Common")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.Common")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Grid.ScriptEngine.Common")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
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 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] | 24 | |
25 | [assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 31 | // Build Number |
30 | // Revision | 32 | // Revision |
31 | // | 33 | // |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs index e5478ae..e6c1678 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs | |||
@@ -27,27 +27,22 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | ||
34 | using System.Runtime.Remoting; | ||
35 | using System.IO; | ||
36 | using OpenSim.Region.Environment.Scenes; | ||
37 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
38 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; | 33 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; |
39 | using OpenSim.Region.ScriptEngine.Common; | ||
40 | using libsecondlife; | ||
41 | 34 | ||
42 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 35 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
43 | { | 36 | { |
44 | public class AppDomainManager | 37 | public class AppDomainManager |
45 | { | 38 | { |
46 | private int maxScriptsPerAppDomain = 1; | 39 | private int maxScriptsPerAppDomain = 1; |
40 | |||
47 | /// <summary> | 41 | /// <summary> |
48 | /// Internal list of all AppDomains | 42 | /// Internal list of all AppDomains |
49 | /// </summary> | 43 | /// </summary> |
50 | private List<AppDomainStructure> appDomains = new List<AppDomainStructure>(); | 44 | private List<AppDomainStructure> appDomains = new List<AppDomainStructure>(); |
45 | |||
51 | /// <summary> | 46 | /// <summary> |
52 | /// Structure to keep track of data around AppDomain | 47 | /// Structure to keep track of data around AppDomain |
53 | /// </summary> | 48 | /// </summary> |
@@ -57,19 +52,23 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
57 | /// The AppDomain itself | 52 | /// The AppDomain itself |
58 | /// </summary> | 53 | /// </summary> |
59 | public AppDomain CurrentAppDomain; | 54 | public AppDomain CurrentAppDomain; |
55 | |||
60 | /// <summary> | 56 | /// <summary> |
61 | /// Number of scripts loaded into AppDomain | 57 | /// Number of scripts loaded into AppDomain |
62 | /// </summary> | 58 | /// </summary> |
63 | public int ScriptsLoaded; | 59 | public int ScriptsLoaded; |
60 | |||
64 | /// <summary> | 61 | /// <summary> |
65 | /// Number of dead scripts | 62 | /// Number of dead scripts |
66 | /// </summary> | 63 | /// </summary> |
67 | public int ScriptsWaitingUnload; | 64 | public int ScriptsWaitingUnload; |
68 | } | 65 | } |
66 | |||
69 | /// <summary> | 67 | /// <summary> |
70 | /// Current AppDomain | 68 | /// Current AppDomain |
71 | /// </summary> | 69 | /// </summary> |
72 | private AppDomainStructure currentAD; | 70 | private AppDomainStructure currentAD; |
71 | |||
73 | private object getLock = new object(); // Mutex | 72 | private object getLock = new object(); // Mutex |
74 | private object freeLock = new object(); // Mutex | 73 | private object freeLock = new object(); // Mutex |
75 | 74 | ||
@@ -94,22 +93,23 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
94 | { | 93 | { |
95 | // Add it to AppDomains list and empty current | 94 | // Add it to AppDomains list and empty current |
96 | appDomains.Add(currentAD); | 95 | appDomains.Add(currentAD); |
97 | currentAD = null; | 96 | currentAD = null; |
98 | } | 97 | } |
99 | // No current | 98 | // No current |
100 | if (currentAD == null) | 99 | if (currentAD == null) |
101 | { | 100 | { |
102 | // Create a new current AppDomain | 101 | // Create a new current AppDomain |
103 | currentAD = new AppDomainStructure(); | 102 | currentAD = new AppDomainStructure(); |
104 | currentAD.CurrentAppDomain = PrepareNewAppDomain(); | 103 | currentAD.CurrentAppDomain = PrepareNewAppDomain(); |
105 | } | 104 | } |
106 | 105 | ||
107 | Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); | 106 | Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); |
108 | return currentAD; | 107 | return currentAD; |
109 | } // lock | 108 | } // lock |
110 | } | 109 | } |
111 | 110 | ||
112 | private int AppDomainNameCount; | 111 | private int AppDomainNameCount; |
112 | |||
113 | /// <summary> | 113 | /// <summary> |
114 | /// Create and prepare a new AppDomain for scripts | 114 | /// Create and prepare a new AppDomain for scripts |
115 | /// </summary> | 115 | /// </summary> |
@@ -130,12 +130,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
130 | ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; | 130 | ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; |
131 | 131 | ||
132 | AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); | 132 | AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); |
133 | Console.WriteLine("Loading: " + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); | 133 | Console.WriteLine("Loading: " + |
134 | AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); | ||
134 | AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); | 135 | AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); |
135 | 136 | ||
136 | // Return the new AppDomain | 137 | // Return the new AppDomain |
137 | return AD; | 138 | return AD; |
138 | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
@@ -146,7 +146,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
146 | lock (freeLock) | 146 | lock (freeLock) |
147 | { | 147 | { |
148 | // Go through all | 148 | // Go through all |
149 | foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) | 149 | foreach (AppDomainStructure ads in new ArrayList(appDomains)) |
150 | { | 150 | { |
151 | // Don't process current AppDomain | 151 | // Don't process current AppDomain |
152 | if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) | 152 | if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) |
@@ -164,23 +164,25 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
164 | // Unload | 164 | // Unload |
165 | AppDomain.Unload(ads.CurrentAppDomain); | 165 | AppDomain.Unload(ads.CurrentAppDomain); |
166 | #if DEBUG | 166 | #if DEBUG |
167 | Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); | 167 | Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + |
168 | " bytes of memory"); | ||
168 | #endif | 169 | #endif |
169 | } | 170 | } |
170 | } | 171 | } |
171 | } // foreach | 172 | } // foreach |
172 | } // lock | 173 | } // lock |
173 | } | 174 | } |
174 | |||
175 | 175 | ||
176 | 176 | ||
177 | public OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadScript(string FileName) | 177 | public LSL_BaseClass LoadScript(string FileName) |
178 | { | 178 | { |
179 | // Find next available AppDomain to put it in | 179 | // Find next available AppDomain to put it in |
180 | AppDomainStructure FreeAppDomain = GetFreeAppDomain(); | 180 | AppDomainStructure FreeAppDomain = GetFreeAppDomain(); |
181 | 181 | ||
182 | Console.WriteLine("Loading into AppDomain: " + FileName); | 182 | Console.WriteLine("Loading into AppDomain: " + FileName); |
183 | LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); | 183 | LSL_BaseClass mbrt = |
184 | (LSL_BaseClass) | ||
185 | FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); | ||
184 | //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); | 186 | //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); |
185 | FreeAppDomain.ScriptsLoaded++; | 187 | FreeAppDomain.ScriptsLoaded++; |
186 | 188 | ||
@@ -207,7 +209,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
207 | } | 209 | } |
208 | 210 | ||
209 | // Lopp through all AppDomains | 211 | // Lopp through all AppDomains |
210 | foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) | 212 | foreach (AppDomainStructure ads in new ArrayList(appDomains)) |
211 | { | 213 | { |
212 | if (ads.CurrentAppDomain == ad) | 214 | if (ads.CurrentAppDomain == ad) |
213 | { | 215 | { |
@@ -219,10 +221,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
219 | } // lock | 221 | } // lock |
220 | 222 | ||
221 | UnloadAppDomains(); // Outsite lock, has its own GetLock | 223 | UnloadAppDomains(); // Outsite lock, has its own GetLock |
222 | |||
223 | |||
224 | } | 224 | } |
225 | |||
226 | |||
227 | } | 225 | } |
228 | } | 226 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs index af5c675..3ded7bf 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs | |||
@@ -26,34 +26,30 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 29 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
34 | { | 30 | { |
35 | public static class Common | 31 | public static class Common |
36 | { | 32 | { |
37 | static public bool debug = true; | 33 | public static bool debug = true; |
38 | static public ScriptEngine mySE; | 34 | public static ScriptEngine mySE; |
39 | 35 | ||
40 | //public delegate void SendToDebugEventDelegate(string Message); | 36 | //public delegate void SendToDebugEventDelegate(string Message); |
41 | //public delegate void SendToLogEventDelegate(string Message); | 37 | //public delegate void SendToLogEventDelegate(string Message); |
42 | //static public event SendToDebugEventDelegate SendToDebugEvent; | 38 | //static public event SendToDebugEventDelegate SendToDebugEvent; |
43 | //static public event SendToLogEventDelegate SendToLogEvent; | 39 | //static public event SendToLogEventDelegate SendToLogEvent; |
44 | 40 | ||
45 | static public void SendToDebug(string Message) | 41 | public static void SendToDebug(string Message) |
46 | { | 42 | { |
47 | //if (Debug == true) | 43 | //if (Debug == true) |
48 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); | 44 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); |
49 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 45 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
50 | } | 46 | } |
51 | static public void SendToLog(string Message) | 47 | |
48 | public static void SendToLog(string Message) | ||
52 | { | 49 | { |
53 | //if (Debug == true) | 50 | //if (Debug == true) |
54 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); | 51 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); |
55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 52 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
56 | } | 53 | } |
57 | } | 54 | } |
58 | 55 | } \ No newline at end of file | |
59 | } | ||
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index bb3d12a..4be8a0b 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -27,16 +27,13 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using Microsoft.CSharp; | ||
34 | using System.CodeDom.Compiler; | 30 | using System.CodeDom.Compiler; |
31 | using System.IO; | ||
35 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Microsoft.CSharp; | ||
36 | 34 | ||
37 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | 35 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL |
38 | { | 36 | { |
39 | |||
40 | public class Compiler | 37 | public class Compiler |
41 | { | 38 | { |
42 | private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); | 39 | private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); |
@@ -45,7 +42,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
45 | //private ICodeCompiler icc = codeProvider.CreateCompiler(); | 42 | //private ICodeCompiler icc = codeProvider.CreateCompiler(); |
46 | public string CompileFromFile(string LSOFileName) | 43 | public string CompileFromFile(string LSOFileName) |
47 | { | 44 | { |
48 | switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) | 45 | switch (Path.GetExtension(LSOFileName).ToLower()) |
49 | { | 46 | { |
50 | case ".txt": | 47 | case ".txt": |
51 | case ".lsl": | 48 | case ".lsl": |
@@ -58,6 +55,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
58 | throw new Exception("Unknown script type."); | 55 | throw new Exception("Unknown script type."); |
59 | } | 56 | } |
60 | } | 57 | } |
58 | |||
61 | /// <summary> | 59 | /// <summary> |
62 | /// Converts script from LSL to CS and calls CompileFromCSText | 60 | /// Converts script from LSL to CS and calls CompileFromCSText |
63 | /// </summary> | 61 | /// </summary> |
@@ -67,13 +65,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
67 | { | 65 | { |
68 | if (Script.Substring(0, 4).ToLower() == "//c#") | 66 | if (Script.Substring(0, 4).ToLower() == "//c#") |
69 | { | 67 | { |
70 | return CompileFromCSText( Script ); | 68 | return CompileFromCSText(Script); |
71 | } | 69 | } |
72 | else | 70 | else |
73 | { | 71 | { |
74 | return CompileFromCSText(LSL_Converter.Convert(Script)); | 72 | return CompileFromCSText(LSL_Converter.Convert(Script)); |
75 | } | 73 | } |
76 | } | 74 | } |
75 | |||
77 | /// <summary> | 76 | /// <summary> |
78 | /// Compile CS script to .Net assembly (.dll) | 77 | /// Compile CS script to .Net assembly (.dll) |
79 | /// </summary> | 78 | /// </summary> |
@@ -81,14 +80,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
81 | /// <returns>Filename to .dll assembly</returns> | 80 | /// <returns>Filename to .dll assembly</returns> |
82 | public string CompileFromCSText(string Script) | 81 | public string CompileFromCSText(string Script) |
83 | { | 82 | { |
84 | |||
85 | |||
86 | // Output assembly name | 83 | // Output assembly name |
87 | scriptCompileCounter++; | 84 | scriptCompileCounter++; |
88 | string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); | 85 | string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); |
89 | try | 86 | try |
90 | { | 87 | { |
91 | System.IO.File.Delete(OutFile); | 88 | File.Delete(OutFile); |
92 | } | 89 | } |
93 | catch (Exception e) | 90 | catch (Exception e) |
94 | { | 91 | { |
@@ -99,12 +96,15 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
99 | // DEBUG - write source to disk | 96 | // DEBUG - write source to disk |
100 | try | 97 | try |
101 | { | 98 | { |
102 | File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); | 99 | File.WriteAllText( |
100 | Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); | ||
101 | } | ||
102 | catch | ||
103 | { | ||
103 | } | 104 | } |
104 | catch { } | ||
105 | 105 | ||
106 | // Do actual compile | 106 | // Do actual compile |
107 | System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); | 107 | CompilerParameters parameters = new CompilerParameters(); |
108 | parameters.IncludeDebugInformation = true; | 108 | parameters.IncludeDebugInformation = true; |
109 | // Add all available assemblies | 109 | // Add all available assemblies |
110 | foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) | 110 | foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) |
@@ -114,11 +114,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
114 | } | 114 | } |
115 | 115 | ||
116 | string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | 116 | string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); |
117 | string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); | 117 | string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); |
118 | //Console.WriteLine("Assembly location: " + rootPath); | 118 | //Console.WriteLine("Assembly location: " + rootPath); |
119 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); | 119 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); |
120 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Grid.ScriptEngine.DotNetEngine.dll")); | 120 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Grid.ScriptEngine.DotNetEngine.dll")); |
121 | 121 | ||
122 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); | 122 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); |
123 | parameters.GenerateExecutable = false; | 123 | parameters.GenerateExecutable = false; |
124 | parameters.OutputAssembly = OutFile; | 124 | parameters.OutputAssembly = OutFile; |
@@ -129,13 +129,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
129 | // TODO: Return errors to user somehow | 129 | // TODO: Return errors to user somehow |
130 | if (results.Errors.Count > 0) | 130 | if (results.Errors.Count > 0) |
131 | { | 131 | { |
132 | |||
133 | string errtext = ""; | 132 | string errtext = ""; |
134 | foreach (CompilerError CompErr in results.Errors) | 133 | foreach (CompilerError CompErr in results.Errors) |
135 | { | 134 | { |
136 | errtext += "Line number " + (CompErr.Line - 1) + | 135 | errtext += "Line number " + (CompErr.Line - 1) + |
137 | ", Error Number: " + CompErr.ErrorNumber + | 136 | ", Error Number: " + CompErr.ErrorNumber + |
138 | ", '" + CompErr.ErrorText + "'\r\n"; | 137 | ", '" + CompErr.ErrorText + "'\r\n"; |
139 | } | 138 | } |
140 | throw new Exception(errtext); | 139 | throw new Exception(errtext); |
141 | } | 140 | } |
@@ -143,6 +142,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
143 | 142 | ||
144 | return OutFile; | 143 | return OutFile; |
145 | } | 144 | } |
146 | |||
147 | } | 145 | } |
148 | } | 146 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 32188d2..9046db3 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -26,9 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | 30 | using System.Text.RegularExpressions; |
33 | 31 | ||
34 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | 32 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL |
@@ -51,9 +49,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
51 | dataTypes.Add("rotation", "LSL_Types.Quaternion"); | 49 | dataTypes.Add("rotation", "LSL_Types.Quaternion"); |
52 | dataTypes.Add("list", "list"); | 50 | dataTypes.Add("list", "list"); |
53 | dataTypes.Add("null", "null"); | 51 | dataTypes.Add("null", "null"); |
54 | |||
55 | } | 52 | } |
56 | 53 | ||
57 | public string Convert(string Script) | 54 | public string Convert(string Script) |
58 | { | 55 | { |
59 | string Return = ""; | 56 | string Return = ""; |
@@ -81,7 +78,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
81 | int quote_replaced_count = 0; | 78 | int quote_replaced_count = 0; |
82 | for (int p = 0; p < Script.Length; p++) | 79 | for (int p = 0; p < Script.Length; p++) |
83 | { | 80 | { |
84 | |||
85 | C = Script.Substring(p, 1); | 81 | C = Script.Substring(p, 1); |
86 | while (true) | 82 | while (true) |
87 | { | 83 | { |
@@ -99,10 +95,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
99 | if (quote == "") | 95 | if (quote == "") |
100 | { | 96 | { |
101 | // We didn't replace quote, probably because of empty string? | 97 | // We didn't replace quote, probably because of empty string? |
102 | _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | 98 | _Script += quote_replacement_string + |
99 | quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | ||
103 | } | 100 | } |
104 | // We just left a quote | 101 | // We just left a quote |
105 | quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); | 102 | quotes.Add( |
103 | quote_replacement_string + | ||
104 | quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); | ||
106 | quote = ""; | 105 | quote = ""; |
107 | } | 106 | } |
108 | break; | 107 | break; |
@@ -112,7 +111,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
112 | { | 111 | { |
113 | // We are not inside a quote | 112 | // We are not inside a quote |
114 | quote_replaced = false; | 113 | quote_replaced = false; |
115 | |||
116 | } | 114 | } |
117 | else | 115 | else |
118 | { | 116 | { |
@@ -120,7 +118,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
120 | if (!quote_replaced) | 118 | if (!quote_replaced) |
121 | { | 119 | { |
122 | // Replace quote | 120 | // Replace quote |
123 | _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | 121 | _Script += quote_replacement_string + |
122 | quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | ||
124 | quote_replaced = true; | 123 | quote_replaced = true; |
125 | } | 124 | } |
126 | quote += C; | 125 | quote += C; |
@@ -141,7 +140,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
141 | // | 140 | // |
142 | 141 | ||
143 | 142 | ||
144 | |||
145 | // | 143 | // |
146 | // PROCESS STATES | 144 | // PROCESS STATES |
147 | // Remove state definitions and add state names to start of each event within state | 145 | // Remove state definitions and add state names to start of each event within state |
@@ -170,7 +168,9 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
170 | if (ilevel == 1 && lastlevel == 0) | 168 | if (ilevel == 1 && lastlevel == 0) |
171 | { | 169 | { |
172 | // 0 => 1: Get last | 170 | // 0 => 1: Get last |
173 | Match m = Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 171 | Match m = |
172 | Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", | ||
173 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
174 | 174 | ||
175 | in_state = false; | 175 | in_state = false; |
176 | if (m.Success) | 176 | if (m.Success) |
@@ -179,7 +179,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
179 | in_state = true; | 179 | in_state = true; |
180 | current_statename = m.Groups[1].Captures[0].Value; | 180 | current_statename = m.Groups[1].Captures[0].Value; |
181 | //Console.WriteLine("Current statename: " + current_statename); | 181 | //Console.WriteLine("Current statename: " + current_statename); |
182 | cache = Regex.Replace(cache, @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", "${s1}${s2}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 182 | cache = |
183 | Regex.Replace(cache, | ||
184 | @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", | ||
185 | "${s1}${s2}", | ||
186 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
183 | } | 187 | } |
184 | ret += cache; | 188 | ret += cache; |
185 | cache = ""; | 189 | cache = ""; |
@@ -196,7 +200,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
196 | // void dataserver(key query_id, string data) { | 200 | // void dataserver(key query_id, string data) { |
197 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 201 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
198 | //Console.WriteLine("Replacing using statename: " + current_statename); | 202 | //Console.WriteLine("Replacing using statename: " + current_statename); |
199 | cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 203 | cache = |
204 | Regex.Replace(cache, | ||
205 | @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", | ||
206 | @"$1public " + current_statename + "_event_$2", | ||
207 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
200 | } | 208 | } |
201 | 209 | ||
202 | ret += cache; | 210 | ret += cache; |
@@ -216,32 +224,48 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
216 | ret = ""; | 224 | ret = ""; |
217 | 225 | ||
218 | 226 | ||
219 | |||
220 | foreach (string key in dataTypes.Keys) | 227 | foreach (string key in dataTypes.Keys) |
221 | { | 228 | { |
222 | string val; | 229 | string val; |
223 | dataTypes.TryGetValue(key, out val); | 230 | dataTypes.TryGetValue(key, out val); |
224 | 231 | ||
225 | // Replace CAST - (integer) with (int) | 232 | // Replace CAST - (integer) with (int) |
226 | Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); | 233 | Script = |
234 | Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", | ||
235 | RegexOptions.Compiled | RegexOptions.Multiline); | ||
227 | // Replace return types and function variables - integer a() and f(integer a, integer a) | 236 | // Replace return types and function variables - integer a() and f(integer a, integer a) |
228 | Script = Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", RegexOptions.Compiled | RegexOptions.Multiline); | 237 | Script = |
238 | Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", | ||
239 | RegexOptions.Compiled | RegexOptions.Multiline); | ||
229 | } | 240 | } |
230 | 241 | ||
231 | // Add "void" in front of functions that needs it | 242 | // Add "void" in front of functions that needs it |
232 | Script = Regex.Replace(Script, @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 243 | Script = |
244 | Regex.Replace(Script, | ||
245 | @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", | ||
246 | @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
233 | 247 | ||
234 | // Replace <x,y,z> and <x,y,z,r> | 248 | // Replace <x,y,z> and <x,y,z,r> |
235 | Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 249 | Script = |
236 | Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 250 | Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", |
251 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
252 | Script = | ||
253 | Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", | ||
254 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
237 | 255 | ||
238 | // Replace List []'s | 256 | // Replace List []'s |
239 | Script = Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 257 | Script = |
258 | Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", | ||
259 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
240 | 260 | ||
241 | 261 | ||
242 | // Replace (string) to .ToString() // | 262 | // Replace (string) to .ToString() // |
243 | Script = Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 263 | Script = |
244 | Script = Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 264 | Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", |
265 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
266 | Script = | ||
267 | Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", | ||
268 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
245 | 269 | ||
246 | 270 | ||
247 | // REPLACE BACK QUOTES | 271 | // REPLACE BACK QUOTES |
@@ -256,7 +280,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
256 | // Add namespace, class name and inheritance | 280 | // Add namespace, class name and inheritance |
257 | 281 | ||
258 | Return = "" + | 282 | Return = "" + |
259 | "using OpenSim.Region.ScriptEngine.Common;"; | 283 | "using OpenSim.Region.ScriptEngine.Common;"; |
260 | //"using System; " + | 284 | //"using System; " + |
261 | //"using System.Collections.Generic; " + | 285 | //"using System.Collections.Generic; " + |
262 | //"using System.Text; " + | 286 | //"using System.Text; " + |
@@ -278,17 +302,15 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
278 | 302 | ||
279 | 303 | ||
280 | Return += "" + | 304 | Return += "" + |
281 | "namespace SecondLife { "; | 305 | "namespace SecondLife { "; |
282 | Return += "" + | 306 | Return += "" + |
283 | //"[Serializable] " + | 307 | //"[Serializable] " + |
284 | "public class Script : OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; | 308 | "public class Script : OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; |
285 | Return += @"public Script() { } "; | 309 | Return += @"public Script() { } "; |
286 | Return += Script; | 310 | Return += Script; |
287 | Return += "} }\r\n"; | 311 | Return += "} }\r\n"; |
288 | 312 | ||
289 | return Return; | 313 | return Return; |
290 | } | 314 | } |
291 | |||
292 | |||
293 | } | 315 | } |
294 | } | 316 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index a5fe7f1..1f5e6da 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -28,12 +28,9 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; | ||
33 | using OpenSim.Region.ScriptEngine.Common; | ||
34 | using System.Threading; | ||
35 | using System.Reflection; | ||
36 | using System.Runtime.Remoting.Lifetime; | 31 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Threading; | ||
33 | using OpenSim.Region.ScriptEngine.Common; | ||
37 | using integer = System.Int32; | 34 | using integer = System.Int32; |
38 | using key = System.String; | 35 | using key = System.String; |
39 | using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; | 36 | using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; |
@@ -44,13 +41,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
44 | //[Serializable] | 41 | //[Serializable] |
45 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript | 42 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript |
46 | { | 43 | { |
47 | |||
48 | // Object never expires | 44 | // Object never expires |
49 | public override Object InitializeLifetimeService() | 45 | public override Object InitializeLifetimeService() |
50 | { | 46 | { |
51 | //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); | 47 | //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); |
52 | // return null; | 48 | // return null; |
53 | ILease lease = (ILease)base.InitializeLifetimeService(); | 49 | ILease lease = (ILease) base.InitializeLifetimeService(); |
54 | 50 | ||
55 | if (lease.CurrentState == LeaseState.Initial) | 51 | if (lease.CurrentState == LeaseState.Initial) |
56 | { | 52 | { |
@@ -63,6 +59,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
63 | 59 | ||
64 | 60 | ||
65 | private Executor m_Exec; | 61 | private Executor m_Exec; |
62 | |||
66 | public Executor Exec | 63 | public Executor Exec |
67 | { | 64 | { |
68 | get | 65 | get |
@@ -79,6 +76,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
79 | public LSL_BaseClass() | 76 | public LSL_BaseClass() |
80 | { | 77 | { |
81 | } | 78 | } |
79 | |||
82 | public string State() | 80 | public string State() |
83 | { | 81 | { |
84 | return m_LSL_Functions.State(); | 82 | return m_LSL_Functions.State(); |
@@ -94,410 +92,1724 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
94 | // Get this AppDomain's settings and display some of them. | 92 | // Get this AppDomain's settings and display some of them. |
95 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; | 93 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; |
96 | Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", | 94 | Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", |
97 | ads.ApplicationName, | 95 | ads.ApplicationName, |
98 | ads.ApplicationBase, | 96 | ads.ApplicationBase, |
99 | ads.ConfigurationFile | 97 | ads.ConfigurationFile |
100 | ); | 98 | ); |
101 | 99 | ||
102 | // Display the name of the calling AppDomain and the name | 100 | // Display the name of the calling AppDomain and the name |
103 | // of the second domain. | 101 | // of the second domain. |
104 | // NOTE: The application's thread has transitioned between | 102 | // NOTE: The application's thread has transitioned between |
105 | // AppDomains. | 103 | // AppDomains. |
106 | Console.WriteLine("Calling to '{0}'.", | 104 | Console.WriteLine("Calling to '{0}'.", |
107 | Thread.GetDomain().FriendlyName | 105 | Thread.GetDomain().FriendlyName |
108 | ); | 106 | ); |
109 | 107 | ||
110 | return; | 108 | return; |
111 | } | 109 | } |
112 | 110 | ||
113 | 111 | ||
114 | |||
115 | // | 112 | // |
116 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 113 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
117 | // | 114 | // |
118 | // They are only forwarders to LSL_BuiltIn_Commands.cs | 115 | // They are only forwarders to LSL_BuiltIn_Commands.cs |
119 | // | 116 | // |
120 | public double llSin(double f) { return m_LSL_Functions.llSin(f); } | 117 | public double llSin(double f) |
121 | public double llCos(double f) { return m_LSL_Functions.llCos(f); } | 118 | { |
122 | public double llTan(double f) { return m_LSL_Functions.llTan(f); } | 119 | return m_LSL_Functions.llSin(f); |
123 | public double llAtan2(double x, double y) { return m_LSL_Functions.llAtan2(x, y); } | 120 | } |
124 | public double llSqrt(double f) { return m_LSL_Functions.llSqrt(f); } | 121 | |
125 | public double llPow(double fbase, double fexponent) { return m_LSL_Functions.llPow(fbase, fexponent); } | 122 | public double llCos(double f) |
126 | public int llAbs(int i) { return m_LSL_Functions.llAbs(i); } | 123 | { |
127 | public double llFabs(double f) { return m_LSL_Functions.llFabs(f); } | 124 | return m_LSL_Functions.llCos(f); |
128 | public double llFrand(double mag) { return m_LSL_Functions.llFrand(mag); } | 125 | } |
129 | public int llFloor(double f) { return m_LSL_Functions.llFloor(f); } | 126 | |
130 | public int llCeil(double f) { return m_LSL_Functions.llCeil(f); } | 127 | public double llTan(double f) |
131 | public int llRound(double f) { return m_LSL_Functions.llRound(f); } | 128 | { |
132 | public double llVecMag(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecMag(v); } | 129 | return m_LSL_Functions.llTan(f); |
133 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecNorm(v); } | 130 | } |
134 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) { return m_LSL_Functions.llVecDist(a, b); } | 131 | |
135 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Euler(r); } | 132 | public double llAtan2(double x, double y) |
136 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) { return m_LSL_Functions.llEuler2Rot(v); } | 133 | { |
137 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return m_LSL_Functions.llAxes2Rot(fwd, left, up); } | 134 | return m_LSL_Functions.llAtan2(x, y); |
138 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Fwd(r); } | 135 | } |
139 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Left(r); } | 136 | |
140 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Up(r); } | 137 | public double llSqrt(double f) |
141 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return m_LSL_Functions.llRotBetween(start, end); } | 138 | { |
142 | public void llWhisper(int channelID, string text) { m_LSL_Functions.llWhisper(channelID, text); } | 139 | return m_LSL_Functions.llSqrt(f); |
143 | public void llSay(int channelID, string text) { m_LSL_Functions.llSay(channelID, text); } | 140 | } |
141 | |||
142 | public double llPow(double fbase, double fexponent) | ||
143 | { | ||
144 | return m_LSL_Functions.llPow(fbase, fexponent); | ||
145 | } | ||
146 | |||
147 | public int llAbs(int i) | ||
148 | { | ||
149 | return m_LSL_Functions.llAbs(i); | ||
150 | } | ||
151 | |||
152 | public double llFabs(double f) | ||
153 | { | ||
154 | return m_LSL_Functions.llFabs(f); | ||
155 | } | ||
156 | |||
157 | public double llFrand(double mag) | ||
158 | { | ||
159 | return m_LSL_Functions.llFrand(mag); | ||
160 | } | ||
161 | |||
162 | public int llFloor(double f) | ||
163 | { | ||
164 | return m_LSL_Functions.llFloor(f); | ||
165 | } | ||
166 | |||
167 | public int llCeil(double f) | ||
168 | { | ||
169 | return m_LSL_Functions.llCeil(f); | ||
170 | } | ||
171 | |||
172 | public int llRound(double f) | ||
173 | { | ||
174 | return m_LSL_Functions.llRound(f); | ||
175 | } | ||
176 | |||
177 | public double llVecMag(vector v) | ||
178 | { | ||
179 | return m_LSL_Functions.llVecMag(v); | ||
180 | } | ||
181 | |||
182 | public vector llVecNorm(vector v) | ||
183 | { | ||
184 | return m_LSL_Functions.llVecNorm(v); | ||
185 | } | ||
186 | |||
187 | public double llVecDist(vector a, vector b) | ||
188 | { | ||
189 | return m_LSL_Functions.llVecDist(a, b); | ||
190 | } | ||
191 | |||
192 | public vector llRot2Euler(rotation r) | ||
193 | { | ||
194 | return m_LSL_Functions.llRot2Euler(r); | ||
195 | } | ||
196 | |||
197 | public rotation llEuler2Rot(vector v) | ||
198 | { | ||
199 | return m_LSL_Functions.llEuler2Rot(v); | ||
200 | } | ||
201 | |||
202 | public rotation llAxes2Rot(vector fwd, vector left, vector up) | ||
203 | { | ||
204 | return m_LSL_Functions.llAxes2Rot(fwd, left, up); | ||
205 | } | ||
206 | |||
207 | public vector llRot2Fwd(rotation r) | ||
208 | { | ||
209 | return m_LSL_Functions.llRot2Fwd(r); | ||
210 | } | ||
211 | |||
212 | public vector llRot2Left(rotation r) | ||
213 | { | ||
214 | return m_LSL_Functions.llRot2Left(r); | ||
215 | } | ||
216 | |||
217 | public vector llRot2Up(rotation r) | ||
218 | { | ||
219 | return m_LSL_Functions.llRot2Up(r); | ||
220 | } | ||
221 | |||
222 | public rotation llRotBetween(vector start, vector end) | ||
223 | { | ||
224 | return m_LSL_Functions.llRotBetween(start, end); | ||
225 | } | ||
226 | |||
227 | public void llWhisper(int channelID, string text) | ||
228 | { | ||
229 | m_LSL_Functions.llWhisper(channelID, text); | ||
230 | } | ||
231 | |||
232 | public void llSay(int channelID, string text) | ||
233 | { | ||
234 | m_LSL_Functions.llSay(channelID, text); | ||
235 | } | ||
236 | |||
144 | // | 237 | // |
145 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 238 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
146 | // | 239 | // |
147 | public void llShout(int channelID, string text) { m_LSL_Functions.llShout(channelID, text); } | 240 | public void llShout(int channelID, string text) |
148 | public int llListen(int channelID, string name, string ID, string msg) { return m_LSL_Functions.llListen(channelID, name, ID, msg); } | 241 | { |
149 | public void llListenControl(int number, int active) { m_LSL_Functions.llListenControl(number, active); } | 242 | m_LSL_Functions.llShout(channelID, text); |
150 | public void llListenRemove(int number) { m_LSL_Functions.llListenRemove(number); } | 243 | } |
151 | public void llSensor(string name, string id, int type, double range, double arc) { m_LSL_Functions.llSensor(name, id, type, range, arc); } | 244 | |
152 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); } | 245 | public int llListen(int channelID, string name, string ID, string msg) |
153 | public void llSensorRemove() { m_LSL_Functions.llSensorRemove(); } | 246 | { |
154 | public string llDetectedName(int number) { return m_LSL_Functions.llDetectedName(number); } | 247 | return m_LSL_Functions.llListen(channelID, name, ID, msg); |
155 | public string llDetectedKey(int number) { return m_LSL_Functions.llDetectedKey(number); } | 248 | } |
156 | public string llDetectedOwner(int number) { return m_LSL_Functions.llDetectedOwner(number); } | 249 | |
157 | public int llDetectedType(int number) { return m_LSL_Functions.llDetectedType(number); } | 250 | public void llListenControl(int number, int active) |
158 | public LSL_Types.Vector3 llDetectedPos(int number) { return m_LSL_Functions.llDetectedPos(number); } | 251 | { |
159 | public LSL_Types.Vector3 llDetectedVel(int number) { return m_LSL_Functions.llDetectedVel(number); } | 252 | m_LSL_Functions.llListenControl(number, active); |
160 | public LSL_Types.Vector3 llDetectedGrab(int number) { return m_LSL_Functions.llDetectedGrab(number); } | 253 | } |
161 | public LSL_Types.Quaternion llDetectedRot(int number) { return m_LSL_Functions.llDetectedRot(number); } | 254 | |
162 | public int llDetectedGroup(int number) { return m_LSL_Functions.llDetectedGroup(number); } | 255 | public void llListenRemove(int number) |
163 | public int llDetectedLinkNumber(int number) { return m_LSL_Functions.llDetectedLinkNumber(number); } | 256 | { |
257 | m_LSL_Functions.llListenRemove(number); | ||
258 | } | ||
259 | |||
260 | public void llSensor(string name, string id, int type, double range, double arc) | ||
261 | { | ||
262 | m_LSL_Functions.llSensor(name, id, type, range, arc); | ||
263 | } | ||
264 | |||
265 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | ||
266 | { | ||
267 | m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); | ||
268 | } | ||
269 | |||
270 | public void llSensorRemove() | ||
271 | { | ||
272 | m_LSL_Functions.llSensorRemove(); | ||
273 | } | ||
274 | |||
275 | public string llDetectedName(int number) | ||
276 | { | ||
277 | return m_LSL_Functions.llDetectedName(number); | ||
278 | } | ||
279 | |||
280 | public string llDetectedKey(int number) | ||
281 | { | ||
282 | return m_LSL_Functions.llDetectedKey(number); | ||
283 | } | ||
284 | |||
285 | public string llDetectedOwner(int number) | ||
286 | { | ||
287 | return m_LSL_Functions.llDetectedOwner(number); | ||
288 | } | ||
289 | |||
290 | public int llDetectedType(int number) | ||
291 | { | ||
292 | return m_LSL_Functions.llDetectedType(number); | ||
293 | } | ||
294 | |||
295 | public vector llDetectedPos(int number) | ||
296 | { | ||
297 | return m_LSL_Functions.llDetectedPos(number); | ||
298 | } | ||
299 | |||
300 | public vector llDetectedVel(int number) | ||
301 | { | ||
302 | return m_LSL_Functions.llDetectedVel(number); | ||
303 | } | ||
304 | |||
305 | public vector llDetectedGrab(int number) | ||
306 | { | ||
307 | return m_LSL_Functions.llDetectedGrab(number); | ||
308 | } | ||
309 | |||
310 | public rotation llDetectedRot(int number) | ||
311 | { | ||
312 | return m_LSL_Functions.llDetectedRot(number); | ||
313 | } | ||
314 | |||
315 | public int llDetectedGroup(int number) | ||
316 | { | ||
317 | return m_LSL_Functions.llDetectedGroup(number); | ||
318 | } | ||
319 | |||
320 | public int llDetectedLinkNumber(int number) | ||
321 | { | ||
322 | return m_LSL_Functions.llDetectedLinkNumber(number); | ||
323 | } | ||
324 | |||
164 | // | 325 | // |
165 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 326 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
166 | // | 327 | // |
167 | public void llDie() { m_LSL_Functions.llDie(); } | 328 | public void llDie() |
168 | public double llGround(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGround(offset); } | 329 | { |
169 | public double llCloud(LSL_Types.Vector3 offset) { return m_LSL_Functions.llCloud(offset); } | 330 | m_LSL_Functions.llDie(); |
170 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWind(offset); } | 331 | } |
171 | public void llSetStatus(int status, int value) { m_LSL_Functions.llSetStatus(status, value); } | 332 | |
172 | public int llGetStatus(int status) { return m_LSL_Functions.llGetStatus(status); } | 333 | public double llGround(vector offset) |
173 | public void llSetScale(LSL_Types.Vector3 scale) { m_LSL_Functions.llSetScale(scale); } | 334 | { |
174 | public LSL_Types.Vector3 llGetScale() { return m_LSL_Functions.llGetScale(); } | 335 | return m_LSL_Functions.llGround(offset); |
175 | public void llSetColor(LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetColor(color, face); } | 336 | } |
176 | public double llGetAlpha(int face) { return m_LSL_Functions.llGetAlpha(face); } | 337 | |
177 | public void llSetAlpha(double alpha, int face) { m_LSL_Functions.llSetAlpha(alpha, face); } | 338 | public double llCloud(vector offset) |
178 | public LSL_Types.Vector3 llGetColor(int face) { return m_LSL_Functions.llGetColor(face); } | 339 | { |
179 | public void llSetTexture(string texture, int face) { m_LSL_Functions.llSetTexture(texture, face); } | 340 | return m_LSL_Functions.llCloud(offset); |
180 | public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); } | 341 | } |
181 | public void llOffsetTexture(double u, double v, int face) { m_LSL_Functions.llOffsetTexture(u, v, face); } | 342 | |
182 | public void llRotateTexture(double rotation, int face) { m_LSL_Functions.llRotateTexture(rotation, face); } | 343 | public vector llWind(vector offset) |
183 | public string llGetTexture(int face) { return m_LSL_Functions.llGetTexture(face); } | 344 | { |
345 | return m_LSL_Functions.llWind(offset); | ||
346 | } | ||
347 | |||
348 | public void llSetStatus(int status, int value) | ||
349 | { | ||
350 | m_LSL_Functions.llSetStatus(status, value); | ||
351 | } | ||
352 | |||
353 | public int llGetStatus(int status) | ||
354 | { | ||
355 | return m_LSL_Functions.llGetStatus(status); | ||
356 | } | ||
357 | |||
358 | public void llSetScale(vector scale) | ||
359 | { | ||
360 | m_LSL_Functions.llSetScale(scale); | ||
361 | } | ||
362 | |||
363 | public vector llGetScale() | ||
364 | { | ||
365 | return m_LSL_Functions.llGetScale(); | ||
366 | } | ||
367 | |||
368 | public void llSetColor(vector color, int face) | ||
369 | { | ||
370 | m_LSL_Functions.llSetColor(color, face); | ||
371 | } | ||
372 | |||
373 | public double llGetAlpha(int face) | ||
374 | { | ||
375 | return m_LSL_Functions.llGetAlpha(face); | ||
376 | } | ||
377 | |||
378 | public void llSetAlpha(double alpha, int face) | ||
379 | { | ||
380 | m_LSL_Functions.llSetAlpha(alpha, face); | ||
381 | } | ||
382 | |||
383 | public vector llGetColor(int face) | ||
384 | { | ||
385 | return m_LSL_Functions.llGetColor(face); | ||
386 | } | ||
387 | |||
388 | public void llSetTexture(string texture, int face) | ||
389 | { | ||
390 | m_LSL_Functions.llSetTexture(texture, face); | ||
391 | } | ||
392 | |||
393 | public void llScaleTexture(double u, double v, int face) | ||
394 | { | ||
395 | m_LSL_Functions.llScaleTexture(u, v, face); | ||
396 | } | ||
397 | |||
398 | public void llOffsetTexture(double u, double v, int face) | ||
399 | { | ||
400 | m_LSL_Functions.llOffsetTexture(u, v, face); | ||
401 | } | ||
402 | |||
403 | public void llRotateTexture(double rotation, int face) | ||
404 | { | ||
405 | m_LSL_Functions.llRotateTexture(rotation, face); | ||
406 | } | ||
407 | |||
408 | public string llGetTexture(int face) | ||
409 | { | ||
410 | return m_LSL_Functions.llGetTexture(face); | ||
411 | } | ||
412 | |||
184 | // | 413 | // |
185 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 414 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
186 | // | 415 | // |
187 | public void llSetPos(LSL_Types.Vector3 pos) { m_LSL_Functions.llSetPos(pos); } | 416 | public void llSetPos(vector pos) |
188 | public LSL_Types.Vector3 llGetPos() { return m_LSL_Functions.llGetPos(); } | 417 | { |
189 | public LSL_Types.Vector3 llGetLocalPos() { return m_LSL_Functions.llGetLocalPos(); } | 418 | m_LSL_Functions.llSetPos(pos); |
190 | public void llSetRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetRot(rot); } | 419 | } |
191 | public LSL_Types.Quaternion llGetRot() { return m_LSL_Functions.llGetRot(); } | 420 | |
192 | public LSL_Types.Quaternion llGetLocalRot() { return m_LSL_Functions.llGetLocalRot(); } | 421 | public vector llGetPos() |
193 | public void llSetForce(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llSetForce(force, local); } | 422 | { |
194 | public LSL_Types.Vector3 llGetForce() { return m_LSL_Functions.llGetForce(); } | 423 | return m_LSL_Functions.llGetPos(); |
195 | public int llTarget(LSL_Types.Vector3 position, double range) { return m_LSL_Functions.llTarget(position, range); } | 424 | } |
196 | public void llTargetRemove(int number) { m_LSL_Functions.llTargetRemove(number); } | 425 | |
197 | public int llRotTarget(LSL_Types.Quaternion rot, double error) { return m_LSL_Functions.llRotTarget(rot, error); } | 426 | public vector llGetLocalPos() |
198 | public void llRotTargetRemove(int number) { m_LSL_Functions.llRotTargetRemove(number); } | 427 | { |
199 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { m_LSL_Functions.llMoveToTarget(target, tau); } | 428 | return m_LSL_Functions.llGetLocalPos(); |
200 | public void llStopMoveToTarget() { m_LSL_Functions.llStopMoveToTarget(); } | 429 | } |
201 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyImpulse(force, local); } | 430 | |
431 | public void llSetRot(rotation rot) | ||
432 | { | ||
433 | m_LSL_Functions.llSetRot(rot); | ||
434 | } | ||
435 | |||
436 | public rotation llGetRot() | ||
437 | { | ||
438 | return m_LSL_Functions.llGetRot(); | ||
439 | } | ||
440 | |||
441 | public rotation llGetLocalRot() | ||
442 | { | ||
443 | return m_LSL_Functions.llGetLocalRot(); | ||
444 | } | ||
445 | |||
446 | public void llSetForce(vector force, int local) | ||
447 | { | ||
448 | m_LSL_Functions.llSetForce(force, local); | ||
449 | } | ||
450 | |||
451 | public vector llGetForce() | ||
452 | { | ||
453 | return m_LSL_Functions.llGetForce(); | ||
454 | } | ||
455 | |||
456 | public int llTarget(vector position, double range) | ||
457 | { | ||
458 | return m_LSL_Functions.llTarget(position, range); | ||
459 | } | ||
460 | |||
461 | public void llTargetRemove(int number) | ||
462 | { | ||
463 | m_LSL_Functions.llTargetRemove(number); | ||
464 | } | ||
465 | |||
466 | public int llRotTarget(rotation rot, double error) | ||
467 | { | ||
468 | return m_LSL_Functions.llRotTarget(rot, error); | ||
469 | } | ||
470 | |||
471 | public void llRotTargetRemove(int number) | ||
472 | { | ||
473 | m_LSL_Functions.llRotTargetRemove(number); | ||
474 | } | ||
475 | |||
476 | public void llMoveToTarget(vector target, double tau) | ||
477 | { | ||
478 | m_LSL_Functions.llMoveToTarget(target, tau); | ||
479 | } | ||
480 | |||
481 | public void llStopMoveToTarget() | ||
482 | { | ||
483 | m_LSL_Functions.llStopMoveToTarget(); | ||
484 | } | ||
485 | |||
486 | public void llApplyImpulse(vector force, int local) | ||
487 | { | ||
488 | m_LSL_Functions.llApplyImpulse(force, local); | ||
489 | } | ||
490 | |||
202 | // | 491 | // |
203 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 492 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
204 | // | 493 | // |
205 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyRotationalImpulse(force, local); } | 494 | public void llApplyRotationalImpulse(vector force, int local) |
206 | public void llSetTorque(LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetTorque(torque, local); } | 495 | { |
207 | public LSL_Types.Vector3 llGetTorque() { return m_LSL_Functions.llGetTorque(); } | 496 | m_LSL_Functions.llApplyRotationalImpulse(force, local); |
208 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetForceAndTorque(force, torque, local); } | 497 | } |
209 | public LSL_Types.Vector3 llGetVel() { return m_LSL_Functions.llGetVel(); } | 498 | |
210 | public LSL_Types.Vector3 llGetAccel() { return m_LSL_Functions.llGetAccel(); } | 499 | public void llSetTorque(vector torque, int local) |
211 | public LSL_Types.Vector3 llGetOmega() { return m_LSL_Functions.llGetOmega(); } | 500 | { |
212 | public double llGetTimeOfDay() { return m_LSL_Functions.llGetTimeOfDay(); } | 501 | m_LSL_Functions.llSetTorque(torque, local); |
213 | public double llGetWallclock() { return m_LSL_Functions.llGetWallclock(); } | 502 | } |
214 | public double llGetTime() { return m_LSL_Functions.llGetTime(); } | 503 | |
215 | public void llResetTime() { m_LSL_Functions.llResetTime(); } | 504 | public vector llGetTorque() |
216 | public double llGetAndResetTime() { return m_LSL_Functions.llGetAndResetTime(); } | 505 | { |
217 | public void llSound() { m_LSL_Functions.llSound(); } | 506 | return m_LSL_Functions.llGetTorque(); |
218 | public void llPlaySound(string sound, double volume) { m_LSL_Functions.llPlaySound(sound, volume); } | 507 | } |
219 | public void llLoopSound(string sound, double volume) { m_LSL_Functions.llLoopSound(sound, volume); } | 508 | |
220 | public void llLoopSoundMaster(string sound, double volume) { m_LSL_Functions.llLoopSoundMaster(sound, volume); } | 509 | public void llSetForceAndTorque(vector force, vector torque, int local) |
221 | public void llLoopSoundSlave(string sound, double volume) { m_LSL_Functions.llLoopSoundSlave(sound, volume); } | 510 | { |
222 | public void llPlaySoundSlave(string sound, double volume) { m_LSL_Functions.llPlaySoundSlave(sound, volume); } | 511 | m_LSL_Functions.llSetForceAndTorque(force, torque, local); |
512 | } | ||
513 | |||
514 | public vector llGetVel() | ||
515 | { | ||
516 | return m_LSL_Functions.llGetVel(); | ||
517 | } | ||
518 | |||
519 | public vector llGetAccel() | ||
520 | { | ||
521 | return m_LSL_Functions.llGetAccel(); | ||
522 | } | ||
523 | |||
524 | public vector llGetOmega() | ||
525 | { | ||
526 | return m_LSL_Functions.llGetOmega(); | ||
527 | } | ||
528 | |||
529 | public double llGetTimeOfDay() | ||
530 | { | ||
531 | return m_LSL_Functions.llGetTimeOfDay(); | ||
532 | } | ||
533 | |||
534 | public double llGetWallclock() | ||
535 | { | ||
536 | return m_LSL_Functions.llGetWallclock(); | ||
537 | } | ||
538 | |||
539 | public double llGetTime() | ||
540 | { | ||
541 | return m_LSL_Functions.llGetTime(); | ||
542 | } | ||
543 | |||
544 | public void llResetTime() | ||
545 | { | ||
546 | m_LSL_Functions.llResetTime(); | ||
547 | } | ||
548 | |||
549 | public double llGetAndResetTime() | ||
550 | { | ||
551 | return m_LSL_Functions.llGetAndResetTime(); | ||
552 | } | ||
553 | |||
554 | public void llSound() | ||
555 | { | ||
556 | m_LSL_Functions.llSound(); | ||
557 | } | ||
558 | |||
559 | public void llPlaySound(string sound, double volume) | ||
560 | { | ||
561 | m_LSL_Functions.llPlaySound(sound, volume); | ||
562 | } | ||
563 | |||
564 | public void llLoopSound(string sound, double volume) | ||
565 | { | ||
566 | m_LSL_Functions.llLoopSound(sound, volume); | ||
567 | } | ||
568 | |||
569 | public void llLoopSoundMaster(string sound, double volume) | ||
570 | { | ||
571 | m_LSL_Functions.llLoopSoundMaster(sound, volume); | ||
572 | } | ||
573 | |||
574 | public void llLoopSoundSlave(string sound, double volume) | ||
575 | { | ||
576 | m_LSL_Functions.llLoopSoundSlave(sound, volume); | ||
577 | } | ||
578 | |||
579 | public void llPlaySoundSlave(string sound, double volume) | ||
580 | { | ||
581 | m_LSL_Functions.llPlaySoundSlave(sound, volume); | ||
582 | } | ||
583 | |||
223 | // | 584 | // |
224 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 585 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
225 | // | 586 | // |
226 | public void llTriggerSound(string sound, double volume) { m_LSL_Functions.llTriggerSound(sound, volume); } | 587 | public void llTriggerSound(string sound, double volume) |
227 | public void llStopSound() { m_LSL_Functions.llStopSound(); } | 588 | { |
228 | public void llPreloadSound(string sound) { m_LSL_Functions.llPreloadSound(sound); } | 589 | m_LSL_Functions.llTriggerSound(sound, volume); |
229 | public string llGetSubString(string src, int start, int end) { return m_LSL_Functions.llGetSubString(src, start, end); } | 590 | } |
230 | public string llDeleteSubString(string src, int start, int end) { return m_LSL_Functions.llDeleteSubString(src, start, end); } | 591 | |
231 | public string llInsertString(string dst, int position, string src) { return m_LSL_Functions.llInsertString(dst, position, src); } | 592 | public void llStopSound() |
232 | public string llToUpper(string source) { return m_LSL_Functions.llToUpper(source); } | 593 | { |
233 | public string llToLower(string source) { return m_LSL_Functions.llToLower(source); } | 594 | m_LSL_Functions.llStopSound(); |
234 | public int llGiveMoney(string destination, int amount) { return m_LSL_Functions.llGiveMoney(destination, amount); } | 595 | } |
235 | public void llMakeExplosion() { m_LSL_Functions.llMakeExplosion(); } | 596 | |
236 | public void llMakeFountain() { m_LSL_Functions.llMakeFountain(); } | 597 | public void llPreloadSound(string sound) |
237 | public void llMakeSmoke() { m_LSL_Functions.llMakeSmoke(); } | 598 | { |
238 | public void llMakeFire() { m_LSL_Functions.llMakeFire(); } | 599 | m_LSL_Functions.llPreloadSound(sound); |
239 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezObject(inventory, pos, rot, param); } | 600 | } |
240 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { m_LSL_Functions.llLookAt(target, strength, damping); } | 601 | |
241 | public void llStopLookAt() { m_LSL_Functions.llStopLookAt(); } | 602 | public string llGetSubString(string src, int start, int end) |
242 | public void llSetTimerEvent(double sec) { m_LSL_Functions.llSetTimerEvent(sec); } | 603 | { |
243 | public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); } | 604 | return m_LSL_Functions.llGetSubString(src, start, end); |
605 | } | ||
606 | |||
607 | public string llDeleteSubString(string src, int start, int end) | ||
608 | { | ||
609 | return m_LSL_Functions.llDeleteSubString(src, start, end); | ||
610 | } | ||
611 | |||
612 | public string llInsertString(string dst, int position, string src) | ||
613 | { | ||
614 | return m_LSL_Functions.llInsertString(dst, position, src); | ||
615 | } | ||
616 | |||
617 | public string llToUpper(string source) | ||
618 | { | ||
619 | return m_LSL_Functions.llToUpper(source); | ||
620 | } | ||
621 | |||
622 | public string llToLower(string source) | ||
623 | { | ||
624 | return m_LSL_Functions.llToLower(source); | ||
625 | } | ||
626 | |||
627 | public int llGiveMoney(string destination, int amount) | ||
628 | { | ||
629 | return m_LSL_Functions.llGiveMoney(destination, amount); | ||
630 | } | ||
631 | |||
632 | public void llMakeExplosion() | ||
633 | { | ||
634 | m_LSL_Functions.llMakeExplosion(); | ||
635 | } | ||
636 | |||
637 | public void llMakeFountain() | ||
638 | { | ||
639 | m_LSL_Functions.llMakeFountain(); | ||
640 | } | ||
641 | |||
642 | public void llMakeSmoke() | ||
643 | { | ||
644 | m_LSL_Functions.llMakeSmoke(); | ||
645 | } | ||
646 | |||
647 | public void llMakeFire() | ||
648 | { | ||
649 | m_LSL_Functions.llMakeFire(); | ||
650 | } | ||
651 | |||
652 | public void llRezObject(string inventory, vector pos, rotation rot, int param) | ||
653 | { | ||
654 | m_LSL_Functions.llRezObject(inventory, pos, rot, param); | ||
655 | } | ||
656 | |||
657 | public void llLookAt(vector target, double strength, double damping) | ||
658 | { | ||
659 | m_LSL_Functions.llLookAt(target, strength, damping); | ||
660 | } | ||
661 | |||
662 | public void llStopLookAt() | ||
663 | { | ||
664 | m_LSL_Functions.llStopLookAt(); | ||
665 | } | ||
666 | |||
667 | public void llSetTimerEvent(double sec) | ||
668 | { | ||
669 | m_LSL_Functions.llSetTimerEvent(sec); | ||
670 | } | ||
671 | |||
672 | public void llSleep(double sec) | ||
673 | { | ||
674 | m_LSL_Functions.llSleep(sec); | ||
675 | } | ||
676 | |||
244 | // | 677 | // |
245 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 678 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
246 | // | 679 | // |
247 | public double llGetMass() { return m_LSL_Functions.llGetMass(); } | 680 | public double llGetMass() |
248 | public void llCollisionFilter(string name, string id, int accept) { m_LSL_Functions.llCollisionFilter(name, id, accept); } | 681 | { |
249 | public void llTakeControls(int controls, int accept, int pass_on) { m_LSL_Functions.llTakeControls(controls, accept, pass_on); } | 682 | return m_LSL_Functions.llGetMass(); |
250 | public void llReleaseControls() { m_LSL_Functions.llReleaseControls(); } | 683 | } |
251 | public void llAttachToAvatar(int attachment) { m_LSL_Functions.llAttachToAvatar(attachment); } | 684 | |
252 | public void llDetachFromAvatar() { m_LSL_Functions.llDetachFromAvatar(); } | 685 | public void llCollisionFilter(string name, string id, int accept) |
253 | public void llTakeCamera() { m_LSL_Functions.llTakeCamera(); } | 686 | { |
254 | public void llReleaseCamera() { m_LSL_Functions.llReleaseCamera(); } | 687 | m_LSL_Functions.llCollisionFilter(name, id, accept); |
255 | public string llGetOwner() { return m_LSL_Functions.llGetOwner(); } | 688 | } |
256 | public void llInstantMessage(string user, string message) { m_LSL_Functions.llInstantMessage(user, message); } | 689 | |
257 | public void llEmail(string address, string subject, string message) { m_LSL_Functions.llEmail(address, subject, message); } | 690 | public void llTakeControls(int controls, int accept, int pass_on) |
258 | public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); } | 691 | { |
259 | public string llGetKey() { return m_LSL_Functions.llGetKey(); } | 692 | m_LSL_Functions.llTakeControls(controls, accept, pass_on); |
260 | public void llSetBuoyancy(double buoyancy) { m_LSL_Functions.llSetBuoyancy(buoyancy); } | 693 | } |
261 | public void llSetHoverHeight(double height, int water, double tau) { m_LSL_Functions.llSetHoverHeight(height, water, tau); } | 694 | |
262 | public void llStopHover() { m_LSL_Functions.llStopHover(); } | 695 | public void llReleaseControls() |
263 | public void llMinEventDelay(double delay) { m_LSL_Functions.llMinEventDelay(delay); } | 696 | { |
264 | public void llSoundPreload() { m_LSL_Functions.llSoundPreload(); } | 697 | m_LSL_Functions.llReleaseControls(); |
265 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { m_LSL_Functions.llRotLookAt(target, strength, damping); } | 698 | } |
699 | |||
700 | public void llAttachToAvatar(int attachment) | ||
701 | { | ||
702 | m_LSL_Functions.llAttachToAvatar(attachment); | ||
703 | } | ||
704 | |||
705 | public void llDetachFromAvatar() | ||
706 | { | ||
707 | m_LSL_Functions.llDetachFromAvatar(); | ||
708 | } | ||
709 | |||
710 | public void llTakeCamera() | ||
711 | { | ||
712 | m_LSL_Functions.llTakeCamera(); | ||
713 | } | ||
714 | |||
715 | public void llReleaseCamera() | ||
716 | { | ||
717 | m_LSL_Functions.llReleaseCamera(); | ||
718 | } | ||
719 | |||
720 | public string llGetOwner() | ||
721 | { | ||
722 | return m_LSL_Functions.llGetOwner(); | ||
723 | } | ||
724 | |||
725 | public void llInstantMessage(string user, string message) | ||
726 | { | ||
727 | m_LSL_Functions.llInstantMessage(user, message); | ||
728 | } | ||
729 | |||
730 | public void llEmail(string address, string subject, string message) | ||
731 | { | ||
732 | m_LSL_Functions.llEmail(address, subject, message); | ||
733 | } | ||
734 | |||
735 | public void llGetNextEmail(string address, string subject) | ||
736 | { | ||
737 | m_LSL_Functions.llGetNextEmail(address, subject); | ||
738 | } | ||
739 | |||
740 | public string llGetKey() | ||
741 | { | ||
742 | return m_LSL_Functions.llGetKey(); | ||
743 | } | ||
744 | |||
745 | public void llSetBuoyancy(double buoyancy) | ||
746 | { | ||
747 | m_LSL_Functions.llSetBuoyancy(buoyancy); | ||
748 | } | ||
749 | |||
750 | public void llSetHoverHeight(double height, int water, double tau) | ||
751 | { | ||
752 | m_LSL_Functions.llSetHoverHeight(height, water, tau); | ||
753 | } | ||
754 | |||
755 | public void llStopHover() | ||
756 | { | ||
757 | m_LSL_Functions.llStopHover(); | ||
758 | } | ||
759 | |||
760 | public void llMinEventDelay(double delay) | ||
761 | { | ||
762 | m_LSL_Functions.llMinEventDelay(delay); | ||
763 | } | ||
764 | |||
765 | public void llSoundPreload() | ||
766 | { | ||
767 | m_LSL_Functions.llSoundPreload(); | ||
768 | } | ||
769 | |||
770 | public void llRotLookAt(rotation target, double strength, double damping) | ||
771 | { | ||
772 | m_LSL_Functions.llRotLookAt(target, strength, damping); | ||
773 | } | ||
774 | |||
266 | // | 775 | // |
267 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 776 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
268 | // | 777 | // |
269 | public int llStringLength(string str) { return m_LSL_Functions.llStringLength(str); } | 778 | public int llStringLength(string str) |
270 | public void llStartAnimation(string anim) { m_LSL_Functions.llStartAnimation(anim); } | 779 | { |
271 | public void llStopAnimation(string anim) { m_LSL_Functions.llStopAnimation(anim); } | 780 | return m_LSL_Functions.llStringLength(str); |
272 | public void llPointAt() { m_LSL_Functions.llPointAt(); } | 781 | } |
273 | public void llStopPointAt() { m_LSL_Functions.llStopPointAt(); } | 782 | |
274 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { m_LSL_Functions.llTargetOmega(axis, spinrate, gain); } | 783 | public void llStartAnimation(string anim) |
275 | public int llGetStartParameter() { return m_LSL_Functions.llGetStartParameter(); } | 784 | { |
276 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { m_LSL_Functions.llGodLikeRezObject(inventory, pos); } | 785 | m_LSL_Functions.llStartAnimation(anim); |
277 | public void llRequestPermissions(string agent, int perm) { m_LSL_Functions.llRequestPermissions(agent, perm); } | 786 | } |
278 | public string llGetPermissionsKey() { return m_LSL_Functions.llGetPermissionsKey(); } | 787 | |
279 | public int llGetPermissions() { return m_LSL_Functions.llGetPermissions(); } | 788 | public void llStopAnimation(string anim) |
280 | public int llGetLinkNumber() { return m_LSL_Functions.llGetLinkNumber(); } | 789 | { |
281 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetLinkColor(linknumber, color, face); } | 790 | m_LSL_Functions.llStopAnimation(anim); |
282 | public void llCreateLink(string target, int parent) { m_LSL_Functions.llCreateLink(target, parent); } | 791 | } |
283 | public void llBreakLink(int linknum) { m_LSL_Functions.llBreakLink(linknum); } | 792 | |
284 | public void llBreakAllLinks() { m_LSL_Functions.llBreakAllLinks(); } | 793 | public void llPointAt() |
285 | public string llGetLinkKey(int linknum) { return m_LSL_Functions.llGetLinkKey(linknum); } | 794 | { |
286 | public void llGetLinkName(int linknum) { m_LSL_Functions.llGetLinkName(linknum); } | 795 | m_LSL_Functions.llPointAt(); |
287 | public int llGetInventoryNumber(int type) { return m_LSL_Functions.llGetInventoryNumber(type); } | 796 | } |
288 | public string llGetInventoryName(int type, int number) { return m_LSL_Functions.llGetInventoryName(type, number); } | 797 | |
798 | public void llStopPointAt() | ||
799 | { | ||
800 | m_LSL_Functions.llStopPointAt(); | ||
801 | } | ||
802 | |||
803 | public void llTargetOmega(vector axis, double spinrate, double gain) | ||
804 | { | ||
805 | m_LSL_Functions.llTargetOmega(axis, spinrate, gain); | ||
806 | } | ||
807 | |||
808 | public int llGetStartParameter() | ||
809 | { | ||
810 | return m_LSL_Functions.llGetStartParameter(); | ||
811 | } | ||
812 | |||
813 | public void llGodLikeRezObject(string inventory, vector pos) | ||
814 | { | ||
815 | m_LSL_Functions.llGodLikeRezObject(inventory, pos); | ||
816 | } | ||
817 | |||
818 | public void llRequestPermissions(string agent, int perm) | ||
819 | { | ||
820 | m_LSL_Functions.llRequestPermissions(agent, perm); | ||
821 | } | ||
822 | |||
823 | public string llGetPermissionsKey() | ||
824 | { | ||
825 | return m_LSL_Functions.llGetPermissionsKey(); | ||
826 | } | ||
827 | |||
828 | public int llGetPermissions() | ||
829 | { | ||
830 | return m_LSL_Functions.llGetPermissions(); | ||
831 | } | ||
832 | |||
833 | public int llGetLinkNumber() | ||
834 | { | ||
835 | return m_LSL_Functions.llGetLinkNumber(); | ||
836 | } | ||
837 | |||
838 | public void llSetLinkColor(int linknumber, vector color, int face) | ||
839 | { | ||
840 | m_LSL_Functions.llSetLinkColor(linknumber, color, face); | ||
841 | } | ||
842 | |||
843 | public void llCreateLink(string target, int parent) | ||
844 | { | ||
845 | m_LSL_Functions.llCreateLink(target, parent); | ||
846 | } | ||
847 | |||
848 | public void llBreakLink(int linknum) | ||
849 | { | ||
850 | m_LSL_Functions.llBreakLink(linknum); | ||
851 | } | ||
852 | |||
853 | public void llBreakAllLinks() | ||
854 | { | ||
855 | m_LSL_Functions.llBreakAllLinks(); | ||
856 | } | ||
857 | |||
858 | public string llGetLinkKey(int linknum) | ||
859 | { | ||
860 | return m_LSL_Functions.llGetLinkKey(linknum); | ||
861 | } | ||
862 | |||
863 | public void llGetLinkName(int linknum) | ||
864 | { | ||
865 | m_LSL_Functions.llGetLinkName(linknum); | ||
866 | } | ||
867 | |||
868 | public int llGetInventoryNumber(int type) | ||
869 | { | ||
870 | return m_LSL_Functions.llGetInventoryNumber(type); | ||
871 | } | ||
872 | |||
873 | public string llGetInventoryName(int type, int number) | ||
874 | { | ||
875 | return m_LSL_Functions.llGetInventoryName(type, number); | ||
876 | } | ||
877 | |||
289 | // | 878 | // |
290 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 879 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
291 | // | 880 | // |
292 | public void llSetScriptState(string name, int run) { m_LSL_Functions.llSetScriptState(name, run); } | 881 | public void llSetScriptState(string name, int run) |
293 | public double llGetEnergy() { return m_LSL_Functions.llGetEnergy(); } | 882 | { |
294 | public void llGiveInventory(string destination, string inventory) { m_LSL_Functions.llGiveInventory(destination, inventory); } | 883 | m_LSL_Functions.llSetScriptState(name, run); |
295 | public void llRemoveInventory(string item) { m_LSL_Functions.llRemoveInventory(item); } | 884 | } |
296 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { m_LSL_Functions.llSetText(text, color, alpha); } | 885 | |
297 | public double llWater(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWater(offset); } | 886 | public double llGetEnergy() |
298 | public void llPassTouches(int pass) { m_LSL_Functions.llPassTouches(pass); } | 887 | { |
299 | public string llRequestAgentData(string id, int data) { return m_LSL_Functions.llRequestAgentData(id, data); } | 888 | return m_LSL_Functions.llGetEnergy(); |
300 | public string llRequestInventoryData(string name) { return m_LSL_Functions.llRequestInventoryData(name); } | 889 | } |
301 | public void llSetDamage(double damage) { m_LSL_Functions.llSetDamage(damage); } | 890 | |
302 | public void llTeleportAgentHome(string agent) { m_LSL_Functions.llTeleportAgentHome(agent); } | 891 | public void llGiveInventory(string destination, string inventory) |
303 | public void llModifyLand(int action, int brush) { m_LSL_Functions.llModifyLand(action, brush); } | 892 | { |
304 | public void llCollisionSound(string impact_sound, double impact_volume) { m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); } | 893 | m_LSL_Functions.llGiveInventory(destination, inventory); |
305 | public void llCollisionSprite(string impact_sprite) { m_LSL_Functions.llCollisionSprite(impact_sprite); } | 894 | } |
306 | public string llGetAnimation(string id) { return m_LSL_Functions.llGetAnimation(id); } | 895 | |
307 | public void llResetScript() { m_LSL_Functions.llResetScript(); } | 896 | public void llRemoveInventory(string item) |
308 | public void llMessageLinked(int linknum, int num, string str, string id) { m_LSL_Functions.llMessageLinked(linknum, num, str, id); } | 897 | { |
309 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); } | 898 | m_LSL_Functions.llRemoveInventory(item); |
310 | public void llPassCollisions(int pass) { m_LSL_Functions.llPassCollisions(pass); } | 899 | } |
311 | public string llGetScriptName() { return m_LSL_Functions.llGetScriptName(); } | 900 | |
312 | public int llGetNumberOfSides() { return m_LSL_Functions.llGetNumberOfSides(); } | 901 | public void llSetText(string text, vector color, double alpha) |
902 | { | ||
903 | m_LSL_Functions.llSetText(text, color, alpha); | ||
904 | } | ||
905 | |||
906 | public double llWater(vector offset) | ||
907 | { | ||
908 | return m_LSL_Functions.llWater(offset); | ||
909 | } | ||
910 | |||
911 | public void llPassTouches(int pass) | ||
912 | { | ||
913 | m_LSL_Functions.llPassTouches(pass); | ||
914 | } | ||
915 | |||
916 | public string llRequestAgentData(string id, int data) | ||
917 | { | ||
918 | return m_LSL_Functions.llRequestAgentData(id, data); | ||
919 | } | ||
920 | |||
921 | public string llRequestInventoryData(string name) | ||
922 | { | ||
923 | return m_LSL_Functions.llRequestInventoryData(name); | ||
924 | } | ||
925 | |||
926 | public void llSetDamage(double damage) | ||
927 | { | ||
928 | m_LSL_Functions.llSetDamage(damage); | ||
929 | } | ||
930 | |||
931 | public void llTeleportAgentHome(string agent) | ||
932 | { | ||
933 | m_LSL_Functions.llTeleportAgentHome(agent); | ||
934 | } | ||
935 | |||
936 | public void llModifyLand(int action, int brush) | ||
937 | { | ||
938 | m_LSL_Functions.llModifyLand(action, brush); | ||
939 | } | ||
940 | |||
941 | public void llCollisionSound(string impact_sound, double impact_volume) | ||
942 | { | ||
943 | m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); | ||
944 | } | ||
945 | |||
946 | public void llCollisionSprite(string impact_sprite) | ||
947 | { | ||
948 | m_LSL_Functions.llCollisionSprite(impact_sprite); | ||
949 | } | ||
950 | |||
951 | public string llGetAnimation(string id) | ||
952 | { | ||
953 | return m_LSL_Functions.llGetAnimation(id); | ||
954 | } | ||
955 | |||
956 | public void llResetScript() | ||
957 | { | ||
958 | m_LSL_Functions.llResetScript(); | ||
959 | } | ||
960 | |||
961 | public void llMessageLinked(int linknum, int num, string str, string id) | ||
962 | { | ||
963 | m_LSL_Functions.llMessageLinked(linknum, num, str, id); | ||
964 | } | ||
965 | |||
966 | public void llPushObject(string target, vector impulse, vector ang_impulse, int local) | ||
967 | { | ||
968 | m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); | ||
969 | } | ||
970 | |||
971 | public void llPassCollisions(int pass) | ||
972 | { | ||
973 | m_LSL_Functions.llPassCollisions(pass); | ||
974 | } | ||
975 | |||
976 | public string llGetScriptName() | ||
977 | { | ||
978 | return m_LSL_Functions.llGetScriptName(); | ||
979 | } | ||
980 | |||
981 | public int llGetNumberOfSides() | ||
982 | { | ||
983 | return m_LSL_Functions.llGetNumberOfSides(); | ||
984 | } | ||
985 | |||
313 | // | 986 | // |
314 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 987 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
315 | // | 988 | // |
316 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return m_LSL_Functions.llAxisAngle2Rot(axis, angle); } | 989 | public rotation llAxisAngle2Rot(vector axis, double angle) |
317 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return m_LSL_Functions.llRot2Axis(rot); } | 990 | { |
318 | public void llRot2Angle() { m_LSL_Functions.llRot2Angle(); } | 991 | return m_LSL_Functions.llAxisAngle2Rot(axis, angle); |
319 | public double llAcos(double val) { return m_LSL_Functions.llAcos(val); } | 992 | } |
320 | public double llAsin(double val) { return m_LSL_Functions.llAsin(val); } | 993 | |
321 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return m_LSL_Functions.llAngleBetween(a, b); } | 994 | public vector llRot2Axis(rotation rot) |
322 | public string llGetInventoryKey(string name) { return m_LSL_Functions.llGetInventoryKey(name); } | 995 | { |
323 | public void llAllowInventoryDrop(int add) { m_LSL_Functions.llAllowInventoryDrop(add); } | 996 | return m_LSL_Functions.llRot2Axis(rot); |
324 | public LSL_Types.Vector3 llGetSunDirection() { return m_LSL_Functions.llGetSunDirection(); } | 997 | } |
325 | public LSL_Types.Vector3 llGetTextureOffset(int face) { return m_LSL_Functions.llGetTextureOffset(face); } | 998 | |
326 | public LSL_Types.Vector3 llGetTextureScale(int side) { return m_LSL_Functions.llGetTextureScale(side); } | 999 | public void llRot2Angle() |
327 | public double llGetTextureRot(int side) { return m_LSL_Functions.llGetTextureRot(side); } | 1000 | { |
328 | public int llSubStringIndex(string source, string pattern) { return m_LSL_Functions.llSubStringIndex(source, pattern); } | 1001 | m_LSL_Functions.llRot2Angle(); |
329 | public string llGetOwnerKey(string id) { return m_LSL_Functions.llGetOwnerKey(id); } | 1002 | } |
330 | public LSL_Types.Vector3 llGetCenterOfMass() { return m_LSL_Functions.llGetCenterOfMass(); } | 1003 | |
331 | public List<string> llListSort(List<string> src, int stride, int ascending) { return m_LSL_Functions.llListSort(src, stride, ascending); } | 1004 | public double llAcos(double val) |
332 | public int llGetListLength(List<string> src) { return m_LSL_Functions.llGetListLength(src); } | 1005 | { |
1006 | return m_LSL_Functions.llAcos(val); | ||
1007 | } | ||
1008 | |||
1009 | public double llAsin(double val) | ||
1010 | { | ||
1011 | return m_LSL_Functions.llAsin(val); | ||
1012 | } | ||
1013 | |||
1014 | public double llAngleBetween(rotation a, rotation b) | ||
1015 | { | ||
1016 | return m_LSL_Functions.llAngleBetween(a, b); | ||
1017 | } | ||
1018 | |||
1019 | public string llGetInventoryKey(string name) | ||
1020 | { | ||
1021 | return m_LSL_Functions.llGetInventoryKey(name); | ||
1022 | } | ||
1023 | |||
1024 | public void llAllowInventoryDrop(int add) | ||
1025 | { | ||
1026 | m_LSL_Functions.llAllowInventoryDrop(add); | ||
1027 | } | ||
1028 | |||
1029 | public vector llGetSunDirection() | ||
1030 | { | ||
1031 | return m_LSL_Functions.llGetSunDirection(); | ||
1032 | } | ||
1033 | |||
1034 | public vector llGetTextureOffset(int face) | ||
1035 | { | ||
1036 | return m_LSL_Functions.llGetTextureOffset(face); | ||
1037 | } | ||
1038 | |||
1039 | public vector llGetTextureScale(int side) | ||
1040 | { | ||
1041 | return m_LSL_Functions.llGetTextureScale(side); | ||
1042 | } | ||
1043 | |||
1044 | public double llGetTextureRot(int side) | ||
1045 | { | ||
1046 | return m_LSL_Functions.llGetTextureRot(side); | ||
1047 | } | ||
1048 | |||
1049 | public int llSubStringIndex(string source, string pattern) | ||
1050 | { | ||
1051 | return m_LSL_Functions.llSubStringIndex(source, pattern); | ||
1052 | } | ||
1053 | |||
1054 | public string llGetOwnerKey(string id) | ||
1055 | { | ||
1056 | return m_LSL_Functions.llGetOwnerKey(id); | ||
1057 | } | ||
1058 | |||
1059 | public vector llGetCenterOfMass() | ||
1060 | { | ||
1061 | return m_LSL_Functions.llGetCenterOfMass(); | ||
1062 | } | ||
1063 | |||
1064 | public List<string> llListSort(List<string> src, int stride, int ascending) | ||
1065 | { | ||
1066 | return m_LSL_Functions.llListSort(src, stride, ascending); | ||
1067 | } | ||
1068 | |||
1069 | public int llGetListLength(List<string> src) | ||
1070 | { | ||
1071 | return m_LSL_Functions.llGetListLength(src); | ||
1072 | } | ||
1073 | |||
333 | // | 1074 | // |
334 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1075 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
335 | // | 1076 | // |
336 | public int llList2Integer(List<string> src, int index) { return m_LSL_Functions.llList2Integer(src, index); } | 1077 | public int llList2Integer(List<string> src, int index) |
337 | public double llList2double(List<string> src, int index) { return m_LSL_Functions.llList2double(src, index); } | 1078 | { |
338 | public string llList2String(List<string> src, int index) { return m_LSL_Functions.llList2String(src, index); } | 1079 | return m_LSL_Functions.llList2Integer(src, index); |
339 | public string llList2Key(List<string> src, int index) { return m_LSL_Functions.llList2Key(src, index); } | 1080 | } |
340 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) { return m_LSL_Functions.llList2Vector(src, index); } | 1081 | |
341 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { return m_LSL_Functions.llList2Rot(src, index); } | 1082 | public double llList2double(List<string> src, int index) |
342 | public List<string> llList2List(List<string> src, int start, int end) { return m_LSL_Functions.llList2List(src, start, end); } | 1083 | { |
343 | public List<string> llDeleteSubList(List<string> src, int start, int end) { return m_LSL_Functions.llDeleteSubList(src, start, end); } | 1084 | return m_LSL_Functions.llList2double(src, index); |
344 | public int llGetListEntryType(List<string> src, int index) { return m_LSL_Functions.llGetListEntryType(src, index); } | 1085 | } |
345 | public string llList2CSV(List<string> src) { return m_LSL_Functions.llList2CSV(src); } | 1086 | |
346 | public List<string> llCSV2List(string src) { return m_LSL_Functions.llCSV2List(src); } | 1087 | public string llList2String(List<string> src, int index) |
347 | public List<string> llListRandomize(List<string> src, int stride) { return m_LSL_Functions.llListRandomize(src, stride); } | 1088 | { |
348 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { return m_LSL_Functions.llList2ListStrided(src, start, end, stride); } | 1089 | return m_LSL_Functions.llList2String(src, index); |
349 | public LSL_Types.Vector3 llGetRegionCorner() { return m_LSL_Functions.llGetRegionCorner(); } | 1090 | } |
350 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) { return m_LSL_Functions.llListInsertList(dest, src, start); } | 1091 | |
351 | public int llListFindList(List<string> src, List<string> test) { return m_LSL_Functions.llListFindList(src, test); } | 1092 | public string llList2Key(List<string> src, int index) |
352 | public string llGetObjectName() { return m_LSL_Functions.llGetObjectName(); } | 1093 | { |
353 | public void llSetObjectName(string name) { m_LSL_Functions.llSetObjectName(name); } | 1094 | return m_LSL_Functions.llList2Key(src, index); |
354 | public string llGetDate() { return m_LSL_Functions.llGetDate(); } | 1095 | } |
355 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return m_LSL_Functions.llEdgeOfWorld(pos, dir); } | 1096 | |
356 | public int llGetAgentInfo(string id) { return m_LSL_Functions.llGetAgentInfo(id); } | 1097 | public vector llList2Vector(List<string> src, int index) |
1098 | { | ||
1099 | return m_LSL_Functions.llList2Vector(src, index); | ||
1100 | } | ||
1101 | |||
1102 | public rotation llList2Rot(List<string> src, int index) | ||
1103 | { | ||
1104 | return m_LSL_Functions.llList2Rot(src, index); | ||
1105 | } | ||
1106 | |||
1107 | public List<string> llList2List(List<string> src, int start, int end) | ||
1108 | { | ||
1109 | return m_LSL_Functions.llList2List(src, start, end); | ||
1110 | } | ||
1111 | |||
1112 | public List<string> llDeleteSubList(List<string> src, int start, int end) | ||
1113 | { | ||
1114 | return m_LSL_Functions.llDeleteSubList(src, start, end); | ||
1115 | } | ||
1116 | |||
1117 | public int llGetListEntryType(List<string> src, int index) | ||
1118 | { | ||
1119 | return m_LSL_Functions.llGetListEntryType(src, index); | ||
1120 | } | ||
1121 | |||
1122 | public string llList2CSV(List<string> src) | ||
1123 | { | ||
1124 | return m_LSL_Functions.llList2CSV(src); | ||
1125 | } | ||
1126 | |||
1127 | public List<string> llCSV2List(string src) | ||
1128 | { | ||
1129 | return m_LSL_Functions.llCSV2List(src); | ||
1130 | } | ||
1131 | |||
1132 | public List<string> llListRandomize(List<string> src, int stride) | ||
1133 | { | ||
1134 | return m_LSL_Functions.llListRandomize(src, stride); | ||
1135 | } | ||
1136 | |||
1137 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | ||
1138 | { | ||
1139 | return m_LSL_Functions.llList2ListStrided(src, start, end, stride); | ||
1140 | } | ||
1141 | |||
1142 | public vector llGetRegionCorner() | ||
1143 | { | ||
1144 | return m_LSL_Functions.llGetRegionCorner(); | ||
1145 | } | ||
1146 | |||
1147 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) | ||
1148 | { | ||
1149 | return m_LSL_Functions.llListInsertList(dest, src, start); | ||
1150 | } | ||
1151 | |||
1152 | public int llListFindList(List<string> src, List<string> test) | ||
1153 | { | ||
1154 | return m_LSL_Functions.llListFindList(src, test); | ||
1155 | } | ||
1156 | |||
1157 | public string llGetObjectName() | ||
1158 | { | ||
1159 | return m_LSL_Functions.llGetObjectName(); | ||
1160 | } | ||
1161 | |||
1162 | public void llSetObjectName(string name) | ||
1163 | { | ||
1164 | m_LSL_Functions.llSetObjectName(name); | ||
1165 | } | ||
1166 | |||
1167 | public string llGetDate() | ||
1168 | { | ||
1169 | return m_LSL_Functions.llGetDate(); | ||
1170 | } | ||
1171 | |||
1172 | public int llEdgeOfWorld(vector pos, vector dir) | ||
1173 | { | ||
1174 | return m_LSL_Functions.llEdgeOfWorld(pos, dir); | ||
1175 | } | ||
1176 | |||
1177 | public int llGetAgentInfo(string id) | ||
1178 | { | ||
1179 | return m_LSL_Functions.llGetAgentInfo(id); | ||
1180 | } | ||
1181 | |||
357 | // | 1182 | // |
358 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1183 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
359 | // | 1184 | // |
360 | public void llAdjustSoundVolume(double volume) { m_LSL_Functions.llAdjustSoundVolume(volume); } | 1185 | public void llAdjustSoundVolume(double volume) |
361 | public void llSetSoundQueueing(int queue) { m_LSL_Functions.llSetSoundQueueing(queue); } | 1186 | { |
362 | public void llSetSoundRadius(double radius) { m_LSL_Functions.llSetSoundRadius(radius); } | 1187 | m_LSL_Functions.llAdjustSoundVolume(volume); |
363 | public string llKey2Name(string id) { return m_LSL_Functions.llKey2Name(id); } | 1188 | } |
364 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); } | 1189 | |
365 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); } | 1190 | public void llSetSoundQueueing(int queue) |
366 | public void llEjectFromLand(string pest) { m_LSL_Functions.llEjectFromLand(pest); } | 1191 | { |
367 | public void llParseString2List() { m_LSL_Functions.llParseString2List(); } | 1192 | m_LSL_Functions.llSetSoundQueueing(queue); |
368 | public int llOverMyLand(string id) { return m_LSL_Functions.llOverMyLand(id); } | 1193 | } |
369 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetLandOwnerAt(pos); } | 1194 | |
370 | public string llGetNotecardLine(string name, int line) { return m_LSL_Functions.llGetNotecardLine(name, line); } | 1195 | public void llSetSoundRadius(double radius) |
371 | public LSL_Types.Vector3 llGetAgentSize(string id) { return m_LSL_Functions.llGetAgentSize(id); } | 1196 | { |
372 | public int llSameGroup(string agent) { return m_LSL_Functions.llSameGroup(agent); } | 1197 | m_LSL_Functions.llSetSoundRadius(radius); |
373 | public void llUnSit(string id) { m_LSL_Functions.llUnSit(id); } | 1198 | } |
374 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundSlope(offset); } | 1199 | |
375 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundNormal(offset); } | 1200 | public string llKey2Name(string id) |
376 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundContour(offset); } | 1201 | { |
377 | public int llGetAttached() { return m_LSL_Functions.llGetAttached(); } | 1202 | return m_LSL_Functions.llKey2Name(id); |
378 | public int llGetFreeMemory() { return m_LSL_Functions.llGetFreeMemory(); } | 1203 | } |
379 | public string llGetRegionName() { return m_LSL_Functions.llGetRegionName(); } | 1204 | |
380 | public double llGetRegionTimeDilation() { return m_LSL_Functions.llGetRegionTimeDilation(); } | 1205 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) |
381 | public double llGetRegionFPS() { return m_LSL_Functions.llGetRegionFPS(); } | 1206 | { |
1207 | m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); | ||
1208 | } | ||
1209 | |||
1210 | public void llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) | ||
1211 | { | ||
1212 | m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); | ||
1213 | } | ||
1214 | |||
1215 | public void llEjectFromLand(string pest) | ||
1216 | { | ||
1217 | m_LSL_Functions.llEjectFromLand(pest); | ||
1218 | } | ||
1219 | |||
1220 | public void llParseString2List() | ||
1221 | { | ||
1222 | m_LSL_Functions.llParseString2List(); | ||
1223 | } | ||
1224 | |||
1225 | public int llOverMyLand(string id) | ||
1226 | { | ||
1227 | return m_LSL_Functions.llOverMyLand(id); | ||
1228 | } | ||
1229 | |||
1230 | public string llGetLandOwnerAt(vector pos) | ||
1231 | { | ||
1232 | return m_LSL_Functions.llGetLandOwnerAt(pos); | ||
1233 | } | ||
1234 | |||
1235 | public string llGetNotecardLine(string name, int line) | ||
1236 | { | ||
1237 | return m_LSL_Functions.llGetNotecardLine(name, line); | ||
1238 | } | ||
1239 | |||
1240 | public vector llGetAgentSize(string id) | ||
1241 | { | ||
1242 | return m_LSL_Functions.llGetAgentSize(id); | ||
1243 | } | ||
1244 | |||
1245 | public int llSameGroup(string agent) | ||
1246 | { | ||
1247 | return m_LSL_Functions.llSameGroup(agent); | ||
1248 | } | ||
1249 | |||
1250 | public void llUnSit(string id) | ||
1251 | { | ||
1252 | m_LSL_Functions.llUnSit(id); | ||
1253 | } | ||
1254 | |||
1255 | public vector llGroundSlope(vector offset) | ||
1256 | { | ||
1257 | return m_LSL_Functions.llGroundSlope(offset); | ||
1258 | } | ||
1259 | |||
1260 | public vector llGroundNormal(vector offset) | ||
1261 | { | ||
1262 | return m_LSL_Functions.llGroundNormal(offset); | ||
1263 | } | ||
1264 | |||
1265 | public vector llGroundContour(vector offset) | ||
1266 | { | ||
1267 | return m_LSL_Functions.llGroundContour(offset); | ||
1268 | } | ||
1269 | |||
1270 | public int llGetAttached() | ||
1271 | { | ||
1272 | return m_LSL_Functions.llGetAttached(); | ||
1273 | } | ||
1274 | |||
1275 | public int llGetFreeMemory() | ||
1276 | { | ||
1277 | return m_LSL_Functions.llGetFreeMemory(); | ||
1278 | } | ||
1279 | |||
1280 | public string llGetRegionName() | ||
1281 | { | ||
1282 | return m_LSL_Functions.llGetRegionName(); | ||
1283 | } | ||
1284 | |||
1285 | public double llGetRegionTimeDilation() | ||
1286 | { | ||
1287 | return m_LSL_Functions.llGetRegionTimeDilation(); | ||
1288 | } | ||
1289 | |||
1290 | public double llGetRegionFPS() | ||
1291 | { | ||
1292 | return m_LSL_Functions.llGetRegionFPS(); | ||
1293 | } | ||
1294 | |||
382 | // | 1295 | // |
383 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1296 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
384 | // | 1297 | // |
385 | public void llParticleSystem(List<Object> rules) { m_LSL_Functions.llParticleSystem(rules); } | 1298 | public void llParticleSystem(List<Object> rules) |
386 | public void llGroundRepel(double height, int water, double tau) { m_LSL_Functions.llGroundRepel(height, water, tau); } | 1299 | { |
387 | public void llGiveInventoryList() { m_LSL_Functions.llGiveInventoryList(); } | 1300 | m_LSL_Functions.llParticleSystem(rules); |
388 | public void llSetVehicleType(int type) { m_LSL_Functions.llSetVehicleType(type); } | 1301 | } |
389 | public void llSetVehicledoubleParam(int param, double value) { m_LSL_Functions.llSetVehicledoubleParam(param, value); } | 1302 | |
390 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { m_LSL_Functions.llSetVehicleVectorParam(param, vec); } | 1303 | public void llGroundRepel(double height, int water, double tau) |
391 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { m_LSL_Functions.llSetVehicleRotationParam(param, rot); } | 1304 | { |
392 | public void llSetVehicleFlags(int flags) { m_LSL_Functions.llSetVehicleFlags(flags); } | 1305 | m_LSL_Functions.llGroundRepel(height, water, tau); |
393 | public void llRemoveVehicleFlags(int flags) { m_LSL_Functions.llRemoveVehicleFlags(flags); } | 1306 | } |
394 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { m_LSL_Functions.llSitTarget(offset, rot); } | 1307 | |
395 | public string llAvatarOnSitTarget() { return m_LSL_Functions.llAvatarOnSitTarget(); } | 1308 | public void llGiveInventoryList() |
396 | public void llAddToLandPassList(string avatar, double hours) { m_LSL_Functions.llAddToLandPassList(avatar, hours); } | 1309 | { |
397 | public void llSetTouchText(string text) { m_LSL_Functions.llSetTouchText(text); } | 1310 | m_LSL_Functions.llGiveInventoryList(); |
398 | public void llSetSitText(string text) { m_LSL_Functions.llSetSitText(text); } | 1311 | } |
399 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraEyeOffset(offset); } | 1312 | |
400 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraAtOffset(offset); } | 1313 | public void llSetVehicleType(int type) |
401 | public void llDumpList2String() { m_LSL_Functions.llDumpList2String(); } | 1314 | { |
402 | public void llScriptDanger(LSL_Types.Vector3 pos) { m_LSL_Functions.llScriptDanger(pos); } | 1315 | m_LSL_Functions.llSetVehicleType(type); |
403 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); } | 1316 | } |
404 | public void llVolumeDetect(int detect) { m_LSL_Functions.llVolumeDetect(detect); } | 1317 | |
405 | public void llResetOtherScript(string name) { m_LSL_Functions.llResetOtherScript(name); } | 1318 | public void llSetVehicledoubleParam(int param, double value) |
406 | public int llGetScriptState(string name) { return m_LSL_Functions.llGetScriptState(name); } | 1319 | { |
407 | public void llRemoteLoadScript() { m_LSL_Functions.llRemoteLoadScript(); } | 1320 | m_LSL_Functions.llSetVehicledoubleParam(param, value); |
408 | public void llSetRemoteScriptAccessPin(int pin) { m_LSL_Functions.llSetRemoteScriptAccessPin(pin); } | 1321 | } |
409 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); } | 1322 | |
1323 | public void llSetVehicleVectorParam(int param, vector vec) | ||
1324 | { | ||
1325 | m_LSL_Functions.llSetVehicleVectorParam(param, vec); | ||
1326 | } | ||
1327 | |||
1328 | public void llSetVehicleRotationParam(int param, rotation rot) | ||
1329 | { | ||
1330 | m_LSL_Functions.llSetVehicleRotationParam(param, rot); | ||
1331 | } | ||
1332 | |||
1333 | public void llSetVehicleFlags(int flags) | ||
1334 | { | ||
1335 | m_LSL_Functions.llSetVehicleFlags(flags); | ||
1336 | } | ||
1337 | |||
1338 | public void llRemoveVehicleFlags(int flags) | ||
1339 | { | ||
1340 | m_LSL_Functions.llRemoveVehicleFlags(flags); | ||
1341 | } | ||
1342 | |||
1343 | public void llSitTarget(vector offset, rotation rot) | ||
1344 | { | ||
1345 | m_LSL_Functions.llSitTarget(offset, rot); | ||
1346 | } | ||
1347 | |||
1348 | public string llAvatarOnSitTarget() | ||
1349 | { | ||
1350 | return m_LSL_Functions.llAvatarOnSitTarget(); | ||
1351 | } | ||
1352 | |||
1353 | public void llAddToLandPassList(string avatar, double hours) | ||
1354 | { | ||
1355 | m_LSL_Functions.llAddToLandPassList(avatar, hours); | ||
1356 | } | ||
1357 | |||
1358 | public void llSetTouchText(string text) | ||
1359 | { | ||
1360 | m_LSL_Functions.llSetTouchText(text); | ||
1361 | } | ||
1362 | |||
1363 | public void llSetSitText(string text) | ||
1364 | { | ||
1365 | m_LSL_Functions.llSetSitText(text); | ||
1366 | } | ||
1367 | |||
1368 | public void llSetCameraEyeOffset(vector offset) | ||
1369 | { | ||
1370 | m_LSL_Functions.llSetCameraEyeOffset(offset); | ||
1371 | } | ||
1372 | |||
1373 | public void llSetCameraAtOffset(vector offset) | ||
1374 | { | ||
1375 | m_LSL_Functions.llSetCameraAtOffset(offset); | ||
1376 | } | ||
1377 | |||
1378 | public void llDumpList2String() | ||
1379 | { | ||
1380 | m_LSL_Functions.llDumpList2String(); | ||
1381 | } | ||
1382 | |||
1383 | public void llScriptDanger(vector pos) | ||
1384 | { | ||
1385 | m_LSL_Functions.llScriptDanger(pos); | ||
1386 | } | ||
1387 | |||
1388 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) | ||
1389 | { | ||
1390 | m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); | ||
1391 | } | ||
1392 | |||
1393 | public void llVolumeDetect(int detect) | ||
1394 | { | ||
1395 | m_LSL_Functions.llVolumeDetect(detect); | ||
1396 | } | ||
1397 | |||
1398 | public void llResetOtherScript(string name) | ||
1399 | { | ||
1400 | m_LSL_Functions.llResetOtherScript(name); | ||
1401 | } | ||
1402 | |||
1403 | public int llGetScriptState(string name) | ||
1404 | { | ||
1405 | return m_LSL_Functions.llGetScriptState(name); | ||
1406 | } | ||
1407 | |||
1408 | public void llRemoteLoadScript() | ||
1409 | { | ||
1410 | m_LSL_Functions.llRemoteLoadScript(); | ||
1411 | } | ||
1412 | |||
1413 | public void llSetRemoteScriptAccessPin(int pin) | ||
1414 | { | ||
1415 | m_LSL_Functions.llSetRemoteScriptAccessPin(pin); | ||
1416 | } | ||
1417 | |||
1418 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) | ||
1419 | { | ||
1420 | m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); | ||
1421 | } | ||
1422 | |||
410 | // | 1423 | // |
411 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1424 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
412 | // | 1425 | // |
413 | public void llOpenRemoteDataChannel() { m_LSL_Functions.llOpenRemoteDataChannel(); } | 1426 | public void llOpenRemoteDataChannel() |
414 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); } | 1427 | { |
415 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); } | 1428 | m_LSL_Functions.llOpenRemoteDataChannel(); |
416 | public void llCloseRemoteDataChannel(string channel) { m_LSL_Functions.llCloseRemoteDataChannel(channel); } | 1429 | } |
417 | public string llMD5String(string src, int nonce) { return m_LSL_Functions.llMD5String(src, nonce); } | 1430 | |
418 | public void llSetPrimitiveParams(List<string> rules) { m_LSL_Functions.llSetPrimitiveParams(rules); } | 1431 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) |
419 | public string llStringToBase64(string str) { return m_LSL_Functions.llStringToBase64(str); } | 1432 | { |
420 | public string llBase64ToString(string str) { return m_LSL_Functions.llBase64ToString(str); } | 1433 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
421 | public void llXorBase64Strings() { m_LSL_Functions.llXorBase64Strings(); } | 1434 | } |
422 | public void llRemoteDataSetRegion() { m_LSL_Functions.llRemoteDataSetRegion(); } | 1435 | |
423 | public double llLog10(double val) { return m_LSL_Functions.llLog10(val); } | 1436 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
424 | public double llLog(double val) { return m_LSL_Functions.llLog(val); } | 1437 | { |
425 | public List<string> llGetAnimationList(string id) { return m_LSL_Functions.llGetAnimationList(id); } | 1438 | m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); |
426 | public void llSetParcelMusicURL(string url) { m_LSL_Functions.llSetParcelMusicURL(url); } | 1439 | } |
427 | public LSL_Types.Vector3 llGetRootPosition() { return m_LSL_Functions.llGetRootPosition(); } | 1440 | |
428 | public LSL_Types.Quaternion llGetRootRotation() { return m_LSL_Functions.llGetRootRotation(); } | 1441 | public void llCloseRemoteDataChannel(string channel) |
429 | public string llGetObjectDesc() { return m_LSL_Functions.llGetObjectDesc(); } | 1442 | { |
430 | public void llSetObjectDesc(string desc) { m_LSL_Functions.llSetObjectDesc(desc); } | 1443 | m_LSL_Functions.llCloseRemoteDataChannel(channel); |
431 | public string llGetCreator() { return m_LSL_Functions.llGetCreator(); } | 1444 | } |
432 | public string llGetTimestamp() { return m_LSL_Functions.llGetTimestamp(); } | 1445 | |
433 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); } | 1446 | public string llMD5String(string src, int nonce) |
434 | public int llGetNumberOfPrims() { return m_LSL_Functions.llGetNumberOfPrims(); } | 1447 | { |
435 | public string llGetNumberOfNotecardLines(string name) { return m_LSL_Functions.llGetNumberOfNotecardLines(name); } | 1448 | return m_LSL_Functions.llMD5String(src, nonce); |
436 | public List<string> llGetBoundingBox(string obj) { return m_LSL_Functions.llGetBoundingBox(obj); } | 1449 | } |
437 | public LSL_Types.Vector3 llGetGeometricCenter() { return m_LSL_Functions.llGetGeometricCenter(); } | 1450 | |
438 | public void llGetPrimitiveParams() { m_LSL_Functions.llGetPrimitiveParams(); } | 1451 | public void llSetPrimitiveParams(List<string> rules) |
1452 | { | ||
1453 | m_LSL_Functions.llSetPrimitiveParams(rules); | ||
1454 | } | ||
1455 | |||
1456 | public string llStringToBase64(string str) | ||
1457 | { | ||
1458 | return m_LSL_Functions.llStringToBase64(str); | ||
1459 | } | ||
1460 | |||
1461 | public string llBase64ToString(string str) | ||
1462 | { | ||
1463 | return m_LSL_Functions.llBase64ToString(str); | ||
1464 | } | ||
1465 | |||
1466 | public void llXorBase64Strings() | ||
1467 | { | ||
1468 | m_LSL_Functions.llXorBase64Strings(); | ||
1469 | } | ||
1470 | |||
1471 | public void llRemoteDataSetRegion() | ||
1472 | { | ||
1473 | m_LSL_Functions.llRemoteDataSetRegion(); | ||
1474 | } | ||
1475 | |||
1476 | public double llLog10(double val) | ||
1477 | { | ||
1478 | return m_LSL_Functions.llLog10(val); | ||
1479 | } | ||
1480 | |||
1481 | public double llLog(double val) | ||
1482 | { | ||
1483 | return m_LSL_Functions.llLog(val); | ||
1484 | } | ||
1485 | |||
1486 | public List<string> llGetAnimationList(string id) | ||
1487 | { | ||
1488 | return m_LSL_Functions.llGetAnimationList(id); | ||
1489 | } | ||
1490 | |||
1491 | public void llSetParcelMusicURL(string url) | ||
1492 | { | ||
1493 | m_LSL_Functions.llSetParcelMusicURL(url); | ||
1494 | } | ||
1495 | |||
1496 | public vector llGetRootPosition() | ||
1497 | { | ||
1498 | return m_LSL_Functions.llGetRootPosition(); | ||
1499 | } | ||
1500 | |||
1501 | public rotation llGetRootRotation() | ||
1502 | { | ||
1503 | return m_LSL_Functions.llGetRootRotation(); | ||
1504 | } | ||
1505 | |||
1506 | public string llGetObjectDesc() | ||
1507 | { | ||
1508 | return m_LSL_Functions.llGetObjectDesc(); | ||
1509 | } | ||
1510 | |||
1511 | public void llSetObjectDesc(string desc) | ||
1512 | { | ||
1513 | m_LSL_Functions.llSetObjectDesc(desc); | ||
1514 | } | ||
1515 | |||
1516 | public string llGetCreator() | ||
1517 | { | ||
1518 | return m_LSL_Functions.llGetCreator(); | ||
1519 | } | ||
1520 | |||
1521 | public string llGetTimestamp() | ||
1522 | { | ||
1523 | return m_LSL_Functions.llGetTimestamp(); | ||
1524 | } | ||
1525 | |||
1526 | public void llSetLinkAlpha(int linknumber, double alpha, int face) | ||
1527 | { | ||
1528 | m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); | ||
1529 | } | ||
1530 | |||
1531 | public int llGetNumberOfPrims() | ||
1532 | { | ||
1533 | return m_LSL_Functions.llGetNumberOfPrims(); | ||
1534 | } | ||
1535 | |||
1536 | public string llGetNumberOfNotecardLines(string name) | ||
1537 | { | ||
1538 | return m_LSL_Functions.llGetNumberOfNotecardLines(name); | ||
1539 | } | ||
1540 | |||
1541 | public List<string> llGetBoundingBox(string obj) | ||
1542 | { | ||
1543 | return m_LSL_Functions.llGetBoundingBox(obj); | ||
1544 | } | ||
1545 | |||
1546 | public vector llGetGeometricCenter() | ||
1547 | { | ||
1548 | return m_LSL_Functions.llGetGeometricCenter(); | ||
1549 | } | ||
1550 | |||
1551 | public void llGetPrimitiveParams() | ||
1552 | { | ||
1553 | m_LSL_Functions.llGetPrimitiveParams(); | ||
1554 | } | ||
1555 | |||
439 | // | 1556 | // |
440 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1557 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
441 | // | 1558 | // |
442 | public string llIntegerToBase64(int number) { return m_LSL_Functions.llIntegerToBase64(number); } | 1559 | public string llIntegerToBase64(int number) |
443 | public int llBase64ToInteger(string str) { return m_LSL_Functions.llBase64ToInteger(str); } | 1560 | { |
444 | public double llGetGMTclock() { return m_LSL_Functions.llGetGMTclock(); } | 1561 | return m_LSL_Functions.llIntegerToBase64(number); |
445 | public string llGetSimulatorHostname() { return m_LSL_Functions.llGetSimulatorHostname(); } | 1562 | } |
446 | public void llSetLocalRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetLocalRot(rot); } | 1563 | |
447 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); } | 1564 | public int llBase64ToInteger(string str) |
448 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); } | 1565 | { |
449 | public int llGetObjectPermMask(int mask) { return m_LSL_Functions.llGetObjectPermMask(mask); } | 1566 | return m_LSL_Functions.llBase64ToInteger(str); |
450 | public void llSetObjectPermMask(int mask, int value) { m_LSL_Functions.llSetObjectPermMask(mask, value); } | 1567 | } |
451 | public void llGetInventoryPermMask(string item, int mask) { m_LSL_Functions.llGetInventoryPermMask(item, mask); } | 1568 | |
452 | public void llSetInventoryPermMask(string item, int mask, int value) { m_LSL_Functions.llSetInventoryPermMask(item, mask, value); } | 1569 | public double llGetGMTclock() |
453 | public string llGetInventoryCreator(string item) { return m_LSL_Functions.llGetInventoryCreator(item); } | 1570 | { |
454 | public void llOwnerSay(string msg) { m_LSL_Functions.llOwnerSay(msg); } | 1571 | return m_LSL_Functions.llGetGMTclock(); |
455 | public void llRequestSimulatorData(string simulator, int data) { m_LSL_Functions.llRequestSimulatorData(simulator, data); } | 1572 | } |
456 | public void llForceMouselook(int mouselook) { m_LSL_Functions.llForceMouselook(mouselook); } | 1573 | |
457 | public double llGetObjectMass(string id) { return m_LSL_Functions.llGetObjectMass(id); } | 1574 | public string llGetSimulatorHostname() |
458 | public void llListReplaceList() { m_LSL_Functions.llListReplaceList(); } | 1575 | { |
459 | public void llLoadURL(string avatar_id, string message, string url) { m_LSL_Functions.llLoadURL(avatar_id, message, url); } | 1576 | return m_LSL_Functions.llGetSimulatorHostname(); |
460 | public void llParcelMediaCommandList(List<string> commandList) { m_LSL_Functions.llParcelMediaCommandList(commandList); } | 1577 | } |
461 | public void llParcelMediaQuery() { m_LSL_Functions.llParcelMediaQuery(); } | 1578 | |
462 | public int llModPow(int a, int b, int c) { return m_LSL_Functions.llModPow(a, b, c); } | 1579 | public void llSetLocalRot(rotation rot) |
1580 | { | ||
1581 | m_LSL_Functions.llSetLocalRot(rot); | ||
1582 | } | ||
1583 | |||
1584 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) | ||
1585 | { | ||
1586 | return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); | ||
1587 | } | ||
1588 | |||
1589 | public void llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, int param) | ||
1590 | { | ||
1591 | m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); | ||
1592 | } | ||
1593 | |||
1594 | public int llGetObjectPermMask(int mask) | ||
1595 | { | ||
1596 | return m_LSL_Functions.llGetObjectPermMask(mask); | ||
1597 | } | ||
1598 | |||
1599 | public void llSetObjectPermMask(int mask, int value) | ||
1600 | { | ||
1601 | m_LSL_Functions.llSetObjectPermMask(mask, value); | ||
1602 | } | ||
1603 | |||
1604 | public void llGetInventoryPermMask(string item, int mask) | ||
1605 | { | ||
1606 | m_LSL_Functions.llGetInventoryPermMask(item, mask); | ||
1607 | } | ||
1608 | |||
1609 | public void llSetInventoryPermMask(string item, int mask, int value) | ||
1610 | { | ||
1611 | m_LSL_Functions.llSetInventoryPermMask(item, mask, value); | ||
1612 | } | ||
1613 | |||
1614 | public string llGetInventoryCreator(string item) | ||
1615 | { | ||
1616 | return m_LSL_Functions.llGetInventoryCreator(item); | ||
1617 | } | ||
1618 | |||
1619 | public void llOwnerSay(string msg) | ||
1620 | { | ||
1621 | m_LSL_Functions.llOwnerSay(msg); | ||
1622 | } | ||
1623 | |||
1624 | public void llRequestSimulatorData(string simulator, int data) | ||
1625 | { | ||
1626 | m_LSL_Functions.llRequestSimulatorData(simulator, data); | ||
1627 | } | ||
1628 | |||
1629 | public void llForceMouselook(int mouselook) | ||
1630 | { | ||
1631 | m_LSL_Functions.llForceMouselook(mouselook); | ||
1632 | } | ||
1633 | |||
1634 | public double llGetObjectMass(string id) | ||
1635 | { | ||
1636 | return m_LSL_Functions.llGetObjectMass(id); | ||
1637 | } | ||
1638 | |||
1639 | public void llListReplaceList() | ||
1640 | { | ||
1641 | m_LSL_Functions.llListReplaceList(); | ||
1642 | } | ||
1643 | |||
1644 | public void llLoadURL(string avatar_id, string message, string url) | ||
1645 | { | ||
1646 | m_LSL_Functions.llLoadURL(avatar_id, message, url); | ||
1647 | } | ||
1648 | |||
1649 | public void llParcelMediaCommandList(List<string> commandList) | ||
1650 | { | ||
1651 | m_LSL_Functions.llParcelMediaCommandList(commandList); | ||
1652 | } | ||
1653 | |||
1654 | public void llParcelMediaQuery() | ||
1655 | { | ||
1656 | m_LSL_Functions.llParcelMediaQuery(); | ||
1657 | } | ||
1658 | |||
1659 | public int llModPow(int a, int b, int c) | ||
1660 | { | ||
1661 | return m_LSL_Functions.llModPow(a, b, c); | ||
1662 | } | ||
1663 | |||
463 | // | 1664 | // |
464 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1665 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
465 | // | 1666 | // |
466 | public int llGetInventoryType(string name) { return m_LSL_Functions.llGetInventoryType(name); } | 1667 | public int llGetInventoryType(string name) |
467 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) { m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); } | 1668 | { |
468 | public LSL_Types.Vector3 llGetCameraPos() { return m_LSL_Functions.llGetCameraPos(); } | 1669 | return m_LSL_Functions.llGetInventoryType(name); |
469 | public LSL_Types.Quaternion llGetCameraRot() { return m_LSL_Functions.llGetCameraRot(); } | 1670 | } |
470 | public void llSetPrimURL() { m_LSL_Functions.llSetPrimURL(); } | 1671 | |
471 | public void llRefreshPrimURL() { m_LSL_Functions.llRefreshPrimURL(); } | 1672 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) |
472 | public string llEscapeURL(string url) { return m_LSL_Functions.llEscapeURL(url); } | 1673 | { |
473 | public string llUnescapeURL(string url) { return m_LSL_Functions.llUnescapeURL(url); } | 1674 | m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); |
474 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { m_LSL_Functions.llMapDestination(simname, pos, look_at); } | 1675 | } |
475 | public void llAddToLandBanList(string avatar, double hours) { m_LSL_Functions.llAddToLandBanList(avatar, hours); } | 1676 | |
476 | public void llRemoveFromLandPassList(string avatar) { m_LSL_Functions.llRemoveFromLandPassList(avatar); } | 1677 | public vector llGetCameraPos() |
477 | public void llRemoveFromLandBanList(string avatar) { m_LSL_Functions.llRemoveFromLandBanList(avatar); } | 1678 | { |
478 | public void llSetCameraParams(List<string> rules) { m_LSL_Functions.llSetCameraParams(rules); } | 1679 | return m_LSL_Functions.llGetCameraPos(); |
479 | public void llClearCameraParams() { m_LSL_Functions.llClearCameraParams(); } | 1680 | } |
480 | public double llListStatistics(int operation, List<string> src) { return m_LSL_Functions.llListStatistics(operation, src); } | 1681 | |
481 | public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } | 1682 | public rotation llGetCameraRot() |
482 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } | 1683 | { |
483 | public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } | 1684 | return m_LSL_Functions.llGetCameraRot(); |
484 | public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } | 1685 | } |
485 | public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } | 1686 | |
486 | public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } | 1687 | public void llSetPrimURL() |
487 | public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } | 1688 | { |
488 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } | 1689 | m_LSL_Functions.llSetPrimURL(); |
489 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelPrimOwners(pos); } | 1690 | } |
490 | public int llGetObjectPrimCount(string object_id) { return m_LSL_Functions.llGetObjectPrimCount(object_id); } | 1691 | |
1692 | public void llRefreshPrimURL() | ||
1693 | { | ||
1694 | m_LSL_Functions.llRefreshPrimURL(); | ||
1695 | } | ||
1696 | |||
1697 | public string llEscapeURL(string url) | ||
1698 | { | ||
1699 | return m_LSL_Functions.llEscapeURL(url); | ||
1700 | } | ||
1701 | |||
1702 | public string llUnescapeURL(string url) | ||
1703 | { | ||
1704 | return m_LSL_Functions.llUnescapeURL(url); | ||
1705 | } | ||
1706 | |||
1707 | public void llMapDestination(string simname, vector pos, vector look_at) | ||
1708 | { | ||
1709 | m_LSL_Functions.llMapDestination(simname, pos, look_at); | ||
1710 | } | ||
1711 | |||
1712 | public void llAddToLandBanList(string avatar, double hours) | ||
1713 | { | ||
1714 | m_LSL_Functions.llAddToLandBanList(avatar, hours); | ||
1715 | } | ||
1716 | |||
1717 | public void llRemoveFromLandPassList(string avatar) | ||
1718 | { | ||
1719 | m_LSL_Functions.llRemoveFromLandPassList(avatar); | ||
1720 | } | ||
1721 | |||
1722 | public void llRemoveFromLandBanList(string avatar) | ||
1723 | { | ||
1724 | m_LSL_Functions.llRemoveFromLandBanList(avatar); | ||
1725 | } | ||
1726 | |||
1727 | public void llSetCameraParams(List<string> rules) | ||
1728 | { | ||
1729 | m_LSL_Functions.llSetCameraParams(rules); | ||
1730 | } | ||
1731 | |||
1732 | public void llClearCameraParams() | ||
1733 | { | ||
1734 | m_LSL_Functions.llClearCameraParams(); | ||
1735 | } | ||
1736 | |||
1737 | public double llListStatistics(int operation, List<string> src) | ||
1738 | { | ||
1739 | return m_LSL_Functions.llListStatistics(operation, src); | ||
1740 | } | ||
1741 | |||
1742 | public int llGetUnixTime() | ||
1743 | { | ||
1744 | return m_LSL_Functions.llGetUnixTime(); | ||
1745 | } | ||
1746 | |||
1747 | public int llGetParcelFlags(vector pos) | ||
1748 | { | ||
1749 | return m_LSL_Functions.llGetParcelFlags(pos); | ||
1750 | } | ||
1751 | |||
1752 | public int llGetRegionFlags() | ||
1753 | { | ||
1754 | return m_LSL_Functions.llGetRegionFlags(); | ||
1755 | } | ||
1756 | |||
1757 | public string llXorBase64StringsCorrect(string str1, string str2) | ||
1758 | { | ||
1759 | return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); | ||
1760 | } | ||
1761 | |||
1762 | public void llHTTPRequest(string url, List<string> parameters, string body) | ||
1763 | { | ||
1764 | m_LSL_Functions.llHTTPRequest(url, parameters, body); | ||
1765 | } | ||
1766 | |||
1767 | public void llResetLandBanList() | ||
1768 | { | ||
1769 | m_LSL_Functions.llResetLandBanList(); | ||
1770 | } | ||
1771 | |||
1772 | public void llResetLandPassList() | ||
1773 | { | ||
1774 | m_LSL_Functions.llResetLandPassList(); | ||
1775 | } | ||
1776 | |||
1777 | public int llGetParcelPrimCount(vector pos, int category, int sim_wide) | ||
1778 | { | ||
1779 | return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); | ||
1780 | } | ||
1781 | |||
1782 | public List<string> llGetParcelPrimOwners(vector pos) | ||
1783 | { | ||
1784 | return m_LSL_Functions.llGetParcelPrimOwners(pos); | ||
1785 | } | ||
1786 | |||
1787 | public int llGetObjectPrimCount(string object_id) | ||
1788 | { | ||
1789 | return m_LSL_Functions.llGetObjectPrimCount(object_id); | ||
1790 | } | ||
1791 | |||
491 | // | 1792 | // |
492 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1793 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
493 | // | 1794 | // |
494 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } | 1795 | public int llGetParcelMaxPrims(vector pos, int sim_wide) |
495 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } | 1796 | { |
1797 | return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); | ||
1798 | } | ||
1799 | |||
1800 | public List<string> llGetParcelDetails(vector pos, List<string> param) | ||
1801 | { | ||
1802 | return m_LSL_Functions.llGetParcelDetails(pos, param); | ||
1803 | } | ||
496 | 1804 | ||
497 | // | 1805 | // |
498 | // OpenSim Functions | 1806 | // OpenSim Functions |
499 | // | 1807 | // |
500 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } | 1808 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, |
1809 | int timer) | ||
1810 | { | ||
1811 | return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); | ||
1812 | } | ||
501 | 1813 | ||
502 | // LSL CONSTANTS | 1814 | // LSL CONSTANTS |
503 | public const int TRUE = 1; | 1815 | public const int TRUE = 1; |
@@ -803,10 +2115,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL | |||
803 | public const double SQRT2 = 1.414213538f; | 2115 | public const double SQRT2 = 1.414213538f; |
804 | 2116 | ||
805 | // Can not be public const? | 2117 | // Can not be public const? |
806 | public LSL_Types.Vector3 ZERO_VECTOR = new LSL_Types.Vector3(0, 0, 0); | 2118 | public vector ZERO_VECTOR = new vector(0, 0, 0); |
807 | public LSL_Types.Quaternion ZERO_ROTATION = new LSL_Types.Quaternion(0, 0, 0, 0); | 2119 | public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); |
808 | |||
809 | |||
810 | |||
811 | } | 2120 | } |
812 | } | 2121 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs index e1ea916..25c3346 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs | |||
@@ -27,31 +27,32 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
35 | public static class Common | 33 | public static class Common |
36 | { | 34 | { |
37 | static public bool Debug = true; | 35 | public static bool Debug = true; |
38 | static public bool IL_UseTryCatch = true; | 36 | public static bool IL_UseTryCatch = true; |
39 | static public bool IL_CreateConstructor = true; | 37 | public static bool IL_CreateConstructor = true; |
40 | static public bool IL_CreateFunctionList = true; | 38 | public static bool IL_CreateFunctionList = true; |
41 | static public bool IL_ProcessCodeChunks = true; | 39 | public static bool IL_ProcessCodeChunks = true; |
42 | 40 | ||
43 | public delegate void SendToDebugEventDelegate(string Message); | 41 | public delegate void SendToDebugEventDelegate(string Message); |
42 | |||
44 | public delegate void SendToLogEventDelegate(string Message); | 43 | public delegate void SendToLogEventDelegate(string Message); |
45 | static public event SendToDebugEventDelegate SendToDebugEvent; | ||
46 | static public event SendToLogEventDelegate SendToLogEvent; | ||
47 | 44 | ||
48 | static public void SendToDebug(string Message) | 45 | public static event SendToDebugEventDelegate SendToDebugEvent; |
46 | public static event SendToLogEventDelegate SendToLogEvent; | ||
47 | |||
48 | public static void SendToDebug(string Message) | ||
49 | { | 49 | { |
50 | //if (Debug == true) | 50 | //if (Debug == true) |
51 | Console.WriteLine("COMPILER:Debug: " + Message); | 51 | Console.WriteLine("COMPILER:Debug: " + Message); |
52 | SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 52 | SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
53 | } | 53 | } |
54 | static public void SendToLog(string Message) | 54 | |
55 | public static void SendToLog(string Message) | ||
55 | { | 56 | { |
56 | //if (Debug == true) | 57 | //if (Debug == true) |
57 | Console.WriteLine("COMPILER:LOG: " + Message); | 58 | Console.WriteLine("COMPILER:LOG: " + Message); |
@@ -68,6 +69,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
68 | Common.SendToDebug("ReverseFormatString format: " + format); | 69 | Common.SendToDebug("ReverseFormatString format: " + format); |
69 | return string.Format(format, text1); | 70 | return string.Format(format, text1); |
70 | } | 71 | } |
72 | |||
71 | public static string ReverseFormatString(string text1, UInt32 text2, string format) | 73 | public static string ReverseFormatString(string text1, UInt32 text2, string format) |
72 | { | 74 | { |
73 | Common.SendToDebug("ReverseFormatString text1: " + text1); | 75 | Common.SendToDebug("ReverseFormatString text1: " + text1); |
@@ -75,10 +77,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
75 | Common.SendToDebug("ReverseFormatString format: " + format); | 77 | Common.SendToDebug("ReverseFormatString format: " + format); |
76 | return string.Format(format, text1, text2.ToString()); | 78 | return string.Format(format, text1, text2.ToString()); |
77 | } | 79 | } |
80 | |||
78 | public static string Cast_ToString(object obj) | 81 | public static string Cast_ToString(object obj) |
79 | { | 82 | { |
80 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); | 83 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); |
81 | return "ABCDEFGIHJKLMNOPQ123"; | 84 | return "ABCDEFGIHJKLMNOPQ123"; |
82 | } | 85 | } |
83 | } | 86 | } |
84 | } | 87 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs index cfae2c5..f3f4bea 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs | |||
@@ -27,20 +27,19 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.IO; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Reflection.Emit; | 32 | using System.Reflection.Emit; |
33 | using System.Text; | ||
32 | using System.Threading; | 34 | using System.Threading; |
33 | 35 | ||
34 | |||
35 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
36 | { | 37 | { |
37 | |||
38 | |||
39 | public class Engine | 38 | public class Engine |
40 | { | 39 | { |
41 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; | 40 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; |
42 | private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; | 41 | private string LSO_FileName; // = @"LSO\CloseToDefault.lso"; |
43 | AppDomain appDomain; | 42 | private AppDomain appDomain; |
44 | 43 | ||
45 | public string Compile(string LSOFileName) | 44 | public string Compile(string LSOFileName) |
46 | { | 45 | { |
@@ -52,20 +51,19 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
52 | 51 | ||
53 | // Create Assembly Name | 52 | // Create Assembly Name |
54 | AssemblyName asmName = new AssemblyName(); | 53 | AssemblyName asmName = new AssemblyName(); |
55 | asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); | 54 | asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName); |
56 | //asmName.Name = "TestAssembly"; | 55 | //asmName.Name = "TestAssembly"; |
57 | 56 | ||
58 | string DLL_FileName = asmName.Name + ".dll"; | 57 | string DLL_FileName = asmName.Name + ".dll"; |
59 | string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; | 58 | string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; |
60 | 59 | ||
61 | Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName)); | 60 | Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName)); |
62 | Common.SendToLog("Assembly name: " + asmName.Name); | 61 | Common.SendToLog("Assembly name: " + asmName.Name); |
63 | Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); | 62 | Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); |
64 | Common.SendToLog("Starting processing of LSL ByteCode..."); | 63 | Common.SendToLog("Starting processing of LSL ByteCode..."); |
65 | Common.SendToLog(""); | 64 | Common.SendToLog(""); |
66 | 65 | ||
67 | 66 | ||
68 | |||
69 | // Create Assembly | 67 | // Create Assembly |
70 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( | 68 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( |
71 | asmName, | 69 | asmName, |
@@ -78,15 +76,15 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
78 | 76 | ||
79 | // Create a module (and save to disk) | 77 | // Create a module (and save to disk) |
80 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule | 78 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule |
81 | (asmName.Name, | 79 | (asmName.Name, |
82 | DLL_FileName); | 80 | DLL_FileName); |
83 | 81 | ||
84 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); | 82 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); |
85 | // Create a Class (/Type) | 83 | // Create a Class (/Type) |
86 | TypeBuilder typeBuilder = modBuilder.DefineType( | 84 | TypeBuilder typeBuilder = modBuilder.DefineType( |
87 | "LSL_ScriptObject", | 85 | "LSL_ScriptObject", |
88 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit, | 86 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit, |
89 | typeof(OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass)); | 87 | typeof (LSL_BaseClass)); |
90 | //, | 88 | //, |
91 | // typeof()); | 89 | // typeof()); |
92 | //, typeof(LSL_BuiltIn_Commands_Interface)); | 90 | //, typeof(LSL_BuiltIn_Commands_Interface)); |
@@ -95,7 +93,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
95 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); | 93 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); |
96 | 94 | ||
97 | 95 | ||
98 | |||
99 | /* | 96 | /* |
100 | * Generate the IL itself | 97 | * Generate the IL itself |
101 | */ | 98 | */ |
@@ -123,7 +120,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
123 | asmBuilder.Save(DLL_FileName); | 120 | asmBuilder.Save(DLL_FileName); |
124 | 121 | ||
125 | Common.SendToLog("Returning assembly filename: " + DLL_FileName); | 122 | Common.SendToLog("Returning assembly filename: " + DLL_FileName); |
126 | 123 | ||
127 | 124 | ||
128 | return DLL_FileName; | 125 | return DLL_FileName; |
129 | 126 | ||
@@ -135,9 +132,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
135 | //object MyScript = (object)Activator.CreateInstance(type); | 132 | //object MyScript = (object)Activator.CreateInstance(type); |
136 | 133 | ||
137 | 134 | ||
138 | |||
139 | |||
140 | |||
141 | //System.Reflection.MemberInfo[] Members = type.GetMembers(); | 135 | //System.Reflection.MemberInfo[] Members = type.GetMembers(); |
142 | 136 | ||
143 | //Common.SendToLog("Members of assembly " + type.ToString() + ":"); | 137 | //Common.SendToLog("Members of assembly " + type.ToString() + ":"); |
@@ -165,29 +159,25 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
165 | // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); | 159 | // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); |
166 | 160 | ||
167 | //} | 161 | //} |
168 | |||
169 | |||
170 | } | 162 | } |
171 | 163 | ||
172 | 164 | ||
173 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) | 165 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) |
174 | { | 166 | { |
175 | |||
176 | |||
177 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); | 167 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); |
178 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( | 168 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( |
179 | // MethodAttributes.Public, | 169 | // MethodAttributes.Public, |
180 | // CallingConventions.Standard, | 170 | // CallingConventions.Standard, |
181 | // new Type[0]); | 171 | // new Type[0]); |
182 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( | 172 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( |
183 | MethodAttributes.Public | | 173 | MethodAttributes.Public | |
184 | MethodAttributes.SpecialName | | 174 | MethodAttributes.SpecialName | |
185 | MethodAttributes.RTSpecialName, | 175 | MethodAttributes.RTSpecialName, |
186 | CallingConventions.Standard, | 176 | CallingConventions.Standard, |
187 | new Type[0]); | 177 | new Type[0]); |
188 | 178 | ||
189 | //Define the reflection ConstructorInfor for System.Object | 179 | //Define the reflection ConstructorInfor for System.Object |
190 | ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]); | 180 | ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]); |
191 | 181 | ||
192 | //call constructor of base object | 182 | //call constructor of base object |
193 | ILGenerator il = constructor.GetILGenerator(); | 183 | ILGenerator il = constructor.GetILGenerator(); |
@@ -230,58 +220,61 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
230 | LSO_Struct.StaticBlock sb; | 220 | LSO_Struct.StaticBlock sb; |
231 | LSOP.StaticBlocks.TryGetValue(pos, out sb); | 221 | LSOP.StaticBlocks.TryGetValue(pos, out sb); |
232 | 222 | ||
233 | if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's | 223 | if (sb.ObjectType > 0 && sb.ObjectType < 8) |
234 | |||
235 | il.Emit(OpCodes.Ldarg_0); | ||
236 | // Push position to stack | ||
237 | il.Emit(OpCodes.Ldc_I4, pos); | ||
238 | //il.Emit(OpCodes.Box, typeof(UInt32)); | ||
239 | |||
240 | |||
241 | Type datatype = null; | ||
242 | |||
243 | // Push data to stack | ||
244 | Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")"); | ||
245 | switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType) | ||
246 | { | 224 | { |
247 | case LSO_Enums.Variable_Type_Codes.Float: | 225 | // We don't want void or null's |
248 | case LSO_Enums.Variable_Type_Codes.Integer: | 226 | |
249 | //UInt32 | 227 | il.Emit(OpCodes.Ldarg_0); |
250 | il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); | 228 | // Push position to stack |
251 | datatype = typeof(UInt32); | 229 | il.Emit(OpCodes.Ldc_I4, pos); |
252 | il.Emit(OpCodes.Box, datatype); | 230 | //il.Emit(OpCodes.Box, typeof(UInt32)); |
253 | break; | 231 | |
254 | case LSO_Enums.Variable_Type_Codes.String: | 232 | |
255 | case LSO_Enums.Variable_Type_Codes.Key: | 233 | Type datatype = null; |
256 | //String | 234 | |
257 | LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); | 235 | // Push data to stack |
258 | il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data)); | 236 | Common.SendToDebug("Adding to static (" + pos + ") type: " + |
259 | datatype = typeof(string); | 237 | ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType + |
260 | break; | 238 | ")"); |
261 | case LSO_Enums.Variable_Type_Codes.Vector: | 239 | switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType) |
262 | datatype = typeof(LSO_Enums.Vector); | 240 | { |
263 | //TODO: Not implemented | 241 | case LSO_Enums.Variable_Type_Codes.Float: |
264 | break; | 242 | case LSO_Enums.Variable_Type_Codes.Integer: |
265 | case LSO_Enums.Variable_Type_Codes.Rotation: | 243 | //UInt32 |
266 | //Object | 244 | il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); |
267 | //TODO: Not implemented | 245 | datatype = typeof (UInt32); |
268 | datatype = typeof(LSO_Enums.Rotation); | 246 | il.Emit(OpCodes.Box, datatype); |
269 | break; | 247 | break; |
270 | default: | 248 | case LSO_Enums.Variable_Type_Codes.String: |
271 | datatype = typeof(object); | 249 | case LSO_Enums.Variable_Type_Codes.Key: |
272 | break; | 250 | //String |
273 | } | 251 | LSO_Struct.HeapBlock hb = |
274 | 252 | LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); | |
275 | 253 | il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data)); | |
276 | // Make call | 254 | datatype = typeof (string); |
277 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype })); | 255 | break; |
256 | case LSO_Enums.Variable_Type_Codes.Vector: | ||
257 | datatype = typeof (LSO_Enums.Vector); | ||
258 | //TODO: Not implemented | ||
259 | break; | ||
260 | case LSO_Enums.Variable_Type_Codes.Rotation: | ||
261 | //Object | ||
262 | //TODO: Not implemented | ||
263 | datatype = typeof (LSO_Enums.Rotation); | ||
264 | break; | ||
265 | default: | ||
266 | datatype = typeof (object); | ||
267 | break; | ||
268 | } | ||
269 | |||
270 | |||
271 | // Make call | ||
272 | il.Emit(OpCodes.Call, | ||
273 | typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype})); | ||
278 | } | 274 | } |
279 | |||
280 | } | 275 | } |
281 | 276 | ||
282 | 277 | ||
283 | |||
284 | |||
285 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); | 278 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); |
286 | //il.Emit(OpCodes.Starg_0); | 279 | //il.Emit(OpCodes.Starg_0); |
287 | //// Create LSL function library | 280 | //// Create LSL function library |
@@ -293,8 +286,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
293 | } | 286 | } |
294 | 287 | ||
295 | 288 | ||
296 | |||
297 | |||
298 | // End of class | 289 | // End of class |
299 | } | 290 | } |
300 | } | 291 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs index eef9d20..064166b 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs | |||
@@ -27,30 +27,25 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | 30 | using System.Reflection; |
33 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
34 | 32 | ||
35 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
36 | { | 34 | { |
37 | partial class LSO_Parser | 35 | internal partial class LSO_Parser |
38 | { | 36 | { |
39 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) | 37 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) |
40 | { | 38 | { |
41 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, | 39 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, |
42 | TypeAttributes.Public | | 40 | TypeAttributes.Public | |
43 | TypeAttributes.Class | | 41 | TypeAttributes.Class | |
44 | TypeAttributes.AutoClass | | 42 | TypeAttributes.AutoClass | |
45 | TypeAttributes.AnsiClass | | 43 | TypeAttributes.AnsiClass | |
46 | TypeAttributes.BeforeFieldInit | | 44 | TypeAttributes.BeforeFieldInit | |
47 | TypeAttributes.AutoLayout, | 45 | TypeAttributes.AutoLayout, |
48 | typeof(object), | 46 | typeof (object), |
49 | new Type[] { typeof(object) }); | 47 | new Type[] {typeof (object)}); |
50 | return typeBuilder; | 48 | return typeBuilder; |
51 | |||
52 | } | 49 | } |
53 | |||
54 | |||
55 | } | 50 | } |
56 | } | 51 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs index ac3bc11..46da5f8 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs | |||
@@ -28,9 +28,6 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; | ||
34 | using OpenSim.Region.ScriptEngine.Common; | 31 | using OpenSim.Region.ScriptEngine.Common; |
35 | 32 | ||
36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
@@ -39,9 +36,9 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
39 | { | 36 | { |
40 | //public MemoryStream LSLStack = new MemoryStream(); | 37 | //public MemoryStream LSLStack = new MemoryStream(); |
41 | public Stack<object> LSLStack = new Stack<object>(); | 38 | public Stack<object> LSLStack = new Stack<object>(); |
42 | public Dictionary<UInt32, object> StaticVariables = new Dictionary<UInt32, object>(); | 39 | public Dictionary<uint, object> StaticVariables = new Dictionary<uint, object>(); |
43 | public Dictionary<UInt32, object> GlobalVariables = new Dictionary<UInt32, object>(); | 40 | public Dictionary<uint, object> GlobalVariables = new Dictionary<uint, object>(); |
44 | public Dictionary<UInt32, object> LocalVariables = new Dictionary<UInt32, object>(); | 41 | public Dictionary<uint, object> LocalVariables = new Dictionary<uint, object>(); |
45 | //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>(); | 42 | //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>(); |
46 | //public void AddFunction(String x) { | 43 | //public void AddFunction(String x) { |
47 | // FunctionList.Add(x); | 44 | // FunctionList.Add(x); |
@@ -54,19 +51,23 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
54 | //} | 51 | //} |
55 | public UInt32 State = 0; | 52 | public UInt32 State = 0; |
56 | public LSL_BuiltIn_Commands_Interface LSL_Builtins; | 53 | public LSL_BuiltIn_Commands_Interface LSL_Builtins; |
54 | |||
57 | public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn() | 55 | public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn() |
58 | { | 56 | { |
59 | return LSL_Builtins; | 57 | return LSL_Builtins; |
60 | } | 58 | } |
61 | 59 | ||
62 | 60 | ||
63 | public LSL_BaseClass() { } | 61 | public LSL_BaseClass() |
62 | { | ||
63 | } | ||
64 | 64 | ||
65 | 65 | ||
66 | public virtual int OverrideMe() | 66 | public virtual int OverrideMe() |
67 | { | 67 | { |
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | |||
70 | public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins) | 71 | public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins) |
71 | { | 72 | { |
72 | LSL_Builtins = LSLBuiltins; | 73 | LSL_Builtins = LSLBuiltins; |
@@ -81,8 +82,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
81 | Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType()); | 82 | Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType()); |
82 | StaticVariables.Add(index, obj); | 83 | StaticVariables.Add(index, obj); |
83 | } | 84 | } |
84 | |||
85 | |||
86 | |||
87 | } | 85 | } |
88 | } | 86 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs index 8a43cc1..0b6970a 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
@@ -53,6 +51,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
53 | LocalVariables.Remove(index); | 51 | LocalVariables.Remove(index); |
54 | LocalVariables.Add(index, LSLStack.Peek()); | 52 | LocalVariables.Add(index, LSLStack.Peek()); |
55 | } | 53 | } |
54 | |||
56 | public void StoreToGlobal(UInt32 index) | 55 | public void StoreToGlobal(UInt32 index) |
57 | { | 56 | { |
58 | Common.SendToDebug("::StoreToGlobal " + index); | 57 | Common.SendToDebug("::StoreToGlobal " + index); |
@@ -60,6 +59,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
60 | GlobalVariables.Remove(index); | 59 | GlobalVariables.Remove(index); |
61 | GlobalVariables.Add(index, LSLStack.Peek()); | 60 | GlobalVariables.Add(index, LSLStack.Peek()); |
62 | } | 61 | } |
62 | |||
63 | public void StoreToStatic(UInt32 index) | 63 | public void StoreToStatic(UInt32 index) |
64 | { | 64 | { |
65 | Common.SendToDebug("::StoreToStatic " + index); | 65 | Common.SendToDebug("::StoreToStatic " + index); |
@@ -67,6 +67,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
67 | // StaticVariables.Remove(index); | 67 | // StaticVariables.Remove(index); |
68 | StaticVariables.Add(index, LSLStack.Peek()); | 68 | StaticVariables.Add(index, LSLStack.Peek()); |
69 | } | 69 | } |
70 | |||
70 | public void GetFromLocal(UInt32 index) | 71 | public void GetFromLocal(UInt32 index) |
71 | { | 72 | { |
72 | // TODO: How to determine local? | 73 | // TODO: How to determine local? |
@@ -76,6 +77,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
76 | LSLStack.Push(ret); | 77 | LSLStack.Push(ret); |
77 | //return ret; | 78 | //return ret; |
78 | } | 79 | } |
80 | |||
79 | public void GetFromGlobal(UInt32 index) | 81 | public void GetFromGlobal(UInt32 index) |
80 | { | 82 | { |
81 | Common.SendToDebug("::GetFromGlobal " + index); | 83 | Common.SendToDebug("::GetFromGlobal " + index); |
@@ -84,6 +86,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
84 | LSLStack.Push(ret); | 86 | LSLStack.Push(ret); |
85 | //return ret; | 87 | //return ret; |
86 | } | 88 | } |
89 | |||
87 | public void GetFromStatic(UInt32 index) | 90 | public void GetFromStatic(UInt32 index) |
88 | { | 91 | { |
89 | Common.SendToDebug("::GetFromStatic " + index); | 92 | Common.SendToDebug("::GetFromStatic " + index); |
@@ -99,22 +102,22 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
99 | Common.SendToDebug("::POPToStack"); | 102 | Common.SendToDebug("::POPToStack"); |
100 | //return LSLStack.Pop(); | 103 | //return LSLStack.Pop(); |
101 | object p = LSLStack.Pop(); | 104 | object p = LSLStack.Pop(); |
102 | if (p.GetType() == typeof(UInt32)) | 105 | if (p.GetType() == typeof (UInt32)) |
103 | return (UInt32)p; | 106 | return (UInt32) p; |
104 | if (p.GetType() == typeof(string)) | 107 | if (p.GetType() == typeof (string)) |
105 | return (string)p; | 108 | return (string) p; |
106 | if (p.GetType() == typeof(Int32)) | 109 | if (p.GetType() == typeof (Int32)) |
107 | return (Int32)p; | 110 | return (Int32) p; |
108 | if (p.GetType() == typeof(UInt16)) | 111 | if (p.GetType() == typeof (UInt16)) |
109 | return (UInt16)p; | 112 | return (UInt16) p; |
110 | if (p.GetType() == typeof(float)) | 113 | if (p.GetType() == typeof (float)) |
111 | return (float)p; | 114 | return (float) p; |
112 | if (p.GetType() == typeof(LSO_Enums.Vector)) | 115 | if (p.GetType() == typeof (LSO_Enums.Vector)) |
113 | return (LSO_Enums.Vector)p; | 116 | return (LSO_Enums.Vector) p; |
114 | if (p.GetType() == typeof(LSO_Enums.Rotation)) | 117 | if (p.GetType() == typeof (LSO_Enums.Rotation)) |
115 | return (LSO_Enums.Rotation)p; | 118 | return (LSO_Enums.Rotation) p; |
116 | if (p.GetType() == typeof(LSO_Enums.Key)) | 119 | if (p.GetType() == typeof (LSO_Enums.Key)) |
117 | return (LSO_Enums.Key)p; | 120 | return (LSO_Enums.Key) p; |
118 | 121 | ||
119 | return p; | 122 | return p; |
120 | } | 123 | } |
@@ -151,6 +154,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
151 | LSLStack.Pop(); | 154 | LSLStack.Pop(); |
152 | } | 155 | } |
153 | } | 156 | } |
157 | |||
154 | public void PUSH(object Param) | 158 | public void PUSH(object Param) |
155 | { | 159 | { |
156 | if (Param == null) | 160 | if (Param == null) |
@@ -159,205 +163,218 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
159 | } | 163 | } |
160 | else | 164 | else |
161 | { | 165 | { |
162 | |||
163 | //Common.SendToDebug("::PUSH: " + Param.GetType()); | 166 | //Common.SendToDebug("::PUSH: " + Param.GetType()); |
164 | } | 167 | } |
165 | 168 | ||
166 | LSLStack.Push(Param); | 169 | LSLStack.Push(Param); |
167 | } | 170 | } |
171 | |||
168 | public void ADD(UInt32 Param) | 172 | public void ADD(UInt32 Param) |
169 | { | 173 | { |
170 | Common.SendToDebug("::ADD: " + Param); | 174 | Common.SendToDebug("::ADD: " + Param); |
171 | object o2 = LSLStack.Pop(); | 175 | object o2 = LSLStack.Pop(); |
172 | object o1 = LSLStack.Pop(); | 176 | object o1 = LSLStack.Pop(); |
173 | Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + " (" + o2.ToString() + ")"); | 177 | Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + |
174 | if (o2.GetType() == typeof(string)) | 178 | " (" + o2.ToString() + ")"); |
179 | if (o2.GetType() == typeof (string)) | ||
175 | { | 180 | { |
176 | LSLStack.Push((string)o1 + (string)o2); | 181 | LSLStack.Push((string) o1 + (string) o2); |
177 | return; | 182 | return; |
178 | } | 183 | } |
179 | if (o2.GetType() == typeof(UInt32)) | 184 | if (o2.GetType() == typeof (UInt32)) |
180 | { | 185 | { |
181 | LSLStack.Push((UInt32)o1 + (UInt32)o2); | 186 | LSLStack.Push((UInt32) o1 + (UInt32) o2); |
182 | return; | 187 | return; |
183 | } | 188 | } |
184 | |||
185 | } | 189 | } |
190 | |||
186 | public void SUB(UInt32 Param) | 191 | public void SUB(UInt32 Param) |
187 | { | 192 | { |
188 | Common.SendToDebug("::SUB: " + Param); | 193 | Common.SendToDebug("::SUB: " + Param); |
189 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 194 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
190 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 195 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
191 | LSLStack.Push((UInt32)(i1 - i2)); | 196 | LSLStack.Push((UInt32) (i1 - i2)); |
192 | } | 197 | } |
198 | |||
193 | public void MUL(UInt32 Param) | 199 | public void MUL(UInt32 Param) |
194 | { | 200 | { |
195 | Common.SendToDebug("::SUB: " + Param); | 201 | Common.SendToDebug("::SUB: " + Param); |
196 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 202 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
197 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 203 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
198 | LSLStack.Push((UInt32)(i1 * i2)); | 204 | LSLStack.Push((UInt32) (i1*i2)); |
199 | } | 205 | } |
206 | |||
200 | public void DIV(UInt32 Param) | 207 | public void DIV(UInt32 Param) |
201 | { | 208 | { |
202 | Common.SendToDebug("::DIV: " + Param); | 209 | Common.SendToDebug("::DIV: " + Param); |
203 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 210 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
204 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 211 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
205 | LSLStack.Push((UInt32)(i1 / i2)); | 212 | LSLStack.Push((UInt32) (i1/i2)); |
206 | } | 213 | } |
207 | 214 | ||
208 | 215 | ||
209 | public void MOD(UInt32 Param) | 216 | public void MOD(UInt32 Param) |
210 | { | 217 | { |
211 | Common.SendToDebug("::MOD: " + Param); | 218 | Common.SendToDebug("::MOD: " + Param); |
212 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 219 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
213 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 220 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
214 | LSLStack.Push((UInt32)(i1 % i2)); | 221 | LSLStack.Push((UInt32) (i1%i2)); |
215 | } | 222 | } |
223 | |||
216 | public void EQ(UInt32 Param) | 224 | public void EQ(UInt32 Param) |
217 | { | 225 | { |
218 | Common.SendToDebug("::EQ: " + Param); | 226 | Common.SendToDebug("::EQ: " + Param); |
219 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 227 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
220 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 228 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
221 | if (i1 == i2) | 229 | if (i1 == i2) |
222 | { | 230 | { |
223 | LSLStack.Push((UInt32)1); | 231 | LSLStack.Push((UInt32) 1); |
224 | } | 232 | } |
225 | else | 233 | else |
226 | { | 234 | { |
227 | LSLStack.Push((UInt32)0); | 235 | LSLStack.Push((UInt32) 0); |
228 | } | 236 | } |
229 | } | 237 | } |
238 | |||
230 | public void NEQ(UInt32 Param) | 239 | public void NEQ(UInt32 Param) |
231 | { | 240 | { |
232 | Common.SendToDebug("::NEQ: " + Param); | 241 | Common.SendToDebug("::NEQ: " + Param); |
233 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 242 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
234 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 243 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
235 | if (i1 != i2) | 244 | if (i1 != i2) |
236 | { | 245 | { |
237 | LSLStack.Push((UInt32)1); | 246 | LSLStack.Push((UInt32) 1); |
238 | } | 247 | } |
239 | else | 248 | else |
240 | { | 249 | { |
241 | LSLStack.Push((UInt32)0); | 250 | LSLStack.Push((UInt32) 0); |
242 | } | 251 | } |
243 | } | 252 | } |
253 | |||
244 | public void LEQ(UInt32 Param) | 254 | public void LEQ(UInt32 Param) |
245 | { | 255 | { |
246 | Common.SendToDebug("::LEQ: " + Param); | 256 | Common.SendToDebug("::LEQ: " + Param); |
247 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 257 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
248 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 258 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
249 | if (i1 <= i2) | 259 | if (i1 <= i2) |
250 | { | 260 | { |
251 | LSLStack.Push((UInt32)1); | 261 | LSLStack.Push((UInt32) 1); |
252 | } | 262 | } |
253 | else | 263 | else |
254 | { | 264 | { |
255 | LSLStack.Push((UInt32)0); | 265 | LSLStack.Push((UInt32) 0); |
256 | } | 266 | } |
257 | } | 267 | } |
268 | |||
258 | public void GEQ(UInt32 Param) | 269 | public void GEQ(UInt32 Param) |
259 | { | 270 | { |
260 | Common.SendToDebug("::GEQ: " + Param); | 271 | Common.SendToDebug("::GEQ: " + Param); |
261 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 272 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
262 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 273 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
263 | if (i1 >= i2) | 274 | if (i1 >= i2) |
264 | { | 275 | { |
265 | LSLStack.Push((UInt32)1); | 276 | LSLStack.Push((UInt32) 1); |
266 | } | 277 | } |
267 | else | 278 | else |
268 | { | 279 | { |
269 | LSLStack.Push((UInt32)0); | 280 | LSLStack.Push((UInt32) 0); |
270 | } | 281 | } |
271 | } | 282 | } |
283 | |||
272 | public void LESS(UInt32 Param) | 284 | public void LESS(UInt32 Param) |
273 | { | 285 | { |
274 | Common.SendToDebug("::LESS: " + Param); | 286 | Common.SendToDebug("::LESS: " + Param); |
275 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 287 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
276 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 288 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
277 | if (i1 < i2) | 289 | if (i1 < i2) |
278 | { | 290 | { |
279 | LSLStack.Push((UInt32)1); | 291 | LSLStack.Push((UInt32) 1); |
280 | } | 292 | } |
281 | else | 293 | else |
282 | { | 294 | { |
283 | LSLStack.Push((UInt32)0); | 295 | LSLStack.Push((UInt32) 0); |
284 | } | 296 | } |
285 | } | 297 | } |
298 | |||
286 | public void GREATER(UInt32 Param) | 299 | public void GREATER(UInt32 Param) |
287 | { | 300 | { |
288 | Common.SendToDebug("::GREATER: " + Param); | 301 | Common.SendToDebug("::GREATER: " + Param); |
289 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 302 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
290 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 303 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
291 | if (i1 > i2) | 304 | if (i1 > i2) |
292 | { | 305 | { |
293 | LSLStack.Push((UInt32)1); | 306 | LSLStack.Push((UInt32) 1); |
294 | } | 307 | } |
295 | else | 308 | else |
296 | { | 309 | { |
297 | LSLStack.Push((UInt32)0); | 310 | LSLStack.Push((UInt32) 0); |
298 | } | 311 | } |
299 | } | 312 | } |
300 | 313 | ||
301 | 314 | ||
302 | |||
303 | public void BITAND() | 315 | public void BITAND() |
304 | { | 316 | { |
305 | Common.SendToDebug("::BITAND"); | 317 | Common.SendToDebug("::BITAND"); |
306 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 318 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
307 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 319 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
308 | LSLStack.Push((UInt32)(i1 & i2)); | 320 | LSLStack.Push((UInt32) (i1 & i2)); |
309 | } | 321 | } |
322 | |||
310 | public void BITOR() | 323 | public void BITOR() |
311 | { | 324 | { |
312 | Common.SendToDebug("::BITOR"); | 325 | Common.SendToDebug("::BITOR"); |
313 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 326 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
314 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 327 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
315 | LSLStack.Push((UInt32)(i1 | i2)); | 328 | LSLStack.Push((UInt32) (i1 | i2)); |
316 | } | 329 | } |
330 | |||
317 | public void BITXOR() | 331 | public void BITXOR() |
318 | { | 332 | { |
319 | Common.SendToDebug("::BITXOR"); | 333 | Common.SendToDebug("::BITXOR"); |
320 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 334 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
321 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 335 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
322 | LSLStack.Push((UInt32)(i1 ^ i2)); | 336 | LSLStack.Push((UInt32) (i1 ^ i2)); |
323 | } | 337 | } |
338 | |||
324 | public void BOOLAND() | 339 | public void BOOLAND() |
325 | { | 340 | { |
326 | Common.SendToDebug("::BOOLAND"); | 341 | Common.SendToDebug("::BOOLAND"); |
327 | bool b2 = bool.Parse((string)LSLStack.Pop()); | 342 | bool b2 = bool.Parse((string) LSLStack.Pop()); |
328 | bool b1 = bool.Parse((string)LSLStack.Pop()); | 343 | bool b1 = bool.Parse((string) LSLStack.Pop()); |
329 | if (b1 && b2) | 344 | if (b1 && b2) |
330 | { | 345 | { |
331 | LSLStack.Push((UInt32)1); | 346 | LSLStack.Push((UInt32) 1); |
332 | } | 347 | } |
333 | else | 348 | else |
334 | { | 349 | { |
335 | LSLStack.Push((UInt32)0); | 350 | LSLStack.Push((UInt32) 0); |
336 | } | 351 | } |
337 | } | 352 | } |
353 | |||
338 | public void BOOLOR() | 354 | public void BOOLOR() |
339 | { | 355 | { |
340 | Common.SendToDebug("::BOOLOR"); | 356 | Common.SendToDebug("::BOOLOR"); |
341 | bool b2 = bool.Parse((string)LSLStack.Pop()); | 357 | bool b2 = bool.Parse((string) LSLStack.Pop()); |
342 | bool b1 = bool.Parse((string)LSLStack.Pop()); | 358 | bool b1 = bool.Parse((string) LSLStack.Pop()); |
343 | 359 | ||
344 | if (b1 || b2) | 360 | if (b1 || b2) |
345 | { | 361 | { |
346 | LSLStack.Push((UInt32)1); | 362 | LSLStack.Push((UInt32) 1); |
347 | } | 363 | } |
348 | else | 364 | else |
349 | { | 365 | { |
350 | LSLStack.Push((UInt32)0); | 366 | LSLStack.Push((UInt32) 0); |
351 | } | 367 | } |
352 | |||
353 | } | 368 | } |
369 | |||
354 | public void NEG(UInt32 Param) | 370 | public void NEG(UInt32 Param) |
355 | { | 371 | { |
356 | Common.SendToDebug("::NEG: " + Param); | 372 | Common.SendToDebug("::NEG: " + Param); |
357 | //UInt32 i2 = (UInt32)LSLStack.Pop(); | 373 | //UInt32 i2 = (UInt32)LSLStack.Pop(); |
358 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 374 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
359 | LSLStack.Push((UInt32)(i1 * -1)); | 375 | LSLStack.Push((UInt32) (i1*-1)); |
360 | } | 376 | } |
377 | |||
361 | public void BITNOT() | 378 | public void BITNOT() |
362 | { | 379 | { |
363 | //Common.SendToDebug("::BITNOT"); | 380 | //Common.SendToDebug("::BITNOT"); |
@@ -365,6 +382,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
365 | //UInt32 i1 = (UInt32)LSLStack.Pop(); | 382 | //UInt32 i1 = (UInt32)LSLStack.Pop(); |
366 | //LSLStack.Push((UInt32)(i1 / i2)); | 383 | //LSLStack.Push((UInt32)(i1 / i2)); |
367 | } | 384 | } |
385 | |||
368 | public void BOOLNOT() | 386 | public void BOOLNOT() |
369 | { | 387 | { |
370 | //Common.SendToDebug("::BOOLNOT"); | 388 | //Common.SendToDebug("::BOOLNOT"); |
@@ -372,7 +390,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
372 | //UInt32 i1 = (UInt32)LSLStack.Pop(); | 390 | //UInt32 i1 = (UInt32)LSLStack.Pop(); |
373 | //LSLStack.Push((UInt32)(i1)); | 391 | //LSLStack.Push((UInt32)(i1)); |
374 | } | 392 | } |
375 | |||
376 | |||
377 | } | 393 | } |
378 | } | 394 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs index 5da1d71..ed07cfc 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 29 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 30 | { |
35 | public class LSL_CLRInterface | 31 | public class LSL_CLRInterface |
@@ -76,4 +72,4 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
76 | //void event_http_response(); | 72 | //void event_http_response(); |
77 | } | 73 | } |
78 | } | 74 | } |
79 | } | 75 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs index 45cca25..d25644c 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs | |||
@@ -27,32 +27,28 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | 30 | using System.Reflection; |
33 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
34 | using OpenSim.Region.ScriptEngine.Common; | 32 | using OpenSim.Region.ScriptEngine.Common; |
35 | 33 | ||
36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 34 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
37 | { | 35 | { |
38 | partial class LSO_Parser | 36 | internal partial class LSO_Parser |
39 | { | 37 | { |
40 | //internal Stack<Type> ILStack = new Stack<Type>(); | 38 | //internal Stack<Type> ILStack = new Stack<Type>(); |
41 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); | 39 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); |
42 | 40 | ||
43 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) | 41 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) |
44 | { | 42 | { |
45 | |||
46 | byte bp1; | 43 | byte bp1; |
47 | UInt32 u32p1; | 44 | UInt32 u32p1; |
48 | float fp1; | 45 | float fp1; |
49 | UInt16 opcode = br_read(1)[0]; | 46 | UInt16 opcode = br_read(1)[0]; |
50 | Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); | 47 | Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString()); |
51 | string idesc = ((LSO_Enums.Operation_Table)opcode).ToString(); | 48 | string idesc = ((LSO_Enums.Operation_Table) opcode).ToString(); |
52 | switch ((LSO_Enums.Operation_Table)opcode) | 49 | switch ((LSO_Enums.Operation_Table) opcode) |
53 | { | 50 | { |
54 | 51 | /*************** | |
55 | /*************** | ||
56 | * IMPLEMENTED * | 52 | * IMPLEMENTED * |
57 | ***************/ | 53 | ***************/ |
58 | case LSO_Enums.Operation_Table.NOOP: | 54 | case LSO_Enums.Operation_Table.NOOP: |
@@ -60,33 +56,34 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
60 | case LSO_Enums.Operation_Table.PUSHSP: | 56 | case LSO_Enums.Operation_Table.PUSHSP: |
61 | // Push Stack Top (Memory Address) to stack | 57 | // Push Stack Top (Memory Address) to stack |
62 | Common.SendToDebug("Instruction " + idesc); | 58 | Common.SendToDebug("Instruction " + idesc); |
63 | Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack"); | 59 | Common.SendToDebug("Instruction " + idesc + |
64 | IL_Push(il, (UInt32)myHeader.SP); | 60 | ": Description: Pushing Stack Top (Memory Address from header) to stack"); |
61 | IL_Push(il, (UInt32) myHeader.SP); | ||
65 | break; | 62 | break; |
66 | // BYTE | 63 | // BYTE |
67 | case LSO_Enums.Operation_Table.PUSHARGB: | 64 | case LSO_Enums.Operation_Table.PUSHARGB: |
68 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 65 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
69 | break; | 66 | break; |
70 | // INTEGER | 67 | // INTEGER |
71 | case LSO_Enums.Operation_Table.PUSHARGI: | 68 | case LSO_Enums.Operation_Table.PUSHARGI: |
72 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 69 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
73 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); | 70 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); |
74 | IL_Push(il, u32p1); | 71 | IL_Push(il, u32p1); |
75 | break; | 72 | break; |
76 | // FLOAT | 73 | // FLOAT |
77 | case LSO_Enums.Operation_Table.PUSHARGF: | 74 | case LSO_Enums.Operation_Table.PUSHARGF: |
78 | fp1 = BitConverter.ToUInt32(br_read(4), 0); | 75 | fp1 = BitConverter.ToUInt32(br_read(4), 0); |
79 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); | 76 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); |
80 | IL_Push(il, fp1); | 77 | IL_Push(il, fp1); |
81 | break; | 78 | break; |
82 | // STRING | 79 | // STRING |
83 | case LSO_Enums.Operation_Table.PUSHARGS: | 80 | case LSO_Enums.Operation_Table.PUSHARGS: |
84 | string s = Read_String(); | 81 | string s = Read_String(); |
85 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); | 82 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); |
86 | IL_Debug(il, "OPCODE: " + idesc + ":" + s); | 83 | IL_Debug(il, "OPCODE: " + idesc + ":" + s); |
87 | IL_Push(il, s); | 84 | IL_Push(il, s); |
88 | break; | 85 | break; |
89 | // VECTOR z,y,x | 86 | // VECTOR z,y,x |
90 | case LSO_Enums.Operation_Table.PUSHARGV: | 87 | case LSO_Enums.Operation_Table.PUSHARGV: |
91 | LSO_Enums.Vector v = new LSO_Enums.Vector(); | 88 | LSO_Enums.Vector v = new LSO_Enums.Vector(); |
92 | v.Z = BitConverter.ToUInt32(br_read(4), 0); | 89 | v.Z = BitConverter.ToUInt32(br_read(4), 0); |
@@ -97,7 +94,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
97 | Common.SendToDebug("Param1 X: " + v.X); | 94 | Common.SendToDebug("Param1 X: " + v.X); |
98 | IL_Push(il, v); | 95 | IL_Push(il, v); |
99 | break; | 96 | break; |
100 | // ROTATION s,z,y,x | 97 | // ROTATION s,z,y,x |
101 | case LSO_Enums.Operation_Table.PUSHARGQ: | 98 | case LSO_Enums.Operation_Table.PUSHARGQ: |
102 | LSO_Enums.Rotation r = new LSO_Enums.Rotation(); | 99 | LSO_Enums.Rotation r = new LSO_Enums.Rotation(); |
103 | r.S = BitConverter.ToUInt32(br_read(4), 0); | 100 | r.S = BitConverter.ToUInt32(br_read(4), 0); |
@@ -112,7 +109,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
112 | break; | 109 | break; |
113 | 110 | ||
114 | case LSO_Enums.Operation_Table.PUSHE: | 111 | case LSO_Enums.Operation_Table.PUSHE: |
115 | IL_Push(il, (UInt32)0); | 112 | IL_Push(il, (UInt32) 0); |
116 | break; | 113 | break; |
117 | 114 | ||
118 | case LSO_Enums.Operation_Table.PUSHARGE: | 115 | case LSO_Enums.Operation_Table.PUSHARGE: |
@@ -121,7 +118,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
121 | //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); | 118 | //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); |
122 | IL_Push(il, u32p1); | 119 | IL_Push(il, u32p1); |
123 | break; | 120 | break; |
124 | // BYTE | 121 | // BYTE |
125 | case LSO_Enums.Operation_Table.ADD: | 122 | case LSO_Enums.Operation_Table.ADD: |
126 | case LSO_Enums.Operation_Table.SUB: | 123 | case LSO_Enums.Operation_Table.SUB: |
127 | case LSO_Enums.Operation_Table.MUL: | 124 | case LSO_Enums.Operation_Table.MUL: |
@@ -136,10 +133,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
136 | case LSO_Enums.Operation_Table.MOD: | 133 | case LSO_Enums.Operation_Table.MOD: |
137 | bp1 = br_read(1)[0]; | 134 | bp1 = br_read(1)[0]; |
138 | Common.SendToDebug("Param1: " + bp1); | 135 | Common.SendToDebug("Param1: " + bp1); |
139 | IL_CallBaseFunction(il, idesc, (UInt32)bp1); | 136 | IL_CallBaseFunction(il, idesc, (UInt32) bp1); |
140 | break; | 137 | break; |
141 | 138 | ||
142 | // NO ARGUMENTS | 139 | // NO ARGUMENTS |
143 | case LSO_Enums.Operation_Table.BITAND: | 140 | case LSO_Enums.Operation_Table.BITAND: |
144 | case LSO_Enums.Operation_Table.BITOR: | 141 | case LSO_Enums.Operation_Table.BITOR: |
145 | case LSO_Enums.Operation_Table.BITXOR: | 142 | case LSO_Enums.Operation_Table.BITXOR: |
@@ -149,22 +146,23 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
149 | case LSO_Enums.Operation_Table.BOOLNOT: | 146 | case LSO_Enums.Operation_Table.BOOLNOT: |
150 | IL_CallBaseFunction(il, idesc); | 147 | IL_CallBaseFunction(il, idesc); |
151 | break; | 148 | break; |
152 | // SHORT | 149 | // SHORT |
153 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: | 150 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: |
154 | // TODO: What is size of short? | 151 | // TODO: What is size of short? |
155 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); | 152 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); |
156 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString()); | 153 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + |
154 | ((LSO_Enums.BuiltIn_Functions) U16p1).ToString()); | ||
157 | //Common.SendToDebug("Param1: " + U16p1); | 155 | //Common.SendToDebug("Param1: " + U16p1); |
158 | string fname = ((LSO_Enums.BuiltIn_Functions)U16p1).ToString(); | 156 | string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString(); |
159 | 157 | ||
160 | bool cmdFound = false; | 158 | bool cmdFound = false; |
161 | foreach (MethodInfo mi in typeof(LSL_BuiltIn_Commands_Interface).GetMethods()) | 159 | foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods()) |
162 | { | 160 | { |
163 | // Found command | 161 | // Found command |
164 | if (mi.Name == fname) | 162 | if (mi.Name == fname) |
165 | { | 163 | { |
166 | il.Emit(OpCodes.Ldarg_0); | 164 | il.Emit(OpCodes.Ldarg_0); |
167 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] { })); | 165 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {})); |
168 | // Pop required number of items from my stack to .Net stack | 166 | // Pop required number of items from my stack to .Net stack |
169 | IL_PopToStack(il, mi.GetParameters().Length); | 167 | IL_PopToStack(il, mi.GetParameters().Length); |
170 | il.Emit(OpCodes.Callvirt, mi); | 168 | il.Emit(OpCodes.Callvirt, mi); |
@@ -179,7 +177,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
179 | 177 | ||
180 | break; | 178 | break; |
181 | 179 | ||
182 | // RETURN | 180 | // RETURN |
183 | case LSO_Enums.Operation_Table.RETURN: | 181 | case LSO_Enums.Operation_Table.RETURN: |
184 | 182 | ||
185 | Common.SendToDebug("OPCODE: RETURN"); | 183 | Common.SendToDebug("OPCODE: RETURN"); |
@@ -195,7 +193,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
195 | IL_Pop(il); | 193 | IL_Pop(il); |
196 | break; | 194 | break; |
197 | 195 | ||
198 | // LONG | 196 | // LONG |
199 | case LSO_Enums.Operation_Table.STORE: | 197 | case LSO_Enums.Operation_Table.STORE: |
200 | case LSO_Enums.Operation_Table.STORES: | 198 | case LSO_Enums.Operation_Table.STORES: |
201 | case LSO_Enums.Operation_Table.STOREL: | 199 | case LSO_Enums.Operation_Table.STOREL: |
@@ -238,7 +236,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
238 | IL_Pop(il); | 236 | IL_Pop(il); |
239 | break; | 237 | break; |
240 | 238 | ||
241 | // PUSH FROM LOCAL FRAME | 239 | // PUSH FROM LOCAL FRAME |
242 | case LSO_Enums.Operation_Table.PUSH: | 240 | case LSO_Enums.Operation_Table.PUSH: |
243 | case LSO_Enums.Operation_Table.PUSHS: | 241 | case LSO_Enums.Operation_Table.PUSHS: |
244 | case LSO_Enums.Operation_Table.PUSHL: | 242 | case LSO_Enums.Operation_Table.PUSHL: |
@@ -250,7 +248,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
250 | 248 | ||
251 | break; | 249 | break; |
252 | 250 | ||
253 | // PUSH FROM STATIC FRAME | 251 | // PUSH FROM STATIC FRAME |
254 | case LSO_Enums.Operation_Table.PUSHG: | 252 | case LSO_Enums.Operation_Table.PUSHG: |
255 | case LSO_Enums.Operation_Table.PUSHGS: | 253 | case LSO_Enums.Operation_Table.PUSHGS: |
256 | case LSO_Enums.Operation_Table.PUSHGL: | 254 | case LSO_Enums.Operation_Table.PUSHGL: |
@@ -262,26 +260,25 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
262 | break; | 260 | break; |
263 | 261 | ||
264 | 262 | ||
265 | /*********************** | 263 | /*********************** |
266 | * NOT IMPLEMENTED YET * | 264 | * NOT IMPLEMENTED YET * |
267 | ***********************/ | 265 | ***********************/ |
268 | 266 | ||
269 | 267 | ||
270 | |||
271 | case LSO_Enums.Operation_Table.POPIP: | 268 | case LSO_Enums.Operation_Table.POPIP: |
272 | case LSO_Enums.Operation_Table.POPSP: | 269 | case LSO_Enums.Operation_Table.POPSP: |
273 | case LSO_Enums.Operation_Table.POPSLR: | 270 | case LSO_Enums.Operation_Table.POPSLR: |
274 | case LSO_Enums.Operation_Table.POPARG: | 271 | case LSO_Enums.Operation_Table.POPARG: |
275 | case LSO_Enums.Operation_Table.POPBP: | 272 | case LSO_Enums.Operation_Table.POPBP: |
276 | //Common.SendToDebug("Instruction " + idesc + ": Ignored"); | 273 | //Common.SendToDebug("Instruction " + idesc + ": Ignored"); |
277 | Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); | 274 | Common.SendToDebug("Instruction " + idesc + |
275 | ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); | ||
278 | //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 276 | //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
279 | IL_Pop(il); | 277 | IL_Pop(il); |
280 | break; | 278 | break; |
281 | 279 | ||
282 | 280 | ||
283 | 281 | // None | |
284 | // None | ||
285 | case LSO_Enums.Operation_Table.PUSHIP: | 282 | case LSO_Enums.Operation_Table.PUSHIP: |
286 | // PUSH INSTRUCTION POINTER | 283 | // PUSH INSTRUCTION POINTER |
287 | break; | 284 | break; |
@@ -293,17 +290,17 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
293 | break; | 290 | break; |
294 | 291 | ||
295 | 292 | ||
296 | // LONG | 293 | // LONG |
297 | case LSO_Enums.Operation_Table.JUMP: | 294 | case LSO_Enums.Operation_Table.JUMP: |
298 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 295 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
299 | break; | 296 | break; |
300 | // BYTE, LONG | 297 | // BYTE, LONG |
301 | case LSO_Enums.Operation_Table.JUMPIF: | 298 | case LSO_Enums.Operation_Table.JUMPIF: |
302 | case LSO_Enums.Operation_Table.JUMPNIF: | 299 | case LSO_Enums.Operation_Table.JUMPNIF: |
303 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 300 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
304 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); | 301 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); |
305 | break; | 302 | break; |
306 | // LONG | 303 | // LONG |
307 | case LSO_Enums.Operation_Table.STATE: | 304 | case LSO_Enums.Operation_Table.STATE: |
308 | bp1 = br_read(1)[0]; | 305 | bp1 = br_read(1)[0]; |
309 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack | 306 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack |
@@ -315,12 +312,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
315 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 312 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
316 | Common.SendToDebug("ERROR: Function CALL not implemented yet."); | 313 | Common.SendToDebug("ERROR: Function CALL not implemented yet."); |
317 | break; | 314 | break; |
318 | // BYTE | 315 | // BYTE |
319 | case LSO_Enums.Operation_Table.CAST: | 316 | case LSO_Enums.Operation_Table.CAST: |
320 | bp1 = br_read(1)[0]; | 317 | bp1 = br_read(1)[0]; |
321 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)); | 318 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + |
319 | ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)); | ||
322 | Common.SendToDebug("Param1: " + bp1); | 320 | Common.SendToDebug("Param1: " + bp1); |
323 | switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1) | 321 | switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1) |
324 | { | 322 | { |
325 | case LSO_Enums.OpCode_Cast_TypeDefs.String: | 323 | case LSO_Enums.OpCode_Cast_TypeDefs.String: |
326 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); | 324 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); |
@@ -330,12 +328,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
330 | break; | 328 | break; |
331 | } | 329 | } |
332 | break; | 330 | break; |
333 | // LONG | 331 | // LONG |
334 | case LSO_Enums.Operation_Table.STACKTOS: | 332 | case LSO_Enums.Operation_Table.STACKTOS: |
335 | case LSO_Enums.Operation_Table.STACKTOL: | 333 | case LSO_Enums.Operation_Table.STACKTOL: |
336 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 334 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
337 | break; | 335 | break; |
338 | // BYTE | 336 | // BYTE |
339 | case LSO_Enums.Operation_Table.PRINT: | 337 | case LSO_Enums.Operation_Table.PRINT: |
340 | case LSO_Enums.Operation_Table.CALLLIB: | 338 | case LSO_Enums.Operation_Table.CALLLIB: |
341 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 339 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
@@ -348,6 +346,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
348 | { | 346 | { |
349 | IL_PopToStack(il, 1); | 347 | IL_PopToStack(il, 1); |
350 | } | 348 | } |
349 | |||
351 | private void IL_PopToStack(ILGenerator il, int count) | 350 | private void IL_PopToStack(ILGenerator il, int count) |
352 | { | 351 | { |
353 | Common.SendToDebug("IL_PopToStack();"); | 352 | Common.SendToDebug("IL_PopToStack();"); |
@@ -360,31 +359,35 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
360 | // new Type[] { })); | 359 | // new Type[] { })); |
361 | } | 360 | } |
362 | } | 361 | } |
362 | |||
363 | private void IL_Pop(ILGenerator il) | 363 | private void IL_Pop(ILGenerator il) |
364 | { | 364 | { |
365 | Common.SendToDebug("IL_Pop();"); | 365 | Common.SendToDebug("IL_Pop();"); |
366 | IL_CallBaseFunction(il, "POP"); | 366 | IL_CallBaseFunction(il, "POP"); |
367 | } | 367 | } |
368 | |||
368 | private void IL_Debug(ILGenerator il, string text) | 369 | private void IL_Debug(ILGenerator il, string text) |
369 | { | 370 | { |
370 | il.Emit(OpCodes.Ldstr, text); | 371 | il.Emit(OpCodes.Ldstr, text); |
371 | il.Emit(OpCodes.Call, typeof(Common).GetMethod("SendToDebug", | 372 | il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug", |
372 | new Type[] { typeof(string) } | 373 | new Type[] {typeof (string)} |
373 | )); | 374 | )); |
374 | } | 375 | } |
376 | |||
375 | private void IL_CallBaseFunction(ILGenerator il, string methodname) | 377 | private void IL_CallBaseFunction(ILGenerator il, string methodname) |
376 | { | 378 | { |
377 | il.Emit(OpCodes.Ldarg_0); | 379 | il.Emit(OpCodes.Ldarg_0); |
378 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { })); | 380 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {})); |
379 | } | 381 | } |
382 | |||
380 | private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) | 383 | private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) |
381 | { | 384 | { |
382 | il.Emit(OpCodes.Ldarg_0); | 385 | il.Emit(OpCodes.Ldarg_0); |
383 | if (data.GetType() == typeof(string)) | 386 | if (data.GetType() == typeof (string)) |
384 | il.Emit(OpCodes.Ldstr, (string)data); | 387 | il.Emit(OpCodes.Ldstr, (string) data); |
385 | if (data.GetType() == typeof(UInt32)) | 388 | if (data.GetType() == typeof (UInt32)) |
386 | il.Emit(OpCodes.Ldc_I4, (UInt32)data); | 389 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); |
387 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { data.GetType() })); | 390 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()})); |
388 | } | 391 | } |
389 | 392 | ||
390 | private void IL_Push(ILGenerator il, object data) | 393 | private void IL_Push(ILGenerator il, object data) |
@@ -394,43 +397,39 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
394 | 397 | ||
395 | IL_PushDataTypeToILStack(il, data); | 398 | IL_PushDataTypeToILStack(il, data); |
396 | 399 | ||
397 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("PUSH", new Type[] { data.GetType() })); | 400 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()})); |
398 | |||
399 | } | 401 | } |
400 | 402 | ||
401 | private void IL_PushDataTypeToILStack(ILGenerator il, object data) | 403 | private void IL_PushDataTypeToILStack(ILGenerator il, object data) |
402 | { | 404 | { |
403 | if (data.GetType() == typeof(UInt16)) | 405 | if (data.GetType() == typeof (UInt16)) |
404 | { | 406 | { |
405 | il.Emit(OpCodes.Ldc_I4, (UInt16)data); | 407 | il.Emit(OpCodes.Ldc_I4, (UInt16) data); |
406 | il.Emit(OpCodes.Box, data.GetType()); | 408 | il.Emit(OpCodes.Box, data.GetType()); |
407 | } | 409 | } |
408 | if (data.GetType() == typeof(UInt32)) | 410 | if (data.GetType() == typeof (UInt32)) |
409 | { | 411 | { |
410 | il.Emit(OpCodes.Ldc_I4, (UInt32)data); | 412 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); |
411 | il.Emit(OpCodes.Box, data.GetType()); | 413 | il.Emit(OpCodes.Box, data.GetType()); |
412 | } | 414 | } |
413 | if (data.GetType() == typeof(Int32)) | 415 | if (data.GetType() == typeof (Int32)) |
414 | { | 416 | { |
415 | il.Emit(OpCodes.Ldc_I4, (Int32)data); | 417 | il.Emit(OpCodes.Ldc_I4, (Int32) data); |
416 | il.Emit(OpCodes.Box, data.GetType()); | 418 | il.Emit(OpCodes.Box, data.GetType()); |
417 | } | 419 | } |
418 | if (data.GetType() == typeof(float)) | 420 | if (data.GetType() == typeof (float)) |
419 | { | 421 | { |
420 | il.Emit(OpCodes.Ldc_I4, (float)data); | 422 | il.Emit(OpCodes.Ldc_I4, (float) data); |
421 | il.Emit(OpCodes.Box, data.GetType()); | 423 | il.Emit(OpCodes.Box, data.GetType()); |
422 | } | 424 | } |
423 | if (data.GetType() == typeof(string)) | 425 | if (data.GetType() == typeof (string)) |
424 | il.Emit(OpCodes.Ldstr, (string)data); | 426 | il.Emit(OpCodes.Ldstr, (string) data); |
425 | //if (data.GetType() == typeof(LSO_Enums.Rotation)) | 427 | //if (data.GetType() == typeof(LSO_Enums.Rotation)) |
426 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); | 428 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); |
427 | //if (data.GetType() == typeof(LSO_Enums.Vector)) | 429 | //if (data.GetType() == typeof(LSO_Enums.Vector)) |
428 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); | 430 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); |
429 | //if (data.GetType() == typeof(LSO_Enums.Key)) | 431 | //if (data.GetType() == typeof(LSO_Enums.Key)) |
430 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); | 432 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); |
431 | |||
432 | } | 433 | } |
433 | |||
434 | |||
435 | } | 434 | } |
436 | } | 435 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs index 3de2a36..fef9ad2 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
@@ -47,6 +45,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
47 | String = 51, | 45 | String = 51, |
48 | UInt32 = 17 | 46 | UInt32 = 17 |
49 | } | 47 | } |
48 | |||
50 | [Serializable] | 49 | [Serializable] |
51 | public enum OpCode_Cast_TypeDefs | 50 | public enum OpCode_Cast_TypeDefs |
52 | { | 51 | { |
@@ -66,6 +65,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
66 | public UInt32 Y; | 65 | public UInt32 Y; |
67 | public UInt32 X; | 66 | public UInt32 X; |
68 | } | 67 | } |
68 | |||
69 | [Serializable] | 69 | [Serializable] |
70 | public struct Rotation | 70 | public struct Rotation |
71 | { | 71 | { |
@@ -74,6 +74,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
74 | public UInt32 Y; | 74 | public UInt32 Y; |
75 | public UInt32 X; | 75 | public UInt32 X; |
76 | } | 76 | } |
77 | |||
77 | [Serializable] | 78 | [Serializable] |
78 | public enum Variable_Type_Codes | 79 | public enum Variable_Type_Codes |
79 | { | 80 | { |
@@ -87,6 +88,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
87 | List = 7, | 88 | List = 7, |
88 | Null = 8 | 89 | Null = 8 |
89 | } | 90 | } |
91 | |||
90 | [Serializable] | 92 | [Serializable] |
91 | public enum Event_Mask_Values | 93 | public enum Event_Mask_Values |
92 | { | 94 | { |
@@ -124,6 +126,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
124 | remote_data = 31, | 126 | remote_data = 31, |
125 | http_response = 32 | 127 | http_response = 32 |
126 | } | 128 | } |
129 | |||
127 | [Serializable] | 130 | [Serializable] |
128 | public enum Operation_Table | 131 | public enum Operation_Table |
129 | { | 132 | { |
@@ -220,6 +223,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
220 | SHL = 0xe0, | 223 | SHL = 0xe0, |
221 | SHR = 0xe1 | 224 | SHR = 0xe1 |
222 | } | 225 | } |
226 | |||
223 | [Serializable] | 227 | [Serializable] |
224 | public enum BuiltIn_Functions | 228 | public enum BuiltIn_Functions |
225 | { | 229 | { |
@@ -552,6 +556,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
552 | llGetParcelMaxPrims = 326, | 556 | llGetParcelMaxPrims = 326, |
553 | llGetParcelDetails = 327 | 557 | llGetParcelDetails = 327 |
554 | } | 558 | } |
555 | |||
556 | } | 559 | } |
557 | } | 560 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs index 8b24e68..11c51c5 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs | |||
@@ -27,15 +27,16 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Reflection.Emit; | 34 | using System.Reflection.Emit; |
35 | using System.Text; | ||
35 | 36 | ||
36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 37 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
37 | { | 38 | { |
38 | partial class LSO_Parser | 39 | internal partial class LSO_Parser |
39 | { | 40 | { |
40 | private string FileName; | 41 | private string FileName; |
41 | private FileStream fs; | 42 | private FileStream fs; |
@@ -45,7 +46,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
45 | //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); | 46 | //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); |
46 | 47 | ||
47 | private TypeBuilder typeBuilder; | 48 | private TypeBuilder typeBuilder; |
48 | private System.Collections.Generic.List<string> EventList = new System.Collections.Generic.List<string>(); | 49 | private List<string> EventList = new List<string>(); |
49 | 50 | ||
50 | public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) | 51 | public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) |
51 | { | 52 | { |
@@ -59,11 +60,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
59 | Common.SendToDebug("Opening filename: " + FileName); | 60 | Common.SendToDebug("Opening filename: " + FileName); |
60 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); | 61 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); |
61 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); | 62 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); |
62 | |||
63 | } | 63 | } |
64 | |||
64 | internal void CloseFile() | 65 | internal void CloseFile() |
65 | { | 66 | { |
66 | |||
67 | // Close | 67 | // Close |
68 | br.Close(); | 68 | br.Close(); |
69 | fs.Close(); | 69 | fs.Close(); |
@@ -75,9 +75,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
75 | /// </summary> | 75 | /// </summary> |
76 | public void Parse() | 76 | public void Parse() |
77 | { | 77 | { |
78 | |||
79 | |||
80 | |||
81 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. | 78 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. |
82 | 79 | ||
83 | 80 | ||
@@ -148,14 +145,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
148 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 145 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
149 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 146 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
150 | myStaticBlock.ObjectType = br_read(1)[0]; | 147 | myStaticBlock.ObjectType = br_read(1)[0]; |
151 | Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); | 148 | Common.SendToDebug("Static Block ObjectType: " + |
149 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); | ||
152 | myStaticBlock.Unknown = br_read(1)[0]; | 150 | myStaticBlock.Unknown = br_read(1)[0]; |
153 | // Size of datatype varies -- what about strings? | 151 | // Size of datatype varies -- what about strings? |
154 | if (myStaticBlock.ObjectType != 0) | 152 | if (myStaticBlock.ObjectType != 0) |
155 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); | 153 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); |
156 | 154 | ||
157 | StaticBlocks.Add((UInt32)startReadPos, myStaticBlock); | 155 | StaticBlocks.Add((UInt32) startReadPos, myStaticBlock); |
158 | |||
159 | } | 156 | } |
160 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); | 157 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); |
161 | 158 | ||
@@ -183,7 +180,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
183 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) | 180 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) |
184 | // Note! Absolute position | 181 | // Note! Absolute position |
185 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; | 182 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; |
186 | Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); | 183 | Common.SendToDebug("Fuction " + i + " code chunk position: " + |
184 | myFunctionBlock.CodeChunkPointer[i]); | ||
187 | } | 185 | } |
188 | } | 186 | } |
189 | } | 187 | } |
@@ -204,14 +202,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
204 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); | 202 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); |
205 | // Position is relative to state frame | 203 | // Position is relative to state frame |
206 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); | 204 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); |
207 | myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); | 205 | myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8)); |
208 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); | 206 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); |
209 | Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); | 207 | Common.SendToDebug("Total potential EventMask bits: " + |
208 | myStateFrameBlock.StatePointer[i].EventMask.Count); | ||
210 | 209 | ||
211 | //// Read STATE BLOCK | 210 | //// Read STATE BLOCK |
212 | //long CurPos = fs.Position; | 211 | //long CurPos = fs.Position; |
213 | //fs.Seek(CurPos, SeekOrigin.Begin); | 212 | //fs.Seek(CurPos, SeekOrigin.Begin); |
214 | |||
215 | } | 213 | } |
216 | } | 214 | } |
217 | 215 | ||
@@ -224,19 +222,20 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
224 | // Go through all State Frame Pointers found | 222 | // Go through all State Frame Pointers found |
225 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 223 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
226 | { | 224 | { |
227 | |||
228 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); | 225 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); |
229 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); | 226 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); |
230 | 227 | ||
231 | // READ: STATE BLOCK HEADER | 228 | // READ: STATE BLOCK HEADER |
232 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); | 229 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); |
233 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note | 230 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note |
234 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 231 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
235 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; | 232 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; |
236 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note | 233 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note |
237 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); | 234 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); |
238 | Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); | 235 | Common.SendToDebug("State block Header Size: " + |
239 | Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | 236 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); |
237 | Common.SendToDebug("State block Header End Pos: " + | ||
238 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | ||
240 | 239 | ||
241 | // We need to count number of bits flagged in EventMask? | 240 | // We need to count number of bits flagged in EventMask? |
242 | 241 | ||
@@ -245,27 +244,36 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
245 | 244 | ||
246 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE | 245 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE |
247 | //TODO: Create event hooks | 246 | //TODO: Create event hooks |
248 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; | 247 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = |
248 | new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; | ||
249 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 249 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
250 | { | 250 | { |
251 | |||
252 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) | 251 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) |
253 | { | 252 | { |
254 | // We got an event | 253 | // We got an event |
255 | // READ: STATE BLOCK HANDLER | 254 | // READ: STATE BLOCK HANDLER |
256 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); | 255 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + |
257 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); | 256 | " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " + |
258 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); | 257 | fs.Position); |
259 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); | 258 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = |
260 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize); | 259 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos + |
260 | BitConverter.ToUInt32(br_read(4), 0); | ||
261 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = | ||
262 | BitConverter.ToUInt32(br_read(4), 0); | ||
263 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + | ||
264 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " + | ||
265 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. | ||
266 | CodeChunkPointer); | ||
267 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + | ||
268 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " + | ||
269 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. | ||
270 | CallFrameSize); | ||
261 | } | 271 | } |
262 | } | 272 | } |
263 | } | 273 | } |
264 | } | 274 | } |
265 | 275 | ||
266 | 276 | ||
267 | |||
268 | |||
269 | //// READ FUNCTION CODE CHUNKS | 277 | //// READ FUNCTION CODE CHUNKS |
270 | //// Functions + Function start pos (GFR) | 278 | //// Functions + Function start pos (GFR) |
271 | //// TODO: Somehow be able to identify and reference this | 279 | //// TODO: Somehow be able to identify and reference this |
@@ -291,37 +299,32 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
291 | // two level search ain't no good | 299 | // two level search ain't no good |
292 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 300 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
293 | { | 301 | { |
294 | |||
295 | |||
296 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) | 302 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) |
297 | { | 303 | { |
298 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); | 304 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + |
305 | (LSO_Enums.Event_Mask_Values) ii); | ||
299 | 306 | ||
300 | 307 | ||
301 | // Override a Method / Function | 308 | // Override a Method / Function |
302 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii; | 309 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii; |
303 | Common.SendToDebug("Event Name: " + eventname); | 310 | Common.SendToDebug("Event Name: " + eventname); |
304 | if (Common.IL_ProcessCodeChunks) | 311 | if (Common.IL_ProcessCodeChunks) |
305 | { | 312 | { |
306 | EventList.Add(eventname); | 313 | EventList.Add(eventname); |
307 | 314 | ||
308 | // JUMP TO CODE PROCESSOR | 315 | // JUMP TO CODE PROCESSOR |
309 | ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname); | 316 | ProcessCodeChunk( |
317 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, | ||
318 | typeBuilder, eventname); | ||
310 | } | 319 | } |
311 | } | 320 | } |
312 | |||
313 | } | 321 | } |
314 | |||
315 | } | 322 | } |
316 | |||
317 | } | 323 | } |
318 | 324 | ||
319 | 325 | ||
320 | |||
321 | |||
322 | if (Common.IL_CreateFunctionList) | 326 | if (Common.IL_CreateFunctionList) |
323 | IL_INSERT_FUNCTIONLIST(); | 327 | IL_INSERT_FUNCTIONLIST(); |
324 | |||
325 | } | 328 | } |
326 | 329 | ||
327 | internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) | 330 | internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) |
@@ -342,11 +345,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
342 | 345 | ||
343 | 346 | ||
344 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); | 347 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); |
345 | Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); | 348 | Common.SendToDebug("Heap Block ObjectType: " + |
349 | ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString()); | ||
346 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); | 350 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); |
347 | 351 | ||
348 | return myHeapBlock; | 352 | return myHeapBlock; |
349 | } | 353 | } |
354 | |||
350 | private byte[] br_read(int len) | 355 | private byte[] br_read(int len) |
351 | { | 356 | { |
352 | if (len <= 0) | 357 | if (len <= 0) |
@@ -365,6 +370,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
365 | throw (e); | 370 | throw (e); |
366 | } | 371 | } |
367 | } | 372 | } |
373 | |||
368 | //private byte[] br_read_smallendian(int len) | 374 | //private byte[] br_read_smallendian(int len) |
369 | //{ | 375 | //{ |
370 | // byte[] bytes = new byte[len]; | 376 | // byte[] bytes = new byte[len]; |
@@ -373,29 +379,38 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
373 | //} | 379 | //} |
374 | private Type getLLObjectType(byte objectCode) | 380 | private Type getLLObjectType(byte objectCode) |
375 | { | 381 | { |
376 | switch ((LSO_Enums.Variable_Type_Codes)objectCode) | 382 | switch ((LSO_Enums.Variable_Type_Codes) objectCode) |
377 | { | 383 | { |
378 | case LSO_Enums.Variable_Type_Codes.Void: return typeof(void); | 384 | case LSO_Enums.Variable_Type_Codes.Void: |
379 | case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32); | 385 | return typeof (void); |
380 | case LSO_Enums.Variable_Type_Codes.Float: return typeof(float); | 386 | case LSO_Enums.Variable_Type_Codes.Integer: |
381 | case LSO_Enums.Variable_Type_Codes.String: return typeof(string); | 387 | return typeof (UInt32); |
382 | case LSO_Enums.Variable_Type_Codes.Key: return typeof(string); | 388 | case LSO_Enums.Variable_Type_Codes.Float: |
383 | case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector); | 389 | return typeof (float); |
384 | case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation); | 390 | case LSO_Enums.Variable_Type_Codes.String: |
391 | return typeof (string); | ||
392 | case LSO_Enums.Variable_Type_Codes.Key: | ||
393 | return typeof (string); | ||
394 | case LSO_Enums.Variable_Type_Codes.Vector: | ||
395 | return typeof (LSO_Enums.Vector); | ||
396 | case LSO_Enums.Variable_Type_Codes.Rotation: | ||
397 | return typeof (LSO_Enums.Rotation); | ||
385 | case LSO_Enums.Variable_Type_Codes.List: | 398 | case LSO_Enums.Variable_Type_Codes.List: |
386 | Common.SendToDebug("TODO: List datatype not implemented yet!"); | 399 | Common.SendToDebug("TODO: List datatype not implemented yet!"); |
387 | return typeof(System.Collections.ArrayList); | 400 | return typeof (ArrayList); |
388 | case LSO_Enums.Variable_Type_Codes.Null: | 401 | case LSO_Enums.Variable_Type_Codes.Null: |
389 | Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); | 402 | Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); |
390 | return typeof(string); | 403 | return typeof (string); |
391 | default: | 404 | default: |
392 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); | 405 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + |
393 | return typeof(object); | 406 | " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); |
407 | return typeof (object); | ||
394 | } | 408 | } |
395 | } | 409 | } |
410 | |||
396 | private int getObjectSize(byte ObjectType) | 411 | private int getObjectSize(byte ObjectType) |
397 | { | 412 | { |
398 | switch ((LSO_Enums.Variable_Type_Codes)ObjectType) | 413 | switch ((LSO_Enums.Variable_Type_Codes) ObjectType) |
399 | { | 414 | { |
400 | case LSO_Enums.Variable_Type_Codes.Integer: | 415 | case LSO_Enums.Variable_Type_Codes.Integer: |
401 | case LSO_Enums.Variable_Type_Codes.Float: | 416 | case LSO_Enums.Variable_Type_Codes.Float: |
@@ -411,13 +426,14 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
411 | return 0; | 426 | return 0; |
412 | } | 427 | } |
413 | } | 428 | } |
429 | |||
414 | private string Read_String() | 430 | private string Read_String() |
415 | { | 431 | { |
416 | string ret = ""; | 432 | string ret = ""; |
417 | byte reader = br_read(1)[0]; | 433 | byte reader = br_read(1)[0]; |
418 | while (reader != 0x000) | 434 | while (reader != 0x000) |
419 | { | 435 | { |
420 | ret += (char)reader; | 436 | ret += (char) reader; |
421 | reader = br_read(1)[0]; | 437 | reader = br_read(1)[0]; |
422 | } | 438 | } |
423 | return ret; | 439 | return ret; |
@@ -431,7 +447,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
431 | /// <param name="eventname">Name of event (function) to generate</param> | 447 | /// <param name="eventname">Name of event (function) to generate</param> |
432 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) | 448 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) |
433 | { | 449 | { |
434 | |||
435 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); | 450 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); |
436 | 451 | ||
437 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); | 452 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); |
@@ -442,12 +457,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
442 | myCodeChunk.Comment = Read_String(); | 457 | myCodeChunk.Comment = Read_String(); |
443 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); | 458 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); |
444 | myCodeChunk.ReturnTypePos = br_read(1)[0]; | 459 | myCodeChunk.ReturnTypePos = br_read(1)[0]; |
445 | myCodeChunk.ReturnType = GetStaticBlock((long)myCodeChunk.ReturnTypePos + (long)myHeader.GVR); | 460 | myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR); |
446 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + ((LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType.ObjectType).ToString()); | 461 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + |
462 | ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString()); | ||
447 | 463 | ||
448 | 464 | ||
449 | // TODO: How to determine number of codechunks -- does this method work? | 465 | // TODO: How to determine number of codechunks -- does this method work? |
450 | myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); | 466 | myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>(); |
451 | byte reader = br_read(1)[0]; | 467 | byte reader = br_read(1)[0]; |
452 | reader = br_read(1)[0]; | 468 | reader = br_read(1)[0]; |
453 | 469 | ||
@@ -464,14 +480,17 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
464 | CCA.NullString = reader; | 480 | CCA.NullString = reader; |
465 | CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); | 481 | CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); |
466 | myCodeChunk.CodeChunkArguments.Add(CCA); | 482 | myCodeChunk.CodeChunkArguments.Add(CCA); |
467 | Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + ": " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType.ObjectType); | 483 | Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + |
484 | ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType); | ||
468 | } | 485 | } |
469 | // Create string array | 486 | // Create string array |
470 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; | 487 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; |
471 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) | 488 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) |
472 | { | 489 | { |
473 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); | 490 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); |
474 | Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).ToString()); | 491 | Common.SendToDebug("Method argument " + _ic + ": " + |
492 | getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType). | ||
493 | ToString()); | ||
475 | } | 494 | } |
476 | // End marker is 0x000 | 495 | // End marker is 0x000 |
477 | myCodeChunk.EndMarker = reader; | 496 | myCodeChunk.EndMarker = reader; |
@@ -483,9 +502,9 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
483 | 502 | ||
484 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); | 503 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); |
485 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 504 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
486 | MethodAttributes.Public, | 505 | MethodAttributes.Public, |
487 | typeof(void), | 506 | typeof (void), |
488 | new Type[] { typeof(object) }); | 507 | new Type[] {typeof (object)}); |
489 | //MethodArgs); | 508 | //MethodArgs); |
490 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), | 509 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), |
491 | // new Type[] { typeof(object) }, //); | 510 | // new Type[] { typeof(object) }, //); |
@@ -504,7 +523,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
504 | IL_INSERT_TRY(il, eventname); | 523 | IL_INSERT_TRY(il, eventname); |
505 | 524 | ||
506 | 525 | ||
507 | |||
508 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | 526 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); |
509 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 527 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
510 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod | 528 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod |
@@ -520,7 +538,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
520 | } | 538 | } |
521 | 539 | ||
522 | 540 | ||
523 | |||
524 | // | 541 | // |
525 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL | 542 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL |
526 | // | 543 | // |
@@ -538,12 +555,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
538 | il.Emit(OpCodes.Ret); | 555 | il.Emit(OpCodes.Ret); |
539 | 556 | ||
540 | return; | 557 | return; |
541 | |||
542 | } | 558 | } |
543 | 559 | ||
544 | private void IL_INSERT_FUNCTIONLIST() | 560 | private void IL_INSERT_FUNCTIONLIST() |
545 | { | 561 | { |
546 | |||
547 | Common.SendToDebug("Creating function list"); | 562 | Common.SendToDebug("Creating function list"); |
548 | 563 | ||
549 | 564 | ||
@@ -557,11 +572,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
557 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); | 572 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); |
558 | 573 | ||
559 | 574 | ||
560 | |||
561 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 575 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
562 | MethodAttributes.Public, | 576 | MethodAttributes.Public, |
563 | typeof(string[]), | 577 | typeof (string[]), |
564 | null); | 578 | null); |
565 | 579 | ||
566 | //typeBuilder.DefineMethodOverride(methodBuilder, | 580 | //typeBuilder.DefineMethodOverride(methodBuilder, |
567 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | 581 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); |
@@ -569,8 +583,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
569 | ILGenerator il = methodBuilder.GetILGenerator(); | 583 | ILGenerator il = methodBuilder.GetILGenerator(); |
570 | 584 | ||
571 | 585 | ||
572 | |||
573 | |||
574 | // IL_INSERT_TRY(il, eventname); | 586 | // IL_INSERT_TRY(il, eventname); |
575 | 587 | ||
576 | // // Push string to stack | 588 | // // Push string to stack |
@@ -586,37 +598,34 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
586 | 598 | ||
587 | ////il.Emit(OpCodes.Ldarg_0); | 599 | ////il.Emit(OpCodes.Ldarg_0); |
588 | 600 | ||
589 | il.DeclareLocal(typeof(string[])); | 601 | il.DeclareLocal(typeof (string[])); |
590 | 602 | ||
591 | ////il.Emit(OpCodes.Ldarg_0); | 603 | ////il.Emit(OpCodes.Ldarg_0); |
592 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length | 604 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length |
593 | il.Emit(OpCodes.Newarr, typeof(String)); // create new string array | 605 | il.Emit(OpCodes.Newarr, typeof (String)); // create new string array |
594 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack | 606 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack |
595 | ////SetFunctionList | 607 | ////SetFunctionList |
596 | 608 | ||
597 | for (int lv = 0; lv < EventList.Count; lv++) | 609 | for (int lv = 0; lv < EventList.Count; lv++) |
598 | { | 610 | { |
599 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | 611 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack |
600 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position | 612 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position |
601 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | 613 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value |
602 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value | 614 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value |
603 | 615 | ||
604 | //il.Emit(OpCodes.Ldarg_0); | 616 | //il.Emit(OpCodes.Ldarg_0); |
605 | //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | 617 | //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value |
606 | //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); | 618 | //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); |
607 | |||
608 | } | 619 | } |
609 | 620 | ||
610 | 621 | ||
611 | |||
612 | // IL_INSERT_END_TRY(il, eventname); | 622 | // IL_INSERT_END_TRY(il, eventname); |
613 | 623 | ||
614 | 624 | ||
615 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | 625 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack |
616 | // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); | 626 | // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); |
617 | 627 | ||
618 | il.Emit(OpCodes.Ret); // Return | 628 | il.Emit(OpCodes.Ret); // Return |
619 | |||
620 | } | 629 | } |
621 | 630 | ||
622 | 631 | ||
@@ -631,7 +640,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
631 | // Push "Hello World!" string to stack | 640 | // Push "Hello World!" string to stack |
632 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 641 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
633 | //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); | 642 | //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); |
634 | |||
635 | } | 643 | } |
636 | 644 | ||
637 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) | 645 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) |
@@ -640,7 +648,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
640 | * CATCH | 648 | * CATCH |
641 | */ | 649 | */ |
642 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); | 650 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); |
643 | il.BeginCatchBlock(typeof(Exception)); | 651 | il.BeginCatchBlock(typeof (Exception)); |
644 | 652 | ||
645 | // Push "Hello World!" string to stack | 653 | // Push "Hello World!" string to stack |
646 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 654 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
@@ -648,18 +656,18 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
648 | 656 | ||
649 | //call void [mscorlib]System.Console::WriteLine(string) | 657 | //call void [mscorlib]System.Console::WriteLine(string) |
650 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 658 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
651 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 659 | il.Emit(OpCodes.Call, typeof (Console).GetMethod |
652 | ("Write", new Type[] { typeof(string) })); | 660 | ("Write", new Type[] {typeof (string)})); |
653 | 661 | ||
654 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 662 | //callvirt instance string [mscorlib]System.Exception::get_Message() |
655 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); | 663 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); |
656 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod | 664 | il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod |
657 | ("get_Message")); | 665 | ("get_Message")); |
658 | 666 | ||
659 | //call void [mscorlib]System.Console::WriteLine(string) | 667 | //call void [mscorlib]System.Console::WriteLine(string) |
660 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 668 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
661 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 669 | il.Emit(OpCodes.Call, typeof (Console).GetMethod |
662 | ("WriteLine", new Type[] { typeof(string) })); | 670 | ("WriteLine", new Type[] {typeof (string)})); |
663 | 671 | ||
664 | /* | 672 | /* |
665 | * CLR END TRY | 673 | * CLR END TRY |
@@ -673,7 +681,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
673 | long FirstPos = fs.Position; | 681 | long FirstPos = fs.Position; |
674 | try | 682 | try |
675 | { | 683 | { |
676 | UInt32 position = (UInt32)pos; | 684 | UInt32 position = (UInt32) pos; |
677 | // STATIC BLOCK | 685 | // STATIC BLOCK |
678 | Common.SendToDebug("Reading STATIC BLOCK at: " + position); | 686 | Common.SendToDebug("Reading STATIC BLOCK at: " + position); |
679 | fs.Seek(position, SeekOrigin.Begin); | 687 | fs.Seek(position, SeekOrigin.Begin); |
@@ -683,7 +691,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
683 | Common.SendToDebug("Found cached STATIC BLOCK"); | 691 | Common.SendToDebug("Found cached STATIC BLOCK"); |
684 | 692 | ||
685 | 693 | ||
686 | |||
687 | return StaticBlocks[pos]; | 694 | return StaticBlocks[pos]; |
688 | } | 695 | } |
689 | 696 | ||
@@ -699,7 +706,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
699 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 706 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
700 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 707 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
701 | myStaticBlock.ObjectType = br_read(1)[0]; | 708 | myStaticBlock.ObjectType = br_read(1)[0]; |
702 | Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); | 709 | Common.SendToDebug("Static Block ObjectType: " + |
710 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); | ||
703 | myStaticBlock.Unknown = br_read(1)[0]; | 711 | myStaticBlock.Unknown = br_read(1)[0]; |
704 | // Size of datatype varies | 712 | // Size of datatype varies |
705 | if (myStaticBlock.ObjectType != 0) | 713 | if (myStaticBlock.ObjectType != 0) |
@@ -715,8 +723,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
715 | // Go back to original read pos | 723 | // Go back to original read pos |
716 | fs.Seek(FirstPos, SeekOrigin.Begin); | 724 | fs.Seek(FirstPos, SeekOrigin.Begin); |
717 | } | 725 | } |
718 | |||
719 | } | 726 | } |
720 | |||
721 | } | 727 | } |
722 | } | 728 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs index f0203b3..2bb2c38 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs | |||
@@ -28,14 +28,13 @@ | |||
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections; | ||
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
32 | using System.Text; | ||
33 | 33 | ||
34 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 34 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
35 | { | 35 | { |
36 | static class LSO_Struct | 36 | internal static class LSO_Struct |
37 | { | 37 | { |
38 | |||
39 | public struct Header | 38 | public struct Header |
40 | { | 39 | { |
41 | public UInt32 TM; | 40 | public UInt32 TM; |
@@ -69,6 +68,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
69 | public byte Unknown; | 68 | public byte Unknown; |
70 | public byte[] BlockVariable; | 69 | public byte[] BlockVariable; |
71 | } | 70 | } |
71 | |||
72 | /* Not actually a structure | 72 | /* Not actually a structure |
73 | public struct StaticBlockVariable | 73 | public struct StaticBlockVariable |
74 | { | 74 | { |
@@ -80,6 +80,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
80 | public byte[] Rotation_16; | 80 | public byte[] Rotation_16; |
81 | public UInt32 Pointer_List_Structure; | 81 | public UInt32 Pointer_List_Structure; |
82 | } */ | 82 | } */ |
83 | |||
83 | public struct HeapBlock | 84 | public struct HeapBlock |
84 | { | 85 | { |
85 | public Int32 DataBlockSize; | 86 | public Int32 DataBlockSize; |
@@ -87,17 +88,20 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
87 | public UInt16 ReferenceCount; | 88 | public UInt16 ReferenceCount; |
88 | public byte[] Data; | 89 | public byte[] Data; |
89 | } | 90 | } |
91 | |||
90 | public struct StateFrameBlock | 92 | public struct StateFrameBlock |
91 | { | 93 | { |
92 | public UInt32 StateCount; | 94 | public UInt32 StateCount; |
93 | public StatePointerBlock[] StatePointer; | 95 | public StatePointerBlock[] StatePointer; |
94 | } | 96 | } |
97 | |||
95 | public struct StatePointerBlock | 98 | public struct StatePointerBlock |
96 | { | 99 | { |
97 | public UInt32 Location; | 100 | public UInt32 Location; |
98 | public System.Collections.BitArray EventMask; | 101 | public BitArray EventMask; |
99 | public StateBlock StateBlock; | 102 | public StateBlock StateBlock; |
100 | } | 103 | } |
104 | |||
101 | public struct StateBlock | 105 | public struct StateBlock |
102 | { | 106 | { |
103 | public UInt32 StartPos; | 107 | public UInt32 StartPos; |
@@ -106,25 +110,29 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
106 | public byte Unknown; | 110 | public byte Unknown; |
107 | public StateBlockHandler[] StateBlockHandlers; | 111 | public StateBlockHandler[] StateBlockHandlers; |
108 | } | 112 | } |
113 | |||
109 | public struct StateBlockHandler | 114 | public struct StateBlockHandler |
110 | { | 115 | { |
111 | public UInt32 CodeChunkPointer; | 116 | public UInt32 CodeChunkPointer; |
112 | public UInt32 CallFrameSize; | 117 | public UInt32 CallFrameSize; |
113 | } | 118 | } |
119 | |||
114 | public struct FunctionBlock | 120 | public struct FunctionBlock |
115 | { | 121 | { |
116 | public UInt32 FunctionCount; | 122 | public UInt32 FunctionCount; |
117 | public UInt32[] CodeChunkPointer; | 123 | public UInt32[] CodeChunkPointer; |
118 | } | 124 | } |
125 | |||
119 | public struct CodeChunk | 126 | public struct CodeChunk |
120 | { | 127 | { |
121 | public UInt32 CodeChunkHeaderSize; | 128 | public UInt32 CodeChunkHeaderSize; |
122 | public string Comment; | 129 | public string Comment; |
123 | public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; | 130 | public List<CodeChunkArgument> CodeChunkArguments; |
124 | public byte EndMarker; | 131 | public byte EndMarker; |
125 | public byte ReturnTypePos; | 132 | public byte ReturnTypePos; |
126 | public StaticBlock ReturnType; | 133 | public StaticBlock ReturnType; |
127 | } | 134 | } |
135 | |||
128 | public struct CodeChunkArgument | 136 | public struct CodeChunkArgument |
129 | { | 137 | { |
130 | public byte FunctionReturnTypePos; | 138 | public byte FunctionReturnTypePos; |
@@ -132,4 +140,4 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
132 | public StaticBlock FunctionReturnType; | 140 | public StaticBlock FunctionReturnType; |
133 | } | 141 | } |
134 | } | 142 | } |
135 | } | 143 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 8e7b95e..7bc3ce4 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -26,19 +26,18 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Axiom.Math; | ||
30 | using System; | 29 | using System; |
31 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Runtime.Remoting.Lifetime; | ||
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | ||
34 | using Axiom.Math; | ||
33 | using libsecondlife; | 35 | using libsecondlife; |
34 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment.Scenes.Scripting; | 37 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; |
36 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; | 39 | using OpenSim.Region.Environment.Scenes; |
38 | using OpenSim.Region.ScriptEngine.Common; | 40 | using OpenSim.Region.ScriptEngine.Common; |
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework; | ||
41 | using System.Runtime.Remoting.Lifetime; | ||
42 | 41 | ||
43 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | 42 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler |
44 | { | 43 | { |
@@ -53,8 +52,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
53 | /// </summary> | 52 | /// </summary> |
54 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface | 53 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface |
55 | { | 54 | { |
56 | 55 | private ASCIIEncoding enc = new ASCIIEncoding(); | |
57 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
58 | private ScriptEngine m_ScriptEngine; | 56 | private ScriptEngine m_ScriptEngine; |
59 | private SceneObjectPart m_host; | 57 | private SceneObjectPart m_host; |
60 | private uint m_localID; | 58 | private uint m_localID; |
@@ -86,7 +84,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
86 | { | 84 | { |
87 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); | 85 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); |
88 | // return null; | 86 | // return null; |
89 | ILease lease = (ILease)base.InitializeLifetimeService(); | 87 | ILease lease = (ILease) base.InitializeLifetimeService(); |
90 | 88 | ||
91 | if (lease.CurrentState == LeaseState.Initial) | 89 | if (lease.CurrentState == LeaseState.Initial) |
92 | { | 90 | { |
@@ -105,79 +103,130 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
105 | 103 | ||
106 | //These are the implementations of the various ll-functions used by the LSL scripts. | 104 | //These are the implementations of the various ll-functions used by the LSL scripts. |
107 | //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 | 105 | //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 |
108 | public double llSin(double f) { return (double)Math.Sin(f); } | 106 | public double llSin(double f) |
109 | public double llCos(double f) { return (double)Math.Cos(f); } | 107 | { |
110 | public double llTan(double f) { return (double)Math.Tan(f); } | 108 | return (double) Math.Sin(f); |
111 | public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } | 109 | } |
112 | public double llSqrt(double f) { return (double)Math.Sqrt(f); } | 110 | |
113 | public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } | 111 | public double llCos(double f) |
114 | public int llAbs(int i) { return (int)Math.Abs(i); } | 112 | { |
115 | public double llFabs(double f) { return (double)Math.Abs(f); } | 113 | return (double) Math.Cos(f); |
114 | } | ||
115 | |||
116 | public double llTan(double f) | ||
117 | { | ||
118 | return (double) Math.Tan(f); | ||
119 | } | ||
120 | |||
121 | public double llAtan2(double x, double y) | ||
122 | { | ||
123 | return (double) Math.Atan2(y, x); | ||
124 | } | ||
125 | |||
126 | public double llSqrt(double f) | ||
127 | { | ||
128 | return (double) Math.Sqrt(f); | ||
129 | } | ||
130 | |||
131 | public double llPow(double fbase, double fexponent) | ||
132 | { | ||
133 | return (double) Math.Pow(fbase, fexponent); | ||
134 | } | ||
135 | |||
136 | public int llAbs(int i) | ||
137 | { | ||
138 | return (int) Math.Abs(i); | ||
139 | } | ||
140 | |||
141 | public double llFabs(double f) | ||
142 | { | ||
143 | return (double) Math.Abs(f); | ||
144 | } | ||
116 | 145 | ||
117 | public double llFrand(double mag) | 146 | public double llFrand(double mag) |
118 | { | 147 | { |
119 | lock (Util.RandomClass) | 148 | lock (Util.RandomClass) |
120 | { | 149 | { |
121 | return Util.RandomClass.Next((int)mag); | 150 | return Util.RandomClass.Next((int) mag); |
122 | } | 151 | } |
123 | } | 152 | } |
124 | 153 | ||
125 | public int llFloor(double f) { return (int)Math.Floor(f); } | 154 | public int llFloor(double f) |
126 | public int llCeil(double f) { return (int)Math.Ceiling(f); } | 155 | { |
127 | public int llRound(double f) { return (int)Math.Round(f, 3); } | 156 | return (int) Math.Floor(f); |
157 | } | ||
158 | |||
159 | public int llCeil(double f) | ||
160 | { | ||
161 | return (int) Math.Ceiling(f); | ||
162 | } | ||
163 | |||
164 | public int llRound(double f) | ||
165 | { | ||
166 | return (int) Math.Round(f, 3); | ||
167 | } | ||
128 | 168 | ||
129 | //This next group are vector operations involving squaring and square root. ckrinke | 169 | //This next group are vector operations involving squaring and square root. ckrinke |
130 | public double llVecMag(LSL_Types.Vector3 v) | 170 | public double llVecMag(LSL_Types.Vector3 v) |
131 | { | 171 | { |
132 | return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); | 172 | return (v.X*v.X + v.Y*v.Y + v.Z*v.Z); |
133 | } | 173 | } |
134 | 174 | ||
135 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) | 175 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) |
136 | { | 176 | { |
137 | double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; | 177 | double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z; |
138 | LSL_Types.Vector3 nor = new LSL_Types.Vector3(); | 178 | LSL_Types.Vector3 nor = new LSL_Types.Vector3(); |
139 | nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; | 179 | nor.X = v.X/mag; |
180 | nor.Y = v.Y/mag; | ||
181 | nor.Z = v.Z/mag; | ||
140 | return nor; | 182 | return nor; |
141 | } | 183 | } |
142 | 184 | ||
143 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) | 185 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) |
144 | { | 186 | { |
145 | double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; | 187 | double dx = a.X - b.X; |
146 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); | 188 | double dy = a.Y - b.Y; |
189 | double dz = a.Z - b.Z; | ||
190 | return Math.Sqrt(dx*dx + dy*dy + dz*dz); | ||
147 | } | 191 | } |
148 | 192 | ||
149 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke | 193 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke |
150 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) | 194 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) |
151 | { | 195 | { |
152 | //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke | 196 | //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke |
153 | LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); | 197 | LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R); |
154 | double m = (t.X + t.Y + t.Z + t.R); | 198 | double m = (t.X + t.Y + t.Z + t.R); |
155 | if (m == 0) return new LSL_Types.Vector3(); | 199 | if (m == 0) return new LSL_Types.Vector3(); |
156 | double n = 2 * (r.Y * r.R + r.X * r.Z); | 200 | double n = 2*(r.Y*r.R + r.X*r.Z); |
157 | double p = m * m - n * n; | 201 | double p = m*m - n*n; |
158 | if (p > 0) | 202 | if (p > 0) |
159 | 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)), | 203 | 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)), |
160 | 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))); | 204 | Math.Atan2(n, Math.Sqrt(p)), |
205 | Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R))); | ||
161 | else if (n > 0) | 206 | else if (n > 0) |
162 | 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)); | 207 | 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)); |
163 | else | 208 | else |
164 | 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)); | 209 | 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)); |
165 | } | 210 | } |
166 | 211 | ||
167 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) | 212 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) |
168 | { | 213 | { |
169 | //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 | 214 | //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 |
170 | float err = 0.00001f; | 215 | float err = 0.00001f; |
171 | double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); | 216 | double ax = Math.Sin(v.X/2); |
172 | double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); | 217 | double aw = Math.Cos(v.X/2); |
173 | double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); | 218 | double by = Math.Sin(v.Y/2); |
219 | double bw = Math.Cos(v.Y/2); | ||
220 | double cz = Math.Sin(v.Z/2); | ||
221 | double cw = Math.Cos(v.Z/2); | ||
174 | LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); | 222 | LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); |
175 | LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); | 223 | LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); |
176 | LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); | 224 | LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); |
177 | LSL_Types.Quaternion a = new LSL_Types.Quaternion(); | 225 | LSL_Types.Quaternion a = new LSL_Types.Quaternion(); |
178 | //This multiplication doesnt compile, yet. a = a1 * a2 * a3; | 226 | //This multiplication doesnt compile, yet. a = a1 * a2 * a3; |
179 | LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, | 227 | LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz, |
180 | aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); | 228 | aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw, |
229 | aw*bw*cw - ax*by*cz); | ||
181 | LSL_Types.Quaternion c = new LSL_Types.Quaternion(); | 230 | LSL_Types.Quaternion c = new LSL_Types.Quaternion(); |
182 | //This addition doesnt compile yet c = a + b; | 231 | //This addition doesnt compile yet c = a + b; |
183 | LSL_Types.Quaternion d = new LSL_Types.Quaternion(); | 232 | LSL_Types.Quaternion d = new LSL_Types.Quaternion(); |
@@ -194,11 +243,30 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
194 | return new LSL_Types.Quaternion(); | 243 | return new LSL_Types.Quaternion(); |
195 | } | 244 | } |
196 | 245 | ||
197 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } | 246 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) |
198 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | 247 | { |
199 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | 248 | return new LSL_Types.Quaternion(); |
200 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | 249 | } |
201 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } | 250 | |
251 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) | ||
252 | { | ||
253 | return new LSL_Types.Vector3(); | ||
254 | } | ||
255 | |||
256 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) | ||
257 | { | ||
258 | return new LSL_Types.Vector3(); | ||
259 | } | ||
260 | |||
261 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) | ||
262 | { | ||
263 | return new LSL_Types.Vector3(); | ||
264 | } | ||
265 | |||
266 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) | ||
267 | { | ||
268 | return new LSL_Types.Quaternion(); | ||
269 | } | ||
202 | 270 | ||
203 | public void llWhisper(int channelID, string text) | 271 | public void llWhisper(int channelID, string text) |
204 | { | 272 | { |
@@ -212,7 +280,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
212 | //type for say is 1 | 280 | //type for say is 1 |
213 | 281 | ||
214 | World.SimChat(Helpers.StringToField(text), | 282 | World.SimChat(Helpers.StringToField(text), |
215 | 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 283 | 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
216 | } | 284 | } |
217 | 285 | ||
218 | public void llShout(int channelID, string text) | 286 | public void llShout(int channelID, string text) |
@@ -222,64 +290,217 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
222 | 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 290 | 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
223 | } | 291 | } |
224 | 292 | ||
225 | public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; } | 293 | public int llListen(int channelID, string name, string ID, string msg) |
226 | public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; } | 294 | { |
227 | public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; } | 295 | NotImplemented("llListen"); |
228 | public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } | 296 | return 0; |
229 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } | 297 | } |
230 | public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } | 298 | |
231 | public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } | 299 | public void llListenControl(int number, int active) |
232 | public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } | 300 | { |
233 | public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } | 301 | NotImplemented("llListenControl"); |
234 | public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } | 302 | return; |
235 | public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } | 303 | } |
236 | public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } | 304 | |
237 | public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } | 305 | public void llListenRemove(int number) |
238 | public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } | 306 | { |
239 | public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } | 307 | NotImplemented("llListenRemove"); |
240 | public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } | 308 | return; |
241 | public void llDie() { NotImplemented("llDie"); return; } | 309 | } |
242 | public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } | 310 | |
243 | public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } | 311 | public void llSensor(string name, string id, int type, double range, double arc) |
244 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } | 312 | { |
245 | public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } | 313 | NotImplemented("llSensor"); |
246 | public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } | 314 | return; |
315 | } | ||
316 | |||
317 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | ||
318 | { | ||
319 | NotImplemented("llSensorRepeat"); | ||
320 | return; | ||
321 | } | ||
322 | |||
323 | public void llSensorRemove() | ||
324 | { | ||
325 | NotImplemented("llSensorRemove"); | ||
326 | return; | ||
327 | } | ||
328 | |||
329 | public string llDetectedName(int number) | ||
330 | { | ||
331 | NotImplemented("llDetectedName"); | ||
332 | return ""; | ||
333 | } | ||
334 | |||
335 | public string llDetectedKey(int number) | ||
336 | { | ||
337 | NotImplemented("llDetectedKey"); | ||
338 | return ""; | ||
339 | } | ||
340 | |||
341 | public string llDetectedOwner(int number) | ||
342 | { | ||
343 | NotImplemented("llDetectedOwner"); | ||
344 | return ""; | ||
345 | } | ||
346 | |||
347 | public int llDetectedType(int number) | ||
348 | { | ||
349 | NotImplemented("llDetectedType"); | ||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | public LSL_Types.Vector3 llDetectedPos(int number) | ||
354 | { | ||
355 | NotImplemented("llDetectedPos"); | ||
356 | return new LSL_Types.Vector3(); | ||
357 | } | ||
358 | |||
359 | public LSL_Types.Vector3 llDetectedVel(int number) | ||
360 | { | ||
361 | NotImplemented("llDetectedVel"); | ||
362 | return new LSL_Types.Vector3(); | ||
363 | } | ||
364 | |||
365 | public LSL_Types.Vector3 llDetectedGrab(int number) | ||
366 | { | ||
367 | NotImplemented("llDetectedGrab"); | ||
368 | return new LSL_Types.Vector3(); | ||
369 | } | ||
370 | |||
371 | public LSL_Types.Quaternion llDetectedRot(int number) | ||
372 | { | ||
373 | NotImplemented("llDetectedRot"); | ||
374 | return new LSL_Types.Quaternion(); | ||
375 | } | ||
376 | |||
377 | public int llDetectedGroup(int number) | ||
378 | { | ||
379 | NotImplemented("llDetectedGroup"); | ||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | public int llDetectedLinkNumber(int number) | ||
384 | { | ||
385 | NotImplemented("llDetectedLinkNumber"); | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | public void llDie() | ||
390 | { | ||
391 | NotImplemented("llDie"); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | public double llGround(LSL_Types.Vector3 offset) | ||
396 | { | ||
397 | NotImplemented("llGround"); | ||
398 | return 0; | ||
399 | } | ||
400 | |||
401 | public double llCloud(LSL_Types.Vector3 offset) | ||
402 | { | ||
403 | NotImplemented("llCloud"); | ||
404 | return 0; | ||
405 | } | ||
406 | |||
407 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) | ||
408 | { | ||
409 | NotImplemented("llWind"); | ||
410 | return new LSL_Types.Vector3(); | ||
411 | } | ||
412 | |||
413 | public void llSetStatus(int status, int value) | ||
414 | { | ||
415 | NotImplemented("llSetStatus"); | ||
416 | return; | ||
417 | } | ||
418 | |||
419 | public int llGetStatus(int status) | ||
420 | { | ||
421 | NotImplemented("llGetStatus"); | ||
422 | return 0; | ||
423 | } | ||
247 | 424 | ||
248 | public void llSetScale(LSL_Types.Vector3 scale) | 425 | public void llSetScale(LSL_Types.Vector3 scale) |
249 | { | 426 | { |
250 | // TODO: this needs to trigger a persistance save as well | 427 | // TODO: this needs to trigger a persistance save as well |
251 | LLVector3 tmp = m_host.Scale; | 428 | LLVector3 tmp = m_host.Scale; |
252 | tmp.X = (float)scale.X; | 429 | tmp.X = (float) scale.X; |
253 | tmp.Y = (float)scale.Y; | 430 | tmp.Y = (float) scale.Y; |
254 | tmp.Z = (float)scale.Z; | 431 | tmp.Z = (float) scale.Z; |
255 | m_host.Scale = tmp; | 432 | m_host.Scale = tmp; |
256 | return; | 433 | return; |
257 | } | 434 | } |
435 | |||
258 | public LSL_Types.Vector3 llGetScale() | 436 | public LSL_Types.Vector3 llGetScale() |
259 | { | 437 | { |
260 | return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); | 438 | return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); |
261 | } | 439 | } |
262 | 440 | ||
263 | public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } | 441 | public void llSetColor(LSL_Types.Vector3 color, int face) |
264 | public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } | 442 | { |
265 | public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } | 443 | NotImplemented("llSetColor"); |
266 | public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } | 444 | return; |
267 | public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } | 445 | } |
268 | public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } | ||
269 | public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } | ||
270 | public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } | ||
271 | 446 | ||
272 | public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } | 447 | public double llGetAlpha(int face) |
448 | { | ||
449 | NotImplemented("llGetAlpha"); | ||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | public void llSetAlpha(double alpha, int face) | ||
454 | { | ||
455 | NotImplemented("llSetAlpha"); | ||
456 | return; | ||
457 | } | ||
458 | |||
459 | public LSL_Types.Vector3 llGetColor(int face) | ||
460 | { | ||
461 | NotImplemented("llGetColor"); | ||
462 | return new LSL_Types.Vector3(); | ||
463 | } | ||
464 | |||
465 | public void llSetTexture(string texture, int face) | ||
466 | { | ||
467 | NotImplemented("llSetTexture"); | ||
468 | return; | ||
469 | } | ||
470 | |||
471 | public void llScaleTexture(double u, double v, int face) | ||
472 | { | ||
473 | NotImplemented("llScaleTexture"); | ||
474 | return; | ||
475 | } | ||
476 | |||
477 | public void llOffsetTexture(double u, double v, int face) | ||
478 | { | ||
479 | NotImplemented("llOffsetTexture"); | ||
480 | return; | ||
481 | } | ||
482 | |||
483 | public void llRotateTexture(double rotation, int face) | ||
484 | { | ||
485 | NotImplemented("llRotateTexture"); | ||
486 | return; | ||
487 | } | ||
488 | |||
489 | public string llGetTexture(int face) | ||
490 | { | ||
491 | NotImplemented("llGetTexture"); | ||
492 | return ""; | ||
493 | } | ||
273 | 494 | ||
274 | public void llSetPos(LSL_Types.Vector3 pos) | 495 | public void llSetPos(LSL_Types.Vector3 pos) |
275 | { | 496 | { |
276 | if (m_host.ParentID != 0) | 497 | if (m_host.ParentID != 0) |
277 | { | 498 | { |
278 | m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 499 | m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); |
279 | } | 500 | } |
280 | else | 501 | else |
281 | { | 502 | { |
282 | m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 503 | m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); |
283 | } | 504 | } |
284 | } | 505 | } |
285 | 506 | ||
@@ -305,51 +526,183 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
305 | m_host.AbsolutePosition.Z); | 526 | m_host.AbsolutePosition.Z); |
306 | } | 527 | } |
307 | } | 528 | } |
529 | |||
308 | public void llSetRot(LSL_Types.Quaternion rot) | 530 | public void llSetRot(LSL_Types.Quaternion rot) |
309 | { | 531 | { |
310 | m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); | 532 | m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R)); |
311 | } | 533 | } |
534 | |||
312 | public LSL_Types.Quaternion llGetRot() | 535 | public LSL_Types.Quaternion llGetRot() |
313 | { | 536 | { |
314 | LLQuaternion q = m_host.RotationOffset; | 537 | LLQuaternion q = m_host.RotationOffset; |
315 | return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | 538 | return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); |
316 | } | 539 | } |
317 | public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } | 540 | |
318 | public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } | 541 | public LSL_Types.Quaternion llGetLocalRot() |
319 | public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } | 542 | { |
320 | public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } | 543 | NotImplemented("llGetLocalRot"); |
321 | public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } | 544 | return new LSL_Types.Quaternion(); |
322 | public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } | 545 | } |
323 | public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } | 546 | |
324 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } | 547 | public void llSetForce(LSL_Types.Vector3 force, int local) |
325 | public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } | 548 | { |
326 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } | 549 | NotImplemented("llSetForce"); |
327 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } | 550 | } |
328 | public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } | 551 | |
329 | public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } | 552 | public LSL_Types.Vector3 llGetForce() |
330 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } | 553 | { |
331 | public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } | 554 | NotImplemented("llGetForce"); |
332 | public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } | 555 | return new LSL_Types.Vector3(); |
333 | public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } | 556 | } |
334 | public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } | 557 | |
558 | public int llTarget(LSL_Types.Vector3 position, double range) | ||
559 | { | ||
560 | NotImplemented("llTarget"); | ||
561 | return 0; | ||
562 | } | ||
563 | |||
564 | public void llTargetRemove(int number) | ||
565 | { | ||
566 | NotImplemented("llTargetRemove"); | ||
567 | } | ||
568 | |||
569 | public int llRotTarget(LSL_Types.Quaternion rot, double error) | ||
570 | { | ||
571 | NotImplemented("llRotTarget"); | ||
572 | return 0; | ||
573 | } | ||
574 | |||
575 | public void llRotTargetRemove(int number) | ||
576 | { | ||
577 | NotImplemented("llRotTargetRemove"); | ||
578 | } | ||
579 | |||
580 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) | ||
581 | { | ||
582 | NotImplemented("llMoveToTarget"); | ||
583 | } | ||
584 | |||
585 | public void llStopMoveToTarget() | ||
586 | { | ||
587 | NotImplemented("llStopMoveToTarget"); | ||
588 | } | ||
589 | |||
590 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) | ||
591 | { | ||
592 | NotImplemented("llApplyImpulse"); | ||
593 | } | ||
594 | |||
595 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) | ||
596 | { | ||
597 | NotImplemented("llApplyRotationalImpulse"); | ||
598 | } | ||
599 | |||
600 | public void llSetTorque(LSL_Types.Vector3 torque, int local) | ||
601 | { | ||
602 | NotImplemented("llSetTorque"); | ||
603 | } | ||
604 | |||
605 | public LSL_Types.Vector3 llGetTorque() | ||
606 | { | ||
607 | NotImplemented("llGetTorque"); | ||
608 | return new LSL_Types.Vector3(); | ||
609 | } | ||
610 | |||
611 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) | ||
612 | { | ||
613 | NotImplemented("llSetForceAndTorque"); | ||
614 | } | ||
615 | |||
616 | public LSL_Types.Vector3 llGetVel() | ||
617 | { | ||
618 | NotImplemented("llGetVel"); | ||
619 | return new LSL_Types.Vector3(); | ||
620 | } | ||
621 | |||
622 | public LSL_Types.Vector3 llGetAccel() | ||
623 | { | ||
624 | NotImplemented("llGetAccel"); | ||
625 | return new LSL_Types.Vector3(); | ||
626 | } | ||
627 | |||
628 | public LSL_Types.Vector3 llGetOmega() | ||
629 | { | ||
630 | NotImplemented("llGetOmega"); | ||
631 | return new LSL_Types.Vector3(); | ||
632 | } | ||
633 | |||
634 | public double llGetTimeOfDay() | ||
635 | { | ||
636 | NotImplemented("llGetTimeOfDay"); | ||
637 | return 0; | ||
638 | } | ||
335 | 639 | ||
336 | public double llGetWallclock() | 640 | public double llGetWallclock() |
337 | { | 641 | { |
338 | return DateTime.Now.TimeOfDay.TotalSeconds; | 642 | return DateTime.Now.TimeOfDay.TotalSeconds; |
339 | } | 643 | } |
340 | 644 | ||
341 | public double llGetTime() { NotImplemented("llGetTime"); return 0; } | 645 | public double llGetTime() |
342 | public void llResetTime() { NotImplemented("llResetTime"); } | 646 | { |
343 | public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } | 647 | NotImplemented("llGetTime"); |
344 | public void llSound() { NotImplemented("llSound"); } | 648 | return 0; |
345 | public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } | 649 | } |
346 | public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } | 650 | |
347 | public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } | 651 | public void llResetTime() |
348 | public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } | 652 | { |
349 | public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } | 653 | NotImplemented("llResetTime"); |
350 | public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } | 654 | } |
351 | public void llStopSound() { NotImplemented("llStopSound"); } | 655 | |
352 | public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } | 656 | public double llGetAndResetTime() |
657 | { | ||
658 | NotImplemented("llGetAndResetTime"); | ||
659 | return 0; | ||
660 | } | ||
661 | |||
662 | public void llSound() | ||
663 | { | ||
664 | NotImplemented("llSound"); | ||
665 | } | ||
666 | |||
667 | public void llPlaySound(string sound, double volume) | ||
668 | { | ||
669 | NotImplemented("llPlaySound"); | ||
670 | } | ||
671 | |||
672 | public void llLoopSound(string sound, double volume) | ||
673 | { | ||
674 | NotImplemented("llLoopSound"); | ||
675 | } | ||
676 | |||
677 | public void llLoopSoundMaster(string sound, double volume) | ||
678 | { | ||
679 | NotImplemented("llLoopSoundMaster"); | ||
680 | } | ||
681 | |||
682 | public void llLoopSoundSlave(string sound, double volume) | ||
683 | { | ||
684 | NotImplemented("llLoopSoundSlave"); | ||
685 | } | ||
686 | |||
687 | public void llPlaySoundSlave(string sound, double volume) | ||
688 | { | ||
689 | NotImplemented("llPlaySoundSlave"); | ||
690 | } | ||
691 | |||
692 | public void llTriggerSound(string sound, double volume) | ||
693 | { | ||
694 | NotImplemented("llTriggerSound"); | ||
695 | } | ||
696 | |||
697 | public void llStopSound() | ||
698 | { | ||
699 | NotImplemented("llStopSound"); | ||
700 | } | ||
701 | |||
702 | public void llPreloadSound(string sound) | ||
703 | { | ||
704 | NotImplemented("llPreloadSound"); | ||
705 | } | ||
353 | 706 | ||
354 | public string llGetSubString(string src, int start, int end) | 707 | public string llGetSubString(string src, int start, int end) |
355 | { | 708 | { |
@@ -360,10 +713,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
360 | { | 713 | { |
361 | return src.Remove(start, end - start); | 714 | return src.Remove(start, end - start); |
362 | } | 715 | } |
716 | |||
363 | public string llInsertString(string dst, int position, string src) | 717 | public string llInsertString(string dst, int position, string src) |
364 | { | 718 | { |
365 | return dst.Insert(position, src); | 719 | return dst.Insert(position, src); |
366 | } | 720 | } |
721 | |||
367 | public string llToUpper(string src) | 722 | public string llToUpper(string src) |
368 | { | 723 | { |
369 | return src.ToUpper(); | 724 | return src.ToUpper(); |
@@ -374,14 +729,46 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
374 | return src.ToLower(); | 729 | return src.ToLower(); |
375 | } | 730 | } |
376 | 731 | ||
377 | public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } | 732 | public int llGiveMoney(string destination, int amount) |
378 | public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } | 733 | { |
379 | public void llMakeFountain() { NotImplemented("llMakeFountain"); } | 734 | NotImplemented("llGiveMoney"); |
380 | public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } | 735 | return 0; |
381 | public void llMakeFire() { NotImplemented("llMakeFire"); } | 736 | } |
382 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } | 737 | |
383 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } | 738 | public void llMakeExplosion() |
384 | public void llStopLookAt() { NotImplemented("llStopLookAt"); } | 739 | { |
740 | NotImplemented("llMakeExplosion"); | ||
741 | } | ||
742 | |||
743 | public void llMakeFountain() | ||
744 | { | ||
745 | NotImplemented("llMakeFountain"); | ||
746 | } | ||
747 | |||
748 | public void llMakeSmoke() | ||
749 | { | ||
750 | NotImplemented("llMakeSmoke"); | ||
751 | } | ||
752 | |||
753 | public void llMakeFire() | ||
754 | { | ||
755 | NotImplemented("llMakeFire"); | ||
756 | } | ||
757 | |||
758 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) | ||
759 | { | ||
760 | NotImplemented("llRezObject"); | ||
761 | } | ||
762 | |||
763 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) | ||
764 | { | ||
765 | NotImplemented("llLookAt"); | ||
766 | } | ||
767 | |||
768 | public void llStopLookAt() | ||
769 | { | ||
770 | NotImplemented("llStopLookAt"); | ||
771 | } | ||
385 | 772 | ||
386 | public void llSetTimerEvent(double sec) | 773 | public void llSetTimerEvent(double sec) |
387 | { | 774 | { |
@@ -391,38 +778,104 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
391 | 778 | ||
392 | public void llSleep(double sec) | 779 | public void llSleep(double sec) |
393 | { | 780 | { |
394 | System.Threading.Thread.Sleep((int)(sec * 1000)); | 781 | Thread.Sleep((int) (sec*1000)); |
782 | } | ||
783 | |||
784 | public double llGetMass() | ||
785 | { | ||
786 | NotImplemented("llGetMass"); | ||
787 | return 0; | ||
788 | } | ||
789 | |||
790 | public void llCollisionFilter(string name, string id, int accept) | ||
791 | { | ||
792 | NotImplemented("llCollisionFilter"); | ||
793 | } | ||
794 | |||
795 | public void llTakeControls(int controls, int accept, int pass_on) | ||
796 | { | ||
797 | NotImplemented("llTakeControls"); | ||
798 | } | ||
799 | |||
800 | public void llReleaseControls() | ||
801 | { | ||
802 | NotImplemented("llReleaseControls"); | ||
803 | } | ||
804 | |||
805 | public void llAttachToAvatar(int attachment) | ||
806 | { | ||
807 | NotImplemented("llAttachToAvatar"); | ||
395 | } | 808 | } |
396 | 809 | ||
397 | public double llGetMass() { NotImplemented("llGetMass"); return 0; } | 810 | public void llDetachFromAvatar() |
398 | public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } | 811 | { |
399 | public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } | 812 | NotImplemented("llDetachFromAvatar"); |
400 | public void llReleaseControls() { NotImplemented("llReleaseControls"); } | 813 | } |
401 | public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } | 814 | |
402 | public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } | 815 | public void llTakeCamera() |
403 | public void llTakeCamera() { NotImplemented("llTakeCamera"); } | 816 | { |
404 | public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } | 817 | NotImplemented("llTakeCamera"); |
818 | } | ||
819 | |||
820 | public void llReleaseCamera() | ||
821 | { | ||
822 | NotImplemented("llReleaseCamera"); | ||
823 | } | ||
405 | 824 | ||
406 | public string llGetOwner() | 825 | public string llGetOwner() |
407 | { | 826 | { |
408 | return m_host.ObjectOwner.ToStringHyphenated(); | 827 | return m_host.ObjectOwner.ToStringHyphenated(); |
409 | } | 828 | } |
410 | 829 | ||
411 | public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } | 830 | public void llInstantMessage(string user, string message) |
412 | public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } | 831 | { |
413 | public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } | 832 | NotImplemented("llInstantMessage"); |
833 | } | ||
834 | |||
835 | public void llEmail(string address, string subject, string message) | ||
836 | { | ||
837 | NotImplemented("llEmail"); | ||
838 | } | ||
839 | |||
840 | public void llGetNextEmail(string address, string subject) | ||
841 | { | ||
842 | NotImplemented("llGetNextEmail"); | ||
843 | } | ||
414 | 844 | ||
415 | public string llGetKey() | 845 | public string llGetKey() |
416 | { | 846 | { |
417 | return m_host.UUID.ToStringHyphenated(); | 847 | return m_host.UUID.ToStringHyphenated(); |
418 | } | 848 | } |
419 | 849 | ||
420 | public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } | 850 | public void llSetBuoyancy(double buoyancy) |
421 | public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } | 851 | { |
422 | public void llStopHover() { NotImplemented("llStopHover"); } | 852 | NotImplemented("llSetBuoyancy"); |
423 | public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } | 853 | } |
424 | public void llSoundPreload() { NotImplemented("llSoundPreload"); } | 854 | |
425 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } | 855 | public void llSetHoverHeight(double height, int water, double tau) |
856 | { | ||
857 | NotImplemented("llSetHoverHeight"); | ||
858 | } | ||
859 | |||
860 | public void llStopHover() | ||
861 | { | ||
862 | NotImplemented("llStopHover"); | ||
863 | } | ||
864 | |||
865 | public void llMinEventDelay(double delay) | ||
866 | { | ||
867 | NotImplemented("llMinEventDelay"); | ||
868 | } | ||
869 | |||
870 | public void llSoundPreload() | ||
871 | { | ||
872 | NotImplemented("llSoundPreload"); | ||
873 | } | ||
874 | |||
875 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) | ||
876 | { | ||
877 | NotImplemented("llRotLookAt"); | ||
878 | } | ||
426 | 879 | ||
427 | public int llStringLength(string str) | 880 | public int llStringLength(string str) |
428 | { | 881 | { |
@@ -436,88 +889,289 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
436 | } | 889 | } |
437 | } | 890 | } |
438 | 891 | ||
439 | public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } | 892 | public void llStartAnimation(string anim) |
440 | public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } | 893 | { |
441 | public void llPointAt() { NotImplemented("llPointAt"); } | 894 | NotImplemented("llStartAnimation"); |
442 | public void llStopPointAt() { NotImplemented("llStopPointAt"); } | 895 | } |
443 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } | 896 | |
444 | public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } | 897 | public void llStopAnimation(string anim) |
445 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } | 898 | { |
446 | public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } | 899 | NotImplemented("llStopAnimation"); |
447 | public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } | 900 | } |
448 | public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } | 901 | |
449 | public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } | 902 | public void llPointAt() |
450 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } | 903 | { |
451 | public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } | 904 | NotImplemented("llPointAt"); |
452 | public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } | 905 | } |
453 | public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } | 906 | |
454 | public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } | 907 | public void llStopPointAt() |
455 | public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } | 908 | { |
456 | public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } | 909 | NotImplemented("llStopPointAt"); |
457 | public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } | 910 | } |
458 | public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } | 911 | |
459 | public double llGetEnergy() { return 1.0f; } | 912 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) |
460 | public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } | 913 | { |
461 | public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } | 914 | NotImplemented("llTargetOmega"); |
915 | } | ||
916 | |||
917 | public int llGetStartParameter() | ||
918 | { | ||
919 | NotImplemented("llGetStartParameter"); | ||
920 | return 0; | ||
921 | } | ||
922 | |||
923 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) | ||
924 | { | ||
925 | NotImplemented("llGodLikeRezObject"); | ||
926 | } | ||
927 | |||
928 | public void llRequestPermissions(string agent, int perm) | ||
929 | { | ||
930 | NotImplemented("llRequestPermissions"); | ||
931 | } | ||
932 | |||
933 | public string llGetPermissionsKey() | ||
934 | { | ||
935 | NotImplemented("llGetPermissionsKey"); | ||
936 | return ""; | ||
937 | } | ||
938 | |||
939 | public int llGetPermissions() | ||
940 | { | ||
941 | NotImplemented("llGetPermissions"); | ||
942 | return 0; | ||
943 | } | ||
944 | |||
945 | public int llGetLinkNumber() | ||
946 | { | ||
947 | NotImplemented("llGetLinkNumber"); | ||
948 | return 0; | ||
949 | } | ||
950 | |||
951 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) | ||
952 | { | ||
953 | NotImplemented("llSetLinkColor"); | ||
954 | } | ||
955 | |||
956 | public void llCreateLink(string target, int parent) | ||
957 | { | ||
958 | NotImplemented("llCreateLink"); | ||
959 | } | ||
960 | |||
961 | public void llBreakLink(int linknum) | ||
962 | { | ||
963 | NotImplemented("llBreakLink"); | ||
964 | } | ||
965 | |||
966 | public void llBreakAllLinks() | ||
967 | { | ||
968 | NotImplemented("llBreakAllLinks"); | ||
969 | } | ||
970 | |||
971 | public string llGetLinkKey(int linknum) | ||
972 | { | ||
973 | NotImplemented("llGetLinkKey"); | ||
974 | return ""; | ||
975 | } | ||
976 | |||
977 | public void llGetLinkName(int linknum) | ||
978 | { | ||
979 | NotImplemented("llGetLinkName"); | ||
980 | } | ||
981 | |||
982 | public int llGetInventoryNumber(int type) | ||
983 | { | ||
984 | NotImplemented("llGetInventoryNumber"); | ||
985 | return 0; | ||
986 | } | ||
987 | |||
988 | public string llGetInventoryName(int type, int number) | ||
989 | { | ||
990 | NotImplemented("llGetInventoryName"); | ||
991 | return ""; | ||
992 | } | ||
993 | |||
994 | public void llSetScriptState(string name, int run) | ||
995 | { | ||
996 | NotImplemented("llSetScriptState"); | ||
997 | } | ||
998 | |||
999 | public double llGetEnergy() | ||
1000 | { | ||
1001 | return 1.0f; | ||
1002 | } | ||
1003 | |||
1004 | public void llGiveInventory(string destination, string inventory) | ||
1005 | { | ||
1006 | NotImplemented("llGiveInventory"); | ||
1007 | } | ||
1008 | |||
1009 | public void llRemoveInventory(string item) | ||
1010 | { | ||
1011 | NotImplemented("llRemoveInventory"); | ||
1012 | } | ||
462 | 1013 | ||
463 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) | 1014 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) |
464 | { | 1015 | { |
465 | Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); | 1016 | Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z); |
466 | m_host.SetText(text, av3, alpha); | 1017 | m_host.SetText(text, av3, alpha); |
467 | } | 1018 | } |
468 | 1019 | ||
469 | 1020 | ||
470 | public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } | 1021 | public double llWater(LSL_Types.Vector3 offset) |
471 | public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } | 1022 | { |
472 | public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } | 1023 | NotImplemented("llWater"); |
473 | public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } | 1024 | return 0; |
474 | public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } | 1025 | } |
475 | public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } | 1026 | |
476 | public void llModifyLand(int action, int brush) { } | 1027 | public void llPassTouches(int pass) |
477 | public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } | 1028 | { |
478 | public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } | 1029 | NotImplemented("llPassTouches"); |
479 | public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } | 1030 | } |
480 | public void llResetScript() | 1031 | |
1032 | public string llRequestAgentData(string id, int data) | ||
1033 | { | ||
1034 | NotImplemented("llRequestAgentData"); | ||
1035 | return ""; | ||
1036 | } | ||
1037 | |||
1038 | public string llRequestInventoryData(string name) | ||
1039 | { | ||
1040 | NotImplemented("llRequestInventoryData"); | ||
1041 | return ""; | ||
1042 | } | ||
1043 | |||
1044 | public void llSetDamage(double damage) | ||
1045 | { | ||
1046 | NotImplemented("llSetDamage"); | ||
1047 | } | ||
1048 | |||
1049 | public void llTeleportAgentHome(string agent) | ||
1050 | { | ||
1051 | NotImplemented("llTeleportAgentHome"); | ||
1052 | } | ||
1053 | |||
1054 | public void llModifyLand(int action, int brush) | ||
1055 | { | ||
1056 | } | ||
1057 | |||
1058 | public void llCollisionSound(string impact_sound, double impact_volume) | ||
1059 | { | ||
1060 | NotImplemented("llCollisionSound"); | ||
1061 | } | ||
1062 | |||
1063 | public void llCollisionSprite(string impact_sprite) | ||
1064 | { | ||
1065 | NotImplemented("llCollisionSprite"); | ||
1066 | } | ||
1067 | |||
1068 | public string llGetAnimation(string id) | ||
1069 | { | ||
1070 | NotImplemented("llGetAnimation"); | ||
1071 | return ""; | ||
1072 | } | ||
1073 | |||
1074 | public void llResetScript() | ||
481 | { | 1075 | { |
482 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); | 1076 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); |
483 | } | 1077 | } |
484 | public void llMessageLinked(int linknum, int num, string str, string id) { } | ||
485 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } | ||
486 | public void llPassCollisions(int pass) { } | ||
487 | public string llGetScriptName() { return ""; } | ||
488 | 1078 | ||
489 | public int llGetNumberOfSides() { return 0; } | 1079 | public void llMessageLinked(int linknum, int num, string str, string id) |
1080 | { | ||
1081 | } | ||
490 | 1082 | ||
491 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } | 1083 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) |
492 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } | 1084 | { |
493 | public void llRot2Angle() { } | 1085 | } |
1086 | |||
1087 | public void llPassCollisions(int pass) | ||
1088 | { | ||
1089 | } | ||
1090 | |||
1091 | public string llGetScriptName() | ||
1092 | { | ||
1093 | return ""; | ||
1094 | } | ||
1095 | |||
1096 | public int llGetNumberOfSides() | ||
1097 | { | ||
1098 | return 0; | ||
1099 | } | ||
1100 | |||
1101 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) | ||
1102 | { | ||
1103 | return new LSL_Types.Quaternion(); | ||
1104 | } | ||
1105 | |||
1106 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) | ||
1107 | { | ||
1108 | return new LSL_Types.Vector3(); | ||
1109 | } | ||
1110 | |||
1111 | public void llRot2Angle() | ||
1112 | { | ||
1113 | } | ||
494 | 1114 | ||
495 | public double llAcos(double val) | 1115 | public double llAcos(double val) |
496 | { | 1116 | { |
497 | return (double)Math.Acos(val); | 1117 | return (double) Math.Acos(val); |
498 | } | 1118 | } |
499 | 1119 | ||
500 | public double llAsin(double val) | 1120 | public double llAsin(double val) |
501 | { | 1121 | { |
502 | return (double)Math.Asin(val); | 1122 | return (double) Math.Asin(val); |
503 | } | 1123 | } |
504 | 1124 | ||
505 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } | 1125 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) |
506 | public string llGetInventoryKey(string name) { return ""; } | 1126 | { |
507 | public void llAllowInventoryDrop(int add) { } | 1127 | return 0; |
508 | public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } | 1128 | } |
509 | public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } | 1129 | |
510 | public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } | 1130 | public string llGetInventoryKey(string name) |
511 | public double llGetTextureRot(int side) { return 0; } | 1131 | { |
1132 | return ""; | ||
1133 | } | ||
1134 | |||
1135 | public void llAllowInventoryDrop(int add) | ||
1136 | { | ||
1137 | } | ||
1138 | |||
1139 | public LSL_Types.Vector3 llGetSunDirection() | ||
1140 | { | ||
1141 | return new LSL_Types.Vector3(); | ||
1142 | } | ||
1143 | |||
1144 | public LSL_Types.Vector3 llGetTextureOffset(int face) | ||
1145 | { | ||
1146 | return new LSL_Types.Vector3(); | ||
1147 | } | ||
1148 | |||
1149 | public LSL_Types.Vector3 llGetTextureScale(int side) | ||
1150 | { | ||
1151 | return new LSL_Types.Vector3(); | ||
1152 | } | ||
1153 | |||
1154 | public double llGetTextureRot(int side) | ||
1155 | { | ||
1156 | return 0; | ||
1157 | } | ||
512 | 1158 | ||
513 | public int llSubStringIndex(string source, string pattern) | 1159 | public int llSubStringIndex(string source, string pattern) |
514 | { | 1160 | { |
515 | return source.IndexOf(pattern); | 1161 | return source.IndexOf(pattern); |
516 | } | 1162 | } |
517 | 1163 | ||
518 | public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } | 1164 | public string llGetOwnerKey(string id) |
1165 | { | ||
1166 | NotImplemented("llGetOwnerKey"); | ||
1167 | return ""; | ||
1168 | } | ||
519 | 1169 | ||
520 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } | 1170 | public LSL_Types.Vector3 llGetCenterOfMass() |
1171 | { | ||
1172 | NotImplemented("llGetCenterOfMass"); | ||
1173 | return new LSL_Types.Vector3(); | ||
1174 | } | ||
521 | 1175 | ||
522 | public List<string> llListSort(List<string> src, int stride, int ascending) | 1176 | public List<string> llListSort(List<string> src, int stride, int ascending) |
523 | { | 1177 | { |
@@ -551,7 +1205,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
551 | ret.AddRange(ls); | 1205 | ret.AddRange(ls); |
552 | } | 1206 | } |
553 | 1207 | ||
554 | if (ascending == LSL.LSL_BaseClass.TRUE) | 1208 | if (ascending == LSL_BaseClass.TRUE) |
555 | return ret; | 1209 | return ret; |
556 | ret.Reverse(); | 1210 | ret.Reverse(); |
557 | return ret; | 1211 | return ret; |
@@ -590,12 +1244,18 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
590 | 1244 | ||
591 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) | 1245 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) |
592 | { | 1246 | { |
593 | return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); | 1247 | return |
1248 | new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), | ||
1249 | double.Parse(src[index + 2])); | ||
594 | } | 1250 | } |
1251 | |||
595 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) | 1252 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) |
596 | { | 1253 | { |
597 | return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); | 1254 | return |
1255 | new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), | ||
1256 | double.Parse(src[index + 2]), double.Parse(src[index + 3])); | ||
598 | } | 1257 | } |
1258 | |||
599 | public List<string> llList2List(List<string> src, int start, int end) | 1259 | public List<string> llList2List(List<string> src, int start, int end) |
600 | { | 1260 | { |
601 | if (end > start) | 1261 | if (end > start) |
@@ -612,18 +1272,21 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
612 | ret.AddRange(src.GetRange(0, end)); | 1272 | ret.AddRange(src.GetRange(0, end)); |
613 | return ret; | 1273 | return ret; |
614 | } | 1274 | } |
615 | |||
616 | |||
617 | |||
618 | |||
619 | } | 1275 | } |
1276 | |||
620 | public List<string> llDeleteSubList(List<string> src, int start, int end) | 1277 | public List<string> llDeleteSubList(List<string> src, int start, int end) |
621 | { | 1278 | { |
622 | List<string> ret = new List<string>(src); | 1279 | List<string> ret = new List<string>(src); |
623 | ret.RemoveRange(start, end - start); | 1280 | ret.RemoveRange(start, end - start); |
624 | return ret; | 1281 | return ret; |
625 | } | 1282 | } |
626 | public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } | 1283 | |
1284 | public int llGetListEntryType(List<string> src, int index) | ||
1285 | { | ||
1286 | NotImplemented("llGetListEntryType"); | ||
1287 | return 0; | ||
1288 | } | ||
1289 | |||
627 | public string llList2CSV(List<string> src) | 1290 | public string llList2CSV(List<string> src) |
628 | { | 1291 | { |
629 | string ret = ""; | 1292 | string ret = ""; |
@@ -635,6 +1298,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
635 | } | 1298 | } |
636 | return ret; | 1299 | return ret; |
637 | } | 1300 | } |
1301 | |||
638 | public List<string> llCSV2List(string src) | 1302 | public List<string> llCSV2List(string src) |
639 | { | 1303 | { |
640 | List<string> ret = new List<string>(); | 1304 | List<string> ret = new List<string>(); |
@@ -644,6 +1308,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
644 | } | 1308 | } |
645 | return ret; | 1309 | return ret; |
646 | } | 1310 | } |
1311 | |||
647 | public List<string> llListRandomize(List<string> src, int stride) | 1312 | public List<string> llListRandomize(List<string> src, int stride) |
648 | { | 1313 | { |
649 | int s = stride; | 1314 | int s = stride; |
@@ -685,9 +1350,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
685 | } | 1350 | } |
686 | 1351 | ||
687 | return ret; | 1352 | return ret; |
688 | |||
689 | |||
690 | } | 1353 | } |
1354 | |||
691 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | 1355 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) |
692 | { | 1356 | { |
693 | List<string> ret = new List<string>(); | 1357 | List<string> ret = new List<string>(); |
@@ -713,12 +1377,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
713 | 1377 | ||
714 | public LSL_Types.Vector3 llGetRegionCorner() | 1378 | public LSL_Types.Vector3 llGetRegionCorner() |
715 | { | 1379 | { |
716 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); | 1380 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0); |
717 | } | 1381 | } |
718 | 1382 | ||
719 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) | 1383 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) |
720 | { | 1384 | { |
721 | |||
722 | List<string> ret = new List<string>(dest); | 1385 | List<string> ret = new List<string>(dest); |
723 | //foreach (string s in src.Reverse()) | 1386 | //foreach (string s in src.Reverse()) |
724 | for (int ci = src.Count - 1; ci > -1; ci--) | 1387 | for (int ci = src.Count - 1; ci > -1; ci--) |
@@ -727,13 +1390,13 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
727 | } | 1390 | } |
728 | return ret; | 1391 | return ret; |
729 | } | 1392 | } |
1393 | |||
730 | public int llListFindList(List<string> src, List<string> test) | 1394 | public int llListFindList(List<string> src, List<string> test) |
731 | { | 1395 | { |
732 | foreach (string s in test) | 1396 | foreach (string s in test) |
733 | { | 1397 | { |
734 | for (int ci = 0; ci < src.Count; ci++) | 1398 | for (int ci = 0; ci < src.Count; ci++) |
735 | { | 1399 | { |
736 | |||
737 | if (s == src[ci]) | 1400 | if (s == src[ci]) |
738 | return ci; | 1401 | return ci; |
739 | } | 1402 | } |
@@ -758,37 +1421,139 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
758 | return result; | 1421 | return result; |
759 | } | 1422 | } |
760 | 1423 | ||
761 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } | 1424 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) |
762 | public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } | 1425 | { |
763 | public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } | 1426 | NotImplemented("llEdgeOfWorld"); |
764 | public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } | 1427 | return 0; |
765 | public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } | 1428 | } |
766 | public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } | 1429 | |
767 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } | 1430 | public int llGetAgentInfo(string id) |
768 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } | 1431 | { |
769 | public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } | 1432 | NotImplemented("llGetAgentInfo"); |
770 | 1433 | return 0; | |
771 | public void llParseString2List() { NotImplemented("llParseString2List"); } | 1434 | } |
772 | 1435 | ||
773 | public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } | 1436 | public void llAdjustSoundVolume(double volume) |
774 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } | 1437 | { |
775 | public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } | 1438 | NotImplemented("llAdjustSoundVolume"); |
776 | public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } | 1439 | } |
777 | public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } | 1440 | |
778 | public void llUnSit(string id) { NotImplemented("llUnSit"); } | 1441 | public void llSetSoundQueueing(int queue) |
779 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } | 1442 | { |
780 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } | 1443 | NotImplemented("llSetSoundQueueing"); |
781 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } | 1444 | } |
782 | public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } | 1445 | |
783 | public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } | 1446 | public void llSetSoundRadius(double radius) |
1447 | { | ||
1448 | NotImplemented("llSetSoundRadius"); | ||
1449 | } | ||
1450 | |||
1451 | public string llKey2Name(string id) | ||
1452 | { | ||
1453 | NotImplemented("llKey2Name"); | ||
1454 | return ""; | ||
1455 | } | ||
1456 | |||
1457 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
1458 | { | ||
1459 | NotImplemented("llSetTextureAnim"); | ||
1460 | } | ||
1461 | |||
1462 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, | ||
1463 | LSL_Types.Vector3 bottom_south_west) | ||
1464 | { | ||
1465 | NotImplemented("llTriggerSoundLimited"); | ||
1466 | } | ||
1467 | |||
1468 | public void llEjectFromLand(string pest) | ||
1469 | { | ||
1470 | NotImplemented("llEjectFromLand"); | ||
1471 | } | ||
1472 | |||
1473 | public void llParseString2List() | ||
1474 | { | ||
1475 | NotImplemented("llParseString2List"); | ||
1476 | } | ||
1477 | |||
1478 | public int llOverMyLand(string id) | ||
1479 | { | ||
1480 | NotImplemented("llOverMyLand"); | ||
1481 | return 0; | ||
1482 | } | ||
1483 | |||
1484 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) | ||
1485 | { | ||
1486 | NotImplemented("llGetLandOwnerAt"); | ||
1487 | return ""; | ||
1488 | } | ||
1489 | |||
1490 | public string llGetNotecardLine(string name, int line) | ||
1491 | { | ||
1492 | NotImplemented("llGetNotecardLine"); | ||
1493 | return ""; | ||
1494 | } | ||
1495 | |||
1496 | public LSL_Types.Vector3 llGetAgentSize(string id) | ||
1497 | { | ||
1498 | NotImplemented("llGetAgentSize"); | ||
1499 | return new LSL_Types.Vector3(); | ||
1500 | } | ||
1501 | |||
1502 | public int llSameGroup(string agent) | ||
1503 | { | ||
1504 | NotImplemented("llSameGroup"); | ||
1505 | return 0; | ||
1506 | } | ||
1507 | |||
1508 | public void llUnSit(string id) | ||
1509 | { | ||
1510 | NotImplemented("llUnSit"); | ||
1511 | } | ||
1512 | |||
1513 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) | ||
1514 | { | ||
1515 | NotImplemented("llGroundSlope"); | ||
1516 | return new LSL_Types.Vector3(); | ||
1517 | } | ||
1518 | |||
1519 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) | ||
1520 | { | ||
1521 | NotImplemented("llGroundNormal"); | ||
1522 | return new LSL_Types.Vector3(); | ||
1523 | } | ||
1524 | |||
1525 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) | ||
1526 | { | ||
1527 | NotImplemented("llGroundContour"); | ||
1528 | return new LSL_Types.Vector3(); | ||
1529 | } | ||
1530 | |||
1531 | public int llGetAttached() | ||
1532 | { | ||
1533 | NotImplemented("llGetAttached"); | ||
1534 | return 0; | ||
1535 | } | ||
1536 | |||
1537 | public int llGetFreeMemory() | ||
1538 | { | ||
1539 | NotImplemented("llGetFreeMemory"); | ||
1540 | return 0; | ||
1541 | } | ||
784 | 1542 | ||
785 | public string llGetRegionName() | 1543 | public string llGetRegionName() |
786 | { | 1544 | { |
787 | return World.RegionInfo.RegionName; | 1545 | return World.RegionInfo.RegionName; |
788 | } | 1546 | } |
789 | 1547 | ||
790 | public double llGetRegionTimeDilation() { return 1.0f; } | 1548 | public double llGetRegionTimeDilation() |
791 | public double llGetRegionFPS() { return 10.0f; } | 1549 | { |
1550 | return 1.0f; | ||
1551 | } | ||
1552 | |||
1553 | public double llGetRegionFPS() | ||
1554 | { | ||
1555 | return 10.0f; | ||
1556 | } | ||
792 | 1557 | ||
793 | /* particle system rules should be coming into this routine as doubles, that is | 1558 | /* particle system rules should be coming into this routine as doubles, that is |
794 | rule[0] should be an integer from this list and rule[1] should be the arg | 1559 | rule[0] should be an integer from this list and rule[1] should be the arg |
@@ -798,6 +1563,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
798 | We iterate through the list for 'Count' elements, incrementing by two for each | 1563 | We iterate through the list for 'Count' elements, incrementing by two for each |
799 | iteration and set the members of Primitive.ParticleSystem, one at a time. | 1564 | iteration and set the members of Primitive.ParticleSystem, one at a time. |
800 | */ | 1565 | */ |
1566 | |||
801 | public enum PrimitiveRule : int | 1567 | public enum PrimitiveRule : int |
802 | { | 1568 | { |
803 | PSYS_PART_FLAGS = 0, | 1569 | PSYS_PART_FLAGS = 0, |
@@ -828,109 +1594,152 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
828 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | 1594 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); |
829 | for (int i = 0; i < rules.Count; i += 2) | 1595 | for (int i = 0; i < rules.Count; i += 2) |
830 | { | 1596 | { |
831 | switch ((int)rules[i]) | 1597 | switch ((int) rules[i]) |
832 | { | 1598 | { |
833 | case (int)PrimitiveRule.PSYS_PART_FLAGS: | 1599 | case (int) PrimitiveRule.PSYS_PART_FLAGS: |
834 | prules.PartFlags = (uint)rules[i + 1]; | 1600 | prules.PartFlags = (uint) rules[i + 1]; |
835 | break; | 1601 | break; |
836 | 1602 | ||
837 | case (int)PrimitiveRule.PSYS_PART_START_COLOR: | 1603 | case (int) PrimitiveRule.PSYS_PART_START_COLOR: |
838 | prules.PartStartColor = (LLColor)rules[i + 1]; | 1604 | prules.PartStartColor = (LLColor) rules[i + 1]; |
839 | break; | 1605 | break; |
840 | 1606 | ||
841 | case (int)PrimitiveRule.PSYS_PART_START_ALPHA: | 1607 | case (int) PrimitiveRule.PSYS_PART_START_ALPHA: |
842 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1608 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
843 | break; | 1609 | break; |
844 | 1610 | ||
845 | case (int)PrimitiveRule.PSYS_PART_END_COLOR: | 1611 | case (int) PrimitiveRule.PSYS_PART_END_COLOR: |
846 | prules.PartEndColor = (LLColor)rules[i + 1]; | 1612 | prules.PartEndColor = (LLColor) rules[i + 1]; |
847 | break; | 1613 | break; |
848 | 1614 | ||
849 | case (int)PrimitiveRule.PSYS_PART_END_ALPHA: | 1615 | case (int) PrimitiveRule.PSYS_PART_END_ALPHA: |
850 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1616 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
851 | break; | 1617 | break; |
852 | 1618 | ||
853 | case (int)PrimitiveRule.PSYS_PART_START_SCALE: | 1619 | case (int) PrimitiveRule.PSYS_PART_START_SCALE: |
854 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1620 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
855 | break; | 1621 | break; |
856 | 1622 | ||
857 | case (int)PrimitiveRule.PSYS_PART_END_SCALE: | 1623 | case (int) PrimitiveRule.PSYS_PART_END_SCALE: |
858 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1624 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
859 | break; | 1625 | break; |
860 | 1626 | ||
861 | case (int)PrimitiveRule.PSYS_PART_MAX_AGE: | 1627 | case (int) PrimitiveRule.PSYS_PART_MAX_AGE: |
862 | prules.MaxAge = (float)rules[i + 1]; | 1628 | prules.MaxAge = (float) rules[i + 1]; |
863 | break; | 1629 | break; |
864 | 1630 | ||
865 | case (int)PrimitiveRule.PSYS_SRC_ACCEL: | 1631 | case (int) PrimitiveRule.PSYS_SRC_ACCEL: |
866 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1632 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
867 | break; | 1633 | break; |
868 | 1634 | ||
869 | case (int)PrimitiveRule.PSYS_SRC_PATTERN: | 1635 | case (int) PrimitiveRule.PSYS_SRC_PATTERN: |
870 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1636 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
871 | break; | 1637 | break; |
872 | 1638 | ||
873 | case (int)PrimitiveRule.PSYS_SRC_TEXTURE: | 1639 | case (int) PrimitiveRule.PSYS_SRC_TEXTURE: |
874 | prules.Texture = (LLUUID)rules[i + 1]; | 1640 | prules.Texture = (LLUUID) rules[i + 1]; |
875 | break; | 1641 | break; |
876 | 1642 | ||
877 | case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: | 1643 | case (int) PrimitiveRule.PSYS_SRC_BURST_RATE: |
878 | prules.BurstRate = (float)rules[i + 1]; | 1644 | prules.BurstRate = (float) rules[i + 1]; |
879 | break; | 1645 | break; |
880 | 1646 | ||
881 | case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: | 1647 | case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: |
882 | prules.BurstPartCount = (byte)rules[i + 1]; | 1648 | prules.BurstPartCount = (byte) rules[i + 1]; |
883 | break; | 1649 | break; |
884 | 1650 | ||
885 | case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: | 1651 | case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS: |
886 | prules.BurstRadius = (float)rules[i + 1]; | 1652 | prules.BurstRadius = (float) rules[i + 1]; |
887 | break; | 1653 | break; |
888 | 1654 | ||
889 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: | 1655 | case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: |
890 | prules.BurstSpeedMin = (float)rules[i + 1]; | 1656 | prules.BurstSpeedMin = (float) rules[i + 1]; |
891 | break; | 1657 | break; |
892 | 1658 | ||
893 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: | 1659 | case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: |
894 | prules.BurstSpeedMax = (float)rules[i + 1]; | 1660 | prules.BurstSpeedMax = (float) rules[i + 1]; |
895 | break; | 1661 | break; |
896 | 1662 | ||
897 | case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: | 1663 | case (int) PrimitiveRule.PSYS_SRC_MAX_AGE: |
898 | prules.MaxAge = (float)rules[i + 1]; | 1664 | prules.MaxAge = (float) rules[i + 1]; |
899 | break; | 1665 | break; |
900 | 1666 | ||
901 | case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: | 1667 | case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY: |
902 | prules.Target = (LLUUID)rules[i + 1]; | 1668 | prules.Target = (LLUUID) rules[i + 1]; |
903 | break; | 1669 | break; |
904 | 1670 | ||
905 | case (int)PrimitiveRule.PSYS_SRC_OMEGA: | 1671 | case (int) PrimitiveRule.PSYS_SRC_OMEGA: |
906 | //cast?? prules.MaxAge = (float)rules[i + 1]; | 1672 | //cast?? prules.MaxAge = (float)rules[i + 1]; |
907 | break; | 1673 | break; |
908 | 1674 | ||
909 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: | 1675 | case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: |
910 | prules.InnerAngle = (float)rules[i + 1]; | 1676 | prules.InnerAngle = (float) rules[i + 1]; |
911 | break; | 1677 | break; |
912 | 1678 | ||
913 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: | 1679 | case (int) PrimitiveRule.PSYS_SRC_ANGLE_END: |
914 | prules.OuterAngle = (float)rules[i + 1]; | 1680 | prules.OuterAngle = (float) rules[i + 1]; |
915 | break; | 1681 | break; |
916 | |||
917 | } | 1682 | } |
918 | } | 1683 | } |
919 | 1684 | ||
920 | m_host.AddNewParticleSystem(prules); | 1685 | m_host.AddNewParticleSystem(prules); |
921 | } | 1686 | } |
922 | 1687 | ||
923 | public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } | 1688 | public void llGroundRepel(double height, int water, double tau) |
924 | public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } | 1689 | { |
925 | public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } | 1690 | NotImplemented("llGroundRepel"); |
926 | public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } | 1691 | } |
927 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } | 1692 | |
928 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } | 1693 | public void llGiveInventoryList() |
929 | public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } | 1694 | { |
930 | public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } | 1695 | NotImplemented("llGiveInventoryList"); |
931 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } | 1696 | } |
932 | public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } | 1697 | |
933 | public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } | 1698 | public void llSetVehicleType(int type) |
1699 | { | ||
1700 | NotImplemented("llSetVehicleType"); | ||
1701 | } | ||
1702 | |||
1703 | public void llSetVehicledoubleParam(int param, double value) | ||
1704 | { | ||
1705 | NotImplemented("llSetVehicledoubleParam"); | ||
1706 | } | ||
1707 | |||
1708 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) | ||
1709 | { | ||
1710 | NotImplemented("llSetVehicleVectorParam"); | ||
1711 | } | ||
1712 | |||
1713 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) | ||
1714 | { | ||
1715 | NotImplemented("llSetVehicleRotationParam"); | ||
1716 | } | ||
1717 | |||
1718 | public void llSetVehicleFlags(int flags) | ||
1719 | { | ||
1720 | NotImplemented("llSetVehicleFlags"); | ||
1721 | } | ||
1722 | |||
1723 | public void llRemoveVehicleFlags(int flags) | ||
1724 | { | ||
1725 | NotImplemented("llRemoveVehicleFlags"); | ||
1726 | } | ||
1727 | |||
1728 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) | ||
1729 | { | ||
1730 | NotImplemented("llSitTarget"); | ||
1731 | } | ||
1732 | |||
1733 | public string llAvatarOnSitTarget() | ||
1734 | { | ||
1735 | NotImplemented("llAvatarOnSitTarget"); | ||
1736 | return ""; | ||
1737 | } | ||
1738 | |||
1739 | public void llAddToLandPassList(string avatar, double hours) | ||
1740 | { | ||
1741 | NotImplemented("llAddToLandPassList"); | ||
1742 | } | ||
934 | 1743 | ||
935 | public void llSetTouchText(string text) | 1744 | public void llSetTouchText(string text) |
936 | { | 1745 | { |
@@ -942,37 +1751,99 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
942 | m_host.SitName = text; | 1751 | m_host.SitName = text; |
943 | } | 1752 | } |
944 | 1753 | ||
945 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } | 1754 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) |
946 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } | 1755 | { |
947 | public void llDumpList2String() { NotImplemented("llDumpList2String"); } | 1756 | NotImplemented("llSetCameraEyeOffset"); |
948 | public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } | 1757 | } |
949 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); } | ||
950 | public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); } | ||
951 | public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); } | ||
952 | 1758 | ||
953 | public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } | 1759 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) |
1760 | { | ||
1761 | NotImplemented("llSetCameraAtOffset"); | ||
1762 | } | ||
1763 | |||
1764 | public void llDumpList2String() | ||
1765 | { | ||
1766 | NotImplemented("llDumpList2String"); | ||
1767 | } | ||
1768 | |||
1769 | public void llScriptDanger(LSL_Types.Vector3 pos) | ||
1770 | { | ||
1771 | NotImplemented("llScriptDanger"); | ||
1772 | } | ||
1773 | |||
1774 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) | ||
1775 | { | ||
1776 | NotImplemented("llDialog"); | ||
1777 | } | ||
1778 | |||
1779 | public void llVolumeDetect(int detect) | ||
1780 | { | ||
1781 | NotImplemented("llVolumeDetect"); | ||
1782 | } | ||
1783 | |||
1784 | public void llResetOtherScript(string name) | ||
1785 | { | ||
1786 | NotImplemented("llResetOtherScript"); | ||
1787 | } | ||
1788 | |||
1789 | public int llGetScriptState(string name) | ||
1790 | { | ||
1791 | NotImplemented("llGetScriptState"); | ||
1792 | return 0; | ||
1793 | } | ||
1794 | |||
1795 | public void llRemoteLoadScript() | ||
1796 | { | ||
1797 | NotImplemented("llRemoteLoadScript"); | ||
1798 | } | ||
1799 | |||
1800 | public void llSetRemoteScriptAccessPin(int pin) | ||
1801 | { | ||
1802 | NotImplemented("llSetRemoteScriptAccessPin"); | ||
1803 | } | ||
954 | 1804 | ||
955 | public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } | 1805 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) |
956 | public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } | 1806 | { |
957 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } | 1807 | NotImplemented("llRemoteLoadScriptPin"); |
958 | public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); } | 1808 | } |
959 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } | 1809 | |
960 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); } | 1810 | public void llOpenRemoteDataChannel() |
961 | public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); } | 1811 | { |
1812 | NotImplemented("llOpenRemoteDataChannel"); | ||
1813 | } | ||
1814 | |||
1815 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) | ||
1816 | { | ||
1817 | NotImplemented("llSendRemoteData"); | ||
1818 | return ""; | ||
1819 | } | ||
1820 | |||
1821 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | ||
1822 | { | ||
1823 | NotImplemented("llRemoteDataReply"); | ||
1824 | } | ||
1825 | |||
1826 | public void llCloseRemoteDataChannel(string channel) | ||
1827 | { | ||
1828 | NotImplemented("llCloseRemoteDataChannel"); | ||
1829 | } | ||
962 | 1830 | ||
963 | public string llMD5String(string src, int nonce) | 1831 | public string llMD5String(string src, int nonce) |
964 | { | 1832 | { |
965 | return Util.Md5Hash(src + ":" + nonce.ToString()); | 1833 | return Util.Md5Hash(src + ":" + nonce.ToString()); |
966 | } | 1834 | } |
967 | 1835 | ||
968 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } | 1836 | public void llSetPrimitiveParams(List<string> rules) |
969 | public string llStringToBase64(string str) | ||
970 | { | 1837 | { |
1838 | NotImplemented("llSetPrimitiveParams"); | ||
1839 | } | ||
971 | 1840 | ||
1841 | public string llStringToBase64(string str) | ||
1842 | { | ||
972 | try | 1843 | try |
973 | { | 1844 | { |
974 | byte[] encData_byte = new byte[str.Length]; | 1845 | byte[] encData_byte = new byte[str.Length]; |
975 | encData_byte = System.Text.Encoding.UTF8.GetBytes(str); | 1846 | encData_byte = Encoding.UTF8.GetBytes(str); |
976 | string encodedData = Convert.ToBase64String(encData_byte); | 1847 | string encodedData = Convert.ToBase64String(encData_byte); |
977 | return encodedData; | 1848 | return encodedData; |
978 | } | 1849 | } |
@@ -984,11 +1855,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
984 | 1855 | ||
985 | public string llBase64ToString(string str) | 1856 | public string llBase64ToString(string str) |
986 | { | 1857 | { |
987 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); | 1858 | UTF8Encoding encoder = new UTF8Encoding(); |
988 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); | 1859 | Decoder utf8Decode = encoder.GetDecoder(); |
989 | try | 1860 | try |
990 | { | 1861 | { |
991 | |||
992 | byte[] todecode_byte = Convert.FromBase64String(str); | 1862 | byte[] todecode_byte = Convert.FromBase64String(str); |
993 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | 1863 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); |
994 | char[] decoded_char = new char[charCount]; | 1864 | char[] decoded_char = new char[charCount]; |
@@ -1001,16 +1871,49 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1001 | throw new Exception("Error in base64Decode" + e.Message); | 1871 | throw new Exception("Error in base64Decode" + e.Message); |
1002 | } | 1872 | } |
1003 | } | 1873 | } |
1004 | public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } | ||
1005 | public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } | ||
1006 | public double llLog10(double val) { return (double)Math.Log10(val); } | ||
1007 | public double llLog(double val) { return (double)Math.Log(val); } | ||
1008 | public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); } | ||
1009 | public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); } | ||
1010 | 1874 | ||
1011 | public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } | 1875 | public void llXorBase64Strings() |
1876 | { | ||
1877 | throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); | ||
1878 | } | ||
1012 | 1879 | ||
1013 | public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } | 1880 | public void llRemoteDataSetRegion() |
1881 | { | ||
1882 | NotImplemented("llRemoteDataSetRegion"); | ||
1883 | } | ||
1884 | |||
1885 | public double llLog10(double val) | ||
1886 | { | ||
1887 | return (double) Math.Log10(val); | ||
1888 | } | ||
1889 | |||
1890 | public double llLog(double val) | ||
1891 | { | ||
1892 | return (double) Math.Log(val); | ||
1893 | } | ||
1894 | |||
1895 | public List<string> llGetAnimationList(string id) | ||
1896 | { | ||
1897 | NotImplemented("llGetAnimationList"); | ||
1898 | return new List<string>(); | ||
1899 | } | ||
1900 | |||
1901 | public void llSetParcelMusicURL(string url) | ||
1902 | { | ||
1903 | NotImplemented("llSetParcelMusicURL"); | ||
1904 | } | ||
1905 | |||
1906 | public LSL_Types.Vector3 llGetRootPosition() | ||
1907 | { | ||
1908 | NotImplemented("llGetRootPosition"); | ||
1909 | return new LSL_Types.Vector3(); | ||
1910 | } | ||
1911 | |||
1912 | public LSL_Types.Quaternion llGetRootRotation() | ||
1913 | { | ||
1914 | NotImplemented("llGetRootRotation"); | ||
1915 | return new LSL_Types.Quaternion(); | ||
1916 | } | ||
1014 | 1917 | ||
1015 | public string llGetObjectDesc() | 1918 | public string llGetObjectDesc() |
1016 | { | 1919 | { |
@@ -1027,20 +1930,55 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1027 | return m_host.ObjectCreator.ToStringHyphenated(); | 1930 | return m_host.ObjectCreator.ToStringHyphenated(); |
1028 | } | 1931 | } |
1029 | 1932 | ||
1030 | public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } | 1933 | public string llGetTimestamp() |
1031 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } | 1934 | { |
1032 | public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } | 1935 | return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); |
1033 | public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } | 1936 | } |
1034 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } | 1937 | |
1035 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } | 1938 | public void llSetLinkAlpha(int linknumber, double alpha, int face) |
1036 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } | 1939 | { |
1940 | NotImplemented("llSetLinkAlpha"); | ||
1941 | } | ||
1942 | |||
1943 | public int llGetNumberOfPrims() | ||
1944 | { | ||
1945 | NotImplemented("llGetNumberOfPrims"); | ||
1946 | return 0; | ||
1947 | } | ||
1948 | |||
1949 | public string llGetNumberOfNotecardLines(string name) | ||
1950 | { | ||
1951 | NotImplemented("llGetNumberOfNotecardLines"); | ||
1952 | return ""; | ||
1953 | } | ||
1954 | |||
1955 | public List<string> llGetBoundingBox(string obj) | ||
1956 | { | ||
1957 | NotImplemented("llGetBoundingBox"); | ||
1958 | return new List<string>(); | ||
1959 | } | ||
1960 | |||
1961 | public LSL_Types.Vector3 llGetGeometricCenter() | ||
1962 | { | ||
1963 | NotImplemented("llGetGeometricCenter"); | ||
1964 | return new LSL_Types.Vector3(); | ||
1965 | } | ||
1966 | |||
1967 | public void llGetPrimitiveParams() | ||
1968 | { | ||
1969 | NotImplemented("llGetPrimitiveParams"); | ||
1970 | } | ||
1971 | |||
1037 | public string llIntegerToBase64(int number) | 1972 | public string llIntegerToBase64(int number) |
1038 | { | 1973 | { |
1039 | NotImplemented("llIntegerToBase64"); return ""; | 1974 | NotImplemented("llIntegerToBase64"); |
1975 | return ""; | ||
1040 | } | 1976 | } |
1977 | |||
1041 | public int llBase64ToInteger(string str) | 1978 | public int llBase64ToInteger(string str) |
1042 | { | 1979 | { |
1043 | NotImplemented("llBase64ToInteger"); return 0; | 1980 | NotImplemented("llBase64ToInteger"); |
1981 | return 0; | ||
1044 | } | 1982 | } |
1045 | 1983 | ||
1046 | public double llGetGMTclock() | 1984 | public double llGetGMTclock() |
@@ -1050,34 +1988,95 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1050 | 1988 | ||
1051 | public string llGetSimulatorHostname() | 1989 | public string llGetSimulatorHostname() |
1052 | { | 1990 | { |
1053 | return System.Environment.MachineName; | 1991 | return Environment.MachineName; |
1054 | } | 1992 | } |
1055 | 1993 | ||
1056 | public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } | 1994 | public void llSetLocalRot(LSL_Types.Quaternion rot) |
1057 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } | 1995 | { |
1058 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } | 1996 | NotImplemented("llSetLocalRot"); |
1997 | } | ||
1059 | 1998 | ||
1060 | public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } | 1999 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) |
2000 | { | ||
2001 | NotImplemented("llParseStringKeepNulls"); | ||
2002 | return new List<string>(); | ||
2003 | } | ||
1061 | 2004 | ||
1062 | public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } | 2005 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, |
2006 | LSL_Types.Quaternion rot, int param) | ||
2007 | { | ||
2008 | NotImplemented("llRezAtRoot"); | ||
2009 | } | ||
1063 | 2010 | ||
1064 | public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } | 2011 | public int llGetObjectPermMask(int mask) |
1065 | public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } | 2012 | { |
1066 | public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } | 2013 | NotImplemented("llGetObjectPermMask"); |
1067 | public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } | 2014 | return 0; |
1068 | public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } | 2015 | } |
1069 | public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } | 2016 | |
1070 | public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } | 2017 | public void llSetObjectPermMask(int mask, int value) |
1071 | public void llListReplaceList() { NotImplemented("llListReplaceList"); } | 2018 | { |
2019 | NotImplemented("llSetObjectPermMask"); | ||
2020 | } | ||
2021 | |||
2022 | public void llGetInventoryPermMask(string item, int mask) | ||
2023 | { | ||
2024 | NotImplemented("llGetInventoryPermMask"); | ||
2025 | } | ||
2026 | |||
2027 | public void llSetInventoryPermMask(string item, int mask, int value) | ||
2028 | { | ||
2029 | NotImplemented("llSetInventoryPermMask"); | ||
2030 | } | ||
2031 | |||
2032 | public string llGetInventoryCreator(string item) | ||
2033 | { | ||
2034 | NotImplemented("llGetInventoryCreator"); | ||
2035 | return ""; | ||
2036 | } | ||
2037 | |||
2038 | public void llOwnerSay(string msg) | ||
2039 | { | ||
2040 | NotImplemented("llOwnerSay"); | ||
2041 | } | ||
2042 | |||
2043 | public void llRequestSimulatorData(string simulator, int data) | ||
2044 | { | ||
2045 | NotImplemented("llRequestSimulatorData"); | ||
2046 | } | ||
2047 | |||
2048 | public void llForceMouselook(int mouselook) | ||
2049 | { | ||
2050 | NotImplemented("llForceMouselook"); | ||
2051 | } | ||
2052 | |||
2053 | public double llGetObjectMass(string id) | ||
2054 | { | ||
2055 | NotImplemented("llGetObjectMass"); | ||
2056 | return 0; | ||
2057 | } | ||
2058 | |||
2059 | public void llListReplaceList() | ||
2060 | { | ||
2061 | NotImplemented("llListReplaceList"); | ||
2062 | } | ||
1072 | 2063 | ||
1073 | public void llLoadURL(string avatar_id, string message, string url) | 2064 | public void llLoadURL(string avatar_id, string message, string url) |
1074 | { | 2065 | { |
1075 | LLUUID avatarId = new LLUUID(avatar_id); | 2066 | LLUUID avatarId = new LLUUID(avatar_id); |
1076 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); | 2067 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, |
2068 | url); | ||
2069 | } | ||
2070 | |||
2071 | public void llParcelMediaCommandList(List<string> commandList) | ||
2072 | { | ||
2073 | NotImplemented("llParcelMediaCommandList"); | ||
1077 | } | 2074 | } |
1078 | 2075 | ||
1079 | public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } | 2076 | public void llParcelMediaQuery() |
1080 | public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } | 2077 | { |
2078 | NotImplemented("llParcelMediaQuery"); | ||
2079 | } | ||
1081 | 2080 | ||
1082 | public int llModPow(int a, int b, int c) | 2081 | public int llModPow(int a, int b, int c) |
1083 | { | 2082 | { |
@@ -1086,13 +2085,38 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1086 | return Convert.ToInt32(tmp); | 2085 | return Convert.ToInt32(tmp); |
1087 | } | 2086 | } |
1088 | 2087 | ||
1089 | public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } | 2088 | public int llGetInventoryType(string name) |
2089 | { | ||
2090 | NotImplemented("llGetInventoryType"); | ||
2091 | return 0; | ||
2092 | } | ||
2093 | |||
2094 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) | ||
2095 | { | ||
2096 | NotImplemented("llSetPayPrice"); | ||
2097 | } | ||
2098 | |||
2099 | public LSL_Types.Vector3 llGetCameraPos() | ||
2100 | { | ||
2101 | NotImplemented("llGetCameraPos"); | ||
2102 | return new LSL_Types.Vector3(); | ||
2103 | } | ||
2104 | |||
2105 | public LSL_Types.Quaternion llGetCameraRot() | ||
2106 | { | ||
2107 | NotImplemented("llGetCameraRot"); | ||
2108 | return new LSL_Types.Quaternion(); | ||
2109 | } | ||
1090 | 2110 | ||
1091 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } | 2111 | public void llSetPrimURL() |
1092 | public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } | 2112 | { |
1093 | public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } | 2113 | NotImplemented("llSetPrimURL"); |
1094 | public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } | 2114 | } |
1095 | public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } | 2115 | |
2116 | public void llRefreshPrimURL() | ||
2117 | { | ||
2118 | NotImplemented("llRefreshPrimURL"); | ||
2119 | } | ||
1096 | 2120 | ||
1097 | public string llEscapeURL(string url) | 2121 | public string llEscapeURL(string url) |
1098 | { | 2122 | { |
@@ -1117,21 +2141,60 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1117 | return "llUnescapeURL: " + ex.ToString(); | 2141 | return "llUnescapeURL: " + ex.ToString(); |
1118 | } | 2142 | } |
1119 | } | 2143 | } |
1120 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } | 2144 | |
1121 | public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } | 2145 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) |
1122 | public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } | 2146 | { |
1123 | public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } | 2147 | NotImplemented("llMapDestination"); |
1124 | public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } | 2148 | } |
1125 | public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } | 2149 | |
1126 | public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } | 2150 | public void llAddToLandBanList(string avatar, double hours) |
2151 | { | ||
2152 | NotImplemented("llAddToLandBanList"); | ||
2153 | } | ||
2154 | |||
2155 | public void llRemoveFromLandPassList(string avatar) | ||
2156 | { | ||
2157 | NotImplemented("llRemoveFromLandPassList"); | ||
2158 | } | ||
2159 | |||
2160 | public void llRemoveFromLandBanList(string avatar) | ||
2161 | { | ||
2162 | NotImplemented("llRemoveFromLandBanList"); | ||
2163 | } | ||
2164 | |||
2165 | public void llSetCameraParams(List<string> rules) | ||
2166 | { | ||
2167 | NotImplemented("llSetCameraParams"); | ||
2168 | } | ||
2169 | |||
2170 | public void llClearCameraParams() | ||
2171 | { | ||
2172 | NotImplemented("llClearCameraParams"); | ||
2173 | } | ||
2174 | |||
2175 | public double llListStatistics(int operation, List<string> src) | ||
2176 | { | ||
2177 | NotImplemented("llListStatistics"); | ||
2178 | return 0; | ||
2179 | } | ||
1127 | 2180 | ||
1128 | public int llGetUnixTime() | 2181 | public int llGetUnixTime() |
1129 | { | 2182 | { |
1130 | return Util.UnixTimeSinceEpoch(); | 2183 | return Util.UnixTimeSinceEpoch(); |
1131 | } | 2184 | } |
1132 | 2185 | ||
1133 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } | 2186 | public int llGetParcelFlags(LSL_Types.Vector3 pos) |
1134 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } | 2187 | { |
2188 | NotImplemented("llGetParcelFlags"); | ||
2189 | return 0; | ||
2190 | } | ||
2191 | |||
2192 | public int llGetRegionFlags() | ||
2193 | { | ||
2194 | NotImplemented("llGetRegionFlags"); | ||
2195 | return 0; | ||
2196 | } | ||
2197 | |||
1135 | public string llXorBase64StringsCorrect(string str1, string str2) | 2198 | public string llXorBase64StringsCorrect(string str1, string str2) |
1136 | { | 2199 | { |
1137 | string ret = ""; | 2200 | string ret = ""; |
@@ -1148,27 +2211,64 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1148 | } | 2211 | } |
1149 | return llStringToBase64(ret); | 2212 | return llStringToBase64(ret); |
1150 | } | 2213 | } |
2214 | |||
1151 | public void llHTTPRequest(string url, List<string> parameters, string body) | 2215 | public void llHTTPRequest(string url, List<string> parameters, string body) |
1152 | { | 2216 | { |
1153 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); | 2217 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); |
1154 | } | 2218 | } |
1155 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } | 2219 | |
1156 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } | 2220 | public void llResetLandBanList() |
1157 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } | 2221 | { |
1158 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } | 2222 | NotImplemented("llResetLandBanList"); |
1159 | public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } | 2223 | } |
1160 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } | 2224 | |
1161 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } | 2225 | public void llResetLandPassList() |
2226 | { | ||
2227 | NotImplemented("llResetLandPassList"); | ||
2228 | } | ||
2229 | |||
2230 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) | ||
2231 | { | ||
2232 | NotImplemented("llGetParcelPrimCount"); | ||
2233 | return 0; | ||
2234 | } | ||
2235 | |||
2236 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) | ||
2237 | { | ||
2238 | NotImplemented("llGetParcelPrimOwners"); | ||
2239 | return new List<string>(); | ||
2240 | } | ||
2241 | |||
2242 | public int llGetObjectPrimCount(string object_id) | ||
2243 | { | ||
2244 | NotImplemented("llGetObjectPrimCount"); | ||
2245 | return 0; | ||
2246 | } | ||
2247 | |||
2248 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) | ||
2249 | { | ||
2250 | NotImplemented("llGetParcelMaxPrims"); | ||
2251 | return 0; | ||
2252 | } | ||
2253 | |||
2254 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) | ||
2255 | { | ||
2256 | NotImplemented("llGetParcelDetails"); | ||
2257 | return new List<string>(); | ||
2258 | } | ||
1162 | 2259 | ||
1163 | // | 2260 | // |
1164 | // OpenSim functions | 2261 | // OpenSim functions |
1165 | // | 2262 | // |
1166 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) | 2263 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, |
2264 | int timer) | ||
1167 | { | 2265 | { |
1168 | if (dynamicID == "") | 2266 | if (dynamicID == "") |
1169 | { | 2267 | { |
1170 | IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); | 2268 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
1171 | LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer); | 2269 | LLUUID createdTexture = |
2270 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | ||
2271 | extraParams, timer); | ||
1172 | return createdTexture.ToStringHyphenated(); | 2272 | return createdTexture.ToStringHyphenated(); |
1173 | } | 2273 | } |
1174 | else | 2274 | else |
@@ -1184,6 +2284,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | |||
1184 | if (throwErrorOnNotImplemented) | 2284 | if (throwErrorOnNotImplemented) |
1185 | throw new NotImplementedException("Command not implemented: " + Command); | 2285 | throw new NotImplementedException("Command not implemented: " + Command); |
1186 | } | 2286 | } |
1187 | |||
1188 | } | 2287 | } |
1189 | } | 2288 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs index 44ed123..1847e87 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs | |||
@@ -27,11 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | 30 | using libsecondlife; |
33 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | 32 | ||
36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
37 | { | 34 | { |
@@ -39,7 +36,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
39 | /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. | 36 | /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. |
40 | /// </summary> | 37 | /// </summary> |
41 | [Serializable] | 38 | [Serializable] |
42 | class EventManager | 39 | internal class EventManager |
43 | { | 40 | { |
44 | private ScriptEngine myScriptEngine; | 41 | private ScriptEngine myScriptEngine; |
45 | //public IScriptHost TEMP_OBJECT_ID; | 42 | //public IScriptHost TEMP_OBJECT_ID; |
@@ -55,7 +52,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
55 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 52 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
56 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 53 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
57 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 54 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
58 | |||
59 | } | 55 | } |
60 | 56 | ||
61 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 57 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
@@ -63,17 +59,20 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
63 | // Add to queue for all scripts in ObjectID object | 59 | // Add to queue for all scripts in ObjectID object |
64 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); | 60 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); |
65 | //Console.WriteLine("touch_start localID: " + localID); | 61 | //Console.WriteLine("touch_start localID: " + localID); |
66 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); | 62 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1}); |
67 | } | 63 | } |
64 | |||
68 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 65 | public void OnRezScript(uint localID, LLUUID itemID, string script) |
69 | { | 66 | { |
70 | //myScriptEngine.myScriptManager.StartScript( | 67 | //myScriptEngine.myScriptManager.StartScript( |
71 | // Path.Combine("ScriptEngines", "Default.lsl"), | 68 | // Path.Combine("ScriptEngines", "Default.lsl"), |
72 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() | 69 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() |
73 | //); | 70 | //); |
74 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); | 71 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + |
72 | script.Length); | ||
75 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); | 73 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); |
76 | } | 74 | } |
75 | |||
77 | public void OnRemoveScript(uint localID, LLUUID itemID) | 76 | public void OnRemoveScript(uint localID, LLUUID itemID) |
78 | { | 77 | { |
79 | //myScriptEngine.myScriptManager.StartScript( | 78 | //myScriptEngine.myScriptManager.StartScript( |
@@ -84,48 +83,138 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
84 | myScriptEngine.m_ScriptManager.StopScript( | 83 | myScriptEngine.m_ScriptManager.StopScript( |
85 | localID, | 84 | localID, |
86 | itemID | 85 | itemID |
87 | ); | 86 | ); |
88 | |||
89 | } | 87 | } |
90 | 88 | ||
91 | // TODO: Replace placeholders below | 89 | // TODO: Replace placeholders below |
92 | // These needs to be hooked up to OpenSim during init of this class | 90 | // These needs to be hooked up to OpenSim during init of this class |
93 | // then queued in EventQueueManager. | 91 | // then queued in EventQueueManager. |
94 | // When queued in EventQueueManager they need to be LSL compatible (name and params) | 92 | // When queued in EventQueueManager they need to be LSL compatible (name and params) |
95 | 93 | ||
96 | //public void state_entry() { } // | 94 | //public void state_entry() { } // |
97 | public void state_exit() { } | 95 | public void state_exit() |
96 | { | ||
97 | } | ||
98 | |||
98 | //public void touch_start() { } | 99 | //public void touch_start() { } |
99 | public void touch() { } | 100 | public void touch() |
100 | public void touch_end() { } | 101 | { |
101 | public void collision_start() { } | 102 | } |
102 | public void collision() { } | 103 | |
103 | public void collision_end() { } | 104 | public void touch_end() |
104 | public void land_collision_start() { } | 105 | { |
105 | public void land_collision() { } | 106 | } |
106 | public void land_collision_end() { } | 107 | |
107 | public void timer() { } | 108 | public void collision_start() |
108 | public void listen() { } | 109 | { |
109 | public void on_rez() { } | 110 | } |
110 | public void sensor() { } | 111 | |
111 | public void no_sensor() { } | 112 | public void collision() |
112 | public void control() { } | 113 | { |
113 | public void money() { } | 114 | } |
114 | public void email() { } | 115 | |
115 | public void at_target() { } | 116 | public void collision_end() |
116 | public void not_at_target() { } | 117 | { |
117 | public void at_rot_target() { } | 118 | } |
118 | public void not_at_rot_target() { } | 119 | |
119 | public void run_time_permissions() { } | 120 | public void land_collision_start() |
120 | public void changed() { } | 121 | { |
121 | public void attach() { } | 122 | } |
122 | public void dataserver() { } | 123 | |
123 | public void link_message() { } | 124 | public void land_collision() |
124 | public void moving_start() { } | 125 | { |
125 | public void moving_end() { } | 126 | } |
126 | public void object_rez() { } | 127 | |
127 | public void remote_data() { } | 128 | public void land_collision_end() |
128 | public void http_response() { } | 129 | { |
130 | } | ||
131 | |||
132 | public void timer() | ||
133 | { | ||
134 | } | ||
135 | |||
136 | public void listen() | ||
137 | { | ||
138 | } | ||
139 | |||
140 | public void on_rez() | ||
141 | { | ||
142 | } | ||
143 | |||
144 | public void sensor() | ||
145 | { | ||
146 | } | ||
147 | |||
148 | public void no_sensor() | ||
149 | { | ||
150 | } | ||
151 | |||
152 | public void control() | ||
153 | { | ||
154 | } | ||
155 | |||
156 | public void money() | ||
157 | { | ||
158 | } | ||
159 | |||
160 | public void email() | ||
161 | { | ||
162 | } | ||
163 | |||
164 | public void at_target() | ||
165 | { | ||
166 | } | ||
167 | |||
168 | public void not_at_target() | ||
169 | { | ||
170 | } | ||
171 | |||
172 | public void at_rot_target() | ||
173 | { | ||
174 | } | ||
175 | |||
176 | public void not_at_rot_target() | ||
177 | { | ||
178 | } | ||
179 | |||
180 | public void run_time_permissions() | ||
181 | { | ||
182 | } | ||
183 | |||
184 | public void changed() | ||
185 | { | ||
186 | } | ||
187 | |||
188 | public void attach() | ||
189 | { | ||
190 | } | ||
191 | |||
192 | public void dataserver() | ||
193 | { | ||
194 | } | ||
195 | |||
196 | public void link_message() | ||
197 | { | ||
198 | } | ||
199 | |||
200 | public void moving_start() | ||
201 | { | ||
202 | } | ||
203 | |||
204 | public void moving_end() | ||
205 | { | ||
206 | } | ||
207 | |||
208 | public void object_rez() | ||
209 | { | ||
210 | } | ||
211 | |||
212 | public void remote_data() | ||
213 | { | ||
214 | } | ||
129 | 215 | ||
216 | public void http_response() | ||
217 | { | ||
218 | } | ||
130 | } | 219 | } |
131 | } | 220 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs index 8ee005a..31d090f 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs | |||
@@ -27,13 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Reflection; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | using libsecondlife; | 33 | using libsecondlife; |
36 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; | 34 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; |
35 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
37 | 36 | ||
38 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 37 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
39 | { | 38 | { |
@@ -42,25 +41,30 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
42 | /// Events are queued and executed in separate thread | 41 | /// Events are queued and executed in separate thread |
43 | /// </summary> | 42 | /// </summary> |
44 | [Serializable] | 43 | [Serializable] |
45 | class EventQueueManager | 44 | internal class EventQueueManager |
46 | { | 45 | { |
47 | /// <summary> | 46 | /// <summary> |
48 | /// List of threads processing event queue | 47 | /// List of threads processing event queue |
49 | /// </summary> | 48 | /// </summary> |
50 | private List<Thread> eventQueueThreads = new List<Thread>(); | 49 | private List<Thread> eventQueueThreads = new List<Thread>(); |
50 | |||
51 | private object queueLock = new object(); // Mutex lock object | 51 | private object queueLock = new object(); // Mutex lock object |
52 | |||
52 | /// <summary> | 53 | /// <summary> |
53 | /// How many ms to sleep if queue is empty | 54 | /// How many ms to sleep if queue is empty |
54 | /// </summary> | 55 | /// </summary> |
55 | private int nothingToDoSleepms = 50; | 56 | private int nothingToDoSleepms = 50; |
57 | |||
56 | /// <summary> | 58 | /// <summary> |
57 | /// How many threads to process queue with | 59 | /// How many threads to process queue with |
58 | /// </summary> | 60 | /// </summary> |
59 | private int numberOfThreads = 2; | 61 | private int numberOfThreads = 2; |
62 | |||
60 | /// <summary> | 63 | /// <summary> |
61 | /// Queue containing events waiting to be executed | 64 | /// Queue containing events waiting to be executed |
62 | /// </summary> | 65 | /// </summary> |
63 | private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); | 66 | private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); |
67 | |||
64 | /// <summary> | 68 | /// <summary> |
65 | /// Queue item structure | 69 | /// Queue item structure |
66 | /// </summary> | 70 | /// </summary> |
@@ -76,9 +80,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
76 | /// List of localID locks for mutex processing of script events | 80 | /// List of localID locks for mutex processing of script events |
77 | /// </summary> | 81 | /// </summary> |
78 | private List<uint> objectLocks = new List<uint>(); | 82 | private List<uint> objectLocks = new List<uint>(); |
83 | |||
79 | private object tryLockLock = new object(); // Mutex lock object | 84 | private object tryLockLock = new object(); // Mutex lock object |
80 | 85 | ||
81 | private ScriptEngine m_ScriptEngine; | 86 | private ScriptEngine m_ScriptEngine; |
87 | |||
82 | public EventQueueManager(ScriptEngine _ScriptEngine) | 88 | public EventQueueManager(ScriptEngine _ScriptEngine) |
83 | { | 89 | { |
84 | m_ScriptEngine = _ScriptEngine; | 90 | m_ScriptEngine = _ScriptEngine; |
@@ -96,11 +102,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
96 | EventQueueThread.Start(); | 102 | EventQueueThread.Start(); |
97 | } | 103 | } |
98 | } | 104 | } |
105 | |||
99 | ~EventQueueManager() | 106 | ~EventQueueManager() |
100 | { | 107 | { |
101 | |||
102 | // Kill worker threads | 108 | // Kill worker threads |
103 | foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads)) | 109 | foreach (Thread EventQueueThread in new ArrayList(eventQueueThreads)) |
104 | { | 110 | { |
105 | if (EventQueueThread != null && EventQueueThread.IsAlive == true) | 111 | if (EventQueueThread != null && EventQueueThread.IsAlive == true) |
106 | { | 112 | { |
@@ -118,7 +124,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
118 | eventQueueThreads.Clear(); | 124 | eventQueueThreads.Clear(); |
119 | // Todo: Clean up our queues | 125 | // Todo: Clean up our queues |
120 | eventQueue.Clear(); | 126 | eventQueue.Clear(); |
121 | |||
122 | } | 127 | } |
123 | 128 | ||
124 | /// <summary> | 129 | /// <summary> |
@@ -176,18 +181,21 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
176 | // Execute function | 181 | // Execute function |
177 | try | 182 | try |
178 | { | 183 | { |
179 | m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param); | 184 | m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, |
185 | QIS.functionName, QIS.param); | ||
180 | } | 186 | } |
181 | catch (Exception e) | 187 | catch (Exception e) |
182 | { | 188 | { |
183 | // DISPLAY ERROR INWORLD | 189 | // DISPLAY ERROR INWORLD |
184 | string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; | 190 | string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; |
185 | if (e.InnerException != null) | 191 | if (e.InnerException != null) |
186 | { // Send inner exception | 192 | { |
193 | // Send inner exception | ||
187 | text += e.InnerException.Message.ToString(); | 194 | text += e.InnerException.Message.ToString(); |
188 | } | 195 | } |
189 | else | 196 | else |
190 | { // Send normal | 197 | { |
198 | // Send normal | ||
191 | text += e.Message.ToString(); | 199 | text += e.Message.ToString(); |
192 | } | 200 | } |
193 | try | 201 | try |
@@ -195,28 +203,33 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
195 | if (text.Length > 1500) | 203 | if (text.Length > 1500) |
196 | text = text.Substring(0, 1500); | 204 | text = text.Substring(0, 1500); |
197 | IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); | 205 | IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); |
198 | //if (m_host != null) | 206 | //if (m_host != null) |
199 | //{ | 207 | //{ |
200 | m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 208 | m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, |
201 | } catch { | 209 | m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
202 | //} | 210 | } |
203 | //else | 211 | catch |
204 | //{ | 212 | { |
213 | //} | ||
214 | //else | ||
215 | //{ | ||
205 | // T oconsole | 216 | // T oconsole |
206 | Console.WriteLine("Unable to send text in-world:\r\n" + text); | 217 | Console.WriteLine("Unable to send text in-world:\r\n" + text); |
207 | } | 218 | } |
208 | |||
209 | } | 219 | } |
210 | finally | 220 | finally |
211 | { | 221 | { |
212 | ReleaseLock(QIS.localID); | 222 | ReleaseLock(QIS.localID); |
213 | } | 223 | } |
214 | } | 224 | } |
215 | |||
216 | } // Something in queue | 225 | } // Something in queue |
217 | } catch (ThreadAbortException tae) { | 226 | } |
227 | catch (ThreadAbortException tae) | ||
228 | { | ||
218 | throw tae; | 229 | throw tae; |
219 | } catch (Exception e) { | 230 | } |
231 | catch (Exception e) | ||
232 | { | ||
220 | Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); | 233 | Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); |
221 | } | 234 | } |
222 | } // while | 235 | } // while |
@@ -283,15 +296,15 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
283 | return; | 296 | return; |
284 | } | 297 | } |
285 | 298 | ||
286 | Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); | 299 | Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = |
300 | m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); | ||
287 | 301 | ||
288 | foreach ( LLUUID itemID in scriptKeys ) | 302 | foreach (LLUUID itemID in scriptKeys) |
289 | { | 303 | { |
290 | // Add to each script in that object | 304 | // Add to each script in that object |
291 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? | 305 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? |
292 | AddToScriptQueue(localID, itemID, FunctionName, param); | 306 | AddToScriptQueue(localID, itemID, FunctionName, param); |
293 | } | 307 | } |
294 | |||
295 | } | 308 | } |
296 | 309 | ||
297 | /// <summary> | 310 | /// <summary> |
@@ -316,6 +329,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
316 | eventQueue.Enqueue(QIS); | 329 | eventQueue.Enqueue(QIS); |
317 | } | 330 | } |
318 | } | 331 | } |
319 | |||
320 | } | 332 | } |
321 | } | 333 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs index 13979ba..303bddb 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs | |||
@@ -28,24 +28,23 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Threading; | 31 | using System.Threading; |
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using OpenSim.Region.ScriptEngine.Common; | ||
35 | using OpenSim.Region.Environment.Modules; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 33 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Modules; | ||
37 | 35 | ||
38 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 36 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
39 | { | 37 | { |
40 | /// <summary> | 38 | /// <summary> |
41 | /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. | 39 | /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. |
42 | /// </summary> | 40 | /// </summary> |
43 | class LSLLongCmdHandler | 41 | internal class LSLLongCmdHandler |
44 | { | 42 | { |
45 | private Thread cmdHandlerThread; | 43 | private Thread cmdHandlerThread; |
46 | private int cmdHandlerThreadCycleSleepms = 100; | 44 | private int cmdHandlerThreadCycleSleepms = 100; |
47 | 45 | ||
48 | private ScriptEngine m_ScriptEngine; | 46 | private ScriptEngine m_ScriptEngine; |
47 | |||
49 | public LSLLongCmdHandler(ScriptEngine _ScriptEngine) | 48 | public LSLLongCmdHandler(ScriptEngine _ScriptEngine) |
50 | { | 49 | { |
51 | m_ScriptEngine = _ScriptEngine; | 50 | m_ScriptEngine = _ScriptEngine; |
@@ -56,8 +55,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
56 | cmdHandlerThread.Priority = ThreadPriority.BelowNormal; | 55 | cmdHandlerThread.Priority = ThreadPriority.BelowNormal; |
57 | cmdHandlerThread.IsBackground = true; | 56 | cmdHandlerThread.IsBackground = true; |
58 | cmdHandlerThread.Start(); | 57 | cmdHandlerThread.Start(); |
59 | |||
60 | } | 58 | } |
59 | |||
61 | ~LSLLongCmdHandler() | 60 | ~LSLLongCmdHandler() |
62 | { | 61 | { |
63 | // Shut down thread | 62 | // Shut down thread |
@@ -72,7 +71,9 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
72 | } | 71 | } |
73 | } | 72 | } |
74 | } | 73 | } |
75 | catch { } | 74 | catch |
75 | { | ||
76 | } | ||
76 | } | 77 | } |
77 | 78 | ||
78 | private void CmdHandlerThreadLoop() | 79 | private void CmdHandlerThreadLoop() |
@@ -124,8 +125,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
124 | public double interval; | 125 | public double interval; |
125 | public DateTime next; | 126 | public DateTime next; |
126 | } | 127 | } |
128 | |||
127 | private List<TimerClass> Timers = new List<TimerClass>(); | 129 | private List<TimerClass> Timers = new List<TimerClass>(); |
128 | private object TimerListLock = new object(); | 130 | private object TimerListLock = new object(); |
131 | |||
129 | public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) | 132 | public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) |
130 | { | 133 | { |
131 | Console.WriteLine("SetTimerEvent"); | 134 | Console.WriteLine("SetTimerEvent"); |
@@ -146,6 +149,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
146 | Timers.Add(ts); | 149 | Timers.Add(ts); |
147 | } | 150 | } |
148 | } | 151 | } |
152 | |||
149 | public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) | 153 | public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) |
150 | { | 154 | { |
151 | // Remove from timer | 155 | // Remove from timer |
@@ -163,6 +167,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
163 | Timers = NewTimers; | 167 | Timers = NewTimers; |
164 | } | 168 | } |
165 | } | 169 | } |
170 | |||
166 | public void CheckTimerEvents() | 171 | public void CheckTimerEvents() |
167 | { | 172 | { |
168 | // Nothing to do here? | 173 | // Nothing to do here? |
@@ -171,7 +176,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
171 | 176 | ||
172 | lock (TimerListLock) | 177 | lock (TimerListLock) |
173 | { | 178 | { |
174 | |||
175 | // Go through all timers | 179 | // Go through all timers |
176 | foreach (TimerClass ts in Timers) | 180 | foreach (TimerClass ts in Timers) |
177 | { | 181 | { |
@@ -179,7 +183,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
179 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) | 183 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) |
180 | { | 184 | { |
181 | // Add it to queue | 185 | // Add it to queue |
182 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); | 186 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", |
187 | new object[] {}); | ||
183 | // set next interval | 188 | // set next interval |
184 | 189 | ||
185 | 190 | ||
@@ -188,6 +193,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
188 | } | 193 | } |
189 | } // lock | 194 | } // lock |
190 | } | 195 | } |
196 | |||
191 | #endregion | 197 | #endregion |
192 | 198 | ||
193 | #region HTTP REQUEST | 199 | #region HTTP REQUEST |
@@ -213,10 +219,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
213 | { | 219 | { |
214 | // TODO: SEND REQUEST!!! | 220 | // TODO: SEND REQUEST!!! |
215 | } | 221 | } |
222 | |||
216 | public void Stop() | 223 | public void Stop() |
217 | { | 224 | { |
218 | // TODO: Cancel any ongoing request | 225 | // TODO: Cancel any ongoing request |
219 | } | 226 | } |
227 | |||
220 | public bool CheckResponse() | 228 | public bool CheckResponse() |
221 | { | 229 | { |
222 | // TODO: Check if we got a response yet, return true if so -- false if not | 230 | // TODO: Check if we got a response yet, return true if so -- false if not |
@@ -227,11 +235,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
227 | //response_status | 235 | //response_status |
228 | //response_metadata | 236 | //response_metadata |
229 | //response_body | 237 | //response_body |
230 | |||
231 | } | 238 | } |
232 | } | 239 | } |
240 | |||
233 | private List<HttpClass> HttpRequests = new List<HttpClass>(); | 241 | private List<HttpClass> HttpRequests = new List<HttpClass>(); |
234 | private object HttpListLock = new object(); | 242 | private object HttpListLock = new object(); |
243 | |||
235 | public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) | 244 | public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) |
236 | { | 245 | { |
237 | Console.WriteLine("StartHttpRequest"); | 246 | Console.WriteLine("StartHttpRequest"); |
@@ -244,11 +253,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
244 | htc.body = body; | 253 | htc.body = body; |
245 | lock (HttpListLock) | 254 | lock (HttpListLock) |
246 | { | 255 | { |
247 | |||
248 | //ADD REQUEST | 256 | //ADD REQUEST |
249 | HttpRequests.Add(htc); | 257 | HttpRequests.Add(htc); |
250 | } | 258 | } |
251 | } | 259 | } |
260 | |||
252 | public void StopHttpRequest(uint m_localID, LLUUID m_itemID) | 261 | public void StopHttpRequest(uint m_localID, LLUUID m_itemID) |
253 | { | 262 | { |
254 | // Remove from list | 263 | // Remove from list |
@@ -272,6 +281,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
272 | HttpRequests = NewHttpList; | 281 | HttpRequests = NewHttpList; |
273 | } | 282 | } |
274 | } | 283 | } |
284 | |||
275 | public void CheckHttpRequests() | 285 | public void CheckHttpRequests() |
276 | { | 286 | { |
277 | // Nothing to do here? | 287 | // Nothing to do here? |
@@ -282,68 +292,64 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
282 | { | 292 | { |
283 | foreach (HttpClass ts in HttpRequests) | 293 | foreach (HttpClass ts in HttpRequests) |
284 | { | 294 | { |
285 | |||
286 | if (ts.CheckResponse() == true) | 295 | if (ts.CheckResponse() == true) |
287 | { | 296 | { |
288 | // Add it to event queue | 297 | // Add it to event queue |
289 | //key request_id, integer status, list metadata, string body | 298 | //key request_id, integer status, list metadata, string body |
290 | object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; | 299 | object[] resobj = |
291 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); | 300 | new object[] |
301 | {ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body}; | ||
302 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", | ||
303 | resobj); | ||
292 | // Now stop it | 304 | // Now stop it |
293 | StopHttpRequest(ts.localID, ts.itemID); | 305 | StopHttpRequest(ts.localID, ts.itemID); |
294 | } | 306 | } |
295 | } | 307 | } |
296 | } // lock | 308 | } // lock |
297 | } | 309 | } |
310 | |||
298 | #endregion | 311 | #endregion |
299 | 312 | ||
300 | public void CheckXMLRPCRequests() | 313 | public void CheckXMLRPCRequests() |
301 | { | 314 | { |
302 | |||
303 | IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 315 | IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
304 | 316 | ||
305 | while (xmlrpc.hasRequests()) | 317 | while (xmlrpc.hasRequests()) |
306 | { | 318 | { |
307 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); | 319 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); |
308 | System.Console.WriteLine("PICKED REQUEST"); | 320 | Console.WriteLine("PICKED REQUEST"); |
309 | 321 | ||
310 | //Deliver data to prim's remote_data handler | 322 | //Deliver data to prim's remote_data handler |
311 | object[] resobj = new object[] { | 323 | object[] resobj = new object[] |
312 | 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), rInfo.GetStrVal() | 324 | { |
313 | }; | 325 | 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), |
326 | rInfo.GetStrVal() | ||
327 | }; | ||
314 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 328 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
315 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj | 329 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj |
316 | ); | 330 | ); |
317 | |||
318 | } | 331 | } |
319 | |||
320 | } | 332 | } |
321 | 333 | ||
322 | public void CheckListeners() | 334 | public void CheckListeners() |
323 | { | 335 | { |
324 | |||
325 | IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 336 | IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
326 | 337 | ||
327 | while (comms.HasMessages()) | 338 | while (comms.HasMessages()) |
328 | { | 339 | { |
329 | ListenerInfo lInfo = comms.GetNextMessage(); | 340 | ListenerInfo lInfo = comms.GetNextMessage(); |
330 | System.Console.WriteLine("PICKED LISTENER"); | 341 | Console.WriteLine("PICKED LISTENER"); |
331 | 342 | ||
332 | //Deliver data to prim's listen handler | 343 | //Deliver data to prim's listen handler |
333 | object[] resobj = new object[] { | 344 | object[] resobj = new object[] |
334 | lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() | 345 | { |
335 | }; | 346 | lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() |
347 | }; | ||
336 | 348 | ||
337 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 349 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
338 | lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj | 350 | lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj |
339 | ); | 351 | ); |
340 | |||
341 | } | 352 | } |
342 | |||
343 | } | 353 | } |
344 | |||
345 | |||
346 | |||
347 | |||
348 | } | 354 | } |
349 | } | 355 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs index e1e025c..a0ac023 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Grid.ScriptEngine.DotNetEngine")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Grid.ScriptEngine.DotNetEngine")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.Grid.ScriptEngine.DotNetEngine")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Grid.ScriptEngine.DotNetEngine")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
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 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] | 24 | |
25 | [assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices; | |||
31 | // | 33 | // |
32 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
33 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
34 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs index 5ec77f3..6373d3c 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -27,14 +27,10 @@ | |||
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 Nini.Config; |
31 | using System.Text; | ||
32 | using OpenSim.Framework.Console; | 31 | using OpenSim.Framework.Console; |
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
36 | using libsecondlife; | 33 | using OpenSim.Region.Environment.Scenes; |
37 | using Nini.Config; | ||
38 | 34 | ||
39 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 35 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
40 | { | 36 | { |
@@ -42,17 +38,16 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
42 | /// This is the root object for ScriptEngine | 38 | /// This is the root object for ScriptEngine |
43 | /// </summary> | 39 | /// </summary> |
44 | [Serializable] | 40 | [Serializable] |
45 | public class ScriptEngine :IRegionModule | 41 | public class ScriptEngine : IRegionModule |
46 | { | 42 | { |
47 | 43 | internal Scene World; | |
48 | internal OpenSim.Region.Environment.Scenes.Scene World; | 44 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
49 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 45 | internal EventQueueManager m_EventQueueManager; // Executes events |
50 | internal EventQueueManager m_EventQueueManager; // Executes events | 46 | internal ScriptManager m_ScriptManager; // Load, unload and execute scripts |
51 | internal ScriptManager m_ScriptManager; // Load, unload and execute scripts | ||
52 | internal AppDomainManager m_AppDomainManager; | 47 | internal AppDomainManager m_AppDomainManager; |
53 | internal LSLLongCmdHandler m_LSLLongCmdHandler; | 48 | internal LSLLongCmdHandler m_LSLLongCmdHandler; |
54 | 49 | ||
55 | private OpenSim.Framework.Console.LogBase m_log; | 50 | private LogBase m_log; |
56 | 51 | ||
57 | public ScriptEngine() | 52 | public ScriptEngine() |
58 | { | 53 | { |
@@ -65,9 +60,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
65 | get { return m_log; } | 60 | get { return m_log; } |
66 | } | 61 | } |
67 | 62 | ||
68 | public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) | 63 | public void InitializeEngine(Scene Sceneworld, LogBase logger) |
69 | { | 64 | { |
70 | |||
71 | World = Sceneworld; | 65 | World = Sceneworld; |
72 | m_log = logger; | 66 | m_log = logger; |
73 | 67 | ||
@@ -84,10 +78,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
84 | 78 | ||
85 | // Should we iterate the region for scripts that needs starting? | 79 | // Should we iterate the region for scripts that needs starting? |
86 | // Or can we assume we are loaded before anything else so we can use proper events? | 80 | // Or can we assume we are loaded before anything else so we can use proper events? |
87 | |||
88 | |||
89 | } | 81 | } |
90 | 82 | ||
91 | public void Shutdown() | 83 | public void Shutdown() |
92 | { | 84 | { |
93 | // We are shutting down | 85 | // We are shutting down |
@@ -106,12 +98,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
106 | 98 | ||
107 | public void Initialise(Scene scene, IConfigSource config) | 99 | public void Initialise(Scene scene, IConfigSource config) |
108 | { | 100 | { |
109 | this.InitializeEngine(scene, MainLog.Instance); | 101 | InitializeEngine(scene, MainLog.Instance); |
110 | } | 102 | } |
111 | 103 | ||
112 | public void PostInitialise() | 104 | public void PostInitialise() |
113 | { | 105 | { |
114 | |||
115 | } | 106 | } |
116 | 107 | ||
117 | public void Close() | 108 | public void Close() |
@@ -130,4 +121,4 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
130 | 121 | ||
131 | #endregion | 122 | #endregion |
132 | } | 123 | } |
133 | } | 124 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs index 988230f..2149bf0 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -28,19 +28,14 @@ | |||
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.IO; |
32 | using System.Threading; | ||
33 | using System.Reflection; | 32 | using System.Reflection; |
34 | using System.Runtime.Remoting; | ||
35 | using System.Runtime.Serialization; | ||
36 | using System.Runtime.Serialization.Formatters.Binary; | 33 | using System.Runtime.Serialization.Formatters.Binary; |
37 | using OpenSim.Region.Environment.Scenes; | 34 | using System.Threading; |
38 | using OpenSim.Region.Environment.Scenes.Scripting; | 35 | using libsecondlife; |
39 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; | 36 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; |
40 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; | 37 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; |
41 | using OpenSim.Region.ScriptEngine.Common; | 38 | using OpenSim.Region.Environment.Scenes; |
42 | using libsecondlife; | ||
43 | |||
44 | 39 | ||
45 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 40 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
46 | { | 41 | { |
@@ -53,16 +48,19 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
53 | public class ScriptManager | 48 | public class ScriptManager |
54 | { | 49 | { |
55 | #region Declares | 50 | #region Declares |
51 | |||
56 | private Thread scriptLoadUnloadThread; | 52 | private Thread scriptLoadUnloadThread; |
57 | private int scriptLoadUnloadThread_IdleSleepms = 100; | 53 | private int scriptLoadUnloadThread_IdleSleepms = 100; |
58 | private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>(); | 54 | private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>(); |
59 | private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>(); | 55 | private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>(); |
56 | |||
60 | private struct LoadStruct | 57 | private struct LoadStruct |
61 | { | 58 | { |
62 | public uint localID; | 59 | public uint localID; |
63 | public LLUUID itemID; | 60 | public LLUUID itemID; |
64 | public string script; | 61 | public string script; |
65 | } | 62 | } |
63 | |||
66 | private struct UnloadStruct | 64 | private struct UnloadStruct |
67 | { | 65 | { |
68 | public uint localID; | 66 | public uint localID; |
@@ -72,17 +70,20 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
72 | // Object<string, Script<string, script>> | 70 | // Object<string, Script<string, script>> |
73 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. | 71 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. |
74 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 72 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
75 | internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); | 73 | internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = |
74 | new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); | ||
75 | |||
76 | public Scene World | 76 | public Scene World |
77 | { | 77 | { |
78 | get | 78 | get { return m_scriptEngine.World; } |
79 | { | ||
80 | return m_scriptEngine.World; | ||
81 | } | ||
82 | } | 79 | } |
83 | #endregion | 80 | |
81 | #endregion | ||
82 | |||
84 | #region Object init/shutdown | 83 | #region Object init/shutdown |
84 | |||
85 | private ScriptEngine m_scriptEngine; | 85 | private ScriptEngine m_scriptEngine; |
86 | |||
86 | public ScriptManager(ScriptEngine scriptEngine) | 87 | public ScriptManager(ScriptEngine scriptEngine) |
87 | { | 88 | { |
88 | m_scriptEngine = scriptEngine; | 89 | m_scriptEngine = scriptEngine; |
@@ -92,9 +93,9 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
92 | scriptLoadUnloadThread.IsBackground = true; | 93 | scriptLoadUnloadThread.IsBackground = true; |
93 | scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; | 94 | scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; |
94 | scriptLoadUnloadThread.Start(); | 95 | scriptLoadUnloadThread.Start(); |
95 | |||
96 | } | 96 | } |
97 | ~ScriptManager () | 97 | |
98 | ~ScriptManager() | ||
98 | { | 99 | { |
99 | // Abort load/unload thread | 100 | // Abort load/unload thread |
100 | try | 101 | try |
@@ -112,8 +113,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
112 | { | 113 | { |
113 | } | 114 | } |
114 | } | 115 | } |
116 | |||
115 | #endregion | 117 | #endregion |
118 | |||
116 | #region Load / Unload scripts (Thread loop) | 119 | #region Load / Unload scripts (Thread loop) |
120 | |||
117 | private void ScriptLoadUnloadThreadLoop() | 121 | private void ScriptLoadUnloadThreadLoop() |
118 | { | 122 | { |
119 | try | 123 | try |
@@ -134,9 +138,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
134 | UnloadStruct item = unloadQueue.Dequeue(); | 138 | UnloadStruct item = unloadQueue.Dequeue(); |
135 | _StopScript(item.localID, item.itemID); | 139 | _StopScript(item.localID, item.itemID); |
136 | } | 140 | } |
137 | |||
138 | |||
139 | |||
140 | } | 141 | } |
141 | } | 142 | } |
142 | catch (ThreadAbortException tae) | 143 | catch (ThreadAbortException tae) |
@@ -145,21 +146,22 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
145 | a = ""; | 146 | a = ""; |
146 | // Expected | 147 | // Expected |
147 | } | 148 | } |
148 | |||
149 | } | 149 | } |
150 | |||
150 | #endregion | 151 | #endregion |
152 | |||
151 | #region Helper functions | 153 | #region Helper functions |
154 | |||
152 | private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) | 155 | private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) |
153 | { | 156 | { |
154 | |||
155 | //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); | 157 | //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); |
156 | return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; | 158 | return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; |
157 | |||
158 | } | 159 | } |
159 | 160 | ||
160 | |||
161 | #endregion | 161 | #endregion |
162 | |||
162 | #region Internal functions to keep track of script | 163 | #region Internal functions to keep track of script |
164 | |||
163 | internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID) | 165 | internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID) |
164 | { | 166 | { |
165 | if (Scripts.ContainsKey(localID) == false) | 167 | if (Scripts.ContainsKey(localID) == false) |
@@ -169,7 +171,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
169 | Scripts.TryGetValue(localID, out Obj); | 171 | Scripts.TryGetValue(localID, out Obj); |
170 | 172 | ||
171 | return Obj.Keys; | 173 | return Obj.Keys; |
172 | |||
173 | } | 174 | } |
174 | 175 | ||
175 | internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) | 176 | internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) |
@@ -187,8 +188,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
187 | Obj.TryGetValue(itemID, out Script); | 188 | Obj.TryGetValue(itemID, out Script); |
188 | 189 | ||
189 | return Script; | 190 | return Script; |
190 | |||
191 | } | 191 | } |
192 | |||
192 | internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) | 193 | internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) |
193 | { | 194 | { |
194 | // Create object if it doesn't exist | 195 | // Create object if it doesn't exist |
@@ -205,8 +206,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
205 | 206 | ||
206 | // Add to object | 207 | // Add to object |
207 | Obj.Add(itemID, Script); | 208 | Obj.Add(itemID, Script); |
208 | |||
209 | } | 209 | } |
210 | |||
210 | internal void RemoveScript(uint localID, LLUUID itemID) | 211 | internal void RemoveScript(uint localID, LLUUID itemID) |
211 | { | 212 | { |
212 | // Don't have that object? | 213 | // Don't have that object? |
@@ -218,10 +219,12 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
218 | Scripts.TryGetValue(localID, out Obj); | 219 | Scripts.TryGetValue(localID, out Obj); |
219 | if (Obj.ContainsKey(itemID) == true) | 220 | if (Obj.ContainsKey(itemID) == true) |
220 | Obj.Remove(itemID); | 221 | Obj.Remove(itemID); |
221 | |||
222 | } | 222 | } |
223 | |||
223 | #endregion | 224 | #endregion |
225 | |||
224 | #region Start/Stop/Reset script | 226 | #region Start/Stop/Reset script |
227 | |||
225 | /// <summary> | 228 | /// <summary> |
226 | /// Fetches, loads and hooks up a script to an objects events | 229 | /// Fetches, loads and hooks up a script to an objects events |
227 | /// </summary> | 230 | /// </summary> |
@@ -235,6 +238,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
235 | ls.script = Script; | 238 | ls.script = Script; |
236 | loadQueue.Enqueue(ls); | 239 | loadQueue.Enqueue(ls); |
237 | } | 240 | } |
241 | |||
238 | /// <summary> | 242 | /// <summary> |
239 | /// Disables and unloads a script | 243 | /// Disables and unloads a script |
240 | /// </summary> | 244 | /// </summary> |
@@ -247,6 +251,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
247 | ls.itemID = itemID; | 251 | ls.itemID = itemID; |
248 | unloadQueue.Enqueue(ls); | 252 | unloadQueue.Enqueue(ls); |
249 | } | 253 | } |
254 | |||
250 | public void ResetScript(uint localID, LLUUID itemID) | 255 | public void ResetScript(uint localID, LLUUID itemID) |
251 | { | 256 | { |
252 | string script = GetScript(localID, itemID).SourceCode; | 257 | string script = GetScript(localID, itemID).SourceCode; |
@@ -267,12 +272,8 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
267 | 272 | ||
268 | try | 273 | try |
269 | { | 274 | { |
270 | |||
271 | |||
272 | |||
273 | |||
274 | // Create a new instance of the compiler (currently we don't want reuse) | 275 | // Create a new instance of the compiler (currently we don't want reuse) |
275 | OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); | 276 | Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); |
276 | // Compile (We assume LSL) | 277 | // Compile (We assume LSL) |
277 | ScriptSource = LSLCompiler.CompileFromLSLText(Script); | 278 | ScriptSource = LSLCompiler.CompileFromLSLText(Script); |
278 | //Console.WriteLine("Compilation of " + FileName + " done"); | 279 | //Console.WriteLine("Compilation of " + FileName + " done"); |
@@ -289,10 +290,10 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
289 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); | 290 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); |
290 | 291 | ||
291 | #if DEBUG | 292 | #if DEBUG |
292 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); | 293 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); |
293 | #endif | 294 | #endif |
294 | 295 | ||
295 | CompiledScript.SourceCode = ScriptSource; | 296 | CompiledScript.SourceCode = ScriptSource; |
296 | // Add it to our script memstruct | 297 | // Add it to our script memstruct |
297 | SetScript(localID, itemID, CompiledScript); | 298 | SetScript(localID, itemID, CompiledScript); |
298 | 299 | ||
@@ -306,9 +307,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
306 | CompiledScript.Start(LSLB); | 307 | CompiledScript.Start(LSLB); |
307 | 308 | ||
308 | // Fire the first start-event | 309 | // Fire the first start-event |
309 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); | 310 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {}); |
310 | |||
311 | |||
312 | } | 311 | } |
313 | catch (Exception e) | 312 | catch (Exception e) |
314 | { | 313 | { |
@@ -326,9 +325,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
326 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); | 325 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); |
327 | } | 326 | } |
328 | } | 327 | } |
329 | |||
330 | |||
331 | |||
332 | } | 328 | } |
333 | 329 | ||
334 | private void _StopScript(uint localID, LLUUID itemID) | 330 | private void _StopScript(uint localID, LLUUID itemID) |
@@ -359,19 +355,24 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
359 | // Tell AppDomain that we have stopped script | 355 | // Tell AppDomain that we have stopped script |
360 | m_scriptEngine.m_AppDomainManager.StopScript(ad); | 356 | m_scriptEngine.m_AppDomainManager.StopScript(ad); |
361 | } | 357 | } |
362 | catch(Exception e) | 358 | catch (Exception e) |
363 | { | 359 | { |
364 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString()); | 360 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + |
361 | ": " + e.ToString()); | ||
365 | } | 362 | } |
366 | } | 363 | } |
367 | private string ProcessYield(string FileName) | 364 | |
365 | private string ProcessYield(string FileName) | ||
368 | { | 366 | { |
369 | // TODO: Create a new assembly and copy old but insert Yield Code | 367 | // TODO: Create a new assembly and copy old but insert Yield Code |
370 | //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); | 368 | //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); |
371 | return FileName; | 369 | return FileName; |
372 | } | 370 | } |
371 | |||
373 | #endregion | 372 | #endregion |
373 | |||
374 | #region Perform event execution in script | 374 | #region Perform event execution in script |
375 | |||
375 | /// <summary> | 376 | /// <summary> |
376 | /// Execute a LL-event-function in Script | 377 | /// Execute a LL-event-function in Script |
377 | /// </summary> | 378 | /// </summary> |
@@ -381,7 +382,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
381 | /// <param name="args">Arguments to pass to function</param> | 382 | /// <param name="args">Arguments to pass to function</param> |
382 | internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) | 383 | internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) |
383 | { | 384 | { |
384 | |||
385 | // Execute a function in the script | 385 | // Execute a function in the script |
386 | //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); | 386 | //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); |
387 | LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); | 387 | LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); |
@@ -390,28 +390,29 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
390 | 390 | ||
391 | // Must be done in correct AppDomain, so leaving it up to the script itself | 391 | // Must be done in correct AppDomain, so leaving it up to the script itself |
392 | Script.Exec.ExecuteEvent(FunctionName, args); | 392 | Script.Exec.ExecuteEvent(FunctionName, args); |
393 | |||
394 | } | 393 | } |
394 | |||
395 | #endregion | 395 | #endregion |
396 | 396 | ||
397 | #region Script serialization/deserialization | 397 | #region Script serialization/deserialization |
398 | |||
398 | public void GetSerializedScript(uint localID, LLUUID itemID) | 399 | public void GetSerializedScript(uint localID, LLUUID itemID) |
399 | { | 400 | { |
400 | // Serialize the script and return it | 401 | // Serialize the script and return it |
401 | // Should not be a problem | 402 | // Should not be a problem |
402 | System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID); | 403 | FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID); |
403 | BinaryFormatter b = new BinaryFormatter(); | 404 | BinaryFormatter b = new BinaryFormatter(); |
404 | b.Serialize(fs, GetScript(localID,itemID)); | 405 | b.Serialize(fs, GetScript(localID, itemID)); |
405 | fs.Close(); | 406 | fs.Close(); |
406 | |||
407 | |||
408 | } | 407 | } |
408 | |||
409 | public void PutSerializedScript(uint localID, LLUUID itemID) | 409 | public void PutSerializedScript(uint localID, LLUUID itemID) |
410 | { | 410 | { |
411 | // Deserialize the script and inject it into an AppDomain | 411 | // Deserialize the script and inject it into an AppDomain |
412 | 412 | ||
413 | // How to inject into an AppDomain? | 413 | // How to inject into an AppDomain? |
414 | } | 414 | } |
415 | |||
415 | #endregion | 416 | #endregion |
416 | } | 417 | } |
417 | } | 418 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs index 0498ef3..8a8c96d 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs | |||
@@ -27,12 +27,9 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.IO; |
31 | using System.Text; | ||
32 | using Rail.Transformation; | ||
33 | using Rail.Reflect; | 31 | using Rail.Reflect; |
34 | using Rail.Exceptions; | 32 | using Rail.Transformation; |
35 | using Rail.MSIL; | ||
36 | 33 | ||
37 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine | 34 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine |
38 | { | 35 | { |
@@ -40,26 +37,26 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
40 | /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! | 37 | /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! |
41 | /// Its offspring will be the actual implementation. | 38 | /// Its offspring will be the actual implementation. |
42 | /// </summary> | 39 | /// </summary> |
43 | class TempDotNetMicroThreadingCodeInjector | 40 | internal class TempDotNetMicroThreadingCodeInjector |
44 | { | 41 | { |
45 | public static string TestFix(string FileName) | 42 | public static string TestFix(string FileName) |
46 | { | 43 | { |
47 | string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); | 44 | string ret = Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); |
48 | 45 | ||
49 | Console.WriteLine("Loading: \"" + FileName + "\""); | 46 | Console.WriteLine("Loading: \"" + FileName + "\""); |
50 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); | 47 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); |
51 | 48 | ||
52 | 49 | ||
53 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe | 50 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe |
54 | RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); | 51 | RTypeDef type = (RTypeDef) rAssembly.RModuleDef.GetType("SecondLife.Script"); |
55 | 52 | ||
56 | //Get the methods in the type | 53 | //Get the methods in the type |
57 | RMethod[] m = type.GetMethods(); | 54 | RMethod[] m = type.GetMethods(); |
58 | 55 | ||
59 | //Create a MethodPrologueAdder visitor object with the method to add | 56 | //Create a MethodPrologueAdder visitor object with the method to add |
60 | //and with the flag that enables local variable creation set to true | 57 | //and with the flag that enables local variable creation set to true |
61 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); | 58 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef) m[0], true); |
62 | 59 | ||
63 | //Apply the changes to the assembly | 60 | //Apply the changes to the assembly |
64 | rAssembly.Accept(mpa); | 61 | rAssembly.Accept(mpa); |
65 | 62 | ||
@@ -67,7 +64,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine | |||
67 | rAssembly.SaveAssembly(ret); | 64 | rAssembly.SaveAssembly(ret); |
68 | 65 | ||
69 | return ret; | 66 | return ret; |
70 | |||
71 | } | 67 | } |
72 | } | 68 | } |
73 | } | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs index 7fc9a53..e049fd7 100644 --- a/OpenSim/Grid/ScriptServer/Application.cs +++ b/OpenSim/Grid/ScriptServer/Application.cs | |||
@@ -26,25 +26,23 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Grid.ScriptServer | 30 | namespace OpenSim.Grid.ScriptServer |
33 | { | 31 | { |
34 | class OpenScript_Main | 32 | internal class OpenScript_Main |
35 | { | 33 | { |
36 | |||
37 | public static ScriptServerMain SE; | 34 | public static ScriptServerMain SE; |
38 | 35 | ||
39 | static void Main(string[] args) | 36 | private static void Main(string[] args) |
40 | { | 37 | { |
41 | // Application is starting | 38 | // Application is starting |
42 | SE = new ScriptServerMain(); | 39 | SE = new ScriptServerMain(); |
43 | 40 | ||
44 | System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | 41 | AppDomain.CurrentDomain.UnhandledException += |
42 | new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | ||
45 | } | 43 | } |
46 | 44 | ||
47 | static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) | 45 | private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |
48 | { | 46 | { |
49 | Console.WriteLine(""); | 47 | Console.WriteLine(""); |
50 | Console.WriteLine("APPLICATION EXCEPTION DETECTED"); | 48 | Console.WriteLine("APPLICATION EXCEPTION DETECTED"); |
@@ -53,6 +51,5 @@ namespace OpenSim.Grid.ScriptServer | |||
53 | Console.WriteLine("Exception:"); | 51 | Console.WriteLine("Exception:"); |
54 | Console.WriteLine(e.ExceptionObject.ToString()); | 52 | Console.WriteLine(e.ExceptionObject.ToString()); |
55 | } | 53 | } |
56 | |||
57 | } | 54 | } |
58 | } | 55 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs index 63f40d4..2886ec7 100644 --- a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Grid.ScriptServer")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Grid.ScriptServer")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Grid.ScriptServer")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
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 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("b6861b87-5203-4040-b756-fd4774932f82")] | 24 | |
25 | [assembly : Guid("b6861b87-5203-4040-b756-fd4774932f82")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 31 | // Build Number |
30 | // Revision | 32 | // Revision |
31 | // | 33 | // |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs index b18bda2..cb6734f 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Grid.ScriptServer | 29 | namespace OpenSim.Grid.ScriptServer |
34 | { | 30 | { |
35 | public abstract class RegionBase | 31 | public abstract class RegionBase |
@@ -73,42 +69,176 @@ namespace OpenSim.Grid.ScriptServer | |||
73 | public event DefaultDelegate onobject_rez; | 69 | public event DefaultDelegate onobject_rez; |
74 | public event DefaultDelegate onremote_data; | 70 | public event DefaultDelegate onremote_data; |
75 | public event DefaultDelegate onhttp_response; | 71 | public event DefaultDelegate onhttp_response; |
76 | 72 | ||
77 | 73 | ||
78 | public void ScriptRez() { onScriptRez(); } | 74 | public void ScriptRez() |
79 | public void state_entry() { onstate_entry(); } | 75 | { |
80 | public void state_exit() { onstate_exit(); } | 76 | onScriptRez(); |
81 | public void touch_start() { ontouch_start(); } | 77 | } |
82 | public void touch() { ontouch(); } | 78 | |
83 | public void touch_end() { ontouch_end(); } | 79 | public void state_entry() |
84 | public void collision_start() { oncollision_start(); } | 80 | { |
85 | public void collision() { oncollision(); } | 81 | onstate_entry(); |
86 | public void collision_end() { oncollision_end(); } | 82 | } |
87 | public void land_collision_start() { onland_collision_start(); } | 83 | |
88 | public void land_collision() { onland_collision(); } | 84 | public void state_exit() |
89 | public void land_collision_end() { onland_collision_end(); } | 85 | { |
90 | public void timer() { ontimer(); } | 86 | onstate_exit(); |
91 | public void listen() { onlisten(); } | 87 | } |
92 | public void on_rez() { onon_rez(); } | 88 | |
93 | public void sensor() { onsensor(); } | 89 | public void touch_start() |
94 | public void no_sensor() { onno_sensor(); } | 90 | { |
95 | public void control() { oncontrol(); } | 91 | ontouch_start(); |
96 | public void money() { onmoney(); } | 92 | } |
97 | public void email() { onemail(); } | 93 | |
98 | public void at_target() { onat_target(); } | 94 | public void touch() |
99 | public void not_at_target() { onnot_at_target(); } | 95 | { |
100 | public void at_rot_target() { onat_rot_target(); } | 96 | ontouch(); |
101 | public void not_at_rot_target() { onnot_at_rot_target(); } | 97 | } |
102 | public void run_time_permissions() { onrun_time_permissions(); } | 98 | |
103 | public void changed() { onchanged(); } | 99 | public void touch_end() |
104 | public void attach() { onattach(); } | 100 | { |
105 | public void dataserver() { ondataserver(); } | 101 | ontouch_end(); |
106 | public void link_message() { onlink_message(); } | 102 | } |
107 | public void moving_start() { onmoving_start(); } | 103 | |
108 | public void moving_end() { onmoving_end(); } | 104 | public void collision_start() |
109 | public void object_rez() { onobject_rez(); } | 105 | { |
110 | public void remote_data() { onremote_data(); } | 106 | oncollision_start(); |
111 | public void http_response() { onhttp_response(); } | 107 | } |
112 | 108 | ||
109 | public void collision() | ||
110 | { | ||
111 | oncollision(); | ||
112 | } | ||
113 | |||
114 | public void collision_end() | ||
115 | { | ||
116 | oncollision_end(); | ||
117 | } | ||
118 | |||
119 | public void land_collision_start() | ||
120 | { | ||
121 | onland_collision_start(); | ||
122 | } | ||
123 | |||
124 | public void land_collision() | ||
125 | { | ||
126 | onland_collision(); | ||
127 | } | ||
128 | |||
129 | public void land_collision_end() | ||
130 | { | ||
131 | onland_collision_end(); | ||
132 | } | ||
133 | |||
134 | public void timer() | ||
135 | { | ||
136 | ontimer(); | ||
137 | } | ||
138 | |||
139 | public void listen() | ||
140 | { | ||
141 | onlisten(); | ||
142 | } | ||
143 | |||
144 | public void on_rez() | ||
145 | { | ||
146 | onon_rez(); | ||
147 | } | ||
148 | |||
149 | public void sensor() | ||
150 | { | ||
151 | onsensor(); | ||
152 | } | ||
153 | |||
154 | public void no_sensor() | ||
155 | { | ||
156 | onno_sensor(); | ||
157 | } | ||
158 | |||
159 | public void control() | ||
160 | { | ||
161 | oncontrol(); | ||
162 | } | ||
163 | |||
164 | public void money() | ||
165 | { | ||
166 | onmoney(); | ||
167 | } | ||
168 | |||
169 | public void email() | ||
170 | { | ||
171 | onemail(); | ||
172 | } | ||
173 | |||
174 | public void at_target() | ||
175 | { | ||
176 | onat_target(); | ||
177 | } | ||
178 | |||
179 | public void not_at_target() | ||
180 | { | ||
181 | onnot_at_target(); | ||
182 | } | ||
183 | |||
184 | public void at_rot_target() | ||
185 | { | ||
186 | onat_rot_target(); | ||
187 | } | ||
188 | |||
189 | public void not_at_rot_target() | ||
190 | { | ||
191 | onnot_at_rot_target(); | ||
192 | } | ||
193 | |||
194 | public void run_time_permissions() | ||
195 | { | ||
196 | onrun_time_permissions(); | ||
197 | } | ||
198 | |||
199 | public void changed() | ||
200 | { | ||
201 | onchanged(); | ||
202 | } | ||
203 | |||
204 | public void attach() | ||
205 | { | ||
206 | onattach(); | ||
207 | } | ||
208 | |||
209 | public void dataserver() | ||
210 | { | ||
211 | ondataserver(); | ||
212 | } | ||
213 | |||
214 | public void link_message() | ||
215 | { | ||
216 | onlink_message(); | ||
217 | } | ||
218 | |||
219 | public void moving_start() | ||
220 | { | ||
221 | onmoving_start(); | ||
222 | } | ||
223 | |||
224 | public void moving_end() | ||
225 | { | ||
226 | onmoving_end(); | ||
227 | } | ||
228 | |||
229 | public void object_rez() | ||
230 | { | ||
231 | onobject_rez(); | ||
232 | } | ||
233 | |||
234 | public void remote_data() | ||
235 | { | ||
236 | onremote_data(); | ||
237 | } | ||
238 | |||
239 | public void http_response() | ||
240 | { | ||
241 | onhttp_response(); | ||
242 | } | ||
113 | } | 243 | } |
114 | } | 244 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs index fa13807..819a037 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs | |||
@@ -26,19 +26,17 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
33 | 30 | ||
34 | namespace OpenSim.Grid.ScriptServer | 31 | namespace OpenSim.Grid.ScriptServer |
35 | { | 32 | { |
36 | // Maintains connection and communication to a region | 33 | // Maintains connection and communication to a region |
37 | public class RegionConnectionManager: RegionBase | 34 | public class RegionConnectionManager : RegionBase |
38 | { | 35 | { |
39 | private LogBase m_log; | 36 | private LogBase m_log; |
40 | private ScriptServerMain m_ScriptServerMain; | 37 | private ScriptServerMain m_ScriptServerMain; |
41 | private object m_Connection; | 38 | private object m_Connection; |
39 | |||
42 | public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) | 40 | public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) |
43 | { | 41 | { |
44 | m_ScriptServerMain = scm; | 42 | m_ScriptServerMain = scm; |
@@ -56,8 +54,6 @@ namespace OpenSim.Grid.ScriptServer | |||
56 | 54 | ||
57 | // EVENT? DELIVER EVENT DIRECTLY TO SCRIPTENGINE | 55 | // EVENT? DELIVER EVENT DIRECTLY TO SCRIPTENGINE |
58 | touch_start(); | 56 | touch_start(); |
59 | |||
60 | } | 57 | } |
61 | |||
62 | } | 58 | } |
63 | } | 59 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index ac56fbe..45bf88d 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | using System.Threading; | 29 | using System.Threading; |
32 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
33 | 31 | ||
@@ -42,11 +40,13 @@ namespace OpenSim.Grid.ScriptServer | |||
42 | 40 | ||
43 | private LogBase m_log; | 41 | private LogBase m_log; |
44 | private ScriptServerMain m_ScriptServerMain; | 42 | private ScriptServerMain m_ScriptServerMain; |
43 | |||
45 | public RegionCommManager(ScriptServerMain scm, LogBase logger) | 44 | public RegionCommManager(ScriptServerMain scm, LogBase logger) |
46 | { | 45 | { |
47 | m_ScriptServerMain = scm; | 46 | m_ScriptServerMain = scm; |
48 | m_log = logger; | 47 | m_log = logger; |
49 | } | 48 | } |
49 | |||
50 | ~RegionCommManager() | 50 | ~RegionCommManager() |
51 | { | 51 | { |
52 | Stop(); | 52 | Stop(); |
@@ -64,6 +64,7 @@ namespace OpenSim.Grid.ScriptServer | |||
64 | listenThread.IsBackground = true; | 64 | listenThread.IsBackground = true; |
65 | listenThread.Start(); | 65 | listenThread.Start(); |
66 | } | 66 | } |
67 | |||
67 | /// <summary> | 68 | /// <summary> |
68 | /// Stops listening for region requests | 69 | /// Stops listening for region requests |
69 | /// </summary> | 70 | /// </summary> |
@@ -78,7 +79,9 @@ namespace OpenSim.Grid.ScriptServer | |||
78 | listenThread.Abort(); | 79 | listenThread.Abort(); |
79 | listenThread.Join(1000); // Wait 1 second for thread to shut down | 80 | listenThread.Join(1000); // Wait 1 second for thread to shut down |
80 | } | 81 | } |
81 | catch { } | 82 | catch |
83 | { | ||
84 | } | ||
82 | listenThread = null; | 85 | listenThread = null; |
83 | } | 86 | } |
84 | } | 87 | } |
@@ -97,6 +100,5 @@ namespace OpenSim.Grid.ScriptServer | |||
97 | // TODO: FAKING A CONNECTION | 100 | // TODO: FAKING A CONNECTION |
98 | Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); | 101 | Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); |
99 | } | 102 | } |
100 | |||
101 | } | 103 | } |
102 | } | 104 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs index a259b1b..3dbd42d 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs | |||
@@ -121,5 +121,4 @@ namespace OpenSim.Grid.ScriptServer | |||
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } \ No newline at end of file |
125 | |||
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs index 4ec2b35..7b49127 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs | |||
@@ -26,9 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
33 | 31 | ||
34 | namespace OpenSim.Grid.ScriptServer | 32 | namespace OpenSim.Grid.ScriptServer |
@@ -46,10 +44,11 @@ namespace OpenSim.Grid.ScriptServer | |||
46 | m_ScriptServerMain = scm; | 44 | m_ScriptServerMain = scm; |
47 | m_log = logger; | 45 | m_log = logger; |
48 | ScriptEngineLoader = new ScriptEngineLoader(m_log); | 46 | ScriptEngineLoader = new ScriptEngineLoader(m_log); |
49 | 47 | ||
50 | // Temp - we should not load during initialize... Loading should be done later. | 48 | // Temp - we should not load during initialize... Loading should be done later. |
51 | LoadEngine("DotNetScriptEngine"); | 49 | LoadEngine("DotNetScriptEngine"); |
52 | } | 50 | } |
51 | |||
53 | ~ScriptEngineManager() | 52 | ~ScriptEngineManager() |
54 | { | 53 | { |
55 | } | 54 | } |
@@ -63,7 +62,5 @@ namespace OpenSim.Grid.ScriptServer | |||
63 | scriptEngines.Add(sei); | 62 | scriptEngines.Add(sei); |
64 | } | 63 | } |
65 | } | 64 | } |
66 | |||
67 | |||
68 | } | 65 | } |
69 | } | 66 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 82035ac..1749376 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs | |||
@@ -26,20 +26,17 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | 29 | using System.IO; |
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | ||
35 | 32 | ||
36 | namespace OpenSim.Grid.ScriptServer | 33 | namespace OpenSim.Grid.ScriptServer |
37 | { | 34 | { |
38 | public class ScriptServerMain : conscmd_callback | 35 | public class ScriptServerMain : conscmd_callback |
39 | { | 36 | { |
40 | private readonly string m_logFilename = ("region-console.log"); | 37 | private readonly string m_logFilename = ("region-console.log"); |
41 | internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region | 38 | internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region |
42 | internal ScriptEngineManager ScriptEngines; // Loads scriptengines | 39 | internal ScriptEngineManager ScriptEngines; // Loads scriptengines |
43 | private LogBase m_log; | 40 | private LogBase m_log; |
44 | 41 | ||
45 | public ScriptServerMain() | 42 | public ScriptServerMain() |
@@ -48,7 +45,6 @@ namespace OpenSim.Grid.ScriptServer | |||
48 | 45 | ||
49 | RegionScriptDaemon = new RegionCommManager(this, m_log); | 46 | RegionScriptDaemon = new RegionCommManager(this, m_log); |
50 | ScriptEngines = new ScriptEngineManager(this, m_log); | 47 | ScriptEngines = new ScriptEngineManager(this, m_log); |
51 | |||
52 | } | 48 | } |
53 | 49 | ||
54 | ~ScriptServerMain() | 50 | ~ScriptServerMain() |
@@ -68,9 +64,9 @@ namespace OpenSim.Grid.ScriptServer | |||
68 | public void RunCmd(string command, string[] cmdparams) | 64 | public void RunCmd(string command, string[] cmdparams) |
69 | { | 65 | { |
70 | } | 66 | } |
67 | |||
71 | public void Show(string ShowWhat) | 68 | public void Show(string ShowWhat) |
72 | { | 69 | { |
73 | } | 70 | } |
74 | |||
75 | } | 71 | } |
76 | } | 72 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 492f67f..779a72b 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -27,28 +27,23 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.IO; | 30 | using System.IO; |
32 | using System.Reflection; | 31 | using OpenSim.Framework; |
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework; | ||
39 | 34 | ||
40 | namespace OpenSim.Grid.UserServer | 35 | namespace OpenSim.Grid.UserServer |
41 | { | 36 | { |
42 | /// <summary> | 37 | /// <summary> |
43 | /// </summary> | 38 | /// </summary> |
44 | public class OpenUser_Main : conscmd_callback | 39 | public class OpenUser_Main : conscmd_callback |
45 | { | 40 | { |
46 | private UserConfig Cfg; | 41 | private UserConfig Cfg; |
47 | 42 | ||
48 | public UserManager m_userManager; | 43 | public UserManager m_userManager; |
49 | public UserLoginService m_loginService; | 44 | public UserLoginService m_loginService; |
50 | 45 | ||
51 | LogBase m_console; | 46 | private LogBase m_console; |
52 | 47 | ||
53 | [STAThread] | 48 | [STAThread] |
54 | public static void Main(string[] args) | 49 | public static void Main(string[] args) |
@@ -67,7 +62,8 @@ namespace OpenSim.Grid.UserServer | |||
67 | { | 62 | { |
68 | Directory.CreateDirectory(Util.logDir()); | 63 | Directory.CreateDirectory(Util.logDir()); |
69 | } | 64 | } |
70 | m_console = new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); | 65 | m_console = |
66 | new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); | ||
71 | MainLog.Instance = m_console; | 67 | MainLog.Instance = m_console; |
72 | } | 68 | } |
73 | 69 | ||
@@ -83,7 +79,7 @@ namespace OpenSim.Grid.UserServer | |||
83 | 79 | ||
84 | public void Startup() | 80 | public void Startup() |
85 | { | 81 | { |
86 | this.Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); | 82 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); |
87 | 83 | ||
88 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | 84 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); |
89 | m_userManager = new UserManager(); | 85 | m_userManager = new UserManager(); |
@@ -93,15 +89,16 @@ namespace OpenSim.Grid.UserServer | |||
93 | m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); | 89 | m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg); |
94 | 90 | ||
95 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); | 91 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); |
96 | BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); | 92 | BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort); |
97 | 93 | ||
98 | httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 94 | httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); |
99 | 95 | ||
100 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 96 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
101 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | 97 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); |
102 | 98 | ||
103 | httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); | 99 | httpServer.AddStreamHandler( |
104 | 100 | new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); | |
101 | |||
105 | httpServer.Start(); | 102 | httpServer.Start(); |
106 | m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); | 103 | m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); |
107 | } | 104 | } |
@@ -126,7 +123,7 @@ namespace OpenSim.Grid.UserServer | |||
126 | 123 | ||
127 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 124 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
128 | 125 | ||
129 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 126 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
130 | break; | 127 | break; |
131 | } | 128 | } |
132 | } | 129 | } |
@@ -178,4 +175,4 @@ namespace OpenSim.Grid.UserServer | |||
178 | { | 175 | { |
179 | } | 176 | } |
180 | } | 177 | } |
181 | } | 178 | } \ No newline at end of file |
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs index 877f02f..079e05e 100644 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OGS-UserServer")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OGS-UserServer")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OGS-UserServer")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OGS-UserServer")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | 24 | |
25 | [assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices; | |||
27 | // Build Number | 31 | // Build Number |
28 | // Revision | 32 | // Revision |
29 | // | 33 | // |
30 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
31 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 1523f81..bbef4b2 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -30,12 +30,10 @@ using System; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Net; | 31 | using System.Net; |
32 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
33 | using OpenSim.Framework.Data; | ||
34 | using OpenSim.Framework.UserManagement; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Data; | ||
36 | using OpenSim.Framework.UserManagement; | ||
39 | 37 | ||
40 | namespace OpenSim.Grid.UserServer | 38 | namespace OpenSim.Grid.UserServer |
41 | { | 39 | { |
@@ -58,18 +56,24 @@ namespace OpenSim.Grid.UserServer | |||
58 | { | 56 | { |
59 | // Load information from the gridserver | 57 | // Load information from the gridserver |
60 | RegionProfileData SimInfo = new RegionProfileData(); | 58 | RegionProfileData SimInfo = new RegionProfileData(); |
61 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 59 | SimInfo = |
60 | SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, | ||
61 | m_config.GridSendKey, m_config.GridRecvKey); | ||
62 | 62 | ||
63 | // Customise the response | 63 | // Customise the response |
64 | // Home Location | 64 | // Home Location |
65 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + | 65 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + |
66 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 66 | (SimInfo.regionLocY*256).ToString() + "], " + |
67 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 67 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + |
68 | theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
69 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + | ||
70 | theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
68 | 71 | ||
69 | // Destination | 72 | // Destination |
70 | MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); | 73 | MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + |
74 | SimInfo.regionLocY); | ||
71 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); | 75 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); |
72 | response.SimPort = (Int32)SimInfo.serverPort; | 76 | response.SimPort = (Int32) SimInfo.serverPort; |
73 | response.RegionX = SimInfo.regionLocX; | 77 | response.RegionX = SimInfo.regionLocX; |
74 | response.RegionY = SimInfo.regionLocY; | 78 | response.RegionY = SimInfo.regionLocY; |
75 | 79 | ||
@@ -87,7 +91,7 @@ namespace OpenSim.Grid.UserServer | |||
87 | SimParams["firstname"] = theUser.username; | 91 | SimParams["firstname"] = theUser.username; |
88 | SimParams["lastname"] = theUser.surname; | 92 | SimParams["lastname"] = theUser.surname; |
89 | SimParams["agent_id"] = theUser.UUID.ToString(); | 93 | SimParams["agent_id"] = theUser.UUID.ToString(); |
90 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | 94 | SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); |
91 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | 95 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); |
92 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | 96 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); |
93 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | 97 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); |
@@ -107,21 +111,20 @@ namespace OpenSim.Grid.UserServer | |||
107 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 111 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
108 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); | 112 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); |
109 | } | 113 | } |
110 | catch( WebException e ) | 114 | catch (WebException e) |
111 | { | 115 | { |
112 | switch( e.Status ) | 116 | switch (e.Status) |
113 | { | 117 | { |
114 | case WebExceptionStatus.Timeout: | 118 | case WebExceptionStatus.Timeout: |
115 | //TODO: Send him to nearby or default region instead | 119 | //TODO: Send him to nearby or default region instead |
116 | MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); | 120 | MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + |
121 | ")"); | ||
117 | break; | 122 | break; |
118 | 123 | ||
119 | default: | 124 | default: |
120 | throw; | 125 | throw; |
121 | } | 126 | } |
122 | } | 127 | } |
123 | } | 128 | } |
124 | } | 129 | } |
125 | } | 130 | } \ No newline at end of file |
126 | |||
127 | |||
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 2b2bf72..96cdfb3 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -27,12 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Net; | 30 | using libsecondlife; |
31 | using Nwc.XmlRpc; | 31 | using Nwc.XmlRpc; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.UserManagement; | 33 | using OpenSim.Framework.UserManagement; |
34 | using OpenSim.Framework; | ||
35 | using libsecondlife; | ||
36 | 34 | ||
37 | namespace OpenSim.Grid.UserServer | 35 | namespace OpenSim.Grid.UserServer |
38 | { | 36 | { |
@@ -118,11 +116,11 @@ namespace OpenSim.Grid.UserServer | |||
118 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 116 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
119 | { | 117 | { |
120 | XmlRpcResponse response = new XmlRpcResponse(); | 118 | XmlRpcResponse response = new XmlRpcResponse(); |
121 | Hashtable requestData = (Hashtable)request.Params[0]; | 119 | Hashtable requestData = (Hashtable) request.Params[0]; |
122 | UserProfileData userProfile; | 120 | UserProfileData userProfile; |
123 | if (requestData.Contains("avatar_name")) | 121 | if (requestData.Contains("avatar_name")) |
124 | { | 122 | { |
125 | userProfile = GetUserProfile((string)requestData["avatar_name"]); | 123 | userProfile = GetUserProfile((string) requestData["avatar_name"]); |
126 | if (userProfile == null) | 124 | if (userProfile == null) |
127 | { | 125 | { |
128 | return CreateUnknownUserErrorResponse(); | 126 | return CreateUnknownUserErrorResponse(); |
@@ -139,12 +137,12 @@ namespace OpenSim.Grid.UserServer | |||
139 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) | 137 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) |
140 | { | 138 | { |
141 | XmlRpcResponse response = new XmlRpcResponse(); | 139 | XmlRpcResponse response = new XmlRpcResponse(); |
142 | Hashtable requestData = (Hashtable)request.Params[0]; | 140 | Hashtable requestData = (Hashtable) request.Params[0]; |
143 | UserProfileData userProfile; | 141 | UserProfileData userProfile; |
144 | System.Console.WriteLine("METHOD BY UUID CALLED"); | 142 | Console.WriteLine("METHOD BY UUID CALLED"); |
145 | if (requestData.Contains("avatar_uuid")) | 143 | if (requestData.Contains("avatar_uuid")) |
146 | { | 144 | { |
147 | userProfile = GetUserProfile((LLUUID)(string)requestData["avatar_uuid"]); | 145 | userProfile = GetUserProfile((LLUUID) (string) requestData["avatar_uuid"]); |
148 | if (userProfile == null) | 146 | if (userProfile == null) |
149 | { | 147 | { |
150 | return CreateUnknownUserErrorResponse(); | 148 | return CreateUnknownUserErrorResponse(); |
@@ -158,6 +156,7 @@ namespace OpenSim.Grid.UserServer | |||
158 | 156 | ||
159 | return ProfileToXmlRPCResponse(userProfile); | 157 | return ProfileToXmlRPCResponse(userProfile); |
160 | } | 158 | } |
159 | |||
161 | #endregion | 160 | #endregion |
162 | 161 | ||
163 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | 162 | public override UserProfileData SetupMasterUser(string firstName, string lastName) |
@@ -170,4 +169,4 @@ namespace OpenSim.Grid.UserServer | |||
170 | throw new Exception("The method or operation is not implemented."); | 169 | throw new Exception("The method or operation is not implemented."); |
171 | } | 170 | } |
172 | } | 171 | } |
173 | } | 172 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 0288f63..bb26ce3 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -26,27 +26,24 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Region.Environment.Scenes; | ||
31 | using Nini.Config; | 29 | using Nini.Config; |
32 | using System.Threading; | ||
33 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | ||
34 | 32 | ||
35 | namespace OpenSim | 33 | namespace OpenSim |
36 | { | 34 | { |
37 | public class Application | 35 | public class Application |
38 | { | 36 | { |
39 | //could move our main function into OpenSimMain and kill this class | 37 | //could move our main function into OpenSimMain and kill this class |
40 | [STAThread] | 38 | [STAThread] |
41 | public static void Main(string[] args) | 39 | public static void Main(string[] args) |
42 | { | 40 | { |
43 | |||
44 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); | 41 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); |
45 | 42 | ||
46 | 43 | ||
47 | Console.Write("Performing compatibility checks... "); | 44 | Console.Write("Performing compatibility checks... "); |
48 | string supported = ""; | 45 | string supported = ""; |
49 | if (OpenSim.Framework.Util.IsEnvironmentSupported(ref supported)) | 46 | if (Util.IsEnvironmentSupported(ref supported)) |
50 | { | 47 | { |
51 | Console.WriteLine(" Environment is compatible.\n"); | 48 | Console.WriteLine(" Environment is compatible.\n"); |
52 | } | 49 | } |
@@ -54,10 +51,10 @@ namespace OpenSim | |||
54 | { | 51 | { |
55 | Console.WriteLine(" Environment is unsupported (" + supported + ")\n"); | 52 | Console.WriteLine(" Environment is unsupported (" + supported + ")\n"); |
56 | } | 53 | } |
57 | 54 | ||
58 | Console.WriteLine("Starting...\n"); | 55 | Console.WriteLine("Starting...\n"); |
59 | 56 | ||
60 | Culture.SetCurrentCulture(); | 57 | Culture.SetCurrentCulture(); |
61 | 58 | ||
62 | ArgvConfigSource configSource = new ArgvConfigSource(args); | 59 | ArgvConfigSource configSource = new ArgvConfigSource(args); |
63 | 60 | ||
@@ -80,4 +77,4 @@ namespace OpenSim | |||
80 | } | 77 | } |
81 | } | 78 | } |
82 | } | 79 | } |
83 | } | 80 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/Region/Application/OpenSimController.cs index da93b54..1fa4b04 100644 --- a/OpenSim/Region/Application/OpenSimController.cs +++ b/OpenSim/Region/Application/OpenSimController.cs | |||
@@ -1,28 +1,15 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Collections; | 2 | using System.Collections; |
4 | using System.IO; | 3 | using System.Net; |
5 | using System.Text; | 4 | using System.Timers; |
6 | using Nini.Config; | 5 | using Nwc.XmlRpc; |
7 | using OpenSim.Framework.Communications.Cache; | 6 | using OpenSim.Framework; |
8 | using OpenSim.Framework.Console; | 7 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Interfaces; | ||
10 | using OpenSim.Framework.Servers; | 8 | using OpenSim.Framework.Servers; |
11 | using OpenSim.Framework; | ||
12 | using OpenSim.Framework; | ||
13 | using OpenSim.Region.ClientStack; | ||
14 | using OpenSim.Region.Communications.Local; | ||
15 | using OpenSim.Region.Communications.OGS1; | ||
16 | using OpenSim.Region.Environment; | ||
17 | using OpenSim.Region.Environment.Scenes; | ||
18 | using OpenSim.Region.Physics.Manager; | ||
19 | using System.Globalization; | ||
20 | using Nwc.XmlRpc; | ||
21 | using RegionInfo = OpenSim.Framework.RegionInfo; | ||
22 | 9 | ||
23 | namespace OpenSim | 10 | namespace OpenSim |
24 | { | 11 | { |
25 | class OpenSimController | 12 | internal class OpenSimController |
26 | { | 13 | { |
27 | private OpenSimMain m_app; | 14 | private OpenSimMain m_app; |
28 | private BaseHttpServer m_httpServer; | 15 | private BaseHttpServer m_httpServer; |
@@ -44,22 +31,23 @@ namespace OpenSim | |||
44 | { | 31 | { |
45 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); | 32 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); |
46 | XmlRpcResponse response = new XmlRpcResponse(); | 33 | XmlRpcResponse response = new XmlRpcResponse(); |
47 | Hashtable requestData = (Hashtable)request.Params[0]; | 34 | Hashtable requestData = (Hashtable) request.Params[0]; |
48 | 35 | ||
49 | if ((string)requestData["shutdown"] == "delayed") | 36 | if ((string) requestData["shutdown"] == "delayed") |
50 | { | 37 | { |
51 | int timeout = Convert.ToInt32((string)requestData["milliseconds"]); | 38 | int timeout = Convert.ToInt32((string) requestData["milliseconds"]); |
52 | 39 | ||
53 | Hashtable responseData = new Hashtable(); | 40 | Hashtable responseData = new Hashtable(); |
54 | responseData["accepted"] = "true"; | 41 | responseData["accepted"] = "true"; |
55 | response.Value = responseData; | 42 | response.Value = responseData; |
56 | 43 | ||
57 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out."); | 44 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + |
45 | " second(s). Please save what you are doing and log out."); | ||
58 | 46 | ||
59 | // Perform shutdown | 47 | // Perform shutdown |
60 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing | 48 | Timer shutdownTimer = new Timer(timeout); // Wait before firing |
61 | shutdownTimer.AutoReset = false; | 49 | shutdownTimer.AutoReset = false; |
62 | shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); | 50 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
63 | 51 | ||
64 | return response; | 52 | return response; |
65 | } | 53 | } |
@@ -72,15 +60,15 @@ namespace OpenSim | |||
72 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); | 60 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); |
73 | 61 | ||
74 | // Perform shutdown | 62 | // Perform shutdown |
75 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing | 63 | Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing |
76 | shutdownTimer.AutoReset = false; | 64 | shutdownTimer.AutoReset = false; |
77 | shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); | 65 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
78 | 66 | ||
79 | return response; | 67 | return response; |
80 | } | 68 | } |
81 | } | 69 | } |
82 | 70 | ||
83 | void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) | 71 | private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) |
84 | { | 72 | { |
85 | m_app.Shutdown(); | 73 | m_app.Shutdown(); |
86 | } | 74 | } |
@@ -89,28 +77,28 @@ namespace OpenSim | |||
89 | { | 77 | { |
90 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); | 78 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); |
91 | XmlRpcResponse response = new XmlRpcResponse(); | 79 | XmlRpcResponse response = new XmlRpcResponse(); |
92 | Hashtable requestData = (Hashtable)request.Params[0]; | 80 | Hashtable requestData = (Hashtable) request.Params[0]; |
93 | 81 | ||
94 | RegionInfo newRegionData = new RegionInfo(); | 82 | RegionInfo newRegionData = new RegionInfo(); |
95 | 83 | ||
96 | try | 84 | try |
97 | { | 85 | { |
98 | newRegionData.RegionID = (string)requestData["region_id"]; | 86 | newRegionData.RegionID = (string) requestData["region_id"]; |
99 | newRegionData.RegionName = (string)requestData["region_name"]; | 87 | newRegionData.RegionName = (string) requestData["region_name"]; |
100 | newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]); | 88 | newRegionData.RegionLocX = Convert.ToUInt32((string) requestData["region_x"]); |
101 | newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]); | 89 | newRegionData.RegionLocY = Convert.ToUInt32((string) requestData["region_y"]); |
102 | 90 | ||
103 | // Security risk | 91 | // Security risk |
104 | newRegionData.DataStore = (string)requestData["datastore"]; | 92 | newRegionData.DataStore = (string) requestData["datastore"]; |
105 | 93 | ||
106 | newRegionData.InternalEndPoint = new System.Net.IPEndPoint( | 94 | newRegionData.InternalEndPoint = new IPEndPoint( |
107 | System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0); | 95 | IPAddress.Parse((string) requestData["listen_ip"]), 0); |
108 | 96 | ||
109 | newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]); | 97 | newRegionData.InternalEndPoint.Port = Convert.ToInt32((string) requestData["listen_port"]); |
110 | newRegionData.ExternalHostName = (string)requestData["external_address"]; | 98 | newRegionData.ExternalHostName = (string) requestData["external_address"]; |
111 | 99 | ||
112 | newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; | 100 | newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; |
113 | newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; | 101 | newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; |
114 | 102 | ||
115 | m_app.CreateRegion(newRegionData); | 103 | m_app.CreateRegion(newRegionData); |
116 | 104 | ||
@@ -129,4 +117,4 @@ namespace OpenSim | |||
129 | return response; | 117 | return response; |
130 | } | 118 | } |
131 | } | 119 | } |
132 | } | 120 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index b938227..7245482 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -31,21 +31,17 @@ using System.Collections.Generic; | |||
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Text; | 32 | using System.Text; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Region.ClientStack; | 38 | using OpenSim.Region.ClientStack; |
41 | using OpenSim.Region.Communications.Local; | 39 | using OpenSim.Region.Communications.Local; |
42 | using OpenSim.Region.Communications.OGS1; | 40 | using OpenSim.Region.Communications.OGS1; |
43 | using OpenSim.Region.Environment; | 41 | using OpenSim.Region.Environment; |
42 | using OpenSim.Region.Environment.Interfaces; | ||
44 | using OpenSim.Region.Environment.Scenes; | 43 | using OpenSim.Region.Environment.Scenes; |
45 | using OpenSim.Region.Physics.Manager; | 44 | using OpenSim.Region.Physics.Manager; |
46 | using OpenSim.Framework; | ||
47 | using System.Globalization; | ||
48 | using RegionInfo = OpenSim.Framework.RegionInfo; | ||
49 | 45 | ||
50 | namespace OpenSim | 46 | namespace OpenSim |
51 | { | 47 | { |
@@ -114,7 +110,6 @@ namespace OpenSim | |||
114 | } | 110 | } |
115 | else | 111 | else |
116 | { | 112 | { |
117 | |||
118 | // no default config files, so set default values, and save it | 113 | // no default config files, so set default values, and save it |
119 | SetDefaultConfig(); | 114 | SetDefaultConfig(); |
120 | 115 | ||
@@ -125,7 +120,6 @@ namespace OpenSim | |||
125 | } | 120 | } |
126 | 121 | ||
127 | ReadConfigSettings(); | 122 | ReadConfigSettings(); |
128 | |||
129 | } | 123 | } |
130 | 124 | ||
131 | protected void SetDefaultConfig() | 125 | protected void SetDefaultConfig() |
@@ -148,7 +142,6 @@ namespace OpenSim | |||
148 | config.Set("script_engine", "DotNetEngine"); | 142 | config.Set("script_engine", "DotNetEngine"); |
149 | 143 | ||
150 | config.Set("asset_database", "sqlite"); | 144 | config.Set("asset_database", "sqlite"); |
151 | |||
152 | } | 145 | } |
153 | 146 | ||
154 | if (m_config.Configs["StandAlone"] == null) | 147 | if (m_config.Configs["StandAlone"] == null) |
@@ -217,7 +210,8 @@ namespace OpenSim | |||
217 | standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); | 210 | standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); |
218 | m_standaloneUserPlugin = | 211 | m_standaloneUserPlugin = |
219 | standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll"); | 212 | standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll"); |
220 | m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll"); | 213 | m_standaloneAssetPlugin = |
214 | standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll"); | ||
221 | 215 | ||
222 | m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); | 216 | m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); |
223 | } | 217 | } |
@@ -230,7 +224,6 @@ namespace OpenSim | |||
230 | /// </summary> | 224 | /// </summary> |
231 | public override void StartUp() | 225 | public override void StartUp() |
232 | { | 226 | { |
233 | |||
234 | if (!Directory.Exists(Util.logDir())) | 227 | if (!Directory.Exists(Util.logDir())) |
235 | { | 228 | { |
236 | Directory.CreateDirectory(Util.logDir()); | 229 | Directory.CreateDirectory(Util.logDir()); |
@@ -248,22 +241,28 @@ namespace OpenSim | |||
248 | LocalInventoryService inventoryService = new LocalInventoryService(); | 241 | LocalInventoryService inventoryService = new LocalInventoryService(); |
249 | inventoryService.AddPlugin(m_standaloneInventoryPlugin); | 242 | inventoryService.AddPlugin(m_standaloneInventoryPlugin); |
250 | 243 | ||
251 | LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); | 244 | LocalUserServices userService = |
245 | new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, | ||
246 | m_networkServersInfo.DefaultHomeLocY, inventoryService); | ||
252 | userService.AddPlugin(m_standaloneUserPlugin); | 247 | userService.AddPlugin(m_standaloneUserPlugin); |
253 | 248 | ||
254 | LocalBackEndServices backendService = new LocalBackEndServices(); | 249 | LocalBackEndServices backendService = new LocalBackEndServices(); |
255 | 250 | ||
256 | CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, m_dumpAssetsToFile); | 251 | CommunicationsLocal localComms = |
252 | new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, | ||
253 | inventoryService, backendService, backendService, m_dumpAssetsToFile); | ||
257 | m_commsManager = localComms; | 254 | m_commsManager = localComms; |
258 | 255 | ||
259 | m_loginService = new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, m_standaloneAuthenticate); | 256 | m_loginService = |
257 | new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, | ||
258 | m_standaloneAuthenticate); | ||
260 | m_loginService.OnLoginToRegion += backendService.AddNewSession; | 259 | m_loginService.OnLoginToRegion += backendService.AddNewSession; |
261 | 260 | ||
262 | m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 261 | m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); |
263 | 262 | ||
264 | if (m_standaloneAuthenticate) | 263 | if (m_standaloneAuthenticate) |
265 | { | 264 | { |
266 | this.CreateAccount = localComms.doCreate; | 265 | CreateAccount = localComms.doCreate; |
267 | } | 266 | } |
268 | } | 267 | } |
269 | else | 268 | else |
@@ -308,7 +307,7 @@ namespace OpenSim | |||
308 | // Start UDP servers | 307 | // Start UDP servers |
309 | for (int i = 0; i < m_udpServers.Count; i++) | 308 | for (int i = 0; i < m_udpServers.Count; i++) |
310 | { | 309 | { |
311 | this.m_udpServers[i].ServerListener(); | 310 | m_udpServers[i].ServerListener(); |
312 | } | 311 | } |
313 | 312 | ||
314 | //Run Startup Commands | 313 | //Run Startup Commands |
@@ -321,7 +320,8 @@ namespace OpenSim | |||
321 | MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on..."); | 320 | MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on..."); |
322 | } | 321 | } |
323 | 322 | ||
324 | MainLog.Instance.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); | 323 | MainLog.Instance.Status("STARTUP", |
324 | "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); | ||
325 | } | 325 | } |
326 | 326 | ||
327 | public UDPServer CreateRegion(RegionInfo regionInfo) | 327 | public UDPServer CreateRegion(RegionInfo regionInfo) |
@@ -365,9 +365,12 @@ namespace OpenSim | |||
365 | return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName); | 365 | return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName); |
366 | } | 366 | } |
367 | 367 | ||
368 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) | 368 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
369 | AgentCircuitManager circuitManager) | ||
369 | { | 370 | { |
370 | return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, m_moduleLoader, m_dumpAssetsToFile); | 371 | return |
372 | new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, | ||
373 | m_moduleLoader, m_dumpAssetsToFile); | ||
371 | } | 374 | } |
372 | 375 | ||
373 | protected override void Initialize() | 376 | protected override void Initialize() |
@@ -436,7 +439,6 @@ namespace OpenSim | |||
436 | 439 | ||
437 | protected void ConnectToRemoteGridServer() | 440 | protected void ConnectToRemoteGridServer() |
438 | { | 441 | { |
439 | |||
440 | } | 442 | } |
441 | 443 | ||
442 | #endregion | 444 | #endregion |
@@ -464,6 +466,7 @@ namespace OpenSim | |||
464 | } | 466 | } |
465 | 467 | ||
466 | #region Console Commands | 468 | #region Console Commands |
469 | |||
467 | /// <summary> | 470 | /// <summary> |
468 | /// | 471 | /// |
469 | /// </summary> | 472 | /// </summary> |
@@ -649,11 +652,10 @@ namespace OpenSim | |||
649 | case "change-region": | 652 | case "change-region": |
650 | if (cmdparams.Length > 0) | 653 | if (cmdparams.Length > 0) |
651 | { | 654 | { |
652 | string regionName = this.CombineParams(cmdparams, 0); | 655 | string regionName = CombineParams(cmdparams, 0); |
653 | 656 | ||
654 | if (m_sceneManager.TrySetCurrentScene(regionName)) | 657 | if (m_sceneManager.TrySetCurrentScene(regionName)) |
655 | { | 658 | { |
656 | |||
657 | } | 659 | } |
658 | else | 660 | else |
659 | { | 661 | { |
@@ -663,11 +665,13 @@ namespace OpenSim | |||
663 | 665 | ||
664 | if (m_sceneManager.CurrentScene == null) | 666 | if (m_sceneManager.CurrentScene == null) |
665 | { | 667 | { |
666 | MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); | 668 | MainLog.Instance.Verbose( |
669 | "Currently at Root level. To change region please use 'change-region <regioname>'"); | ||
667 | } | 670 | } |
668 | else | 671 | else |
669 | { | 672 | { |
670 | MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); | 673 | MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + |
674 | ". To change region please use 'change-region <regioname>'"); | ||
671 | } | 675 | } |
672 | 676 | ||
673 | break; | 677 | break; |
@@ -676,7 +680,6 @@ namespace OpenSim | |||
676 | m_log.Error("Unknown command"); | 680 | m_log.Error("Unknown command"); |
677 | break; | 681 | break; |
678 | } | 682 | } |
679 | |||
680 | } | 683 | } |
681 | 684 | ||
682 | public void Debug(string[] args) | 685 | public void Debug(string[] args) |
@@ -695,8 +698,7 @@ namespace OpenSim | |||
695 | { | 698 | { |
696 | m_log.Error("packet debug should be 0..2"); | 699 | m_log.Error("packet debug should be 0..2"); |
697 | } | 700 | } |
698 | System.Console.WriteLine("New packet debug: " + newDebug.ToString()); | 701 | Console.WriteLine("New packet debug: " + newDebug.ToString()); |
699 | |||
700 | } | 702 | } |
701 | 703 | ||
702 | break; | 704 | break; |
@@ -704,7 +706,6 @@ namespace OpenSim | |||
704 | m_log.Error("Unknown debug"); | 706 | m_log.Error("Unknown debug"); |
705 | break; | 707 | break; |
706 | } | 708 | } |
707 | |||
708 | } | 709 | } |
709 | 710 | ||
710 | /// <summary> | 711 | /// <summary> |
@@ -720,7 +721,9 @@ namespace OpenSim | |||
720 | m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); | 721 | m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); |
721 | break; | 722 | break; |
722 | case "users": | 723 | case "users": |
723 | m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); | 724 | m_log.Error( |
725 | String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", | ||
726 | "Agent ID", "Session ID", "Circuit", "IP", "World")); | ||
724 | 727 | ||
725 | foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars()) | 728 | foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars()) |
726 | { | 729 | { |
@@ -750,7 +753,7 @@ namespace OpenSim | |||
750 | break; | 753 | break; |
751 | case "modules": | 754 | case "modules": |
752 | m_log.Error("The currently loaded shared modules are:"); | 755 | m_log.Error("The currently loaded shared modules are:"); |
753 | foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.GetLoadedSharedModules ) | 756 | foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) |
754 | { | 757 | { |
755 | m_log.Error("Shared Module: " + module.Name); | 758 | m_log.Error("Shared Module: " + module.Name); |
756 | } | 759 | } |
@@ -768,8 +771,7 @@ namespace OpenSim | |||
768 | result = result.TrimEnd(' '); | 771 | result = result.TrimEnd(' '); |
769 | return result; | 772 | return result; |
770 | } | 773 | } |
774 | |||
771 | #endregion | 775 | #endregion |
772 | } | 776 | } |
773 | 777 | } \ No newline at end of file | |
774 | |||
775 | } | ||
diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs index f045164..7840206 100644 --- a/OpenSim/Region/Application/VersionInfo.cs +++ b/OpenSim/Region/Application/VersionInfo.cs | |||
@@ -33,4 +33,4 @@ namespace OpenSim | |||
33 | { | 33 | { |
34 | public static string Version = "0.4, SVN build "; | 34 | public static string Version = "0.4, SVN build "; |
35 | } | 35 | } |
36 | } | 36 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs index 3960c19..4b44ead 100644 --- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs +++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs | |||
@@ -29,12 +29,10 @@ using System.Net.Sockets; | |||
29 | 29 | ||
30 | namespace OpenSim.Region.ClientStack | 30 | namespace OpenSim.Region.ClientStack |
31 | { | 31 | { |
32 | |||
33 | public interface ClientStackNetworkHandler | 32 | public interface ClientStackNetworkHandler |
34 | { | 33 | { |
35 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); | 34 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender); |
36 | void RemoveClientCircuit(uint circuitcode); | 35 | void RemoveClientCircuit(uint circuitcode); |
37 | void RegisterPacketServer(PacketServer server); | 36 | void RegisterPacketServer(PacketServer server); |
38 | } | 37 | } |
39 | 38 | } \ No newline at end of file | |
40 | } | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 24962f8..7dcf1e8 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -32,10 +32,8 @@ using System.Text; | |||
32 | using Axiom.Math; | 32 | using Axiom.Math; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | ||
39 | 37 | ||
40 | namespace OpenSim.Region.ClientStack | 38 | namespace OpenSim.Region.ClientStack |
41 | { | 39 | { |
@@ -116,26 +114,18 @@ namespace OpenSim.Region.ClientStack | |||
116 | /// </summary> | 114 | /// </summary> |
117 | public LLVector3 StartPos | 115 | public LLVector3 StartPos |
118 | { | 116 | { |
119 | get | 117 | get { return startpos; } |
120 | { | 118 | set { startpos = value; } |
121 | return startpos; | ||
122 | } | ||
123 | set | ||
124 | { | ||
125 | startpos = value; | ||
126 | } | ||
127 | } | 119 | } |
128 | 120 | ||
129 | /// <summary> | 121 | /// <summary> |
130 | /// | 122 | /// |
131 | /// </summary> | 123 | /// </summary> |
132 | private LLUUID m_agentId; | 124 | private LLUUID m_agentId; |
125 | |||
133 | public LLUUID AgentId | 126 | public LLUUID AgentId |
134 | { | 127 | { |
135 | get | 128 | get { return m_agentId; } |
136 | { | ||
137 | return m_agentId; | ||
138 | } | ||
139 | } | 129 | } |
140 | 130 | ||
141 | /// <summary> | 131 | /// <summary> |
@@ -143,11 +133,7 @@ namespace OpenSim.Region.ClientStack | |||
143 | /// </summary> | 133 | /// </summary> |
144 | public string FirstName | 134 | public string FirstName |
145 | { | 135 | { |
146 | get | 136 | get { return firstName; } |
147 | { | ||
148 | return this.firstName; | ||
149 | } | ||
150 | |||
151 | } | 137 | } |
152 | 138 | ||
153 | /// <summary> | 139 | /// <summary> |
@@ -155,10 +141,7 @@ namespace OpenSim.Region.ClientStack | |||
155 | /// </summary> | 141 | /// </summary> |
156 | public string LastName | 142 | public string LastName |
157 | { | 143 | { |
158 | get | 144 | get { return lastName; } |
159 | { | ||
160 | return this.lastName; | ||
161 | } | ||
162 | } | 145 | } |
163 | 146 | ||
164 | #region Scene/Avatar to Client | 147 | #region Scene/Avatar to Client |
@@ -182,11 +165,11 @@ namespace OpenSim.Region.ClientStack | |||
182 | handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1; | 165 | handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1; |
183 | handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2; | 166 | handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2; |
184 | handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3; | 167 | handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3; |
185 | handshake.RegionInfo.SimAccess = (byte)regionInfo.EstateSettings.simAccess; | 168 | handshake.RegionInfo.SimAccess = (byte) regionInfo.EstateSettings.simAccess; |
186 | handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; | 169 | handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; |
187 | 170 | ||
188 | 171 | ||
189 | handshake.RegionInfo.RegionFlags = (uint)regionInfo.EstateSettings.regionFlags; | 172 | handshake.RegionInfo.RegionFlags = (uint) regionInfo.EstateSettings.regionFlags; |
190 | 173 | ||
191 | handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); | 174 | handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); |
192 | handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; | 175 | handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; |
@@ -200,7 +183,7 @@ namespace OpenSim.Region.ClientStack | |||
200 | handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3; | 183 | handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3; |
201 | handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? | 184 | handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? |
202 | 185 | ||
203 | this.OutPacket(handshake); | 186 | OutPacket(handshake); |
204 | } | 187 | } |
205 | 188 | ||
206 | /// <summary> | 189 | /// <summary> |
@@ -210,14 +193,14 @@ namespace OpenSim.Region.ClientStack | |||
210 | public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) | 193 | public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) |
211 | { | 194 | { |
212 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | 195 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); |
213 | mov.AgentData.SessionID = this.m_sessionId; | 196 | mov.AgentData.SessionID = m_sessionId; |
214 | mov.AgentData.AgentID = this.AgentId; | 197 | mov.AgentData.AgentID = AgentId; |
215 | mov.Data.RegionHandle = regInfo.RegionHandle; | 198 | mov.Data.RegionHandle = regInfo.RegionHandle; |
216 | mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this | 199 | mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this |
217 | 200 | ||
218 | if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) | 201 | if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) |
219 | { | 202 | { |
220 | mov.Data.Position = this.startpos; | 203 | mov.Data.Position = startpos; |
221 | } | 204 | } |
222 | else | 205 | else |
223 | { | 206 | { |
@@ -255,7 +238,7 @@ namespace OpenSim.Region.ClientStack | |||
255 | reply.ChatData.OwnerID = fromAgentID; | 238 | reply.ChatData.OwnerID = fromAgentID; |
256 | reply.ChatData.SourceID = fromAgentID; | 239 | reply.ChatData.SourceID = fromAgentID; |
257 | 240 | ||
258 | this.OutPacket(reply); | 241 | OutPacket(reply); |
259 | } | 242 | } |
260 | 243 | ||
261 | /// <summary> | 244 | /// <summary> |
@@ -264,27 +247,27 @@ namespace OpenSim.Region.ClientStack | |||
264 | /// <remarks>TODO</remarks> | 247 | /// <remarks>TODO</remarks> |
265 | /// <param name="message"></param> | 248 | /// <param name="message"></param> |
266 | /// <param name="target"></param> | 249 | /// <param name="target"></param> |
267 | public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) | 250 | public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, |
251 | LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) | ||
268 | { | 252 | { |
269 | 253 | Encoding enc = Encoding.ASCII; | |
270 | Encoding enc = Encoding.ASCII; | 254 | ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); |
271 | ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); | 255 | msg.AgentData.AgentID = fromAgent; |
272 | msg.AgentData.AgentID = fromAgent; | 256 | msg.AgentData.SessionID = fromAgentSession; |
273 | msg.AgentData.SessionID = fromAgentSession; | 257 | msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); |
274 | msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); | 258 | msg.MessageBlock.Dialog = dialog; |
275 | msg.MessageBlock.Dialog = dialog; | 259 | msg.MessageBlock.FromGroup = false; |
276 | msg.MessageBlock.FromGroup = false; | 260 | msg.MessageBlock.ID = imSessionID; |
277 | msg.MessageBlock.ID = imSessionID; | 261 | msg.MessageBlock.Offline = 0; |
278 | msg.MessageBlock.Offline = 0; | 262 | msg.MessageBlock.ParentEstateID = 0; |
279 | msg.MessageBlock.ParentEstateID = 0; | 263 | msg.MessageBlock.Position = new LLVector3(); |
280 | msg.MessageBlock.Position = new LLVector3(); | 264 | msg.MessageBlock.RegionID = LLUUID.Random(); |
281 | msg.MessageBlock.RegionID = LLUUID.Random(); | 265 | msg.MessageBlock.Timestamp = timeStamp; |
282 | msg.MessageBlock.Timestamp = timeStamp; | 266 | msg.MessageBlock.ToAgentID = toAgent; |
283 | msg.MessageBlock.ToAgentID = toAgent; | 267 | msg.MessageBlock.Message = enc.GetBytes(message + "\0"); |
284 | msg.MessageBlock.Message = enc.GetBytes(message + "\0"); | 268 | msg.MessageBlock.BinaryBucket = new byte[0]; |
285 | msg.MessageBlock.BinaryBucket = new byte[0]; | 269 | |
286 | 270 | OutPacket(msg); | |
287 | this.OutPacket(msg); | ||
288 | } | 271 | } |
289 | 272 | ||
290 | /// <summary> | 273 | /// <summary> |
@@ -301,10 +284,10 @@ namespace OpenSim.Region.ClientStack | |||
301 | { | 284 | { |
302 | for (int x = 0; x < 16; x = x + 4) | 285 | for (int x = 0; x < 16; x = x + 4) |
303 | { | 286 | { |
304 | patches[0] = x + 0 + y * 16; | 287 | patches[0] = x + 0 + y*16; |
305 | patches[1] = x + 1 + y * 16; | 288 | patches[1] = x + 1 + y*16; |
306 | patches[2] = x + 2 + y * 16; | 289 | patches[2] = x + 2 + y*16; |
307 | patches[3] = x + 3 + y * 16; | 290 | patches[3] = x + 3 + y*16; |
308 | 291 | ||
309 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); | 292 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); |
310 | OutPacket(layerpack); | 293 | OutPacket(layerpack); |
@@ -313,7 +296,8 @@ namespace OpenSim.Region.ClientStack | |||
313 | } | 296 | } |
314 | catch (Exception e) | 297 | catch (Exception e) |
315 | { | 298 | { |
316 | MainLog.Instance.Warn("client", "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); | 299 | MainLog.Instance.Warn("client", |
300 | "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
317 | } | 301 | } |
318 | } | 302 | } |
319 | 303 | ||
@@ -332,14 +316,15 @@ namespace OpenSim.Region.ClientStack | |||
332 | patchx = px; | 316 | patchx = px; |
333 | patchy = py; | 317 | patchy = py; |
334 | 318 | ||
335 | patches[0] = patchx + 0 + patchy * 16; | 319 | patches[0] = patchx + 0 + patchy*16; |
336 | 320 | ||
337 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); | 321 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); |
338 | OutPacket(layerpack); | 322 | OutPacket(layerpack); |
339 | } | 323 | } |
340 | catch (Exception e) | 324 | catch (Exception e) |
341 | { | 325 | { |
342 | MainLog.Instance.Warn("client", "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); | 326 | MainLog.Instance.Warn("client", |
327 | "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
343 | } | 328 | } |
344 | } | 329 | } |
345 | 330 | ||
@@ -352,17 +337,17 @@ namespace OpenSim.Region.ClientStack | |||
352 | public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) | 337 | public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) |
353 | { | 338 | { |
354 | IPAddress neighbourIP = neighbourEndPoint.Address; | 339 | IPAddress neighbourIP = neighbourEndPoint.Address; |
355 | ushort neighbourPort = (ushort)neighbourEndPoint.Port; | 340 | ushort neighbourPort = (ushort) neighbourEndPoint.Port; |
356 | 341 | ||
357 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | 342 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); |
358 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | 343 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); |
359 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | 344 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; |
360 | 345 | ||
361 | byte[] byteIP = neighbourIP.GetAddressBytes(); | 346 | byte[] byteIP = neighbourIP.GetAddressBytes(); |
362 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | 347 | enablesimpacket.SimulatorInfo.IP = (uint) byteIP[3] << 24; |
363 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | 348 | enablesimpacket.SimulatorInfo.IP += (uint) byteIP[2] << 16; |
364 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | 349 | enablesimpacket.SimulatorInfo.IP += (uint) byteIP[1] << 8; |
365 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | 350 | enablesimpacket.SimulatorInfo.IP += (uint) byteIP[0]; |
366 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | 351 | enablesimpacket.SimulatorInfo.Port = neighbourPort; |
367 | OutPacket(enablesimpacket); | 352 | OutPacket(enablesimpacket); |
368 | } | 353 | } |
@@ -374,46 +359,48 @@ namespace OpenSim.Region.ClientStack | |||
374 | public AgentCircuitData RequestClientInfo() | 359 | public AgentCircuitData RequestClientInfo() |
375 | { | 360 | { |
376 | AgentCircuitData agentData = new AgentCircuitData(); | 361 | AgentCircuitData agentData = new AgentCircuitData(); |
377 | agentData.AgentID = this.AgentId; | 362 | agentData.AgentID = AgentId; |
378 | agentData.SessionID = this.m_sessionId; | 363 | agentData.SessionID = m_sessionId; |
379 | agentData.SecureSessionID = this.SecureSessionID; | 364 | agentData.SecureSessionID = SecureSessionID; |
380 | agentData.circuitcode = this.m_circuitCode; | 365 | agentData.circuitcode = m_circuitCode; |
381 | agentData.child = false; | 366 | agentData.child = false; |
382 | agentData.firstname = this.firstName; | 367 | agentData.firstname = firstName; |
383 | agentData.lastname = this.lastName; | 368 | agentData.lastname = lastName; |
384 | agentData.CapsPath = ""; | 369 | agentData.CapsPath = ""; |
385 | return agentData; | 370 | return agentData; |
386 | } | 371 | } |
387 | 372 | ||
388 | public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint, string capsURL) | 373 | public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint, |
374 | string capsURL) | ||
389 | { | 375 | { |
390 | LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); | 376 | LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); |
391 | 377 | ||
392 | CrossedRegionPacket newSimPack = new CrossedRegionPacket(); | 378 | CrossedRegionPacket newSimPack = new CrossedRegionPacket(); |
393 | newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | 379 | newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); |
394 | newSimPack.AgentData.AgentID = this.AgentId; | 380 | newSimPack.AgentData.AgentID = AgentId; |
395 | newSimPack.AgentData.SessionID = this.m_sessionId; | 381 | newSimPack.AgentData.SessionID = m_sessionId; |
396 | newSimPack.Info = new CrossedRegionPacket.InfoBlock(); | 382 | newSimPack.Info = new CrossedRegionPacket.InfoBlock(); |
397 | newSimPack.Info.Position = pos; | 383 | newSimPack.Info.Position = pos; |
398 | newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | 384 | newSimPack.Info.LookAt = look; |
385 | // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | ||
399 | newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); | 386 | newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); |
400 | newSimPack.RegionData.RegionHandle = newRegionHandle; | 387 | newSimPack.RegionData.RegionHandle = newRegionHandle; |
401 | byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); | 388 | byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); |
402 | newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | 389 | newSimPack.RegionData.SimIP = (uint) byteIP[3] << 24; |
403 | newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | 390 | newSimPack.RegionData.SimIP += (uint) byteIP[2] << 16; |
404 | newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | 391 | newSimPack.RegionData.SimIP += (uint) byteIP[1] << 8; |
405 | newSimPack.RegionData.SimIP += (uint)byteIP[0]; | 392 | newSimPack.RegionData.SimIP += (uint) byteIP[0]; |
406 | newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; | 393 | newSimPack.RegionData.SimPort = (ushort) externalIPEndPoint.Port; |
407 | //newSimPack.RegionData.SeedCapability = new byte[0]; | 394 | //newSimPack.RegionData.SeedCapability = new byte[0]; |
408 | newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); | 395 | newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); |
409 | 396 | ||
410 | this.OutPacket(newSimPack); | 397 | OutPacket(newSimPack); |
411 | } | 398 | } |
412 | 399 | ||
413 | public void SendMapBlock(List<MapBlockData> mapBlocks) | 400 | public void SendMapBlock(List<MapBlockData> mapBlocks) |
414 | { | 401 | { |
415 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); | 402 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); |
416 | mapReply.AgentData.AgentID = this.AgentId; | 403 | mapReply.AgentData.AgentID = AgentId; |
417 | mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; | 404 | mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; |
418 | mapReply.AgentData.Flags = 0; | 405 | mapReply.AgentData.Flags = 0; |
419 | 406 | ||
@@ -429,13 +416,13 @@ namespace OpenSim.Region.ClientStack | |||
429 | mapReply.Data[i].Access = mapBlocks[i].Access; | 416 | mapReply.Data[i].Access = mapBlocks[i].Access; |
430 | mapReply.Data[i].Agents = mapBlocks[i].Agents; | 417 | mapReply.Data[i].Agents = mapBlocks[i].Agents; |
431 | } | 418 | } |
432 | this.OutPacket(mapReply); | 419 | OutPacket(mapReply); |
433 | } | 420 | } |
434 | 421 | ||
435 | public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) | 422 | public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) |
436 | { | 423 | { |
437 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 424 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); |
438 | tpLocal.Info.AgentID = this.AgentId; | 425 | tpLocal.Info.AgentID = AgentId; |
439 | tpLocal.Info.TeleportFlags = flags; | 426 | tpLocal.Info.TeleportFlags = flags; |
440 | tpLocal.Info.LocationID = 2; | 427 | tpLocal.Info.LocationID = 2; |
441 | tpLocal.Info.LookAt = lookAt; | 428 | tpLocal.Info.LookAt = lookAt; |
@@ -443,10 +430,11 @@ namespace OpenSim.Region.ClientStack | |||
443 | OutPacket(tpLocal); | 430 | OutPacket(tpLocal); |
444 | } | 431 | } |
445 | 432 | ||
446 | public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags, string capsURL) | 433 | public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, |
434 | uint flags, string capsURL) | ||
447 | { | 435 | { |
448 | TeleportFinishPacket teleport = new TeleportFinishPacket(); | 436 | TeleportFinishPacket teleport = new TeleportFinishPacket(); |
449 | teleport.Info.AgentID = this.AgentId; | 437 | teleport.Info.AgentID = AgentId; |
450 | teleport.Info.RegionHandle = regionHandle; | 438 | teleport.Info.RegionHandle = regionHandle; |
451 | teleport.Info.SimAccess = simAccess; | 439 | teleport.Info.SimAccess = simAccess; |
452 | 440 | ||
@@ -455,13 +443,13 @@ namespace OpenSim.Region.ClientStack | |||
455 | 443 | ||
456 | IPAddress oIP = newRegionEndPoint.Address; | 444 | IPAddress oIP = newRegionEndPoint.Address; |
457 | byte[] byteIP = oIP.GetAddressBytes(); | 445 | byte[] byteIP = oIP.GetAddressBytes(); |
458 | uint ip = (uint)byteIP[3] << 24; | 446 | uint ip = (uint) byteIP[3] << 24; |
459 | ip += (uint)byteIP[2] << 16; | 447 | ip += (uint) byteIP[2] << 16; |
460 | ip += (uint)byteIP[1] << 8; | 448 | ip += (uint) byteIP[1] << 8; |
461 | ip += (uint)byteIP[0]; | 449 | ip += (uint) byteIP[0]; |
462 | 450 | ||
463 | teleport.Info.SimIP = ip; | 451 | teleport.Info.SimIP = ip; |
464 | teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; | 452 | teleport.Info.SimPort = (ushort) newRegionEndPoint.Port; |
465 | teleport.Info.LocationID = 4; | 453 | teleport.Info.LocationID = 4; |
466 | teleport.Info.TeleportFlags = 1 << 4; | 454 | teleport.Info.TeleportFlags = 1 << 4; |
467 | OutPacket(teleport); | 455 | OutPacket(teleport); |
@@ -473,8 +461,8 @@ namespace OpenSim.Region.ClientStack | |||
473 | public void SendTeleportCancel() | 461 | public void SendTeleportCancel() |
474 | { | 462 | { |
475 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 463 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); |
476 | tpCancel.Info.SessionID = this.m_sessionId; | 464 | tpCancel.Info.SessionID = m_sessionId; |
477 | tpCancel.Info.AgentID = this.AgentId; | 465 | tpCancel.Info.AgentID = AgentId; |
478 | 466 | ||
479 | OutPacket(tpCancel); | 467 | OutPacket(tpCancel); |
480 | } | 468 | } |
@@ -492,7 +480,7 @@ namespace OpenSim.Region.ClientStack | |||
492 | public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) | 480 | public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) |
493 | { | 481 | { |
494 | MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); | 482 | MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); |
495 | money.MoneyData.AgentID = this.AgentId; | 483 | money.MoneyData.AgentID = AgentId; |
496 | money.MoneyData.TransactionID = transaction; | 484 | money.MoneyData.TransactionID = transaction; |
497 | money.MoneyData.TransactionSuccess = success; | 485 | money.MoneyData.TransactionSuccess = success; |
498 | money.MoneyData.Description = description; | 486 | money.MoneyData.Description = description; |
@@ -506,7 +494,6 @@ namespace OpenSim.Region.ClientStack | |||
506 | pc.PingID.PingID = seq; | 494 | pc.PingID.PingID = seq; |
507 | pc.Header.Reliable = false; | 495 | pc.Header.Reliable = false; |
508 | OutPacket(pc); | 496 | OutPacket(pc); |
509 | |||
510 | } | 497 | } |
511 | 498 | ||
512 | public void SendKillObject(ulong regionHandle, uint localID) | 499 | public void SendKillObject(ulong regionHandle, uint localID) |
@@ -522,8 +509,8 @@ namespace OpenSim.Region.ClientStack | |||
522 | { | 509 | { |
523 | Encoding enc = Encoding.ASCII; | 510 | Encoding enc = Encoding.ASCII; |
524 | uint FULL_MASK_PERMISSIONS = 2147483647; | 511 | uint FULL_MASK_PERMISSIONS = 2147483647; |
525 | InventoryDescendentsPacket descend = this.CreateInventoryDescendentsPacket(ownerID, folderID); | 512 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
526 | 513 | ||
527 | int count = 0; | 514 | int count = 0; |
528 | if (items.Count < 40) | 515 | if (items.Count < 40) |
529 | { | 516 | { |
@@ -550,25 +537,30 @@ namespace OpenSim.Region.ClientStack | |||
550 | descend.ItemData[i].FolderID = item.parentFolderID; | 537 | descend.ItemData[i].FolderID = item.parentFolderID; |
551 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 538 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
552 | descend.ItemData[i].GroupMask = 0; | 539 | descend.ItemData[i].GroupMask = 0; |
553 | descend.ItemData[i].InvType = (sbyte)item.invType; | 540 | descend.ItemData[i].InvType = (sbyte) item.invType; |
554 | descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); | 541 | descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); |
555 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; | 542 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; |
556 | descend.ItemData[i].OwnerID = item.avatarID; | 543 | descend.ItemData[i].OwnerID = item.avatarID; |
557 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; | 544 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; |
558 | descend.ItemData[i].SalePrice = 0; | 545 | descend.ItemData[i].SalePrice = 0; |
559 | descend.ItemData[i].SaleType = 0; | 546 | descend.ItemData[i].SaleType = 0; |
560 | descend.ItemData[i].Type = (sbyte)item.assetType; | 547 | descend.ItemData[i].Type = (sbyte) item.assetType; |
561 | descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100, descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 548 | descend.ItemData[i].CRC = |
549 | Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, | ||
550 | descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100, | ||
551 | descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, | ||
552 | descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, | ||
553 | 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | ||
562 | 554 | ||
563 | i++; | 555 | i++; |
564 | count++; | 556 | count++; |
565 | if (i == 40) | 557 | if (i == 40) |
566 | { | 558 | { |
567 | this.OutPacket(descend); | 559 | OutPacket(descend); |
568 | 560 | ||
569 | if ((items.Count - count) > 0) | 561 | if ((items.Count - count) > 0) |
570 | { | 562 | { |
571 | descend = this.CreateInventoryDescendentsPacket(ownerID, folderID); | 563 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
572 | if ((items.Count - count) < 40) | 564 | if ((items.Count - count) < 40) |
573 | { | 565 | { |
574 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; | 566 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; |
@@ -586,15 +578,14 @@ namespace OpenSim.Region.ClientStack | |||
586 | 578 | ||
587 | if (i < 40) | 579 | if (i < 40) |
588 | { | 580 | { |
589 | this.OutPacket(descend); | 581 | OutPacket(descend); |
590 | } | 582 | } |
591 | |||
592 | } | 583 | } |
593 | 584 | ||
594 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) | 585 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) |
595 | { | 586 | { |
596 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); | 587 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); |
597 | descend.AgentData.AgentID = this.AgentId; | 588 | descend.AgentData.AgentID = AgentId; |
598 | descend.AgentData.OwnerID = ownerID; | 589 | descend.AgentData.OwnerID = ownerID; |
599 | descend.AgentData.FolderID = folderID; | 590 | descend.AgentData.FolderID = folderID; |
600 | descend.AgentData.Version = 0; | 591 | descend.AgentData.Version = 0; |
@@ -607,31 +598,39 @@ namespace OpenSim.Region.ClientStack | |||
607 | Encoding enc = Encoding.ASCII; | 598 | Encoding enc = Encoding.ASCII; |
608 | uint FULL_MASK_PERMISSIONS = 2147483647; | 599 | uint FULL_MASK_PERMISSIONS = 2147483647; |
609 | FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); | 600 | FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); |
610 | inventoryReply.AgentData.AgentID = this.AgentId; | 601 | inventoryReply.AgentData.AgentID = AgentId; |
611 | inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; | 602 | inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; |
612 | inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); | 603 | inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); |
613 | inventoryReply.InventoryData[0].ItemID = item.inventoryID; | 604 | inventoryReply.InventoryData[0].ItemID = item.inventoryID; |
614 | inventoryReply.InventoryData[0].AssetID = item.assetID; | 605 | inventoryReply.InventoryData[0].AssetID = item.assetID; |
615 | inventoryReply.InventoryData[0].CreatorID = item.creatorsID; | 606 | inventoryReply.InventoryData[0].CreatorID = item.creatorsID; |
616 | inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; | 607 | inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; |
617 | inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 608 | inventoryReply.InventoryData[0].CreationDate = |
609 | (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
618 | inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); | 610 | inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); |
619 | inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; | 611 | inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; |
620 | inventoryReply.InventoryData[0].Flags = 0; | 612 | inventoryReply.InventoryData[0].Flags = 0; |
621 | inventoryReply.InventoryData[0].FolderID = item.parentFolderID; | 613 | inventoryReply.InventoryData[0].FolderID = item.parentFolderID; |
622 | inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 614 | inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
623 | inventoryReply.InventoryData[0].GroupMask = 0; | 615 | inventoryReply.InventoryData[0].GroupMask = 0; |
624 | inventoryReply.InventoryData[0].InvType = (sbyte)item.invType; | 616 | inventoryReply.InventoryData[0].InvType = (sbyte) item.invType; |
625 | inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); | 617 | inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); |
626 | inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; | 618 | inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; |
627 | inventoryReply.InventoryData[0].OwnerID = item.avatarID; | 619 | inventoryReply.InventoryData[0].OwnerID = item.avatarID; |
628 | inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; | 620 | inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; |
629 | inventoryReply.InventoryData[0].SalePrice = 0; | 621 | inventoryReply.InventoryData[0].SalePrice = 0; |
630 | inventoryReply.InventoryData[0].SaleType = 0; | 622 | inventoryReply.InventoryData[0].SaleType = 0; |
631 | inventoryReply.InventoryData[0].Type = (sbyte)item.assetType; | 623 | inventoryReply.InventoryData[0].Type = (sbyte) item.assetType; |
632 | inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].GroupID, 100, inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 624 | inventoryReply.InventoryData[0].CRC = |
633 | 625 | Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, | |
634 | this.OutPacket(inventoryReply); | 626 | inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, |
627 | inventoryReply.InventoryData[0].GroupID, 100, | ||
628 | inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, | ||
629 | inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, | ||
630 | FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, | ||
631 | FULL_MASK_PERMISSIONS); | ||
632 | |||
633 | OutPacket(inventoryReply); | ||
635 | } | 634 | } |
636 | 635 | ||
637 | public void SendInventoryItemUpdate(InventoryItemBase Item) | 636 | public void SendInventoryItemUpdate(InventoryItemBase Item) |
@@ -639,7 +638,7 @@ namespace OpenSim.Region.ClientStack | |||
639 | Encoding enc = Encoding.ASCII; | 638 | Encoding enc = Encoding.ASCII; |
640 | uint FULL_MASK_PERMISSIONS = 2147483647; | 639 | uint FULL_MASK_PERMISSIONS = 2147483647; |
641 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); | 640 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); |
642 | InventoryReply.AgentData.AgentID = this.AgentId; | 641 | InventoryReply.AgentData.AgentID = AgentId; |
643 | InventoryReply.AgentData.SimApproved = true; | 642 | InventoryReply.AgentData.SimApproved = true; |
644 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 643 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
645 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 644 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
@@ -654,15 +653,22 @@ namespace OpenSim.Region.ClientStack | |||
654 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; | 653 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; |
655 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 654 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
656 | InventoryReply.InventoryData[0].GroupMask = 0; | 655 | InventoryReply.InventoryData[0].GroupMask = 0; |
657 | InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType; | 656 | InventoryReply.InventoryData[0].InvType = (sbyte) Item.invType; |
658 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); | 657 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); |
659 | InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; | 658 | InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; |
660 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; | 659 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; |
661 | InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; | 660 | InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; |
662 | InventoryReply.InventoryData[0].SalePrice = 100; | 661 | InventoryReply.InventoryData[0].SalePrice = 100; |
663 | InventoryReply.InventoryData[0].SaleType = 0; | 662 | InventoryReply.InventoryData[0].SaleType = 0; |
664 | InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType; | 663 | InventoryReply.InventoryData[0].Type = (sbyte) Item.assetType; |
665 | InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 664 | InventoryReply.InventoryData[0].CRC = |
665 | Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, | ||
666 | InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, | ||
667 | InventoryReply.InventoryData[0].GroupID, 100, | ||
668 | InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, | ||
669 | InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, | ||
670 | FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, | ||
671 | FULL_MASK_PERMISSIONS); | ||
666 | 672 | ||
667 | OutPacket(InventoryReply); | 673 | OutPacket(InventoryReply); |
668 | } | 674 | } |
@@ -670,8 +676,8 @@ namespace OpenSim.Region.ClientStack | |||
670 | public void SendRemoveInventoryItem(LLUUID itemID) | 676 | public void SendRemoveInventoryItem(LLUUID itemID) |
671 | { | 677 | { |
672 | RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); | 678 | RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); |
673 | remove.AgentData.AgentID = this.AgentId; | 679 | remove.AgentData.AgentID = AgentId; |
674 | remove.AgentData.SessionID = this.m_sessionId; | 680 | remove.AgentData.SessionID = m_sessionId; |
675 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; | 681 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; |
676 | remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); | 682 | remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); |
677 | remove.InventoryData[0].ItemID = itemID; | 683 | remove.InventoryData[0].ItemID = itemID; |
@@ -716,13 +722,14 @@ namespace OpenSim.Region.ClientStack | |||
716 | public void SendAgentAlertMessage(string message, bool modal) | 722 | public void SendAgentAlertMessage(string message, bool modal) |
717 | { | 723 | { |
718 | AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); | 724 | AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); |
719 | alertPack.AgentData.AgentID = this.AgentId; | 725 | alertPack.AgentData.AgentID = AgentId; |
720 | alertPack.AlertData.Message = Helpers.StringToField(message); | 726 | alertPack.AlertData.Message = Helpers.StringToField(message); |
721 | alertPack.AlertData.Modal = modal; | 727 | alertPack.AlertData.Modal = modal; |
722 | OutPacket(alertPack); | 728 | OutPacket(alertPack); |
723 | } | 729 | } |
724 | 730 | ||
725 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) | 731 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, |
732 | string url) | ||
726 | { | 733 | { |
727 | LoadURLPacket loadURL = new LoadURLPacket(); | 734 | LoadURLPacket loadURL = new LoadURLPacket(); |
728 | loadURL.Data.ObjectName = Helpers.StringToField(objectname); | 735 | loadURL.Data.ObjectName = Helpers.StringToField(objectname); |
@@ -761,14 +768,13 @@ namespace OpenSim.Region.ClientStack | |||
761 | 768 | ||
762 | public void SendViewerTime(int phase) | 769 | public void SendViewerTime(int phase) |
763 | { | 770 | { |
764 | |||
765 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); | 771 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); |
766 | //viewertime.TimeInfo.SecPerDay = 86400; | 772 | //viewertime.TimeInfo.SecPerDay = 86400; |
767 | // viewertime.TimeInfo.SecPerYear = 31536000; | 773 | // viewertime.TimeInfo.SecPerYear = 31536000; |
768 | viewertime.TimeInfo.SecPerDay = 1000; | 774 | viewertime.TimeInfo.SecPerDay = 1000; |
769 | viewertime.TimeInfo.SecPerYear = 365000; | 775 | viewertime.TimeInfo.SecPerYear = 365000; |
770 | viewertime.TimeInfo.SunPhase = 1; | 776 | viewertime.TimeInfo.SunPhase = 1; |
771 | int sunPhase = (phase + 2) / 2; | 777 | int sunPhase = (phase + 2)/2; |
772 | if ((sunPhase < 6) || (sunPhase > 36)) | 778 | if ((sunPhase < 6) || (sunPhase > 36)) |
773 | { | 779 | { |
774 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); | 780 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); |
@@ -781,27 +787,41 @@ namespace OpenSim.Region.ClientStack | |||
781 | sunPhase = 12; | 787 | sunPhase = 12; |
782 | } | 788 | } |
783 | sunPhase = sunPhase - 12; | 789 | sunPhase = sunPhase - 12; |
784 | float yValue = 0.1f * (sunPhase); | 790 | float yValue = 0.1f*(sunPhase); |
785 | if (yValue > 1.2f) { yValue = yValue - 1.2f; } | 791 | if (yValue > 1.2f) |
786 | if (yValue > 1 ) { yValue = 1; } | 792 | { |
787 | if (yValue < 0) { yValue = 0; } | 793 | yValue = yValue - 1.2f; |
794 | } | ||
795 | if (yValue > 1) | ||
796 | { | ||
797 | yValue = 1; | ||
798 | } | ||
799 | if (yValue < 0) | ||
800 | { | ||
801 | yValue = 0; | ||
802 | } | ||
788 | if (sunPhase < 14) | 803 | if (sunPhase < 14) |
789 | { | 804 | { |
790 | yValue = 1 - yValue; | 805 | yValue = 1 - yValue; |
791 | } | 806 | } |
792 | if (sunPhase < 12) { yValue *= -1; } | 807 | if (sunPhase < 12) |
808 | { | ||
809 | yValue *= -1; | ||
810 | } | ||
793 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); | 811 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); |
794 | //Console.WriteLine("sending sun update " + yValue); | 812 | //Console.WriteLine("sending sun update " + yValue); |
795 | } | 813 | } |
796 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); | 814 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); |
797 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); | 815 | viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); |
798 | OutPacket(viewertime); | 816 | OutPacket(viewertime); |
799 | } | 817 | } |
800 | 818 | ||
801 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) | 819 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, |
820 | string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, | ||
821 | LLUUID partnerID) | ||
802 | { | 822 | { |
803 | AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); | 823 | AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); |
804 | avatarReply.AgentData.AgentID = this.AgentId; | 824 | avatarReply.AgentData.AgentID = AgentId; |
805 | avatarReply.AgentData.AvatarID = avatarID; | 825 | avatarReply.AgentData.AvatarID = avatarID; |
806 | avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); | 826 | avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); |
807 | avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn); | 827 | avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn); |
@@ -827,6 +847,7 @@ namespace OpenSim.Region.ClientStack | |||
827 | 847 | ||
828 | OutPacket(avatarSitResponse); | 848 | OutPacket(avatarSitResponse); |
829 | } | 849 | } |
850 | |||
830 | #endregion | 851 | #endregion |
831 | 852 | ||
832 | #region Appearance/ Wearables Methods | 853 | #region Appearance/ Wearables Methods |
@@ -838,22 +859,22 @@ namespace OpenSim.Region.ClientStack | |||
838 | public void SendWearables(AvatarWearable[] wearables) | 859 | public void SendWearables(AvatarWearable[] wearables) |
839 | { | 860 | { |
840 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | 861 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); |
841 | aw.AgentData.AgentID = this.AgentId; | 862 | aw.AgentData.AgentID = AgentId; |
842 | aw.AgentData.SerialNum = 0; | 863 | aw.AgentData.SerialNum = 0; |
843 | aw.AgentData.SessionID = this.m_sessionId; | 864 | aw.AgentData.SessionID = m_sessionId; |
844 | 865 | ||
845 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | 866 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; |
846 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 867 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
847 | for (int i = 0; i < wearables.Length; i++) | 868 | for (int i = 0; i < wearables.Length; i++) |
848 | { | 869 | { |
849 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 870 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
850 | awb.WearableType = (byte)i; | 871 | awb.WearableType = (byte) i; |
851 | awb.AssetID = wearables[i].AssetID; | 872 | awb.AssetID = wearables[i].AssetID; |
852 | awb.ItemID = wearables[i].ItemID; | 873 | awb.ItemID = wearables[i].ItemID; |
853 | aw.WearableData[i] = awb; | 874 | aw.WearableData[i] = awb; |
854 | } | 875 | } |
855 | 876 | ||
856 | this.OutPacket(aw); | 877 | OutPacket(aw); |
857 | } | 878 | } |
858 | 879 | ||
859 | /// <summary> | 880 | /// <summary> |
@@ -893,7 +914,7 @@ namespace OpenSim.Region.ClientStack | |||
893 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); | 914 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); |
894 | ani.AnimationList[0].AnimID = animID; | 915 | ani.AnimationList[0].AnimID = animID; |
895 | ani.AnimationList[0].AnimSequenceID = seq; | 916 | ani.AnimationList[0].AnimSequenceID = seq; |
896 | this.OutPacket(ani); | 917 | OutPacket(ani); |
897 | } | 918 | } |
898 | 919 | ||
899 | #endregion | 920 | #endregion |
@@ -909,25 +930,26 @@ namespace OpenSim.Region.ClientStack | |||
909 | /// <param name="avatarID"></param> | 930 | /// <param name="avatarID"></param> |
910 | /// <param name="avatarLocalID"></param> | 931 | /// <param name="avatarLocalID"></param> |
911 | /// <param name="Pos"></param> | 932 | /// <param name="Pos"></param> |
912 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 933 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
934 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | ||
913 | { | 935 | { |
914 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 936 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
915 | objupdate.RegionData.RegionHandle = regionHandle; | 937 | objupdate.RegionData.RegionHandle = regionHandle; |
916 | objupdate.RegionData.TimeDilation = 64096; | 938 | objupdate.RegionData.TimeDilation = 64096; |
917 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 939 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
918 | objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry); | 940 | objupdate.ObjectData[0] = CreateDefaultAvatarPacket(textureEntry); |
919 | 941 | ||
920 | //give this avatar object a local id and assign the user a name | 942 | //give this avatar object a local id and assign the user a name |
921 | objupdate.ObjectData[0].ID = avatarLocalID; | 943 | objupdate.ObjectData[0].ID = avatarLocalID; |
922 | objupdate.ObjectData[0].FullID = avatarID; | 944 | objupdate.ObjectData[0].FullID = avatarID; |
923 | objupdate.ObjectData[0].ParentID = parentID; | 945 | objupdate.ObjectData[0].ParentID = parentID; |
924 | objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); | 946 | objupdate.ObjectData[0].NameValue = |
925 | LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | 947 | Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); |
948 | LLVector3 pos2 = new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | ||
926 | byte[] pb = pos2.GetBytes(); | 949 | byte[] pb = pos2.GetBytes(); |
927 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 950 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
928 | 951 | ||
929 | OutPacket(objupdate); | 952 | OutPacket(objupdate); |
930 | |||
931 | } | 953 | } |
932 | 954 | ||
933 | /// <summary> | 955 | /// <summary> |
@@ -938,38 +960,41 @@ namespace OpenSim.Region.ClientStack | |||
938 | /// <param name="localID"></param> | 960 | /// <param name="localID"></param> |
939 | /// <param name="position"></param> | 961 | /// <param name="position"></param> |
940 | /// <param name="velocity"></param> | 962 | /// <param name="velocity"></param> |
941 | public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) | 963 | public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
964 | LLVector3 velocity, LLQuaternion rotation) | ||
942 | { | 965 | { |
943 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity, rotation); | 966 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = |
967 | CreateAvatarImprovedBlock(localID, position, velocity, rotation); | ||
944 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 968 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
945 | terse.RegionData.RegionHandle = regionHandle; | 969 | terse.RegionData.RegionHandle = regionHandle; |
946 | terse.RegionData.TimeDilation = timeDilation; | 970 | terse.RegionData.TimeDilation = timeDilation; |
947 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 971 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
948 | terse.ObjectData[0] = terseBlock; | 972 | terse.ObjectData[0] = terseBlock; |
949 | 973 | ||
950 | this.OutPacket(terse); | 974 | OutPacket(terse); |
951 | } | 975 | } |
952 | 976 | ||
953 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) | 977 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) |
954 | { | 978 | { |
955 | CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); | 979 | CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); |
956 | int total = CoarseLocations.Count; | 980 | int total = CoarseLocations.Count; |
957 | CoarseLocationUpdatePacket.IndexBlock ib = | 981 | CoarseLocationUpdatePacket.IndexBlock ib = |
958 | new CoarseLocationUpdatePacket.IndexBlock(); | 982 | new CoarseLocationUpdatePacket.IndexBlock(); |
959 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; | 983 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; |
960 | for(int i=0; i<total; i++) { | 984 | for (int i = 0; i < total; i++) |
961 | CoarseLocationUpdatePacket.LocationBlock lb = | 985 | { |
962 | new CoarseLocationUpdatePacket.LocationBlock(); | 986 | CoarseLocationUpdatePacket.LocationBlock lb = |
963 | lb.X = (byte)CoarseLocations[i].X; | 987 | new CoarseLocationUpdatePacket.LocationBlock(); |
964 | lb.Y = (byte)CoarseLocations[i].Y; | 988 | lb.X = (byte) CoarseLocations[i].X; |
965 | lb.Z = (byte)(CoarseLocations[i].Z/4); | 989 | lb.Y = (byte) CoarseLocations[i].Y; |
966 | loc.Location[i] = lb; | 990 | lb.Z = (byte) (CoarseLocations[i].Z/4); |
967 | } | 991 | loc.Location[i] = lb; |
968 | ib.You = -1; | 992 | } |
969 | ib.Prey = -1; | 993 | ib.You = -1; |
970 | loc.Index = ib; | 994 | ib.Prey = -1; |
971 | this.OutPacket(loc); | 995 | loc.Index = ib; |
972 | } | 996 | OutPacket(loc); |
997 | } | ||
973 | 998 | ||
974 | #endregion | 999 | #endregion |
975 | 1000 | ||
@@ -984,27 +1009,28 @@ namespace OpenSim.Region.ClientStack | |||
984 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) | 1009 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) |
985 | { | 1010 | { |
986 | ObjectAttachPacket attach = new ObjectAttachPacket(); | 1011 | ObjectAttachPacket attach = new ObjectAttachPacket(); |
987 | attach.AgentData.AgentID = this.AgentId; | 1012 | attach.AgentData.AgentID = AgentId; |
988 | attach.AgentData.SessionID = this.m_sessionId; | 1013 | attach.AgentData.SessionID = m_sessionId; |
989 | attach.AgentData.AttachmentPoint = attachPoint; | 1014 | attach.AgentData.AttachmentPoint = attachPoint; |
990 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; | 1015 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; |
991 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); | 1016 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); |
992 | attach.ObjectData[0].ObjectLocalID = localID; | 1017 | attach.ObjectData[0].ObjectLocalID = localID; |
993 | attach.ObjectData[0].Rotation = rotation; | 1018 | attach.ObjectData[0].Rotation = rotation; |
994 | 1019 | ||
995 | this.OutPacket(attach); | 1020 | OutPacket(attach); |
996 | } | 1021 | } |
997 | 1022 | ||
998 | public void SendPrimitiveToClient( | 1023 | public void SendPrimitiveToClient( |
999 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, | 1024 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, |
1025 | uint flags, | ||
1000 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) | 1026 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) |
1001 | { | 1027 | { |
1002 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | 1028 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); |
1003 | outPacket.RegionData.RegionHandle = regionHandle; | 1029 | outPacket.RegionData.RegionHandle = regionHandle; |
1004 | outPacket.RegionData.TimeDilation = timeDilation; | 1030 | outPacket.RegionData.TimeDilation = timeDilation; |
1005 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 1031 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
1006 | 1032 | ||
1007 | outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); | 1033 | outPacket.ObjectData[0] = CreatePrimUpdateBlock(primShape, flags); |
1008 | 1034 | ||
1009 | outPacket.ObjectData[0].ID = localID; | 1035 | outPacket.ObjectData[0].ID = localID; |
1010 | outPacket.ObjectData[0].FullID = objectID; | 1036 | outPacket.ObjectData[0].FullID = objectID; |
@@ -1033,35 +1059,38 @@ namespace OpenSim.Region.ClientStack | |||
1033 | /// <param name="localID"></param> | 1059 | /// <param name="localID"></param> |
1034 | /// <param name="position"></param> | 1060 | /// <param name="position"></param> |
1035 | /// <param name="rotation"></param> | 1061 | /// <param name="rotation"></param> |
1036 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) | 1062 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
1063 | LLQuaternion rotation) | ||
1037 | { | 1064 | { |
1038 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1065 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
1039 | terse.RegionData.RegionHandle = regionHandle; | 1066 | terse.RegionData.RegionHandle = regionHandle; |
1040 | terse.RegionData.TimeDilation = timeDilation; | 1067 | terse.RegionData.TimeDilation = timeDilation; |
1041 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1068 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1042 | terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); | 1069 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation); |
1043 | 1070 | ||
1044 | this.OutPacket(terse); | 1071 | OutPacket(terse); |
1045 | } | 1072 | } |
1046 | 1073 | ||
1047 | #endregion | 1074 | #endregion |
1048 | 1075 | ||
1049 | #region Helper Methods | 1076 | #region Helper Methods |
1050 | 1077 | ||
1051 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity, LLQuaternion rotation) | 1078 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, |
1079 | LLVector3 velocity, | ||
1080 | LLQuaternion rotation) | ||
1052 | { | 1081 | { |
1053 | byte[] bytes = new byte[60]; | 1082 | byte[] bytes = new byte[60]; |
1054 | int i = 0; | 1083 | int i = 0; |
1055 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 1084 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
1056 | 1085 | ||
1057 | dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; | 1086 | dat.TextureEntry = new byte[0]; // AvatarTemplate.TextureEntry; |
1058 | 1087 | ||
1059 | uint ID = localID; | 1088 | uint ID = localID; |
1060 | 1089 | ||
1061 | bytes[i++] = (byte)(ID % 256); | 1090 | bytes[i++] = (byte) (ID%256); |
1062 | bytes[i++] = (byte)((ID >> 8) % 256); | 1091 | bytes[i++] = (byte) ((ID >> 8)%256); |
1063 | bytes[i++] = (byte)((ID >> 16) % 256); | 1092 | bytes[i++] = (byte) ((ID >> 16)%256); |
1064 | bytes[i++] = (byte)((ID >> 24) % 256); | 1093 | bytes[i++] = (byte) ((ID >> 24)%256); |
1065 | bytes[i++] = 0; | 1094 | bytes[i++] = 0; |
1066 | bytes[i++] = 1; | 1095 | bytes[i++] = 1; |
1067 | i += 14; | 1096 | i += 14; |
@@ -1078,55 +1107,55 @@ namespace OpenSim.Region.ClientStack | |||
1078 | 1107 | ||
1079 | internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); | 1108 | internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); |
1080 | 1109 | ||
1081 | internDirec = internDirec / 128.0f; | 1110 | internDirec = internDirec/128.0f; |
1082 | internDirec.x += 1; | 1111 | internDirec.x += 1; |
1083 | internDirec.y += 1; | 1112 | internDirec.y += 1; |
1084 | internDirec.z += 1; | 1113 | internDirec.z += 1; |
1085 | 1114 | ||
1086 | InternVelocityX = (ushort)(32768 * internDirec.x); | 1115 | InternVelocityX = (ushort) (32768*internDirec.x); |
1087 | InternVelocityY = (ushort)(32768 * internDirec.y); | 1116 | InternVelocityY = (ushort) (32768*internDirec.y); |
1088 | InternVelocityZ = (ushort)(32768 * internDirec.z); | 1117 | InternVelocityZ = (ushort) (32768*internDirec.z); |
1089 | 1118 | ||
1090 | ushort ac = 32767; | 1119 | ushort ac = 32767; |
1091 | bytes[i++] = (byte)(InternVelocityX % 256); | 1120 | bytes[i++] = (byte) (InternVelocityX%256); |
1092 | bytes[i++] = (byte)((InternVelocityX >> 8) % 256); | 1121 | bytes[i++] = (byte) ((InternVelocityX >> 8)%256); |
1093 | bytes[i++] = (byte)(InternVelocityY % 256); | 1122 | bytes[i++] = (byte) (InternVelocityY%256); |
1094 | bytes[i++] = (byte)((InternVelocityY >> 8) % 256); | 1123 | bytes[i++] = (byte) ((InternVelocityY >> 8)%256); |
1095 | bytes[i++] = (byte)(InternVelocityZ % 256); | 1124 | bytes[i++] = (byte) (InternVelocityZ%256); |
1096 | bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); | 1125 | bytes[i++] = (byte) ((InternVelocityZ >> 8)%256); |
1097 | 1126 | ||
1098 | //accel | 1127 | //accel |
1099 | bytes[i++] = (byte)(ac % 256); | 1128 | bytes[i++] = (byte) (ac%256); |
1100 | bytes[i++] = (byte)((ac >> 8) % 256); | 1129 | bytes[i++] = (byte) ((ac >> 8)%256); |
1101 | bytes[i++] = (byte)(ac % 256); | 1130 | bytes[i++] = (byte) (ac%256); |
1102 | bytes[i++] = (byte)((ac >> 8) % 256); | 1131 | bytes[i++] = (byte) ((ac >> 8)%256); |
1103 | bytes[i++] = (byte)(ac % 256); | 1132 | bytes[i++] = (byte) (ac%256); |
1104 | bytes[i++] = (byte)((ac >> 8) % 256); | 1133 | bytes[i++] = (byte) ((ac >> 8)%256); |
1105 | 1134 | ||
1106 | //rotation | 1135 | //rotation |
1107 | ushort rw, rx, ry, rz; | 1136 | ushort rw, rx, ry, rz; |
1108 | rw = (ushort)(32768 * (rotation.W + 1)); | 1137 | rw = (ushort) (32768*(rotation.W + 1)); |
1109 | rx = (ushort)(32768 * (rotation.X + 1)); | 1138 | rx = (ushort) (32768*(rotation.X + 1)); |
1110 | ry = (ushort)(32768 * (rotation.Y + 1)); | 1139 | ry = (ushort) (32768*(rotation.Y + 1)); |
1111 | rz = (ushort)(32768 * (rotation.Z + 1)); | 1140 | rz = (ushort) (32768*(rotation.Z + 1)); |
1112 | 1141 | ||
1113 | //rot | 1142 | //rot |
1114 | bytes[i++] = (byte)(rx % 256); | 1143 | bytes[i++] = (byte) (rx%256); |
1115 | bytes[i++] = (byte)((rx >> 8) % 256); | 1144 | bytes[i++] = (byte) ((rx >> 8)%256); |
1116 | bytes[i++] = (byte)(ry % 256); | 1145 | bytes[i++] = (byte) (ry%256); |
1117 | bytes[i++] = (byte)((ry >> 8) % 256); | 1146 | bytes[i++] = (byte) ((ry >> 8)%256); |
1118 | bytes[i++] = (byte)(rz % 256); | 1147 | bytes[i++] = (byte) (rz%256); |
1119 | bytes[i++] = (byte)((rz >> 8) % 256); | 1148 | bytes[i++] = (byte) ((rz >> 8)%256); |
1120 | bytes[i++] = (byte)(rw % 256); | 1149 | bytes[i++] = (byte) (rw%256); |
1121 | bytes[i++] = (byte)((rw >> 8) % 256); | 1150 | bytes[i++] = (byte) ((rw >> 8)%256); |
1122 | 1151 | ||
1123 | //rotation vel | 1152 | //rotation vel |
1124 | bytes[i++] = (byte)(ac % 256); | 1153 | bytes[i++] = (byte) (ac%256); |
1125 | bytes[i++] = (byte)((ac >> 8) % 256); | 1154 | bytes[i++] = (byte) ((ac >> 8)%256); |
1126 | bytes[i++] = (byte)(ac % 256); | 1155 | bytes[i++] = (byte) (ac%256); |
1127 | bytes[i++] = (byte)((ac >> 8) % 256); | 1156 | bytes[i++] = (byte) ((ac >> 8)%256); |
1128 | bytes[i++] = (byte)(ac % 256); | 1157 | bytes[i++] = (byte) (ac%256); |
1129 | bytes[i++] = (byte)((ac >> 8) % 256); | 1158 | bytes[i++] = (byte) ((ac >> 8)%256); |
1130 | 1159 | ||
1131 | dat.Data = bytes; | 1160 | dat.Data = bytes; |
1132 | 1161 | ||
@@ -1140,7 +1169,9 @@ namespace OpenSim.Region.ClientStack | |||
1140 | /// <param name="position"></param> | 1169 | /// <param name="position"></param> |
1141 | /// <param name="rotation"></param> | 1170 | /// <param name="rotation"></param> |
1142 | /// <returns></returns> | 1171 | /// <returns></returns> |
1143 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) | 1172 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, |
1173 | LLVector3 position, | ||
1174 | LLQuaternion rotation) | ||
1144 | { | 1175 | { |
1145 | uint ID = localID; | 1176 | uint ID = localID; |
1146 | byte[] bytes = new byte[60]; | 1177 | byte[] bytes = new byte[60]; |
@@ -1148,10 +1179,10 @@ namespace OpenSim.Region.ClientStack | |||
1148 | int i = 0; | 1179 | int i = 0; |
1149 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 1180 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
1150 | dat.TextureEntry = new byte[0]; | 1181 | dat.TextureEntry = new byte[0]; |
1151 | bytes[i++] = (byte)(ID % 256); | 1182 | bytes[i++] = (byte) (ID%256); |
1152 | bytes[i++] = (byte)((ID >> 8) % 256); | 1183 | bytes[i++] = (byte) ((ID >> 8)%256); |
1153 | bytes[i++] = (byte)((ID >> 16) % 256); | 1184 | bytes[i++] = (byte) ((ID >> 16)%256); |
1154 | bytes[i++] = (byte)((ID >> 24) % 256); | 1185 | bytes[i++] = (byte) ((ID >> 24)%256); |
1155 | bytes[i++] = 0; | 1186 | bytes[i++] = 0; |
1156 | bytes[i++] = 0; | 1187 | bytes[i++] = 0; |
1157 | 1188 | ||
@@ -1161,44 +1192,44 @@ namespace OpenSim.Region.ClientStack | |||
1161 | ushort ac = 32767; | 1192 | ushort ac = 32767; |
1162 | 1193 | ||
1163 | //vel | 1194 | //vel |
1164 | bytes[i++] = (byte)(ac % 256); | 1195 | bytes[i++] = (byte) (ac%256); |
1165 | bytes[i++] = (byte)((ac >> 8) % 256); | 1196 | bytes[i++] = (byte) ((ac >> 8)%256); |
1166 | bytes[i++] = (byte)(ac % 256); | 1197 | bytes[i++] = (byte) (ac%256); |
1167 | bytes[i++] = (byte)((ac >> 8) % 256); | 1198 | bytes[i++] = (byte) ((ac >> 8)%256); |
1168 | bytes[i++] = (byte)(ac % 256); | 1199 | bytes[i++] = (byte) (ac%256); |
1169 | bytes[i++] = (byte)((ac >> 8) % 256); | 1200 | bytes[i++] = (byte) ((ac >> 8)%256); |
1170 | 1201 | ||
1171 | //accel | 1202 | //accel |
1172 | bytes[i++] = (byte)(ac % 256); | 1203 | bytes[i++] = (byte) (ac%256); |
1173 | bytes[i++] = (byte)((ac >> 8) % 256); | 1204 | bytes[i++] = (byte) ((ac >> 8)%256); |
1174 | bytes[i++] = (byte)(ac % 256); | 1205 | bytes[i++] = (byte) (ac%256); |
1175 | bytes[i++] = (byte)((ac >> 8) % 256); | 1206 | bytes[i++] = (byte) ((ac >> 8)%256); |
1176 | bytes[i++] = (byte)(ac % 256); | 1207 | bytes[i++] = (byte) (ac%256); |
1177 | bytes[i++] = (byte)((ac >> 8) % 256); | 1208 | bytes[i++] = (byte) ((ac >> 8)%256); |
1178 | 1209 | ||
1179 | ushort rw, rx, ry, rz; | 1210 | ushort rw, rx, ry, rz; |
1180 | rw = (ushort)(32768 * (rotation.W + 1)); | 1211 | rw = (ushort) (32768*(rotation.W + 1)); |
1181 | rx = (ushort)(32768 * (rotation.X + 1)); | 1212 | rx = (ushort) (32768*(rotation.X + 1)); |
1182 | ry = (ushort)(32768 * (rotation.Y + 1)); | 1213 | ry = (ushort) (32768*(rotation.Y + 1)); |
1183 | rz = (ushort)(32768 * (rotation.Z + 1)); | 1214 | rz = (ushort) (32768*(rotation.Z + 1)); |
1184 | 1215 | ||
1185 | //rot | 1216 | //rot |
1186 | bytes[i++] = (byte)(rx % 256); | 1217 | bytes[i++] = (byte) (rx%256); |
1187 | bytes[i++] = (byte)((rx >> 8) % 256); | 1218 | bytes[i++] = (byte) ((rx >> 8)%256); |
1188 | bytes[i++] = (byte)(ry % 256); | 1219 | bytes[i++] = (byte) (ry%256); |
1189 | bytes[i++] = (byte)((ry >> 8) % 256); | 1220 | bytes[i++] = (byte) ((ry >> 8)%256); |
1190 | bytes[i++] = (byte)(rz % 256); | 1221 | bytes[i++] = (byte) (rz%256); |
1191 | bytes[i++] = (byte)((rz >> 8) % 256); | 1222 | bytes[i++] = (byte) ((rz >> 8)%256); |
1192 | bytes[i++] = (byte)(rw % 256); | 1223 | bytes[i++] = (byte) (rw%256); |
1193 | bytes[i++] = (byte)((rw >> 8) % 256); | 1224 | bytes[i++] = (byte) ((rw >> 8)%256); |
1194 | 1225 | ||
1195 | //rotation vel | 1226 | //rotation vel |
1196 | bytes[i++] = (byte)(ac % 256); | 1227 | bytes[i++] = (byte) (ac%256); |
1197 | bytes[i++] = (byte)((ac >> 8) % 256); | 1228 | bytes[i++] = (byte) ((ac >> 8)%256); |
1198 | bytes[i++] = (byte)(ac % 256); | 1229 | bytes[i++] = (byte) (ac%256); |
1199 | bytes[i++] = (byte)((ac >> 8) % 256); | 1230 | bytes[i++] = (byte) ((ac >> 8)%256); |
1200 | bytes[i++] = (byte)(ac % 256); | 1231 | bytes[i++] = (byte) (ac%256); |
1201 | bytes[i++] = (byte)((ac >> 8) % 256); | 1232 | bytes[i++] = (byte) ((ac >> 8)%256); |
1202 | 1233 | ||
1203 | dat.Data = bytes; | 1234 | dat.Data = bytes; |
1204 | return dat; | 1235 | return dat; |
@@ -1212,16 +1243,15 @@ namespace OpenSim.Region.ClientStack | |||
1212 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) | 1243 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) |
1213 | { | 1244 | { |
1214 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | 1245 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); |
1215 | this.SetDefaultPrimPacketValues(objupdate); | 1246 | SetDefaultPrimPacketValues(objupdate); |
1216 | objupdate.UpdateFlags = flags; | 1247 | objupdate.UpdateFlags = flags; |
1217 | this.SetPrimPacketShapeData(objupdate, primShape); | 1248 | SetPrimPacketShapeData(objupdate, primShape); |
1218 | 1249 | ||
1219 | return objupdate; | 1250 | return objupdate; |
1220 | } | 1251 | } |
1221 | 1252 | ||
1222 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) | 1253 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) |
1223 | { | 1254 | { |
1224 | |||
1225 | objectData.TextureEntry = primData.TextureEntry; | 1255 | objectData.TextureEntry = primData.TextureEntry; |
1226 | objectData.PCode = primData.PCode; | 1256 | objectData.PCode = primData.PCode; |
1227 | objectData.PathBegin = primData.PathBegin; | 1257 | objectData.PathBegin = primData.PathBegin; |
@@ -1278,10 +1308,11 @@ namespace OpenSim.Region.ClientStack | |||
1278 | /// <returns></returns> | 1308 | /// <returns></returns> |
1279 | protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) | 1309 | protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) |
1280 | { | 1310 | { |
1281 | ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | 1311 | ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); |
1312 | // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
1282 | 1313 | ||
1283 | SetDefaultAvatarPacketValues(ref objdata); | 1314 | SetDefaultAvatarPacketValues(ref objdata); |
1284 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | 1315 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); |
1285 | objdata.PathCurve = 16; | 1316 | objdata.PathCurve = 16; |
1286 | objdata.ProfileCurve = 1; | 1317 | objdata.ProfileCurve = 1; |
1287 | objdata.PathScaleX = 100; | 1318 | objdata.PathScaleX = 100; |
@@ -1353,6 +1384,5 @@ namespace OpenSim.Region.ClientStack | |||
1353 | } | 1384 | } |
1354 | 1385 | ||
1355 | #endregion | 1386 | #endregion |
1356 | |||
1357 | } | 1387 | } |
1358 | } | 1388 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 0771a4a..d589a7b 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs | |||
@@ -27,9 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using libsecondlife.Packets; | 29 | using libsecondlife.Packets; |
30 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | ||
33 | 32 | ||
34 | namespace OpenSim.Region.ClientStack | 33 | namespace OpenSim.Region.ClientStack |
35 | { | 34 | { |
@@ -37,17 +36,17 @@ namespace OpenSim.Region.ClientStack | |||
37 | { | 36 | { |
38 | protected virtual void RegisterLocalPacketHandlers() | 37 | protected virtual void RegisterLocalPacketHandlers() |
39 | { | 38 | { |
40 | this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); | 39 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); |
41 | this.AddLocalPacketHandler(PacketType.ViewerEffect, this.HandleViewerEffect); | 40 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); |
42 | this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); | 41 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); |
43 | this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); | 42 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); |
44 | } | 43 | } |
45 | 44 | ||
46 | private bool HandleViewerEffect(IClientAPI sender, Packet Pack) | 45 | private bool HandleViewerEffect(IClientAPI sender, Packet Pack) |
47 | { | 46 | { |
48 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | 47 | ViewerEffectPacket viewer = (ViewerEffectPacket) Pack; |
49 | 48 | ||
50 | if( OnViewerEffect != null ) | 49 | if (OnViewerEffect != null) |
51 | { | 50 | { |
52 | OnViewerEffect(sender, viewer.Effect); | 51 | OnViewerEffect(sender, viewer.Effect); |
53 | } | 52 | } |
@@ -59,7 +58,7 @@ namespace OpenSim.Region.ClientStack | |||
59 | { | 58 | { |
60 | MainLog.Instance.Verbose("CLIENT", "Got a logout request"); | 59 | MainLog.Instance.Verbose("CLIENT", "Got a logout request"); |
61 | 60 | ||
62 | if( OnLogout != null ) | 61 | if (OnLogout != null) |
63 | { | 62 | { |
64 | OnLogout(client); | 63 | OnLogout(client); |
65 | } | 64 | } |
@@ -70,13 +69,14 @@ namespace OpenSim.Region.ClientStack | |||
70 | protected bool AgentTextureCached(IClientAPI simclient, Packet packet) | 69 | protected bool AgentTextureCached(IClientAPI simclient, Packet packet) |
71 | { | 70 | { |
72 | //System.Console.WriteLine("texture cached: " + packet.ToString()); | 71 | //System.Console.WriteLine("texture cached: " + packet.ToString()); |
73 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; | 72 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; |
74 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); | 73 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); |
75 | cachedresp.AgentData.AgentID = this.AgentId; | 74 | cachedresp.AgentData.AgentID = AgentId; |
76 | cachedresp.AgentData.SessionID = this.m_sessionId; | 75 | cachedresp.AgentData.SessionID = m_sessionId; |
77 | cachedresp.AgentData.SerialNum = this.cachedtextureserial; | 76 | cachedresp.AgentData.SerialNum = cachedtextureserial; |
78 | this.cachedtextureserial++; | 77 | cachedtextureserial++; |
79 | cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | 78 | cachedresp.WearableData = |
79 | new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | ||
80 | for (int i = 0; i < chechedtex.WearableData.Length; i++) | 80 | for (int i = 0; i < chechedtex.WearableData.Length; i++) |
81 | { | 81 | { |
82 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 82 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
@@ -84,17 +84,18 @@ namespace OpenSim.Region.ClientStack | |||
84 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; | 84 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; |
85 | cachedresp.WearableData[i].HostName = new byte[0]; | 85 | cachedresp.WearableData[i].HostName = new byte[0]; |
86 | } | 86 | } |
87 | this.OutPacket(cachedresp); | 87 | OutPacket(cachedresp); |
88 | return true; | 88 | return true; |
89 | } | 89 | } |
90 | 90 | ||
91 | protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) | 91 | protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) |
92 | { | 92 | { |
93 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; | 93 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet; |
94 | // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); | 94 | // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); |
95 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) | 95 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) |
96 | { | 96 | { |
97 | #region position | 97 | #region position |
98 | |||
98 | if (multipleupdate.ObjectData[i].Type == 9) //change position | 99 | if (multipleupdate.ObjectData[i].Type == 9) //change position |
99 | { | 100 | { |
100 | if (OnUpdatePrimGroupPosition != null) | 101 | if (OnUpdatePrimGroupPosition != null) |
@@ -102,20 +103,20 @@ namespace OpenSim.Region.ClientStack | |||
102 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 103 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
103 | OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 104 | OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
104 | } | 105 | } |
105 | |||
106 | } | 106 | } |
107 | else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position | 107 | else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position |
108 | { | 108 | { |
109 | if (OnUpdatePrimSinglePosition != null) | 109 | if (OnUpdatePrimSinglePosition != null) |
110 | { | 110 | { |
111 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 111 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
112 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 112 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
113 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 113 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | #endregion position | 116 | #endregion position |
117 | #region rotation | 117 | #region rotation |
118 | else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab | 118 | |
119 | else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab | ||
119 | { | 120 | { |
120 | if (OnUpdatePrimSingleRotation != null) | 121 | if (OnUpdatePrimSingleRotation != null) |
121 | { | 122 | { |
@@ -124,38 +125,39 @@ namespace OpenSim.Region.ClientStack | |||
124 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | 125 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); |
125 | } | 126 | } |
126 | } | 127 | } |
127 | else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse | 128 | else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse |
128 | { | 129 | { |
129 | if (OnUpdatePrimSingleRotation != null) | 130 | if (OnUpdatePrimSingleRotation != null) |
130 | { | 131 | { |
131 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | 132 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); |
132 | //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | 133 | //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); |
133 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | 134 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); |
134 | } | 135 | } |
135 | } | 136 | } |
136 | else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab | 137 | else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab |
137 | { | 138 | { |
138 | if (OnUpdatePrimGroupRotation != null) | 139 | if (OnUpdatePrimGroupRotation != null) |
139 | { | 140 | { |
140 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | 141 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); |
141 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | 142 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); |
142 | OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | 143 | OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); |
143 | } | 144 | } |
144 | } | 145 | } |
145 | else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse | 146 | else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse |
146 | { | 147 | { |
147 | if (OnUpdatePrimGroupMouseRotation != null) | 148 | if (OnUpdatePrimGroupMouseRotation != null) |
148 | { | 149 | { |
149 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 150 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
150 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | 151 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); |
151 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 152 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
152 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | 153 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); |
153 | OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); | 154 | OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); |
154 | } | 155 | } |
155 | } | 156 | } |
156 | #endregion | 157 | #endregion |
157 | #region scale | 158 | #region scale |
158 | else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab | 159 | |
160 | else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab | ||
159 | { | 161 | { |
160 | if (OnUpdatePrimScale != null) | 162 | if (OnUpdatePrimScale != null) |
161 | { | 163 | { |
@@ -164,40 +166,41 @@ namespace OpenSim.Region.ClientStack | |||
164 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 166 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
165 | 167 | ||
166 | // Change the position based on scale (for bug number 246) | 168 | // Change the position based on scale (for bug number 246) |
167 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 169 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
168 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 170 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
169 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 171 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse | 174 | else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse |
173 | { | 175 | { |
174 | if (OnUpdatePrimScale != null) | 176 | if (OnUpdatePrimScale != null) |
175 | { | 177 | { |
176 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 178 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); |
177 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); | 179 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); |
178 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 180 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
179 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 181 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
180 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 182 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
181 | } | 183 | } |
182 | } | 184 | } |
183 | else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab | 185 | else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab |
184 | { | 186 | { |
185 | if (OnUpdatePrimScale != null) | 187 | if (OnUpdatePrimScale != null) |
186 | { | 188 | { |
187 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 189 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); |
188 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 190 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); |
189 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 191 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
190 | } | 192 | } |
191 | } | 193 | } |
192 | else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse | 194 | else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse |
193 | { | 195 | { |
194 | if (OnUpdatePrimScale != null) | 196 | if (OnUpdatePrimScale != null) |
195 | { | 197 | { |
196 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 198 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); |
197 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 199 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); |
198 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 200 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
199 | } | 201 | } |
200 | } | 202 | } |
203 | |||
201 | #endregion | 204 | #endregion |
202 | } | 205 | } |
203 | return true; | 206 | return true; |
@@ -208,7 +211,7 @@ namespace OpenSim.Region.ClientStack | |||
208 | //should be getting the map layer from the grid server | 211 | //should be getting the map layer from the grid server |
209 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) | 212 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) |
210 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); | 213 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); |
211 | mapReply.AgentData.AgentID = this.AgentId; | 214 | mapReply.AgentData.AgentID = AgentId; |
212 | mapReply.AgentData.Flags = 0; | 215 | mapReply.AgentData.Flags = 0; |
213 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; | 216 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; |
214 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); | 217 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); |
@@ -217,7 +220,7 @@ namespace OpenSim.Region.ClientStack | |||
217 | mapReply.LayerData[0].Top = 30000; | 220 | mapReply.LayerData[0].Top = 30000; |
218 | mapReply.LayerData[0].Right = 30000; | 221 | mapReply.LayerData[0].Right = 30000; |
219 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 222 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
220 | this.OutPacket(mapReply); | 223 | OutPacket(mapReply); |
221 | } | 224 | } |
222 | 225 | ||
223 | public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) | 226 | public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) |
@@ -251,4 +254,4 @@ namespace OpenSim.Region.ClientStack | |||
251 | */ | 254 | */ |
252 | } | 255 | } |
253 | } | 256 | } |
254 | } | 257 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs index 5cd30ce..efeff29 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs | |||
@@ -32,13 +32,12 @@ using System.Net.Sockets; | |||
32 | using System.Timers; | 32 | using System.Timers; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
37 | using OpenSim.Region.Environment; | 36 | using OpenSim.Framework.Console; |
38 | 37 | ||
39 | namespace OpenSim.Region.ClientStack | 38 | namespace OpenSim.Region.ClientStack |
40 | { | 39 | { |
41 | public partial class ClientView | 40 | public partial class ClientView |
42 | { | 41 | { |
43 | protected BlockingQueue<QueItem> PacketQueue; | 42 | protected BlockingQueue<QueItem> PacketQueue; |
44 | protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | 43 | protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); |
@@ -84,7 +83,7 @@ namespace OpenSim.Region.ClientStack | |||
84 | Pack.Header.Sequence = Sequence; | 83 | Pack.Header.Sequence = Sequence; |
85 | } | 84 | } |
86 | 85 | ||
87 | if (Pack.Header.Reliable) //DIRTY HACK | 86 | if (Pack.Header.Reliable) //DIRTY HACK |
88 | { | 87 | { |
89 | lock (NeedAck) | 88 | lock (NeedAck) |
90 | { | 89 | { |
@@ -148,19 +147,21 @@ namespace OpenSim.Region.ClientStack | |||
148 | if (Pack.Header.Zerocoded) | 147 | if (Pack.Header.Zerocoded) |
149 | { | 148 | { |
150 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | 149 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); |
151 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);//userEP); | 150 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); //userEP); |
152 | } | 151 | } |
153 | else | 152 | else |
154 | { | 153 | { |
155 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); //userEP); | 154 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); |
155 | //userEP); | ||
156 | } | 156 | } |
157 | } | 157 | } |
158 | catch (Exception) | 158 | catch (Exception) |
159 | { | 159 | { |
160 | MainLog.Instance.Warn("client", "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); | 160 | MainLog.Instance.Warn("client", |
161 | this.KillThread(); | 161 | "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + |
162 | userEP.ToString() + " - killing thread"); | ||
163 | KillThread(); | ||
162 | } | 164 | } |
163 | |||
164 | } | 165 | } |
165 | 166 | ||
166 | public virtual void InPacket(Packet NewPack) | 167 | public virtual void InPacket(Packet NewPack) |
@@ -180,7 +181,7 @@ namespace OpenSim.Region.ClientStack | |||
180 | // Handle PacketAck packets | 181 | // Handle PacketAck packets |
181 | if (NewPack.Type == PacketType.PacketAck) | 182 | if (NewPack.Type == PacketType.PacketAck) |
182 | { | 183 | { |
183 | PacketAckPacket ackPacket = (PacketAckPacket)NewPack; | 184 | PacketAckPacket ackPacket = (PacketAckPacket) NewPack; |
184 | 185 | ||
185 | lock (NeedAck) | 186 | lock (NeedAck) |
186 | { | 187 | { |
@@ -193,7 +194,7 @@ namespace OpenSim.Region.ClientStack | |||
193 | else if ((NewPack.Type == PacketType.StartPingCheck)) | 194 | else if ((NewPack.Type == PacketType.StartPingCheck)) |
194 | { | 195 | { |
195 | //reply to pingcheck | 196 | //reply to pingcheck |
196 | StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack; | 197 | StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; |
197 | CompletePingCheckPacket endPing = new CompletePingCheckPacket(); | 198 | CompletePingCheckPacket endPing = new CompletePingCheckPacket(); |
198 | endPing.PingID.PingID = startPing.PingID.PingID; | 199 | endPing.PingID.PingID = startPing.PingID.PingID; |
199 | OutPacket(endPing); | 200 | OutPacket(endPing); |
@@ -203,9 +204,8 @@ namespace OpenSim.Region.ClientStack | |||
203 | QueItem item = new QueItem(); | 204 | QueItem item = new QueItem(); |
204 | item.Packet = NewPack; | 205 | item.Packet = NewPack; |
205 | item.Incoming = true; | 206 | item.Incoming = true; |
206 | this.PacketQueue.Enqueue(item); | 207 | PacketQueue.Enqueue(item); |
207 | } | 208 | } |
208 | |||
209 | } | 209 | } |
210 | 210 | ||
211 | public virtual void OutPacket(Packet NewPack) | 211 | public virtual void OutPacket(Packet NewPack) |
@@ -213,7 +213,7 @@ namespace OpenSim.Region.ClientStack | |||
213 | QueItem item = new QueItem(); | 213 | QueItem item = new QueItem(); |
214 | item.Packet = NewPack; | 214 | item.Packet = NewPack; |
215 | item.Incoming = false; | 215 | item.Incoming = false; |
216 | this.PacketQueue.Enqueue(item); | 216 | PacketQueue.Enqueue(item); |
217 | } | 217 | } |
218 | 218 | ||
219 | # region Low Level Packet Methods | 219 | # region Low Level Packet Methods |
@@ -229,7 +229,6 @@ namespace OpenSim.Region.ClientStack | |||
229 | ack_it.Header.Reliable = false; | 229 | ack_it.Header.Reliable = false; |
230 | 230 | ||
231 | OutPacket(ack_it); | 231 | OutPacket(ack_it); |
232 | |||
233 | } | 232 | } |
234 | /* | 233 | /* |
235 | if (Pack.Header.Reliable) | 234 | if (Pack.Header.Reliable) |
@@ -252,8 +251,8 @@ namespace OpenSim.Region.ClientStack | |||
252 | { | 251 | { |
253 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) | 252 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) |
254 | { | 253 | { |
255 | MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + | 254 | MainLog.Instance.Verbose("Resending " + packet.Type.ToString() + " packet, " + |
256 | (now - packet.TickCount) + "ms have passed"); | 255 | (now - packet.TickCount) + "ms have passed"); |
257 | 256 | ||
258 | packet.Header.Resent = true; | 257 | packet.Header.Resent = true; |
259 | OutPacket(packet); | 258 | OutPacket(packet); |
@@ -271,7 +270,7 @@ namespace OpenSim.Region.ClientStack | |||
271 | if (PendingAcks.Count > 250) | 270 | if (PendingAcks.Count > 250) |
272 | { | 271 | { |
273 | // FIXME: Handle the odd case where we have too many pending ACKs queued up | 272 | // FIXME: Handle the odd case where we have too many pending ACKs queued up |
274 | MainLog.Instance.Verbose( "Too many ACKs queued up!"); | 273 | MainLog.Instance.Verbose("Too many ACKs queued up!"); |
275 | return; | 274 | return; |
276 | } | 275 | } |
277 | 276 | ||
@@ -302,6 +301,7 @@ namespace OpenSim.Region.ClientStack | |||
302 | SendAcks(); | 301 | SendAcks(); |
303 | ResendUnacked(); | 302 | ResendUnacked(); |
304 | } | 303 | } |
304 | |||
305 | #endregion | 305 | #endregion |
306 | 306 | ||
307 | #region Nested Classes | 307 | #region Nested Classes |
@@ -315,6 +315,7 @@ namespace OpenSim.Region.ClientStack | |||
315 | public Packet Packet; | 315 | public Packet Packet; |
316 | public bool Incoming; | 316 | public bool Incoming; |
317 | } | 317 | } |
318 | |||
318 | #endregion | 319 | #endregion |
319 | } | 320 | } |
320 | } | 321 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 13e8b43..dd2562c 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -31,8 +31,6 @@ using System.Text; | |||
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Region.Environment.Scenes; | ||
36 | 34 | ||
37 | namespace OpenSim.Region.ClientStack | 35 | namespace OpenSim.Region.ClientStack |
38 | { | 36 | { |
@@ -63,7 +61,7 @@ namespace OpenSim.Region.ClientStack | |||
63 | { | 61 | { |
64 | ack_pack(Pack); | 62 | ack_pack(Pack); |
65 | 63 | ||
66 | if (this.ProcessPacketMethod(Pack)) | 64 | if (ProcessPacketMethod(Pack)) |
67 | { | 65 | { |
68 | //there is a handler registered that handled this packet type | 66 | //there is a handler registered that handled this packet type |
69 | return; | 67 | return; |
@@ -74,16 +72,17 @@ namespace OpenSim.Region.ClientStack | |||
74 | 72 | ||
75 | switch (Pack.Type) | 73 | switch (Pack.Type) |
76 | { | 74 | { |
77 | #region Scene/Avatar | 75 | #region Scene/Avatar |
76 | |||
78 | case PacketType.AvatarPropertiesRequest: | 77 | case PacketType.AvatarPropertiesRequest: |
79 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 78 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket) Pack; |
80 | if (OnRequestAvatarProperties != null) | 79 | if (OnRequestAvatarProperties != null) |
81 | { | 80 | { |
82 | OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); | 81 | OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); |
83 | } | 82 | } |
84 | break; | 83 | break; |
85 | case PacketType.ChatFromViewer: | 84 | case PacketType.ChatFromViewer: |
86 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | 85 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack; |
87 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") | 86 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") |
88 | { | 87 | { |
89 | //empty message so don't bother with it | 88 | //empty message so don't bother with it |
@@ -103,30 +102,32 @@ namespace OpenSim.Region.ClientStack | |||
103 | args.Channel = channel; | 102 | args.Channel = channel; |
104 | args.From = fromName; | 103 | args.From = fromName; |
105 | args.Message = Util.FieldToString(message); | 104 | args.Message = Util.FieldToString(message); |
106 | args.Type = (ChatTypeEnum)type; | 105 | args.Type = (ChatTypeEnum) type; |
107 | args.Position = fromPos; | 106 | args.Position = fromPos; |
108 | 107 | ||
109 | args.Scene = Scene; | 108 | args.Scene = Scene; |
110 | args.Sender = this; | 109 | args.Sender = this; |
111 | 110 | ||
112 | this.OnChatFromViewer(this, args); | 111 | OnChatFromViewer(this, args); |
113 | } | 112 | } |
114 | break; | 113 | break; |
115 | case PacketType.ImprovedInstantMessage: | 114 | case PacketType.ImprovedInstantMessage: |
116 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; | 115 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack; |
117 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); | 116 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); |
118 | string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); | 117 | string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); |
119 | if (OnInstantMessage != null) | 118 | if (OnInstantMessage != null) |
120 | { | 119 | { |
121 | this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, | 120 | OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, |
122 | msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, msgpack.MessageBlock.Dialog); | 121 | msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, |
122 | msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, | ||
123 | msgpack.MessageBlock.Dialog); | ||
123 | } | 124 | } |
124 | break; | 125 | break; |
125 | case PacketType.RezObject: | 126 | case PacketType.RezObject: |
126 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | 127 | RezObjectPacket rezPacket = (RezObjectPacket) Pack; |
127 | if (OnRezObject != null) | 128 | if (OnRezObject != null) |
128 | { | 129 | { |
129 | this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); | 130 | OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); |
130 | } | 131 | } |
131 | break; | 132 | break; |
132 | case PacketType.DeRezObject: | 133 | case PacketType.DeRezObject: |
@@ -136,13 +137,15 @@ namespace OpenSim.Region.ClientStack | |||
136 | } | 137 | } |
137 | break; | 138 | break; |
138 | case PacketType.ModifyLand: | 139 | case PacketType.ModifyLand: |
139 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | 140 | ModifyLandPacket modify = (ModifyLandPacket) Pack; |
140 | if (modify.ParcelData.Length > 0) | 141 | if (modify.ParcelData.Length > 0) |
141 | { | 142 | { |
142 | if (OnModifyTerrain != null) | 143 | if (OnModifyTerrain != null) |
143 | { | 144 | { |
144 | OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, | 145 | OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, |
145 | modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West, this); | 146 | modify.ModifyBlock.BrushSize, |
147 | modify.ModifyBlock.Action, modify.ParcelData[0].North, | ||
148 | modify.ParcelData[0].West, this); | ||
146 | } | 149 | } |
147 | } | 150 | } |
148 | break; | 151 | break; |
@@ -164,7 +167,7 @@ namespace OpenSim.Region.ClientStack | |||
164 | break; | 167 | break; |
165 | case PacketType.AgentSetAppearance: | 168 | case PacketType.AgentSetAppearance: |
166 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString()); | 169 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString()); |
167 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | 170 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket) Pack; |
168 | if (OnSetAppearance != null) | 171 | if (OnSetAppearance != null) |
169 | { | 172 | { |
170 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); | 173 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); |
@@ -179,17 +182,16 @@ namespace OpenSim.Region.ClientStack | |||
179 | case PacketType.AgentUpdate: | 182 | case PacketType.AgentUpdate: |
180 | if (OnAgentUpdate != null) | 183 | if (OnAgentUpdate != null) |
181 | { | 184 | { |
182 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; | 185 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; |
183 | OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); | 186 | OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); |
184 | } | 187 | } |
185 | break; | 188 | break; |
186 | case PacketType.AgentAnimation: | 189 | case PacketType.AgentAnimation: |
187 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | 190 | AgentAnimationPacket AgentAni = (AgentAnimationPacket) Pack; |
188 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | 191 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) |
189 | { | 192 | { |
190 | if (AgentAni.AnimationList[i].StartAnim) | 193 | if (AgentAni.AnimationList[i].StartAnim) |
191 | { | 194 | { |
192 | |||
193 | if (OnStartAnim != null) | 195 | if (OnStartAnim != null) |
194 | { | 196 | { |
195 | OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); | 197 | OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); |
@@ -198,27 +200,29 @@ namespace OpenSim.Region.ClientStack | |||
198 | } | 200 | } |
199 | break; | 201 | break; |
200 | case PacketType.AgentRequestSit: | 202 | case PacketType.AgentRequestSit: |
201 | AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; | 203 | AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket) Pack; |
202 | SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); | 204 | SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); |
203 | if (OnAgentRequestSit != null) | 205 | if (OnAgentRequestSit != null) |
204 | { | 206 | { |
205 | OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID); | 207 | OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, |
208 | agentRequestSit.TargetObject.TargetID); | ||
206 | } | 209 | } |
207 | break; | 210 | break; |
208 | case PacketType.AgentSit: | 211 | case PacketType.AgentSit: |
209 | if (OnAgentSit != null) | 212 | if (OnAgentSit != null) |
210 | { | 213 | { |
211 | AgentSitPacket agentSit = (AgentSitPacket)Pack; | 214 | AgentSitPacket agentSit = (AgentSitPacket) Pack; |
212 | OnAgentSit(this, agentSit.AgentData.AgentID); | 215 | OnAgentSit(this, agentSit.AgentData.AgentID); |
213 | } | 216 | } |
214 | break; | 217 | break; |
215 | 218 | ||
216 | #endregion | 219 | #endregion |
220 | |||
221 | #region Objects/m_sceneObjects | ||
217 | 222 | ||
218 | #region Objects/m_sceneObjects | ||
219 | case PacketType.ObjectLink: | 223 | case PacketType.ObjectLink: |
220 | // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); | 224 | // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); |
221 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | 225 | ObjectLinkPacket link = (ObjectLinkPacket) Pack; |
222 | uint parentprimid = 0; | 226 | uint parentprimid = 0; |
223 | List<uint> childrenprims = new List<uint>(); | 227 | List<uint> childrenprims = new List<uint>(); |
224 | if (link.ObjectData.Length > 1) | 228 | if (link.ObjectData.Length > 1) |
@@ -238,13 +242,13 @@ namespace OpenSim.Region.ClientStack | |||
238 | case PacketType.ObjectAdd: | 242 | case PacketType.ObjectAdd: |
239 | if (OnAddPrim != null) | 243 | if (OnAddPrim != null) |
240 | { | 244 | { |
241 | ObjectAddPacket addPacket = (ObjectAddPacket)Pack; | 245 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack; |
242 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); | 246 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); |
243 | OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); | 247 | OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, shape); |
244 | } | 248 | } |
245 | break; | 249 | break; |
246 | case PacketType.ObjectShape: | 250 | case PacketType.ObjectShape: |
247 | ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; | 251 | ObjectShapePacket shapePacket = (ObjectShapePacket) Pack; |
248 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) | 252 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) |
249 | { | 253 | { |
250 | if (OnUpdatePrimShape != null) | 254 | if (OnUpdatePrimShape != null) |
@@ -254,26 +258,28 @@ namespace OpenSim.Region.ClientStack | |||
254 | } | 258 | } |
255 | break; | 259 | break; |
256 | case PacketType.ObjectExtraParams: | 260 | case PacketType.ObjectExtraParams: |
257 | ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; | 261 | ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack; |
258 | if (OnUpdateExtraParams != null) | 262 | if (OnUpdateExtraParams != null) |
259 | { | 263 | { |
260 | OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); | 264 | OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, |
265 | extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); | ||
261 | } | 266 | } |
262 | break; | 267 | break; |
263 | case PacketType.ObjectDuplicate: | 268 | case PacketType.ObjectDuplicate: |
264 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; | 269 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket) Pack; |
265 | for (int i = 0; i < dupe.ObjectData.Length; i++) | 270 | for (int i = 0; i < dupe.ObjectData.Length; i++) |
266 | { | 271 | { |
267 | if (OnObjectDuplicate != null) | 272 | if (OnObjectDuplicate != null) |
268 | { | 273 | { |
269 | OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); | 274 | OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, |
275 | dupe.SharedData.DuplicateFlags); | ||
270 | } | 276 | } |
271 | } | 277 | } |
272 | 278 | ||
273 | break; | 279 | break; |
274 | 280 | ||
275 | case PacketType.ObjectSelect: | 281 | case PacketType.ObjectSelect: |
276 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | 282 | ObjectSelectPacket incomingselect = (ObjectSelectPacket) Pack; |
277 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 283 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
278 | { | 284 | { |
279 | if (OnObjectSelect != null) | 285 | if (OnObjectSelect != null) |
@@ -283,7 +289,7 @@ namespace OpenSim.Region.ClientStack | |||
283 | } | 289 | } |
284 | break; | 290 | break; |
285 | case PacketType.ObjectDeselect: | 291 | case PacketType.ObjectDeselect: |
286 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; | 292 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket) Pack; |
287 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 293 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
288 | { | 294 | { |
289 | if (OnObjectDeselect != null) | 295 | if (OnObjectDeselect != null) |
@@ -293,55 +299,58 @@ namespace OpenSim.Region.ClientStack | |||
293 | } | 299 | } |
294 | break; | 300 | break; |
295 | case PacketType.ObjectFlagUpdate: | 301 | case PacketType.ObjectFlagUpdate: |
296 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | 302 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket) Pack; |
297 | if (OnUpdatePrimFlags != null) | 303 | if (OnUpdatePrimFlags != null) |
298 | { | 304 | { |
299 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); | 305 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); |
300 | } | 306 | } |
301 | break; | 307 | break; |
302 | case PacketType.ObjectImage: | 308 | case PacketType.ObjectImage: |
303 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | 309 | ObjectImagePacket imagePack = (ObjectImagePacket) Pack; |
304 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | 310 | for (int i = 0; i < imagePack.ObjectData.Length; i++) |
305 | { | 311 | { |
306 | if (OnUpdatePrimTexture != null) | 312 | if (OnUpdatePrimTexture != null) |
307 | { | 313 | { |
308 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); | 314 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, |
315 | imagePack.ObjectData[i].TextureEntry, this); | ||
309 | } | 316 | } |
310 | } | 317 | } |
311 | break; | 318 | break; |
312 | case PacketType.ObjectGrab: | 319 | case PacketType.ObjectGrab: |
313 | ObjectGrabPacket grab = (ObjectGrabPacket)Pack; | 320 | ObjectGrabPacket grab = (ObjectGrabPacket) Pack; |
314 | if (OnGrabObject != null) | 321 | if (OnGrabObject != null) |
315 | { | 322 | { |
316 | OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); | 323 | OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); |
317 | } | 324 | } |
318 | break; | 325 | break; |
319 | case PacketType.ObjectGrabUpdate: | 326 | case PacketType.ObjectGrabUpdate: |
320 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; | 327 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket) Pack; |
321 | if (OnGrabUpdate != null) | 328 | if (OnGrabUpdate != null) |
322 | { | 329 | { |
323 | OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, grabUpdate.ObjectData.GrabPosition, this); | 330 | OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, |
331 | grabUpdate.ObjectData.GrabPosition, this); | ||
324 | } | 332 | } |
325 | break; | 333 | break; |
326 | case PacketType.ObjectDeGrab: | 334 | case PacketType.ObjectDeGrab: |
327 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; | 335 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket) Pack; |
328 | if (OnDeGrabObject != null) | 336 | if (OnDeGrabObject != null) |
329 | { | 337 | { |
330 | OnDeGrabObject(deGrab.ObjectData.LocalID, this); | 338 | OnDeGrabObject(deGrab.ObjectData.LocalID, this); |
331 | } | 339 | } |
332 | break; | 340 | break; |
333 | case PacketType.ObjectDescription: | 341 | case PacketType.ObjectDescription: |
334 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; | 342 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket) Pack; |
335 | for (int i = 0; i < objDes.ObjectData.Length; i++) | 343 | for (int i = 0; i < objDes.ObjectData.Length; i++) |
336 | { | 344 | { |
337 | if (OnObjectDescription != null) | 345 | if (OnObjectDescription != null) |
338 | { | 346 | { |
339 | OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); | 347 | OnObjectDescription(objDes.ObjectData[i].LocalID, |
348 | enc.GetString(objDes.ObjectData[i].Description)); | ||
340 | } | 349 | } |
341 | } | 350 | } |
342 | break; | 351 | break; |
343 | case PacketType.ObjectName: | 352 | case PacketType.ObjectName: |
344 | ObjectNamePacket objName = (ObjectNamePacket)Pack; | 353 | ObjectNamePacket objName = (ObjectNamePacket) Pack; |
345 | for (int i = 0; i < objName.ObjectData.Length; i++) | 354 | for (int i = 0; i < objName.ObjectData.Length; i++) |
346 | { | 355 | { |
347 | if (OnObjectName != null) | 356 | if (OnObjectName != null) |
@@ -353,15 +362,16 @@ namespace OpenSim.Region.ClientStack | |||
353 | case PacketType.ObjectPermissions: | 362 | case PacketType.ObjectPermissions: |
354 | //Console.WriteLine("permissions set " + Pack.ToString()); | 363 | //Console.WriteLine("permissions set " + Pack.ToString()); |
355 | break; | 364 | break; |
356 | #endregion | ||
357 | 365 | ||
358 | #region Inventory/Asset/Other related packets | 366 | #endregion |
367 | |||
368 | #region Inventory/Asset/Other related packets | ||
369 | |||
359 | case PacketType.RequestImage: | 370 | case PacketType.RequestImage: |
360 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | 371 | RequestImagePacket imageRequest = (RequestImagePacket) Pack; |
361 | //Console.WriteLine("image request: " + Pack.ToString()); | 372 | //Console.WriteLine("image request: " + Pack.ToString()); |
362 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | 373 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) |
363 | { | 374 | { |
364 | |||
365 | // still working on the Texture download module so for now using old method | 375 | // still working on the Texture download module so for now using old method |
366 | // TextureRequestArgs args = new TextureRequestArgs(); | 376 | // TextureRequestArgs args = new TextureRequestArgs(); |
367 | // args.RequestedAssetID = imageRequest.RequestImage[i].Image; | 377 | // args.RequestedAssetID = imageRequest.RequestImage[i].Image; |
@@ -373,86 +383,104 @@ namespace OpenSim.Region.ClientStack | |||
373 | // OnRequestTexture(this, args); | 383 | // OnRequestTexture(this, args); |
374 | // } | 384 | // } |
375 | 385 | ||
376 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet, imageRequest.RequestImage[i].DiscardLevel); | 386 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, |
387 | imageRequest.RequestImage[i].Packet, | ||
388 | imageRequest.RequestImage[i].DiscardLevel); | ||
377 | } | 389 | } |
378 | break; | 390 | break; |
379 | case PacketType.TransferRequest: | 391 | case PacketType.TransferRequest: |
380 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | 392 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); |
381 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | 393 | TransferRequestPacket transfer = (TransferRequestPacket) Pack; |
382 | m_assetCache.AddAssetRequest(this, transfer); | 394 | m_assetCache.AddAssetRequest(this, transfer); |
383 | break; | 395 | break; |
384 | case PacketType.AssetUploadRequest: | 396 | case PacketType.AssetUploadRequest: |
385 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 397 | AssetUploadRequestPacket request = (AssetUploadRequestPacket) Pack; |
386 | // Console.WriteLine("upload request " + Pack.ToString()); | 398 | // Console.WriteLine("upload request " + Pack.ToString()); |
387 | // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); | 399 | // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); |
388 | if (OnAssetUploadRequest != null) | 400 | if (OnAssetUploadRequest != null) |
389 | { | 401 | { |
390 | OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); | 402 | OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(SecureSessionID), |
403 | request.AssetBlock.TransactionID, request.AssetBlock.Type, | ||
404 | request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); | ||
391 | } | 405 | } |
392 | break; | 406 | break; |
393 | case PacketType.RequestXfer: | 407 | case PacketType.RequestXfer: |
394 | RequestXferPacket xferReq = (RequestXferPacket)Pack; | 408 | RequestXferPacket xferReq = (RequestXferPacket) Pack; |
395 | if (OnRequestXfer != null) | 409 | if (OnRequestXfer != null) |
396 | { | 410 | { |
397 | OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); | 411 | OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); |
398 | } | 412 | } |
399 | break; | 413 | break; |
400 | case PacketType.SendXferPacket: | 414 | case PacketType.SendXferPacket: |
401 | SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; | 415 | SendXferPacketPacket xferRec = (SendXferPacketPacket) Pack; |
402 | if (OnXferReceive != null) | 416 | if (OnXferReceive != null) |
403 | { | 417 | { |
404 | OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); | 418 | OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); |
405 | } | 419 | } |
406 | break; | 420 | break; |
407 | case PacketType.ConfirmXferPacket: | 421 | case PacketType.ConfirmXferPacket: |
408 | ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; | 422 | ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket) Pack; |
409 | if (OnConfirmXfer != null) | 423 | if (OnConfirmXfer != null) |
410 | { | 424 | { |
411 | OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); | 425 | OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); |
412 | } | 426 | } |
413 | break; | 427 | break; |
414 | case PacketType.CreateInventoryFolder: | 428 | case PacketType.CreateInventoryFolder: |
415 | if (this.OnCreateNewInventoryFolder != null) | 429 | if (OnCreateNewInventoryFolder != null) |
416 | { | 430 | { |
417 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 431 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket) Pack; |
418 | this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 432 | OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, |
433 | (ushort) invFolder.FolderData.Type, | ||
434 | Util.FieldToString(invFolder.FolderData.Name), | ||
435 | invFolder.FolderData.ParentID); | ||
419 | } | 436 | } |
420 | break; | 437 | break; |
421 | case PacketType.CreateInventoryItem: | 438 | case PacketType.CreateInventoryItem: |
422 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | 439 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; |
423 | if (this.OnCreateNewInventoryItem != null) | 440 | if (OnCreateNewInventoryItem != null) |
424 | { | 441 | { |
425 | this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID, | 442 | OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, |
426 | Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType, | 443 | createItem.InventoryBlock.FolderID, |
427 | createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask); | 444 | createItem.InventoryBlock.CallbackID, |
445 | Util.FieldToString(createItem.InventoryBlock.Description), | ||
446 | Util.FieldToString(createItem.InventoryBlock.Name), | ||
447 | createItem.InventoryBlock.InvType, | ||
448 | createItem.InventoryBlock.Type, | ||
449 | createItem.InventoryBlock.WearableType, | ||
450 | createItem.InventoryBlock.NextOwnerMask); | ||
428 | } | 451 | } |
429 | break; | 452 | break; |
430 | case PacketType.FetchInventory: | 453 | case PacketType.FetchInventory: |
431 | if (this.OnFetchInventory != null) | 454 | if (OnFetchInventory != null) |
432 | { | 455 | { |
433 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | 456 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket) Pack; |
434 | for (int i = 0; i < FetchInventory.InventoryData.Length; i++) | 457 | for (int i = 0; i < FetchInventory.InventoryData.Length; i++) |
435 | { | 458 | { |
436 | this.OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, FetchInventory.InventoryData[i].OwnerID); | 459 | OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, |
460 | FetchInventory.InventoryData[i].OwnerID); | ||
437 | } | 461 | } |
438 | } | 462 | } |
439 | break; | 463 | break; |
440 | case PacketType.FetchInventoryDescendents: | 464 | case PacketType.FetchInventoryDescendents: |
441 | if (this.OnFetchInventoryDescendents != null) | 465 | if (OnFetchInventoryDescendents != null) |
442 | { | 466 | { |
443 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | 467 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket) Pack; |
444 | this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); | 468 | OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, |
469 | Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, | ||
470 | Fetch.InventoryData.SortOrder); | ||
445 | } | 471 | } |
446 | break; | 472 | break; |
447 | case PacketType.UpdateInventoryItem: | 473 | case PacketType.UpdateInventoryItem: |
448 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | 474 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket) Pack; |
449 | if (OnUpdateInventoryItem != null) | 475 | if (OnUpdateInventoryItem != null) |
450 | { | 476 | { |
451 | for (int i = 0; i < update.InventoryData.Length; i++) | 477 | for (int i = 0; i < update.InventoryData.Length; i++) |
452 | { | 478 | { |
453 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | 479 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) |
454 | { | 480 | { |
455 | OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID); | 481 | OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, |
482 | update.InventoryData[i].TransactionID.Combine(SecureSessionID), | ||
483 | update.InventoryData[i].ItemID); | ||
456 | } | 484 | } |
457 | } | 485 | } |
458 | } | 486 | } |
@@ -488,25 +516,26 @@ namespace OpenSim.Region.ClientStack | |||
488 | }*/ | 516 | }*/ |
489 | break; | 517 | break; |
490 | case PacketType.RequestTaskInventory: | 518 | case PacketType.RequestTaskInventory: |
491 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | 519 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack; |
492 | if (this.OnRequestTaskInventory != null) | 520 | if (OnRequestTaskInventory != null) |
493 | { | 521 | { |
494 | this.OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); | 522 | OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); |
495 | } | 523 | } |
496 | break; | 524 | break; |
497 | case PacketType.UpdateTaskInventory: | 525 | case PacketType.UpdateTaskInventory: |
498 | //Console.WriteLine(Pack.ToString()); | 526 | //Console.WriteLine(Pack.ToString()); |
499 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; | 527 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket) Pack; |
500 | if (OnUpdateTaskInventory != null) | 528 | if (OnUpdateTaskInventory != null) |
501 | { | 529 | { |
502 | if (updatetask.UpdateData.Key == 0) | 530 | if (updatetask.UpdateData.Key == 0) |
503 | { | 531 | { |
504 | OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID, updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); | 532 | OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID, |
533 | updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); | ||
505 | } | 534 | } |
506 | } | 535 | } |
507 | break; | 536 | break; |
508 | case PacketType.RemoveTaskInventory: | 537 | case PacketType.RemoveTaskInventory: |
509 | RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; | 538 | RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket) Pack; |
510 | if (OnRemoveTaskItem != null) | 539 | if (OnRemoveTaskItem != null) |
511 | { | 540 | { |
512 | OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); | 541 | OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); |
@@ -517,38 +546,39 @@ namespace OpenSim.Region.ClientStack | |||
517 | break; | 546 | break; |
518 | case PacketType.RezScript: | 547 | case PacketType.RezScript: |
519 | //Console.WriteLine(Pack.ToString()); | 548 | //Console.WriteLine(Pack.ToString()); |
520 | RezScriptPacket rezScript = (RezScriptPacket)Pack; | 549 | RezScriptPacket rezScript = (RezScriptPacket) Pack; |
521 | if (OnRezScript != null) | 550 | if (OnRezScript != null) |
522 | { | 551 | { |
523 | OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); | 552 | OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); |
524 | } | 553 | } |
525 | break; | 554 | break; |
526 | case PacketType.MapLayerRequest: | 555 | case PacketType.MapLayerRequest: |
527 | this.RequestMapLayer(); | 556 | RequestMapLayer(); |
528 | break; | 557 | break; |
529 | case PacketType.MapBlockRequest: | 558 | case PacketType.MapBlockRequest: |
530 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; | 559 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket) Pack; |
531 | if (OnRequestMapBlocks != null) | 560 | if (OnRequestMapBlocks != null) |
532 | { | 561 | { |
533 | OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | 562 | OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, |
563 | MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | ||
534 | } | 564 | } |
535 | break; | 565 | break; |
536 | case PacketType.TeleportLandmarkRequest: | 566 | case PacketType.TeleportLandmarkRequest: |
537 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; | 567 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; |
538 | 568 | ||
539 | TeleportStartPacket tpStart = new TeleportStartPacket(); | 569 | TeleportStartPacket tpStart = new TeleportStartPacket(); |
540 | tpStart.Info.TeleportFlags = 8; // tp via lm | 570 | tpStart.Info.TeleportFlags = 8; // tp via lm |
541 | this.OutPacket(tpStart); | 571 | OutPacket(tpStart); |
542 | 572 | ||
543 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); | 573 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); |
544 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); | 574 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); |
545 | tpProgress.Info.TeleportFlags = 8; | 575 | tpProgress.Info.TeleportFlags = 8; |
546 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; | 576 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; |
547 | this.OutPacket(tpProgress); | 577 | OutPacket(tpProgress); |
548 | 578 | ||
549 | // Fetch landmark | 579 | // Fetch landmark |
550 | LLUUID lmid = tpReq.Info.LandmarkID; | 580 | LLUUID lmid = tpReq.Info.LandmarkID; |
551 | AssetBase lma = this.m_assetCache.GetAsset(lmid); | 581 | AssetBase lma = m_assetCache.GetAsset(lmid); |
552 | if (lma != null) | 582 | if (lma != null) |
553 | { | 583 | { |
554 | AssetLandmark lm = new AssetLandmark(lma); | 584 | AssetLandmark lm = new AssetLandmark(lma); |
@@ -558,7 +588,7 @@ namespace OpenSim.Region.ClientStack | |||
558 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 588 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); |
559 | 589 | ||
560 | tpLocal.Info.AgentID = tpReq.Info.AgentID; | 590 | tpLocal.Info.AgentID = tpReq.Info.AgentID; |
561 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark | 591 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark |
562 | tpLocal.Info.LocationID = 2; | 592 | tpLocal.Info.LocationID = 2; |
563 | tpLocal.Info.Position = lm.Position; | 593 | tpLocal.Info.Position = lm.Position; |
564 | OutPacket(tpLocal); | 594 | OutPacket(tpLocal); |
@@ -582,12 +612,13 @@ namespace OpenSim.Region.ClientStack | |||
582 | } | 612 | } |
583 | break; | 613 | break; |
584 | case PacketType.TeleportLocationRequest: | 614 | case PacketType.TeleportLocationRequest: |
585 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | 615 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket) Pack; |
586 | // Console.WriteLine(tpLocReq.ToString()); | 616 | // Console.WriteLine(tpLocReq.ToString()); |
587 | 617 | ||
588 | if (OnTeleportLocationRequest != null) | 618 | if (OnTeleportLocationRequest != null) |
589 | { | 619 | { |
590 | OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); | 620 | OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, |
621 | tpLocReq.Info.LookAt, 16); | ||
591 | } | 622 | } |
592 | else | 623 | else |
593 | { | 624 | { |
@@ -598,76 +629,94 @@ namespace OpenSim.Region.ClientStack | |||
598 | OutPacket(tpCancel); | 629 | OutPacket(tpCancel); |
599 | } | 630 | } |
600 | break; | 631 | break; |
601 | #endregion | 632 | |
633 | #endregion | ||
602 | 634 | ||
603 | case PacketType.MoneyBalanceRequest: | 635 | case PacketType.MoneyBalanceRequest: |
604 | SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); | 636 | SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); |
605 | break; | 637 | break; |
606 | case PacketType.UUIDNameRequest: | 638 | case PacketType.UUIDNameRequest: |
607 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; | 639 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket) Pack; |
608 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) | 640 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) |
609 | { | 641 | { |
610 | OnNameFromUUIDRequest(UUIDBlock.ID, this); | 642 | OnNameFromUUIDRequest(UUIDBlock.ID, this); |
611 | } | 643 | } |
612 | break; | 644 | break; |
613 | #region Parcel related packets | 645 | |
646 | #region Parcel related packets | ||
647 | |||
614 | case PacketType.ParcelPropertiesRequest: | 648 | case PacketType.ParcelPropertiesRequest: |
615 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | 649 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket) Pack; |
616 | if (OnParcelPropertiesRequest != null) | 650 | if (OnParcelPropertiesRequest != null) |
617 | { | 651 | { |
618 | OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); | 652 | OnParcelPropertiesRequest((int) Math.Round(propertiesRequest.ParcelData.West), |
653 | (int) Math.Round(propertiesRequest.ParcelData.South), | ||
654 | (int) Math.Round(propertiesRequest.ParcelData.East), | ||
655 | (int) Math.Round(propertiesRequest.ParcelData.North), | ||
656 | propertiesRequest.ParcelData.SequenceID, | ||
657 | propertiesRequest.ParcelData.SnapSelection, this); | ||
619 | } | 658 | } |
620 | break; | 659 | break; |
621 | case PacketType.ParcelDivide: | 660 | case PacketType.ParcelDivide: |
622 | ParcelDividePacket landDivide = (ParcelDividePacket)Pack; | 661 | ParcelDividePacket landDivide = (ParcelDividePacket) Pack; |
623 | if (OnParcelDivideRequest != null) | 662 | if (OnParcelDivideRequest != null) |
624 | { | 663 | { |
625 | OnParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), (int)Math.Round(landDivide.ParcelData.South), (int)Math.Round(landDivide.ParcelData.East), (int)Math.Round(landDivide.ParcelData.North), this); | 664 | OnParcelDivideRequest((int) Math.Round(landDivide.ParcelData.West), |
665 | (int) Math.Round(landDivide.ParcelData.South), | ||
666 | (int) Math.Round(landDivide.ParcelData.East), | ||
667 | (int) Math.Round(landDivide.ParcelData.North), this); | ||
626 | } | 668 | } |
627 | break; | 669 | break; |
628 | case PacketType.ParcelJoin: | 670 | case PacketType.ParcelJoin: |
629 | ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; | 671 | ParcelJoinPacket landJoin = (ParcelJoinPacket) Pack; |
630 | if (OnParcelJoinRequest != null) | 672 | if (OnParcelJoinRequest != null) |
631 | { | 673 | { |
632 | OnParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), (int)Math.Round(landJoin.ParcelData.South), (int)Math.Round(landJoin.ParcelData.East), (int)Math.Round(landJoin.ParcelData.North), this); | 674 | OnParcelJoinRequest((int) Math.Round(landJoin.ParcelData.West), |
675 | (int) Math.Round(landJoin.ParcelData.South), | ||
676 | (int) Math.Round(landJoin.ParcelData.East), | ||
677 | (int) Math.Round(landJoin.ParcelData.North), this); | ||
633 | } | 678 | } |
634 | break; | 679 | break; |
635 | case PacketType.ParcelPropertiesUpdate: | 680 | case PacketType.ParcelPropertiesUpdate: |
636 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; | 681 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket) Pack; |
637 | if (OnParcelPropertiesUpdateRequest != null) | 682 | if (OnParcelPropertiesUpdateRequest != null) |
638 | { | 683 | { |
639 | OnParcelPropertiesUpdateRequest(updatePacket, this); | 684 | OnParcelPropertiesUpdateRequest(updatePacket, this); |
640 | |||
641 | } | 685 | } |
642 | break; | 686 | break; |
643 | case PacketType.ParcelSelectObjects: | 687 | case PacketType.ParcelSelectObjects: |
644 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; | 688 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket) Pack; |
645 | if (OnParcelSelectObjects != null) | 689 | if (OnParcelSelectObjects != null) |
646 | { | 690 | { |
647 | OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); | 691 | OnParcelSelectObjects(selectPacket.ParcelData.LocalID, |
692 | Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); | ||
648 | } | 693 | } |
649 | break; | 694 | break; |
650 | 695 | ||
651 | case PacketType.ParcelObjectOwnersRequest: | 696 | case PacketType.ParcelObjectOwnersRequest: |
652 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; | 697 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket) Pack; |
653 | if (OnParcelObjectOwnerRequest != null) | 698 | if (OnParcelObjectOwnerRequest != null) |
654 | { | 699 | { |
655 | OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); | 700 | OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); |
656 | } | 701 | } |
657 | break; | 702 | break; |
658 | #endregion | ||
659 | 703 | ||
660 | #region Estate Packets | 704 | #endregion |
705 | |||
706 | #region Estate Packets | ||
707 | |||
661 | case PacketType.EstateOwnerMessage: | 708 | case PacketType.EstateOwnerMessage: |
662 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; | 709 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket) Pack; |
663 | if (OnEstateOwnerMessage != null) | 710 | if (OnEstateOwnerMessage != null) |
664 | { | 711 | { |
665 | OnEstateOwnerMessage(messagePacket, this); | 712 | OnEstateOwnerMessage(messagePacket, this); |
666 | } | 713 | } |
667 | break; | 714 | break; |
668 | #endregion | ||
669 | 715 | ||
670 | #region unimplemented handlers | 716 | #endregion |
717 | |||
718 | #region unimplemented handlers | ||
719 | |||
671 | case PacketType.AgentIsNowWearing: | 720 | case PacketType.AgentIsNowWearing: |
672 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | 721 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; |
673 | //Console.WriteLine(Pack.ToString()); | 722 | //Console.WriteLine(Pack.ToString()); |
@@ -675,7 +724,8 @@ namespace OpenSim.Region.ClientStack | |||
675 | case PacketType.ObjectScale: | 724 | case PacketType.ObjectScale: |
676 | //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); | 725 | //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); |
677 | break; | 726 | break; |
678 | #endregion | 727 | |
728 | #endregion | ||
679 | } | 729 | } |
680 | } | 730 | } |
681 | } | 731 | } |
@@ -721,4 +771,4 @@ namespace OpenSim.Region.ClientStack | |||
721 | OutPacket(logReply); | 771 | OutPacket(logReply); |
722 | } | 772 | } |
723 | } | 773 | } |
724 | } | 774 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 6d49e34..55f50a4 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -36,7 +36,7 @@ using libsecondlife.Packets; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | using OpenSim.Framework.Communications.Cache; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using Timer = System.Timers.Timer; | 39 | using Timer=System.Timers.Timer; |
40 | 40 | ||
41 | namespace OpenSim.Region.ClientStack | 41 | namespace OpenSim.Region.ClientStack |
42 | { | 42 | { |
@@ -50,8 +50,11 @@ namespace OpenSim.Region.ClientStack | |||
50 | { | 50 | { |
51 | public static TerrainManager TerrainManager; | 51 | public static TerrainManager TerrainManager; |
52 | 52 | ||
53 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 53 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = |
54 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance | 54 | new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
55 | |||
56 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); | ||
57 | //local handlers for this instance | ||
55 | 58 | ||
56 | private LLUUID m_sessionId; | 59 | private LLUUID m_sessionId; |
57 | public LLUUID SecureSessionID = LLUUID.Zero; | 60 | public LLUUID SecureSessionID = LLUUID.Zero; |
@@ -84,7 +87,9 @@ namespace OpenSim.Region.ClientStack | |||
84 | private int probesWithNoIngressPackets = 0; | 87 | private int probesWithNoIngressPackets = 0; |
85 | private int lastPacketsReceived = 0; | 88 | private int lastPacketsReceived = 0; |
86 | 89 | ||
87 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) | 90 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, |
91 | IScene scene, AssetCache assetCache, PacketServer packServer, | ||
92 | AgentCircuitManager authenSessions) | ||
88 | { | 93 | { |
89 | m_moneyBalance = 1000; | 94 | m_moneyBalance = 1000; |
90 | 95 | ||
@@ -96,11 +101,11 @@ namespace OpenSim.Region.ClientStack | |||
96 | // m_inventoryCache = inventoryCache; | 101 | // m_inventoryCache = inventoryCache; |
97 | m_authenticateSessionsHandler = authenSessions; | 102 | m_authenticateSessionsHandler = authenSessions; |
98 | 103 | ||
99 | MainLog.Instance.Verbose("CLIENT","Started up new client thread to handle incoming request"); | 104 | MainLog.Instance.Verbose("CLIENT", "Started up new client thread to handle incoming request"); |
100 | cirpack = initialcirpack; | 105 | cirpack = initialcirpack; |
101 | userEP = remoteEP; | 106 | userEP = remoteEP; |
102 | 107 | ||
103 | this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); | 108 | startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); |
104 | 109 | ||
105 | PacketQueue = new BlockingQueue<QueItem>(); | 110 | PacketQueue = new BlockingQueue<QueItem>(); |
106 | 111 | ||
@@ -109,7 +114,7 @@ namespace OpenSim.Region.ClientStack | |||
109 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | 114 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); |
110 | AckTimer.Start(); | 115 | AckTimer.Start(); |
111 | 116 | ||
112 | this.RegisterLocalPacketHandlers(); | 117 | RegisterLocalPacketHandlers(); |
113 | 118 | ||
114 | ClientThread = new Thread(new ThreadStart(AuthUser)); | 119 | ClientThread = new Thread(new ThreadStart(AuthUser)); |
115 | ClientThread.IsBackground = true; | 120 | ClientThread.IsBackground = true; |
@@ -121,7 +126,7 @@ namespace OpenSim.Region.ClientStack | |||
121 | get { return m_sessionId; } | 126 | get { return m_sessionId; } |
122 | } | 127 | } |
123 | 128 | ||
124 | public void SetDebug(int newDebug) | 129 | public void SetDebug(int newDebug) |
125 | { | 130 | { |
126 | debug = newDebug; | 131 | debug = newDebug; |
127 | } | 132 | } |
@@ -132,14 +137,15 @@ namespace OpenSim.Region.ClientStack | |||
132 | { | 137 | { |
133 | clientPingTimer.Stop(); | 138 | clientPingTimer.Stop(); |
134 | 139 | ||
135 | m_scene.RemoveClient(this.AgentId); | 140 | m_scene.RemoveClient(AgentId); |
136 | 141 | ||
137 | this.ClientThread.Abort(); | 142 | ClientThread.Abort(); |
138 | } | 143 | } |
139 | 144 | ||
140 | #endregion | 145 | #endregion |
141 | 146 | ||
142 | # region Packet Handling | 147 | # region Packet Handling |
148 | |||
143 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) | 149 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) |
144 | { | 150 | { |
145 | bool result = false; | 151 | bool result = false; |
@@ -195,23 +201,27 @@ namespace OpenSim.Region.ClientStack | |||
195 | 201 | ||
196 | protected void DebugPacket(string direction, Packet packet) | 202 | protected void DebugPacket(string direction, Packet packet) |
197 | { | 203 | { |
198 | if (debug > 0) { | 204 | if (debug > 0) |
205 | { | ||
199 | string info; | 206 | string info; |
200 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) | 207 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) |
201 | return; | 208 | return; |
202 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) | 209 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) |
203 | return; | 210 | return; |
204 | if (debug < 253 && ( | 211 | if (debug < 253 && ( |
205 | packet.Type == PacketType.CompletePingCheck || | 212 | packet.Type == PacketType.CompletePingCheck || |
206 | packet.Type == PacketType.StartPingCheck | 213 | packet.Type == PacketType.StartPingCheck |
207 | ) ) | 214 | )) |
208 | return; | 215 | return; |
209 | if (debug < 252 && packet.Type == PacketType.PacketAck) | 216 | if (debug < 252 && packet.Type == PacketType.PacketAck) |
210 | return; | 217 | return; |
211 | 218 | ||
212 | if (debug > 1) { | 219 | if (debug > 1) |
220 | { | ||
213 | info = packet.ToString(); | 221 | info = packet.ToString(); |
214 | } else { | 222 | } |
223 | else | ||
224 | { | ||
215 | info = packet.Type.ToString(); | 225 | info = packet.Type.ToString(); |
216 | } | 226 | } |
217 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); | 227 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); |
@@ -242,6 +252,7 @@ namespace OpenSim.Region.ClientStack | |||
242 | } | 252 | } |
243 | } | 253 | } |
244 | } | 254 | } |
255 | |||
245 | # endregion | 256 | # endregion |
246 | 257 | ||
247 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) | 258 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) |
@@ -251,7 +262,7 @@ namespace OpenSim.Region.ClientStack | |||
251 | probesWithNoIngressPackets++; | 262 | probesWithNoIngressPackets++; |
252 | if (probesWithNoIngressPackets > 30) | 263 | if (probesWithNoIngressPackets > 30) |
253 | { | 264 | { |
254 | if( OnConnectionClosed != null ) | 265 | if (OnConnectionClosed != null) |
255 | { | 266 | { |
256 | OnConnectionClosed(this); | 267 | OnConnectionClosed(this); |
257 | } | 268 | } |
@@ -278,14 +289,16 @@ namespace OpenSim.Region.ClientStack | |||
278 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 289 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); |
279 | clientPingTimer.Enabled = true; | 290 | clientPingTimer.Enabled = true; |
280 | 291 | ||
281 | MainLog.Instance.Verbose("CLIENT","Adding viewer agent to scene"); | 292 | MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene"); |
282 | this.m_scene.AddNewClient(this, true); | 293 | m_scene.AddNewClient(this, true); |
283 | } | 294 | } |
284 | 295 | ||
285 | protected virtual void AuthUser() | 296 | protected virtual void AuthUser() |
286 | { | 297 | { |
287 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); | 298 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); |
288 | AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | 299 | AuthenticateResponse sessionInfo = |
300 | m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, | ||
301 | cirpack.CircuitCode.Code); | ||
289 | if (!sessionInfo.Authorised) | 302 | if (!sessionInfo.Authorised) |
290 | { | 303 | { |
291 | //session/circuit not authorised | 304 | //session/circuit not authorised |
@@ -297,27 +310,26 @@ namespace OpenSim.Region.ClientStack | |||
297 | MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); | 310 | MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); |
298 | //session is authorised | 311 | //session is authorised |
299 | m_agentId = cirpack.CircuitCode.ID; | 312 | m_agentId = cirpack.CircuitCode.ID; |
300 | this.m_sessionId = cirpack.CircuitCode.SessionID; | 313 | m_sessionId = cirpack.CircuitCode.SessionID; |
301 | this.m_circuitCode = cirpack.CircuitCode.Code; | 314 | m_circuitCode = cirpack.CircuitCode.Code; |
302 | this.firstName = sessionInfo.LoginInfo.First; | 315 | firstName = sessionInfo.LoginInfo.First; |
303 | this.lastName = sessionInfo.LoginInfo.Last; | 316 | lastName = sessionInfo.LoginInfo.Last; |
304 | 317 | ||
305 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) | 318 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) |
306 | { | 319 | { |
307 | this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; | 320 | SecureSessionID = sessionInfo.LoginInfo.SecureSession; |
308 | } | 321 | } |
309 | InitNewClient(); | 322 | InitNewClient(); |
310 | 323 | ||
311 | ClientLoop(); | 324 | ClientLoop(); |
312 | } | 325 | } |
313 | } | 326 | } |
314 | # endregion | ||
315 | 327 | ||
328 | # endregion | ||
316 | 329 | ||
317 | protected void KillThread() | 330 | protected void KillThread() |
318 | { | 331 | { |
319 | this.ClientThread.Abort(); | 332 | ClientThread.Abort(); |
320 | } | 333 | } |
321 | |||
322 | } | 334 | } |
323 | } | 335 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 1b64602..f75536a 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -25,15 +25,11 @@ | |||
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; | ||
29 | using System.Net; | 28 | using System.Net; |
30 | using System.Net.Sockets; | 29 | using System.Net.Sockets; |
31 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
32 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications.Cache; | 32 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Interfaces; | ||
36 | using libsecondlife; | ||
37 | 33 | ||
38 | namespace OpenSim.Region.ClientStack | 34 | namespace OpenSim.Region.ClientStack |
39 | { | 35 | { |
@@ -56,10 +52,7 @@ namespace OpenSim.Region.ClientStack | |||
56 | 52 | ||
57 | public IScene LocalScene | 53 | public IScene LocalScene |
58 | { | 54 | { |
59 | set | 55 | set { m_scene = value; } |
60 | { | ||
61 | this.m_scene = value; | ||
62 | } | ||
63 | } | 56 | } |
64 | 57 | ||
65 | /// <summary> | 58 | /// <summary> |
@@ -72,17 +65,21 @@ namespace OpenSim.Region.ClientStack | |||
72 | m_scene.ClientManager.InPacket(circuitCode, packet); | 65 | m_scene.ClientManager.InPacket(circuitCode, packet); |
73 | } | 66 | } |
74 | 67 | ||
75 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) | 68 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, |
69 | ClientManager clientManager, IScene scene, AssetCache assetCache, | ||
70 | PacketServer packServer, AgentCircuitManager authenSessions) | ||
76 | { | 71 | { |
77 | return new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions ); | 72 | return |
73 | new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions); | ||
78 | } | 74 | } |
79 | 75 | ||
80 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass) | 76 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, |
77 | AgentCircuitManager authenticateSessionsClass) | ||
81 | { | 78 | { |
82 | IClientAPI newuser; | 79 | IClientAPI newuser; |
83 | 80 | ||
84 | if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) | 81 | if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) |
85 | { | 82 | { |
86 | return false; | 83 | return false; |
87 | } | 84 | } |
88 | else | 85 | else |
@@ -104,7 +101,7 @@ namespace OpenSim.Region.ClientStack | |||
104 | { | 101 | { |
105 | client.SendLogoutPacket(); | 102 | client.SendLogoutPacket(); |
106 | 103 | ||
107 | CloseClient( client ); | 104 | CloseClient(client); |
108 | } | 105 | } |
109 | 106 | ||
110 | 107 | ||
@@ -117,7 +114,7 @@ namespace OpenSim.Region.ClientStack | |||
117 | /// <param name="circuitcode"></param> | 114 | /// <param name="circuitcode"></param> |
118 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) | 115 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
119 | { | 116 | { |
120 | this.m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); | 117 | m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); |
121 | } | 118 | } |
122 | 119 | ||
123 | /// <summary> | 120 | /// <summary> |
@@ -126,13 +123,13 @@ namespace OpenSim.Region.ClientStack | |||
126 | /// <param name="circuitcode"></param> | 123 | /// <param name="circuitcode"></param> |
127 | public virtual void CloseCircuit(uint circuitcode) | 124 | public virtual void CloseCircuit(uint circuitcode) |
128 | { | 125 | { |
129 | m_networkHandler.RemoveClientCircuit( circuitcode ); | 126 | m_networkHandler.RemoveClientCircuit(circuitcode); |
130 | m_scene.ClientManager.CloseAllAgents(circuitcode); | 127 | m_scene.ClientManager.CloseAllAgents(circuitcode); |
131 | } | 128 | } |
132 | 129 | ||
133 | public virtual void CloseClient( IClientAPI client ) | 130 | public virtual void CloseClient(IClientAPI client) |
134 | { | 131 | { |
135 | CloseCircuit( client.CircuitCode ); | 132 | CloseCircuit(client.CircuitCode); |
136 | } | 133 | } |
137 | } | 134 | } |
138 | } | 135 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 657af54..7551bff 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -28,17 +28,15 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using libsecondlife; | ||
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications; | ||
32 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Physics.Manager; | ||
38 | using OpenSim.Region.Environment; | 37 | using OpenSim.Region.Environment; |
39 | using libsecondlife; | ||
40 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Region.Physics.Manager; |
42 | 40 | ||
43 | namespace OpenSim.Region.ClientStack | 41 | namespace OpenSim.Region.ClientStack |
44 | { | 42 | { |
@@ -67,9 +65,8 @@ namespace OpenSim.Region.ClientStack | |||
67 | m_startuptime = DateTime.Now; | 65 | m_startuptime = DateTime.Now; |
68 | } | 66 | } |
69 | 67 | ||
70 | virtual public void StartUp() | 68 | public virtual void StartUp() |
71 | { | 69 | { |
72 | |||
73 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | 70 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); |
74 | 71 | ||
75 | Initialize(); | 72 | Initialize(); |
@@ -116,7 +113,10 @@ namespace OpenSim.Region.ClientStack | |||
116 | scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); | 113 | scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); |
117 | 114 | ||
118 | //Master Avatar Setup | 115 | //Master Avatar Setup |
119 | UserProfileData masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); | 116 | UserProfileData masterAvatar = |
117 | m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, | ||
118 | scene.RegionInfo.MasterAvatarLastName, | ||
119 | scene.RegionInfo.MasterAvatarSandboxPassword); | ||
120 | if (masterAvatar != null) | 120 | if (masterAvatar != null) |
121 | { | 121 | { |
122 | m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); | 122 | m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); |
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ClientStack | |||
126 | else | 126 | else |
127 | { | 127 | { |
128 | m_log.Verbose("PARCEL", "No master avatar found, using null."); | 128 | m_log.Verbose("PARCEL", "No master avatar found, using null."); |
129 | scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; | 129 | scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; |
130 | //TODO: Load parcels from storageManager | 130 | //TODO: Load parcels from storageManager |
131 | } | 131 | } |
132 | 132 | ||
@@ -138,8 +138,7 @@ namespace OpenSim.Region.ClientStack | |||
138 | return scene; | 138 | return scene; |
139 | } | 139 | } |
140 | 140 | ||
141 | protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager); | 141 | protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
142 | 142 | AgentCircuitManager circuitManager); | |
143 | |||
144 | } | 143 | } |
145 | } | 144 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 584b80c..e5965cb 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -32,13 +32,10 @@ using System.Net.Sockets; | |||
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Interfaces; | ||
38 | 36 | ||
39 | namespace OpenSim.Region.ClientStack | 37 | namespace OpenSim.Region.ClientStack |
40 | { | 38 | { |
41 | |||
42 | public class UDPServer : ClientStackNetworkHandler | 39 | public class UDPServer : ClientStackNetworkHandler |
43 | { | 40 | { |
44 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | 41 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); |
@@ -59,22 +56,16 @@ namespace OpenSim.Region.ClientStack | |||
59 | 56 | ||
60 | public PacketServer PacketServer | 57 | public PacketServer PacketServer |
61 | { | 58 | { |
62 | get | 59 | get { return m_packetServer; } |
63 | { | 60 | set { m_packetServer = value; } |
64 | return m_packetServer; | ||
65 | } | ||
66 | set | ||
67 | { | ||
68 | m_packetServer = value; | ||
69 | } | ||
70 | } | 61 | } |
71 | 62 | ||
72 | public IScene LocalScene | 63 | public IScene LocalScene |
73 | { | 64 | { |
74 | set | 65 | set |
75 | { | 66 | { |
76 | this.m_localScene = value; | 67 | m_localScene = value; |
77 | this.m_packetServer.LocalScene = this.m_localScene; | 68 | m_packetServer.LocalScene = m_localScene; |
78 | } | 69 | } |
79 | } | 70 | } |
80 | 71 | ||
@@ -85,10 +76,10 @@ namespace OpenSim.Region.ClientStack | |||
85 | public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) | 76 | public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) |
86 | { | 77 | { |
87 | listenPort = port; | 78 | listenPort = port; |
88 | this.m_assetCache = assetCache; | 79 | m_assetCache = assetCache; |
89 | this.m_log = console; | 80 | m_log = console; |
90 | this.m_authenticateSessionsClass = authenticateClass; | 81 | m_authenticateSessionsClass = authenticateClass; |
91 | this.CreatePacketServer(); | 82 | CreatePacketServer(); |
92 | } | 83 | } |
93 | 84 | ||
94 | protected virtual void CreatePacketServer() | 85 | protected virtual void CreatePacketServer() |
@@ -99,7 +90,7 @@ namespace OpenSim.Region.ClientStack | |||
99 | protected virtual void OnReceivedData(IAsyncResult result) | 90 | protected virtual void OnReceivedData(IAsyncResult result) |
100 | { | 91 | { |
101 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 92 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
102 | epSender = (EndPoint)ipeSender; | 93 | epSender = (EndPoint) ipeSender; |
103 | Packet packet = null; | 94 | Packet packet = null; |
104 | 95 | ||
105 | int numBytes; | 96 | int numBytes; |
@@ -108,7 +99,7 @@ namespace OpenSim.Region.ClientStack | |||
108 | { | 99 | { |
109 | numBytes = Server.EndReceiveFrom(result, ref epSender); | 100 | numBytes = Server.EndReceiveFrom(result, ref epSender); |
110 | } | 101 | } |
111 | catch (System.Net.Sockets.SocketException e) | 102 | catch (SocketException e) |
112 | { | 103 | { |
113 | // TODO : Actually only handle those states that we have control over, re-throw everything else, | 104 | // TODO : Actually only handle those states that we have control over, re-throw everything else, |
114 | // TODO: implement cases as we encounter them. | 105 | // TODO: implement cases as we encounter them. |
@@ -134,7 +125,7 @@ namespace OpenSim.Region.ClientStack | |||
134 | if (clientCircuits.TryGetValue(epSender, out circuit)) | 125 | if (clientCircuits.TryGetValue(epSender, out circuit)) |
135 | { | 126 | { |
136 | //if so then send packet to the packetserver | 127 | //if so then send packet to the packetserver |
137 | this.m_packetServer.InPacket(circuit, packet); | 128 | m_packetServer.InPacket(circuit, packet); |
138 | } | 129 | } |
139 | else if (packet.Type == PacketType.UseCircuitCode) | 130 | else if (packet.Type == PacketType.UseCircuitCode) |
140 | { | 131 | { |
@@ -142,7 +133,8 @@ namespace OpenSim.Region.ClientStack | |||
142 | AddNewClient(packet); | 133 | AddNewClient(packet); |
143 | } | 134 | } |
144 | else | 135 | else |
145 | { // invalid client | 136 | { |
137 | // invalid client | ||
146 | m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); | 138 | m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); |
147 | } | 139 | } |
148 | 140 | ||
@@ -160,10 +152,10 @@ namespace OpenSim.Region.ClientStack | |||
160 | 152 | ||
161 | protected virtual void AddNewClient(Packet packet) | 153 | protected virtual void AddNewClient(Packet packet) |
162 | { | 154 | { |
163 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; | 155 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; |
164 | this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); | 156 | clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); |
165 | 157 | ||
166 | this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); | 158 | PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); |
167 | } | 159 | } |
168 | 160 | ||
169 | public void ServerListener() | 161 | public void ServerListener() |
@@ -177,24 +169,24 @@ namespace OpenSim.Region.ClientStack | |||
177 | m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen"); | 169 | m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen"); |
178 | 170 | ||
179 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 171 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
180 | epSender = (EndPoint)ipeSender; | 172 | epSender = (EndPoint) ipeSender; |
181 | ReceivedData = new AsyncCallback(this.OnReceivedData); | 173 | ReceivedData = new AsyncCallback(OnReceivedData); |
182 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 174 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
183 | 175 | ||
184 | m_log.Status("SERVER", "Listening..."); | 176 | m_log.Status("SERVER", "Listening..."); |
185 | |||
186 | } | 177 | } |
187 | 178 | ||
188 | public virtual void RegisterPacketServer(PacketServer server) | 179 | public virtual void RegisterPacketServer(PacketServer server) |
189 | { | 180 | { |
190 | this.m_packetServer = server; | 181 | m_packetServer = server; |
191 | } | 182 | } |
192 | 183 | ||
193 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) | 184 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
185 | //EndPoint packetSender) | ||
194 | { | 186 | { |
195 | // find the endpoint for this circuit | 187 | // find the endpoint for this circuit |
196 | EndPoint sendto = null; | 188 | EndPoint sendto = null; |
197 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | 189 | foreach (KeyValuePair<EndPoint, uint> p in clientCircuits) |
198 | { | 190 | { |
199 | if (p.Value == circuitcode) | 191 | if (p.Value == circuitcode) |
200 | { | 192 | { |
@@ -205,22 +197,20 @@ namespace OpenSim.Region.ClientStack | |||
205 | if (sendto != null) | 197 | if (sendto != null) |
206 | { | 198 | { |
207 | //we found the endpoint so send the packet to it | 199 | //we found the endpoint so send the packet to it |
208 | this.Server.SendTo(buffer, size, flags, sendto); | 200 | Server.SendTo(buffer, size, flags, sendto); |
209 | } | 201 | } |
210 | } | 202 | } |
211 | 203 | ||
212 | public virtual void RemoveClientCircuit(uint circuitcode) | 204 | public virtual void RemoveClientCircuit(uint circuitcode) |
213 | { | 205 | { |
214 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | 206 | foreach (KeyValuePair<EndPoint, uint> p in clientCircuits) |
215 | { | 207 | { |
216 | if (p.Value == circuitcode) | 208 | if (p.Value == circuitcode) |
217 | { | 209 | { |
218 | this.clientCircuits.Remove(p.Key); | 210 | clientCircuits.Remove(p.Key); |
219 | break; | 211 | break; |
220 | } | 212 | } |
221 | } | 213 | } |
222 | } | 214 | } |
223 | |||
224 | |||
225 | } | 215 | } |
226 | } \ No newline at end of file | 216 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index ef5150f..eac293e 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -25,32 +25,30 @@ | |||
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; | ||
28 | using OpenSim.Framework.Communications; | 29 | using OpenSim.Framework.Communications; |
29 | using OpenSim.Framework.Communications.Cache; | 30 | using OpenSim.Framework.Communications.Cache; |
30 | using OpenSim.Framework.Interfaces; | 31 | using OpenSim.Framework.Interfaces; |
31 | using OpenSim.Framework.Servers; | 32 | using OpenSim.Framework.Servers; |
32 | using OpenSim.Framework; | ||
33 | 33 | ||
34 | namespace OpenSim.Region.Communications.Local | 34 | namespace OpenSim.Region.Communications.Local |
35 | { | 35 | { |
36 | public class CommunicationsLocal : CommunicationsManager | 36 | public class CommunicationsLocal : CommunicationsManager |
37 | { | 37 | { |
38 | public CommunicationsLocal( | 38 | public CommunicationsLocal( |
39 | NetworkServersInfo serversInfo, | 39 | NetworkServersInfo serversInfo, |
40 | BaseHttpServer httpServer, | 40 | BaseHttpServer httpServer, |
41 | AssetCache assetCache, | 41 | AssetCache assetCache, |
42 | IUserService userService, | 42 | IUserService userService, |
43 | LocalInventoryService inventoryService, | 43 | LocalInventoryService inventoryService, |
44 | IInterRegionCommunications interRegionService, | 44 | IInterRegionCommunications interRegionService, |
45 | IGridServices gridService, bool dumpAssetsToFile ) | 45 | IGridServices gridService, bool dumpAssetsToFile) |
46 | : base(serversInfo, httpServer, assetCache, dumpAssetsToFile) | 46 | : base(serversInfo, httpServer, assetCache, dumpAssetsToFile) |
47 | { | 47 | { |
48 | m_inventoryService = inventoryService; | 48 | m_inventoryService = inventoryService; |
49 | m_userService = userService; | 49 | m_userService = userService; |
50 | m_gridService = gridService; | 50 | m_gridService = gridService; |
51 | m_interRegion = interRegionService; | 51 | m_interRegion = interRegionService; |
52 | |||
53 | } | 52 | } |
54 | |||
55 | } | 53 | } |
56 | } | 54 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 99c4bc3..3a0b47f 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -25,25 +25,25 @@ | |||
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; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using libsecondlife; | 30 | using libsecondlife; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Communications; | 32 | using OpenSim.Framework.Communications; |
32 | using OpenSim.Framework; | ||
33 | using System.Collections; | ||
34 | 33 | ||
35 | namespace OpenSim.Region.Communications.Local | 34 | namespace OpenSim.Region.Communications.Local |
36 | { | 35 | { |
37 | |||
38 | public class LocalBackEndServices : IGridServices, IInterRegionCommunications | 36 | public class LocalBackEndServices : IGridServices, IInterRegionCommunications |
39 | { | 37 | { |
40 | protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>(); | 38 | protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>(); |
41 | protected Dictionary<ulong, RegionCommsListener> m_regionListeners = new Dictionary<ulong, RegionCommsListener>(); | 39 | |
40 | protected Dictionary<ulong, RegionCommsListener> m_regionListeners = | ||
41 | new Dictionary<ulong, RegionCommsListener>(); | ||
42 | |||
42 | private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); | 43 | private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); |
43 | 44 | ||
44 | public LocalBackEndServices() | 45 | public LocalBackEndServices() |
45 | { | 46 | { |
46 | |||
47 | } | 47 | } |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
@@ -54,13 +54,13 @@ namespace OpenSim.Region.Communications.Local | |||
54 | public RegionCommsListener RegisterRegion(RegionInfo regionInfo) | 54 | public RegionCommsListener RegisterRegion(RegionInfo regionInfo) |
55 | { | 55 | { |
56 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | 56 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); |
57 | if (!this.m_regions.ContainsKey((uint)regionInfo.RegionHandle)) | 57 | if (!m_regions.ContainsKey((uint) regionInfo.RegionHandle)) |
58 | { | 58 | { |
59 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | 59 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); |
60 | this.m_regions.Add(regionInfo.RegionHandle, regionInfo); | 60 | m_regions.Add(regionInfo.RegionHandle, regionInfo); |
61 | 61 | ||
62 | RegionCommsListener regionHost = new RegionCommsListener(); | 62 | RegionCommsListener regionHost = new RegionCommsListener(); |
63 | this.m_regionListeners.Add(regionInfo.RegionHandle, regionHost); | 63 | m_regionListeners.Add(regionInfo.RegionHandle, regionHost); |
64 | 64 | ||
65 | return regionHost; | 65 | return regionHost; |
66 | } | 66 | } |
@@ -103,9 +103,9 @@ namespace OpenSim.Region.Communications.Local | |||
103 | /// <returns></returns> | 103 | /// <returns></returns> |
104 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) | 104 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) |
105 | { | 105 | { |
106 | if (this.m_regions.ContainsKey(regionHandle)) | 106 | if (m_regions.ContainsKey(regionHandle)) |
107 | { | 107 | { |
108 | return this.m_regions[regionHandle]; | 108 | return m_regions[regionHandle]; |
109 | } | 109 | } |
110 | return null; | 110 | return null; |
111 | } | 111 | } |
@@ -121,16 +121,18 @@ namespace OpenSim.Region.Communications.Local | |||
121 | public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | 121 | public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) |
122 | { | 122 | { |
123 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | 123 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
124 | foreach (RegionInfo regInfo in this.m_regions.Values) | 124 | foreach (RegionInfo regInfo in m_regions.Values) |
125 | { | 125 | { |
126 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) | 126 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && |
127 | ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) | ||
127 | { | 128 | { |
128 | MapBlockData map = new MapBlockData(); | 129 | MapBlockData map = new MapBlockData(); |
129 | map.Name = regInfo.RegionName; | 130 | map.Name = regInfo.RegionName; |
130 | map.X = (ushort)regInfo.RegionLocX; | 131 | map.X = (ushort) regInfo.RegionLocX; |
131 | map.Y = (ushort)regInfo.RegionLocY; | 132 | map.Y = (ushort) regInfo.RegionLocY; |
132 | map.WaterHeight = (byte)regInfo.EstateSettings.waterHeight; | 133 | map.WaterHeight = (byte) regInfo.EstateSettings.waterHeight; |
133 | map.MapImageId = regInfo.EstateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); | 134 | map.MapImageId = regInfo.EstateSettings.terrainImageID; |
135 | //new LLUUID("00000000-0000-0000-9999-000000000007"); | ||
134 | map.Agents = 1; | 136 | map.Agents = 1; |
135 | map.RegionFlags = 72458694; | 137 | map.RegionFlags = 72458694; |
136 | map.Access = 13; | 138 | map.Access = 13; |
@@ -145,13 +147,14 @@ namespace OpenSim.Region.Communications.Local | |||
145 | /// <param name="regionHandle"></param> | 147 | /// <param name="regionHandle"></param> |
146 | /// <param name="agentData"></param> | 148 | /// <param name="agentData"></param> |
147 | /// <returns></returns> | 149 | /// <returns></returns> |
148 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | 150 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
151 | //should change from agentCircuitData | ||
149 | { | 152 | { |
150 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | 153 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); |
151 | if (this.m_regionListeners.ContainsKey(regionHandle)) | 154 | if (m_regionListeners.ContainsKey(regionHandle)) |
152 | { | 155 | { |
153 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | 156 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); |
154 | this.m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData); | 157 | m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData); |
155 | return true; | 158 | return true; |
156 | } | 159 | } |
157 | return false; | 160 | return false; |
@@ -166,10 +169,10 @@ namespace OpenSim.Region.Communications.Local | |||
166 | /// <returns></returns> | 169 | /// <returns></returns> |
167 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 170 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
168 | { | 171 | { |
169 | if (this.m_regionListeners.ContainsKey(regionHandle)) | 172 | if (m_regionListeners.ContainsKey(regionHandle)) |
170 | { | 173 | { |
171 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); | 174 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); |
172 | this.m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 175 | m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
173 | return true; | 176 | return true; |
174 | } | 177 | } |
175 | return false; | 178 | return false; |
@@ -177,7 +180,7 @@ namespace OpenSim.Region.Communications.Local | |||
177 | 180 | ||
178 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) | 181 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) |
179 | { | 182 | { |
180 | if (this.m_regionListeners.ContainsKey(regionHandle)) | 183 | if (m_regionListeners.ContainsKey(regionHandle)) |
181 | { | 184 | { |
182 | return true; | 185 | return true; |
183 | } | 186 | } |
@@ -210,15 +213,15 @@ namespace OpenSim.Region.Communications.Local | |||
210 | 213 | ||
211 | public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) | 214 | public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) |
212 | { | 215 | { |
213 | if (this.m_regionListeners.ContainsKey(regionHandle)) | 216 | if (m_regionListeners.ContainsKey(regionHandle)) |
214 | { | 217 | { |
215 | this.m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent); | 218 | m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent); |
216 | } | 219 | } |
217 | } | 220 | } |
218 | 221 | ||
219 | public void PingCheckReply(Hashtable respData) | 222 | public void PingCheckReply(Hashtable respData) |
220 | { | 223 | { |
221 | foreach (ulong region in this.m_regions.Keys) | 224 | foreach (ulong region in m_regions.Keys) |
222 | { | 225 | { |
223 | Hashtable regData = new Hashtable(); | 226 | Hashtable regData = new Hashtable(); |
224 | RegionInfo reg = m_regions[region]; | 227 | RegionInfo reg = m_regions[region]; |
@@ -234,7 +237,7 @@ namespace OpenSim.Region.Communications.Local | |||
234 | if (m_regionListeners.ContainsKey(regionHandle)) | 237 | if (m_regionListeners.ContainsKey(regionHandle)) |
235 | { | 238 | { |
236 | return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, | 239 | return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, |
237 | isFlying); | 240 | isFlying); |
238 | } | 241 | } |
239 | 242 | ||
240 | return false; | 243 | return false; |
@@ -250,11 +253,5 @@ namespace OpenSim.Region.Communications.Local | |||
250 | 253 | ||
251 | return false; | 254 | return false; |
252 | } | 255 | } |
253 | |||
254 | |||
255 | |||
256 | } | 256 | } |
257 | } | 257 | } \ No newline at end of file |
258 | |||
259 | |||
260 | |||
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index b7d78bc..c38e922 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -28,29 +28,28 @@ | |||
28 | 28 | ||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Framework.Communications; | 32 | using OpenSim.Framework.Communications; |
32 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Framework; | ||
34 | 34 | ||
35 | namespace OpenSim.Region.Communications.Local | 35 | namespace OpenSim.Region.Communications.Local |
36 | { | 36 | { |
37 | public class LocalInventoryService : InventoryServiceBase | 37 | public class LocalInventoryService : InventoryServiceBase |
38 | { | 38 | { |
39 | |||
40 | public LocalInventoryService() | 39 | public LocalInventoryService() |
41 | { | 40 | { |
42 | |||
43 | } | 41 | } |
44 | 42 | ||
45 | public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) | 43 | public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, |
44 | InventoryItemInfo itemCallBack) | ||
46 | { | 45 | { |
47 | List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); | 46 | List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID); |
48 | InventoryFolderImpl rootFolder = null; | 47 | InventoryFolderImpl rootFolder = null; |
49 | 48 | ||
50 | //need to make sure we send root folder first | 49 | //need to make sure we send root folder first |
51 | foreach (InventoryFolderBase folder in folders) | 50 | foreach (InventoryFolderBase folder in folders) |
52 | { | 51 | { |
53 | if (folder.parentID == libsecondlife.LLUUID.Zero) | 52 | if (folder.parentID == LLUUID.Zero) |
54 | { | 53 | { |
55 | InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); | 54 | InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); |
56 | rootFolder = newfolder; | 55 | rootFolder = newfolder; |
@@ -67,7 +66,7 @@ namespace OpenSim.Region.Communications.Local | |||
67 | InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); | 66 | InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); |
68 | folderCallBack(userID, newfolder); | 67 | folderCallBack(userID, newfolder); |
69 | 68 | ||
70 | List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); | 69 | List<InventoryItemBase> items = RequestFolderItems(newfolder.folderID); |
71 | foreach (InventoryItemBase item in items) | 70 | foreach (InventoryItemBase item in items) |
72 | { | 71 | { |
73 | itemCallBack(userID, item); | 72 | itemCallBack(userID, item); |
@@ -79,17 +78,17 @@ namespace OpenSim.Region.Communications.Local | |||
79 | 78 | ||
80 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) | 79 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) |
81 | { | 80 | { |
82 | this.AddFolder(folder); | 81 | AddFolder(folder); |
83 | } | 82 | } |
84 | 83 | ||
85 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 84 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
86 | { | 85 | { |
87 | this.AddItem(item); | 86 | AddItem(item); |
88 | } | 87 | } |
89 | 88 | ||
90 | public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) | 89 | public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) |
91 | { | 90 | { |
92 | this.deleteItem(item); | 91 | deleteItem(item); |
93 | } | 92 | } |
94 | } | 93 | } |
95 | } | 94 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 1043683..aa1a0d9 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs | |||
@@ -30,9 +30,9 @@ using System; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Framework.UserManagement; | 34 | using OpenSim.Framework.UserManagement; |
35 | using InventoryFolder=OpenSim.Framework.InventoryFolder; | ||
36 | 36 | ||
37 | namespace OpenSim.Region.Communications.Local | 37 | namespace OpenSim.Region.Communications.Local |
38 | { | 38 | { |
@@ -49,23 +49,23 @@ namespace OpenSim.Region.Communications.Local | |||
49 | 49 | ||
50 | public event LoginToRegionEvent OnLoginToRegion; | 50 | public event LoginToRegionEvent OnLoginToRegion; |
51 | 51 | ||
52 | public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) | 52 | public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, |
53 | NetworkServersInfo serversInfo, bool authenticate) | ||
53 | : base(userManager, welcomeMess) | 54 | : base(userManager, welcomeMess) |
54 | { | 55 | { |
55 | m_Parent = parent; | 56 | m_Parent = parent; |
56 | this.serversInfo = serversInfo; | 57 | this.serversInfo = serversInfo; |
57 | defaultHomeX = this.serversInfo.DefaultHomeLocX; | 58 | defaultHomeX = this.serversInfo.DefaultHomeLocX; |
58 | defaultHomeY = this.serversInfo.DefaultHomeLocY; | 59 | defaultHomeY = this.serversInfo.DefaultHomeLocY; |
59 | this.authUsers = authenticate; | 60 | authUsers = authenticate; |
60 | } | 61 | } |
61 | 62 | ||
62 | 63 | ||
63 | public override UserProfileData GetTheUser(string firstname, string lastname) | 64 | public override UserProfileData GetTheUser(string firstname, string lastname) |
64 | { | 65 | { |
65 | UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname); | 66 | UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname); |
66 | if (profile != null) | 67 | if (profile != null) |
67 | { | 68 | { |
68 | |||
69 | return profile; | 69 | return profile; |
70 | } | 70 | } |
71 | 71 | ||
@@ -73,9 +73,9 @@ namespace OpenSim.Region.Communications.Local | |||
73 | { | 73 | { |
74 | //no current user account so make one | 74 | //no current user account so make one |
75 | Console.WriteLine("No User account found so creating a new one "); | 75 | Console.WriteLine("No User account found so creating a new one "); |
76 | this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); | 76 | m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); |
77 | 77 | ||
78 | profile = this.m_userManager.GetUserProfile(firstname, lastname); | 78 | profile = m_userManager.GetUserProfile(firstname, lastname); |
79 | if (profile != null) | 79 | if (profile != null) |
80 | { | 80 | { |
81 | m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); | 81 | m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); |
@@ -113,18 +113,22 @@ namespace OpenSim.Region.Communications.Local | |||
113 | 113 | ||
114 | if (reg != null) | 114 | if (reg != null) |
115 | { | 115 | { |
116 | response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + | 116 | response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" + |
117 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 117 | (reg.RegionLocY*256).ToString() + "], " + |
118 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 118 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + |
119 | theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
120 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + | ||
121 | theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
119 | string capsPath = Util.GetRandomCapsPath(); | 122 | string capsPath = Util.GetRandomCapsPath(); |
120 | response.SimAddress = reg.ExternalEndPoint.Address.ToString(); | 123 | response.SimAddress = reg.ExternalEndPoint.Address.ToString(); |
121 | response.SimPort = (Int32)reg.ExternalEndPoint.Port; | 124 | response.SimPort = (Int32) reg.ExternalEndPoint.Port; |
122 | response.RegionX = reg.RegionLocX; | 125 | response.RegionX = reg.RegionLocX; |
123 | response.RegionY = reg.RegionLocY; | 126 | response.RegionY = reg.RegionLocY; |
124 | |||
125 | 127 | ||
126 | response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; | 128 | |
127 | // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; | 129 | response.SeedCapability = "http://" + reg.ExternalHostName + ":" + |
130 | serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; | ||
131 | // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; | ||
128 | theUser.currentAgent.currentRegion = reg.RegionID; | 132 | theUser.currentAgent.currentRegion = reg.RegionID; |
129 | theUser.currentAgent.currentHandle = reg.RegionHandle; | 133 | theUser.currentAgent.currentHandle = reg.RegionHandle; |
130 | 134 | ||
@@ -135,11 +139,11 @@ namespace OpenSim.Region.Communications.Local | |||
135 | _login.Agent = response.AgentID; | 139 | _login.Agent = response.AgentID; |
136 | _login.Session = response.SessionID; | 140 | _login.Session = response.SessionID; |
137 | _login.SecureSession = response.SecureSessionID; | 141 | _login.SecureSession = response.SecureSessionID; |
138 | _login.CircuitCode = (uint)response.CircuitCode; | 142 | _login.CircuitCode = (uint) response.CircuitCode; |
139 | _login.StartPos = new LLVector3(128, 128, 70); | 143 | _login.StartPos = new LLVector3(128, 128, 70); |
140 | _login.CapsPath = capsPath; | 144 | _login.CapsPath = capsPath; |
141 | 145 | ||
142 | if( OnLoginToRegion != null ) | 146 | if (OnLoginToRegion != null) |
143 | { | 147 | { |
144 | OnLoginToRegion(currentRegion, _login); | 148 | OnLoginToRegion(currentRegion, _login); |
145 | } | 149 | } |
@@ -148,7 +152,6 @@ namespace OpenSim.Region.Communications.Local | |||
148 | { | 152 | { |
149 | Console.WriteLine("not found region " + currentRegion); | 153 | Console.WriteLine("not found region " + currentRegion); |
150 | } | 154 | } |
151 | |||
152 | } | 155 | } |
153 | 156 | ||
154 | protected override InventoryData CreateInventoryData(LLUUID userID) | 157 | protected override InventoryData CreateInventoryData(LLUUID userID) |
@@ -168,8 +171,8 @@ namespace OpenSim.Region.Communications.Local | |||
168 | TempHash = new Hashtable(); | 171 | TempHash = new Hashtable(); |
169 | TempHash["name"] = InvFolder.name; | 172 | TempHash["name"] = InvFolder.name; |
170 | TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); | 173 | TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); |
171 | TempHash["version"] = (Int32)InvFolder.version; | 174 | TempHash["version"] = (Int32) InvFolder.version; |
172 | TempHash["type_default"] = (Int32)InvFolder.type; | 175 | TempHash["type_default"] = (Int32) InvFolder.type; |
173 | TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); | 176 | TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); |
174 | AgentInventoryArray.Add(TempHash); | 177 | AgentInventoryArray.Add(TempHash); |
175 | } | 178 | } |
@@ -182,13 +185,13 @@ namespace OpenSim.Region.Communications.Local | |||
182 | 185 | ||
183 | ArrayList AgentInventoryArray = new ArrayList(); | 186 | ArrayList AgentInventoryArray = new ArrayList(); |
184 | Hashtable TempHash; | 187 | Hashtable TempHash; |
185 | foreach (OpenSim.Framework.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) | 188 | foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) |
186 | { | 189 | { |
187 | TempHash = new Hashtable(); | 190 | TempHash = new Hashtable(); |
188 | TempHash["name"] = InvFolder.FolderName; | 191 | TempHash["name"] = InvFolder.FolderName; |
189 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 192 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
190 | TempHash["version"] = (Int32)InvFolder.Version; | 193 | TempHash["version"] = (Int32) InvFolder.Version; |
191 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 194 | TempHash["type_default"] = (Int32) InvFolder.DefaultType; |
192 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 195 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
193 | AgentInventoryArray.Add(TempHash); | 196 | AgentInventoryArray.Add(TempHash); |
194 | } | 197 | } |
@@ -197,4 +200,4 @@ namespace OpenSim.Region.Communications.Local | |||
197 | } | 200 | } |
198 | } | 201 | } |
199 | } | 202 | } |
200 | } | 203 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 1dede97..a7687c7 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs | |||
@@ -27,8 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using OpenSim.Framework.Communications; | ||
31 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Communications; | ||
32 | using OpenSim.Framework.UserManagement; | 32 | using OpenSim.Framework.UserManagement; |
33 | 33 | ||
34 | namespace OpenSim.Region.Communications.Local | 34 | namespace OpenSim.Region.Communications.Local |
@@ -41,7 +41,8 @@ namespace OpenSim.Region.Communications.Local | |||
41 | private IInventoryServices m_inventoryService; | 41 | private IInventoryServices m_inventoryService; |
42 | 42 | ||
43 | 43 | ||
44 | public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, IInventoryServices inventoryService) | 44 | public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, |
45 | IInventoryServices inventoryService) | ||
45 | { | 46 | { |
46 | m_serversInfo = serversInfo; | 47 | m_serversInfo = serversInfo; |
47 | 48 | ||
@@ -49,7 +50,6 @@ namespace OpenSim.Region.Communications.Local | |||
49 | m_defaultHomeY = defaultHomeLocY; | 50 | m_defaultHomeY = defaultHomeLocY; |
50 | 51 | ||
51 | m_inventoryService = inventoryService; | 52 | m_inventoryService = inventoryService; |
52 | |||
53 | } | 53 | } |
54 | 54 | ||
55 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | 55 | public override UserProfileData SetupMasterUser(string firstName, string lastName) |
@@ -82,4 +82,4 @@ namespace OpenSim.Region.Communications.Local | |||
82 | return profile; | 82 | return profile; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs index ca64319..481577e 100644 --- a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Region.Communications.Local")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Region.Communications.Local")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Region.Communications.Local")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Region.Communications.Local")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] | 24 | |
25 | [assembly : Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 1807cc7..941cc30 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | |||
@@ -26,17 +26,17 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using OpenSim.Framework; | ||
29 | using OpenSim.Framework.Communications; | 30 | using OpenSim.Framework.Communications; |
30 | using OpenSim.Framework.Communications.Cache; | 31 | using OpenSim.Framework.Communications.Cache; |
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework.Servers; | 32 | using OpenSim.Framework.Servers; |
33 | 33 | ||
34 | |||
35 | namespace OpenSim.Region.Communications.OGS1 | 34 | namespace OpenSim.Region.Communications.OGS1 |
36 | { | 35 | { |
37 | public class CommunicationsOGS1 : CommunicationsManager | 36 | public class CommunicationsOGS1 : CommunicationsManager |
38 | { | 37 | { |
39 | public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) :base(serversInfo, httpServer, assetCache, false) | 38 | public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) |
39 | : base(serversInfo, httpServer, assetCache, false) | ||
40 | { | 40 | { |
41 | OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); | 41 | OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); |
42 | m_gridService = gridInterComms; | 42 | m_gridService = gridInterComms; |
@@ -46,4 +46,4 @@ namespace OpenSim.Region.Communications.OGS1 | |||
46 | m_userService = new OGS1UserServices(this); | 46 | m_userService = new OGS1UserServices(this); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } | 49 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 3719c97..d9af95b 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -35,14 +35,12 @@ using System.Runtime.Remoting; | |||
35 | using System.Runtime.Remoting.Channels; | 35 | using System.Runtime.Remoting.Channels; |
36 | using System.Runtime.Remoting.Channels.Tcp; | 36 | using System.Runtime.Remoting.Channels.Tcp; |
37 | using System.Security.Authentication; | 37 | using System.Security.Authentication; |
38 | |||
39 | using libsecondlife; | 38 | using libsecondlife; |
40 | using Nwc.XmlRpc; | 39 | using Nwc.XmlRpc; |
41 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
43 | using OpenSim.Framework.Console; | 42 | using OpenSim.Framework.Console; |
44 | using OpenSim.Framework.Servers; | 43 | using OpenSim.Framework.Servers; |
45 | using OpenSim.Framework; | ||
46 | using OpenSim.Region.Communications.Local; | 44 | using OpenSim.Region.Communications.Local; |
47 | 45 | ||
48 | namespace OpenSim.Region.Communications.OGS1 | 46 | namespace OpenSim.Region.Communications.OGS1 |
@@ -65,10 +63,10 @@ namespace OpenSim.Region.Communications.OGS1 | |||
65 | { | 63 | { |
66 | serversInfo = servers_info; | 64 | serversInfo = servers_info; |
67 | httpServer = httpServe; | 65 | httpServer = httpServe; |
68 | httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); | 66 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); |
69 | httpServer.AddXmlRPCHandler("check", this.PingCheckReply); | 67 | httpServer.AddXmlRPCHandler("check", PingCheckReply); |
70 | 68 | ||
71 | this.StartRemoting(); | 69 | StartRemoting(); |
72 | } | 70 | } |
73 | 71 | ||
74 | /// <summary> | 72 | /// <summary> |
@@ -99,14 +97,14 @@ namespace OpenSim.Region.Communications.OGS1 | |||
99 | // Send Request | 97 | // Send Request |
100 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | 98 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); |
101 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000); | 99 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000); |
102 | Hashtable GridRespData = (Hashtable)GridResp.Value; | 100 | Hashtable GridRespData = (Hashtable) GridResp.Value; |
103 | 101 | ||
104 | Hashtable griddatahash = GridRespData; | 102 | Hashtable griddatahash = GridRespData; |
105 | 103 | ||
106 | // Process Response | 104 | // Process Response |
107 | if (GridRespData.ContainsKey("error")) | 105 | if (GridRespData.ContainsKey("error")) |
108 | { | 106 | { |
109 | string errorstring = (string)GridRespData["error"]; | 107 | string errorstring = (string) GridRespData["error"]; |
110 | MainLog.Instance.Error("Unable to connect to grid: " + errorstring); | 108 | MainLog.Instance.Error("Unable to connect to grid: " + errorstring); |
111 | return null; | 109 | return null; |
112 | } | 110 | } |
@@ -121,8 +119,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
121 | /// <returns></returns> | 119 | /// <returns></returns> |
122 | public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | 120 | public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) |
123 | { | 121 | { |
124 | 122 | Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1); | |
125 | Hashtable respData = MapBlockQuery((int)x - 1, (int)y - 1, (int)x + 1, (int)y + 1); | ||
126 | 123 | ||
127 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); | 124 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); |
128 | 125 | ||
@@ -134,16 +131,15 @@ namespace OpenSim.Region.Communications.OGS1 | |||
134 | uint regY = Convert.ToUInt32(neighbourData["y"]); | 131 | uint regY = Convert.ToUInt32(neighbourData["y"]); |
135 | if ((x != regX) || (y != regY)) | 132 | if ((x != regX) || (y != regY)) |
136 | { | 133 | { |
137 | 134 | string simIp = (string) neighbourData["sim_ip"]; | |
138 | string simIp = (string)neighbourData["sim_ip"]; | ||
139 | 135 | ||
140 | int port = Convert.ToInt32(neighbourData["sim_port"]); | 136 | int port = Convert.ToInt32(neighbourData["sim_port"]); |
141 | string externalUri = (string)neighbourData["sim_uri"]; | 137 | string externalUri = (string) neighbourData["sim_uri"]; |
142 | 138 | ||
143 | string externalIpStr = OpenSim.Framework.Util.GetHostFromDNS(simIp).ToString(); | 139 | string externalIpStr = Util.GetHostFromDNS(simIp).ToString(); |
144 | SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); | 140 | SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); |
145 | sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); | 141 | sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); |
146 | sri.RegionID = new LLUUID((string)neighbourData["uuid"]); | 142 | sri.RegionID = new LLUUID((string) neighbourData["uuid"]); |
147 | 143 | ||
148 | neighbours.Add(sri); | 144 | neighbours.Add(sri); |
149 | } | 145 | } |
@@ -175,11 +171,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
175 | { | 171 | { |
176 | Hashtable requestData = new Hashtable(); | 172 | Hashtable requestData = new Hashtable(); |
177 | requestData["region_handle"] = regionHandle.ToString(); | 173 | requestData["region_handle"] = regionHandle.ToString(); |
178 | requestData["authkey"] = this.serversInfo.GridSendKey; | 174 | requestData["authkey"] = serversInfo.GridSendKey; |
179 | ArrayList SendParams = new ArrayList(); | 175 | ArrayList SendParams = new ArrayList(); |
180 | SendParams.Add(requestData); | 176 | SendParams.Add(requestData); |
181 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 177 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
182 | XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); | 178 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); |
183 | 179 | ||
184 | Hashtable responseData = (Hashtable) GridResp.Value; | 180 | Hashtable responseData = (Hashtable) GridResp.Value; |
185 | 181 | ||
@@ -205,7 +201,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
205 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); | 201 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); |
206 | regionInfo.RegionName = (string) responseData["region_name"]; | 202 | regionInfo.RegionName = (string) responseData["region_name"]; |
207 | 203 | ||
208 | m_remoteRegionInfoCache.Add( regionHandle, regionInfo ); | 204 | m_remoteRegionInfoCache.Add(regionHandle, regionInfo); |
209 | } | 205 | } |
210 | 206 | ||
211 | return regionInfo; | 207 | return regionInfo; |
@@ -234,11 +230,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
234 | neighbour.X = Convert.ToUInt16(n["x"]); | 230 | neighbour.X = Convert.ToUInt16(n["x"]); |
235 | neighbour.Y = Convert.ToUInt16(n["y"]); | 231 | neighbour.Y = Convert.ToUInt16(n["y"]); |
236 | 232 | ||
237 | neighbour.Name = (string)n["name"]; | 233 | neighbour.Name = (string) n["name"]; |
238 | neighbour.Access = Convert.ToByte(n["access"]); | 234 | neighbour.Access = Convert.ToByte(n["access"]); |
239 | neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); | 235 | neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); |
240 | neighbour.WaterHeight = Convert.ToByte(n["water-height"]); | 236 | neighbour.WaterHeight = Convert.ToByte(n["water-height"]); |
241 | neighbour.MapImageId = new LLUUID((string)n["map-image-id"]); | 237 | neighbour.MapImageId = new LLUUID((string) n["map-image-id"]); |
242 | 238 | ||
243 | neighbours.Add(neighbour); | 239 | neighbours.Add(neighbour); |
244 | } | 240 | } |
@@ -267,7 +263,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
267 | parameters.Add(param); | 263 | parameters.Add(param); |
268 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); | 264 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); |
269 | XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000); | 265 | XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000); |
270 | Hashtable respData = (Hashtable)resp.Value; | 266 | Hashtable respData = (Hashtable) resp.Value; |
271 | return respData; | 267 | return respData; |
272 | } | 268 | } |
273 | 269 | ||
@@ -300,15 +296,15 @@ namespace OpenSim.Region.Communications.OGS1 | |||
300 | public XmlRpcResponse ExpectUser(XmlRpcRequest request) | 296 | public XmlRpcResponse ExpectUser(XmlRpcRequest request) |
301 | { | 297 | { |
302 | Console.WriteLine("Expecting User..."); | 298 | Console.WriteLine("Expecting User..."); |
303 | Hashtable requestData = (Hashtable)request.Params[0]; | 299 | Hashtable requestData = (Hashtable) request.Params[0]; |
304 | AgentCircuitData agentData = new AgentCircuitData(); | 300 | AgentCircuitData agentData = new AgentCircuitData(); |
305 | agentData.SessionID = new LLUUID((string)requestData["session_id"]); | 301 | agentData.SessionID = new LLUUID((string) requestData["session_id"]); |
306 | agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); | 302 | agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); |
307 | agentData.firstname = (string)requestData["firstname"]; | 303 | agentData.firstname = (string) requestData["firstname"]; |
308 | agentData.lastname = (string)requestData["lastname"]; | 304 | agentData.lastname = (string) requestData["lastname"]; |
309 | agentData.AgentID = new LLUUID((string)requestData["agent_id"]); | 305 | agentData.AgentID = new LLUUID((string) requestData["agent_id"]); |
310 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 306 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
311 | agentData.CapsPath = (string)requestData["caps_path"]; | 307 | agentData.CapsPath = (string) requestData["caps_path"]; |
312 | 308 | ||
313 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | 309 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) |
314 | { | 310 | { |
@@ -316,12 +312,14 @@ namespace OpenSim.Region.Communications.OGS1 | |||
316 | } | 312 | } |
317 | else | 313 | else |
318 | { | 314 | { |
319 | agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); | 315 | agentData.startpos = |
316 | new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), | ||
317 | Convert.ToUInt32(requestData["startpos_y"]), | ||
318 | Convert.ToUInt32(requestData["startpos_z"])); | ||
320 | agentData.child = false; | 319 | agentData.child = false; |
321 | |||
322 | } | 320 | } |
323 | 321 | ||
324 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | 322 | ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); |
325 | 323 | ||
326 | m_localBackend.TriggerExpectUser(regionHandle, agentData); | 324 | m_localBackend.TriggerExpectUser(regionHandle, agentData); |
327 | 325 | ||
@@ -331,6 +329,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
331 | } | 329 | } |
332 | 330 | ||
333 | #region m_interRegion Comms | 331 | #region m_interRegion Comms |
332 | |||
334 | /// <summary> | 333 | /// <summary> |
335 | /// | 334 | /// |
336 | /// </summary> | 335 | /// </summary> |
@@ -339,13 +338,16 @@ namespace OpenSim.Region.Communications.OGS1 | |||
339 | TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort); | 338 | TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort); |
340 | ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. | 339 | ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. |
341 | 340 | ||
342 | WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); | 341 | WellKnownServiceTypeEntry wellType = |
342 | new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions", | ||
343 | WellKnownObjectMode.Singleton); | ||
343 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); | 344 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); |
344 | InterRegionSingleton.Instance.OnArrival += this.TriggerExpectAvatarCrossing; | 345 | InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; |
345 | InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; | 346 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; |
346 | } | 347 | } |
347 | 348 | ||
348 | #region Methods called by regions in this instance | 349 | #region Methods called by regions in this instance |
350 | |||
349 | /// <summary> | 351 | /// <summary> |
350 | /// | 352 | /// |
351 | /// </summary> | 353 | /// </summary> |
@@ -361,17 +363,19 @@ namespace OpenSim.Region.Communications.OGS1 | |||
361 | return true; | 363 | return true; |
362 | } | 364 | } |
363 | 365 | ||
364 | RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); | 366 | RegionInfo regInfo = RequestNeighbourInfo(regionHandle); |
365 | if (regInfo != null) | 367 | if (regInfo != null) |
366 | { | 368 | { |
367 | //don't want to be creating a new link to the remote instance every time like we are here | 369 | //don't want to be creating a new link to the remote instance every time like we are here |
368 | bool retValue = false; | 370 | bool retValue = false; |
369 | 371 | ||
370 | 372 | ||
371 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 373 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( |
372 | typeof(OGS1InterRegionRemoting), | 374 | typeof (OGS1InterRegionRemoting), |
373 | "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); | 375 | "tcp://" + regInfo.RemotingAddress + |
374 | 376 | ":" + regInfo.RemotingPort + | |
377 | "/InterRegions"); | ||
378 | |||
375 | if (remObject != null) | 379 | if (remObject != null) |
376 | { | 380 | { |
377 | retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); | 381 | retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); |
@@ -388,7 +392,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
388 | 392 | ||
389 | return false; | 393 | return false; |
390 | } | 394 | } |
391 | catch (System.Runtime.Remoting.RemotingException e) | 395 | catch (RemotingException e) |
392 | { | 396 | { |
393 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 397 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
394 | return false; | 398 | return false; |
@@ -432,13 +436,15 @@ namespace OpenSim.Region.Communications.OGS1 | |||
432 | return true; | 436 | return true; |
433 | } | 437 | } |
434 | 438 | ||
435 | RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); | 439 | RegionInfo regInfo = RequestNeighbourInfo(regionHandle); |
436 | if (regInfo != null) | 440 | if (regInfo != null) |
437 | { | 441 | { |
438 | bool retValue = false; | 442 | bool retValue = false; |
439 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 443 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( |
440 | typeof(OGS1InterRegionRemoting), | 444 | typeof (OGS1InterRegionRemoting), |
441 | "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); | 445 | "tcp://" + regInfo.RemotingAddress + |
446 | ":" + regInfo.RemotingPort + | ||
447 | "/InterRegions"); | ||
442 | if (remObject != null) | 448 | if (remObject != null) |
443 | { | 449 | { |
444 | retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 450 | retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
@@ -455,7 +461,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
455 | // to inform it. | 461 | // to inform it. |
456 | return false; | 462 | return false; |
457 | } | 463 | } |
458 | catch (System.Runtime.Remoting.RemotingException e) | 464 | catch (RemotingException e) |
459 | { | 465 | { |
460 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 466 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
461 | return false; | 467 | return false; |
@@ -474,6 +480,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
474 | #endregion | 480 | #endregion |
475 | 481 | ||
476 | #region Methods triggered by calls from external instances | 482 | #region Methods triggered by calls from external instances |
483 | |||
477 | /// <summary> | 484 | /// <summary> |
478 | /// | 485 | /// |
479 | /// </summary> | 486 | /// </summary> |
@@ -486,7 +493,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
486 | { | 493 | { |
487 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); | 494 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); |
488 | } | 495 | } |
489 | catch (System.Runtime.Remoting.RemotingException e) | 496 | catch (RemotingException e) |
490 | { | 497 | { |
491 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 498 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
492 | return false; | 499 | return false; |
@@ -502,18 +509,19 @@ namespace OpenSim.Region.Communications.OGS1 | |||
502 | /// <returns></returns> | 509 | /// <returns></returns> |
503 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 510 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
504 | { | 511 | { |
505 | |||
506 | try | 512 | try |
507 | { | 513 | { |
508 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 514 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
509 | } | 515 | } |
510 | catch (System.Runtime.Remoting.RemotingException e) | 516 | catch (RemotingException e) |
511 | { | 517 | { |
512 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 518 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
513 | return false; | 519 | return false; |
514 | } | 520 | } |
515 | } | 521 | } |
522 | |||
516 | #endregion | 523 | #endregion |
524 | |||
517 | #endregion | 525 | #endregion |
518 | } | 526 | } |
519 | } | 527 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index 0b7bd82..a127010 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | |||
@@ -27,17 +27,19 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Runtime.Remoting; | ||
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | 33 | ||
33 | namespace OpenSim.Region.Communications.OGS1 | 34 | namespace OpenSim.Region.Communications.OGS1 |
34 | { | 35 | { |
35 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); | 36 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); |
37 | |||
36 | public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); | 38 | public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
37 | 39 | ||
38 | public sealed class InterRegionSingleton | 40 | public sealed class InterRegionSingleton |
39 | { | 41 | { |
40 | static readonly InterRegionSingleton instance = new InterRegionSingleton(); | 42 | private static readonly InterRegionSingleton instance = new InterRegionSingleton(); |
41 | 43 | ||
42 | public event InformRegionChild OnChildAgent; | 44 | public event InformRegionChild OnChildAgent; |
43 | public event ExpectArrival OnArrival; | 45 | public event ExpectArrival OnArrival; |
@@ -46,16 +48,13 @@ namespace OpenSim.Region.Communications.OGS1 | |||
46 | { | 48 | { |
47 | } | 49 | } |
48 | 50 | ||
49 | InterRegionSingleton() | 51 | private InterRegionSingleton() |
50 | { | 52 | { |
51 | } | 53 | } |
52 | 54 | ||
53 | public static InterRegionSingleton Instance | 55 | public static InterRegionSingleton Instance |
54 | { | 56 | { |
55 | get | 57 | get { return instance; } |
56 | { | ||
57 | return instance; | ||
58 | } | ||
59 | } | 58 | } |
60 | 59 | ||
61 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | 60 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
@@ -79,7 +78,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
79 | 78 | ||
80 | public class OGS1InterRegionRemoting : MarshalByRefObject | 79 | public class OGS1InterRegionRemoting : MarshalByRefObject |
81 | { | 80 | { |
82 | |||
83 | public OGS1InterRegionRemoting() | 81 | public OGS1InterRegionRemoting() |
84 | { | 82 | { |
85 | } | 83 | } |
@@ -90,7 +88,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
90 | { | 88 | { |
91 | return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); | 89 | return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); |
92 | } | 90 | } |
93 | catch (System.Runtime.Remoting.RemotingException e) | 91 | catch (RemotingException e) |
94 | { | 92 | { |
95 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 93 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
96 | return false; | 94 | return false; |
@@ -103,11 +101,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
103 | { | 101 | { |
104 | return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 102 | return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
105 | } | 103 | } |
106 | catch (System.Runtime.Remoting.RemotingException e) | 104 | catch (RemotingException e) |
107 | { | 105 | { |
108 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 106 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
109 | return false; | 107 | return false; |
110 | } | 108 | } |
111 | } | 109 | } |
112 | } | 110 | } |
113 | } | 111 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 11dee2d..49fdee9 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -28,46 +28,39 @@ | |||
28 | 28 | ||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Framework.Communications; | 32 | using OpenSim.Framework.Communications; |
32 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Framework; | ||
34 | |||
35 | 34 | ||
36 | namespace OpenSim.Region.Communications.OGS1 | 35 | namespace OpenSim.Region.Communications.OGS1 |
37 | { | 36 | { |
38 | public class OGS1InventoryService : IInventoryServices | 37 | public class OGS1InventoryService : IInventoryServices |
39 | { | 38 | { |
40 | |||
41 | public OGS1InventoryService() | 39 | public OGS1InventoryService() |
42 | { | 40 | { |
43 | |||
44 | } | 41 | } |
45 | 42 | ||
46 | #region IInventoryServices Members | 43 | #region IInventoryServices Members |
47 | 44 | ||
48 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) | 45 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, |
46 | InventoryItemInfo itemCallBack) | ||
49 | { | 47 | { |
50 | |||
51 | } | 48 | } |
52 | 49 | ||
53 | public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) | 50 | public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) |
54 | { | 51 | { |
55 | |||
56 | } | 52 | } |
57 | 53 | ||
58 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 54 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
59 | { | 55 | { |
60 | |||
61 | } | 56 | } |
62 | 57 | ||
63 | public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) | 58 | public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) |
64 | { | 59 | { |
65 | |||
66 | } | 60 | } |
67 | 61 | ||
68 | public void CreateNewUserInventory(LLUUID user) | 62 | public void CreateNewUserInventory(LLUUID user) |
69 | { | 63 | { |
70 | |||
71 | } | 64 | } |
72 | 65 | ||
73 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) | 66 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) |
@@ -77,4 +70,4 @@ namespace OpenSim.Region.Communications.OGS1 | |||
77 | 70 | ||
78 | #endregion | 71 | #endregion |
79 | } | 72 | } |
80 | } | 73 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 19a3c3b..d00a813 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |||
@@ -28,16 +28,19 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Net; | ||
31 | using libsecondlife; | 32 | using libsecondlife; |
32 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Interfaces; | ||
35 | 37 | ||
36 | namespace OpenSim.Region.Communications.OGS1 | 38 | namespace OpenSim.Region.Communications.OGS1 |
37 | { | 39 | { |
38 | public class OGS1UserServices :IUserService | 40 | public class OGS1UserServices : IUserService |
39 | { | 41 | { |
40 | CommunicationsOGS1 m_parent; | 42 | private CommunicationsOGS1 m_parent; |
43 | |||
41 | public OGS1UserServices(CommunicationsOGS1 parent) | 44 | public OGS1UserServices(CommunicationsOGS1 parent) |
42 | { | 45 | { |
43 | m_parent = parent; | 46 | m_parent = parent; |
@@ -47,32 +50,41 @@ namespace OpenSim.Region.Communications.OGS1 | |||
47 | { | 50 | { |
48 | if (data.Contains("error_type")) | 51 | if (data.Contains("error_type")) |
49 | { | 52 | { |
50 | Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); | 53 | Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + |
54 | "): " + data["error_desc"]); | ||
51 | return null; | 55 | return null; |
52 | } | 56 | } |
53 | 57 | ||
54 | UserProfileData userData = new UserProfileData(); | 58 | UserProfileData userData = new UserProfileData(); |
55 | userData.username = (string)data["firstname"]; | 59 | userData.username = (string) data["firstname"]; |
56 | userData.surname = (string)data["lastname"]; | 60 | userData.surname = (string) data["lastname"]; |
57 | userData.UUID = new LLUUID((string)data["uuid"]); | 61 | userData.UUID = new LLUUID((string) data["uuid"]); |
58 | userData.userInventoryURI = (string)data["server_inventory"]; | 62 | userData.userInventoryURI = (string) data["server_inventory"]; |
59 | userData.userAssetURI = (string)data["server_asset"]; | 63 | userData.userAssetURI = (string) data["server_asset"]; |
60 | userData.profileFirstText = (string)data["profile_firstlife_about"]; | 64 | userData.profileFirstText = (string) data["profile_firstlife_about"]; |
61 | userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); | 65 | userData.profileFirstImage = new LLUUID((string) data["profile_firstlife_image"]); |
62 | userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); | 66 | userData.profileCanDoMask = Convert.ToUInt32((string) data["profile_can_do"]); |
63 | userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); | 67 | userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); |
64 | userData.profileImage = new LLUUID((string)data["profile_image"]); | 68 | userData.profileImage = new LLUUID((string) data["profile_image"]); |
65 | userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); | 69 | userData.lastLogin = Convert.ToInt32((string) data["profile_lastlogin"]); |
66 | userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); | 70 | userData.homeRegion = Convert.ToUInt64((string) data["home_region"]); |
67 | userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"])); | 71 | userData.homeLocation = |
68 | userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"])); | 72 | new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]), |
73 | (float) Convert.ToDecimal((string) data["home_coordinates_y"]), | ||
74 | (float) Convert.ToDecimal((string) data["home_coordinates_z"])); | ||
75 | userData.homeLookAt = | ||
76 | new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]), | ||
77 | (float) Convert.ToDecimal((string) data["home_look_y"]), | ||
78 | (float) Convert.ToDecimal((string) data["home_look_z"])); | ||
69 | 79 | ||
70 | return userData; | 80 | return userData; |
71 | } | 81 | } |
82 | |||
72 | public UserProfileData GetUserProfile(string firstName, string lastName) | 83 | public UserProfileData GetUserProfile(string firstName, string lastName) |
73 | { | 84 | { |
74 | return GetUserProfile(firstName + " " + lastName); | 85 | return GetUserProfile(firstName + " " + lastName); |
75 | } | 86 | } |
87 | |||
76 | public UserProfileData GetUserProfile(string name) | 88 | public UserProfileData GetUserProfile(string name) |
77 | { | 89 | { |
78 | try | 90 | try |
@@ -83,16 +95,18 @@ namespace OpenSim.Region.Communications.OGS1 | |||
83 | parameters.Add(param); | 95 | parameters.Add(param); |
84 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); | 96 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); |
85 | XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); | 97 | XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); |
86 | Hashtable respData = (Hashtable)resp.Value; | 98 | Hashtable respData = (Hashtable) resp.Value; |
87 | 99 | ||
88 | return ConvertXMLRPCDataToUserProfile(respData); | 100 | return ConvertXMLRPCDataToUserProfile(respData); |
89 | } | 101 | } |
90 | catch (System.Net.WebException e) | 102 | catch (WebException e) |
91 | { | 103 | { |
92 | OpenSim.Framework.Console.MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + e.Message); | 104 | MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + |
105 | e.Message); | ||
93 | } | 106 | } |
94 | return null; | 107 | return null; |
95 | } | 108 | } |
109 | |||
96 | public UserProfileData GetUserProfile(LLUUID avatarID) | 110 | public UserProfileData GetUserProfile(LLUUID avatarID) |
97 | { | 111 | { |
98 | try | 112 | try |
@@ -103,18 +117,19 @@ namespace OpenSim.Region.Communications.OGS1 | |||
103 | parameters.Add(param); | 117 | parameters.Add(param); |
104 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); | 118 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); |
105 | XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); | 119 | XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); |
106 | Hashtable respData = (Hashtable)resp.Value; | 120 | Hashtable respData = (Hashtable) resp.Value; |
107 | 121 | ||
108 | return ConvertXMLRPCDataToUserProfile(respData); | 122 | return ConvertXMLRPCDataToUserProfile(respData); |
109 | } | 123 | } |
110 | catch (Exception e) | 124 | catch (Exception e) |
111 | { | 125 | { |
112 | Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); | 126 | Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + |
127 | e.Message); | ||
113 | } | 128 | } |
114 | return null; | 129 | return null; |
115 | } | 130 | } |
116 | 131 | ||
117 | public void clearUserAgent(LLUUID avatarID) | 132 | public void clearUserAgent(LLUUID avatarID) |
118 | { | 133 | { |
119 | // TODO: implement | 134 | // TODO: implement |
120 | } | 135 | } |
@@ -135,4 +150,4 @@ namespace OpenSim.Region.Communications.OGS1 | |||
135 | throw new Exception("The method or operation is not implemented."); | 150 | throw new Exception("The method or operation is not implemented."); |
136 | } | 151 | } |
137 | } | 152 | } |
138 | } | 153 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs index 2bebf9f..631cfd0 100644 --- a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] | 24 | |
25 | [assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs index 41d14f0..9e32b35 100644 --- a/OpenSim/Region/Environment/EstateManager.cs +++ b/OpenSim/Region/Environment/EstateManager.cs | |||
@@ -30,12 +30,10 @@ using System.Collections.Generic; | |||
30 | using System.Text; | 30 | using System.Text; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
37 | 36 | ||
38 | |||
39 | namespace OpenSim.Region.Environment | 37 | namespace OpenSim.Region.Environment |
40 | { | 38 | { |
41 | /// <summary> | 39 | /// <summary> |
@@ -216,14 +214,14 @@ namespace OpenSim.Region.Environment | |||
216 | 214 | ||
217 | int tempMaxAgents = | 215 | int tempMaxAgents = |
218 | Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); | 216 | Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); |
219 | m_regInfo.EstateSettings.maxAgents = (byte)tempMaxAgents; | 217 | m_regInfo.EstateSettings.maxAgents = (byte) tempMaxAgents; |
220 | 218 | ||
221 | float tempObjectBonusFactor = | 219 | float tempObjectBonusFactor = |
222 | (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | 220 | (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); |
223 | m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor; | 221 | m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor; |
224 | 222 | ||
225 | int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); | 223 | int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); |
226 | m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; | 224 | m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel; |
227 | 225 | ||
228 | 226 | ||
229 | if (convertParamStringToBool(packet.ParamList[7].Parameter)) | 227 | if (convertParamStringToBool(packet.ParamList[7].Parameter)) |
@@ -250,13 +248,13 @@ namespace OpenSim.Region.Environment | |||
250 | } | 248 | } |
251 | else | 249 | else |
252 | { | 250 | { |
253 | float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); | 251 | float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); |
254 | float TerrainRaiseLimit = | 252 | float TerrainRaiseLimit = |
255 | (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); | 253 | (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); |
256 | float TerrainLowerLimit = | 254 | float TerrainLowerLimit = |
257 | (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); | 255 | (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); |
258 | bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); | 256 | bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); |
259 | float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | 257 | float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); |
260 | 258 | ||
261 | setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); | 259 | setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); |
262 | 260 | ||
@@ -273,8 +271,8 @@ namespace OpenSim.Region.Environment | |||
273 | if (splitField.Length == 3) | 271 | if (splitField.Length == 3) |
274 | { | 272 | { |
275 | Int16 corner = Convert.ToInt16(splitField[0]); | 273 | Int16 corner = Convert.ToInt16(splitField[0]); |
276 | float lowValue = (float)Convert.ToDecimal(splitField[1]); | 274 | float lowValue = (float) Convert.ToDecimal(splitField[1]); |
277 | float highValue = (float)Convert.ToDecimal(splitField[2]); | 275 | float highValue = (float) Convert.ToDecimal(splitField[2]); |
278 | 276 | ||
279 | setEstateTextureRange(corner, lowValue, highValue); | 277 | setEstateTextureRange(corner, lowValue, highValue); |
280 | } | 278 | } |
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Environment | |||
343 | { | 341 | { |
344 | m_scene.Broadcast( | 342 | m_scene.Broadcast( |
345 | sendRegionHandshake | 343 | sendRegionHandshake |
346 | ); | 344 | ); |
347 | } | 345 | } |
348 | 346 | ||
349 | public void sendRegionInfoPacket(IClientAPI remote_client) | 347 | public void sendRegionInfoPacket(IClientAPI remote_client) |
@@ -363,8 +361,8 @@ namespace OpenSim.Region.Environment | |||
363 | regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter; | 361 | regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter; |
364 | regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX; | 362 | regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX; |
365 | regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY; | 363 | regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY; |
366 | regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.EstateSettings.regionFlags; | 364 | regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.EstateSettings.regionFlags; |
367 | regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.EstateSettings.simAccess; | 365 | regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.EstateSettings.simAccess; |
368 | regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName); | 366 | regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName); |
369 | regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour; | 367 | regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour; |
370 | regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit; | 368 | regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit; |
diff --git a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs index 90c3730..e7ce957 100644 --- a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs | |||
@@ -1,6 +1,3 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | 1 | using libsecondlife; |
5 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
6 | 3 | ||
@@ -10,4 +7,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
10 | { | 7 | { |
11 | bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams); | 8 | bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams); |
12 | } | 9 | } |
13 | } | 10 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs index 8a31d87..daecf86 100644 --- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs | |||
@@ -53,4 +53,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
53 | bool AsyncConvertUrl(LLUUID id, string url, string extraParams); | 53 | bool AsyncConvertUrl(LLUUID id, string url, string extraParams); |
54 | bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); | 54 | bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); |
55 | } | 55 | } |
56 | } | 56 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs index 19cf131..0357139 100644 --- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs | |||
@@ -34,4 +34,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
34 | { | 34 | { |
35 | LLUUID MakeHttpRequest(string url, string type, string body); | 35 | LLUUID MakeHttpRequest(string url, string type, string body); |
36 | } | 36 | } |
37 | } | 37 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs index 808b94a..e5d0b26 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs | |||
@@ -26,8 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using OpenSim.Region.Environment.Scenes; | ||
30 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Region.Environment.Scenes; | ||
31 | 31 | ||
32 | namespace OpenSim.Region.Environment.Interfaces | 32 | namespace OpenSim.Region.Environment.Interfaces |
33 | { | 33 | { |
@@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
39 | string Name { get; } | 39 | string Name { get; } |
40 | bool IsSharedModule { get; } | 40 | bool IsSharedModule { get; } |
41 | } | 41 | } |
42 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs index 7dc3e0b..fb491cc 100644 --- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs +++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs | |||
@@ -26,12 +26,13 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using libsecondlife; | 29 | using System; |
30 | using OpenSim.Framework; | ||
30 | 31 | ||
31 | namespace OpenSim.Region.Environment.Interfaces | 32 | namespace OpenSim.Region.Environment.Interfaces |
32 | { | 33 | { |
33 | public interface ISimChat | 34 | public interface ISimChat |
34 | { | 35 | { |
35 | void SimChat(System.Object sender, OpenSim.Framework.ChatFromViewerArgs e); | 36 | void SimChat(Object sender, ChatFromViewerArgs e); |
36 | } | 37 | } |
37 | } | 38 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs index 77ec2dd..9171d09 100644 --- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using OpenSim.Framework.Interfaces; | ||
30 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
31 | 30 | ||
32 | namespace OpenSim.Region.Environment.Interfaces | 31 | namespace OpenSim.Region.Environment.Interfaces |
@@ -72,4 +71,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
72 | void ExportImage(string filename, string gradientmap); | 71 | void ExportImage(string filename, string gradientmap); |
73 | byte[] ExportJpegImage(string gradientmap); | 72 | byte[] ExportJpegImage(string gradientmap); |
74 | } | 73 | } |
75 | } | 74 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs index 9d8c259..27b5466 100644 --- a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs | |||
@@ -40,4 +40,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
40 | void ListenControl(int handle, int active); | 40 | void ListenControl(int handle, int active); |
41 | void ListenRemove(int handle); | 41 | void ListenRemove(int handle); |
42 | } | 42 | } |
43 | } | 43 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs index d888a36..6786b8c 100644 --- a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs +++ b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs | |||
@@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
39 | RPCRequestInfo GetNextRequest(); | 39 | RPCRequestInfo GetNextRequest(); |
40 | void RemoteDataReply(string channel, string message_id, string sdata, int idata); | 40 | void RemoteDataReply(string channel, string message_id, string sdata, int idata); |
41 | } | 41 | } |
42 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs index 3cbd549..5e5ff1b 100644 --- a/OpenSim/Region/Environment/Interfaces/IXfer.cs +++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs | |||
@@ -32,4 +32,4 @@ namespace OpenSim.Region.Environment.Interfaces | |||
32 | { | 32 | { |
33 | bool AddNewFile(string fileName, byte[] data); | 33 | bool AddNewFile(string fileName, byte[] data); |
34 | } | 34 | } |
35 | } | 35 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index 3962e5f..e9837c0 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs | |||
@@ -30,7 +30,6 @@ using System; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
36 | 35 | ||
@@ -652,4 +651,4 @@ namespace OpenSim.Region.Environment.LandManagement | |||
652 | } | 651 | } |
653 | 652 | ||
654 | #endregion | 653 | #endregion |
655 | } | 654 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index ae89d85..785aafa 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Framework.Interfaces; | ||
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
35 | 34 | ||
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index c0dd52a..cb72638 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -27,15 +27,14 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
32 | using System.IO; | 31 | using System.IO; |
33 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | ||
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Modules; | 36 | using OpenSim.Region.Environment.Modules; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
38 | using Nini.Config; | ||
39 | 38 | ||
40 | namespace OpenSim.Region.Environment | 39 | namespace OpenSim.Region.Environment |
41 | { | 40 | { |
@@ -58,8 +57,8 @@ namespace OpenSim.Region.Environment | |||
58 | { | 57 | { |
59 | get | 58 | get |
60 | { | 59 | { |
61 | IRegionModule[] regionModules = new IRegionModule[ m_loadedSharedModules.Count ]; | 60 | IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count]; |
62 | m_loadedSharedModules.Values.CopyTo( regionModules, 0 ); | 61 | m_loadedSharedModules.Values.CopyTo(regionModules, 0); |
63 | return regionModules; | 62 | return regionModules; |
64 | } | 63 | } |
65 | } | 64 | } |
@@ -132,7 +131,7 @@ namespace OpenSim.Region.Environment | |||
132 | 131 | ||
133 | if (modules.Length > 0) | 132 | if (modules.Length > 0) |
134 | { | 133 | { |
135 | m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName ); | 134 | m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName); |
136 | foreach (IRegionModule module in modules) | 135 | foreach (IRegionModule module in modules) |
137 | { | 136 | { |
138 | if (!module.IsSharedModule) | 137 | if (!module.IsSharedModule) |
@@ -179,16 +178,16 @@ namespace OpenSim.Region.Environment | |||
179 | List<IRegionModule> modules = new List<IRegionModule>(); | 178 | List<IRegionModule> modules = new List<IRegionModule>(); |
180 | 179 | ||
181 | Assembly pluginAssembly; | 180 | Assembly pluginAssembly; |
182 | if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly )) | 181 | if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly)) |
183 | { | 182 | { |
184 | try | 183 | try |
185 | { | 184 | { |
186 | pluginAssembly = Assembly.LoadFrom(dllName); | 185 | pluginAssembly = Assembly.LoadFrom(dllName); |
187 | LoadedAssemblys.Add(dllName, pluginAssembly); | 186 | LoadedAssemblys.Add(dllName, pluginAssembly); |
188 | } | 187 | } |
189 | catch( BadImageFormatException e ) | 188 | catch (BadImageFormatException e) |
190 | { | 189 | { |
191 | m_log.Verbose( "MODULES", "The file [{0}] is not a module assembly.", e.FileName ); | 190 | m_log.Verbose("MODULES", "The file [{0}] is not a module assembly.", e.FileName); |
192 | } | 191 | } |
193 | } | 192 | } |
194 | 193 | ||
@@ -201,7 +200,7 @@ namespace OpenSim.Region.Environment | |||
201 | { | 200 | { |
202 | if (!pluginType.IsAbstract) | 201 | if (!pluginType.IsAbstract) |
203 | { | 202 | { |
204 | if( pluginType.GetInterface("IRegionModule") != null ) | 203 | if (pluginType.GetInterface("IRegionModule") != null) |
205 | { | 204 | { |
206 | modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); | 205 | modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); |
207 | } | 206 | } |
@@ -231,4 +230,4 @@ namespace OpenSim.Region.Environment | |||
231 | LoadedAssemblys.Clear(); | 230 | LoadedAssemblys.Clear(); |
232 | } | 231 | } |
233 | } | 232 | } |
234 | } | 233 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index e414713..54d5ad8 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -26,11 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using OpenSim.Framework.Interfaces; | 29 | using Nini.Config; |
30 | using OpenSim.Framework; | ||
30 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework; | ||
33 | using Nini.Config; | ||
34 | 33 | ||
35 | namespace OpenSim.Region.Environment.Modules | 34 | namespace OpenSim.Region.Environment.Modules |
36 | { | 35 | { |
@@ -70,4 +69,4 @@ namespace OpenSim.Region.Environment.Modules | |||
70 | { | 69 | { |
71 | } | 70 | } |
72 | } | 71 | } |
73 | } | 72 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs index 456d838..4bb0638 100644 --- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs | |||
@@ -1,6 +1,3 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | 1 | using libsecondlife; |
5 | using Nini.Config; | 2 | using Nini.Config; |
6 | using OpenSim.Framework; | 3 | using OpenSim.Framework; |
@@ -11,7 +8,8 @@ namespace OpenSim.Region.Environment.Modules | |||
11 | { | 8 | { |
12 | public class AvatarFactoryModule : IAvatarFactory | 9 | public class AvatarFactoryModule : IAvatarFactory |
13 | { | 10 | { |
14 | public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams) | 11 | public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, |
12 | out byte[] visualParams) | ||
15 | { | 13 | { |
16 | GetDefaultAvatarAppearance(out wearables, out visualParams); | 14 | GetDefaultAvatarAppearance(out wearables, out visualParams); |
17 | return true; | 15 | return true; |
@@ -51,7 +49,4 @@ namespace OpenSim.Region.Environment.Modules | |||
51 | wearables = AvatarWearable.DefaultWearables; | 49 | wearables = AvatarWearable.DefaultWearables; |
52 | } | 50 | } |
53 | } | 51 | } |
54 | 52 | } \ No newline at end of file | |
55 | |||
56 | |||
57 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index 802655f..1b7e2a4 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -27,11 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Interfaces; | 30 | using Nini.Config; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
33 | using OpenSim.Framework; | ||
34 | using Nini.Config; | ||
35 | 34 | ||
36 | namespace OpenSim.Region.Environment.Modules | 35 | namespace OpenSim.Region.Environment.Modules |
37 | { | 36 | { |
@@ -92,4 +91,4 @@ namespace OpenSim.Region.Environment.Modules | |||
92 | partner); | 91 | partner); |
93 | } | 92 | } |
94 | } | 93 | } |
95 | } | 94 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index bdb8ee5..9d4187a 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -27,13 +27,13 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
32 | using System.Threading; | ||
33 | using System.Collections.Generic; | ||
34 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
34 | using System.Threading; | ||
35 | using libsecondlife; | 35 | using libsecondlife; |
36 | using OpenSim.Framework.Interfaces; | 36 | using Nini.Config; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using OpenSim.Region.Environment.Interfaces; | 39 | using OpenSim.Region.Environment.Interfaces; |
@@ -54,18 +54,22 @@ namespace OpenSim.Region.Environment.Modules | |||
54 | 54 | ||
55 | public ChatModule() | 55 | public ChatModule() |
56 | { | 56 | { |
57 | m_log = OpenSim.Framework.Console.MainLog.Instance; | 57 | m_log = MainLog.Instance; |
58 | } | 58 | } |
59 | 59 | ||
60 | public void Initialise(Scene scene, Nini.Config.IConfigSource config) | 60 | public void Initialise(Scene scene, IConfigSource config) |
61 | { | 61 | { |
62 | // wrap this in a try block so that defaults will work if | 62 | // wrap this in a try block so that defaults will work if |
63 | // the config file doesn't specify otherwise. | 63 | // the config file doesn't specify otherwise. |
64 | try { | 64 | try |
65 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 65 | { |
66 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | ||
66 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 67 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
67 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 68 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
68 | } catch (Exception e) {} | 69 | } |
70 | catch (Exception e) | ||
71 | { | ||
72 | } | ||
69 | 73 | ||
70 | if (!m_scenes.Contains(scene)) | 74 | if (!m_scenes.Contains(scene)) |
71 | { | 75 | { |
@@ -73,20 +77,20 @@ namespace OpenSim.Region.Environment.Modules | |||
73 | scene.EventManager.OnNewClient += NewClient; | 77 | scene.EventManager.OnNewClient += NewClient; |
74 | scene.RegisterModuleInterface<ISimChat>(this); | 78 | scene.RegisterModuleInterface<ISimChat>(this); |
75 | } | 79 | } |
76 | 80 | ||
77 | // setup IRC Relay | 81 | // setup IRC Relay |
78 | m_irc = new IRCChatModule(config); | 82 | m_irc = new IRCChatModule(config); |
79 | } | 83 | } |
80 | 84 | ||
81 | public void PostInitialise() | 85 | public void PostInitialise() |
82 | { | 86 | { |
83 | 87 | if (m_irc.Enabled) | |
84 | if (m_irc.Enabled) { | 88 | { |
85 | m_irc.Connect(m_scenes); | 89 | m_irc.Connect(m_scenes); |
86 | } | 90 | } |
87 | } | 91 | } |
88 | 92 | ||
89 | public void Close() | 93 | public void Close() |
90 | { | 94 | { |
91 | m_irc.Close(); | 95 | m_irc.Close(); |
92 | } | 96 | } |
@@ -111,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules | |||
111 | ScenePresence avatar = null; | 115 | ScenePresence avatar = null; |
112 | 116 | ||
113 | //TODO: Move ForEachScenePresence and others into IScene. | 117 | //TODO: Move ForEachScenePresence and others into IScene. |
114 | Scene scene = (Scene)e.Scene; | 118 | Scene scene = (Scene) e.Scene; |
115 | 119 | ||
116 | //TODO: Remove the need for this check | 120 | //TODO: Remove the need for this check |
117 | if (scene == null) | 121 | if (scene == null) |
@@ -119,10 +123,12 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | 123 | ||
120 | // Filled in since it's easier than rewriting right now. | 124 | // Filled in since it's easier than rewriting right now. |
121 | LLVector3 fromPos = e.Position; | 125 | LLVector3 fromPos = e.Position; |
122 | LLVector3 fromRegionPos = e.Position + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); | 126 | LLVector3 fromRegionPos = e.Position + |
127 | new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256, | ||
128 | 0); | ||
123 | string fromName = e.From; | 129 | string fromName = e.From; |
124 | string message = e.Message; | 130 | string message = e.Message; |
125 | byte type = (byte)e.Type; | 131 | byte type = (byte) e.Type; |
126 | LLUUID fromAgentID = LLUUID.Zero; | 132 | LLUUID fromAgentID = LLUUID.Zero; |
127 | 133 | ||
128 | if (e.Sender != null) | 134 | if (e.Sender != null) |
@@ -133,7 +139,8 @@ namespace OpenSim.Region.Environment.Modules | |||
133 | if (avatar != null) | 139 | if (avatar != null) |
134 | { | 140 | { |
135 | fromPos = avatar.AbsolutePosition; | 141 | fromPos = avatar.AbsolutePosition; |
136 | fromRegionPos = fromPos + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); | 142 | fromRegionPos = fromPos + |
143 | new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256, 0); | ||
137 | fromName = avatar.Firstname + " " + avatar.Lastname; | 144 | fromName = avatar.Firstname + " " + avatar.Lastname; |
138 | fromAgentID = e.Sender.AgentId; | 145 | fromAgentID = e.Sender.AgentId; |
139 | avatar = null; | 146 | avatar = null; |
@@ -159,75 +166,84 @@ namespace OpenSim.Region.Environment.Modules | |||
159 | break; | 166 | break; |
160 | } | 167 | } |
161 | 168 | ||
162 | m_log.Verbose("CHAT", fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + e.Message); | 169 | m_log.Verbose("CHAT", |
163 | 170 | fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + | |
164 | if (m_irc.Connected) | 171 | e.Message); |
165 | { | 172 | |
166 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); | 173 | if (m_irc.Connected) |
167 | } | 174 | { |
168 | 175 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); | |
169 | if (e.Channel == 0) | 176 | } |
170 | { | 177 | |
171 | foreach (Scene m_scene in m_scenes) | 178 | if (e.Channel == 0) |
172 | { | 179 | { |
173 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 180 | foreach (Scene m_scene in m_scenes) |
174 | { | 181 | { |
175 | int dis = -100000; | 182 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
176 | 183 | { | |
177 | LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0); | 184 | int dis = -100000; |
178 | dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); | 185 | |
179 | 186 | LLVector3 avatarRegionPos = presence.AbsolutePosition + | |
180 | switch (e.Type) | 187 | new LLVector3( |
181 | { | 188 | scene.RegionInfo.RegionLocX*256, |
182 | case ChatTypeEnum.Whisper: | 189 | scene.RegionInfo.RegionLocY*256, |
183 | if (dis < m_whisperdistance) | 190 | 0); |
184 | { | 191 | dis = |
185 | //should change so the message is sent through the avatar rather than direct to the ClientView | 192 | Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos)); |
186 | presence.ControllingClient.SendChatMessage(message, | 193 | |
187 | type, | 194 | switch (e.Type) |
188 | fromPos, | 195 | { |
189 | fromName, | 196 | case ChatTypeEnum.Whisper: |
190 | fromAgentID); | 197 | if (dis < m_whisperdistance) |
191 | } | 198 | { |
192 | break; | 199 | //should change so the message is sent through the avatar rather than direct to the ClientView |
193 | case ChatTypeEnum.Say: | 200 | presence.ControllingClient.SendChatMessage(message, |
194 | if (dis < m_saydistance) | 201 | type, |
195 | { | 202 | fromPos, |
196 | //Console.WriteLine("sending chat"); | 203 | fromName, |
197 | presence.ControllingClient.SendChatMessage(message, | 204 | fromAgentID); |
198 | type, | 205 | } |
199 | fromPos, | 206 | break; |
200 | fromName, | 207 | case ChatTypeEnum.Say: |
201 | fromAgentID); | 208 | if (dis < m_saydistance) |
202 | } | 209 | { |
203 | break; | 210 | //Console.WriteLine("sending chat"); |
204 | case ChatTypeEnum.Shout: | 211 | presence.ControllingClient.SendChatMessage(message, |
205 | if (dis < m_shoutdistance) | 212 | type, |
206 | { | 213 | fromPos, |
207 | presence.ControllingClient.SendChatMessage(message, | 214 | fromName, |
208 | type, | 215 | fromAgentID); |
209 | fromPos, | 216 | } |
210 | fromName, | 217 | break; |
211 | fromAgentID); | 218 | case ChatTypeEnum.Shout: |
212 | } | 219 | if (dis < m_shoutdistance) |
213 | break; | 220 | { |
214 | 221 | presence.ControllingClient.SendChatMessage(message, | |
215 | case ChatTypeEnum.Broadcast: | 222 | type, |
216 | presence.ControllingClient.SendChatMessage(message, type, | 223 | fromPos, |
217 | fromPos, | 224 | fromName, |
218 | fromName, | 225 | fromAgentID); |
219 | fromAgentID); | 226 | } |
220 | break; | 227 | break; |
221 | default: | 228 | |
222 | break; | 229 | case ChatTypeEnum.Broadcast: |
223 | } | 230 | presence.ControllingClient.SendChatMessage(message, |
224 | }); | 231 | type, |
232 | fromPos, | ||
233 | fromName, | ||
234 | fromAgentID); | ||
235 | break; | ||
236 | default: | ||
237 | break; | ||
238 | } | ||
239 | }); | ||
225 | } | 240 | } |
226 | } | 241 | } |
227 | } | 242 | } |
228 | } | 243 | } |
229 | 244 | ||
230 | class IRCChatModule { | 245 | internal class IRCChatModule |
246 | { | ||
231 | private string m_server = null; | 247 | private string m_server = null; |
232 | private int m_port = 6668; | 248 | private int m_port = 6668; |
233 | private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 249 | private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
@@ -238,7 +254,7 @@ namespace OpenSim.Region.Environment.Modules | |||
238 | private TcpClient m_tcp; | 254 | private TcpClient m_tcp; |
239 | private StreamWriter m_writer; | 255 | private StreamWriter m_writer; |
240 | private StreamReader m_reader; | 256 | private StreamReader m_reader; |
241 | 257 | ||
242 | private Thread pingSender; | 258 | private Thread pingSender; |
243 | private Thread listener; | 259 | private Thread listener; |
244 | 260 | ||
@@ -248,29 +264,36 @@ namespace OpenSim.Region.Environment.Modules | |||
248 | private List<Scene> m_scenes = null; | 264 | private List<Scene> m_scenes = null; |
249 | private LogBase m_log; | 265 | private LogBase m_log; |
250 | 266 | ||
251 | public IRCChatModule(Nini.Config.IConfigSource config) { | 267 | public IRCChatModule(IConfigSource config) |
268 | { | ||
252 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); | 269 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); |
253 | m_tcp = null; | 270 | m_tcp = null; |
254 | m_writer = null; | 271 | m_writer = null; |
255 | m_reader = null; | 272 | m_reader = null; |
256 | 273 | ||
257 | try { | 274 | try |
275 | { | ||
258 | m_server = config.Configs["IRC"].GetString("server"); | 276 | m_server = config.Configs["IRC"].GetString("server"); |
259 | m_nick = config.Configs["IRC"].GetString("nick"); | 277 | m_nick = config.Configs["IRC"].GetString("nick"); |
260 | m_channel = config.Configs["IRC"].GetString("channel"); | 278 | m_channel = config.Configs["IRC"].GetString("channel"); |
261 | m_port = config.Configs["IRC"].GetInt("port", m_port); | 279 | m_port = config.Configs["IRC"].GetInt("port", m_port); |
262 | m_user = config.Configs["IRC"].GetString("username", m_user); | 280 | m_user = config.Configs["IRC"].GetString("username", m_user); |
263 | if (m_server != null && m_nick != null && m_channel != null) { | 281 | if (m_server != null && m_nick != null && m_channel != null) |
282 | { | ||
264 | m_enabled = true; | 283 | m_enabled = true; |
265 | } | 284 | } |
266 | } catch (Exception e) { | 285 | } |
286 | catch (Exception e) | ||
287 | { | ||
267 | Console.WriteLine("No IRC config information, skipping IRC bridge configuration"); | 288 | Console.WriteLine("No IRC config information, skipping IRC bridge configuration"); |
268 | } | 289 | } |
269 | m_log = OpenSim.Framework.Console.MainLog.Instance; | 290 | m_log = MainLog.Instance; |
270 | } | 291 | } |
271 | 292 | ||
272 | public bool Connect(List<Scene> scenes) { | 293 | public bool Connect(List<Scene> scenes) |
273 | try { | 294 | { |
295 | try | ||
296 | { | ||
274 | m_scenes = scenes; | 297 | m_scenes = scenes; |
275 | 298 | ||
276 | m_tcp = new TcpClient(m_server, m_port); | 299 | m_tcp = new TcpClient(m_server, m_port); |
@@ -279,13 +302,13 @@ namespace OpenSim.Region.Environment.Modules | |||
279 | m_log.Verbose("IRC", "Connected to " + m_server); | 302 | m_log.Verbose("IRC", "Connected to " + m_server); |
280 | m_reader = new StreamReader(m_stream); | 303 | m_reader = new StreamReader(m_stream); |
281 | m_writer = new StreamWriter(m_stream); | 304 | m_writer = new StreamWriter(m_stream); |
282 | 305 | ||
283 | pingSender = new Thread(new ThreadStart(this.PingRun)); | 306 | pingSender = new Thread(new ThreadStart(PingRun)); |
284 | pingSender.Start(); | 307 | pingSender.Start(); |
285 | 308 | ||
286 | listener = new Thread(new ThreadStart(this.ListenerRun)); | 309 | listener = new Thread(new ThreadStart(ListenerRun)); |
287 | listener.Start(); | 310 | listener.Start(); |
288 | 311 | ||
289 | m_writer.WriteLine(m_user); | 312 | m_writer.WriteLine(m_user); |
290 | m_writer.Flush(); | 313 | m_writer.Flush(); |
291 | m_writer.WriteLine("NICK " + m_nick); | 314 | m_writer.WriteLine("NICK " + m_nick); |
@@ -294,50 +317,61 @@ namespace OpenSim.Region.Environment.Modules | |||
294 | m_writer.Flush(); | 317 | m_writer.Flush(); |
295 | m_log.Verbose("IRC", "Connection fully established"); | 318 | m_log.Verbose("IRC", "Connection fully established"); |
296 | m_connected = true; | 319 | m_connected = true; |
297 | } catch (Exception e) { | 320 | } |
321 | catch (Exception e) | ||
322 | { | ||
298 | Console.WriteLine(e.ToString()); | 323 | Console.WriteLine(e.ToString()); |
299 | } | 324 | } |
300 | return m_connected; | 325 | return m_connected; |
301 | } | 326 | } |
302 | 327 | ||
303 | public bool Enabled | 328 | public bool Enabled |
304 | { | 329 | { |
305 | get { return m_enabled; } | 330 | get { return m_enabled; } |
306 | } | 331 | } |
307 | 332 | ||
308 | public bool Connected | 333 | public bool Connected |
309 | { | 334 | { |
310 | get { return m_connected; } | 335 | get { return m_connected; } |
311 | } | 336 | } |
312 | 337 | ||
313 | public void PrivMsg(string from, string region, string msg) { | 338 | public void PrivMsg(string from, string region, string msg) |
314 | try { | 339 | { |
340 | try | ||
341 | { | ||
315 | m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); | 342 | m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); |
316 | m_writer.Flush(); | 343 | m_writer.Flush(); |
317 | } catch (IOException) { | 344 | } |
318 | m_log.Error("IRC","Disconnected from IRC server."); | 345 | catch (IOException) |
346 | { | ||
347 | m_log.Error("IRC", "Disconnected from IRC server."); | ||
319 | listener.Abort(); | 348 | listener.Abort(); |
320 | pingSender.Abort(); | 349 | pingSender.Abort(); |
321 | m_connected = false; | 350 | m_connected = false; |
322 | } | 351 | } |
323 | } | 352 | } |
324 | 353 | ||
325 | private Dictionary<string, string> ExtractMsg(string input) { | 354 | private Dictionary<string, string> ExtractMsg(string input) |
355 | { | ||
326 | Dictionary<string, string> result = null; | 356 | Dictionary<string, string> result = null; |
327 | string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; | 357 | string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; |
328 | Regex RE = new Regex(regex, RegexOptions.Multiline); | 358 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
329 | MatchCollection matches = RE.Matches(input); | 359 | MatchCollection matches = RE.Matches(input); |
330 | // Get some direct matches $1 $4 is a | 360 | // Get some direct matches $1 $4 is a |
331 | if ((matches.Count == 1) && (matches[0].Groups.Count == 5)) { | 361 | if ((matches.Count == 1) && (matches[0].Groups.Count == 5)) |
362 | { | ||
332 | result = new Dictionary<string, string>(); | 363 | result = new Dictionary<string, string>(); |
333 | result.Add("nick", matches[0].Groups[1].Value); | 364 | result.Add("nick", matches[0].Groups[1].Value); |
334 | result.Add("user", matches[0].Groups[2].Value); | 365 | result.Add("user", matches[0].Groups[2].Value); |
335 | result.Add("channel", matches[0].Groups[3].Value); | 366 | result.Add("channel", matches[0].Groups[3].Value); |
336 | result.Add("msg", matches[0].Groups[4].Value); | 367 | result.Add("msg", matches[0].Groups[4].Value); |
337 | } else { | 368 | } |
369 | else | ||
370 | { | ||
338 | m_log.Verbose("IRC", "Number of matches: " + matches.Count); | 371 | m_log.Verbose("IRC", "Number of matches: " + matches.Count); |
339 | if (matches.Count > 0) { | 372 | if (matches.Count > 0) |
340 | m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); | 373 | { |
374 | m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); | ||
341 | } | 375 | } |
342 | } | 376 | } |
343 | return result; | 377 | return result; |
@@ -365,19 +399,20 @@ namespace OpenSim.Region.Environment.Modules | |||
365 | if (inputLine.Contains(m_channel)) | 399 | if (inputLine.Contains(m_channel)) |
366 | { | 400 | { |
367 | Dictionary<string, string> data = ExtractMsg(inputLine); | 401 | Dictionary<string, string> data = ExtractMsg(inputLine); |
368 | if (data != null ) | 402 | if (data != null) |
369 | { | 403 | { |
370 | foreach (Scene m_scene in m_scenes) | 404 | foreach (Scene m_scene in m_scenes) |
371 | { | 405 | { |
372 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | 406 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) |
373 | { | ||
374 | if (!avatar.IsChildAgent) | ||
375 | { | 407 | { |
376 | avatar.ControllingClient.SendChatMessage( | 408 | if (!avatar.IsChildAgent) |
377 | Helpers.StringToField(data["msg"]), 255, pos, data["nick"], | 409 | { |
378 | LLUUID.Zero); | 410 | avatar.ControllingClient.SendChatMessage( |
379 | } | 411 | Helpers.StringToField(data["msg"]), 255, |
380 | }); | 412 | pos, data["nick"], |
413 | LLUUID.Zero); | ||
414 | } | ||
415 | }); | ||
381 | } | 416 | } |
382 | } | 417 | } |
383 | } | 418 | } |
@@ -387,7 +422,8 @@ namespace OpenSim.Region.Environment.Modules | |||
387 | } | 422 | } |
388 | 423 | ||
389 | 424 | ||
390 | public void Close() { | 425 | public void Close() |
426 | { | ||
391 | listener.Abort(); | 427 | listener.Abort(); |
392 | pingSender.Abort(); | 428 | pingSender.Abort(); |
393 | m_writer.Close(); | 429 | m_writer.Close(); |
@@ -395,4 +431,4 @@ namespace OpenSim.Region.Environment.Modules | |||
395 | m_tcp.Close(); | 431 | m_tcp.Close(); |
396 | } | 432 | } |
397 | } | 433 | } |
398 | } | 434 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 7c852dc..2bc3db8 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -29,10 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using Nini.Config; | ||
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
35 | using Nini.Config; | ||
36 | 36 | ||
37 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
38 | { | 38 | { |
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules | |||
99 | if (RenderPlugins.ContainsKey(contentType)) | 99 | if (RenderPlugins.ContainsKey(contentType)) |
100 | { | 100 | { |
101 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 101 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
102 | 102 | ||
103 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 103 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
104 | updater.SimUUID = simID; | 104 | updater.SimUUID = simID; |
105 | updater.PrimID = primID; | 105 | updater.PrimID = primID; |
@@ -187,4 +187,4 @@ namespace OpenSim.Region.Environment.Modules | |||
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |
190 | } | 190 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs index 00ea07a..046a46c 100644 --- a/OpenSim/Region/Environment/Modules/EmailModule.cs +++ b/OpenSim/Region/Environment/Modules/EmailModule.cs | |||
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | internal class EmailModule | 31 | internal class EmailModule |
32 | { | 32 | { |
33 | } | 33 | } |
34 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index 9144bee..d9f09f7 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
31 | using Nini.Config; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules | 33 | namespace OpenSim.Region.Environment.Modules |
34 | { | 34 | { |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules | |||
59 | get { return false; } | 59 | get { return false; } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index 150f294..50e9a39 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
31 | using Nini.Config; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules | 33 | namespace OpenSim.Region.Environment.Modules |
34 | { | 34 | { |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules | |||
59 | get { return false; } | 59 | get { return false; } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 9ac1d76..2ad027a 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -27,11 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework.Console; | ||
33 | using OpenSim.Framework; | ||
34 | using Nini.Config; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
37 | { | 38 | { |
@@ -42,7 +43,7 @@ namespace OpenSim.Region.Environment.Modules | |||
42 | 43 | ||
43 | public InstantMessageModule() | 44 | public InstantMessageModule() |
44 | { | 45 | { |
45 | m_log = OpenSim.Framework.Console.MainLog.Instance; | 46 | m_log = MainLog.Instance; |
46 | } | 47 | } |
47 | 48 | ||
48 | public void Initialise(Scene scene, IConfigSource config) | 49 | public void Initialise(Scene scene, IConfigSource config) |
@@ -50,33 +51,34 @@ namespace OpenSim.Region.Environment.Modules | |||
50 | if (!m_scenes.Contains(scene)) | 51 | if (!m_scenes.Contains(scene)) |
51 | { | 52 | { |
52 | m_scenes.Add(scene); | 53 | m_scenes.Add(scene); |
53 | scene.EventManager.OnNewClient += OnNewClient; | 54 | scene.EventManager.OnNewClient += OnNewClient; |
54 | } | 55 | } |
55 | } | 56 | } |
56 | 57 | ||
57 | void OnNewClient(OpenSim.Framework.IClientAPI client) | 58 | private void OnNewClient(IClientAPI client) |
58 | { | 59 | { |
59 | client.OnInstantMessage += OnInstantMessage; | 60 | client.OnInstantMessage += OnInstantMessage; |
60 | } | 61 | } |
61 | 62 | ||
62 | void OnInstantMessage(libsecondlife.LLUUID fromAgentID, | 63 | private void OnInstantMessage(LLUUID fromAgentID, |
63 | libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, | 64 | LLUUID fromAgentSession, LLUUID toAgentID, |
64 | libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, | 65 | LLUUID imSessionID, uint timestamp, string fromAgentName, |
65 | string message, byte dialog) | 66 | string message, byte dialog) |
66 | { | 67 | { |
67 | // TODO: Remove after debugging. Privacy implications. | 68 | // TODO: Remove after debugging. Privacy implications. |
68 | m_log.Verbose("IM",fromAgentName + ": " + message); | 69 | m_log.Verbose("IM", fromAgentName + ": " + message); |
69 | 70 | ||
70 | foreach (Scene m_scene in m_scenes) | 71 | foreach (Scene m_scene in m_scenes) |
71 | { | 72 | { |
72 | if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) | 73 | if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) |
73 | { | 74 | { |
74 | // Local Message | 75 | // Local Message |
75 | ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; | 76 | ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; |
76 | if (!user.IsChildAgent) | 77 | if (!user.IsChildAgent) |
77 | { | 78 | { |
78 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, | 79 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, |
79 | toAgentID, imSessionID, fromAgentName, dialog, timestamp); | 80 | toAgentID, imSessionID, fromAgentName, dialog, |
81 | timestamp); | ||
80 | } | 82 | } |
81 | // Message sent | 83 | // Message sent |
82 | return; | 84 | return; |
@@ -104,4 +106,4 @@ namespace OpenSim.Region.Environment.Modules | |||
104 | get { return true; } | 106 | get { return true; } |
105 | } | 107 | } |
106 | } | 108 | } |
107 | } | 109 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 3f8cd6e..e2ad0d5 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
31 | using Nini.Config; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules | 33 | namespace OpenSim.Region.Environment.Modules |
34 | { | 34 | { |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules | |||
59 | get { return false; } | 59 | get { return false; } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs index 8b8b386..9d10fc3 100644 --- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | |||
@@ -1,18 +1,16 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Net; | ||
5 | using System.IO; | ||
6 | using System.Drawing; | 2 | using System.Drawing; |
3 | using System.IO; | ||
4 | using System.Net; | ||
7 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Nini.Config; | ||
8 | using OpenJPEGNet; | 7 | using OpenJPEGNet; |
9 | using OpenSim.Region.Environment.Scenes; | ||
10 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
11 | using Nini.Config; | 9 | using OpenSim.Region.Environment.Scenes; |
12 | 10 | ||
13 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
14 | { | 12 | { |
15 | public class LoadImageURLModule : IRegionModule , IDynamicTextureRender | 13 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender |
16 | { | 14 | { |
17 | private string m_name = "LoadImageURL"; | 15 | private string m_name = "LoadImageURL"; |
18 | private IDynamicTextureManager m_textureManager; | 16 | private IDynamicTextureManager m_textureManager; |
@@ -85,25 +83,25 @@ namespace OpenSim.Region.Environment.Modules | |||
85 | private void MakeHttpRequest(string url, LLUUID requestID) | 83 | private void MakeHttpRequest(string url, LLUUID requestID) |
86 | { | 84 | { |
87 | WebRequest request = HttpWebRequest.Create(url); | 85 | WebRequest request = HttpWebRequest.Create(url); |
88 | RequestState state = new RequestState((HttpWebRequest)request, requestID); | 86 | RequestState state = new RequestState((HttpWebRequest) request, requestID); |
89 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); | 87 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); |
90 | 88 | ||
91 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); | 89 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); |
92 | state.TimeOfRequest = (int)t.TotalSeconds; | 90 | state.TimeOfRequest = (int) t.TotalSeconds; |
93 | } | 91 | } |
94 | 92 | ||
95 | private void HttpRequestReturn(IAsyncResult result) | 93 | private void HttpRequestReturn(IAsyncResult result) |
96 | { | 94 | { |
97 | RequestState state = (RequestState)result.AsyncState; | 95 | RequestState state = (RequestState) result.AsyncState; |
98 | WebRequest request = (WebRequest)state.Request; | 96 | WebRequest request = (WebRequest) state.Request; |
99 | HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); | 97 | HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result); |
100 | if (response.StatusCode == HttpStatusCode.OK) | 98 | if (response.StatusCode == HttpStatusCode.OK) |
101 | { | 99 | { |
102 | Bitmap image = new Bitmap(response.GetResponseStream()); | 100 | Bitmap image = new Bitmap(response.GetResponseStream()); |
103 | Bitmap resize = new Bitmap(image, new Size(512, 512)); | 101 | Bitmap resize = new Bitmap(image, new Size(512, 512)); |
104 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); | 102 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); |
105 | 103 | ||
106 | m_textureManager.ReturnData(state.RequestID, imageJ2000); | 104 | m_textureManager.ReturnData(state.RequestID, imageJ2000); |
107 | } | 105 | } |
108 | } | 106 | } |
109 | 107 | ||
@@ -119,6 +117,5 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | RequestID = requestID; | 117 | RequestID = requestID; |
120 | } | 118 | } |
121 | } | 119 | } |
122 | |||
123 | } | 120 | } |
124 | } | 121 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs index 9412089..5ac0b39 100644 --- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs | |||
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | internal class ScriptsHttpRequests | 31 | internal class ScriptsHttpRequests |
32 | { | 32 | { |
33 | } | 33 | } |
34 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs index d22a722..77f8db2 100644 --- a/OpenSim/Region/Environment/Modules/TeleportModule.cs +++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs | |||
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | internal class TeleportModule | 31 | internal class TeleportModule |
32 | { | 32 | { |
33 | } | 33 | } |
34 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index 5eeeca6..66c499b 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -27,14 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | ||
31 | using libsecondlife; | 30 | using libsecondlife; |
32 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Interfaces; | 32 | using Nini.Config; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
37 | using Nini.Config; | ||
38 | 36 | ||
39 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
40 | { | 38 | { |
@@ -42,17 +40,19 @@ namespace OpenSim.Region.Environment.Modules | |||
42 | { | 40 | { |
43 | private Scene m_scene; | 41 | private Scene m_scene; |
44 | private List<Scene> m_scenes = new List<Scene>(); | 42 | private List<Scene> m_scenes = new List<Scene>(); |
45 | private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests = new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>(); | 43 | |
44 | private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests = | ||
45 | new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>(); | ||
46 | 46 | ||
47 | private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); | 47 | private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); |
48 | private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); | 48 | private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); |
49 | // private Thread m_thread; | 49 | // private Thread m_thread; |
50 | 50 | ||
51 | public TextureDownloadModule() | 51 | public TextureDownloadModule() |
52 | { | 52 | { |
53 | // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); | 53 | // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); |
54 | // m_thread.IsBackground = true; | 54 | // m_thread.IsBackground = true; |
55 | // m_thread.Start(); | 55 | // m_thread.Start(); |
56 | } | 56 | } |
57 | 57 | ||
58 | public void Initialise(Scene scene, IConfigSource config) | 58 | public void Initialise(Scene scene, IConfigSource config) |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules | |||
85 | 85 | ||
86 | public void NewClient(IClientAPI client) | 86 | public void NewClient(IClientAPI client) |
87 | { | 87 | { |
88 | /* lock (ClientRequests) | 88 | /* lock (ClientRequests) |
89 | { | 89 | { |
90 | if (!ClientRequests.ContainsKey(client.AgentId)) | 90 | if (!ClientRequests.ContainsKey(client.AgentId)) |
91 | { | 91 | { |
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | 120 | ||
121 | public void TextureRequest(Object sender, TextureRequestArgs e) | 121 | public void TextureRequest(Object sender, TextureRequestArgs e) |
122 | { | 122 | { |
123 | IClientAPI client = (IClientAPI)sender; | 123 | IClientAPI client = (IClientAPI) sender; |
124 | if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) | 124 | if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) |
125 | { | 125 | { |
126 | lock (ClientRequests) | 126 | lock (ClientRequests) |
@@ -136,15 +136,15 @@ namespace OpenSim.Region.Environment.Modules | |||
136 | { | 136 | { |
137 | while (true) | 137 | while (true) |
138 | { | 138 | { |
139 | TextureSender sender = this.QueueSenders.Dequeue(); | 139 | TextureSender sender = QueueSenders.Dequeue(); |
140 | bool finished = sender.SendTexture(); | 140 | bool finished = sender.SendTexture(); |
141 | if (finished) | 141 | if (finished) |
142 | { | 142 | { |
143 | this.TextureSent(sender); | 143 | TextureSent(sender); |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | this.QueueSenders.Enqueue(sender); | 147 | QueueSenders.Enqueue(sender); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
@@ -173,13 +173,13 @@ namespace OpenSim.Region.Environment.Modules | |||
173 | 173 | ||
174 | if (asset.Data.LongLength > 600) | 174 | if (asset.Data.LongLength > 600) |
175 | { | 175 | { |
176 | NumPackets = 2 + (int)(asset.Data.Length - 601) / 1000; | 176 | NumPackets = 2 + (int) (asset.Data.Length - 601)/1000; |
177 | } | 177 | } |
178 | else | 178 | else |
179 | { | 179 | { |
180 | NumPackets = 1; | 180 | NumPackets = 1; |
181 | } | 181 | } |
182 | 182 | ||
183 | PacketCounter = (int) req.PacketNumber; | 183 | PacketCounter = (int) req.PacketNumber; |
184 | } | 184 | } |
185 | 185 | ||
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules | |||
205 | im.Header.Reliable = false; | 205 | im.Header.Reliable = false; |
206 | im.ImageID.Packets = 1; | 206 | im.ImageID.Packets = 1; |
207 | im.ImageID.ID = m_asset.FullID; | 207 | im.ImageID.ID = m_asset.FullID; |
208 | im.ImageID.Size = (uint)m_asset.Data.Length; | 208 | im.ImageID.Size = (uint) m_asset.Data.Length; |
209 | im.ImageData.Data = m_asset.Data; | 209 | im.ImageData.Data = m_asset.Data; |
210 | im.ImageID.Codec = 2; | 210 | im.ImageID.Codec = 2; |
211 | req.RequestUser.OutPacket(im); | 211 | req.RequestUser.OutPacket(im); |
@@ -215,9 +215,9 @@ namespace OpenSim.Region.Environment.Modules | |||
215 | { | 215 | { |
216 | ImageDataPacket im = new ImageDataPacket(); | 216 | ImageDataPacket im = new ImageDataPacket(); |
217 | im.Header.Reliable = false; | 217 | im.Header.Reliable = false; |
218 | im.ImageID.Packets = (ushort)(NumPackets); | 218 | im.ImageID.Packets = (ushort) (NumPackets); |
219 | im.ImageID.ID = m_asset.FullID; | 219 | im.ImageID.ID = m_asset.FullID; |
220 | im.ImageID.Size = (uint)m_asset.Data.Length; | 220 | im.ImageID.Size = (uint) m_asset.Data.Length; |
221 | im.ImageData.Data = new byte[600]; | 221 | im.ImageData.Data = new byte[600]; |
222 | Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); | 222 | Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); |
223 | im.ImageID.Codec = 2; | 223 | im.ImageID.Codec = 2; |
@@ -229,18 +229,16 @@ namespace OpenSim.Region.Environment.Modules | |||
229 | { | 229 | { |
230 | ImagePacketPacket im = new ImagePacketPacket(); | 230 | ImagePacketPacket im = new ImagePacketPacket(); |
231 | im.Header.Reliable = false; | 231 | im.Header.Reliable = false; |
232 | im.ImageID.Packet = (ushort)(PacketCounter); | 232 | im.ImageID.Packet = (ushort) (PacketCounter); |
233 | im.ImageID.ID = m_asset.FullID; | 233 | im.ImageID.ID = m_asset.FullID; |
234 | int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); | 234 | int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1)); |
235 | if (size > 1000) size = 1000; | 235 | if (size > 1000) size = 1000; |
236 | im.ImageData.Data = new byte[size]; | 236 | im.ImageData.Data = new byte[size]; |
237 | Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); | 237 | Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size); |
238 | req.RequestUser.OutPacket(im); | 238 | req.RequestUser.OutPacket(im); |
239 | PacketCounter++; | 239 | PacketCounter++; |
240 | } | 240 | } |
241 | |||
242 | } | 241 | } |
243 | |||
244 | } | 242 | } |
245 | 243 | ||
246 | public class AssetRequest | 244 | public class AssetRequest |
@@ -258,6 +256,5 @@ namespace OpenSim.Region.Environment.Modules | |||
258 | PacketNumber = packetNumber; | 256 | PacketNumber = packetNumber; |
259 | } | 257 | } |
260 | } | 258 | } |
261 | |||
262 | } | 259 | } |
263 | } | 260 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs index a697162..7a631d7 100644 --- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs | |||
@@ -27,20 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.IO; | 30 | using System.Collections.Generic; |
31 | using System.Net.Sockets; | ||
32 | using System.Text; | ||
33 | using System.Threading; | ||
34 | using libsecondlife; | 31 | using libsecondlife; |
35 | using OpenSim.Framework.Interfaces; | 32 | using Nini.Config; |
36 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
37 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
39 | using OpenSim.Framework.Servers; | ||
40 | using Nwc.XmlRpc; | ||
41 | using System.Collections; | ||
42 | using System.Collections.Generic; | ||
43 | using Nini.Config; | ||
44 | 36 | ||
45 | /***************************************************** | 37 | /***************************************************** |
46 | * | 38 | * |
@@ -71,6 +63,7 @@ using Nini.Config; | |||
71 | * thats the way it works. | 63 | * thats the way it works. |
72 | * | 64 | * |
73 | * **************************************************/ | 65 | * **************************************************/ |
66 | |||
74 | namespace OpenSim.Region.Environment.Modules | 67 | namespace OpenSim.Region.Environment.Modules |
75 | { | 68 | { |
76 | public class WorldCommModule : IRegionModule, IWorldComm | 69 | public class WorldCommModule : IRegionModule, IWorldComm |
@@ -120,9 +113,9 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) | 113 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) |
121 | { | 114 | { |
122 | DeliverMessage(e.Sender.AgentId.ToString(), | 115 | DeliverMessage(e.Sender.AgentId.ToString(), |
123 | (int)e.Type, e.Channel, | 116 | (int) e.Type, e.Channel, |
124 | e.Sender.FirstName + " " + e.Sender.LastName, | 117 | e.Sender.FirstName + " " + e.Sender.LastName, |
125 | e.Message); | 118 | e.Message); |
126 | } | 119 | } |
127 | 120 | ||
128 | public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 121 | public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) |
@@ -132,11 +125,10 @@ namespace OpenSim.Region.Environment.Modules | |||
132 | 125 | ||
133 | public void ListenControl(int handle, int active) | 126 | public void ListenControl(int handle, int active) |
134 | { | 127 | { |
135 | if ( active == 1 ) | 128 | if (active == 1) |
136 | m_listenerManager.Activate(handle); | 129 | m_listenerManager.Activate(handle); |
137 | else if ( active == 0 ) | 130 | else if (active == 0) |
138 | m_listenerManager.Dectivate(handle); | 131 | m_listenerManager.Dectivate(handle); |
139 | |||
140 | } | 132 | } |
141 | 133 | ||
142 | public void ListenRemove(int handle) | 134 | public void ListenRemove(int handle) |
@@ -151,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules | |||
151 | // nearby avatards, the SimChat function is used. | 143 | // nearby avatards, the SimChat function is used. |
152 | public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) | 144 | public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) |
153 | { | 145 | { |
154 | |||
155 | SceneObjectPart source = null; | 146 | SceneObjectPart source = null; |
156 | ScenePresence avatar = null; | 147 | ScenePresence avatar = null; |
157 | 148 | ||
@@ -160,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules | |||
160 | { | 151 | { |
161 | avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID)); | 152 | avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID)); |
162 | } | 153 | } |
163 | if( (avatar != null) || (source != null) ) | 154 | if ((avatar != null) || (source != null)) |
164 | { | 155 | { |
165 | // Loop through the objects in the scene | 156 | // Loop through the objects in the scene |
166 | // If they are in proximity, then if they are | 157 | // If they are in proximity, then if they are |
@@ -169,12 +160,12 @@ namespace OpenSim.Region.Environment.Modules | |||
169 | foreach (LLUUID eb in m_scene.Entities.Keys) | 160 | foreach (LLUUID eb in m_scene.Entities.Keys) |
170 | { | 161 | { |
171 | EntityBase sPart; | 162 | EntityBase sPart; |
172 | 163 | ||
173 | m_scene.Entities.TryGetValue(eb, out sPart); | 164 | m_scene.Entities.TryGetValue(eb, out sPart); |
174 | 165 | ||
175 | // Dont process if this message is from itself! | 166 | // Dont process if this message is from itself! |
176 | if (eb.ToString().Equals(sourceItemID) || | 167 | if (eb.ToString().Equals(sourceItemID) || |
177 | sPart.UUID.ToString().Equals(sourceItemID) ) | 168 | sPart.UUID.ToString().Equals(sourceItemID)) |
178 | continue; | 169 | continue; |
179 | 170 | ||
180 | double dis = 0; | 171 | double dis = 0; |
@@ -192,12 +183,11 @@ namespace OpenSim.Region.Environment.Modules | |||
192 | { | 183 | { |
193 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 184 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
194 | sourceItemID, sPart.UUID, channel, name, msg | 185 | sourceItemID, sPart.UUID, channel, name, msg |
195 | ); | 186 | ); |
196 | if (isListener != null) | 187 | if (isListener != null) |
197 | { | 188 | { |
198 | m_pending.Enqueue(isListener); | 189 | m_pending.Enqueue(isListener); |
199 | } | 190 | } |
200 | |||
201 | } | 191 | } |
202 | break; | 192 | break; |
203 | 193 | ||
@@ -207,12 +197,11 @@ namespace OpenSim.Region.Environment.Modules | |||
207 | { | 197 | { |
208 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 198 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
209 | sourceItemID, sPart.UUID, channel, name, msg | 199 | sourceItemID, sPart.UUID, channel, name, msg |
210 | ); | 200 | ); |
211 | if (isListener != null) | 201 | if (isListener != null) |
212 | { | 202 | { |
213 | m_pending.Enqueue(isListener); | 203 | m_pending.Enqueue(isListener); |
214 | } | 204 | } |
215 | |||
216 | } | 205 | } |
217 | break; | 206 | break; |
218 | 207 | ||
@@ -221,22 +210,22 @@ namespace OpenSim.Region.Environment.Modules | |||
221 | { | 210 | { |
222 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 211 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
223 | sourceItemID, sPart.UUID, channel, name, msg | 212 | sourceItemID, sPart.UUID, channel, name, msg |
224 | ); | 213 | ); |
225 | if (isListener != null) | 214 | if (isListener != null) |
226 | { | 215 | { |
227 | m_pending.Enqueue(isListener); | 216 | m_pending.Enqueue(isListener); |
228 | } | 217 | } |
229 | |||
230 | } | 218 | } |
231 | break; | 219 | break; |
232 | 220 | ||
233 | case 0xff: // Broadcast | 221 | case 0xff: // Broadcast |
234 | ListenerInfo isListen = m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); | 222 | ListenerInfo isListen = |
223 | m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); | ||
235 | if (isListen != null) | 224 | if (isListen != null) |
236 | { | 225 | { |
237 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 226 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
238 | sourceItemID, sPart.UUID, channel, name, msg | 227 | sourceItemID, sPart.UUID, channel, name, msg |
239 | ); | 228 | ); |
240 | if (isListener != null) | 229 | if (isListener != null) |
241 | { | 230 | { |
242 | m_pending.Enqueue(isListener); | 231 | m_pending.Enqueue(isListener); |
@@ -244,10 +233,9 @@ namespace OpenSim.Region.Environment.Modules | |||
244 | } | 233 | } |
245 | break; | 234 | break; |
246 | } | 235 | } |
247 | }; | 236 | } |
248 | 237 | ; | |
249 | } | 238 | } |
250 | |||
251 | } | 239 | } |
252 | 240 | ||
253 | public bool HasMessages() | 241 | public bool HasMessages() |
@@ -257,18 +245,15 @@ namespace OpenSim.Region.Environment.Modules | |||
257 | 245 | ||
258 | public ListenerInfo GetNextMessage() | 246 | public ListenerInfo GetNextMessage() |
259 | { | 247 | { |
260 | |||
261 | ListenerInfo li = null; | 248 | ListenerInfo li = null; |
262 | 249 | ||
263 | lock (CommListLock) | 250 | lock (CommListLock) |
264 | { | 251 | { |
265 | li = m_pending.Dequeue(); | 252 | li = m_pending.Dequeue(); |
266 | } | 253 | } |
267 | 254 | ||
268 | return li; | 255 | return li; |
269 | |||
270 | } | 256 | } |
271 | |||
272 | } | 257 | } |
273 | 258 | ||
274 | // hostID: the ID of the ScenePart | 259 | // hostID: the ID of the ScenePart |
@@ -285,20 +270,19 @@ namespace OpenSim.Region.Environment.Modules | |||
285 | m_listeners = new Dictionary<int, ListenerInfo>(); | 270 | m_listeners = new Dictionary<int, ListenerInfo>(); |
286 | } | 271 | } |
287 | 272 | ||
288 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 273 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, |
274 | string msg) | ||
289 | { | 275 | { |
290 | 276 | if (m_listeners.Count < m_MaxListeners) | |
291 | if ( m_listeners.Count < m_MaxListeners ) | ||
292 | { | 277 | { |
293 | ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg); | 278 | ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg); |
294 | 279 | ||
295 | if(isListener == null) | 280 | if (isListener == null) |
296 | { | 281 | { |
297 | int newHandle = GetNewHandle(); | 282 | int newHandle = GetNewHandle(); |
298 | 283 | ||
299 | if (newHandle > -1) | 284 | if (newHandle > -1) |
300 | { | 285 | { |
301 | |||
302 | ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg); | 286 | ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg); |
303 | 287 | ||
304 | lock (ListenersLock) | 288 | lock (ListenersLock) |
@@ -308,13 +292,10 @@ namespace OpenSim.Region.Environment.Modules | |||
308 | 292 | ||
309 | return newHandle; | 293 | return newHandle; |
310 | } | 294 | } |
311 | |||
312 | } | 295 | } |
313 | |||
314 | } | 296 | } |
315 | 297 | ||
316 | return -1; | 298 | return -1; |
317 | |||
318 | } | 299 | } |
319 | 300 | ||
320 | public void Remove(int handle) | 301 | public void Remove(int handle) |
@@ -324,7 +305,6 @@ namespace OpenSim.Region.Environment.Modules | |||
324 | 305 | ||
325 | private int GetNewHandle() | 306 | private int GetNewHandle() |
326 | { | 307 | { |
327 | |||
328 | for (int i = 0; i < int.MaxValue - 1; i++) | 308 | for (int i = 0; i < int.MaxValue - 1; i++) |
329 | { | 309 | { |
330 | if (!m_listeners.ContainsKey(i)) | 310 | if (!m_listeners.ContainsKey(i)) |
@@ -332,12 +312,10 @@ namespace OpenSim.Region.Environment.Modules | |||
332 | } | 312 | } |
333 | 313 | ||
334 | return -1; | 314 | return -1; |
335 | |||
336 | } | 315 | } |
337 | 316 | ||
338 | public bool IsListener(LLUUID hostID) | 317 | public bool IsListener(LLUUID hostID) |
339 | { | 318 | { |
340 | |||
341 | foreach (ListenerInfo li in m_listeners.Values) | 319 | foreach (ListenerInfo li in m_listeners.Values) |
342 | { | 320 | { |
343 | if (li.GetHostID().Equals(hostID)) | 321 | if (li.GetHostID().Equals(hostID)) |
@@ -345,15 +323,13 @@ namespace OpenSim.Region.Environment.Modules | |||
345 | } | 323 | } |
346 | 324 | ||
347 | return false; | 325 | return false; |
348 | |||
349 | } | 326 | } |
350 | 327 | ||
351 | public void Activate(int handle) | 328 | public void Activate(int handle) |
352 | { | 329 | { |
353 | |||
354 | ListenerInfo li; | 330 | ListenerInfo li; |
355 | 331 | ||
356 | if( m_listeners.TryGetValue(handle, out li) ) | 332 | if (m_listeners.TryGetValue(handle, out li)) |
357 | { | 333 | { |
358 | li.Activate(); | 334 | li.Activate(); |
359 | } | 335 | } |
@@ -361,10 +337,9 @@ namespace OpenSim.Region.Environment.Modules | |||
361 | 337 | ||
362 | public void Dectivate(int handle) | 338 | public void Dectivate(int handle) |
363 | { | 339 | { |
364 | |||
365 | ListenerInfo li; | 340 | ListenerInfo li; |
366 | 341 | ||
367 | if( m_listeners.TryGetValue(handle, out li) ) | 342 | if (m_listeners.TryGetValue(handle, out li)) |
368 | { | 343 | { |
369 | li.Deactivate(); | 344 | li.Deactivate(); |
370 | } | 345 | } |
@@ -372,40 +347,40 @@ namespace OpenSim.Region.Environment.Modules | |||
372 | 347 | ||
373 | // Theres probably a more clever and efficient way to | 348 | // Theres probably a more clever and efficient way to |
374 | // do this, maybe with regex. | 349 | // do this, maybe with regex. |
375 | public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name, string msg) | 350 | public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name, |
351 | string msg) | ||
376 | { | 352 | { |
377 | |||
378 | bool isMatch = true; | 353 | bool isMatch = true; |
379 | 354 | ||
380 | foreach (ListenerInfo li in m_listeners.Values) | 355 | foreach (ListenerInfo li in m_listeners.Values) |
381 | { | 356 | { |
382 | if (li.GetHostID().Equals(listenerKey)) | 357 | if (li.GetHostID().Equals(listenerKey)) |
383 | { | 358 | { |
384 | if ( li.IsActive() ) | 359 | if (li.IsActive()) |
385 | { | 360 | { |
386 | if ( channel == li.GetChannel() ) | 361 | if (channel == li.GetChannel()) |
387 | { | 362 | { |
388 | if ( (li.GetID().ToString().Length > 0) && | 363 | if ((li.GetID().ToString().Length > 0) && |
389 | (!li.GetID().Equals(LLUUID.Zero)) ) | 364 | (!li.GetID().Equals(LLUUID.Zero))) |
390 | { | 365 | { |
391 | if (!li.GetID().ToString().Equals(sourceItemID)) | 366 | if (!li.GetID().ToString().Equals(sourceItemID)) |
392 | { | 367 | { |
393 | isMatch = false; | 368 | isMatch = false; |
394 | } | 369 | } |
395 | } | 370 | } |
396 | if ( isMatch && (li.GetName().Length > 0) ) | 371 | if (isMatch && (li.GetName().Length > 0)) |
397 | { | 372 | { |
398 | if ( li.GetName().Equals(name) ) | 373 | if (li.GetName().Equals(name)) |
399 | { | 374 | { |
400 | isMatch = false; | 375 | isMatch = false; |
401 | } | 376 | } |
402 | } | 377 | } |
403 | if ( isMatch ) | 378 | if (isMatch) |
404 | { | 379 | { |
405 | return new ListenerInfo( | 380 | return new ListenerInfo( |
406 | li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(), | 381 | li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(), |
407 | li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID) | 382 | li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID) |
408 | ); | 383 | ); |
409 | } | 384 | } |
410 | } | 385 | } |
411 | } | 386 | } |
@@ -413,35 +388,36 @@ namespace OpenSim.Region.Environment.Modules | |||
413 | } | 388 | } |
414 | return null; | 389 | return null; |
415 | } | 390 | } |
416 | |||
417 | } | 391 | } |
418 | 392 | ||
419 | public class ListenerInfo | 393 | public class ListenerInfo |
420 | { | 394 | { |
421 | 395 | private LLUUID m_itemID; // ID of the host script engine | |
422 | private LLUUID m_itemID; // ID of the host script engine | 396 | private LLUUID m_hostID; // ID of the host/scene part |
423 | private LLUUID m_hostID; // ID of the host/scene part | 397 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message |
424 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message | 398 | private int m_channel; // Channel |
425 | private int m_channel; // Channel | 399 | private int m_handle; // Assigned handle of this listener |
426 | private int m_handle; // Assigned handle of this listener | 400 | private uint m_localID; // Local ID from script engine |
427 | private uint m_localID; // Local ID from script engine | 401 | private string m_name; // Object name to filter messages from |
428 | private string m_name; // Object name to filter messages from | 402 | private LLUUID m_id; // ID to filter messages from |
429 | private LLUUID m_id; // ID to filter messages from | 403 | private string m_message; // The message |
430 | private string m_message; // The message | 404 | private bool m_active; // Listener is active or not |
431 | private bool m_active; // Listener is active or not | 405 | |
432 | 406 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, | |
433 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) | 407 | string message) |
434 | { | 408 | { |
435 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); | 409 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); |
436 | } | 410 | } |
437 | 411 | ||
438 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message, LLUUID sourceItemID) | 412 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, |
413 | string message, LLUUID sourceItemID) | ||
439 | { | 414 | { |
440 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); | 415 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); |
441 | m_sourceItemID = sourceItemID; | 416 | m_sourceItemID = sourceItemID; |
442 | } | 417 | } |
443 | 418 | ||
444 | private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) | 419 | private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, |
420 | LLUUID id, string message) | ||
445 | { | 421 | { |
446 | m_handle = handle; | 422 | m_handle = handle; |
447 | m_channel = channel; | 423 | m_channel = channel; |
@@ -453,55 +429,65 @@ namespace OpenSim.Region.Environment.Modules | |||
453 | m_active = true; | 429 | m_active = true; |
454 | m_localID = localID; | 430 | m_localID = localID; |
455 | } | 431 | } |
432 | |||
456 | public LLUUID GetItemID() | 433 | public LLUUID GetItemID() |
457 | { | 434 | { |
458 | return m_itemID; | 435 | return m_itemID; |
459 | } | 436 | } |
437 | |||
460 | public LLUUID GetHostID() | 438 | public LLUUID GetHostID() |
461 | { | 439 | { |
462 | return m_hostID; | 440 | return m_hostID; |
463 | } | 441 | } |
442 | |||
464 | public LLUUID GetSourceItemID() | 443 | public LLUUID GetSourceItemID() |
465 | { | 444 | { |
466 | return m_sourceItemID; | 445 | return m_sourceItemID; |
467 | } | 446 | } |
447 | |||
468 | public int GetChannel() | 448 | public int GetChannel() |
469 | { | 449 | { |
470 | return m_channel; | 450 | return m_channel; |
471 | } | 451 | } |
452 | |||
472 | public uint GetLocalID() | 453 | public uint GetLocalID() |
473 | { | 454 | { |
474 | return m_localID; | 455 | return m_localID; |
475 | } | 456 | } |
457 | |||
476 | public int GetHandle() | 458 | public int GetHandle() |
477 | { | 459 | { |
478 | return m_handle; | 460 | return m_handle; |
479 | } | 461 | } |
462 | |||
480 | public string GetMessage() | 463 | public string GetMessage() |
481 | { | 464 | { |
482 | return m_message; | 465 | return m_message; |
483 | } | 466 | } |
467 | |||
484 | public string GetName() | 468 | public string GetName() |
485 | { | 469 | { |
486 | return m_name; | 470 | return m_name; |
487 | } | 471 | } |
472 | |||
488 | public bool IsActive() | 473 | public bool IsActive() |
489 | { | 474 | { |
490 | return m_active; | 475 | return m_active; |
491 | } | 476 | } |
477 | |||
492 | public void Deactivate() | 478 | public void Deactivate() |
493 | { | 479 | { |
494 | m_active = false; | 480 | m_active = false; |
495 | } | 481 | } |
482 | |||
496 | public void Activate() | 483 | public void Activate() |
497 | { | 484 | { |
498 | m_active = true; | 485 | m_active = true; |
499 | } | 486 | } |
487 | |||
500 | public LLUUID GetID() | 488 | public LLUUID GetID() |
501 | { | 489 | { |
502 | return m_id; | 490 | return m_id; |
503 | } | 491 | } |
504 | |||
505 | } | 492 | } |
506 | 493 | } \ No newline at end of file | |
507 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs index dd84778..434c92f 100644 --- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs | |||
@@ -26,20 +26,15 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System.Collections; |
30 | using System.IO; | 30 | using System.Collections.Generic; |
31 | using System.Net.Sockets; | ||
32 | using System.Threading; | 31 | using System.Threading; |
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using OpenSim.Framework.Interfaces; | 33 | using Nini.Config; |
35 | using OpenSim.Framework; | 34 | using Nwc.XmlRpc; |
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
38 | using OpenSim.Framework.Servers; | ||
39 | using Nwc.XmlRpc; | ||
40 | using System.Collections; | ||
41 | using System.Collections.Generic; | ||
42 | using Nini.Config; | ||
43 | 38 | ||
44 | /***************************************************** | 39 | /***************************************************** |
45 | * | 40 | * |
@@ -73,6 +68,7 @@ using Nini.Config; | |||
73 | * llCloseRemoteDataChannel | 68 | * llCloseRemoteDataChannel |
74 | * | 69 | * |
75 | * **************************************************/ | 70 | * **************************************************/ |
71 | |||
76 | namespace OpenSim.Region.Environment.Modules | 72 | namespace OpenSim.Region.Environment.Modules |
77 | { | 73 | { |
78 | public class XMLRPCModule : IRegionModule, IXMLRPC | 74 | public class XMLRPCModule : IRegionModule, IXMLRPC |
@@ -83,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules | |||
83 | private string m_name = "XMLRPCModule"; | 79 | private string m_name = "XMLRPCModule"; |
84 | private int RemoteReplyScriptWait = 100; | 80 | private int RemoteReplyScriptWait = 100; |
85 | private int RemoteReplyScriptTimeout = 300; | 81 | private int RemoteReplyScriptTimeout = 300; |
86 | 82 | ||
87 | // <channel id, RPCChannelInfo> | 83 | // <channel id, RPCChannelInfo> |
88 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; | 84 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; |
89 | 85 | ||
@@ -106,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules | |||
106 | // Start http server | 102 | // Start http server |
107 | // Attach xmlrpc handlers | 103 | // Attach xmlrpc handlers |
108 | BaseHttpServer httpServer = new BaseHttpServer(20800); | 104 | BaseHttpServer httpServer = new BaseHttpServer(20800); |
109 | httpServer.AddXmlRPCHandler("llRemoteData", this.XmlRpcRemoteData); | 105 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); |
110 | httpServer.Start(); | 106 | httpServer.Start(); |
111 | } | 107 | } |
112 | 108 | ||
@@ -141,6 +137,7 @@ namespace OpenSim.Region.Environment.Modules | |||
141 | * current channel and assign a new one. | 137 | * current channel and assign a new one. |
142 | * | 138 | * |
143 | * ********************************************/ | 139 | * ********************************************/ |
140 | |||
144 | public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) | 141 | public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) |
145 | { | 142 | { |
146 | LLUUID channel = null; | 143 | LLUUID channel = null; |
@@ -156,7 +153,7 @@ namespace OpenSim.Region.Environment.Modules | |||
156 | } | 153 | } |
157 | } | 154 | } |
158 | 155 | ||
159 | if ( (channel == null) || (channel.Equals(LLUUID.Zero)) ) | 156 | if ((channel == null) || (channel.Equals(LLUUID.Zero))) |
160 | { | 157 | { |
161 | channel = LLUUID.Random(); | 158 | channel = LLUUID.Random(); |
162 | RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); | 159 | RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); |
@@ -164,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules | |||
164 | { | 161 | { |
165 | m_openChannels.Add(channel, rpcChanInfo); | 162 | m_openChannels.Add(channel, rpcChanInfo); |
166 | } | 163 | } |
167 | |||
168 | } | 164 | } |
169 | 165 | ||
170 | return channel; | 166 | return channel; |
@@ -176,6 +172,7 @@ namespace OpenSim.Region.Environment.Modules | |||
176 | * Response to RPC message | 172 | * Response to RPC message |
177 | * | 173 | * |
178 | *********************************************/ | 174 | *********************************************/ |
175 | |||
179 | public void RemoteDataReply(string channel, string message_id, string sdata, int idata) | 176 | public void RemoteDataReply(string channel, string message_id, string sdata, int idata) |
180 | { | 177 | { |
181 | RPCRequestInfo rpcInfo; | 178 | RPCRequestInfo rpcInfo; |
@@ -191,7 +188,6 @@ namespace OpenSim.Region.Environment.Modules | |||
191 | m_pendingResponse.Remove(message_key); | 188 | m_pendingResponse.Remove(message_key); |
192 | } | 189 | } |
193 | } | 190 | } |
194 | |||
195 | } | 191 | } |
196 | 192 | ||
197 | /********************************************** | 193 | /********************************************** |
@@ -200,41 +196,44 @@ namespace OpenSim.Region.Environment.Modules | |||
200 | * Remove channel from dictionary | 196 | * Remove channel from dictionary |
201 | * | 197 | * |
202 | *********************************************/ | 198 | *********************************************/ |
199 | |||
203 | public void CloseXMLRPCChannel(LLUUID channelKey) | 200 | public void CloseXMLRPCChannel(LLUUID channelKey) |
204 | { | 201 | { |
205 | if(m_openChannels.ContainsKey(channelKey)) | 202 | if (m_openChannels.ContainsKey(channelKey)) |
206 | m_openChannels.Remove(channelKey); | 203 | m_openChannels.Remove(channelKey); |
207 | } | 204 | } |
208 | 205 | ||
209 | 206 | ||
210 | public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request) | 207 | public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request) |
211 | { | 208 | { |
212 | |||
213 | XmlRpcResponse response = new XmlRpcResponse(); | 209 | XmlRpcResponse response = new XmlRpcResponse(); |
214 | 210 | ||
215 | Hashtable requestData = (Hashtable)request.Params[0]; | 211 | Hashtable requestData = (Hashtable) request.Params[0]; |
216 | bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") && requestData.Contains("StringValue")); | 212 | bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") && |
213 | requestData.Contains("StringValue")); | ||
217 | 214 | ||
218 | if (GoodXML) | 215 | if (GoodXML) |
219 | { | 216 | { |
220 | LLUUID channel = new LLUUID((string)requestData["Channel"]); | 217 | LLUUID channel = new LLUUID((string) requestData["Channel"]); |
221 | RPCChannelInfo rpcChanInfo; | 218 | RPCChannelInfo rpcChanInfo; |
222 | if (m_openChannels.TryGetValue(channel, out rpcChanInfo)) | 219 | if (m_openChannels.TryGetValue(channel, out rpcChanInfo)) |
223 | { | 220 | { |
224 | string intVal = (string)requestData["IntValue"]; | 221 | string intVal = (string) requestData["IntValue"]; |
225 | string strVal = (string)requestData["StringValue"]; | 222 | string strVal = (string) requestData["StringValue"]; |
226 | 223 | ||
227 | RPCRequestInfo rpcInfo; | 224 | RPCRequestInfo rpcInfo; |
228 | 225 | ||
229 | lock (XMLRPCListLock) | 226 | lock (XMLRPCListLock) |
230 | { | 227 | { |
231 | rpcInfo = new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal, intVal); | 228 | rpcInfo = |
229 | new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal, | ||
230 | intVal); | ||
232 | rpcQueue.Enqueue(rpcInfo); | 231 | rpcQueue.Enqueue(rpcInfo); |
233 | } | 232 | } |
234 | 233 | ||
235 | int timeoutCtr = 0; | 234 | int timeoutCtr = 0; |
236 | 235 | ||
237 | while(!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout)) | 236 | while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout)) |
238 | { | 237 | { |
239 | Thread.Sleep(RemoteReplyScriptWait); | 238 | Thread.Sleep(RemoteReplyScriptWait); |
240 | timeoutCtr += RemoteReplyScriptWait; | 239 | timeoutCtr += RemoteReplyScriptWait; |
@@ -252,13 +251,11 @@ namespace OpenSim.Region.Environment.Modules | |||
252 | m_pendingResponse.Remove(rpcInfo.GetMessageID()); | 251 | m_pendingResponse.Remove(rpcInfo.GetMessageID()); |
253 | } | 252 | } |
254 | } | 253 | } |
255 | |||
256 | } | 254 | } |
257 | else | 255 | else |
258 | { | 256 | { |
259 | response.SetFault(-1, "Invalid channel"); | 257 | response.SetFault(-1, "Invalid channel"); |
260 | } | 258 | } |
261 | |||
262 | } | 259 | } |
263 | 260 | ||
264 | return response; | 261 | return response; |
@@ -278,7 +275,6 @@ namespace OpenSim.Region.Environment.Modules | |||
278 | return rpcInfo; | 275 | return rpcInfo; |
279 | } | 276 | } |
280 | } | 277 | } |
281 | |||
282 | } | 278 | } |
283 | 279 | ||
284 | /************************************************************** | 280 | /************************************************************** |
@@ -288,6 +284,7 @@ namespace OpenSim.Region.Environment.Modules | |||
288 | * Holds details about incoming requests until they are picked | 284 | * Holds details about incoming requests until they are picked |
289 | * from the queue by LSLLongCmdHandler | 285 | * from the queue by LSLLongCmdHandler |
290 | * ***********************************************************/ | 286 | * ***********************************************************/ |
287 | |||
291 | public class RPCRequestInfo | 288 | public class RPCRequestInfo |
292 | { | 289 | { |
293 | private string m_StrVal; | 290 | private string m_StrVal; |
@@ -315,6 +312,7 @@ namespace OpenSim.Region.Environment.Modules | |||
315 | { | 312 | { |
316 | return m_processed; | 313 | return m_processed; |
317 | } | 314 | } |
315 | |||
318 | public LLUUID GetChannelKey() | 316 | public LLUUID GetChannelKey() |
319 | { | 317 | { |
320 | return m_ChannelKey; | 318 | return m_ChannelKey; |
@@ -324,36 +322,41 @@ namespace OpenSim.Region.Environment.Modules | |||
324 | { | 322 | { |
325 | m_processed = processed; | 323 | m_processed = processed; |
326 | } | 324 | } |
325 | |||
327 | public void SetRetval(string resp) | 326 | public void SetRetval(string resp) |
328 | { | 327 | { |
329 | m_resp = resp; | 328 | m_resp = resp; |
330 | } | 329 | } |
330 | |||
331 | public string GetRetval() | 331 | public string GetRetval() |
332 | { | 332 | { |
333 | return m_resp; | 333 | return m_resp; |
334 | } | 334 | } |
335 | |||
335 | public uint GetLocalID() | 336 | public uint GetLocalID() |
336 | { | 337 | { |
337 | return m_localID; | 338 | return m_localID; |
338 | } | 339 | } |
340 | |||
339 | public LLUUID GetItemID() | 341 | public LLUUID GetItemID() |
340 | { | 342 | { |
341 | return m_ItemID; | 343 | return m_ItemID; |
342 | } | 344 | } |
345 | |||
343 | public string GetStrVal() | 346 | public string GetStrVal() |
344 | { | 347 | { |
345 | return m_StrVal; | 348 | return m_StrVal; |
346 | } | 349 | } |
350 | |||
347 | public int GetIntValue() | 351 | public int GetIntValue() |
348 | { | 352 | { |
349 | return int.Parse(m_IntVal); | 353 | return int.Parse(m_IntVal); |
350 | } | 354 | } |
355 | |||
351 | public LLUUID GetMessageID() | 356 | public LLUUID GetMessageID() |
352 | { | 357 | { |
353 | return m_MessageID; | 358 | return m_MessageID; |
354 | } | 359 | } |
355 | |||
356 | |||
357 | } | 360 | } |
358 | 361 | ||
359 | public class RPCChannelInfo | 362 | public class RPCChannelInfo |
@@ -383,7 +386,5 @@ namespace OpenSim.Region.Environment.Modules | |||
383 | { | 386 | { |
384 | return m_localID; | 387 | return m_localID; |
385 | } | 388 | } |
386 | |||
387 | } | 389 | } |
388 | 390 | } \ No newline at end of file | |
389 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index e555475..807b46c 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -29,11 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework.Interfaces; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Framework; | ||
36 | using Nini.Config; | ||
37 | 36 | ||
38 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
39 | { | 38 | { |
@@ -200,4 +199,4 @@ namespace OpenSim.Region.Environment.Modules | |||
200 | } | 199 | } |
201 | } | 200 | } |
202 | } | 201 | } |
203 | } | 202 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 63285dc..fd55833 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -29,7 +29,6 @@ | |||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Region.Environment.LandManagement; | 30 | using OpenSim.Region.Environment.LandManagement; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework; | ||
33 | 32 | ||
34 | namespace OpenSim.Region.Environment | 33 | namespace OpenSim.Region.Environment |
35 | { | 34 | { |
@@ -337,4 +336,4 @@ namespace OpenSim.Region.Environment | |||
337 | 336 | ||
338 | #endregion | 337 | #endregion |
339 | } | 338 | } |
340 | } | 339 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 767a740..b8bae57 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -146,4 +146,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
146 | 146 | ||
147 | public abstract void SetText(string text, Vector3 color, double alpha); | 147 | public abstract void SetText(string text, Vector3 color, double alpha); |
148 | } | 148 | } |
149 | } | 149 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs index 14a1c7e..0f3bca1 100644 --- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs +++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs | |||
@@ -29,7 +29,6 @@ | |||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Interfaces; | ||
33 | 32 | ||
34 | namespace OpenSim.Region.Environment.Scenes | 33 | namespace OpenSim.Region.Environment.Scenes |
35 | { | 34 | { |
@@ -40,4 +39,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
40 | void SendOurAppearance(IClientAPI OurClient); | 39 | void SendOurAppearance(IClientAPI OurClient); |
41 | void SendAppearanceToOtherAgent(ScenePresence avatarInfo); | 40 | void SendAppearanceToOtherAgent(ScenePresence avatarInfo); |
42 | } | 41 | } |
43 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 68591d4..a0c9a50 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -29,9 +29,8 @@ | |||
29 | using Axiom.Math; | 29 | using Axiom.Math; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Framework.Communications.Cache; | ||
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.Physics.Manager; |
36 | 35 | ||
37 | namespace OpenSim.Region.Environment.Scenes | 36 | namespace OpenSim.Region.Environment.Scenes |
@@ -45,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
45 | { | 44 | { |
46 | ScenePresence avatar; | 45 | ScenePresence avatar; |
47 | 46 | ||
48 | if ( TryGetAvatar( avatarId, out avatar )) | 47 | if (TryGetAvatar(avatarId, out avatar)) |
49 | { | 48 | { |
50 | AddInventoryItem(avatar.ControllingClient, item); | 49 | AddInventoryItem(avatar.ControllingClient, item); |
51 | } | 50 | } |
@@ -392,7 +391,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
392 | remoteClient.SendInventoryItemUpdate(item); | 391 | remoteClient.SendInventoryItemUpdate(item); |
393 | } | 392 | } |
394 | 393 | ||
395 | DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt); | 394 | DeleteSceneObjectGroup((SceneObjectGroup) selectedEnt); |
396 | } | 395 | } |
397 | } | 396 | } |
398 | } | 397 | } |
@@ -471,4 +470,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
471 | } | 470 | } |
472 | } | 471 | } |
473 | } | 472 | } |
474 | } | 473 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 3a35e21..69bd310 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -28,9 +28,8 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
31 | using OpenSim.Framework.Console; | ||
32 | using OpenSim.Framework.Interfaces; | ||
33 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Console; | ||
34 | 33 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 34 | namespace OpenSim.Region.Environment.Scenes |
36 | { | 35 | { |
@@ -73,12 +72,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
73 | { | 72 | { |
74 | ChatFromViewerArgs args = new ChatFromViewerArgs(); | 73 | ChatFromViewerArgs args = new ChatFromViewerArgs(); |
75 | 74 | ||
76 | args.Message = OpenSim.Framework.Util.FieldToString(message); | 75 | args.Message = Util.FieldToString(message); |
77 | args.Channel = channel; | 76 | args.Channel = channel; |
78 | args.Type = (ChatTypeEnum)type; | 77 | args.Type = (ChatTypeEnum) type; |
79 | args.Position = fromPos; | 78 | args.Position = fromPos; |
80 | 79 | ||
81 | ScenePresence user = this.GetScenePresence(fromAgentID); | 80 | ScenePresence user = GetScenePresence(fromAgentID); |
82 | if (user != null) | 81 | if (user != null) |
83 | args.Sender = user.ControllingClient; | 82 | args.Sender = user.ControllingClient; |
84 | else | 83 | else |
@@ -488,10 +487,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
488 | 487 | ||
489 | public void StartAnimation(LLUUID animID, int seq, LLUUID agentId) | 488 | public void StartAnimation(LLUUID animID, int seq, LLUUID agentId) |
490 | { | 489 | { |
491 | Broadcast(delegate(IClientAPI client) | 490 | Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, agentId); }); |
492 | { | ||
493 | client.SendAnimation(animID, seq, agentId); | ||
494 | }); | ||
495 | } | 491 | } |
496 | 492 | ||
497 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 493 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
@@ -503,14 +499,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
503 | if (ent is SceneObjectGroup) | 499 | if (ent is SceneObjectGroup) |
504 | { | 500 | { |
505 | SceneObjectGroup obj = ent as SceneObjectGroup; | 501 | SceneObjectGroup obj = ent as SceneObjectGroup; |
506 | 502 | ||
507 | if( obj.HasChildPrim( localID ) ) | 503 | if (obj.HasChildPrim(localID)) |
508 | { | 504 | { |
509 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); | 505 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); |
510 | return; | 506 | return; |
511 | } | 507 | } |
512 | } | 508 | } |
513 | } | 509 | } |
514 | } | 510 | } |
515 | } | 511 | } |
516 | } | 512 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b54c25b..db4d230 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Net; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | ||
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using System.Xml; | 34 | using System.Xml; |
@@ -38,17 +38,16 @@ using OpenSim.Framework; | |||
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Framework.Interfaces; | ||
42 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Capabilities; | 42 | using OpenSim.Region.Capabilities; |
44 | using OpenSim.Region.Environment.Interfaces; | 43 | using OpenSim.Region.Environment.Interfaces; |
45 | using OpenSim.Region.Environment.LandManagement; | 44 | using OpenSim.Region.Environment.LandManagement; |
45 | using OpenSim.Region.Environment.Modules; | ||
46 | using OpenSim.Region.Environment.Scenes.Scripting; | 46 | using OpenSim.Region.Environment.Scenes.Scripting; |
47 | using OpenSim.Region.Environment.Types; | 47 | using OpenSim.Region.Environment.Types; |
48 | using OpenSim.Region.Physics.Manager; | 48 | using OpenSim.Region.Physics.Manager; |
49 | using OpenSim.Region.Terrain; | 49 | using OpenSim.Region.Terrain; |
50 | using Timer = System.Timers.Timer; | 50 | using Timer=System.Timers.Timer; |
51 | using OpenSim.Region.Environment.Modules; | ||
52 | 51 | ||
53 | namespace OpenSim.Region.Environment.Scenes | 52 | namespace OpenSim.Region.Environment.Scenes |
54 | { | 53 | { |
@@ -130,6 +129,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
130 | private readonly EstateManager m_estateManager; | 129 | private readonly EstateManager m_estateManager; |
131 | 130 | ||
132 | private PhysicsScene phyScene; | 131 | private PhysicsScene phyScene; |
132 | |||
133 | public PhysicsScene PhysScene | 133 | public PhysicsScene PhysScene |
134 | { | 134 | { |
135 | set { phyScene = value; } | 135 | set { phyScene = value; } |
@@ -199,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
199 | m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); | 199 | m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); |
200 | 200 | ||
201 | MainLog.Instance.Verbose("Creating LandMap"); | 201 | MainLog.Instance.Verbose("Creating LandMap"); |
202 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); | 202 | Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); |
203 | 203 | ||
204 | ScenePresence.LoadAnims(); | 204 | ScenePresence.LoadAnims(); |
205 | 205 | ||
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
233 | public void StartTimer() | 233 | public void StartTimer() |
234 | { | 234 | { |
235 | m_heartbeatTimer.Enabled = true; | 235 | m_heartbeatTimer.Enabled = true; |
236 | m_heartbeatTimer.Interval = (int)(m_timespan * 1000); | 236 | m_heartbeatTimer.Interval = (int) (m_timespan*1000); |
237 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 237 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
238 | } | 238 | } |
239 | 239 | ||
@@ -267,33 +267,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
267 | if (m_frame == Int32.MaxValue) | 267 | if (m_frame == Int32.MaxValue) |
268 | m_frame = 0; | 268 | m_frame = 0; |
269 | 269 | ||
270 | if (m_frame % m_update_physics == 0) | 270 | if (m_frame%m_update_physics == 0) |
271 | UpdatePreparePhysics(); | 271 | UpdatePreparePhysics(); |
272 | 272 | ||
273 | if (m_frame % m_update_entitymovement == 0) | 273 | if (m_frame%m_update_entitymovement == 0) |
274 | UpdateEntityMovement(); | 274 | UpdateEntityMovement(); |
275 | 275 | ||
276 | if (m_frame % m_update_physics == 0) | 276 | if (m_frame%m_update_physics == 0) |
277 | UpdatePhysics( | 277 | UpdatePhysics( |
278 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) | 278 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) |
279 | ); | 279 | ); |
280 | 280 | ||
281 | if (m_frame % m_update_entities == 0) | 281 | if (m_frame%m_update_entities == 0) |
282 | UpdateEntities(); | 282 | UpdateEntities(); |
283 | 283 | ||
284 | if (m_frame % m_update_events == 0) | 284 | if (m_frame%m_update_events == 0) |
285 | UpdateEvents(); | 285 | UpdateEvents(); |
286 | 286 | ||
287 | if (m_frame % m_update_backup == 0) | 287 | if (m_frame%m_update_backup == 0) |
288 | UpdateStorageBackup(); | 288 | UpdateStorageBackup(); |
289 | 289 | ||
290 | if (m_frame % m_update_terrain == 0) | 290 | if (m_frame%m_update_terrain == 0) |
291 | UpdateTerrain(); | 291 | UpdateTerrain(); |
292 | 292 | ||
293 | if (m_frame % m_update_land == 0) | 293 | if (m_frame%m_update_land == 0) |
294 | UpdateLand(); | 294 | UpdateLand(); |
295 | 295 | ||
296 | if (m_frame % m_update_avatars == 0) | 296 | if (m_frame%m_update_avatars == 0) |
297 | UpdateInWorldTime(); | 297 | UpdateInWorldTime(); |
298 | } | 298 | } |
299 | catch (NotImplementedException) | 299 | catch (NotImplementedException) |
@@ -308,7 +308,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
308 | { | 308 | { |
309 | updateLock.ReleaseMutex(); | 309 | updateLock.ReleaseMutex(); |
310 | 310 | ||
311 | m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds; | 311 | m_timedilation = m_timespan/(float) SinceLastFrame.TotalSeconds; |
312 | m_lastupdate = DateTime.Now; | 312 | m_lastupdate = DateTime.Now; |
313 | } | 313 | } |
314 | } | 314 | } |
@@ -369,24 +369,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
369 | phyScene.SetTerrain(Terrain.GetHeights1D()); | 369 | phyScene.SetTerrain(Terrain.GetHeights1D()); |
370 | } | 370 | } |
371 | 371 | ||
372 | storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID); | 372 | storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); |
373 | 373 | ||
374 | float[] terData = Terrain.GetHeights1D(); | 374 | float[] terData = Terrain.GetHeights1D(); |
375 | 375 | ||
376 | Broadcast(delegate(IClientAPI client) | 376 | Broadcast(delegate(IClientAPI client) |
377 | { | 377 | { |
378 | for (int x = 0; x < 16; x++) | 378 | for (int x = 0; x < 16; x++) |
379 | { | 379 | { |
380 | for (int y = 0; y < 16; y++) | 380 | for (int y = 0; y < 16; y++) |
381 | { | 381 | { |
382 | if (Terrain.Tainted(x * 16, y * 16)) | 382 | if (Terrain.Tainted(x*16, y*16)) |
383 | { | 383 | { |
384 | client.SendLayerData(x, y, terData); | 384 | client.SendLayerData(x, y, terData); |
385 | } | 385 | } |
386 | } | 386 | } |
387 | } | 387 | } |
388 | }); | 388 | }); |
389 | |||
390 | 389 | ||
391 | 390 | ||
392 | Terrain.ResetTaint(); | 391 | Terrain.ResetTaint(); |
@@ -418,7 +417,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
418 | { | 417 | { |
419 | lock (m_syncRoot) | 418 | lock (m_syncRoot) |
420 | { | 419 | { |
421 | phyScene.Simulate((float)elapsed); | 420 | phyScene.Simulate((float) elapsed); |
422 | } | 421 | } |
423 | } | 422 | } |
424 | 423 | ||
@@ -438,11 +437,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
438 | /// <returns></returns> | 437 | /// <returns></returns> |
439 | internal void Broadcast(Action<IClientAPI> whatToDo) | 438 | internal void Broadcast(Action<IClientAPI> whatToDo) |
440 | { | 439 | { |
441 | ForEachScenePresence(delegate(ScenePresence presence) | 440 | ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); |
442 | { | ||
443 | whatToDo(presence.ControllingClient); | ||
444 | }); | ||
445 | } | 441 | } |
442 | |||
446 | /// <summary> | 443 | /// <summary> |
447 | /// | 444 | /// |
448 | /// </summary> | 445 | /// </summary> |
@@ -473,7 +470,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
473 | MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); | 470 | MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); |
474 | Terrain.HillsGenerator(); | 471 | Terrain.HillsGenerator(); |
475 | 472 | ||
476 | storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID); | 473 | storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); |
477 | } | 474 | } |
478 | else | 475 | else |
479 | { | 476 | { |
@@ -484,7 +481,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
484 | } | 481 | } |
485 | catch | 482 | catch |
486 | { | 483 | { |
487 | MainLog.Instance.Verbose("TERRAIN", "No terrain found in database or default. Generating a new terrain."); | 484 | MainLog.Instance.Verbose("TERRAIN", |
485 | "No terrain found in database or default. Generating a new terrain."); | ||
488 | Terrain.HillsGenerator(); | 486 | Terrain.HillsGenerator(); |
489 | } | 487 | } |
490 | storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); | 488 | storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); |
@@ -535,7 +533,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
535 | { | 533 | { |
536 | AddEntityFromStorage(prim); | 534 | AddEntityFromStorage(prim); |
537 | SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); | 535 | SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); |
538 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 536 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
539 | rootPart.PhysActor = phyScene.AddPrimShape( | 537 | rootPart.PhysActor = phyScene.AddPrimShape( |
540 | rootPart.Name, | 538 | rootPart.Name, |
541 | rootPart.Shape, | 539 | rootPart.Shape, |
@@ -581,17 +579,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
581 | // if grass or tree, make phantom | 579 | // if grass or tree, make phantom |
582 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) | 580 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) |
583 | { | 581 | { |
584 | rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; | 582 | rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom; |
585 | } | 583 | } |
586 | // if not phantom, add to physics | 584 | // if not phantom, add to physics |
587 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 585 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
588 | rootPart.PhysActor = | 586 | rootPart.PhysActor = |
589 | phyScene.AddPrimShape( | 587 | phyScene.AddPrimShape( |
590 | rootPart.Name, | 588 | rootPart.Name, |
591 | rootPart.Shape, | 589 | rootPart.Shape, |
592 | new PhysicsVector(pos.X, pos.Y, pos.Z), | 590 | new PhysicsVector(pos.X, pos.Y, pos.Z), |
593 | new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), | 591 | new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), |
594 | new Quaternion()); | 592 | new Quaternion()); |
595 | } | 593 | } |
596 | } | 594 | } |
597 | 595 | ||
@@ -601,9 +599,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
601 | { | 599 | { |
602 | if (obj is SceneObjectGroup) | 600 | if (obj is SceneObjectGroup) |
603 | { | 601 | { |
604 | if (((SceneObjectGroup)obj).LocalId == localID) | 602 | if (((SceneObjectGroup) obj).LocalId == localID) |
605 | { | 603 | { |
606 | RemoveEntity((SceneObjectGroup)obj); | 604 | RemoveEntity((SceneObjectGroup) obj); |
607 | return; | 605 | return; |
608 | } | 606 | } |
609 | } | 607 | } |
@@ -657,7 +655,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
657 | int primCount = 0; | 655 | int primCount = 0; |
658 | if ((fileName.StartsWith("http:")) | (File.Exists(fileName))) | 656 | if ((fileName.StartsWith("http:")) | (File.Exists(fileName))) |
659 | { | 657 | { |
660 | |||
661 | XmlTextReader reader = new XmlTextReader(fileName); | 658 | XmlTextReader reader = new XmlTextReader(fileName); |
662 | reader.WhitespaceHandling = WhitespaceHandling.None; | 659 | reader.WhitespaceHandling = WhitespaceHandling.None; |
663 | doc.Load(reader); | 660 | doc.Load(reader); |
@@ -672,7 +669,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
672 | AddEntity(obj); | 669 | AddEntity(obj); |
673 | 670 | ||
674 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); | 671 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); |
675 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 672 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
676 | rootPart.PhysActor = phyScene.AddPrimShape( | 673 | rootPart.PhysActor = phyScene.AddPrimShape( |
677 | rootPart.Name, | 674 | rootPart.Name, |
678 | rootPart.Shape, | 675 | rootPart.Shape, |
@@ -700,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
700 | { | 697 | { |
701 | if (ent is SceneObjectGroup) | 698 | if (ent is SceneObjectGroup) |
702 | { | 699 | { |
703 | stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); | 700 | stream.WriteLine(((SceneObjectGroup) ent).ToXmlString()); |
704 | primCount++; | 701 | primCount++; |
705 | } | 702 | } |
706 | } | 703 | } |
@@ -737,7 +734,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
737 | AddEntityFromStorage(obj); | 734 | AddEntityFromStorage(obj); |
738 | 735 | ||
739 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); | 736 | SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); |
740 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 737 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
741 | rootPart.PhysActor = phyScene.AddPrimShape( | 738 | rootPart.PhysActor = phyScene.AddPrimShape( |
742 | rootPart.Name, | 739 | rootPart.Name, |
743 | rootPart.Shape, | 740 | rootPart.Shape, |
@@ -758,7 +755,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
758 | { | 755 | { |
759 | if (ent is SceneObjectGroup) | 756 | if (ent is SceneObjectGroup) |
760 | { | 757 | { |
761 | stream.WriteLine(((SceneObjectGroup)ent).ToXmlString2()); | 758 | stream.WriteLine(((SceneObjectGroup) ent).ToXmlString2()); |
762 | primCount++; | 759 | primCount++; |
763 | } | 760 | } |
764 | } | 761 | } |
@@ -857,7 +854,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
857 | byte[] visualParams; | 854 | byte[] visualParams; |
858 | AvatarWearable[] wearables; | 855 | AvatarWearable[] wearables; |
859 | 856 | ||
860 | if( m_AvatarFactory == null || !m_AvatarFactory.TryGetIntialAvatarAppearance( client.AgentId, out wearables, out visualParams)) | 857 | if (m_AvatarFactory == null || |
858 | !m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams)) | ||
861 | { | 859 | { |
862 | AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams); | 860 | AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams); |
863 | } | 861 | } |
@@ -916,16 +914,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
916 | 914 | ||
917 | ScenePresence avatar = GetScenePresence(agentID); | 915 | ScenePresence avatar = GetScenePresence(agentID); |
918 | 916 | ||
919 | Broadcast(delegate(IClientAPI client) | 917 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); }); |
920 | { | ||
921 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | ||
922 | }); | ||
923 | 918 | ||
924 | ForEachScenePresence( | 919 | ForEachScenePresence( |
925 | delegate(ScenePresence presence) | 920 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
926 | { | ||
927 | presence.CoarseLocationChange(); | ||
928 | }); | ||
929 | 921 | ||
930 | lock (m_scenePresences) | 922 | lock (m_scenePresences) |
931 | { | 923 | { |
@@ -965,10 +957,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
965 | 957 | ||
966 | public List<ScenePresence> GetAvatars() | 958 | public List<ScenePresence> GetAvatars() |
967 | { | 959 | { |
968 | List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence) | 960 | List<ScenePresence> result = |
969 | { | 961 | GetScenePresences(delegate(ScenePresence scenePresence) { return !scenePresence.IsChildAgent; }); |
970 | return !scenePresence.IsChildAgent; | ||
971 | }); | ||
972 | 962 | ||
973 | return result; | 963 | return result; |
974 | } | 964 | } |
@@ -1046,18 +1036,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1046 | 1036 | ||
1047 | public void SendKillObject(uint localID) | 1037 | public void SendKillObject(uint localID) |
1048 | { | 1038 | { |
1049 | Broadcast(delegate(IClientAPI client) | 1039 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); |
1050 | { | ||
1051 | client.SendKillObject(m_regionHandle, localID); | ||
1052 | }); | ||
1053 | } | 1040 | } |
1054 | 1041 | ||
1055 | public void NotifyMyCoarseLocationChange() | 1042 | public void NotifyMyCoarseLocationChange() |
1056 | { | 1043 | { |
1057 | ForEachScenePresence(delegate(ScenePresence presence) | 1044 | ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
1058 | { | ||
1059 | presence.CoarseLocationChange(); | ||
1060 | }); | ||
1061 | } | 1045 | } |
1062 | 1046 | ||
1063 | public void SendAllSceneObjectsToClient(ScenePresence presence) | 1047 | public void SendAllSceneObjectsToClient(ScenePresence presence) |
@@ -1067,7 +1051,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1067 | if (ent is SceneObjectGroup) | 1051 | if (ent is SceneObjectGroup) |
1068 | { | 1052 | { |
1069 | // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); | 1053 | // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); |
1070 | ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); | 1054 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); |
1071 | } | 1055 | } |
1072 | } | 1056 | } |
1073 | } | 1057 | } |
@@ -1137,11 +1121,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1137 | } | 1121 | } |
1138 | } | 1122 | } |
1139 | 1123 | ||
1140 | delegate void InformClientOfNeighbourDelegate(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); | 1124 | private delegate void InformClientOfNeighbourDelegate( |
1125 | IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); | ||
1141 | 1126 | ||
1142 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) | 1127 | private void InformClientOfNeighbourCompleted(IAsyncResult iar) |
1143 | { | 1128 | { |
1144 | InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; | 1129 | InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; |
1145 | 1130 | ||
1146 | 1131 | ||
1147 | icon.EndInvoke(iar); | 1132 | icon.EndInvoke(iar); |
@@ -1157,7 +1142,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1157 | /// <param name="a"></param> | 1142 | /// <param name="a"></param> |
1158 | /// <param name="regionHandle"></param> | 1143 | /// <param name="regionHandle"></param> |
1159 | /// <param name="endPoint"></param> | 1144 | /// <param name="endPoint"></param> |
1160 | private void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint) | 1145 | private void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, |
1146 | IPEndPoint endPoint) | ||
1161 | { | 1147 | { |
1162 | MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours"); | 1148 | MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours"); |
1163 | bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a); | 1149 | bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a); |
@@ -1172,7 +1158,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1172 | /// </summary> | 1158 | /// </summary> |
1173 | public void InformClientOfNeighbours(IClientAPI remoteClient) | 1159 | public void InformClientOfNeighbours(IClientAPI remoteClient) |
1174 | { | 1160 | { |
1175 | List<SimpleRegionInfo> neighbours = commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY); | 1161 | List<SimpleRegionInfo> neighbours = |
1162 | commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY); | ||
1176 | if (neighbours != null) | 1163 | if (neighbours != null) |
1177 | { | 1164 | { |
1178 | for (int i = 0; i < neighbours.Count; i++) | 1165 | for (int i = 0; i < neighbours.Count; i++) |
@@ -1185,9 +1172,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1185 | 1172 | ||
1186 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1173 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1187 | d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint, | 1174 | d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint, |
1188 | InformClientOfNeighbourCompleted, | 1175 | InformClientOfNeighbourCompleted, |
1189 | d); | 1176 | d); |
1190 | |||
1191 | } | 1177 | } |
1192 | } | 1178 | } |
1193 | } | 1179 | } |
@@ -1289,17 +1275,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1289 | 1275 | ||
1290 | public void RegisterModuleInterface<M>(M mod) | 1276 | public void RegisterModuleInterface<M>(M mod) |
1291 | { | 1277 | { |
1292 | if (!ModuleInterfaces.ContainsKey(typeof(M))) | 1278 | if (!ModuleInterfaces.ContainsKey(typeof (M))) |
1293 | { | 1279 | { |
1294 | ModuleInterfaces.Add(typeof(M), mod); | 1280 | ModuleInterfaces.Add(typeof (M), mod); |
1295 | } | 1281 | } |
1296 | } | 1282 | } |
1297 | 1283 | ||
1298 | public T RequestModuleInterface<T>() | 1284 | public T RequestModuleInterface<T>() |
1299 | { | 1285 | { |
1300 | if (ModuleInterfaces.ContainsKey(typeof(T))) | 1286 | if (ModuleInterfaces.ContainsKey(typeof (T))) |
1301 | { | 1287 | { |
1302 | return (T)ModuleInterfaces[typeof(T)]; | 1288 | return (T) ModuleInterfaces[typeof (T)]; |
1303 | } | 1289 | } |
1304 | else | 1290 | else |
1305 | { | 1291 | { |
@@ -1317,7 +1303,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1317 | { | 1303 | { |
1318 | if (m_scenePresences.ContainsKey(avatarID)) | 1304 | if (m_scenePresences.ContainsKey(avatarID)) |
1319 | { | 1305 | { |
1320 | m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url); | 1306 | m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, |
1307 | message, url); | ||
1321 | } | 1308 | } |
1322 | } | 1309 | } |
1323 | 1310 | ||
@@ -1388,7 +1375,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1388 | { | 1375 | { |
1389 | if (ent is SceneObjectGroup) | 1376 | if (ent is SceneObjectGroup) |
1390 | { | 1377 | { |
1391 | ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); | 1378 | ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate(); |
1392 | } | 1379 | } |
1393 | } | 1380 | } |
1394 | } | 1381 | } |
@@ -1400,7 +1387,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1400 | { | 1387 | { |
1401 | if (ent is SceneObjectGroup) | 1388 | if (ent is SceneObjectGroup) |
1402 | { | 1389 | { |
1403 | SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); | 1390 | SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID); |
1404 | if (part != null) | 1391 | if (part != null) |
1405 | { | 1392 | { |
1406 | if (part.Name == cmmdparams[0]) | 1393 | if (part.Name == cmmdparams[0]) |
@@ -1429,14 +1416,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1429 | foreach (ScenePresence scenePrescence in GetAvatars()) | 1416 | foreach (ScenePresence scenePrescence in GetAvatars()) |
1430 | { | 1417 | { |
1431 | MainLog.Instance.Error( | 1418 | MainLog.Instance.Error( |
1432 | String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", | 1419 | String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", |
1433 | scenePrescence.Firstname, | 1420 | scenePrescence.Firstname, |
1434 | scenePrescence.Lastname, | 1421 | scenePrescence.Lastname, |
1435 | scenePrescence.UUID, | 1422 | scenePrescence.UUID, |
1436 | scenePrescence.ControllingClient.AgentId, | 1423 | scenePrescence.ControllingClient.AgentId, |
1437 | "Unknown", | 1424 | "Unknown", |
1438 | "Unknown", | 1425 | "Unknown", |
1439 | RegionInfo.RegionName)); | 1426 | RegionInfo.RegionName)); |
1440 | } | 1427 | } |
1441 | break; | 1428 | break; |
1442 | case "modules": | 1429 | case "modules": |
@@ -1482,10 +1469,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1482 | { | 1469 | { |
1483 | if (ent is SceneObjectGroup) | 1470 | if (ent is SceneObjectGroup) |
1484 | { | 1471 | { |
1485 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); | 1472 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
1486 | if (hasPrim != false) | 1473 | if (hasPrim != false) |
1487 | { | 1474 | { |
1488 | return ((SceneObjectGroup)ent).GetPartsFullID(localID); | 1475 | return ((SceneObjectGroup) ent).GetPartsFullID(localID); |
1489 | } | 1476 | } |
1490 | } | 1477 | } |
1491 | } | 1478 | } |
@@ -1499,10 +1486,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1499 | { | 1486 | { |
1500 | if (ent is SceneObjectGroup) | 1487 | if (ent is SceneObjectGroup) |
1501 | { | 1488 | { |
1502 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); | 1489 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
1503 | if (hasPrim != false) | 1490 | if (hasPrim != false) |
1504 | { | 1491 | { |
1505 | return ((SceneObjectGroup)ent).GetChildPart(localID); | 1492 | return ((SceneObjectGroup) ent).GetChildPart(localID); |
1506 | } | 1493 | } |
1507 | } | 1494 | } |
1508 | } | 1495 | } |
@@ -1516,10 +1503,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1516 | { | 1503 | { |
1517 | if (ent is SceneObjectGroup) | 1504 | if (ent is SceneObjectGroup) |
1518 | { | 1505 | { |
1519 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); | 1506 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID); |
1520 | if (hasPrim != false) | 1507 | if (hasPrim != false) |
1521 | { | 1508 | { |
1522 | return ((SceneObjectGroup)ent).GetChildPart(fullID); | 1509 | return ((SceneObjectGroup) ent).GetChildPart(fullID); |
1523 | } | 1510 | } |
1524 | } | 1511 | } |
1525 | } | 1512 | } |
@@ -1569,12 +1556,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1569 | return false; | 1556 | return false; |
1570 | } | 1557 | } |
1571 | 1558 | ||
1572 | internal void ForEachClient( Action<IClientAPI> action ) | 1559 | internal void ForEachClient(Action<IClientAPI> action) |
1573 | { | 1560 | { |
1574 | foreach (ScenePresence presence in m_scenePresences.Values ) | 1561 | foreach (ScenePresence presence in m_scenePresences.Values) |
1575 | { | 1562 | { |
1576 | action(presence.ControllingClient); | 1563 | action(presence.ControllingClient); |
1577 | } | 1564 | } |
1578 | } | 1565 | } |
1579 | } | 1566 | } |
1580 | } | 1567 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 0072d4e..4ad9d65 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -28,10 +28,9 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Framework.Communications.Cache; | 32 | using OpenSim.Framework.Communications.Cache; |
32 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Terrain; | 34 | using OpenSim.Region.Terrain; |
36 | 35 | ||
37 | namespace OpenSim.Region.Environment.Scenes | 36 | namespace OpenSim.Region.Environment.Scenes |
@@ -39,6 +38,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
39 | public abstract class SceneBase : IScene | 38 | public abstract class SceneBase : IScene |
40 | { | 39 | { |
41 | private readonly ClientManager m_clientManager = new ClientManager(); | 40 | private readonly ClientManager m_clientManager = new ClientManager(); |
41 | |||
42 | public ClientManager ClientManager | 42 | public ClientManager ClientManager |
43 | { | 43 | { |
44 | get { return m_clientManager; } | 44 | get { return m_clientManager; } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index ea47713..493afd1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -27,9 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Interfaces; | ||
31 | using OpenSim.Region.Environment.Interfaces; | ||
32 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment.Interfaces; | ||
33 | 32 | ||
34 | namespace OpenSim.Region.Environment.Scenes | 33 | namespace OpenSim.Region.Environment.Scenes |
35 | { | 34 | { |
@@ -207,4 +206,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
207 | } | 206 | } |
208 | } | 207 | } |
209 | } | 208 | } |
210 | } | 209 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index a315d02..75e2a41 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -28,9 +28,9 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using OpenSim.Framework.Console; | ||
32 | using OpenSim.Framework; | ||
33 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Console; | ||
34 | 34 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
36 | { | 36 | { |
@@ -152,10 +152,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
152 | 152 | ||
153 | public void SendGeneralMessage(string msg) | 153 | public void SendGeneralMessage(string msg) |
154 | { | 154 | { |
155 | ForEachCurrentScene(delegate(Scene scene) | 155 | ForEachCurrentScene(delegate(Scene scene) { scene.SendGeneralAlert(msg); }); |
156 | { | ||
157 | scene.SendGeneralAlert(msg); | ||
158 | }); | ||
159 | } | 156 | } |
160 | 157 | ||
161 | public bool TrySetCurrentScene(string regionName) | 158 | public bool TrySetCurrentScene(string regionName) |
@@ -185,23 +182,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
185 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) | 182 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) |
186 | { | 183 | { |
187 | ForEachCurrentScene(delegate(Scene scene) | 184 | ForEachCurrentScene(delegate(Scene scene) |
188 | { | ||
189 | foreach (EntityBase entity in scene.Entities.Values) | ||
190 | { | ||
191 | if (entity is ScenePresence) | ||
192 | { | ||
193 | ScenePresence scenePrescence = entity as ScenePresence; | ||
194 | if (!scenePrescence.IsChildAgent) | ||
195 | { | 185 | { |
196 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", | 186 | foreach (EntityBase entity in scene.Entities.Values) |
197 | scenePrescence.Firstname, scenePrescence.Lastname, | 187 | { |
198 | newDebug)); | 188 | if (entity is ScenePresence) |
199 | 189 | { | |
200 | scenePrescence.ControllingClient.SetDebug(newDebug); | 190 | ScenePresence scenePrescence = entity as ScenePresence; |
201 | } | 191 | if (!scenePrescence.IsChildAgent) |
202 | } | 192 | { |
203 | } | 193 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", |
204 | }); | 194 | scenePrescence.Firstname, |
195 | scenePrescence.Lastname, | ||
196 | newDebug)); | ||
197 | |||
198 | scenePrescence.ControllingClient.SetDebug(newDebug); | ||
199 | } | ||
200 | } | ||
201 | } | ||
202 | }); | ||
205 | } | 203 | } |
206 | 204 | ||
207 | public List<ScenePresence> GetCurrentSceneAvatars() | 205 | public List<ScenePresence> GetCurrentSceneAvatars() |
@@ -209,19 +207,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
209 | List<ScenePresence> avatars = new List<ScenePresence>(); | 207 | List<ScenePresence> avatars = new List<ScenePresence>(); |
210 | 208 | ||
211 | ForEachCurrentScene(delegate(Scene scene) | 209 | ForEachCurrentScene(delegate(Scene scene) |
212 | { | ||
213 | foreach (EntityBase entity in scene.Entities.Values) | ||
214 | { | ||
215 | if (entity is ScenePresence) | ||
216 | { | ||
217 | ScenePresence scenePrescence = entity as ScenePresence; | ||
218 | if (!scenePrescence.IsChildAgent) | ||
219 | { | 210 | { |
220 | avatars.Add(scenePrescence); | 211 | foreach (EntityBase entity in scene.Entities.Values) |
221 | } | 212 | { |
222 | } | 213 | if (entity is ScenePresence) |
223 | } | 214 | { |
224 | }); | 215 | ScenePresence scenePrescence = entity as ScenePresence; |
216 | if (!scenePrescence.IsChildAgent) | ||
217 | { | ||
218 | avatars.Add(scenePrescence); | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | }); | ||
225 | 223 | ||
226 | return avatars; | 224 | return avatars; |
227 | } | 225 | } |
@@ -242,11 +240,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
242 | public void SetCurrentSceneTimePhase(int timePhase) | 240 | public void SetCurrentSceneTimePhase(int timePhase) |
243 | { | 241 | { |
244 | ForEachCurrentScene(delegate(Scene scene) | 242 | ForEachCurrentScene(delegate(Scene scene) |
245 | { | 243 | { |
246 | scene.SetTimePhase( | 244 | scene.SetTimePhase( |
247 | timePhase) | 245 | timePhase) |
248 | ; | 246 | ; |
249 | }); | 247 | }); |
250 | } | 248 | } |
251 | 249 | ||
252 | 250 | ||
@@ -260,11 +258,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
260 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 258 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
261 | } | 259 | } |
262 | 260 | ||
263 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) | 261 | public bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar) |
264 | { | 262 | { |
265 | foreach (Scene scene in m_localScenes) | 263 | foreach (Scene scene in m_localScenes) |
266 | { | 264 | { |
267 | if( scene.TryGetAvatar( avatarId, out avatar )) | 265 | if (scene.TryGetAvatar(avatarId, out avatar)) |
268 | { | 266 | { |
269 | return true; | 267 | return true; |
270 | } | 268 | } |
@@ -311,9 +309,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
311 | return false; | 309 | return false; |
312 | } | 310 | } |
313 | 311 | ||
314 | public void ForEachScene(Action<Scene> action ) | 312 | public void ForEachScene(Action<Scene> action) |
315 | { | 313 | { |
316 | m_localScenes.ForEach( action ); | 314 | m_localScenes.ForEach(action); |
317 | } | 315 | } |
318 | } | 316 | } |
319 | } | 317 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 4603902..4d439b2 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -34,7 +34,6 @@ using System.Xml; | |||
34 | using Axiom.Math; | 34 | using Axiom.Math; |
35 | using libsecondlife; | 35 | using libsecondlife; |
36 | using libsecondlife.Packets; | 36 | using libsecondlife.Packets; |
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
39 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
40 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
@@ -270,7 +269,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
270 | StringReader sr = new StringReader(xmlData); | 269 | StringReader sr = new StringReader(xmlData); |
271 | XmlTextReader reader = new XmlTextReader(sr); | 270 | XmlTextReader reader = new XmlTextReader(sr); |
272 | reader.Read(); | 271 | reader.Read(); |
273 | 272 | ||
274 | reader.ReadStartElement("SceneObjectGroup"); | 273 | reader.ReadStartElement("SceneObjectGroup"); |
275 | m_rootPart = SceneObjectPart.FromXml(reader); | 274 | m_rootPart = SceneObjectPart.FromXml(reader); |
276 | 275 | ||
@@ -285,14 +284,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
285 | if (reader.Name == "SceneObjectPart") | 284 | if (reader.Name == "SceneObjectPart") |
286 | { | 285 | { |
287 | SceneObjectPart Part = SceneObjectPart.FromXml(reader); | 286 | SceneObjectPart Part = SceneObjectPart.FromXml(reader); |
288 | AddPart(Part); | 287 | AddPart(Part); |
289 | } | 288 | } |
290 | break; | 289 | break; |
291 | case XmlNodeType.EndElement: | 290 | case XmlNodeType.EndElement: |
292 | reader.Read(); | 291 | reader.Read(); |
293 | break; | 292 | break; |
294 | } | 293 | } |
295 | more = !reader.EOF; | 294 | more = !reader.EOF; |
296 | } | 295 | } |
297 | reader.Close(); | 296 | reader.Close(); |
298 | sr.Close(); | 297 | sr.Close(); |
@@ -424,13 +423,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
424 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; | 423 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; |
425 | 424 | ||
426 | dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape( | 425 | dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape( |
427 | dupe.RootPart.Name, | 426 | dupe.RootPart.Name, |
428 | pbs, | 427 | pbs, |
429 | new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), | 428 | new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, |
430 | new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), | 429 | dupe.RootPart.AbsolutePosition.Z), |
431 | new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, | 430 | new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), |
432 | dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); | 431 | new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, |
433 | 432 | dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); | |
434 | } | 433 | } |
435 | 434 | ||
436 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); | 435 | List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); |
@@ -951,14 +950,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
951 | } | 950 | } |
952 | if (m_rootPart.PhysActor != null) | 951 | if (m_rootPart.PhysActor != null) |
953 | { | 952 | { |
954 | this.m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor); | 953 | m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor); |
955 | m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape( | 954 | m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape( |
956 | m_rootPart.Name, | 955 | m_rootPart.Name, |
957 | m_rootPart.Shape, | 956 | m_rootPart.Shape, |
958 | new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y, m_rootPart.AbsolutePosition.Z), | 957 | new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y, |
959 | new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z), | 958 | m_rootPart.AbsolutePosition.Z), |
960 | new Axiom.Math.Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, | 959 | new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z), |
961 | m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z)); | 960 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, |
961 | m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z)); | ||
962 | } | 962 | } |
963 | } | 963 | } |
964 | 964 | ||
@@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1001 | AbsolutePosition = pos; | 1001 | AbsolutePosition = pos; |
1002 | ScheduleGroupForTerseUpdate(); | 1002 | ScheduleGroupForTerseUpdate(); |
1003 | 1003 | ||
1004 | m_scene.EventManager.TriggerGroupMove(this.UUID, pos); | 1004 | m_scene.EventManager.TriggerGroupMove(UUID, pos); |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | /// <summary> | 1007 | /// <summary> |
@@ -1350,7 +1350,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1350 | 1350 | ||
1351 | public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) | 1351 | public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) |
1352 | { | 1352 | { |
1353 | m_scene.EventManager.TriggerGroupGrab(this.UUID, offsetPos, remoteClient.AgentId); | 1353 | m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId); |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | public void DeleteGroup() | 1356 | public void DeleteGroup() |
@@ -1377,4 +1377,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1377 | Text = text; | 1377 | Text = text; |
1378 | } | 1378 | } |
1379 | } | 1379 | } |
1380 | } | 1380 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 3e104e3..387f573 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -33,12 +33,10 @@ using System.Xml.Serialization; | |||
33 | using Axiom.Math; | 33 | using Axiom.Math; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using libsecondlife.Packets; | 35 | using libsecondlife.Packets; |
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
38 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
39 | using OpenSim.Region.Environment.Scenes.Scripting; | 38 | using OpenSim.Region.Environment.Scenes.Scripting; |
40 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
41 | using OpenSim.Region.Environment.Types; | ||
42 | 40 | ||
43 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
44 | { | 42 | { |
@@ -49,8 +47,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
49 | private string m_inventoryFileName = ""; | 47 | private string m_inventoryFileName = ""; |
50 | private LLUUID m_folderID = LLUUID.Zero; | 48 | private LLUUID m_folderID = LLUUID.Zero; |
51 | 49 | ||
52 | [XmlIgnore] | 50 | [XmlIgnore] public PhysicsActor PhysActor = null; |
53 | public PhysicsActor PhysActor = null; | ||
54 | 51 | ||
55 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); | 52 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); |
56 | 53 | ||
@@ -68,10 +65,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
68 | 65 | ||
69 | protected byte[] m_particleSystem = new byte[0]; | 66 | protected byte[] m_particleSystem = new byte[0]; |
70 | 67 | ||
71 | [XmlIgnore] | 68 | [XmlIgnore] public uint TimeStampFull = 0; |
72 | public uint TimeStampFull = 0; | 69 | [XmlIgnore] public uint TimeStampTerse = 0; |
73 | [XmlIgnore] | ||
74 | public uint TimeStampTerse = 0; | ||
75 | 70 | ||
76 | protected SceneObjectGroup m_parentGroup; | 71 | protected SceneObjectGroup m_parentGroup; |
77 | 72 | ||
@@ -124,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
124 | set { m_name = value; } | 119 | set { m_name = value; } |
125 | } | 120 | } |
126 | 121 | ||
127 | protected LLObject.ObjectFlags m_flags =0; | 122 | protected LLObject.ObjectFlags m_flags = 0; |
128 | 123 | ||
129 | public uint ObjectFlags | 124 | public uint ObjectFlags |
130 | { | 125 | { |
@@ -132,7 +127,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
132 | set { m_flags = (LLObject.ObjectFlags) value; } | 127 | set { m_flags = (LLObject.ObjectFlags) value; } |
133 | } | 128 | } |
134 | 129 | ||
135 | protected LLObject.MaterialType m_material =0; | 130 | protected LLObject.MaterialType m_material = 0; |
136 | 131 | ||
137 | public byte Material | 132 | public byte Material |
138 | { | 133 | { |
@@ -712,7 +707,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
712 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | 707 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
713 | for (int i = 0; i < avatars.Count; i++) | 708 | for (int i = 0; i < avatars.Count; i++) |
714 | { | 709 | { |
715 | avatars[i].QueuePartForUpdate(this); | 710 | avatars[i].QueuePartForUpdate(this); |
716 | } | 711 | } |
717 | } | 712 | } |
718 | 713 | ||
@@ -774,13 +769,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
774 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | 769 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
775 | for (int i = 0; i < avatars.Count; i++) | 770 | for (int i = 0; i < avatars.Count; i++) |
776 | { | 771 | { |
777 | avatars[i].QueuePartForUpdate(this); | 772 | avatars[i].QueuePartForUpdate(this); |
778 | } | 773 | } |
779 | } | 774 | } |
780 | 775 | ||
781 | public void AddTerseUpdateToAvatar(ScenePresence presence) | 776 | public void AddTerseUpdateToAvatar(ScenePresence presence) |
782 | { | 777 | { |
783 | presence.QueuePartForUpdate(this); | 778 | presence.QueuePartForUpdate(this); |
784 | } | 779 | } |
785 | 780 | ||
786 | /// <summary> | 781 | /// <summary> |
@@ -927,4 +922,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
927 | } | 922 | } |
928 | } | 923 | } |
929 | } | 924 | } |
930 | } | 925 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs index 8ed4e87..f43a9fc 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
45 | public void LoadAnims() | 45 | public void LoadAnims() |
46 | { | 46 | { |
47 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); | 47 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); |
48 | using( XmlTextReader reader = new XmlTextReader("data/avataranimations.xml") ) | 48 | using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) |
49 | { | 49 | { |
50 | XmlDocument doc = new XmlDocument(); | 50 | XmlDocument doc = new XmlDocument(); |
51 | doc.Load(reader); | 51 | doc.Load(reader); |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6ed50b7..527eb22 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -30,11 +30,10 @@ using System.Collections.Generic; | |||
30 | using Axiom.Math; | 30 | using Axiom.Math; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
36 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Framework.Console; |
37 | using OpenSim.Region.Environment.Types; | 35 | using OpenSim.Region.Environment.Types; |
36 | using OpenSim.Region.Physics.Manager; | ||
38 | 37 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 38 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 39 | { |
@@ -116,18 +115,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
116 | } | 115 | } |
117 | 116 | ||
118 | private readonly ulong m_regionHandle; | 117 | private readonly ulong m_regionHandle; |
118 | |||
119 | public ulong RegionHandle | 119 | public ulong RegionHandle |
120 | { | 120 | { |
121 | get { return m_regionHandle; } | 121 | get { return m_regionHandle; } |
122 | } | 122 | } |
123 | 123 | ||
124 | private readonly string m_firstname; | 124 | private readonly string m_firstname; |
125 | |||
125 | public string Firstname | 126 | public string Firstname |
126 | { | 127 | { |
127 | get { return m_firstname; } | 128 | get { return m_firstname; } |
128 | } | 129 | } |
129 | 130 | ||
130 | private readonly string m_lastname; | 131 | private readonly string m_lastname; |
132 | |||
131 | public string Lastname | 133 | public string Lastname |
132 | { | 134 | { |
133 | get { return m_lastname; } | 135 | get { return m_lastname; } |
@@ -210,6 +212,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
210 | } | 212 | } |
211 | 213 | ||
212 | private bool m_isChildAgent = true; | 214 | private bool m_isChildAgent = true; |
215 | |||
213 | public bool IsChildAgent | 216 | public bool IsChildAgent |
214 | { | 217 | { |
215 | get { return m_isChildAgent; } | 218 | get { return m_isChildAgent; } |
@@ -217,6 +220,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
217 | } | 220 | } |
218 | 221 | ||
219 | private uint m_parentID = 0; | 222 | private uint m_parentID = 0; |
223 | |||
220 | public uint ParentID | 224 | public uint ParentID |
221 | { | 225 | { |
222 | get { return m_parentID; } | 226 | get { return m_parentID; } |
@@ -227,7 +231,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
227 | 231 | ||
228 | #region Constructor(s) | 232 | #region Constructor(s) |
229 | 233 | ||
230 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables) | 234 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
235 | AvatarWearable[] wearables) | ||
231 | { | 236 | { |
232 | m_scene = world; | 237 | m_scene = world; |
233 | m_uuid = client.AgentId; | 238 | m_uuid = client.AgentId; |
@@ -309,24 +314,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
309 | if (update.LastFullUpdateTime < part.TimeStampFull) | 314 | if (update.LastFullUpdateTime < part.TimeStampFull) |
310 | { | 315 | { |
311 | //need to do a full update | 316 | //need to do a full update |
312 | part.SendFullUpdate(this.ControllingClient); | 317 | part.SendFullUpdate(ControllingClient); |
313 | update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | 318 | update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch(); |
314 | updateCount++; | 319 | updateCount++; |
315 | } | 320 | } |
316 | else if (update.LastTerseUpdateTime < part.TimeStampTerse) | 321 | else if (update.LastTerseUpdateTime < part.TimeStampTerse) |
317 | { | 322 | { |
318 | part.SendTerseUpdate(this.ControllingClient); | 323 | part.SendTerseUpdate(ControllingClient); |
319 | update.LastTerseUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | 324 | update.LastTerseUpdateTime = (uint) Util.UnixTimeSinceEpoch(); |
320 | updateCount++; | 325 | updateCount++; |
321 | } | 326 | } |
322 | } | 327 | } |
323 | else | 328 | else |
324 | { | 329 | { |
325 | //never been sent to client before so do full update | 330 | //never been sent to client before so do full update |
326 | part.SendFullUpdate(this.ControllingClient); | 331 | part.SendFullUpdate(ControllingClient); |
327 | ScenePartUpdate update = new ScenePartUpdate(); | 332 | ScenePartUpdate update = new ScenePartUpdate(); |
328 | update.FullID = part.UUID; | 333 | update.FullID = part.UUID; |
329 | update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | 334 | update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch(); |
330 | m_updateTimes.Add(part.UUID, update); | 335 | m_updateTimes.Add(part.UUID, update); |
331 | updateCount++; | 336 | updateCount++; |
332 | } | 337 | } |
@@ -339,7 +344,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
339 | } | 344 | } |
340 | } | 345 | } |
341 | 346 | ||
342 | |||
343 | #region Status Methods | 347 | #region Status Methods |
344 | 348 | ||
345 | public void MakeRootAgent(LLVector3 pos, bool isFlying) | 349 | public void MakeRootAgent(LLVector3 pos, bool isFlying) |
@@ -368,10 +372,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
368 | 372 | ||
369 | private void RemoveFromPhysicalScene() | 373 | private void RemoveFromPhysicalScene() |
370 | { | 374 | { |
371 | if (this.PhysicsActor != null) | 375 | if (PhysicsActor != null) |
372 | { | 376 | { |
373 | m_scene.PhysScene.RemoveAvatar(this.PhysicsActor); | 377 | m_scene.PhysScene.RemoveAvatar(PhysicsActor); |
374 | this.PhysicsActor = null; | 378 | PhysicsActor = null; |
375 | } | 379 | } |
376 | } | 380 | } |
377 | 381 | ||
@@ -432,7 +436,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
432 | m_isChildAgent = false; | 436 | m_isChildAgent = false; |
433 | 437 | ||
434 | //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); | 438 | //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); |
435 | this.MakeRootAgent(this.AbsolutePosition, false); | 439 | MakeRootAgent(AbsolutePosition, false); |
436 | } | 440 | } |
437 | } | 441 | } |
438 | 442 | ||
@@ -457,13 +461,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
457 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); | 461 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); |
458 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 462 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); |
459 | bool oldflying = PhysicsActor.Flying; | 463 | bool oldflying = PhysicsActor.Flying; |
460 | PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); | 464 | PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); |
461 | if (PhysicsActor.Flying != oldflying) | 465 | if (PhysicsActor.Flying != oldflying) |
462 | { | 466 | { |
463 | update_movementflag = true; | 467 | update_movementflag = true; |
464 | } | 468 | } |
465 | 469 | ||
466 | if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 470 | if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
467 | { | 471 | { |
468 | StandUp(); | 472 | StandUp(); |
469 | update_movementflag = true; | 473 | update_movementflag = true; |
@@ -477,23 +481,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
477 | 481 | ||
478 | if (m_parentID == 0) | 482 | if (m_parentID == 0) |
479 | { | 483 | { |
480 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) | 484 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) |
481 | { | 485 | { |
482 | if ((flags & (uint)DCF) != 0) | 486 | if ((flags & (uint) DCF) != 0) |
483 | { | 487 | { |
484 | DCFlagKeyPressed = true; | 488 | DCFlagKeyPressed = true; |
485 | agent_control_v3 += Dir_Vectors[i]; | 489 | agent_control_v3 += Dir_Vectors[i]; |
486 | if ((m_movementflag & (uint)DCF) == 0) | 490 | if ((m_movementflag & (uint) DCF) == 0) |
487 | { | 491 | { |
488 | m_movementflag += (byte)(uint)DCF; | 492 | m_movementflag += (byte) (uint) DCF; |
489 | update_movementflag = true; | 493 | update_movementflag = true; |
490 | } | 494 | } |
491 | } | 495 | } |
492 | else | 496 | else |
493 | { | 497 | { |
494 | if ((m_movementflag & (uint)DCF) != 0) | 498 | if ((m_movementflag & (uint) DCF) != 0) |
495 | { | 499 | { |
496 | m_movementflag -= (byte)(uint)DCF; | 500 | m_movementflag -= (byte) (uint) DCF; |
497 | update_movementflag = true; | 501 | update_movementflag = true; |
498 | } | 502 | } |
499 | } | 503 | } |
@@ -580,10 +584,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
580 | } | 584 | } |
581 | 585 | ||
582 | NewForce newVelocity = new NewForce(); | 586 | NewForce newVelocity = new NewForce(); |
583 | Vector3 direc = rotation * vec; | 587 | Vector3 direc = rotation*vec; |
584 | direc.Normalize(); | 588 | direc.Normalize(); |
585 | 589 | ||
586 | direc = direc * ((0.03f) * 128f); | 590 | direc = direc*((0.03f)*128f); |
587 | if (m_physicsActor.Flying) | 591 | if (m_physicsActor.Flying) |
588 | direc *= 4; | 592 | direc *= 4; |
589 | 593 | ||
@@ -692,8 +696,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
692 | } | 696 | } |
693 | 697 | ||
694 | 698 | ||
695 | |||
696 | |||
697 | /// <summary> | 699 | /// <summary> |
698 | /// | 700 | /// |
699 | /// </summary> | 701 | /// </summary> |
@@ -701,7 +703,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
701 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 703 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
702 | { | 704 | { |
703 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | 705 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, |
704 | LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); | 706 | LocalId, AbsolutePosition, m_textureEntry.ToBytes(), |
707 | m_parentID); | ||
705 | } | 708 | } |
706 | 709 | ||
707 | public void SendFullUpdateToAllClients() | 710 | public void SendFullUpdateToAllClients() |
@@ -784,7 +787,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
784 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | 787 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) |
785 | { | 788 | { |
786 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, | 789 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, |
787 | m_textureEntry.ToBytes()); | 790 | m_textureEntry.ToBytes()); |
788 | } | 791 | } |
789 | 792 | ||
790 | /// <summary> | 793 | /// <summary> |
@@ -798,10 +801,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
798 | AnimationSeq = seq; | 801 | AnimationSeq = seq; |
799 | LLUUID sourceAgentId = m_controllingClient.AgentId; | 802 | LLUUID sourceAgentId = m_controllingClient.AgentId; |
800 | 803 | ||
801 | m_scene.Broadcast(delegate(IClientAPI client) | 804 | m_scene.Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, sourceAgentId); }); |
802 | { | ||
803 | client.SendAnimation(animID, seq, sourceAgentId); | ||
804 | }); | ||
805 | } | 805 | } |
806 | 806 | ||
807 | /// <summary> | 807 | /// <summary> |
@@ -842,9 +842,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
842 | LLVector3 vel = Velocity; | 842 | LLVector3 vel = Velocity; |
843 | 843 | ||
844 | float timeStep = 0.1f; | 844 | float timeStep = 0.1f; |
845 | pos2.X = pos2.X + (vel.X * timeStep); | 845 | pos2.X = pos2.X + (vel.X*timeStep); |
846 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 846 | pos2.Y = pos2.Y + (vel.Y*timeStep); |
847 | pos2.Z = pos2.Z + (vel.Z * timeStep); | 847 | pos2.Z = pos2.Z + (vel.Z*timeStep); |
848 | 848 | ||
849 | if ((pos2.X < 0) || (pos2.X > 256)) | 849 | if ((pos2.X < 0) || (pos2.X > 256)) |
850 | { | 850 | { |
@@ -889,7 +889,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
889 | } | 889 | } |
890 | 890 | ||
891 | LLVector3 vel = m_velocity; | 891 | LLVector3 vel = m_velocity; |
892 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); | 892 | ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); |
893 | RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 893 | RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
894 | if (neighbourRegion != null) | 894 | if (neighbourRegion != null) |
895 | { | 895 | { |
@@ -901,7 +901,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
901 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 901 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
902 | string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); | 902 | string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); |
903 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, | 903 | m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, |
904 | capsPath); | 904 | capsPath); |
905 | MakeChildAgent(); | 905 | MakeChildAgent(); |
906 | m_scene.SendKillObject(m_localId); | 906 | m_scene.SendKillObject(m_localId); |
907 | m_scene.NotifyMyCoarseLocationChange(); | 907 | m_scene.NotifyMyCoarseLocationChange(); |
@@ -980,7 +980,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
980 | LastFullUpdateTime = 0; | 980 | LastFullUpdateTime = 0; |
981 | LastTerseUpdateTime = 0; | 981 | LastTerseUpdateTime = 0; |
982 | } | 982 | } |
983 | |||
984 | } | 983 | } |
985 | 984 | ||
986 | 985 | ||
@@ -997,7 +996,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
997 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | 996 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
998 | AbsolutePosition.Z); | 997 | AbsolutePosition.Z); |
999 | 998 | ||
1000 | m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec); | 999 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec); |
1001 | } | 1000 | } |
1002 | 1001 | ||
1003 | internal void Close() | 1002 | internal void Close() |
@@ -1008,7 +1007,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1008 | public void SetWearable(int wearableId, AvatarWearable wearable) | 1007 | public void SetWearable(int wearableId, AvatarWearable wearable) |
1009 | { | 1008 | { |
1010 | m_wearables[wearableId] = wearable; | 1009 | m_wearables[wearableId] = wearable; |
1011 | SendOurAppearance( m_controllingClient ); | 1010 | SendOurAppearance(m_controllingClient); |
1012 | } | 1011 | } |
1013 | } | 1012 | } |
1014 | } | 1013 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index 01c1d65..cb000c4 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -43,4 +43,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
43 | LLVector3 AbsolutePosition { get; } | 43 | LLVector3 AbsolutePosition { get; } |
44 | void SetText(string text, Vector3 color, double alpha); | 44 | void SetText(string text, Vector3 color, double alpha); |
45 | } | 45 | } |
46 | } | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index 2fb3e78..c1bf72b 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -85,4 +85,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
85 | Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); | 85 | Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs index 42048ea..11f0ce0 100644 --- a/OpenSim/Region/Environment/StorageManager.cs +++ b/OpenSim/Region/Environment/StorageManager.cs | |||
@@ -78,4 +78,4 @@ namespace OpenSim.Region.Environment | |||
78 | //TODO: Add checking and warning to make sure it initialised. | 78 | //TODO: Add checking and warning to make sure it initialised. |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index 942ec4d..70b957e 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -44,7 +44,8 @@ namespace OpenSim.Region.Environment.Types | |||
44 | //private int m_quadNumber; | 44 | //private int m_quadNumber; |
45 | private string m_quadID; | 45 | private string m_quadID; |
46 | 46 | ||
47 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) | 47 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, |
48 | short height) | ||
48 | { | 49 | { |
49 | m_parent = parent; | 50 | m_parent = parent; |
50 | m_quadID = quadID; | 51 | m_quadID = quadID; |
@@ -66,9 +67,9 @@ namespace OpenSim.Region.Environment.Types | |||
66 | } | 67 | } |
67 | else | 68 | else |
68 | { | 69 | { |
69 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) | 70 | if (obj.AbsolutePosition.X < (m_leftX + (m_width/2))) |
70 | { | 71 | { |
71 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | 72 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) |
72 | { | 73 | { |
73 | m_childNodes[0].AddObject(obj); | 74 | m_childNodes[0].AddObject(obj); |
74 | } | 75 | } |
@@ -79,7 +80,7 @@ namespace OpenSim.Region.Environment.Types | |||
79 | } | 80 | } |
80 | else | 81 | else |
81 | { | 82 | { |
82 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | 83 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) |
83 | { | 84 | { |
84 | m_childNodes[1].AddObject(obj); | 85 | m_childNodes[1].AddObject(obj); |
85 | } | 86 | } |
@@ -96,10 +97,18 @@ namespace OpenSim.Region.Environment.Types | |||
96 | if (m_childNodes == null) | 97 | if (m_childNodes == null) |
97 | { | 98 | { |
98 | m_childNodes = new BasicQuadTreeNode[4]; | 99 | m_childNodes = new BasicQuadTreeNode[4]; |
99 | m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); | 100 | m_childNodes[0] = |
100 | m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); | 101 | new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2), |
101 | m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); | 102 | (short) (m_height/2)); |
102 | m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); | 103 | m_childNodes[1] = |
104 | new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY, | ||
105 | (short) (m_width/2), (short) (m_height/2)); | ||
106 | m_childNodes[2] = | ||
107 | new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)), | ||
108 | (short) (m_width/2), (short) (m_height/2)); | ||
109 | m_childNodes[3] = | ||
110 | new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)), | ||
111 | (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2)); | ||
103 | } | 112 | } |
104 | else | 113 | else |
105 | { | 114 | { |
@@ -118,9 +127,9 @@ namespace OpenSim.Region.Environment.Types | |||
118 | } | 127 | } |
119 | else | 128 | else |
120 | { | 129 | { |
121 | if (x < m_leftX + (m_width / 2)) | 130 | if (x < m_leftX + (m_width/2)) |
122 | { | 131 | { |
123 | if (y < m_leftY + (m_height / 2)) | 132 | if (y < m_leftY + (m_height/2)) |
124 | { | 133 | { |
125 | return m_childNodes[0].GetObjectsFrom(x, y); | 134 | return m_childNodes[0].GetObjectsFrom(x, y); |
126 | } | 135 | } |
@@ -131,7 +140,7 @@ namespace OpenSim.Region.Environment.Types | |||
131 | } | 140 | } |
132 | else | 141 | else |
133 | { | 142 | { |
134 | if (y < m_leftY + (m_height / 2)) | 143 | if (y < m_leftY + (m_height/2)) |
135 | { | 144 | { |
136 | return m_childNodes[1].GetObjectsFrom(x, y); | 145 | return m_childNodes[1].GetObjectsFrom(x, y); |
137 | } | 146 | } |
@@ -172,9 +181,9 @@ namespace OpenSim.Region.Environment.Types | |||
172 | } | 181 | } |
173 | else | 182 | else |
174 | { | 183 | { |
175 | if (x < m_leftX + (m_width / 2)) | 184 | if (x < m_leftX + (m_width/2)) |
176 | { | 185 | { |
177 | if (y < m_leftY + (m_height / 2)) | 186 | if (y < m_leftY + (m_height/2)) |
178 | { | 187 | { |
179 | return m_childNodes[0].GetNodeID(x, y); | 188 | return m_childNodes[0].GetNodeID(x, y); |
180 | } | 189 | } |
@@ -185,7 +194,7 @@ namespace OpenSim.Region.Environment.Types | |||
185 | } | 194 | } |
186 | else | 195 | else |
187 | { | 196 | { |
188 | if (y < m_leftY + (m_height / 2)) | 197 | if (y < m_leftY + (m_height/2)) |
189 | { | 198 | { |
190 | return m_childNodes[1].GetNodeID(x, y); | 199 | return m_childNodes[1].GetNodeID(x, y); |
191 | } | 200 | } |
@@ -211,7 +220,8 @@ namespace OpenSim.Region.Environment.Types | |||
211 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | 220 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); |
212 | foreach (SceneObjectGroup group in m_objects) | 221 | foreach (SceneObjectGroup group in m_objects) |
213 | { | 222 | { |
214 | 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)))) | 223 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
224 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | ||
215 | { | 225 | { |
216 | //still in bounds | 226 | //still in bounds |
217 | } | 227 | } |
@@ -235,7 +245,8 @@ namespace OpenSim.Region.Environment.Types | |||
235 | 245 | ||
236 | public void PassUp(SceneObjectGroup group) | 246 | public void PassUp(SceneObjectGroup group) |
237 | { | 247 | { |
238 | 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)))) | 248 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
249 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | ||
239 | { | 250 | { |
240 | AddObject(group); | 251 | AddObject(group); |
241 | } | 252 | } |
@@ -255,4 +266,4 @@ namespace OpenSim.Region.Environment.Types | |||
255 | return retVal; | 266 | return retVal; |
256 | } | 267 | } |
257 | } | 268 | } |
258 | } | 269 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index 442e9d5..0648476 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -76,4 +76,4 @@ namespace OpenSim.Region.Environment.Types | |||
76 | return part; | 76 | return part; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs index f5a080f..bfd9d06 100644 --- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | |||
@@ -26,60 +26,69 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | using Axiom.Math; | ||
34 | using libsecondlife; | 29 | using libsecondlife; |
35 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Interfaces; | 31 | using OpenSim.Region.Environment.Scenes; |
37 | 32 | ||
38 | namespace SimpleApp | 33 | namespace SimpleApp |
39 | { | 34 | { |
40 | public class ComplexObject : SceneObjectGroup | 35 | public class ComplexObject : SceneObjectGroup |
41 | { | 36 | { |
42 | private LLQuaternion m_rotationDirection; | 37 | private LLQuaternion m_rotationDirection; |
43 | 38 | ||
44 | private class RotatingWheel : SceneObjectPart | 39 | private class RotatingWheel : SceneObjectPart |
45 | { | 40 | { |
46 | private LLQuaternion m_rotationDirection; | 41 | private LLQuaternion m_rotationDirection; |
47 | 42 | ||
48 | public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) | 43 | public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, |
49 | : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition ) | 44 | LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) |
45 | : base( | ||
46 | regionHandle, parent, ownerID, localID, new CylinderShape(0.5f, 0.2f), groupPosition, offsetPosition | ||
47 | ) | ||
50 | { | 48 | { |
51 | m_rotationDirection = rotationDirection; | 49 | m_rotationDirection = rotationDirection; |
52 | } | 50 | } |
53 | 51 | ||
54 | public override void UpdateMovement() | 52 | public override void UpdateMovement() |
55 | { | 53 | { |
56 | UpdateRotation(RotationOffset * m_rotationDirection); | 54 | UpdateRotation(RotationOffset*m_rotationDirection); |
57 | } | 55 | } |
58 | } | 56 | } |
59 | 57 | ||
60 | public override void UpdateMovement() | 58 | public override void UpdateMovement() |
61 | { | 59 | { |
62 | UpdateGroupRotation(GroupRotation * m_rotationDirection); | 60 | UpdateGroupRotation(GroupRotation*m_rotationDirection); |
63 | 61 | ||
64 | base.UpdateMovement(); | 62 | base.UpdateMovement(); |
65 | } | 63 | } |
66 | 64 | ||
67 | 65 | ||
68 | 66 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) | |
69 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) | 67 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default) |
70 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) | ||
71 | { | 68 | { |
72 | m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); | 69 | m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); |
73 | 70 | ||
74 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0))); | 71 | AddPart( |
75 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0))); | 72 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), |
73 | new LLQuaternion(0.05f, 0, 0))); | ||
74 | AddPart( | ||
75 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), | ||
76 | new LLQuaternion(-0.05f, 0, 0))); | ||
77 | |||
78 | AddPart( | ||
79 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f, 0), | ||
80 | new LLQuaternion(0.5f, 0, 0.05f))); | ||
81 | AddPart( | ||
82 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f, 0), | ||
83 | new LLQuaternion(-0.5f, 0, -0.05f))); | ||
76 | 84 | ||
77 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f))); | 85 | AddPart( |
78 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f))); | 86 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), |
87 | new LLQuaternion(0, 0.5f, 0.05f))); | ||
88 | AddPart( | ||
89 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), | ||
90 | new LLQuaternion(0, -0.5f, -0.05f))); | ||
79 | 91 | ||
80 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f))); | ||
81 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f))); | ||
82 | |||
83 | UpdateParentIDs(); | 92 | UpdateParentIDs(); |
84 | } | 93 | } |
85 | 94 | ||
@@ -88,12 +97,12 @@ namespace SimpleApp | |||
88 | m_parts.Remove(part.UUID); | 97 | m_parts.Remove(part.UUID); |
89 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); | 98 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); |
90 | remoteClient.AddMoney(1); | 99 | remoteClient.AddMoney(1); |
91 | remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); | 100 | remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero); |
92 | } | 101 | } |
93 | 102 | ||
94 | public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) | 103 | public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) |
95 | { | 104 | { |
96 | if( m_parts.Count == 1 ) | 105 | if (m_parts.Count == 1) |
97 | { | 106 | { |
98 | m_parts.Remove(m_rootPart.UUID); | 107 | m_parts.Remove(m_rootPart.UUID); |
99 | m_scene.RemoveEntity(this); | 108 | m_scene.RemoveEntity(this); |
@@ -103,4 +112,4 @@ namespace SimpleApp | |||
103 | } | 112 | } |
104 | } | 113 | } |
105 | } | 114 | } |
106 | } | 115 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs index 0f833ea..cbc4dea 100644 --- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs | |||
@@ -27,37 +27,34 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Diagnostics; |
31 | using System.Text; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | using libsecondlife; | 31 | using libsecondlife; |
34 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
35 | using System.Timers; | 33 | using OpenSim.Region.Environment.Scenes; |
36 | using System.Diagnostics; | ||
37 | 34 | ||
38 | namespace SimpleApp | 35 | namespace SimpleApp |
39 | { | 36 | { |
40 | public class CpuCounterObject : SceneObjectGroup | 37 | public class CpuCounterObject : SceneObjectGroup |
41 | { | 38 | { |
42 | private PerformanceCounter m_counter; | 39 | private PerformanceCounter m_counter; |
43 | 40 | ||
44 | public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) | 41 | public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) |
45 | : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default ) | 42 | : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default) |
46 | { | 43 | { |
47 | String objectName = "Processor"; | 44 | String objectName = "Processor"; |
48 | String counterName = "% Processor Time"; | 45 | String counterName = "% Processor Time"; |
49 | String instanceName = "_Total"; | 46 | String instanceName = "_Total"; |
50 | 47 | ||
51 | m_counter = new PerformanceCounter(objectName, counterName, instanceName); | 48 | m_counter = new PerformanceCounter(objectName, counterName, instanceName); |
52 | } | 49 | } |
53 | 50 | ||
54 | public override void UpdateMovement( ) | 51 | public override void UpdateMovement() |
55 | { | 52 | { |
56 | float cpu = m_counter.NextValue() / 40f; | 53 | float cpu = m_counter.NextValue()/40f; |
57 | LLVector3 size = new LLVector3(cpu, cpu, cpu); | 54 | LLVector3 size = new LLVector3(cpu, cpu, cpu); |
58 | //rootPrimitive.ResizeGoup( size ); | 55 | //rootPrimitive.ResizeGoup( size ); |
59 | 56 | ||
60 | base.UpdateMovement(); | 57 | base.UpdateMovement(); |
61 | } | 58 | } |
62 | } | 59 | } |
63 | } | 60 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs index 746340f..7b1420b 100644 --- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs | |||
@@ -27,14 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.IO; |
31 | using System.Text; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | using libsecondlife; | 31 | using libsecondlife; |
34 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
35 | using System.Timers; | 33 | using OpenSim.Region.Environment.Scenes; |
36 | using System.Diagnostics; | ||
37 | using System.IO; | ||
38 | 34 | ||
39 | namespace SimpleApp | 35 | namespace SimpleApp |
40 | { | 36 | { |
@@ -43,9 +39,7 @@ namespace SimpleApp | |||
43 | public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) | 39 | public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) |
44 | : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default) | 40 | : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default) |
45 | { | 41 | { |
46 | 42 | float size = (float) Math.Pow((double) fileInfo.Length, (double) 1/3)/5; | |
47 | |||
48 | float size = (float)Math.Pow((double)fileInfo.Length, (double)1 / 3) / 5; | ||
49 | // rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); | 43 | // rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); |
50 | Text = fileInfo.Name; | 44 | Text = fileInfo.Name; |
51 | ScheduleGroupForFullUpdate(); | 45 | ScheduleGroupForFullUpdate(); |
@@ -56,4 +50,4 @@ namespace SimpleApp | |||
56 | base.Update(); | 50 | base.Update(); |
57 | } | 51 | } |
58 | } | 52 | } |
59 | } | 53 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 03e0f98..f7fdbb5 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -26,16 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Net; | 31 | using System.Net; |
31 | using System.Text; | 32 | using System.Text; |
32 | using libsecondlife; | 33 | using libsecondlife; |
33 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
37 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
38 | using System; | ||
39 | 37 | ||
40 | namespace SimpleApp | 38 | namespace SimpleApp |
41 | { | 39 | { |
@@ -126,13 +124,15 @@ namespace SimpleApp | |||
126 | #pragma warning restore 67 | 124 | #pragma warning restore 67 |
127 | 125 | ||
128 | private LLUUID myID = LLUUID.Random(); | 126 | private LLUUID myID = LLUUID.Random(); |
129 | public MyNpcCharacter( EventManager eventManager ) | 127 | |
128 | public MyNpcCharacter(EventManager eventManager) | ||
130 | { | 129 | { |
131 | // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); | 130 | // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); |
132 | eventManager.OnFrame += Update; | 131 | eventManager.OnFrame += Update; |
133 | } | 132 | } |
134 | 133 | ||
135 | private LLVector3 startPos = new LLVector3(128, 128,2); | 134 | private LLVector3 startPos = new LLVector3(128, 128, 2); |
135 | |||
136 | public virtual LLVector3 StartPos | 136 | public virtual LLVector3 StartPos |
137 | { | 137 | { |
138 | get { return startPos; } | 138 | get { return startPos; } |
@@ -155,92 +155,218 @@ namespace SimpleApp | |||
155 | } | 155 | } |
156 | 156 | ||
157 | private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); | 157 | private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); |
158 | |||
158 | public virtual string LastName | 159 | public virtual string LastName |
159 | { | 160 | { |
160 | get { return lastName; } | 161 | get { return lastName; } |
161 | } | 162 | } |
162 | 163 | ||
163 | public virtual void OutPacket(Packet newPack) { } | 164 | public virtual void OutPacket(Packet newPack) |
164 | public virtual void SendWearables(AvatarWearable[] wearables) { } | 165 | { |
165 | public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } | 166 | } |
166 | public virtual void SendStartPingCheck(byte seq) { } | 167 | |
167 | public virtual void SendKillObject(ulong regionHandle, uint localID) { } | 168 | public virtual void SendWearables(AvatarWearable[] wearables) |
168 | public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } | 169 | { |
169 | public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } | 170 | } |
170 | public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } | 171 | |
171 | public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) { } | 172 | public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) |
172 | public virtual void SendLayerData(float[] map) { } | 173 | { |
173 | public virtual void SendLayerData(int px, int py, float[] map) { } | 174 | } |
174 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } | 175 | |
175 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } | 176 | public virtual void SendStartPingCheck(byte seq) |
176 | public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } | 177 | { |
177 | public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL) { } | 178 | } |
178 | public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { } | 179 | |
179 | public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } | 180 | public virtual void SendKillObject(ulong regionHandle, uint localID) |
180 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL) { } | 181 | { |
181 | public virtual void SendTeleportCancel() { } | 182 | } |
182 | public virtual void SendTeleportLocationStart() { } | 183 | |
183 | public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } | 184 | public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) |
184 | 185 | { | |
185 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { } | 186 | } |
186 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } | 187 | |
187 | public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } | 188 | public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, |
188 | 189 | LLUUID fromAgentID) | |
189 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } | 190 | { |
190 | 191 | } | |
191 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) { } | 192 | |
192 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } | 193 | public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, |
193 | 194 | LLUUID fromAgentID) | |
194 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } | 195 | { |
195 | public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { } | 196 | } |
196 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | 197 | |
197 | public virtual void SendRemoveInventoryItem(LLUUID itemID) { } | 198 | public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, |
198 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | 199 | LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) |
199 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } | 200 | { |
200 | 201 | } | |
201 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } | 202 | |
202 | 203 | public virtual void SendLayerData(float[] map) | |
203 | public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } | 204 | { |
204 | public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } | 205 | } |
205 | 206 | ||
206 | public void SendAlertMessage(string message) { } | 207 | public virtual void SendLayerData(int px, int py, float[] map) |
207 | public void SendAgentAlertMessage(string message, bool modal) { } | 208 | { |
208 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } | 209 | } |
210 | |||
211 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) | ||
212 | { | ||
213 | } | ||
214 | |||
215 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) | ||
216 | { | ||
217 | } | ||
218 | |||
219 | public virtual AgentCircuitData RequestClientInfo() | ||
220 | { | ||
221 | return new AgentCircuitData(); | ||
222 | } | ||
223 | |||
224 | public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, | ||
225 | IPEndPoint newRegionExternalEndPoint, string capsURL) | ||
226 | { | ||
227 | } | ||
228 | |||
229 | public virtual void SendMapBlock(List<MapBlockData> mapBlocks) | ||
230 | { | ||
231 | } | ||
232 | |||
233 | public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) | ||
234 | { | ||
235 | } | ||
236 | |||
237 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | ||
238 | uint locationID, uint flags, string capsURL) | ||
239 | { | ||
240 | } | ||
241 | |||
242 | public virtual void SendTeleportCancel() | ||
243 | { | ||
244 | } | ||
245 | |||
246 | public virtual void SendTeleportLocationStart() | ||
247 | { | ||
248 | } | ||
249 | |||
250 | public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) | ||
251 | { | ||
252 | } | ||
253 | |||
254 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, | ||
255 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | ||
256 | { | ||
257 | } | ||
258 | |||
259 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | ||
260 | LLVector3 position, LLVector3 velocity, LLQuaternion rotation) | ||
261 | { | ||
262 | } | ||
263 | |||
264 | public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) | ||
265 | { | ||
266 | } | ||
267 | |||
268 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) | ||
269 | { | ||
270 | } | ||
271 | |||
272 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, | ||
273 | PrimitiveBaseShape primShape, LLVector3 pos, uint flags, | ||
274 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, | ||
275 | byte[] particleSystem, LLQuaternion rotation) | ||
276 | { | ||
277 | } | ||
278 | |||
279 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | ||
280 | LLVector3 position, LLQuaternion rotation) | ||
281 | { | ||
282 | } | ||
283 | |||
284 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) | ||
285 | { | ||
286 | } | ||
287 | |||
288 | public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) | ||
289 | { | ||
290 | } | ||
291 | |||
292 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) | ||
293 | { | ||
294 | } | ||
295 | |||
296 | public virtual void SendRemoveInventoryItem(LLUUID itemID) | ||
297 | { | ||
298 | } | ||
299 | |||
300 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) | ||
301 | { | ||
302 | } | ||
303 | |||
304 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) | ||
305 | { | ||
306 | } | ||
307 | |||
308 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) | ||
309 | { | ||
310 | } | ||
311 | |||
312 | public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) | ||
313 | { | ||
314 | } | ||
315 | |||
316 | public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, | ||
317 | byte flags) | ||
318 | { | ||
319 | } | ||
320 | |||
321 | public void SendAlertMessage(string message) | ||
322 | { | ||
323 | } | ||
324 | |||
325 | public void SendAgentAlertMessage(string message, bool modal) | ||
326 | { | ||
327 | } | ||
328 | |||
329 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, | ||
330 | string url) | ||
331 | { | ||
332 | } | ||
209 | 333 | ||
210 | public virtual void SendRegionHandshake(RegionInfo regionInfo) | 334 | public virtual void SendRegionHandshake(RegionInfo regionInfo) |
211 | { | 335 | { |
212 | if (OnRegionHandShakeReply != null) | 336 | if (OnRegionHandShakeReply != null) |
213 | { | 337 | { |
214 | this.OnRegionHandShakeReply(this); | 338 | OnRegionHandShakeReply(this); |
215 | } | 339 | } |
216 | 340 | ||
217 | if (OnCompleteMovementToRegion != null) | 341 | if (OnCompleteMovementToRegion != null) |
218 | { | 342 | { |
219 | this.OnCompleteMovementToRegion(); | 343 | OnCompleteMovementToRegion(); |
220 | } | 344 | } |
221 | } | 345 | } |
222 | 346 | ||
223 | private void Update( ) | 347 | private void Update() |
224 | { | 348 | { |
225 | Encoding enc = Encoding.ASCII; | 349 | Encoding enc = Encoding.ASCII; |
226 | 350 | ||
227 | if (this.OnAgentUpdate != null) | 351 | if (OnAgentUpdate != null) |
228 | { | 352 | { |
229 | this.OnAgentUpdate(this, movementFlag, bodyDirection); | 353 | OnAgentUpdate(this, movementFlag, bodyDirection); |
230 | } | 354 | } |
231 | if (this.flyState == 0) | 355 | if (flyState == 0) |
232 | { | 356 | { |
233 | movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; | 357 | movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY | |
358 | (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; | ||
234 | flyState = 1; | 359 | flyState = 1; |
235 | } | 360 | } |
236 | else if (this.flyState == 1) | 361 | else if (flyState == 1) |
237 | { | 362 | { |
238 | movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; | 363 | movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY | |
364 | (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; | ||
239 | flyState = 2; | 365 | flyState = 2; |
240 | } | 366 | } |
241 | else | 367 | else |
242 | { | 368 | { |
243 | movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY; | 369 | movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY; |
244 | flyState = 0; | 370 | flyState = 0; |
245 | } | 371 | } |
246 | 372 | ||
@@ -251,15 +377,14 @@ namespace SimpleApp | |||
251 | ChatFromViewerArgs args = new ChatFromViewerArgs(); | 377 | ChatFromViewerArgs args = new ChatFromViewerArgs(); |
252 | args.Message = "Kinda quiet around here, isn't it?"; | 378 | args.Message = "Kinda quiet around here, isn't it?"; |
253 | args.Channel = 0; | 379 | args.Channel = 0; |
254 | args.From = this.FirstName + " " + this.LastName; | 380 | args.From = FirstName + " " + LastName; |
255 | args.Position = new LLVector3(128, 128, 26); | 381 | args.Position = new LLVector3(128, 128, 26); |
256 | args.Sender = this; | 382 | args.Sender = this; |
257 | args.Type = ChatTypeEnum.Shout; | 383 | args.Type = ChatTypeEnum.Shout; |
258 | 384 | ||
259 | this.OnChatFromViewer(this, args); | 385 | OnChatFromViewer(this, args); |
260 | } | 386 | } |
261 | count = -1; | 387 | count = -1; |
262 | |||
263 | } | 388 | } |
264 | 389 | ||
265 | count++; | 390 | count++; |
@@ -270,9 +395,19 @@ namespace SimpleApp | |||
270 | return false; | 395 | return false; |
271 | } | 396 | } |
272 | 397 | ||
273 | public void SendViewerTime(int phase) { } | 398 | public void SendViewerTime(int phase) |
274 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } | 399 | { |
275 | public void SetDebug(int newDebug) { } | 400 | } |
401 | |||
402 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, | ||
403 | string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, | ||
404 | LLUUID partnerID) | ||
405 | { | ||
406 | } | ||
407 | |||
408 | public void SetDebug(int newDebug) | ||
409 | { | ||
410 | } | ||
276 | 411 | ||
277 | public void InPacket(Packet NewPack) | 412 | public void InPacket(Packet NewPack) |
278 | { | 413 | { |
@@ -281,22 +416,17 @@ namespace SimpleApp | |||
281 | public void Close() | 416 | public void Close() |
282 | { | 417 | { |
283 | } | 418 | } |
284 | 419 | ||
285 | private uint m_circuitCode; | 420 | private uint m_circuitCode; |
421 | |||
286 | public uint CircuitCode | 422 | public uint CircuitCode |
287 | { | 423 | { |
288 | get | 424 | get { return m_circuitCode; } |
289 | { | 425 | set { m_circuitCode = value; } |
290 | return m_circuitCode; | ||
291 | } | ||
292 | set | ||
293 | { | ||
294 | m_circuitCode = value; | ||
295 | } | ||
296 | } | 426 | } |
297 | 427 | ||
298 | public void SendLogoutPacket() | 428 | public void SendLogoutPacket() |
299 | { | 429 | { |
300 | } | 430 | } |
301 | } | 431 | } |
302 | } | 432 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 9a7b340..c616f6a 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -31,13 +31,9 @@ using libsecondlife; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Communications; | 32 | using OpenSim.Framework.Communications; |
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework; | ||
37 | |||
38 | using OpenSim.Region.Environment.Scenes; | ||
39 | using OpenSim.Region.Terrain; | ||
40 | using OpenSim.Region.Environment; | 35 | using OpenSim.Region.Environment; |
36 | using OpenSim.Region.Environment.Scenes; | ||
41 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; | 37 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; |
42 | 38 | ||
43 | namespace SimpleApp | 39 | namespace SimpleApp |
@@ -46,8 +42,10 @@ namespace SimpleApp | |||
46 | { | 42 | { |
47 | private List<ScenePresence> m_avatars; | 43 | private List<ScenePresence> m_avatars; |
48 | 44 | ||
49 | public MyWorld( RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, ModuleLoader moduleLoader) | 45 | public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, |
50 | : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false) | 46 | AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, |
47 | ModuleLoader moduleLoader) | ||
48 | : base(regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false) | ||
51 | { | 49 | { |
52 | m_avatars = new List<Avatar>(); | 50 | m_avatars = new List<Avatar>(); |
53 | } | 51 | } |
@@ -58,32 +56,30 @@ namespace SimpleApp | |||
58 | 56 | ||
59 | for (int i = 0; i < 65536; i++) | 57 | for (int i = 0; i < 65536; i++) |
60 | { | 58 | { |
61 | int x = i % 256; | 59 | int x = i%256; |
62 | int y = i / 256; | 60 | int y = i/256; |
63 | 61 | ||
64 | map[i] = 25f; | 62 | map[i] = 25f; |
65 | } | 63 | } |
66 | 64 | ||
67 | this.Terrain.GetHeights1D(map); | 65 | Terrain.GetHeights1D(map); |
68 | this.CreateTerrainTexture(); | 66 | CreateTerrainTexture(); |
69 | } | 67 | } |
70 | 68 | ||
71 | override public void AddNewClient(IClientAPI client, bool child) | 69 | public override void AddNewClient(IClientAPI client, bool child) |
72 | { | 70 | { |
73 | SubscribeToClientEvents(client); | 71 | SubscribeToClientEvents(client); |
74 | 72 | ||
75 | ScenePresence avatar = CreateAndAddScenePresence(client, child ); | 73 | ScenePresence avatar = CreateAndAddScenePresence(client, child); |
76 | avatar.AbsolutePosition = new LLVector3(128, 128, 26); | 74 | avatar.AbsolutePosition = new LLVector3(128, 128, 26); |
77 | 75 | ||
78 | LLVector3 pos = new LLVector3(128, 128, 128); | 76 | LLVector3 pos = new LLVector3(128, 128, 128); |
79 | 77 | ||
80 | client.OnCompleteMovementToRegion += delegate() | 78 | client.OnCompleteMovementToRegion += |
81 | { | 79 | delegate() { client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); }; |
82 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); | ||
83 | }; | ||
84 | 80 | ||
85 | 81 | ||
86 | client.SendRegionHandshake(m_regInfo); | 82 | client.SendRegionHandshake(m_regInfo); |
87 | } | 83 | } |
88 | } | 84 | } |
89 | } | 85 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 72aaf6b..b37c2ee 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -31,23 +31,23 @@ using System.Collections.Generic; | |||
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Net; | 32 | using System.Net; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Nini.Config; | ||
35 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.ClientStack; | 38 | using OpenSim.Region.ClientStack; |
38 | using OpenSim.Region.Communications.Local; | 39 | using OpenSim.Region.Communications.Local; |
39 | using OpenSim.Region.Environment; | 40 | using OpenSim.Region.Environment; |
40 | using OpenSim.Region.Environment.Scenes; | 41 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Region.Physics.Manager; | 42 | using OpenSim.Region.Physics.Manager; |
42 | using Nini.Config; | ||
43 | 43 | ||
44 | namespace SimpleApp | 44 | namespace SimpleApp |
45 | { | 45 | { |
46 | class Program : RegionApplicationBase, conscmd_callback | 46 | internal class Program : RegionApplicationBase, conscmd_callback |
47 | { | 47 | { |
48 | private ModuleLoader m_moduleLoader; | 48 | private ModuleLoader m_moduleLoader; |
49 | private IConfigSource m_config; | 49 | private IConfigSource m_config; |
50 | 50 | ||
51 | protected override LogBase CreateLog() | 51 | protected override LogBase CreateLog() |
52 | { | 52 | { |
53 | return new LogBase(null, "SimpleApp", this, true); | 53 | return new LogBase(null, "SimpleApp", this, true); |
@@ -57,45 +57,51 @@ namespace SimpleApp | |||
57 | { | 57 | { |
58 | StartLog(); | 58 | StartLog(); |
59 | 59 | ||
60 | m_networkServersInfo = new NetworkServersInfo( 1000, 1000 ); | 60 | m_networkServersInfo = new NetworkServersInfo(1000, 1000); |
61 | 61 | ||
62 | LocalAssetServer assetServer = new LocalAssetServer(); | 62 | LocalAssetServer assetServer = new LocalAssetServer(); |
63 | 63 | ||
64 | m_assetCache = new AssetCache(assetServer); | 64 | m_assetCache = new AssetCache(assetServer); |
65 | } | 65 | } |
66 | 66 | ||
67 | public void Run() | 67 | public void Run() |
68 | { | 68 | { |
69 | base.StartUp(); | 69 | base.StartUp(); |
70 | 70 | ||
71 | LocalInventoryService inventoryService = new LocalInventoryService(); | 71 | LocalInventoryService inventoryService = new LocalInventoryService(); |
72 | LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); | 72 | LocalUserServices userService = |
73 | new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, | ||
74 | m_networkServersInfo.DefaultHomeLocY, inventoryService); | ||
73 | LocalBackEndServices backendService = new LocalBackEndServices(); | 75 | LocalBackEndServices backendService = new LocalBackEndServices(); |
74 | 76 | ||
75 | CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, false); | 77 | CommunicationsLocal localComms = |
78 | new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, | ||
79 | backendService, backendService, false); | ||
76 | m_commsManager = localComms; | 80 | m_commsManager = localComms; |
77 | 81 | ||
78 | LocalLoginService loginService = new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); | 82 | LocalLoginService loginService = |
83 | new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); | ||
79 | loginService.OnLoginToRegion += backendService.AddNewSession; | 84 | loginService.OnLoginToRegion += backendService.AddNewSession; |
80 | 85 | ||
81 | m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); | 86 | m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); |
82 | 87 | ||
83 | m_log.Notice(m_log.LineInfo); | 88 | m_log.Notice(m_log.LineInfo); |
84 | 89 | ||
85 | IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); | 90 | IPEndPoint internalEndPoint = |
91 | new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); | ||
86 | 92 | ||
87 | RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost"); | 93 | RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost"); |
88 | regionInfo.DataStore = "simpleapp_datastore.yap"; | 94 | regionInfo.DataStore = "simpleapp_datastore.yap"; |
89 | 95 | ||
90 | UDPServer udpServer; | 96 | UDPServer udpServer; |
91 | 97 | ||
92 | m_moduleLoader = new ModuleLoader( m_log, m_config ); | 98 | m_moduleLoader = new ModuleLoader(m_log, m_config); |
93 | m_moduleLoader.LoadDefaultSharedModules(); | 99 | m_moduleLoader.LoadDefaultSharedModules(); |
94 | 100 | ||
95 | Scene scene = SetupScene(regionInfo, out udpServer); | 101 | Scene scene = SetupScene(regionInfo, out udpServer); |
96 | 102 | ||
97 | m_moduleLoader.InitialiseSharedModules(scene); | 103 | m_moduleLoader.InitialiseSharedModules(scene); |
98 | 104 | ||
99 | scene.SetModuleInterfaces(); | 105 | scene.SetModuleInterfaces(); |
100 | 106 | ||
101 | scene.StartTimer(); | 107 | scene.StartTimer(); |
@@ -104,18 +110,22 @@ namespace SimpleApp | |||
104 | 110 | ||
105 | m_moduleLoader.PostInitialise(); | 111 | m_moduleLoader.PostInitialise(); |
106 | m_moduleLoader.ClearCache(); | 112 | m_moduleLoader.ClearCache(); |
107 | 113 | ||
108 | udpServer.ServerListener(); | 114 | udpServer.ServerListener(); |
109 | 115 | ||
110 | LLVector3 pos = new LLVector3(110, 129, 27); | 116 | LLVector3 pos = new LLVector3(110, 129, 27); |
111 | 117 | ||
112 | SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f )); | 118 | SceneObjectGroup sceneObject = |
119 | new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), | ||
120 | pos + new LLVector3(1f, 1f, 1f)); | ||
113 | scene.AddEntity(sceneObject); | 121 | scene.AddEntity(sceneObject); |
114 | 122 | ||
115 | for (int i = 0; i < 27; i++) | 123 | for (int i = 0; i < 27; i++) |
116 | { | 124 | { |
117 | LLVector3 posOffset = new LLVector3( (i%3)*4, (i%9)/3 * 4, (i/9) * 4 ); | 125 | LLVector3 posOffset = new LLVector3((i%3)*4, (i%9)/3*4, (i/9)*4); |
118 | ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); | 126 | ComplexObject complexObject = |
127 | new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), | ||
128 | pos + posOffset); | ||
119 | scene.AddEntity(complexObject); | 129 | scene.AddEntity(complexObject); |
120 | } | 130 | } |
121 | 131 | ||
@@ -128,45 +138,48 @@ namespace SimpleApp | |||
128 | List<ScenePresence> avatars = scene.GetAvatars(); | 138 | List<ScenePresence> avatars = scene.GetAvatars(); |
129 | foreach (ScenePresence avatar in avatars) | 139 | foreach (ScenePresence avatar in avatars) |
130 | { | 140 | { |
131 | avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Util.RandomClass.Next(30, 200), 2); | 141 | avatar.AbsolutePosition = |
142 | new LLVector3((float) Util.RandomClass.Next(100, 200), (float) Util.RandomClass.Next(30, 200), 2); | ||
132 | } | 143 | } |
133 | 144 | ||
134 | 145 | ||
135 | 146 | DirectoryInfo dirInfo = new DirectoryInfo("."); | |
136 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); | ||
137 | 147 | ||
138 | float x = 0; | 148 | float x = 0; |
139 | float z = 0; | 149 | float z = 0; |
140 | 150 | ||
141 | foreach( FileInfo fileInfo in dirInfo.GetFiles()) | 151 | foreach (FileInfo fileInfo in dirInfo.GetFiles()) |
142 | { | 152 | { |
143 | LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); | 153 | LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); |
144 | x = x + 2; | 154 | x = x + 2; |
145 | if( x > 50 ) | 155 | if (x > 50) |
146 | { | 156 | { |
147 | x = 0; | 157 | x = 0; |
148 | z = z + 2; | 158 | z = z + 2; |
149 | } | 159 | } |
150 | 160 | ||
151 | FileSystemObject fileObject = new FileSystemObject( scene, fileInfo, filePos ); | 161 | FileSystemObject fileObject = new FileSystemObject(scene, fileInfo, filePos); |
152 | scene.AddEntity(fileObject); | 162 | scene.AddEntity(fileObject); |
153 | } | 163 | } |
154 | 164 | ||
155 | m_log.Notice("Press enter to quit."); | 165 | m_log.Notice("Press enter to quit."); |
156 | m_log.ReadLine(); | 166 | m_log.ReadLine(); |
157 | } | 167 | } |
158 | 168 | ||
159 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) | 169 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
170 | AgentCircuitManager circuitManager) | ||
160 | { | 171 | { |
161 | return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config )); | 172 | return |
173 | new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, | ||
174 | new ModuleLoader(m_log, m_config)); | ||
162 | } | 175 | } |
163 | 176 | ||
164 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) | 177 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) |
165 | { | 178 | { |
166 | return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); | 179 | return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); |
167 | } | 180 | } |
168 | 181 | ||
169 | protected override PhysicsScene GetPhysicsScene( ) | 182 | protected override PhysicsScene GetPhysicsScene() |
170 | { | 183 | { |
171 | return GetPhysicsScene("basicphysics"); | 184 | return GetPhysicsScene("basicphysics"); |
172 | } | 185 | } |
@@ -185,11 +198,11 @@ namespace SimpleApp | |||
185 | 198 | ||
186 | #endregion | 199 | #endregion |
187 | 200 | ||
188 | static void Main(string[] args) | 201 | private static void Main(string[] args) |
189 | { | 202 | { |
190 | Program app = new Program(); | 203 | Program app = new Program(); |
191 | 204 | ||
192 | app.Run(); | 205 | app.Run(); |
193 | } | 206 | } |
194 | } | 207 | } |
195 | } | 208 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs index 2250613..a5c8f05 100644 --- a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("SimpleApp")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("SimpleApp")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("Playahead AB")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("SimpleApp")] | 11 | [assembly : AssemblyCompany("Playahead AB")] |
11 | [assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] | 12 | [assembly : AssemblyProduct("SimpleApp")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © Playahead AB 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // 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 |
16 | // 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 |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] | 24 | |
25 | [assembly : Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices; | |||
27 | // Build Number | 31 | // Build Number |
28 | // Revision | 32 | // Revision |
29 | // | 33 | // |
30 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
31 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs index d4b27fc..176fc7b 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp | |||
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; |
@@ -66,15 +66,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp | |||
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 = |
78 | (IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | ||
78 | 79 | ||
79 | string scriptName = "C#/" + script.Name; | 80 | string scriptName = "C#/" + script.Name; |
80 | Console.WriteLine("Script: " + scriptName + " loaded."); | 81 | Console.WriteLine("Script: " + scriptName + " loaded."); |
@@ -94,10 +95,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp | |||
94 | return null; | 95 | return null; |
95 | } | 96 | } |
96 | 97 | ||
97 | public Dictionary<string,IScript> compile(string filename) | 98 | public Dictionary<string, IScript> compile(string filename) |
98 | { | 99 | { |
99 | CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); | 100 | CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); |
100 | return LoadDotNetScript(csharpProvider, filename); | 101 | return LoadDotNetScript(csharpProvider, filename); |
101 | } | 102 | } |
102 | } | 103 | } |
103 | } | 104 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs index 7ae4658..2d684d1 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs | |||
@@ -26,19 +26,13 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Environment; | ||
32 | using OpenSim.Region.Environment.Scenes; | 29 | using OpenSim.Region.Environment.Scenes; |
33 | 30 | ||
34 | using System.Collections.Generic; | ||
35 | using libsecondlife; | ||
36 | |||
37 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples | 31 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples |
38 | { | 32 | { |
39 | public class LSLExportScript : IScript | 33 | public class LSLExportScript : IScript |
40 | { | 34 | { |
41 | ScriptInfo script; | 35 | private ScriptInfo script; |
42 | 36 | ||
43 | public string Name | 37 | public string Name |
44 | { | 38 | { |
@@ -48,11 +42,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples | |||
48 | public void Initialise(ScriptInfo scriptInfo) | 42 | public void Initialise(ScriptInfo scriptInfo) |
49 | { | 43 | { |
50 | script = scriptInfo; | 44 | script = scriptInfo; |
51 | 45 | ||
52 | script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg); | 46 | script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg); |
53 | } | 47 | } |
54 | 48 | ||
55 | void ProcessConsoleMsg(string[] args) | 49 | private void ProcessConsoleMsg(string[] args) |
56 | { | 50 | { |
57 | /*if (args[0].ToLower() == "lslexport") | 51 | /*if (args[0].ToLower() == "lslexport") |
58 | { | 52 | { |
@@ -79,7 +73,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples | |||
79 | }*/ | 73 | }*/ |
80 | } | 74 | } |
81 | 75 | ||
82 | string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) | 76 | private string processPrimitiveToString(SceneObjectPart prim) |
83 | { | 77 | { |
84 | /*string desc = prim.Description; | 78 | /*string desc = prim.Description; |
85 | string name = prim.Name; | 79 | string name = prim.Name; |
@@ -97,4 +91,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples | |||
97 | return ""; | 91 | return ""; |
98 | } | 92 | } |
99 | } | 93 | } |
100 | } | 94 | } \ 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 4bde721..ea0e92a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs | |||
@@ -74,7 +74,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript | |||
74 | 74 | ||
75 | if (testInterface != null) | 75 | if (testInterface != null) |
76 | { | 76 | { |
77 | IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | 77 | IScript script = |
78 | (IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | ||
78 | 79 | ||
79 | string scriptName = "JS.NET/" + script.Name; | 80 | string scriptName = "JS.NET/" + script.Name; |
80 | Console.WriteLine("Script: " + scriptName + " loaded."); | 81 | Console.WriteLine("Script: " + scriptName + " loaded."); |
@@ -100,4 +101,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript | |||
100 | return LoadDotNetScript(jscriptProvider, filename); | 101 | return LoadDotNetScript(jscriptProvider, filename); |
101 | } | 102 | } |
102 | } | 103 | } |
103 | } | 104 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs index 6100c67..3f09099 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 30 | ||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 31 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
@@ -40,7 +38,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
40 | 38 | ||
41 | public ClassInstance() | 39 | public ClassInstance() |
42 | { | 40 | { |
43 | |||
44 | } | 41 | } |
45 | } | 42 | } |
46 | } | 43 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs index 5c3629c..3bcc824 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs | |||
@@ -26,9 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | 30 | using System.IO; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
33 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
34 | 33 | ||
@@ -56,7 +55,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
56 | 55 | ||
57 | public ClassRecord() | 56 | public ClassRecord() |
58 | { | 57 | { |
59 | |||
60 | } | 58 | } |
61 | 59 | ||
62 | public ClassInstance CreateNewInstance() | 60 | public ClassInstance CreateNewInstance() |
@@ -72,7 +70,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
72 | { | 70 | { |
73 | Console.WriteLine("loading script " + fileName); | 71 | Console.WriteLine("loading script " + fileName); |
74 | FileStream fs = File.OpenRead(fileName); | 72 | FileStream fs = File.OpenRead(fileName); |
75 | this.LoadClassFromBytes(ReadFully(fs)); | 73 | LoadClassFromBytes(ReadFully(fs)); |
76 | fs.Close(); | 74 | fs.Close(); |
77 | } | 75 | } |
78 | 76 | ||
@@ -80,9 +78,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
80 | { | 78 | { |
81 | int i = 0; | 79 | int i = 0; |
82 | i += 4; | 80 | i += 4; |
83 | m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); | 81 | m_minorVersion = (ushort) ((data[i++] << 8) + data[i++]); |
84 | m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); | 82 | m_majorVersion = (ushort) ((data[i++] << 8) + data[i++]); |
85 | m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); | 83 | m_constantPoolCount = (ushort) ((data[i++] << 8) + data[i++]); |
86 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); | 84 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); |
87 | for (int count = 0; count < (m_constantPoolCount - 1); count++) | 85 | for (int count = 0; count < (m_constantPoolCount - 1); count++) |
88 | { | 86 | { |
@@ -92,13 +90,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
92 | //Console.WriteLine("start position is: " + i); | 90 | //Console.WriteLine("start position is: " + i); |
93 | switch (pooltype) | 91 | switch (pooltype) |
94 | { | 92 | { |
95 | case 1: //Utf8 | 93 | case 1: //Utf8 |
96 | ushort uLength = (ushort)((data[i++] << 8) + data[i++]); | 94 | ushort uLength = (ushort) ((data[i++] << 8) + data[i++]); |
97 | 95 | ||
98 | // Console.WriteLine("new utf8 type, length is " + uLength); | 96 | // Console.WriteLine("new utf8 type, length is " + uLength); |
99 | PoolUtf8 utf8 = new PoolUtf8(); | 97 | PoolUtf8 utf8 = new PoolUtf8(); |
100 | utf8.readValue(data, ref i, uLength); | 98 | utf8.readValue(data, ref i, uLength); |
101 | this.m_constantsPool.Add(utf8); | 99 | m_constantsPool.Add(utf8); |
102 | break; | 100 | break; |
103 | case 3: //Int | 101 | case 3: //Int |
104 | break; | 102 | break; |
@@ -107,53 +105,53 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
107 | case 7: //Class | 105 | case 7: //Class |
108 | PoolClass pClass = new PoolClass(this); | 106 | PoolClass pClass = new PoolClass(this); |
109 | pClass.readValue(data, ref i); | 107 | pClass.readValue(data, ref i); |
110 | this.m_constantsPool.Add(pClass); | 108 | m_constantsPool.Add(pClass); |
111 | break; | 109 | break; |
112 | case 9: //FieldRef | 110 | case 9: //FieldRef |
113 | PoolFieldRef pField = new PoolFieldRef(this); | 111 | PoolFieldRef pField = new PoolFieldRef(this); |
114 | pField.readValue(data, ref i); | 112 | pField.readValue(data, ref i); |
115 | this.m_constantsPool.Add(pField); | 113 | m_constantsPool.Add(pField); |
116 | break; | 114 | break; |
117 | case 10: //Method | 115 | case 10: //Method |
118 | PoolMethodRef pMeth = new PoolMethodRef(this); | 116 | PoolMethodRef pMeth = new PoolMethodRef(this); |
119 | pMeth.readValue(data, ref i); | 117 | pMeth.readValue(data, ref i); |
120 | this.m_constantsPool.Add(pMeth); | 118 | m_constantsPool.Add(pMeth); |
121 | break; | 119 | break; |
122 | case 12: //NamedType | 120 | case 12: //NamedType |
123 | PoolNamedType pNamed = new PoolNamedType(this); | 121 | PoolNamedType pNamed = new PoolNamedType(this); |
124 | pNamed.readValue(data, ref i); | 122 | pNamed.readValue(data, ref i); |
125 | this.m_constantsPool.Add(pNamed); | 123 | m_constantsPool.Add(pNamed); |
126 | break; | 124 | break; |
127 | } | 125 | } |
128 | } | 126 | } |
129 | 127 | ||
130 | m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); | 128 | m_accessFlags = (ushort) ((data[i++] << 8) + data[i++]); |
131 | m_thisClass = (ushort)((data[i++] << 8) + data[i++]); | 129 | m_thisClass = (ushort) ((data[i++] << 8) + data[i++]); |
132 | m_supperClass = (ushort)((data[i++] << 8) + data[i++]); | 130 | m_supperClass = (ushort) ((data[i++] << 8) + data[i++]); |
133 | 131 | ||
134 | if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) | 132 | if (m_constantsPool[m_thisClass - 1] is PoolClass) |
135 | { | 133 | { |
136 | this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); | 134 | MClass = ((PoolClass) m_constantsPool[m_thisClass - 1]); |
137 | } | 135 | } |
138 | 136 | ||
139 | m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); | 137 | m_interfaceCount = (ushort) ((data[i++] << 8) + data[i++]); |
140 | //should now read in the info for each interface | 138 | //should now read in the info for each interface |
141 | 139 | ||
142 | m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); | 140 | m_fieldCount = (ushort) ((data[i++] << 8) + data[i++]); |
143 | //should now read in the info for each field | 141 | //should now read in the info for each field |
144 | for (int count = 0; count < m_fieldCount; count++) | 142 | for (int count = 0; count < m_fieldCount; count++) |
145 | { | 143 | { |
146 | FieldInfo fieldInf = new FieldInfo(this); | 144 | FieldInfo fieldInf = new FieldInfo(this); |
147 | fieldInf.ReadData(data, ref i); | 145 | fieldInf.ReadData(data, ref i); |
148 | this.m_fieldList.Add(fieldInf); | 146 | m_fieldList.Add(fieldInf); |
149 | } | 147 | } |
150 | 148 | ||
151 | m_methodCount = (ushort)((data[i++] << 8) + data[i++]); | 149 | m_methodCount = (ushort) ((data[i++] << 8) + data[i++]); |
152 | for (int count = 0; count < m_methodCount; count++) | 150 | for (int count = 0; count < m_methodCount; count++) |
153 | { | 151 | { |
154 | MethodInfo methInf = new MethodInfo(this); | 152 | MethodInfo methInf = new MethodInfo(this); |
155 | methInf.ReadData(data, ref i); | 153 | methInf.ReadData(data, ref i); |
156 | this.m_methodsList.Add(methInf); | 154 | m_methodsList.Add(methInf); |
157 | } | 155 | } |
158 | } | 156 | } |
159 | 157 | ||
@@ -161,7 +159,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
161 | { | 159 | { |
162 | for (int count = 0; count < m_methodCount; count++) | 160 | for (int count = 0; count < m_methodCount; count++) |
163 | { | 161 | { |
164 | this.m_methodsList[count].AddMethodCode(memory); | 162 | m_methodsList[count].AddMethodCode(memory); |
165 | } | 163 | } |
166 | } | 164 | } |
167 | 165 | ||
@@ -169,12 +167,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
169 | { | 167 | { |
170 | for (int count = 0; count < m_methodCount; count++) | 168 | for (int count = 0; count < m_methodCount; count++) |
171 | { | 169 | { |
172 | if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) | 170 | if (m_constantsPool[m_methodsList[count].NameIndex - 1] is PoolUtf8) |
173 | { | 171 | { |
174 | if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) | 172 | if (((PoolUtf8) m_constantsPool[m_methodsList[count].NameIndex - 1]).Value == methodName) |
175 | { | 173 | { |
176 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | 174 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); |
177 | thread.SetPC(this.m_methodsList[count].CodePointer); | 175 | thread.SetPC(m_methodsList[count].CodePointer); |
178 | return true; | 176 | return true; |
179 | } | 177 | } |
180 | } | 178 | } |
@@ -191,7 +189,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
191 | 189 | ||
192 | for (int i = 0; i < m_constantsPool.Count; i++) | 190 | for (int i = 0; i < m_constantsPool.Count; i++) |
193 | { | 191 | { |
194 | this.m_constantsPool[i].Print(); | 192 | m_constantsPool[i].Print(); |
195 | } | 193 | } |
196 | 194 | ||
197 | Console.WriteLine("Access flags: " + m_accessFlags); | 195 | Console.WriteLine("Access flags: " + m_accessFlags); |
@@ -201,16 +199,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
201 | for (int count = 0; count < m_fieldCount; count++) | 199 | for (int count = 0; count < m_fieldCount; count++) |
202 | { | 200 | { |
203 | Console.WriteLine(); | 201 | Console.WriteLine(); |
204 | this.m_fieldList[count].Print(); | 202 | m_fieldList[count].Print(); |
205 | } | 203 | } |
206 | 204 | ||
207 | for (int count = 0; count < m_methodCount; count++) | 205 | for (int count = 0; count < m_methodCount; count++) |
208 | { | 206 | { |
209 | Console.WriteLine(); | 207 | Console.WriteLine(); |
210 | this.m_methodsList[count].Print(); | 208 | m_methodsList[count].Print(); |
211 | } | 209 | } |
212 | 210 | ||
213 | Console.WriteLine("class name is " + this.MClass.Name.Value); | 211 | Console.WriteLine("class name is " + MClass.Name.Value); |
214 | } | 212 | } |
215 | 213 | ||
216 | public static byte[] ReadFully(Stream stream) | 214 | public static byte[] ReadFully(Stream stream) |
@@ -229,11 +227,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
229 | } | 227 | } |
230 | 228 | ||
231 | #region nested classes | 229 | #region nested classes |
230 | |||
232 | public class PoolItem | 231 | public class PoolItem |
233 | { | 232 | { |
234 | public virtual void Print() | 233 | public virtual void Print() |
235 | { | 234 | { |
236 | |||
237 | } | 235 | } |
238 | } | 236 | } |
239 | 237 | ||
@@ -245,21 +243,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
245 | { | 243 | { |
246 | for (int i = 0; i < length; i++) | 244 | for (int i = 0; i < length; i++) |
247 | { | 245 | { |
248 | int a = (int)data[pointer++]; | 246 | int a = (int) data[pointer++]; |
249 | if ((a & 0x80) == 0) | 247 | if ((a & 0x80) == 0) |
250 | { | 248 | { |
251 | Value = Value + (char)a; | 249 | Value = Value + (char) a; |
252 | } | 250 | } |
253 | else if ((a & 0x20) == 0) | 251 | else if ((a & 0x20) == 0) |
254 | { | 252 | { |
255 | int b = (int)data[pointer++]; | 253 | int b = (int) data[pointer++]; |
256 | Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); | 254 | Value = Value + (char) (((a & 0x1f) << 6) + (b & 0x3f)); |
257 | } | 255 | } |
258 | else | 256 | else |
259 | { | 257 | { |
260 | int b = (int)data[pointer++]; | 258 | int b = (int) data[pointer++]; |
261 | int c = (int)data[pointer++]; | 259 | int c = (int) data[pointer++]; |
262 | Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); | 260 | Value = Value + (char) (((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); |
263 | } | 261 | } |
264 | } | 262 | } |
265 | } | 263 | } |
@@ -272,7 +270,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
272 | 270 | ||
273 | private class PoolInt : PoolItem | 271 | private class PoolInt : PoolItem |
274 | { | 272 | { |
275 | |||
276 | } | 273 | } |
277 | 274 | ||
278 | public class PoolClass : PoolItem | 275 | public class PoolClass : PoolItem |
@@ -289,15 +286,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
289 | 286 | ||
290 | public void readValue(byte[] data, ref int pointer) | 287 | public void readValue(byte[] data, ref int pointer) |
291 | { | 288 | { |
292 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 289 | namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
293 | } | 290 | } |
294 | 291 | ||
295 | public override void Print() | 292 | public override void Print() |
296 | { | 293 | { |
297 | this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); | 294 | Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]); |
298 | Console.Write("Class type: " + namePointer); | 295 | Console.Write("Class type: " + namePointer); |
299 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); | 296 | Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value); |
300 | |||
301 | } | 297 | } |
302 | } | 298 | } |
303 | 299 | ||
@@ -316,14 +312,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
316 | 312 | ||
317 | public void readValue(byte[] data, ref int pointer) | 313 | public void readValue(byte[] data, ref int pointer) |
318 | { | 314 | { |
319 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 315 | classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
320 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 316 | nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
321 | } | 317 | } |
322 | 318 | ||
323 | public override void Print() | 319 | public override void Print() |
324 | { | 320 | { |
325 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); | 321 | mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]); |
326 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); | 322 | mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]); |
327 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); | 323 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); |
328 | } | 324 | } |
329 | } | 325 | } |
@@ -343,14 +339,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
343 | 339 | ||
344 | public void readValue(byte[] data, ref int pointer) | 340 | public void readValue(byte[] data, ref int pointer) |
345 | { | 341 | { |
346 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 342 | classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
347 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 343 | nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
348 | } | 344 | } |
349 | 345 | ||
350 | public override void Print() | 346 | public override void Print() |
351 | { | 347 | { |
352 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); | 348 | mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]); |
353 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); | 349 | mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]); |
354 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | 350 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); |
355 | } | 351 | } |
356 | } | 352 | } |
@@ -370,16 +366,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
370 | 366 | ||
371 | public void readValue(byte[] data, ref int pointer) | 367 | public void readValue(byte[] data, ref int pointer) |
372 | { | 368 | { |
373 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 369 | namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
374 | typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 370 | typePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
375 | } | 371 | } |
376 | 372 | ||
377 | public override void Print() | 373 | public override void Print() |
378 | { | 374 | { |
379 | Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); | 375 | Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]); |
380 | Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); | 376 | Type = ((PoolUtf8) parent.m_constantsPool[typePointer - 1]); |
381 | Console.Write("Named type: " + namePointer + " , " + typePointer); | 377 | Console.Write("Named type: " + namePointer + " , " + typePointer); |
382 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); | 378 | Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value); |
383 | } | 379 | } |
384 | } | 380 | } |
385 | 381 | ||
@@ -402,23 +398,23 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
402 | 398 | ||
403 | public void AddMethodCode(MethodMemory memory) | 399 | public void AddMethodCode(MethodMemory memory) |
404 | { | 400 | { |
405 | Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); | 401 | Array.Copy(Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, Attributes[0].Code.Length); |
406 | memory.Methodcount++; | 402 | memory.Methodcount++; |
407 | this.CodePointer = memory.NextMethodPC; | 403 | CodePointer = memory.NextMethodPC; |
408 | memory.NextMethodPC += this.Attributes[0].Code.Length; | 404 | memory.NextMethodPC += Attributes[0].Code.Length; |
409 | } | 405 | } |
410 | 406 | ||
411 | public void ReadData(byte[] data, ref int pointer) | 407 | public void ReadData(byte[] data, ref int pointer) |
412 | { | 408 | { |
413 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | 409 | AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
414 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 410 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
415 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 411 | DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
416 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 412 | AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
417 | for (int i = 0; i < AttributeCount; i++) | 413 | for (int i = 0; i < AttributeCount; i++) |
418 | { | 414 | { |
419 | MethodAttribute attri = new MethodAttribute(this.parent); | 415 | MethodAttribute attri = new MethodAttribute(parent); |
420 | attri.ReadData(data, ref pointer); | 416 | attri.ReadData(data, ref pointer); |
421 | this.Attributes.Add(attri); | 417 | Attributes.Add(attri); |
422 | } | 418 | } |
423 | } | 419 | } |
424 | 420 | ||
@@ -426,12 +422,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
426 | { | 422 | { |
427 | Console.WriteLine("Method Info Struct: "); | 423 | Console.WriteLine("Method Info Struct: "); |
428 | Console.WriteLine("AccessFlags: " + AccessFlags); | 424 | Console.WriteLine("AccessFlags: " + AccessFlags); |
429 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 425 | Console.WriteLine("NameIndex: " + NameIndex + " // " + |
430 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); | 426 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); |
427 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + | ||
428 | ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value); | ||
431 | Console.WriteLine("Attribute Count:" + AttributeCount); | 429 | Console.WriteLine("Attribute Count:" + AttributeCount); |
432 | for (int i = 0; i < AttributeCount; i++) | 430 | for (int i = 0; i < AttributeCount; i++) |
433 | { | 431 | { |
434 | this.Attributes[i].Print(); | 432 | Attributes[i].Print(); |
435 | } | 433 | } |
436 | } | 434 | } |
437 | 435 | ||
@@ -457,30 +455,35 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
457 | 455 | ||
458 | public void ReadData(byte[] data, ref int pointer) | 456 | public void ReadData(byte[] data, ref int pointer) |
459 | { | 457 | { |
460 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 458 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
461 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 459 | Length = |
462 | MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); | 460 | (Int32) |
463 | MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); | 461 | ((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++]); | 462 | MaxStack = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
463 | MaxLocals = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
464 | CodeLength = | ||
465 | (Int32) | ||
466 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
465 | Code = new byte[CodeLength]; | 467 | Code = new byte[CodeLength]; |
466 | for (int i = 0; i < CodeLength; i++) | 468 | for (int i = 0; i < CodeLength; i++) |
467 | { | 469 | { |
468 | Code[i] = data[pointer++]; | 470 | Code[i] = data[pointer++]; |
469 | } | 471 | } |
470 | ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); | 472 | ExceptionTableLength = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
471 | SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 473 | SubAttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
472 | for (int i = 0; i < SubAttributeCount; i++) | 474 | for (int i = 0; i < SubAttributeCount; i++) |
473 | { | 475 | { |
474 | SubAttribute subAttri = new SubAttribute(this.parent); | 476 | SubAttribute subAttri = new SubAttribute(parent); |
475 | subAttri.ReadData(data, ref pointer); | 477 | subAttri.ReadData(data, ref pointer); |
476 | this.SubAttributes.Add(subAttri); | 478 | SubAttributes.Add(subAttri); |
477 | } | 479 | } |
478 | } | 480 | } |
479 | 481 | ||
480 | public void Print() | 482 | public void Print() |
481 | { | 483 | { |
482 | Console.WriteLine("Method Attribute: "); | 484 | Console.WriteLine("Method Attribute: "); |
483 | Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 485 | Console.WriteLine("Name Index: " + NameIndex + " // " + |
486 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
484 | Console.WriteLine("Length: " + Length); | 487 | Console.WriteLine("Length: " + Length); |
485 | Console.WriteLine("MaxStack: " + MaxStack); | 488 | Console.WriteLine("MaxStack: " + MaxStack); |
486 | Console.WriteLine("MaxLocals: " + MaxLocals); | 489 | Console.WriteLine("MaxLocals: " + MaxLocals); |
@@ -492,7 +495,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
492 | Console.WriteLine("SubAttributes: " + SubAttributeCount); | 495 | Console.WriteLine("SubAttributes: " + SubAttributeCount); |
493 | for (int i = 0; i < SubAttributeCount; i++) | 496 | for (int i = 0; i < SubAttributeCount; i++) |
494 | { | 497 | { |
495 | this.SubAttributes[i].Print(); | 498 | SubAttributes[i].Print(); |
496 | } | 499 | } |
497 | } | 500 | } |
498 | 501 | ||
@@ -511,8 +514,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
511 | 514 | ||
512 | public void ReadData(byte[] data, ref int pointer) | 515 | public void ReadData(byte[] data, ref int pointer) |
513 | { | 516 | { |
514 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 517 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
515 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 518 | Length = |
519 | (Int32) | ||
520 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + | ||
521 | data[pointer++]); | ||
516 | Data = new byte[Length]; | 522 | Data = new byte[Length]; |
517 | for (int i = 0; i < Length; i++) | 523 | for (int i = 0; i < Length; i++) |
518 | { | 524 | { |
@@ -522,18 +528,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
522 | 528 | ||
523 | public void Print() | 529 | public void Print() |
524 | { | 530 | { |
525 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 531 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + |
532 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
526 | } | 533 | } |
527 | |||
528 | } | 534 | } |
529 | } | 535 | } |
530 | |||
531 | } | 536 | } |
537 | |||
532 | private class InterfaceInfo | 538 | private class InterfaceInfo |
533 | { | 539 | { |
534 | public void ReadData(byte[] data, ref int i) | 540 | public void ReadData(byte[] data, ref int i) |
535 | { | 541 | { |
536 | |||
537 | } | 542 | } |
538 | } | 543 | } |
539 | 544 | ||
@@ -554,15 +559,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
554 | 559 | ||
555 | public void ReadData(byte[] data, ref int pointer) | 560 | public void ReadData(byte[] data, ref int pointer) |
556 | { | 561 | { |
557 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | 562 | AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
558 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 563 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
559 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 564 | DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
560 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 565 | AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
561 | for (int i = 0; i < AttributeCount; i++) | 566 | for (int i = 0; i < AttributeCount; i++) |
562 | { | 567 | { |
563 | FieldAttribute attri = new FieldAttribute(this.parent); | 568 | FieldAttribute attri = new FieldAttribute(parent); |
564 | attri.ReadData(data, ref pointer); | 569 | attri.ReadData(data, ref pointer); |
565 | this.Attributes.Add(attri); | 570 | Attributes.Add(attri); |
566 | } | 571 | } |
567 | } | 572 | } |
568 | 573 | ||
@@ -570,29 +575,30 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
570 | { | 575 | { |
571 | Console.WriteLine("Field Info Struct: "); | 576 | Console.WriteLine("Field Info Struct: "); |
572 | Console.WriteLine("AccessFlags: " + AccessFlags); | 577 | Console.WriteLine("AccessFlags: " + AccessFlags); |
573 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 578 | Console.WriteLine("NameIndex: " + NameIndex + " // " + |
574 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); | 579 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); |
580 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + | ||
581 | ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value); | ||
575 | Console.WriteLine("Attribute Count:" + AttributeCount); | 582 | Console.WriteLine("Attribute Count:" + AttributeCount); |
576 | //if static, add to static field list | 583 | //if static, add to static field list |
577 | // if (this.AccessFlags == 9) //public and static | 584 | // if (this.AccessFlags == 9) //public and static |
578 | if ((this.AccessFlags & 0x08) != 0) | 585 | if ((AccessFlags & 0x08) != 0) |
579 | { | 586 | { |
580 | switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) | 587 | switch (((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value) |
581 | { | 588 | { |
582 | case "I": | 589 | case "I": |
583 | Int newin = new Int(); | 590 | Int newin = new Int(); |
584 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); | 591 | parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newin); |
585 | break; | 592 | break; |
586 | case "F": | 593 | case "F": |
587 | Float newfl = new Float(); | 594 | Float newfl = new Float(); |
588 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); | 595 | parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newfl); |
589 | break; | 596 | break; |
590 | } | 597 | } |
591 | |||
592 | } | 598 | } |
593 | for (int i = 0; i < AttributeCount; i++) | 599 | for (int i = 0; i < AttributeCount; i++) |
594 | { | 600 | { |
595 | this.Attributes[i].Print(); | 601 | Attributes[i].Print(); |
596 | } | 602 | } |
597 | } | 603 | } |
598 | 604 | ||
@@ -611,8 +617,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
611 | 617 | ||
612 | public void ReadData(byte[] data, ref int pointer) | 618 | public void ReadData(byte[] data, ref int pointer) |
613 | { | 619 | { |
614 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 620 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
615 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 621 | Length = |
622 | (Int32) | ||
623 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
616 | Data = new byte[Length]; | 624 | Data = new byte[Length]; |
617 | for (int i = 0; i < Length; i++) | 625 | for (int i = 0; i < Length; i++) |
618 | { | 626 | { |
@@ -622,7 +630,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
622 | 630 | ||
623 | public void Print() | 631 | public void Print() |
624 | { | 632 | { |
625 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 633 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + |
634 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
626 | } | 635 | } |
627 | } | 636 | } |
628 | } | 637 | } |
@@ -631,10 +640,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
631 | { | 640 | { |
632 | public void ReadData(byte[] data, ref int i) | 641 | public void ReadData(byte[] data, ref int i) |
633 | { | 642 | { |
634 | |||
635 | } | 643 | } |
636 | } | 644 | } |
637 | #endregion | ||
638 | 645 | ||
646 | #endregion | ||
639 | } | 647 | } |
640 | } \ No newline at end of file | 648 | } \ 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 c76767a..9876caa 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 30 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 31 | { |
@@ -37,7 +35,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
37 | 35 | ||
38 | public Heap() | 36 | public Heap() |
39 | { | 37 | { |
40 | |||
41 | } | 38 | } |
42 | } | 39 | } |
43 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs index 6b8930e..b172562 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs | |||
@@ -25,9 +25,6 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 28 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 30 | ||
@@ -42,304 +39,313 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
42 | bool result = false; | 39 | bool result = false; |
43 | switch (opcode) | 40 | switch (opcode) |
44 | { | 41 | { |
45 | case (byte)(byte)OpCode.iconst_m1: | 42 | case (byte) (byte) OpCode.iconst_m1: |
46 | Int m_int = new Int(); | 43 | Int m_int = new Int(); |
47 | m_int.mValue = -1; | 44 | m_int.mValue = -1; |
48 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 45 | m_thread.m_currentFrame.OpStack.Push(m_int); |
49 | result = true; | 46 | result = true; |
50 | break; | 47 | break; |
51 | case (byte)(byte)OpCode.iconst_0: | 48 | case (byte) (byte) OpCode.iconst_0: |
52 | m_int = new Int(); | 49 | m_int = new Int(); |
53 | m_int.mValue = 0; | 50 | m_int.mValue = 0; |
54 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 51 | m_thread.m_currentFrame.OpStack.Push(m_int); |
55 | result = true; | 52 | result = true; |
56 | break; | 53 | break; |
57 | case (byte)(byte)OpCode.iconst_1: | 54 | case (byte) (byte) OpCode.iconst_1: |
58 | m_int = new Int(); | 55 | m_int = new Int(); |
59 | m_int.mValue = 1; | 56 | m_int.mValue = 1; |
60 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 57 | m_thread.m_currentFrame.OpStack.Push(m_int); |
61 | result = true; | 58 | result = true; |
62 | break; | 59 | break; |
63 | case (byte)(byte)OpCode.iconst_2: | 60 | case (byte) (byte) OpCode.iconst_2: |
64 | m_int = new Int(); | 61 | m_int = new Int(); |
65 | m_int.mValue = 2; | 62 | m_int.mValue = 2; |
66 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 63 | m_thread.m_currentFrame.OpStack.Push(m_int); |
67 | result = true; | 64 | result = true; |
68 | break; | 65 | break; |
69 | case (byte)(byte)OpCode.iconst_3: | 66 | case (byte) (byte) OpCode.iconst_3: |
70 | m_int = new Int(); | 67 | m_int = new Int(); |
71 | m_int.mValue = 3; | 68 | m_int.mValue = 3; |
72 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 69 | m_thread.m_currentFrame.OpStack.Push(m_int); |
73 | break; | 70 | break; |
74 | case (byte)(byte)OpCode.iconst_4: | 71 | case (byte) (byte) OpCode.iconst_4: |
75 | m_int = new Int(); | 72 | m_int = new Int(); |
76 | m_int.mValue = 4; | 73 | m_int.mValue = 4; |
77 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 74 | m_thread.m_currentFrame.OpStack.Push(m_int); |
78 | result = true; | 75 | result = true; |
79 | break; | 76 | break; |
80 | case (byte)OpCode.iconst_5: | 77 | case (byte) OpCode.iconst_5: |
81 | m_int = new Int(); | 78 | m_int = new Int(); |
82 | m_int.mValue = 5; | 79 | m_int.mValue = 5; |
83 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 80 | m_thread.m_currentFrame.OpStack.Push(m_int); |
84 | result = true; | 81 | result = true; |
85 | break; | 82 | break; |
86 | case (byte)OpCode.fconst_0: | 83 | case (byte) OpCode.fconst_0: |
87 | Float m_float = new Float(); | 84 | Float m_float = new Float(); |
88 | m_float.mValue = 0.0f; | 85 | m_float.mValue = 0.0f; |
89 | this.m_thread.m_currentFrame.OpStack.Push(m_float); | 86 | m_thread.m_currentFrame.OpStack.Push(m_float); |
90 | result = true; | 87 | result = true; |
91 | break; | 88 | break; |
92 | case (byte)OpCode.fconst_1: | 89 | case (byte) OpCode.fconst_1: |
93 | m_float = new Float(); | 90 | m_float = new Float(); |
94 | m_float.mValue = 1.0f; | 91 | m_float.mValue = 1.0f; |
95 | this.m_thread.m_currentFrame.OpStack.Push(m_float); | 92 | m_thread.m_currentFrame.OpStack.Push(m_float); |
96 | result = true; | 93 | result = true; |
97 | break; | 94 | break; |
98 | case (byte)OpCode.fconst_2: | 95 | case (byte) OpCode.fconst_2: |
99 | m_float = new Float(); | 96 | m_float = new Float(); |
100 | m_float.mValue = 2.0f; | 97 | m_float.mValue = 2.0f; |
101 | this.m_thread.m_currentFrame.OpStack.Push(m_float); | 98 | m_thread.m_currentFrame.OpStack.Push(m_float); |
102 | result = true; | 99 | result = true; |
103 | break; | 100 | break; |
104 | case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? | 101 | 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]; | 102 | int pushvalue = (int) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]; |
106 | Int pushInt = new Int(); | 103 | Int pushInt = new Int(); |
107 | pushInt.mValue = pushvalue; | 104 | pushInt.mValue = pushvalue; |
108 | this.m_thread.m_currentFrame.OpStack.Push(pushInt); | 105 | m_thread.m_currentFrame.OpStack.Push(pushInt); |
109 | this.m_thread.PC++; | 106 | m_thread.PC++; |
110 | result = true; | 107 | result = true; |
111 | break; | 108 | break; |
112 | case (byte)OpCode.sipush: | 109 | case (byte) OpCode.sipush: |
113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 110 | short pushvalue2 = |
111 | (short) | ||
112 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
113 | GlobalMemory.MethodArea.MethodBuffer[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 | m_thread.m_currentFrame.OpStack.Push(pushInt2); |
117 | this.m_thread.PC += 2; | 117 | 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[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 (m_thread.m_currentFrame.LocalVariables[findex1] != null) |
124 | { | 124 | { |
125 | if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) | 125 | if (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) m_thread.m_currentFrame.LocalVariables[findex1]).mValue; |
128 | this.m_thread.m_currentFrame.OpStack.Push(fload); | 128 | m_thread.m_currentFrame.OpStack.Push(fload); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | this.m_thread.PC++; | 131 | 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 (m_thread.m_currentFrame.LocalVariables[0] != null) |
136 | { | 136 | { |
137 | if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) | 137 | if (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) m_thread.m_currentFrame.LocalVariables[0]).mValue; |
141 | this.m_thread.m_currentFrame.OpStack.Push(newInt); | 141 | 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 (m_thread.m_currentFrame.LocalVariables[1] != null) |
148 | { | 148 | { |
149 | if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) | 149 | if (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) m_thread.m_currentFrame.LocalVariables[1]).mValue; |
153 | this.m_thread.m_currentFrame.OpStack.Push(newInt); | 153 | 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 (m_thread.m_currentFrame.LocalVariables[0] != null) |
160 | { | 160 | { |
161 | if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) | 161 | if (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) m_thread.m_currentFrame.LocalVariables[0]).mValue; |
165 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 165 | 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 (m_thread.m_currentFrame.LocalVariables[1] != null) |
172 | { | 172 | { |
173 | if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) | 173 | if (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) m_thread.m_currentFrame.LocalVariables[1]).mValue; |
177 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 177 | 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 (m_thread.m_currentFrame.LocalVariables[2] != null) |
184 | { | 184 | { |
185 | if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) | 185 | if (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) m_thread.m_currentFrame.LocalVariables[2]).mValue; |
189 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 189 | 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 (m_thread.m_currentFrame.LocalVariables[3] != null) |
196 | { | 196 | { |
197 | if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) | 197 | if (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) m_thread.m_currentFrame.LocalVariables[3]).mValue; |
201 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 201 | 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[m_thread.PC])); |
208 | BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); | 208 | BaseType istor = 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 | m_thread.m_currentFrame.LocalVariables[findex3] = (Int) istor; |
212 | } | 212 | } |
213 | this.m_thread.PC++; | 213 | 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[m_thread.PC])); |
218 | BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); | 218 | BaseType fstor = 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 | m_thread.m_currentFrame.LocalVariables[findex] = (Float) fstor; |
222 | } | 222 | } |
223 | this.m_thread.PC++; | 223 | 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 = 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 | 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 = 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 | 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 = 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 | 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 = 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 | 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 = 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 | 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 = 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 | 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 | 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 = m_thread.m_currentFrame.OpStack.Pop(); |
280 | BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 280 | BaseType bf1 = 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 | 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 = m_thread.m_currentFrame.OpStack.Pop(); |
291 | BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 291 | BaseType bsf1 = 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 | 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 = m_thread.m_currentFrame.OpStack.Pop(); |
302 | BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 302 | BaseType bs1 = 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 | 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 (m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]] != |
313 | null) | ||
313 | { | 314 | { |
314 | if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) | 315 | if ( |
316 | m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] | ||
317 | ] is Int) | ||
315 | { | 318 | { |
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]; | 319 | ((Int) |
320 | m_thread.m_currentFrame.LocalVariables[ | ||
321 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]]).mValue += | ||
322 | (sbyte) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]; | ||
317 | } | 323 | } |
318 | } | 324 | } |
319 | this.m_thread.PC += 2; | 325 | m_thread.PC += 2; |
320 | result = true; | 326 | result = true; |
321 | break; | 327 | break; |
322 | case (byte)OpCode.f2i: | 328 | case (byte) OpCode.f2i: |
323 | BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 329 | BaseType conv1 = m_thread.m_currentFrame.OpStack.Pop(); |
324 | if (conv1 is Float) | 330 | if (conv1 is Float) |
325 | { | 331 | { |
326 | Int newconv = new Int(); | 332 | Int newconv = new Int(); |
327 | newconv.mValue = (int)((Float)conv1).mValue; | 333 | newconv.mValue = (int) ((Float) conv1).mValue; |
328 | this.m_thread.m_currentFrame.OpStack.Push(newconv); | 334 | m_thread.m_currentFrame.OpStack.Push(newconv); |
329 | } | 335 | } |
330 | result = true; | 336 | result = true; |
331 | break; | 337 | break; |
332 | case (byte)OpCode.fcmpl: | 338 | case (byte) OpCode.fcmpl: |
333 | BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 339 | BaseType flcom2 = m_thread.m_currentFrame.OpStack.Pop(); |
334 | BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 340 | BaseType flcom1 = m_thread.m_currentFrame.OpStack.Pop(); |
335 | if (flcom1 is Float && flcom2 is Float) | 341 | if (flcom1 is Float && flcom2 is Float) |
336 | { | 342 | { |
337 | Int compres = new Int(); | 343 | Int compres = new Int(); |
338 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | 344 | if (((Float) flcom1).mValue < ((Float) flcom2).mValue) |
339 | { | 345 | { |
340 | compres.mValue = -1; | 346 | compres.mValue = -1; |
341 | } | 347 | } |
342 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | 348 | else if (((Float) flcom1).mValue > ((Float) flcom2).mValue) |
343 | { | 349 | { |
344 | compres.mValue = 1; | 350 | compres.mValue = 1; |
345 | } | 351 | } |
@@ -347,21 +353,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
347 | { | 353 | { |
348 | compres.mValue = 0; | 354 | compres.mValue = 0; |
349 | } | 355 | } |
350 | this.m_thread.m_currentFrame.OpStack.Push(compres); | 356 | m_thread.m_currentFrame.OpStack.Push(compres); |
351 | } | 357 | } |
352 | result = true; | 358 | result = true; |
353 | break; | 359 | break; |
354 | case (byte)OpCode.fcmpg: | 360 | case (byte) OpCode.fcmpg: |
355 | flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 361 | flcom2 = m_thread.m_currentFrame.OpStack.Pop(); |
356 | flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 362 | flcom1 = m_thread.m_currentFrame.OpStack.Pop(); |
357 | if (flcom1 is Float && flcom2 is Float) | 363 | if (flcom1 is Float && flcom2 is Float) |
358 | { | 364 | { |
359 | Int compres = new Int(); | 365 | Int compres = new Int(); |
360 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | 366 | if (((Float) flcom1).mValue < ((Float) flcom2).mValue) |
361 | { | 367 | { |
362 | compres.mValue = -1; | 368 | compres.mValue = -1; |
363 | } | 369 | } |
364 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | 370 | else if (((Float) flcom1).mValue > ((Float) flcom2).mValue) |
365 | { | 371 | { |
366 | compres.mValue = 1; | 372 | compres.mValue = 1; |
367 | } | 373 | } |
@@ -369,128 +375,169 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
369 | { | 375 | { |
370 | compres.mValue = 0; | 376 | compres.mValue = 0; |
371 | } | 377 | } |
372 | this.m_thread.m_currentFrame.OpStack.Push(compres); | 378 | m_thread.m_currentFrame.OpStack.Push(compres); |
373 | } | 379 | } |
374 | result = true; | 380 | result = true; |
375 | break; | 381 | break; |
376 | case (byte)OpCode.ifge: | 382 | case (byte) OpCode.ifge: |
377 | short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 383 | short compareoffset2 = |
378 | BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 384 | (short) |
385 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
386 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
387 | BaseType compe1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
379 | if (compe1 is Int) | 388 | if (compe1 is Int) |
380 | { | 389 | { |
381 | if (((Int)compe1).mValue >= 0) | 390 | if (((Int) compe1).mValue >= 0) |
382 | { | 391 | { |
383 | this.m_thread.PC += -1 + compareoffset2; | 392 | m_thread.PC += -1 + compareoffset2; |
384 | } | 393 | } |
385 | else | 394 | else |
386 | { | 395 | { |
387 | this.m_thread.PC += 2; | 396 | m_thread.PC += 2; |
388 | } | 397 | } |
389 | } | 398 | } |
390 | else | 399 | else |
391 | { | 400 | { |
392 | this.m_thread.PC += 2; | 401 | m_thread.PC += 2; |
393 | } | 402 | } |
394 | result = true; | 403 | result = true; |
395 | break; | 404 | break; |
396 | case (byte)OpCode.ifle: | 405 | case (byte) OpCode.ifle: |
397 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 406 | short compareoffset1 = |
398 | BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 407 | (short) |
408 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
409 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
410 | BaseType comp1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
399 | if (comp1 is Int) | 411 | if (comp1 is Int) |
400 | { | 412 | { |
401 | if (((Int)comp1).mValue <= 0) | 413 | if (((Int) comp1).mValue <= 0) |
402 | { | 414 | { |
403 | this.m_thread.PC += -1 + compareoffset1; | 415 | m_thread.PC += -1 + compareoffset1; |
404 | } | 416 | } |
405 | else | 417 | else |
406 | { | 418 | { |
407 | this.m_thread.PC += 2; | 419 | m_thread.PC += 2; |
408 | } | 420 | } |
409 | } | 421 | } |
410 | else | 422 | else |
411 | { | 423 | { |
412 | this.m_thread.PC += 2; | 424 | m_thread.PC += 2; |
413 | } | 425 | } |
414 | result = true; | 426 | result = true; |
415 | break; | 427 | break; |
416 | case (byte)OpCode.if_icmpge: | 428 | 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]); | 429 | short compareoffset = |
418 | BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 430 | (short) |
419 | BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 431 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + |
432 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
433 | BaseType bc2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
434 | BaseType bc1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
420 | if (bc1 is Int && bc2 is Int) | 435 | if (bc1 is Int && bc2 is Int) |
421 | { | 436 | { |
422 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | 437 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); |
423 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) | 438 | if (((Int) bc1).mValue >= ((Int) bc2).mValue) |
424 | { | 439 | { |
425 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | 440 | // Console.WriteLine("branch compare true , offset is " +compareoffset); |
426 | // Console.WriteLine("current PC is " + this._mThread.PC); | 441 | // Console.WriteLine("current PC is " + this._mThread.PC); |
427 | this.m_thread.PC += -1 + compareoffset; | 442 | m_thread.PC += -1 + compareoffset; |
428 | //Console.WriteLine("new PC is " + this._mThread.PC); | 443 | //Console.WriteLine("new PC is " + this._mThread.PC); |
429 | } | 444 | } |
430 | else | 445 | else |
431 | { | 446 | { |
432 | //Console.WriteLine("branch compare false"); | 447 | //Console.WriteLine("branch compare false"); |
433 | this.m_thread.PC += 2; | 448 | m_thread.PC += 2; |
434 | } | 449 | } |
435 | } | 450 | } |
436 | else | 451 | else |
437 | { | 452 | { |
438 | this.m_thread.PC += 2; | 453 | m_thread.PC += 2; |
439 | } | 454 | } |
440 | result = true; | 455 | result = true; |
441 | break; | 456 | break; |
442 | case (byte)OpCode.if_icmple: | 457 | 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]); | 458 | short compareloffset = |
444 | BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 459 | (short) |
445 | BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 460 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + |
461 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
462 | BaseType bcl2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
463 | BaseType bcl1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
446 | if (bcl1 is Int && bcl2 is Int) | 464 | if (bcl1 is Int && bcl2 is Int) |
447 | { | 465 | { |
448 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | 466 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); |
449 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) | 467 | if (((Int) bcl1).mValue <= ((Int) bcl2).mValue) |
450 | { | 468 | { |
451 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | 469 | // Console.WriteLine("branch compare true , offset is " + compareloffset); |
452 | // Console.WriteLine("current PC is " + this._mThread.PC); | 470 | // Console.WriteLine("current PC is " + this._mThread.PC); |
453 | this.m_thread.PC += -1 + compareloffset; | 471 | m_thread.PC += -1 + compareloffset; |
454 | // Console.WriteLine("new PC is " + this._mThread.PC); | 472 | // Console.WriteLine("new PC is " + this._mThread.PC); |
455 | } | 473 | } |
456 | else | 474 | else |
457 | { | 475 | { |
458 | //Console.WriteLine("branch compare false"); | 476 | //Console.WriteLine("branch compare false"); |
459 | this.m_thread.PC += 2; | 477 | m_thread.PC += 2; |
460 | } | 478 | } |
461 | } | 479 | } |
462 | else | 480 | else |
463 | { | 481 | { |
464 | this.m_thread.PC += 2; | 482 | m_thread.PC += 2; |
465 | } | 483 | } |
466 | result = true; | 484 | result = true; |
467 | break; | 485 | break; |
468 | case (byte)OpCode._goto: | 486 | case (byte) OpCode._goto: |
469 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 487 | short offset = |
470 | this.m_thread.PC += -1 + offset; | 488 | (short) |
489 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
490 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
491 | m_thread.PC += -1 + offset; | ||
471 | result = true; | 492 | result = true; |
472 | break; | 493 | break; |
473 | case (byte)OpCode.getstatic: | 494 | case (byte) OpCode.getstatic: |
474 | short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 495 | short fieldrefIndex = |
475 | if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | 496 | (short) |
497 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
498 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
499 | if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | ||
476 | { | 500 | { |
477 | if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) | 501 | if ( |
502 | ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). | ||
503 | mClass.Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
478 | { | 504 | { |
479 | //from this class | 505 | //from this class |
480 | if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | 506 | if ( |
507 | m_thread.currentClass.StaticFields.ContainsKey( | ||
508 | ((ClassRecord.PoolFieldRef) | ||
509 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | ||
481 | { | 510 | { |
482 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) | 511 | if ( |
512 | m_thread.currentClass.StaticFields[ | ||
513 | ((ClassRecord.PoolFieldRef) | ||
514 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name. | ||
515 | Value] is Float) | ||
483 | { | 516 | { |
484 | Float retFloat = new Float(); | 517 | 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; | 518 | retFloat.mValue = |
486 | this.m_thread.m_currentFrame.OpStack.Push(retFloat); | 519 | ((Float) |
520 | m_thread.currentClass.StaticFields[ | ||
521 | ((ClassRecord.PoolFieldRef) | ||
522 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
523 | Name.Value]).mValue; | ||
524 | m_thread.m_currentFrame.OpStack.Push(retFloat); | ||
487 | } | 525 | } |
488 | else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) | 526 | else if ( |
527 | m_thread.currentClass.StaticFields[ | ||
528 | ((ClassRecord.PoolFieldRef) | ||
529 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
530 | Name.Value] is Int) | ||
489 | { | 531 | { |
490 | Int retInt = new Int(); | 532 | 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; | 533 | retInt.mValue = |
534 | ((Int) | ||
535 | m_thread.currentClass.StaticFields[ | ||
536 | ((ClassRecord.PoolFieldRef) | ||
537 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). | ||
538 | mNameType.Name.Value]).mValue; | ||
492 | // Console.WriteLine("getting static field, " + retInt.mValue); | 539 | // Console.WriteLine("getting static field, " + retInt.mValue); |
493 | this.m_thread.m_currentFrame.OpStack.Push(retInt); | 540 | m_thread.m_currentFrame.OpStack.Push(retInt); |
494 | } | 541 | } |
495 | } | 542 | } |
496 | } | 543 | } |
@@ -499,36 +546,58 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
499 | //get from a different class | 546 | //get from a different class |
500 | } | 547 | } |
501 | } | 548 | } |
502 | this.m_thread.PC += 2; | 549 | m_thread.PC += 2; |
503 | result = true; | 550 | result = true; |
504 | break; | 551 | break; |
505 | case (byte)OpCode.putstatic: | 552 | case (byte) OpCode.putstatic: |
506 | fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 553 | fieldrefIndex = |
507 | BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); | 554 | (short) |
508 | if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | 555 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + |
556 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
557 | BaseType addstatic = m_thread.m_currentFrame.OpStack.Pop(); | ||
558 | if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | ||
509 | { | 559 | { |
510 | if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) | 560 | if ( |
561 | ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). | ||
562 | mClass.Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
511 | { | 563 | { |
512 | // this class | 564 | // this class |
513 | if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | 565 | if ( |
566 | m_thread.currentClass.StaticFields.ContainsKey( | ||
567 | ((ClassRecord.PoolFieldRef) | ||
568 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | ||
514 | { | 569 | { |
515 | if (addstatic is Float) | 570 | if (addstatic is Float) |
516 | { | 571 | { |
517 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) | 572 | if ( |
573 | m_thread.currentClass.StaticFields[ | ||
574 | ((ClassRecord.PoolFieldRef) | ||
575 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
576 | Name.Value] is Float) | ||
518 | { | 577 | { |
519 | Float newf = new Float(); | 578 | Float newf = new Float(); |
520 | newf.mValue = ((Float)addstatic).mValue; | 579 | 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; | 580 | m_thread.currentClass.StaticFields[ |
581 | ((ClassRecord.PoolFieldRef) | ||
582 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
583 | Name.Value] = newf; | ||
522 | } | 584 | } |
523 | } | 585 | } |
524 | else if (addstatic is Int) | 586 | else if (addstatic is Int) |
525 | { | 587 | { |
526 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) | 588 | if ( |
589 | m_thread.currentClass.StaticFields[ | ||
590 | ((ClassRecord.PoolFieldRef) | ||
591 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
592 | Name.Value] is Int) | ||
527 | { | 593 | { |
528 | //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); | 594 | //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); |
529 | Int newi = new Int(); | 595 | Int newi = new Int(); |
530 | newi.mValue = ((Int)addstatic).mValue; | 596 | 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; | 597 | m_thread.currentClass.StaticFields[ |
598 | ((ClassRecord.PoolFieldRef) | ||
599 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
600 | Name.Value] = newi; | ||
532 | } | 601 | } |
533 | } | 602 | } |
534 | } | 603 | } |
@@ -538,10 +607,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
538 | // a different class | 607 | // a different class |
539 | } | 608 | } |
540 | } | 609 | } |
541 | this.m_thread.PC += 2; | 610 | m_thread.PC += 2; |
542 | result = true; | 611 | result = true; |
543 | break; | 612 | break; |
544 | |||
545 | } | 613 | } |
546 | 614 | ||
547 | return result; | 615 | return result; |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs index a5bd48b..b27630a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs | |||
@@ -25,15 +25,6 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | ||
36 | |||
37 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
38 | { | 29 | { |
39 | partial class Thread | 30 | partial class Thread |
@@ -46,10 +37,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
46 | switch (opcode) | 37 | switch (opcode) |
47 | { | 38 | { |
48 | case 184: | 39 | case 184: |
49 | short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); | 40 | short refIndex = |
50 | if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | 41 | (short) |
42 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
43 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
44 | if (m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | ||
51 | { | 45 | { |
52 | string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; | 46 | string typ = |
47 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]). | ||
48 | mNameType.Type.Value; | ||
53 | string typeparam = ""; | 49 | string typeparam = ""; |
54 | string typereturn = ""; | 50 | string typereturn = ""; |
55 | int firstbrak = 0; | 51 | int firstbrak = 0; |
@@ -58,16 +54,22 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
58 | secondbrak = typ.LastIndexOf(')'); | 54 | secondbrak = typ.LastIndexOf(')'); |
59 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); | 55 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); |
60 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); | 56 | 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) | 57 | if ( |
58 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass | ||
59 | .Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
62 | { | 60 | { |
63 | //calling a method in this class | 61 | //calling a method in this class |
64 | if (typeparam.Length == 0) | 62 | if (typeparam.Length == 0) |
65 | { | 63 | { |
66 | this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); | 64 | m_thread.JumpToStaticVoidMethod( |
65 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
66 | .mNameType.Name.Value, (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 | m_thread.JumpToStaticParamMethod( |
71 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
72 | .mNameType.Name.Value, typeparam, (m_thread.PC + 2)); | ||
71 | } | 73 | } |
72 | } | 74 | } |
73 | else | 75 | else |
@@ -75,15 +77,19 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
75 | //calling a method of a different class | 77 | //calling a method of a different class |
76 | 78 | ||
77 | // OpenSimAPI Class | 79 | // OpenSimAPI Class |
78 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") | 80 | if ( |
81 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]). | ||
82 | mClass.Name.Value == "OpenSimAPI") | ||
79 | { | 83 | { |
80 | this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); | 84 | m_thread.scriptInfo.api.CallMethod( |
85 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
86 | .mNameType.Name.Value, null); | ||
81 | } | 87 | } |
82 | } | 88 | } |
83 | } | 89 | } |
84 | else | 90 | else |
85 | { | 91 | { |
86 | this.m_thread.PC += 2; | 92 | m_thread.PC += 2; |
87 | } | 93 | } |
88 | result = true; | 94 | result = true; |
89 | break; | 95 | break; |
@@ -93,4 +99,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
93 | } | 99 | } |
94 | } | 100 | } |
95 | } | 101 | } |
96 | } | 102 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs index 5a42285..2814720 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs | |||
@@ -25,10 +25,6 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 29 | { |
34 | partial class Thread | 30 | partial class Thread |
@@ -37,4 +33,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
37 | { | 33 | { |
38 | } | 34 | } |
39 | } | 35 | } |
40 | } | 36 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs index 698a518..4e7351e 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs | |||
@@ -26,8 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 30 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 31 | ||
@@ -47,77 +45,77 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
47 | public bool Excute() | 45 | public bool Excute() |
48 | { | 46 | { |
49 | bool run = true; | 47 | bool run = true; |
50 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; | 48 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[m_thread.PC++]; |
51 | // Console.WriteLine("opCode is: " + currentOpCode); | 49 | // Console.WriteLine("opCode is: " + currentOpCode); |
52 | bool handled = false; | 50 | bool handled = false; |
53 | 51 | ||
54 | handled = this.IsLogicOpCode(currentOpCode); | 52 | handled = IsLogicOpCode(currentOpCode); |
55 | if (!handled) | 53 | if (!handled) |
56 | { | 54 | { |
57 | handled = this.IsMethodOpCode(currentOpCode); | 55 | handled = IsMethodOpCode(currentOpCode); |
58 | } | 56 | } |
59 | if (!handled) | 57 | if (!handled) |
60 | { | 58 | { |
61 | if (currentOpCode == 172) | 59 | if (currentOpCode == 172) |
62 | { | 60 | { |
63 | if (this.m_thread.stack.StackFrames.Count > 1) | 61 | if (m_thread.stack.StackFrames.Count > 1) |
64 | { | 62 | { |
65 | Console.WriteLine("returning int from function"); | 63 | Console.WriteLine("returning int from function"); |
66 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; | 64 | int retPC1 = m_thread.m_currentFrame.ReturnPC; |
67 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 65 | BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop(); |
68 | this.m_thread.stack.StackFrames.Pop(); | 66 | m_thread.stack.StackFrames.Pop(); |
69 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 67 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); |
70 | this.m_thread.PC = retPC1; | 68 | m_thread.PC = retPC1; |
71 | if (bas1 is Int) | 69 | if (bas1 is Int) |
72 | { | 70 | { |
73 | this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); | 71 | m_thread.m_currentFrame.OpStack.Push((Int) bas1); |
74 | } | 72 | } |
75 | } | 73 | } |
76 | else | 74 | else |
77 | { | 75 | { |
78 | // Console.WriteLine("No parent function so ending program"); | 76 | // Console.WriteLine("No parent function so ending program"); |
79 | this.m_thread.stack.StackFrames.Pop(); | 77 | m_thread.stack.StackFrames.Pop(); |
80 | run = false; | 78 | run = false; |
81 | } | 79 | } |
82 | handled = true; | 80 | handled = true; |
83 | } | 81 | } |
84 | if (currentOpCode == 174) | 82 | if (currentOpCode == 174) |
85 | { | 83 | { |
86 | if (this.m_thread.stack.StackFrames.Count > 1) | 84 | if (m_thread.stack.StackFrames.Count > 1) |
87 | { | 85 | { |
88 | Console.WriteLine("returning float from function"); | 86 | Console.WriteLine("returning float from function"); |
89 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; | 87 | int retPC1 = m_thread.m_currentFrame.ReturnPC; |
90 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 88 | BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop(); |
91 | this.m_thread.stack.StackFrames.Pop(); | 89 | m_thread.stack.StackFrames.Pop(); |
92 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 90 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); |
93 | this.m_thread.PC = retPC1; | 91 | m_thread.PC = retPC1; |
94 | if (bas1 is Float) | 92 | if (bas1 is Float) |
95 | { | 93 | { |
96 | this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); | 94 | m_thread.m_currentFrame.OpStack.Push((Float) bas1); |
97 | } | 95 | } |
98 | } | 96 | } |
99 | else | 97 | else |
100 | { | 98 | { |
101 | // Console.WriteLine("No parent function so ending program"); | 99 | // Console.WriteLine("No parent function so ending program"); |
102 | this.m_thread.stack.StackFrames.Pop(); | 100 | m_thread.stack.StackFrames.Pop(); |
103 | run = false; | 101 | run = false; |
104 | } | 102 | } |
105 | handled = true; | 103 | handled = true; |
106 | } | 104 | } |
107 | if (currentOpCode == 177) | 105 | if (currentOpCode == 177) |
108 | { | 106 | { |
109 | if (this.m_thread.stack.StackFrames.Count > 1) | 107 | if (m_thread.stack.StackFrames.Count > 1) |
110 | { | 108 | { |
111 | Console.WriteLine("returning from function"); | 109 | Console.WriteLine("returning from function"); |
112 | int retPC = this.m_thread.m_currentFrame.ReturnPC; | 110 | int retPC = m_thread.m_currentFrame.ReturnPC; |
113 | this.m_thread.stack.StackFrames.Pop(); | 111 | m_thread.stack.StackFrames.Pop(); |
114 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 112 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); |
115 | this.m_thread.PC = retPC; | 113 | m_thread.PC = retPC; |
116 | } | 114 | } |
117 | else | 115 | else |
118 | { | 116 | { |
119 | // Console.WriteLine("No parent function so ending program"); | 117 | // Console.WriteLine("No parent function so ending program"); |
120 | this.m_thread.stack.StackFrames.Pop(); | 118 | m_thread.stack.StackFrames.Pop(); |
121 | run = false; | 119 | run = false; |
122 | } | 120 | } |
123 | handled = true; | 121 | handled = true; |
@@ -128,8 +126,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
128 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); | 126 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); |
129 | } | 127 | } |
130 | return run; | 128 | return run; |
131 | |||
132 | } | 129 | } |
133 | } | 130 | } |
134 | } | 131 | } |
135 | } | 132 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs index 34d4fc5..adad1a8 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs | |||
@@ -25,21 +25,17 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 29 | { |
34 | public class MainMemory | 30 | public class MainMemory |
35 | { | 31 | { |
36 | public Heap HeapArea; | 32 | public Heap HeapArea; |
37 | public MethodMemory MethodArea; | 33 | public MethodMemory MethodArea; |
38 | 34 | ||
39 | public MainMemory() | 35 | public MainMemory() |
40 | { | 36 | { |
41 | MethodArea = new MethodMemory(); | 37 | MethodArea = new MethodMemory(); |
42 | HeapArea = new Heap(); | 38 | HeapArea = new Heap(); |
43 | } | 39 | } |
44 | } | 40 | } |
45 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs index f470583..86df4c2 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 30 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 31 | { |
@@ -43,4 +41,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
43 | MethodBuffer = new byte[20000]; | 41 | MethodBuffer = new byte[20000]; |
44 | } | 42 | } |
45 | } | 43 | } |
46 | } | 44 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs index 21e467a..1d9cabb 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs | |||
@@ -25,13 +25,9 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 29 | { |
34 | public class Object | 30 | public class Object |
35 | { | 31 | { |
36 | } | 32 | } |
37 | } | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs index 9fcec49..616b64e 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
34 | { | 30 | { |
35 | public enum OpCode : byte | 31 | public enum OpCode : byte |
@@ -81,4 +77,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
81 | getstatic = 178, | 77 | getstatic = 178, |
82 | putstatic = 179 | 78 | putstatic = 179 |
83 | } | 79 | } |
84 | } | 80 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs index 56e02ff..4f6c1e7 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 30 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 31 | { |
@@ -39,4 +37,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
39 | { | 37 | { |
40 | } | 38 | } |
41 | } | 39 | } |
42 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs index a5f9029..306a70d 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 30 | ||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 31 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
@@ -44,6 +42,5 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
44 | { | 42 | { |
45 | LocalVariables = new BaseType[20]; | 43 | LocalVariables = new BaseType[20]; |
46 | } | 44 | } |
47 | |||
48 | } | 45 | } |
49 | } | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs index b810676..64093ef 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs | |||
@@ -25,15 +25,9 @@ | |||
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 OpenSim.Region.Environment.Scenes; |
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 30 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Region.Environment.Scenes; | ||
36 | using OpenSim.Region.ExtensionsScriptModule; | ||
37 | 31 | ||
38 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
39 | { | 33 | { |
@@ -55,8 +49,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
55 | 49 | ||
56 | public Thread() | 50 | public Thread() |
57 | { | 51 | { |
58 | this.m_Interpreter = new Interpreter(this); | 52 | m_Interpreter = new Interpreter(this); |
59 | this.stack = new Stack(); | 53 | stack = new Stack(); |
60 | } | 54 | } |
61 | 55 | ||
62 | public void SetPC(int methodpointer) | 56 | public void SetPC(int methodpointer) |
@@ -68,15 +62,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
68 | public void StartMethod(ClassRecord rec, string methName) | 62 | public void StartMethod(ClassRecord rec, string methName) |
69 | { | 63 | { |
70 | m_currentFrame = new StackFrame(); | 64 | m_currentFrame = new StackFrame(); |
71 | this.stack.StackFrames.Push(m_currentFrame); | 65 | stack.StackFrames.Push(m_currentFrame); |
72 | this.currentClass = rec; | 66 | currentClass = rec; |
73 | currentClass.StartMethod(this, methName); | 67 | currentClass.StartMethod(this, methName); |
74 | } | 68 | } |
75 | 69 | ||
76 | public void StartMethod( string methName) | 70 | public void StartMethod(string methName) |
77 | { | 71 | { |
78 | m_currentFrame = new StackFrame(); | 72 | m_currentFrame = new StackFrame(); |
79 | this.stack.StackFrames.Push(m_currentFrame); | 73 | stack.StackFrames.Push(m_currentFrame); |
80 | currentClass.StartMethod(this, methName); | 74 | currentClass.StartMethod(this, methName); |
81 | } | 75 | } |
82 | 76 | ||
@@ -84,7 +78,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
84 | { | 78 | { |
85 | m_currentFrame = new StackFrame(); | 79 | m_currentFrame = new StackFrame(); |
86 | m_currentFrame.ReturnPC = returnPC; | 80 | m_currentFrame.ReturnPC = returnPC; |
87 | this.stack.StackFrames.Push(m_currentFrame); | 81 | stack.StackFrames.Push(m_currentFrame); |
88 | currentClass.StartMethod(this, methName); | 82 | currentClass.StartMethod(this, methName); |
89 | } | 83 | } |
90 | 84 | ||
@@ -95,25 +89,23 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
95 | BaseType bs1 = m_currentFrame.OpStack.Pop(); | 89 | BaseType bs1 = m_currentFrame.OpStack.Pop(); |
96 | m_currentFrame = new StackFrame(); | 90 | m_currentFrame = new StackFrame(); |
97 | m_currentFrame.ReturnPC = returnPC; | 91 | m_currentFrame.ReturnPC = returnPC; |
98 | this.stack.StackFrames.Push(m_currentFrame); | 92 | stack.StackFrames.Push(m_currentFrame); |
99 | m_currentFrame.LocalVariables[0] = ((Int)bs1); | 93 | m_currentFrame.LocalVariables[0] = ((Int) bs1); |
100 | currentClass.StartMethod(this, methName); | 94 | currentClass.StartMethod(this, methName); |
101 | } | 95 | } |
102 | if (param == "F") | 96 | if (param == "F") |
103 | { | 97 | { |
104 | |||
105 | } | 98 | } |
106 | } | 99 | } |
107 | 100 | ||
108 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) | 101 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) |
109 | { | 102 | { |
110 | |||
111 | } | 103 | } |
112 | 104 | ||
113 | public bool Excute() | 105 | public bool Excute() |
114 | { | 106 | { |
115 | excutionCounter++; | 107 | excutionCounter++; |
116 | return this.m_Interpreter.Excute(); | 108 | return m_Interpreter.Excute(); |
117 | } | 109 | } |
118 | } | 110 | } |
119 | } | 111 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs index 0f0ff16..ea99626 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs | |||
@@ -26,11 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | |||
33 | using OpenSim.Region.ExtensionsScriptModule; | ||
34 | 30 | ||
35 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 31 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine |
36 | { | 32 | { |
@@ -53,4 +49,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
53 | return returns; | 49 | return returns; |
54 | } | 50 | } |
55 | } | 51 | } |
56 | } | 52 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs index b1258f6..274932a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs | |||
@@ -27,15 +27,11 @@ | |||
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.Diagnostics; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Threading; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
36 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; |
38 | using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; | ||
39 | 35 | ||
40 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 36 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine |
41 | { | 37 | { |
@@ -45,14 +41,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
45 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | 41 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); |
46 | private MainMemory _mainMemory; | 42 | private MainMemory _mainMemory; |
47 | 43 | ||
48 | ScriptInfo scriptInfo; | 44 | private ScriptInfo scriptInfo; |
49 | 45 | ||
50 | public void Initialise(ScriptInfo info) | 46 | public void Initialise(ScriptInfo info) |
51 | { | 47 | { |
52 | scriptInfo = info; | 48 | scriptInfo = info; |
53 | 49 | ||
54 | _mainMemory = new MainMemory(); | 50 | _mainMemory = new MainMemory(); |
55 | Thread.GlobalMemory = this._mainMemory; | 51 | Thread.GlobalMemory = _mainMemory; |
56 | Thread.World = info.world; | 52 | Thread.World = info.world; |
57 | CompileScript(); | 53 | CompileScript(); |
58 | 54 | ||
@@ -60,33 +56,33 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
60 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | 56 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); |
61 | } | 57 | } |
62 | 58 | ||
63 | void events_OnNewPresence(ScenePresence presence) | 59 | private void events_OnNewPresence(ScenePresence presence) |
64 | { | 60 | { |
65 | for (int i = 0; i < this._threads.Count; i++) | 61 | for (int i = 0; i < _threads.Count; i++) |
66 | { | 62 | { |
67 | if (!this._threads[i].running) | 63 | if (!_threads[i].running) |
68 | { | 64 | { |
69 | this._threads[i].StartMethod("OnNewPresence"); | 65 | _threads[i].StartMethod("OnNewPresence"); |
70 | bool run = true; | 66 | bool run = true; |
71 | while (run) | 67 | while (run) |
72 | { | 68 | { |
73 | run = this._threads[i].Excute(); | 69 | run = _threads[i].Excute(); |
74 | } | 70 | } |
75 | } | 71 | } |
76 | } | 72 | } |
77 | } | 73 | } |
78 | 74 | ||
79 | void events_OnFrame() | 75 | private void events_OnFrame() |
80 | { | 76 | { |
81 | for (int i = 0; i < this._threads.Count; i++) | 77 | for (int i = 0; i < _threads.Count; i++) |
82 | { | 78 | { |
83 | if (!this._threads[i].running) | 79 | if (!_threads[i].running) |
84 | { | 80 | { |
85 | this._threads[i].StartMethod("OnFrame"); | 81 | _threads[i].StartMethod("OnFrame"); |
86 | bool run = true; | 82 | bool run = true; |
87 | while (run) | 83 | while (run) |
88 | { | 84 | { |
89 | run = this._threads[i].Excute(); | 85 | run = _threads[i].Excute(); |
90 | } | 86 | } |
91 | } | 87 | } |
92 | } | 88 | } |
@@ -103,12 +99,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
103 | CompileInfo comp = new CompileInfo(); | 99 | CompileInfo comp = new CompileInfo(); |
104 | comp.script = script; | 100 | comp.script = script; |
105 | comp.scriptName = script; | 101 | comp.scriptName = script; |
106 | this.CompileScripts.Enqueue(comp); | 102 | CompileScripts.Enqueue(comp); |
107 | } | 103 | } |
108 | 104 | ||
109 | public void CompileScript() | 105 | public void CompileScript() |
110 | { | 106 | { |
111 | CompileInfo comp = this.CompileScripts.Dequeue(); | 107 | CompileInfo comp = CompileScripts.Dequeue(); |
112 | string script = comp.script; | 108 | string script = comp.script; |
113 | string scriptName = comp.scriptName; | 109 | string scriptName = comp.scriptName; |
114 | try | 110 | try |
@@ -121,13 +117,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
121 | tw.Close(); | 117 | tw.Close(); |
122 | 118 | ||
123 | //now compile | 119 | //now compile |
124 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); | 120 | ProcessStartInfo psi = new ProcessStartInfo("javac.exe", "*.java"); |
125 | // psi.RedirectStandardOutput = true; | 121 | // psi.RedirectStandardOutput = true; |
126 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | 122 | psi.WindowStyle = ProcessWindowStyle.Hidden; |
127 | psi.UseShellExecute = false; | 123 | psi.UseShellExecute = false; |
128 | 124 | ||
129 | System.Diagnostics.Process javacomp; | 125 | Process javacomp; |
130 | javacomp = System.Diagnostics.Process.Start(psi); | 126 | javacomp = Process.Start(psi); |
131 | javacomp.WaitForExit(); | 127 | javacomp.WaitForExit(); |
132 | 128 | ||
133 | 129 | ||
@@ -136,17 +132,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
136 | class1.LoadClassFromFile(scriptName + ".class"); | 132 | class1.LoadClassFromFile(scriptName + ".class"); |
137 | class1.PrintToConsole(); | 133 | class1.PrintToConsole(); |
138 | //Console.WriteLine(); | 134 | //Console.WriteLine(); |
139 | this._mainMemory.MethodArea.Classes.Add(class1); | 135 | _mainMemory.MethodArea.Classes.Add(class1); |
140 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | 136 | class1.AddMethodsToMemory(_mainMemory.MethodArea); |
141 | 137 | ||
142 | Thread newThread = new Thread(); | 138 | Thread newThread = new Thread(); |
143 | this._threads.Add(newThread); | 139 | _threads.Add(newThread); |
144 | newThread.currentClass = class1; | 140 | newThread.currentClass = class1; |
145 | newThread.scriptInfo = scriptInfo; | 141 | newThread.scriptInfo = scriptInfo; |
146 | 142 | ||
147 | //now delete the created files | 143 | //now delete the created files |
148 | System.IO.File.Delete(scriptName + ".java"); | 144 | File.Delete(scriptName + ".java"); |
149 | System.IO.File.Delete(scriptName + ".class"); | 145 | File.Delete(scriptName + ".class"); |
150 | //this.OnFrame(); | 146 | //this.OnFrame(); |
151 | } | 147 | } |
152 | catch (Exception e) | 148 | catch (Exception e) |
@@ -164,8 +160,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
164 | 160 | ||
165 | public CompileInfo() | 161 | public CompileInfo() |
166 | { | 162 | { |
167 | |||
168 | } | 163 | } |
169 | } | 164 | } |
170 | } | 165 | } |
171 | } | 166 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs index a36ad77..3c82952 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs | |||
@@ -26,13 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
34 | { | 30 | { |
35 | public class ArrayReference :BaseType | 31 | public class ArrayReference : BaseType |
36 | { | 32 | { |
37 | } | 33 | } |
38 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs index 5921446..4026c10 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
34 | { | 30 | { |
35 | public class ObjectReference : BaseType | 31 | public class ObjectReference : BaseType |
@@ -38,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | |||
38 | 34 | ||
39 | public ObjectReference() | 35 | public ObjectReference() |
40 | { | 36 | { |
41 | |||
42 | } | 37 | } |
43 | } | 38 | } |
44 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs index aa59681..de1aa87 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | |||
@@ -26,14 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Byte : BaseType | 31 | public class Byte : BaseType |
37 | { | 32 | { |
38 | } | 33 | } |
39 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs index 1cef150..0e17057 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | |||
@@ -26,14 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Char : BaseType | 31 | public class Char : BaseType |
37 | { | 32 | { |
38 | } | 33 | } |
39 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs index 0614dfd..ce8648c 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs | |||
@@ -26,11 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Float : BaseType | 31 | public class Float : BaseType |
@@ -39,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | |||
39 | 34 | ||
40 | public Float() | 35 | public Float() |
41 | { | 36 | { |
42 | |||
43 | } | 37 | } |
44 | } | 38 | } |
45 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs index 35f9822..251b736 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs | |||
@@ -26,11 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Int : BaseType | 31 | public class Int : BaseType |
@@ -39,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | |||
39 | 34 | ||
40 | public Int() | 35 | public Int() |
41 | { | 36 | { |
42 | |||
43 | } | 37 | } |
44 | } | 38 | } |
45 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs index 251b8c3..5f85799 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Script.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs | |||
@@ -37,7 +37,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
37 | 37 | ||
38 | public class TestScript : IScript | 38 | public class TestScript : IScript |
39 | { | 39 | { |
40 | ScriptInfo script; | 40 | private ScriptInfo script; |
41 | 41 | ||
42 | public string Name | 42 | public string Name |
43 | { | 43 | { |
@@ -51,14 +51,14 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
51 | script.events.OnNewPresence += events_OnNewPresence; | 51 | script.events.OnNewPresence += events_OnNewPresence; |
52 | } | 52 | } |
53 | 53 | ||
54 | void events_OnNewPresence(ScenePresence presence) | 54 | private 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 | private void events_OnFrame() |
60 | { | 60 | { |
61 | //script.logger.Verbose("Hello World!"); | 61 | //script.logger.Verbose("Hello World!"); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | } | 64 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs index 39dc878..9384efa 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs | |||
@@ -27,24 +27,21 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using OpenSim.Region.Environment.Scenes; |
31 | using System.Text; | ||
32 | using Key = libsecondlife.LLUUID; | 31 | using Key = libsecondlife.LLUUID; |
33 | using Rotation = libsecondlife.LLQuaternion; | 32 | using Rotation = libsecondlife.LLQuaternion; |
34 | using Vector = libsecondlife.LLVector3; | 33 | using Vector = libsecondlife.LLVector3; |
35 | using LSLList = System.Collections.Generic.List<string>; | 34 | using LSLList = System.Collections.Generic.List<string>; |
36 | 35 | ||
37 | 36 | ||
38 | using OpenSim.Region.Environment.Scenes; | ||
39 | |||
40 | namespace OpenSim.Region.ExtensionsScriptModule | 37 | namespace OpenSim.Region.ExtensionsScriptModule |
41 | { | 38 | { |
42 | // This class is to be used for engines which may not be able to access the Scene directly. | 39 | // This class is to be used for engines which may not be able to access the Scene directly. |
43 | // Scene access is preffered, but obviously not possible on some non-.NET languages. | 40 | // Scene access is preffered, but obviously not possible on some non-.NET languages. |
44 | public class ScriptAPI | 41 | public class ScriptAPI |
45 | { | 42 | { |
46 | Scene scene; | 43 | private Scene scene; |
47 | ScriptInterpretedAPI interpretedAPI; | 44 | private ScriptInterpretedAPI interpretedAPI; |
48 | 45 | ||
49 | public ScriptAPI(Scene world, Key taskID) | 46 | public ScriptAPI(Scene world, Key taskID) |
50 | { | 47 | { |
@@ -57,4 +54,4 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
57 | return null; | 54 | return null; |
58 | } | 55 | } |
59 | } | 56 | } |
60 | } | 57 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs index aaadd1f..cfa3c8e 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs | |||
@@ -25,6 +25,7 @@ | |||
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 libsecondlife; | ||
28 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
29 | using OpenSim.Region.Environment.Scenes; | 30 | using OpenSim.Region.Environment.Scenes; |
30 | 31 | ||
@@ -52,12 +53,12 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
52 | world = scene; | 53 | world = scene; |
53 | events = world.EventManager; | 54 | events = world.EventManager; |
54 | logger = MainLog.Instance; | 55 | logger = MainLog.Instance; |
55 | api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); | 56 | api = new ScriptAPI(world, LLUUID.Zero); |
56 | } | 57 | } |
57 | 58 | ||
58 | public void CreateTaskAPI(libsecondlife.LLUUID task) | 59 | public void CreateTaskAPI(LLUUID task) |
59 | { | 60 | { |
60 | api = new ScriptAPI(world, task); | 61 | api = new ScriptAPI(world, task); |
61 | } | 62 | } |
62 | } | 63 | } |
63 | } | 64 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs index eb85dbe..2895c4e 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs | |||
@@ -27,26 +27,25 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | 30 | using System.Text; |
31 | using Axiom.Math; | ||
32 | using OpenSim.Framework.Console; | ||
33 | using OpenSim.Region.Environment.LandManagement; | ||
34 | using OpenSim.Region.Environment.Scenes; | ||
32 | using Key = libsecondlife.LLUUID; | 35 | using Key = libsecondlife.LLUUID; |
33 | using Rotation = libsecondlife.LLQuaternion; | 36 | using Rotation = libsecondlife.LLQuaternion; |
34 | using Vector = libsecondlife.LLVector3; | 37 | using Vector = libsecondlife.LLVector3; |
35 | using LSLList = System.Collections.Generic.List<string>; | 38 | using LSLList = System.Collections.Generic.List<string>; |
36 | 39 | ||
37 | using OpenSim.Region.Environment.Scenes; | ||
38 | using OpenSim.Region.Environment.LandManagement; | ||
39 | using libsecondlife; | ||
40 | |||
41 | namespace OpenSim.Region.ExtensionsScriptModule | 40 | namespace OpenSim.Region.ExtensionsScriptModule |
42 | { | 41 | { |
43 | /// <summary> | 42 | /// <summary> |
44 | /// A class inteded to act as an API for LSL-styled interpreted languages | 43 | /// A class inteded to act as an API for LSL-styled interpreted languages |
45 | /// </summary> | 44 | /// </summary> |
46 | /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> | 45 | /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> |
47 | class ScriptInterpretedAPI | 46 | internal class ScriptInterpretedAPI |
48 | { | 47 | { |
49 | protected LLUUID m_object; | 48 | protected Key m_object; |
50 | protected Scene m_scene; | 49 | protected Scene m_scene; |
51 | 50 | ||
52 | /// <summary> | 51 | /// <summary> |
@@ -78,7 +77,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
78 | /// </summary> | 77 | /// </summary> |
79 | /// <param name="world">The scene the object is located in</param> | 78 | /// <param name="world">The scene the object is located in</param> |
80 | /// <param name="member">The specific member being 'occupied' by the script</param> | 79 | /// <param name="member">The specific member being 'occupied' by the script</param> |
81 | public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) | 80 | public ScriptInterpretedAPI(Scene world, Key member) |
82 | { | 81 | { |
83 | m_scene = world; | 82 | m_scene = world; |
84 | m_object = member; | 83 | m_object = member; |
@@ -96,7 +95,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
96 | 95 | ||
97 | public float osAcos(float val) | 96 | public float osAcos(float val) |
98 | { | 97 | { |
99 | return (float)Math.Acos(val); | 98 | return (float) Math.Acos(val); |
100 | } | 99 | } |
101 | 100 | ||
102 | [Obsolete("Unimplemented")] | 101 | [Obsolete("Unimplemented")] |
@@ -105,14 +104,15 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
105 | Vector myPosition = Task.AbsolutePosition; | 104 | Vector myPosition = Task.AbsolutePosition; |
106 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); | 105 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); |
107 | 106 | ||
108 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); | 107 | MainLog.Instance.Warn("script", |
108 | "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); | ||
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | 111 | ||
112 | [Obsolete("Unimplemented")] | 112 | [Obsolete("Unimplemented")] |
113 | public void osAdjustSoundVolume(float volume) | 113 | public void osAdjustSoundVolume(float volume) |
114 | { | 114 | { |
115 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); | 115 | MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | 118 | ||
@@ -125,8 +125,8 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
125 | [Obsolete("Unimplemented")] | 125 | [Obsolete("Unimplemented")] |
126 | public float osAngleBetween(Rotation a, Rotation b) | 126 | public float osAngleBetween(Rotation a, Rotation b) |
127 | { | 127 | { |
128 | Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); | 128 | Quaternion axA = new Quaternion(a.W, a.X, a.Y, a.Z); |
129 | Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); | 129 | Quaternion axB = new Quaternion(b.W, b.X, b.Y, b.Z); |
130 | 130 | ||
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
@@ -145,12 +145,12 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
145 | 145 | ||
146 | public float osAsin(float val) | 146 | public float osAsin(float val) |
147 | { | 147 | { |
148 | return (float)Math.Asin(val); | 148 | return (float) Math.Asin(val); |
149 | } | 149 | } |
150 | 150 | ||
151 | public float osAtan2(float x, float y) | 151 | public float osAtan2(float x, float y) |
152 | { | 152 | { |
153 | return (float)Math.Atan2(x, y); | 153 | return (float) Math.Atan2(x, y); |
154 | } | 154 | } |
155 | 155 | ||
156 | [Obsolete("Unimplemented")] | 156 | [Obsolete("Unimplemented")] |
@@ -178,10 +178,10 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
178 | 178 | ||
179 | public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) | 179 | public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) |
180 | { | 180 | { |
181 | Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); | 181 | Quaternion axQ = new Quaternion(); |
182 | Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); | 182 | Vector3 axFwd = new Vector3(fwd.X, fwd.Y, fwd.Z); |
183 | Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); | 183 | Vector3 axLeft = new Vector3(left.X, left.Y, left.Z); |
184 | Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); | 184 | Vector3 axUp = new Vector3(up.X, up.Y, up.Z); |
185 | 185 | ||
186 | axQ.FromAxes(axFwd, axLeft, axUp); | 186 | axQ.FromAxes(axFwd, axLeft, axUp); |
187 | 187 | ||
@@ -190,14 +190,14 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
190 | 190 | ||
191 | public Rotation osAxisAngle2Rot(Vector axis, float angle) | 191 | public Rotation osAxisAngle2Rot(Vector axis, float angle) |
192 | { | 192 | { |
193 | Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); | 193 | Quaternion axQ = Quaternion.FromAngleAxis(angle, new Vector3(axis.X, axis.Y, axis.Z)); |
194 | 194 | ||
195 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); | 195 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); |
196 | } | 196 | } |
197 | 197 | ||
198 | public string osBase64ToString(string str) | 198 | public string osBase64ToString(string str) |
199 | { | 199 | { |
200 | Encoding enc = System.Text.Encoding.UTF8; | 200 | Encoding enc = Encoding.UTF8; |
201 | return enc.GetString(Convert.FromBase64String(str)); | 201 | return enc.GetString(Convert.FromBase64String(str)); |
202 | } | 202 | } |
203 | 203 | ||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
223 | 223 | ||
224 | public int osCeil(float val) | 224 | public int osCeil(float val) |
225 | { | 225 | { |
226 | return (int)Math.Ceiling(val); | 226 | return (int) Math.Ceiling(val); |
227 | } | 227 | } |
228 | 228 | ||
229 | [Obsolete("Unimplemented")] | 229 | [Obsolete("Unimplemented")] |
@@ -252,13 +252,13 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
252 | 252 | ||
253 | public float osCos(float theta) | 253 | public float osCos(float theta) |
254 | { | 254 | { |
255 | return (float)Math.Cos(theta); | 255 | return (float) Math.Cos(theta); |
256 | } | 256 | } |
257 | 257 | ||
258 | public void osCreateLink(Key target, int parent) | 258 | public void osCreateLink(Key target, int parent) |
259 | { | 259 | { |
260 | if(Scene.Entities[target] is SceneObjectGroup) | 260 | if (Scene.Entities[target] is SceneObjectGroup) |
261 | Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); | 261 | Task.LinkToGroup((SceneObjectGroup) Scene.Entities[target]); |
262 | 262 | ||
263 | return; | 263 | return; |
264 | } | 264 | } |
@@ -292,4 +292,4 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
292 | return; | 292 | return; |
293 | } | 293 | } |
294 | } | 294 | } |
295 | } | 295 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs index 068df33..44feaff 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs | |||
@@ -26,19 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | using libsecondlife; | ||
34 | using Key = libsecondlife.LLUUID; | 29 | using Key = libsecondlife.LLUUID; |
35 | 30 | ||
36 | namespace OpenSim.Region.ExtensionsScriptModule | 31 | namespace OpenSim.Region.ExtensionsScriptModule |
37 | { | 32 | { |
38 | |||
39 | public class ScriptInterpretedEvents | 33 | public class ScriptInterpretedEvents |
40 | { | 34 | { |
41 | public delegate void OnTouchStartDelegate(Key user); | 35 | public delegate void OnTouchStartDelegate(Key user); |
36 | |||
42 | public event OnTouchStartDelegate OnTouchStart; | 37 | public event OnTouchStartDelegate OnTouchStart; |
43 | 38 | ||
44 | 39 | ||
@@ -48,4 +43,4 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
48 | OnTouchStart(user); | 43 | OnTouchStart(user); |
49 | } | 44 | } |
50 | } | 45 | } |
51 | } | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index 95ab2ca..2778e9c 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | |||
@@ -26,27 +26,28 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using Nini.Config; | ||
29 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
30 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Region.ExtensionsScriptModule.CSharp; | 33 | using OpenSim.Region.ExtensionsScriptModule.CSharp; |
33 | using OpenSim.Region.ExtensionsScriptModule.JScript; | 34 | using OpenSim.Region.ExtensionsScriptModule.JScript; |
34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; | 35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; |
35 | using Nini.Config; | ||
36 | 36 | ||
37 | namespace OpenSim.Region.ExtensionsScriptModule | 37 | namespace OpenSim.Region.ExtensionsScriptModule |
38 | { | 38 | { |
39 | public class ScriptManager : IRegionModule, IExtensionScriptModule | 39 | public class ScriptManager : IRegionModule, IExtensionScriptModule |
40 | { | 40 | { |
41 | readonly List<IScript> scripts = new List<IScript>(); | 41 | private readonly List<IScript> scripts = new List<IScript>(); |
42 | Scene m_scene; | 42 | private Scene m_scene; |
43 | readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); | 43 | private readonly 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); |
50 | // 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); | 51 | MainLog.Instance.Verbose("Loading " + script.Key); |
51 | script.Value.Initialise(scriptInfo); | 52 | script.Value.Initialise(scriptInfo); |
52 | scripts.Add(script.Value); | 53 | scripts.Add(script.Value); |
@@ -70,7 +71,7 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
70 | 71 | ||
71 | public void Initialise(Scene scene, IConfigSource config) | 72 | public void Initialise(Scene scene, IConfigSource config) |
72 | { | 73 | { |
73 | OpenSim.Framework.Console.MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module"); | 74 | MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module"); |
74 | m_scene = scene; | 75 | m_scene = scene; |
75 | 76 | ||
76 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); | 77 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); |
@@ -78,12 +79,10 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
78 | 79 | ||
79 | public void PostInitialise() | 80 | public void PostInitialise() |
80 | { | 81 | { |
81 | |||
82 | } | 82 | } |
83 | 83 | ||
84 | public void Close() | 84 | public void Close() |
85 | { | 85 | { |
86 | |||
87 | } | 86 | } |
88 | 87 | ||
89 | public string Name | 88 | public string Name |
@@ -92,8 +91,8 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
92 | } | 91 | } |
93 | 92 | ||
94 | public bool IsSharedModule | 93 | public bool IsSharedModule |
95 | { | 94 | { |
96 | get { return false; } | 95 | get { return false; } |
97 | } | 96 | } |
98 | 97 | ||
99 | public bool Compile(string filename) | 98 | public bool Compile(string filename) |
@@ -127,7 +126,8 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
127 | public bool AddPreCompiledScript(IScript script) | 126 | public bool AddPreCompiledScript(IScript script) |
128 | { | 127 | { |
129 | MainLog.Instance.Verbose("Loading script " + script.Name); | 128 | 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. | 129 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); |
130 | // 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 | ||
@@ -141,9 +141,9 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
141 | bool AddPreCompiledScript(IScript script); | 141 | bool AddPreCompiledScript(IScript script); |
142 | } | 142 | } |
143 | 143 | ||
144 | interface IScriptCompiler | 144 | internal interface IScriptCompiler |
145 | { | 145 | { |
146 | Dictionary<string, IScript> compile(string filename); | 146 | Dictionary<string, IScript> compile(string filename); |
147 | string FileExt(); | 147 | string FileExt(); |
148 | } | 148 | } |
149 | } | 149 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs index 2d4d898..a8f1de1 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs | |||
@@ -27,24 +27,26 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // Information about this assembly is defined by the following | 31 | // Information about this assembly is defined by the following |
31 | // attributes. | 32 | // attributes. |
32 | // | 33 | // |
33 | // change them to the information which is associated with the assembly | 34 | // change them to the information which is associated with the assembly |
34 | // you compile. | 35 | // you compile. |
35 | 36 | ||
36 | [assembly: AssemblyTitle("PhysXplugin")] | 37 | [assembly : AssemblyTitle("PhysXplugin")] |
37 | [assembly: AssemblyDescription("")] | 38 | [assembly : AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 39 | [assembly : AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 40 | [assembly : AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("PhysXplugin")] | 41 | [assembly : AssemblyProduct("PhysXplugin")] |
41 | [assembly: AssemblyCopyright("")] | 42 | [assembly : AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 43 | [assembly : AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 44 | [assembly : AssemblyCulture("")] |
44 | 45 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 46 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 48 | |
49 | [assembly : ComVisible(false)] | ||
48 | 50 | ||
49 | // The assembly version has following format : | 51 | // The assembly version has following format : |
50 | // | 52 | // |
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices; | |||
53 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
55 | 57 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 58 | [assembly : AssemblyVersion("1.0.*")] \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 95e6095..b412818 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -39,7 +39,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
39 | { | 39 | { |
40 | public BasicPhysicsPlugin() | 40 | public BasicPhysicsPlugin() |
41 | { | 41 | { |
42 | |||
43 | } | 42 | } |
44 | 43 | ||
45 | public bool Init() | 44 | public bool Init() |
@@ -59,7 +58,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
59 | 58 | ||
60 | public void Dispose() | 59 | public void Dispose() |
61 | { | 60 | { |
62 | |||
63 | } | 61 | } |
64 | } | 62 | } |
65 | 63 | ||
@@ -70,7 +68,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
70 | 68 | ||
71 | public BasicScene() | 69 | public BasicScene() |
72 | { | 70 | { |
73 | |||
74 | } | 71 | } |
75 | 72 | ||
76 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) | 73 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) |
@@ -83,17 +80,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
83 | 80 | ||
84 | public override void RemovePrim(PhysicsActor prim) | 81 | public override void RemovePrim(PhysicsActor prim) |
85 | { | 82 | { |
86 | |||
87 | } | 83 | } |
88 | 84 | ||
89 | public override void RemoveAvatar(PhysicsActor actor) | 85 | public override void RemoveAvatar(PhysicsActor actor) |
90 | { | 86 | { |
91 | BasicActor act = (BasicActor)actor; | 87 | BasicActor act = (BasicActor) actor; |
92 | if (_actors.Contains(act)) | 88 | if (_actors.Contains(act)) |
93 | { | 89 | { |
94 | _actors.Remove(act); | 90 | _actors.Remove(act); |
95 | } | 91 | } |
96 | |||
97 | } | 92 | } |
98 | 93 | ||
99 | /* | 94 | /* |
@@ -102,7 +97,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
102 | return null; | 97 | return null; |
103 | } | 98 | } |
104 | */ | 99 | */ |
105 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) | 100 | |
101 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | ||
102 | PhysicsVector size, Quaternion rotation) | ||
106 | { | 103 | { |
107 | return null; | 104 | return null; |
108 | } | 105 | } |
@@ -112,8 +109,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
112 | { | 109 | { |
113 | foreach (BasicActor actor in _actors) | 110 | foreach (BasicActor actor in _actors) |
114 | { | 111 | { |
115 | actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); | 112 | actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep); |
116 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); | 113 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); |
117 | if (actor.Position.Y < 0) | 114 | if (actor.Position.Y < 0) |
118 | { | 115 | { |
119 | actor.Position.Y = 0.1F; | 116 | actor.Position.Y = 0.1F; |
@@ -132,17 +129,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
132 | actor.Position.X = 255.9F; | 129 | actor.Position.X = 255.9F; |
133 | } | 130 | } |
134 | 131 | ||
135 | float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.0f; | 132 | float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f; |
136 | if (actor.Flying) | 133 | if (actor.Flying) |
137 | { | 134 | { |
138 | if (actor.Position.Z + (actor.Velocity.Z * timeStep) < _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2) | 135 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < |
136 | _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2) | ||
139 | { | 137 | { |
140 | actor.Position.Z = height; | 138 | actor.Position.Z = height; |
141 | actor.Velocity.Z = 0; | 139 | actor.Velocity.Z = 0; |
142 | } | 140 | } |
143 | else | 141 | else |
144 | { | 142 | { |
145 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | 143 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z*timeStep); |
146 | } | 144 | } |
147 | } | 145 | } |
148 | else | 146 | else |
@@ -150,32 +148,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
150 | actor.Position.Z = height; | 148 | actor.Position.Z = height; |
151 | actor.Velocity.Z = 0; | 149 | actor.Velocity.Z = 0; |
152 | } | 150 | } |
153 | |||
154 | |||
155 | } | 151 | } |
156 | } | 152 | } |
157 | 153 | ||
158 | public override void GetResults() | 154 | public override void GetResults() |
159 | { | 155 | { |
160 | |||
161 | } | 156 | } |
162 | 157 | ||
163 | public override bool IsThreaded | 158 | public override bool IsThreaded |
164 | { | 159 | { |
165 | get | 160 | get { return (false); // for now we won't be multithreaded |
166 | { | ||
167 | return (false); // for now we won't be multithreaded | ||
168 | } | 161 | } |
169 | } | 162 | } |
170 | 163 | ||
171 | public override void SetTerrain(float[] heightMap) | 164 | public override void SetTerrain(float[] heightMap) |
172 | { | 165 | { |
173 | this._heightMap = heightMap; | 166 | _heightMap = heightMap; |
174 | } | 167 | } |
175 | 168 | ||
176 | public override void DeleteTerrain() | 169 | public override void DeleteTerrain() |
177 | { | 170 | { |
178 | |||
179 | } | 171 | } |
180 | } | 172 | } |
181 | 173 | ||
@@ -185,6 +177,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
185 | private PhysicsVector _velocity; | 177 | private PhysicsVector _velocity; |
186 | private PhysicsVector _acceleration; | 178 | private PhysicsVector _acceleration; |
187 | private bool flying; | 179 | private bool flying; |
180 | |||
188 | public BasicActor() | 181 | public BasicActor() |
189 | { | 182 | { |
190 | _velocity = new PhysicsVector(); | 183 | _velocity = new PhysicsVector(); |
@@ -194,97 +187,56 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
194 | 187 | ||
195 | public override bool Flying | 188 | public override bool Flying |
196 | { | 189 | { |
197 | get | 190 | get { return flying; } |
198 | { | 191 | set { flying = value; } |
199 | return flying; | ||
200 | } | ||
201 | set | ||
202 | { | ||
203 | flying = value; | ||
204 | } | ||
205 | } | 192 | } |
206 | 193 | ||
207 | public override PhysicsVector Position | 194 | public override PhysicsVector Position |
208 | { | 195 | { |
209 | get | 196 | get { return _position; } |
210 | { | 197 | set { _position = value; } |
211 | return _position; | ||
212 | } | ||
213 | set | ||
214 | { | ||
215 | _position = value; | ||
216 | } | ||
217 | } | 198 | } |
218 | 199 | ||
219 | public override PhysicsVector Size | 200 | public override PhysicsVector Size |
220 | { | 201 | { |
221 | get | 202 | get { return new PhysicsVector(0, 0, 0); } |
222 | { | 203 | set { } |
223 | return new PhysicsVector(0, 0, 0); | ||
224 | } | ||
225 | set | ||
226 | { | ||
227 | } | ||
228 | } | 204 | } |
229 | 205 | ||
230 | public override PhysicsVector Velocity | 206 | public override PhysicsVector Velocity |
231 | { | 207 | { |
232 | get | 208 | get { return _velocity; } |
233 | { | 209 | set { _velocity = value; } |
234 | return _velocity; | ||
235 | } | ||
236 | set | ||
237 | { | ||
238 | _velocity = value; | ||
239 | } | ||
240 | } | 210 | } |
241 | 211 | ||
242 | public override Quaternion Orientation | 212 | public override Quaternion Orientation |
243 | { | 213 | { |
244 | get | 214 | get { return Quaternion.Identity; } |
245 | { | 215 | set { } |
246 | return Quaternion.Identity; | ||
247 | } | ||
248 | set | ||
249 | { | ||
250 | |||
251 | } | ||
252 | } | 216 | } |
253 | 217 | ||
254 | public override PhysicsVector Acceleration | 218 | public override PhysicsVector Acceleration |
255 | { | 219 | { |
256 | get | 220 | get { return _acceleration; } |
257 | { | ||
258 | return _acceleration; | ||
259 | } | ||
260 | |||
261 | } | 221 | } |
262 | 222 | ||
263 | public override bool Kinematic | 223 | public override bool Kinematic |
264 | { | 224 | { |
265 | get | 225 | get { return true; } |
266 | { | 226 | set { } |
267 | return true; | ||
268 | } | ||
269 | set | ||
270 | { | ||
271 | |||
272 | } | ||
273 | } | 227 | } |
228 | |||
274 | public void SetAcceleration(PhysicsVector accel) | 229 | public void SetAcceleration(PhysicsVector accel) |
275 | { | 230 | { |
276 | this._acceleration = accel; | 231 | _acceleration = accel; |
277 | } | 232 | } |
278 | 233 | ||
279 | public override void AddForce(PhysicsVector force) | 234 | public override void AddForce(PhysicsVector force) |
280 | { | 235 | { |
281 | |||
282 | } | 236 | } |
283 | 237 | ||
284 | public override void SetMomentum(PhysicsVector momentum) | 238 | public override void SetMomentum(PhysicsVector momentum) |
285 | { | 239 | { |
286 | |||
287 | } | 240 | } |
288 | } | 241 | } |
289 | 242 | } \ No newline at end of file | |
290 | } | ||
diff --git a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs index 0180917..c8596f7 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs | |||
@@ -1,4 +1,4 @@ | |||
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 | * |
@@ -27,24 +27,26 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // Information about this assembly is defined by the following | 31 | // Information about this assembly is defined by the following |
31 | // attributes. | 32 | // attributes. |
32 | // | 33 | // |
33 | // change them to the information which is associated with the assembly | 34 | // change them to the information which is associated with the assembly |
34 | // you compile. | 35 | // you compile. |
35 | 36 | ||
36 | [assembly: AssemblyTitle("BulletXPlugin")] | 37 | [assembly : AssemblyTitle("BulletXPlugin")] |
37 | [assembly: AssemblyDescription("")] | 38 | [assembly : AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 39 | [assembly : AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 40 | [assembly : AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("BulletXPlugin")] | 41 | [assembly : AssemblyProduct("BulletXPlugin")] |
41 | [assembly: AssemblyCopyright("")] | 42 | [assembly : AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 43 | [assembly : AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 44 | [assembly : AssemblyCulture("")] |
44 | 45 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 46 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 48 | |
49 | [assembly : ComVisible(false)] | ||
48 | 50 | ||
49 | // The assembly version has following format : | 51 | // The assembly version has following format : |
50 | // | 52 | // |
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices; | |||
53 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
55 | 57 | ||
56 | [assembly: AssemblyVersion("1.0.0.0")] | 58 | [assembly : AssemblyVersion("1.0.0.0")] \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 9fdc017..1658e2d 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #region Copyright | 29 | #region Copyright |
30 | |||
30 | /* | 31 | /* |
31 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 32 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
32 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 33 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
@@ -54,18 +55,21 @@ | |||
54 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 55 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
55 | * | 56 | * |
56 | */ | 57 | */ |
58 | |||
57 | #endregion | 59 | #endregion |
60 | |||
58 | #region References | 61 | #region References |
62 | |||
59 | using System; | 63 | using System; |
60 | using System.Collections.Generic; | 64 | using System.Collections.Generic; |
61 | using OpenSim.Region.Physics.Manager; | ||
62 | using OpenSim.Framework; | ||
63 | using Axiom.Math; | ||
64 | using AxiomQuaternion = Axiom.Math.Quaternion; | ||
65 | //Specific References for BulletXPlugin | ||
66 | using MonoXnaCompactMaths; | 65 | using MonoXnaCompactMaths; |
66 | using OpenSim.Framework; | ||
67 | using OpenSim.Region.Physics.Manager; | ||
67 | using XnaDevRu.BulletX; | 68 | using XnaDevRu.BulletX; |
68 | using XnaDevRu.BulletX.Dynamics; | 69 | using XnaDevRu.BulletX.Dynamics; |
70 | using AxiomQuaternion = Axiom.Math.Quaternion; | ||
71 | using BoxShape=XnaDevRu.BulletX.BoxShape; | ||
72 | //Specific References for BulletXPlugin | ||
69 | 73 | ||
70 | #endregion | 74 | #endregion |
71 | 75 | ||
@@ -80,27 +84,31 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
80 | { | 84 | { |
81 | } | 85 | } |
82 | } | 86 | } |
87 | |||
83 | /// <summary> | 88 | /// <summary> |
84 | /// BulletXConversions are called now BulletXMaths | 89 | /// BulletXConversions are called now BulletXMaths |
85 | /// This Class converts objects and types for BulletX and give some operations | 90 | /// This Class converts objects and types for BulletX and give some operations |
86 | /// </summary> | 91 | /// </summary> |
87 | public class BulletXMaths | 92 | public class BulletXMaths |
88 | { | 93 | { |
89 | //Vector3 | 94 | //Vector3 |
90 | public static MonoXnaCompactMaths.Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) | 95 | public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) |
91 | { | 96 | { |
92 | return new MonoXnaCompactMaths.Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); | 97 | return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); |
93 | } | 98 | } |
94 | public static PhysicsVector XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3) | 99 | |
100 | public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3) | ||
95 | { | 101 | { |
96 | return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); | 102 | return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); |
97 | } | 103 | } |
104 | |||
98 | //Quaternion | 105 | //Quaternion |
99 | public static MonoXnaCompactMaths.Quaternion AxiomQuaternionToXnaQuaternion(AxiomQuaternion axiomQuaternion) | 106 | public static Quaternion AxiomQuaternionToXnaQuaternion(AxiomQuaternion axiomQuaternion) |
100 | { | 107 | { |
101 | return new MonoXnaCompactMaths.Quaternion(axiomQuaternion.x, axiomQuaternion.y, axiomQuaternion.z, axiomQuaternion.w); | 108 | return new Quaternion(axiomQuaternion.x, axiomQuaternion.y, axiomQuaternion.z, axiomQuaternion.w); |
102 | } | 109 | } |
103 | public static AxiomQuaternion XnaQuaternionToAxiomQuaternion(MonoXnaCompactMaths.Quaternion xnaQuaternion) | 110 | |
111 | public static AxiomQuaternion XnaQuaternionToAxiomQuaternion(Quaternion xnaQuaternion) | ||
104 | { | 112 | { |
105 | return new AxiomQuaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z); | 113 | return new AxiomQuaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z); |
106 | } | 114 | } |
@@ -110,70 +118,79 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
110 | //- GetRotation (class MatrixOperations) | 118 | //- GetRotation (class MatrixOperations) |
111 | //- GetElement (class MathHelper) | 119 | //- GetElement (class MathHelper) |
112 | //- SetElement (class MathHelper) | 120 | //- SetElement (class MathHelper) |
113 | internal static void SetRotation(ref Matrix m, MonoXnaCompactMaths.Quaternion q) | 121 | internal static void SetRotation(ref Matrix m, Quaternion q) |
114 | { | 122 | { |
115 | float d = q.LengthSquared(); | 123 | float d = q.LengthSquared(); |
116 | float s = 2f / d; | 124 | float s = 2f/d; |
117 | float xs = q.X * s, ys = q.Y * s, zs = q.Z * s; | 125 | float xs = q.X*s, ys = q.Y*s, zs = q.Z*s; |
118 | float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs; | 126 | float wx = q.W*xs, wy = q.W*ys, wz = q.W*zs; |
119 | float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs; | 127 | float xx = q.X*xs, xy = q.X*ys, xz = q.X*zs; |
120 | float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs; | 128 | float yy = q.Y*ys, yz = q.Y*zs, zz = q.Z*zs; |
121 | m = new Matrix(1 - (yy + zz), xy - wz, xz + wy, 0, | 129 | m = new Matrix(1 - (yy + zz), xy - wz, xz + wy, 0, |
122 | xy + wz, 1 - (xx + zz), yz - wx, 0, | 130 | xy + wz, 1 - (xx + zz), yz - wx, 0, |
123 | xz - wy, yz + wx, 1 - (xx + yy), 0, | 131 | xz - wy, yz + wx, 1 - (xx + yy), 0, |
124 | m.M41, m.M42, m.M43, 1); | 132 | m.M41, m.M42, m.M43, 1); |
125 | } | 133 | } |
126 | internal static MonoXnaCompactMaths.Quaternion GetRotation(Matrix m) | 134 | |
135 | internal static Quaternion GetRotation(Matrix m) | ||
127 | { | 136 | { |
128 | MonoXnaCompactMaths.Quaternion q = new MonoXnaCompactMaths.Quaternion(); | 137 | Quaternion q = new Quaternion(); |
129 | 138 | ||
130 | float trace = m.M11 + m.M22 + m.M33; | 139 | float trace = m.M11 + m.M22 + m.M33; |
131 | 140 | ||
132 | if (trace > 0) | 141 | if (trace > 0) |
133 | { | 142 | { |
134 | float s = (float)Math.Sqrt(trace + 1); | 143 | float s = (float) Math.Sqrt(trace + 1); |
135 | q.W = s * 0.5f; | 144 | q.W = s*0.5f; |
136 | s = 0.5f / s; | 145 | s = 0.5f/s; |
137 | 146 | ||
138 | q.X = (m.M32 - m.M23) * s; | 147 | q.X = (m.M32 - m.M23)*s; |
139 | q.Y = (m.M13 - m.M31) * s; | 148 | q.Y = (m.M13 - m.M31)*s; |
140 | q.Z = (m.M21 - m.M12) * s; | 149 | q.Z = (m.M21 - m.M12)*s; |
141 | } | 150 | } |
142 | else | 151 | else |
143 | { | 152 | { |
144 | int i = m.M11 < m.M22 ? | 153 | int i = m.M11 < m.M22 |
145 | (m.M22 < m.M33 ? 2 : 1) : | 154 | ? |
146 | (m.M11 < m.M33 ? 2 : 0); | 155 | (m.M22 < m.M33 ? 2 : 1) |
147 | int j = (i + 1) % 3; | 156 | : |
148 | int k = (i + 2) % 3; | 157 | (m.M11 < m.M33 ? 2 : 0); |
149 | 158 | int j = (i + 1)%3; | |
150 | float s = (float)Math.Sqrt(GetElement(m, i, i) - GetElement(m, j, j) - GetElement(m, k, k) + 1); | 159 | int k = (i + 2)%3; |
151 | SetElement(ref q, i, s * 0.5f); | 160 | |
152 | s = 0.5f / s; | 161 | float s = (float) Math.Sqrt(GetElement(m, i, i) - GetElement(m, j, j) - GetElement(m, k, k) + 1); |
153 | 162 | SetElement(ref q, i, s*0.5f); | |
154 | q.W = (GetElement(m, k, j) - GetElement(m, j, k)) * s; | 163 | s = 0.5f/s; |
155 | SetElement(ref q, j, (GetElement(m, j, i) + GetElement(m, i, j)) * s); | 164 | |
156 | SetElement(ref q, k, (GetElement(m, k, i) + GetElement(m, i, k)) * s); | 165 | q.W = (GetElement(m, k, j) - GetElement(m, j, k))*s; |
166 | SetElement(ref q, j, (GetElement(m, j, i) + GetElement(m, i, j))*s); | ||
167 | SetElement(ref q, k, (GetElement(m, k, i) + GetElement(m, i, k))*s); | ||
157 | } | 168 | } |
158 | 169 | ||
159 | return q; | 170 | return q; |
160 | } | 171 | } |
161 | internal static float SetElement(ref MonoXnaCompactMaths.Quaternion q, int index, float value) | 172 | |
173 | internal static float SetElement(ref Quaternion q, int index, float value) | ||
162 | { | 174 | { |
163 | switch (index) | 175 | switch (index) |
164 | { | 176 | { |
165 | case 0: | 177 | case 0: |
166 | q.X = value; break; | 178 | q.X = value; |
179 | break; | ||
167 | case 1: | 180 | case 1: |
168 | q.Y = value; break; | 181 | q.Y = value; |
182 | break; | ||
169 | case 2: | 183 | case 2: |
170 | q.Z = value; break; | 184 | q.Z = value; |
185 | break; | ||
171 | case 3: | 186 | case 3: |
172 | q.W = value; break; | 187 | q.W = value; |
188 | break; | ||
173 | } | 189 | } |
174 | 190 | ||
175 | return 0; | 191 | return 0; |
176 | } | 192 | } |
193 | |||
177 | internal static float GetElement(Matrix mat, int row, int col) | 194 | internal static float GetElement(Matrix mat, int row, int col) |
178 | { | 195 | { |
179 | switch (row) | 196 | switch (row) |
@@ -187,7 +204,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
187 | return mat.M12; | 204 | return mat.M12; |
188 | case 2: | 205 | case 2: |
189 | return mat.M13; | 206 | return mat.M13; |
190 | } break; | 207 | } |
208 | break; | ||
191 | case 1: | 209 | case 1: |
192 | switch (col) | 210 | switch (col) |
193 | { | 211 | { |
@@ -197,7 +215,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
197 | return mat.M22; | 215 | return mat.M22; |
198 | case 2: | 216 | case 2: |
199 | return mat.M23; | 217 | return mat.M23; |
200 | } break; | 218 | } |
219 | break; | ||
201 | case 2: | 220 | case 2: |
202 | switch (col) | 221 | switch (col) |
203 | { | 222 | { |
@@ -207,12 +226,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
207 | return mat.M32; | 226 | return mat.M32; |
208 | case 2: | 227 | case 2: |
209 | return mat.M33; | 228 | return mat.M33; |
210 | } break; | 229 | } |
230 | break; | ||
211 | } | 231 | } |
212 | 232 | ||
213 | return 0; | 233 | return 0; |
214 | } | 234 | } |
215 | } | 235 | } |
236 | |||
216 | /// <summary> | 237 | /// <summary> |
217 | /// PhysicsPlugin Class for BulletX | 238 | /// PhysicsPlugin Class for BulletX |
218 | /// </summary> | 239 | /// </summary> |
@@ -223,10 +244,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
223 | public BulletXPlugin() | 244 | public BulletXPlugin() |
224 | { | 245 | { |
225 | } | 246 | } |
247 | |||
226 | public bool Init() | 248 | public bool Init() |
227 | { | 249 | { |
228 | return true; | 250 | return true; |
229 | } | 251 | } |
252 | |||
230 | public PhysicsScene GetScene() | 253 | public PhysicsScene GetScene() |
231 | { | 254 | { |
232 | if (_mScene == null) | 255 | if (_mScene == null) |
@@ -235,20 +258,24 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
235 | } | 258 | } |
236 | return (_mScene); | 259 | return (_mScene); |
237 | } | 260 | } |
261 | |||
238 | public string GetName() | 262 | public string GetName() |
239 | { | 263 | { |
240 | return ("modified_BulletX");//Changed!! "BulletXEngine" To "modified_BulletX" | 264 | return ("modified_BulletX"); //Changed!! "BulletXEngine" To "modified_BulletX" |
241 | } | 265 | } |
266 | |||
242 | public void Dispose() | 267 | public void Dispose() |
243 | { | 268 | { |
244 | } | 269 | } |
245 | } | 270 | } |
271 | |||
246 | /// <summary> | 272 | /// <summary> |
247 | /// PhysicsScene Class for BulletX | 273 | /// PhysicsScene Class for BulletX |
248 | /// </summary> | 274 | /// </summary> |
249 | public class BulletXScene : PhysicsScene | 275 | public class BulletXScene : PhysicsScene |
250 | { | 276 | { |
251 | #region BulletXScene Fields | 277 | #region BulletXScene Fields |
278 | |||
252 | public DiscreteDynamicsWorld ddWorld; | 279 | public DiscreteDynamicsWorld ddWorld; |
253 | private CollisionDispatcher cDispatcher; | 280 | private CollisionDispatcher cDispatcher; |
254 | private OverlappingPairCache opCache; | 281 | private OverlappingPairCache opCache; |
@@ -271,33 +298,58 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
271 | private List<BulletXCharacter> _characters = new List<BulletXCharacter>(); | 298 | private List<BulletXCharacter> _characters = new List<BulletXCharacter>(); |
272 | private List<BulletXPrim> _prims = new List<BulletXPrim>(); | 299 | private List<BulletXPrim> _prims = new List<BulletXPrim>(); |
273 | 300 | ||
274 | public static float Gravity { get { return gravity; } } | 301 | public static float Gravity |
275 | public static float HeightLevel0 { get { return heightLevel0; } } | 302 | { |
276 | public static float HeightLevel1 { get { return heightLevel1; } } | 303 | get { return gravity; } |
277 | public static float LowGravityFactor { get { return lowGravityFactor; } } | 304 | } |
278 | public static int MaxXY { get { return maxXY; } } | 305 | |
279 | public static int MaxZ { get { return maxZ; } } | 306 | public static float HeightLevel0 |
307 | { | ||
308 | get { return heightLevel0; } | ||
309 | } | ||
310 | |||
311 | public static float HeightLevel1 | ||
312 | { | ||
313 | get { return heightLevel1; } | ||
314 | } | ||
315 | |||
316 | public static float LowGravityFactor | ||
317 | { | ||
318 | get { return lowGravityFactor; } | ||
319 | } | ||
320 | |||
321 | public static int MaxXY | ||
322 | { | ||
323 | get { return maxXY; } | ||
324 | } | ||
325 | |||
326 | public static int MaxZ | ||
327 | { | ||
328 | get { return maxZ; } | ||
329 | } | ||
280 | 330 | ||
281 | private List<RigidBody> _forgottenRigidBodies = new List<RigidBody>(); | 331 | private List<RigidBody> _forgottenRigidBodies = new List<RigidBody>(); |
282 | internal string is_ex_message = "Can't remove rigidBody!: "; | 332 | internal string is_ex_message = "Can't remove rigidBody!: "; |
333 | |||
283 | #endregion | 334 | #endregion |
284 | 335 | ||
285 | public BulletXScene() | 336 | public BulletXScene() |
286 | { | 337 | { |
287 | cDispatcher = new CollisionDispatcher(); | 338 | cDispatcher = new CollisionDispatcher(); |
288 | MonoXnaCompactMaths.Vector3 worldMinDim = new MonoXnaCompactMaths.Vector3((float)minXY, (float)minXY, (float)minZ); | 339 | Vector3 worldMinDim = new Vector3((float) minXY, (float) minXY, (float) minZ); |
289 | MonoXnaCompactMaths.Vector3 worldMaxDim = new MonoXnaCompactMaths.Vector3((float)maxXY, (float)maxXY, (float)maxZ); | 340 | Vector3 worldMaxDim = new Vector3((float) maxXY, (float) maxXY, (float) maxZ); |
290 | opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles); | 341 | opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles); |
291 | sicSolver = new SequentialImpulseConstraintSolver(); | 342 | sicSolver = new SequentialImpulseConstraintSolver(); |
292 | 343 | ||
293 | lock (BulletXLock) | 344 | lock (BulletXLock) |
294 | { | 345 | { |
295 | ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver); | 346 | ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver); |
296 | ddWorld.Gravity = new MonoXnaCompactMaths.Vector3(0, 0, -gravity); | 347 | ddWorld.Gravity = new Vector3(0, 0, -gravity); |
297 | } | 348 | } |
298 | //this._heightmap = new float[65536]; | 349 | //this._heightmap = new float[65536]; |
299 | } | 350 | } |
300 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) | 351 | |
352 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) | ||
301 | { | 353 | { |
302 | PhysicsVector pos = new PhysicsVector(); | 354 | PhysicsVector pos = new PhysicsVector(); |
303 | pos.X = position.X; | 355 | pos.X = position.X; |
@@ -311,6 +363,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
311 | } | 363 | } |
312 | return newAv; | 364 | return newAv; |
313 | } | 365 | } |
366 | |||
314 | public override void RemoveAvatar(PhysicsActor actor) | 367 | public override void RemoveAvatar(PhysicsActor actor) |
315 | { | 368 | { |
316 | if (actor is BulletXCharacter) | 369 | if (actor is BulletXCharacter) |
@@ -319,20 +372,22 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
319 | { | 372 | { |
320 | try | 373 | try |
321 | { | 374 | { |
322 | ddWorld.RemoveRigidBody(((BulletXCharacter)actor).RigidBody); | 375 | ddWorld.RemoveRigidBody(((BulletXCharacter) actor).RigidBody); |
323 | } | 376 | } |
324 | catch (Exception ex) | 377 | catch (Exception ex) |
325 | { | 378 | { |
326 | BulletXMessage(is_ex_message + ex.Message, true); | 379 | BulletXMessage(is_ex_message + ex.Message, true); |
327 | ((BulletXCharacter)actor).RigidBody.ActivationState = ActivationState.DisableSimulation; | 380 | ((BulletXCharacter) actor).RigidBody.ActivationState = ActivationState.DisableSimulation; |
328 | AddForgottenRigidBody(((BulletXCharacter)actor).RigidBody); | 381 | AddForgottenRigidBody(((BulletXCharacter) actor).RigidBody); |
329 | } | 382 | } |
330 | _characters.Remove((BulletXCharacter)actor); | 383 | _characters.Remove((BulletXCharacter) actor); |
331 | } | 384 | } |
332 | GC.Collect(); | 385 | GC.Collect(); |
333 | } | 386 | } |
334 | } | 387 | } |
335 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation) | 388 | |
389 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | ||
390 | PhysicsVector size, AxiomQuaternion rotation) | ||
336 | { | 391 | { |
337 | PhysicsActor result; | 392 | PhysicsActor result; |
338 | 393 | ||
@@ -358,11 +413,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
358 | 413 | ||
359 | return result; | 414 | return result; |
360 | } | 415 | } |
361 | public PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Axiom.Math.Quaternion rotation) | 416 | |
417 | public PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation) | ||
362 | { | 418 | { |
363 | return AddPrim("", position, size, rotation, null, null); | 419 | return AddPrim("", position, size, rotation, null, null); |
364 | } | 420 | } |
365 | public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | 421 | |
422 | public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation, | ||
423 | Mesh mesh, PrimitiveBaseShape pbs) | ||
366 | { | 424 | { |
367 | BulletXPrim newPrim = null; | 425 | BulletXPrim newPrim = null; |
368 | lock (BulletXLock) | 426 | lock (BulletXLock) |
@@ -372,6 +430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
372 | } | 430 | } |
373 | return newPrim; | 431 | return newPrim; |
374 | } | 432 | } |
433 | |||
375 | public override void RemovePrim(PhysicsActor prim) | 434 | public override void RemovePrim(PhysicsActor prim) |
376 | { | 435 | { |
377 | if (prim is BulletXPrim) | 436 | if (prim is BulletXPrim) |
@@ -380,19 +439,20 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
380 | { | 439 | { |
381 | try | 440 | try |
382 | { | 441 | { |
383 | ddWorld.RemoveRigidBody(((BulletXPrim)prim).RigidBody); | 442 | ddWorld.RemoveRigidBody(((BulletXPrim) prim).RigidBody); |
384 | } | 443 | } |
385 | catch (Exception ex) | 444 | catch (Exception ex) |
386 | { | 445 | { |
387 | BulletXMessage(is_ex_message + ex.Message, true); | 446 | BulletXMessage(is_ex_message + ex.Message, true); |
388 | ((BulletXPrim)prim).RigidBody.ActivationState = ActivationState.DisableSimulation; | 447 | ((BulletXPrim) prim).RigidBody.ActivationState = ActivationState.DisableSimulation; |
389 | AddForgottenRigidBody(((BulletXPrim)prim).RigidBody); | 448 | AddForgottenRigidBody(((BulletXPrim) prim).RigidBody); |
390 | } | 449 | } |
391 | _prims.Remove((BulletXPrim)prim); | 450 | _prims.Remove((BulletXPrim) prim); |
392 | } | 451 | } |
393 | GC.Collect(); | 452 | GC.Collect(); |
394 | } | 453 | } |
395 | } | 454 | } |
455 | |||
396 | public override void Simulate(float timeStep) | 456 | public override void Simulate(float timeStep) |
397 | { | 457 | { |
398 | lock (BulletXLock) | 458 | lock (BulletXLock) |
@@ -408,6 +468,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
408 | UpdateKineticsForAll(); | 468 | UpdateKineticsForAll(); |
409 | } | 469 | } |
410 | } | 470 | } |
471 | |||
411 | private void MoveAllObjects(float timeStep) | 472 | private void MoveAllObjects(float timeStep) |
412 | { | 473 | { |
413 | foreach (BulletXCharacter actor in _characters) | 474 | foreach (BulletXCharacter actor in _characters) |
@@ -418,6 +479,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
418 | { | 479 | { |
419 | } | 480 | } |
420 | } | 481 | } |
482 | |||
421 | private void ValidateHeightForAll() | 483 | private void ValidateHeightForAll() |
422 | { | 484 | { |
423 | float _height; | 485 | float _height; |
@@ -431,7 +493,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
431 | foreach (BulletXPrim prim in _prims) | 493 | foreach (BulletXPrim prim in _prims) |
432 | { | 494 | { |
433 | //_height = HeightValue(prim.RigidBodyPosition); | 495 | //_height = HeightValue(prim.RigidBodyPosition); |
434 | _height = _simFlatPlanet.HeightValue(prim.RigidBodyPosition); | 496 | _height = _simFlatPlanet.HeightValue(prim.RigidBodyPosition); |
435 | prim.ValidateHeight(_height); | 497 | prim.ValidateHeight(_height); |
436 | //if (_simFlatPlanet.heightIsNotValid(prim.RigidBodyPosition, out _height)) prim.ValidateHeight(_height); | 498 | //if (_simFlatPlanet.heightIsNotValid(prim.RigidBodyPosition, out _height)) prim.ValidateHeight(_height); |
437 | } | 499 | } |
@@ -444,6 +506,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
444 | // prim.ValidateHeight(0); | 506 | // prim.ValidateHeight(0); |
445 | //} | 507 | //} |
446 | } | 508 | } |
509 | |||
447 | private void UpdateKineticsForAll() | 510 | private void UpdateKineticsForAll() |
448 | { | 511 | { |
449 | //UpdatePosition > UpdateKinetics. | 512 | //UpdatePosition > UpdateKinetics. |
@@ -458,17 +521,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
458 | } | 521 | } |
459 | //if(this._simFlatPlanet!=null) this._simFlatPlanet.Restore(); | 522 | //if(this._simFlatPlanet!=null) this._simFlatPlanet.Restore(); |
460 | } | 523 | } |
524 | |||
461 | public override void GetResults() | 525 | public override void GetResults() |
462 | { | 526 | { |
463 | |||
464 | } | 527 | } |
528 | |||
465 | public override bool IsThreaded | 529 | public override bool IsThreaded |
466 | { | 530 | { |
467 | get | 531 | get { return (false); // for now we won't be multithreaded |
468 | { | ||
469 | return (false); // for now we won't be multithreaded | ||
470 | } | 532 | } |
471 | } | 533 | } |
534 | |||
472 | public override void SetTerrain(float[] heightMap) | 535 | public override void SetTerrain(float[] heightMap) |
473 | { | 536 | { |
474 | ////As the same as ODE, heightmap (x,y) must be swapped for BulletX | 537 | ////As the same as ODE, heightmap (x,y) must be swapped for BulletX |
@@ -494,41 +557,44 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
494 | DeleteTerrain(); | 557 | DeleteTerrain(); |
495 | //There is a BulletXLock inside the constructor of BulletXPlanet | 558 | //There is a BulletXLock inside the constructor of BulletXPlanet |
496 | //this._simFlatPlanet = new BulletXPlanet(this, swappedHeightMap); | 559 | //this._simFlatPlanet = new BulletXPlanet(this, swappedHeightMap); |
497 | this._simFlatPlanet = new BulletXPlanet(this, heightMap); | 560 | _simFlatPlanet = new BulletXPlanet(this, heightMap); |
498 | //this._heightmap = heightMap; | 561 | //this._heightmap = heightMap; |
499 | } | 562 | } |
563 | |||
500 | public override void DeleteTerrain() | 564 | public override void DeleteTerrain() |
501 | { | 565 | { |
502 | if (this._simFlatPlanet != null) | 566 | if (_simFlatPlanet != null) |
503 | { | 567 | { |
504 | lock (BulletXLock) | 568 | lock (BulletXLock) |
505 | { | 569 | { |
506 | try | 570 | try |
507 | { | 571 | { |
508 | ddWorld.RemoveRigidBody(this._simFlatPlanet.RigidBody); | 572 | ddWorld.RemoveRigidBody(_simFlatPlanet.RigidBody); |
509 | } | 573 | } |
510 | catch (Exception ex) | 574 | catch (Exception ex) |
511 | { | 575 | { |
512 | BulletXMessage(is_ex_message + ex.Message, true); | 576 | BulletXMessage(is_ex_message + ex.Message, true); |
513 | this._simFlatPlanet.RigidBody.ActivationState = ActivationState.DisableSimulation; | 577 | _simFlatPlanet.RigidBody.ActivationState = ActivationState.DisableSimulation; |
514 | AddForgottenRigidBody(this._simFlatPlanet.RigidBody); | 578 | AddForgottenRigidBody(_simFlatPlanet.RigidBody); |
515 | } | 579 | } |
516 | } | 580 | } |
517 | this._simFlatPlanet = null; | 581 | _simFlatPlanet = null; |
518 | GC.Collect(); | 582 | GC.Collect(); |
519 | BulletXMessage("Terrain erased!", false); | 583 | BulletXMessage("Terrain erased!", false); |
520 | } | 584 | } |
521 | //this._heightmap = null; | 585 | //this._heightmap = null; |
522 | } | 586 | } |
587 | |||
523 | internal void AddForgottenRigidBody(RigidBody forgottenRigidBody) | 588 | internal void AddForgottenRigidBody(RigidBody forgottenRigidBody) |
524 | { | 589 | { |
525 | _forgottenRigidBodies.Add(forgottenRigidBody); | 590 | _forgottenRigidBodies.Add(forgottenRigidBody); |
526 | } | 591 | } |
592 | |||
527 | private void RemoveForgottenRigidBodies() | 593 | private void RemoveForgottenRigidBodies() |
528 | { | 594 | { |
529 | RigidBody forgottenRigidBody; | 595 | RigidBody forgottenRigidBody; |
530 | int nRigidBodies = _forgottenRigidBodies.Count; | 596 | int nRigidBodies = _forgottenRigidBodies.Count; |
531 | for(int i = nRigidBodies - 1; i >= 0; i--) | 597 | for (int i = nRigidBodies - 1; i >= 0; i--) |
532 | { | 598 | { |
533 | forgottenRigidBody = _forgottenRigidBodies[i]; | 599 | forgottenRigidBody = _forgottenRigidBodies[i]; |
534 | try | 600 | try |
@@ -544,10 +610,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
544 | } | 610 | } |
545 | GC.Collect(); | 611 | GC.Collect(); |
546 | } | 612 | } |
613 | |||
547 | internal void BulletXMessage(string message, bool isWarning) | 614 | internal void BulletXMessage(string message, bool isWarning) |
548 | { | 615 | { |
549 | PhysicsPluginManager.PhysicsPluginMessage("[Modified BulletX]:\t" + message, isWarning); | 616 | PhysicsPluginManager.PhysicsPluginMessage("[Modified BulletX]:\t" + message, isWarning); |
550 | } | 617 | } |
618 | |||
551 | //temp | 619 | //temp |
552 | //private float HeightValue(MonoXnaCompactMaths.Vector3 position) | 620 | //private float HeightValue(MonoXnaCompactMaths.Vector3 position) |
553 | //{ | 621 | //{ |
@@ -559,10 +627,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
559 | // height = this._heightmap[li_y * 256 + li_x]; | 627 | // height = this._heightmap[li_y * 256 + li_x]; |
560 | // if (height < 0) height = 0; | 628 | // if (height < 0) height = 0; |
561 | // else if (height > maxZ) height = maxZ; | 629 | // else if (height > maxZ) height = maxZ; |
562 | 630 | ||
563 | // return height; | 631 | // return height; |
564 | //} | 632 | //} |
565 | } | 633 | } |
634 | |||
566 | /// <summary> | 635 | /// <summary> |
567 | /// PhysicsActor Character Class for BulletX | 636 | /// PhysicsActor Character Class for BulletX |
568 | /// </summary> | 637 | /// </summary> |
@@ -576,21 +645,24 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
576 | private bool flying; | 645 | private bool flying; |
577 | private RigidBody rigidBody; | 646 | private RigidBody rigidBody; |
578 | 647 | ||
579 | public MonoXnaCompactMaths.Vector3 RigidBodyPosition | 648 | public Vector3 RigidBodyPosition |
580 | { | 649 | { |
581 | get { return this.rigidBody.CenterOfMassPosition; } | 650 | get { return rigidBody.CenterOfMassPosition; } |
582 | } | 651 | } |
652 | |||
583 | public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) | 653 | public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) |
584 | : this("", parent_scene, pos) | 654 | : this("", parent_scene, pos) |
585 | { | 655 | { |
586 | } | 656 | } |
657 | |||
587 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) | 658 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) |
588 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), | 659 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), |
589 | AxiomQuaternion.Identity) | 660 | AxiomQuaternion.Identity) |
590 | { | 661 | { |
591 | } | 662 | } |
663 | |||
592 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 664 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, |
593 | PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation) | 665 | PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation) |
594 | { | 666 | { |
595 | //This fields will be removed. They're temporal | 667 | //This fields will be removed. They're temporal |
596 | float _sizeX = 0.5f; | 668 | float _sizeX = 0.5f; |
@@ -622,23 +694,23 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
622 | //For now, like ODE, collisionShape = sphere of radious = 1.0 | 694 | //For now, like ODE, collisionShape = sphere of radious = 1.0 |
623 | CollisionShape _collisionShape = new SphereShape(1.0f); | 695 | CollisionShape _collisionShape = new SphereShape(1.0f); |
624 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); | 696 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); |
625 | MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); | 697 | Vector3 _localInertia = new Vector3(); |
626 | _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 | 698 | _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 |
627 | rigidBody = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); | 699 | rigidBody = |
700 | new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, | ||
701 | _friction, _restitution); | ||
628 | //rigidBody.ActivationState = ActivationState.DisableDeactivation; | 702 | //rigidBody.ActivationState = ActivationState.DisableDeactivation; |
629 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition | 703 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition |
630 | MonoXnaCompactMaths.Vector3 _vDebugTranslation; | 704 | Vector3 _vDebugTranslation; |
631 | _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; | 705 | _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; |
632 | rigidBody.Translate(_vDebugTranslation); | 706 | rigidBody.Translate(_vDebugTranslation); |
633 | parent_scene.ddWorld.AddRigidBody(rigidBody); | 707 | parent_scene.ddWorld.AddRigidBody(rigidBody); |
634 | } | 708 | } |
635 | } | 709 | } |
710 | |||
636 | public override PhysicsVector Position | 711 | public override PhysicsVector Position |
637 | { | 712 | { |
638 | get | 713 | get { return _position; } |
639 | { | ||
640 | return _position; | ||
641 | } | ||
642 | set | 714 | set |
643 | { | 715 | { |
644 | lock (BulletXScene.BulletXLock) | 716 | lock (BulletXScene.BulletXLock) |
@@ -648,12 +720,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
648 | } | 720 | } |
649 | } | 721 | } |
650 | } | 722 | } |
723 | |||
651 | public override PhysicsVector Velocity | 724 | public override PhysicsVector Velocity |
652 | { | 725 | { |
653 | get | 726 | get { return _velocity; } |
654 | { | ||
655 | return _velocity; | ||
656 | } | ||
657 | set | 727 | set |
658 | { | 728 | { |
659 | lock (BulletXScene.BulletXLock) | 729 | lock (BulletXScene.BulletXLock) |
@@ -663,12 +733,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
663 | } | 733 | } |
664 | } | 734 | } |
665 | } | 735 | } |
736 | |||
666 | public override PhysicsVector Size | 737 | public override PhysicsVector Size |
667 | { | 738 | { |
668 | get | 739 | get { return _size; } |
669 | { | ||
670 | return _size; | ||
671 | } | ||
672 | set | 740 | set |
673 | { | 741 | { |
674 | lock (BulletXScene.BulletXLock) | 742 | lock (BulletXScene.BulletXLock) |
@@ -677,19 +745,15 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
677 | } | 745 | } |
678 | } | 746 | } |
679 | } | 747 | } |
748 | |||
680 | public override PhysicsVector Acceleration | 749 | public override PhysicsVector Acceleration |
681 | { | 750 | { |
682 | get | 751 | get { return _acceleration; } |
683 | { | ||
684 | return _acceleration; | ||
685 | } | ||
686 | } | 752 | } |
753 | |||
687 | public override AxiomQuaternion Orientation | 754 | public override AxiomQuaternion Orientation |
688 | { | 755 | { |
689 | get | 756 | get { return _orientation; } |
690 | { | ||
691 | return _orientation; | ||
692 | } | ||
693 | set | 757 | set |
694 | { | 758 | { |
695 | lock (BulletXScene.BulletXLock) | 759 | lock (BulletXScene.BulletXLock) |
@@ -698,24 +762,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
698 | } | 762 | } |
699 | } | 763 | } |
700 | } | 764 | } |
765 | |||
701 | public RigidBody RigidBody | 766 | public RigidBody RigidBody |
702 | { | 767 | { |
703 | get | 768 | get { return rigidBody; } |
704 | { | ||
705 | return rigidBody; | ||
706 | } | ||
707 | } | 769 | } |
770 | |||
708 | public override bool Flying | 771 | public override bool Flying |
709 | { | 772 | { |
710 | get | 773 | get { return flying; } |
711 | { | 774 | set { flying = value; } |
712 | return flying; | ||
713 | } | ||
714 | set | ||
715 | { | ||
716 | flying = value; | ||
717 | } | ||
718 | } | 775 | } |
776 | |||
719 | public void SetAcceleration(PhysicsVector accel) | 777 | public void SetAcceleration(PhysicsVector accel) |
720 | { | 778 | { |
721 | lock (BulletXScene.BulletXLock) | 779 | lock (BulletXScene.BulletXLock) |
@@ -723,116 +781,121 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
723 | _acceleration = accel; | 781 | _acceleration = accel; |
724 | } | 782 | } |
725 | } | 783 | } |
784 | |||
726 | public override bool Kinematic | 785 | public override bool Kinematic |
727 | { | 786 | { |
728 | get | 787 | get { return false; } |
729 | { | 788 | set { } |
730 | return false; | ||
731 | } | ||
732 | set | ||
733 | { | ||
734 | |||
735 | } | ||
736 | } | 789 | } |
790 | |||
737 | public override void AddForce(PhysicsVector force) | 791 | public override void AddForce(PhysicsVector force) |
738 | { | 792 | { |
739 | |||
740 | } | 793 | } |
794 | |||
741 | public override void SetMomentum(PhysicsVector momentum) | 795 | public override void SetMomentum(PhysicsVector momentum) |
742 | { | 796 | { |
743 | |||
744 | } | 797 | } |
798 | |||
745 | internal void Move(float timeStep) | 799 | internal void Move(float timeStep) |
746 | { | 800 | { |
747 | MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3(); | 801 | Vector3 vec = new Vector3(); |
748 | //At this point it's supossed that: | 802 | //At this point it's supossed that: |
749 | //_velocity == rigidBody.LinearVelocity | 803 | //_velocity == rigidBody.LinearVelocity |
750 | vec.X = this._velocity.X; | 804 | vec.X = _velocity.X; |
751 | vec.Y = this._velocity.Y; | 805 | vec.Y = _velocity.Y; |
752 | vec.Z = this._velocity.Z; | 806 | vec.Z = _velocity.Z; |
753 | if ((vec.X != 0.0f) || (vec.Y != 0.0f) || (vec.Z != 0.0f)) rigidBody.Activate(); | 807 | if ((vec.X != 0.0f) || (vec.Y != 0.0f) || (vec.Z != 0.0f)) rigidBody.Activate(); |
754 | if (flying) | 808 | if (flying) |
755 | { | 809 | { |
756 | //Antigravity with movement | 810 | //Antigravity with movement |
757 | if (this._position.Z <= BulletXScene.HeightLevel0) | 811 | if (_position.Z <= BulletXScene.HeightLevel0) |
758 | { | 812 | { |
759 | vec.Z += BulletXScene.Gravity * timeStep; | 813 | vec.Z += BulletXScene.Gravity*timeStep; |
760 | } | 814 | } |
761 | //Lowgravity with movement | 815 | //Lowgravity with movement |
762 | else if ((this._position.Z > BulletXScene.HeightLevel0) | 816 | else if ((_position.Z > BulletXScene.HeightLevel0) |
763 | && (this._position.Z <= BulletXScene.HeightLevel1)) | 817 | && (_position.Z <= BulletXScene.HeightLevel1)) |
764 | { | 818 | { |
765 | vec.Z += BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); | 819 | vec.Z += BulletXScene.Gravity*timeStep*(1.0f - BulletXScene.LowGravityFactor); |
766 | } | 820 | } |
767 | //Lowgravity with... | 821 | //Lowgravity with... |
768 | else if (this._position.Z > BulletXScene.HeightLevel1) | 822 | else if (_position.Z > BulletXScene.HeightLevel1) |
769 | { | 823 | { |
770 | if (vec.Z > 0) //no movement | 824 | if (vec.Z > 0) //no movement |
771 | vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); | 825 | vec.Z = BulletXScene.Gravity*timeStep*(1.0f - BulletXScene.LowGravityFactor); |
772 | else | 826 | else |
773 | vec.Z += BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); | 827 | vec.Z += BulletXScene.Gravity*timeStep*(1.0f - BulletXScene.LowGravityFactor); |
774 | |||
775 | } | 828 | } |
776 | } | 829 | } |
777 | rigidBody.LinearVelocity = vec; | 830 | rigidBody.LinearVelocity = vec; |
778 | } | 831 | } |
832 | |||
779 | //This validation is very basic | 833 | //This validation is very basic |
780 | internal void ValidateHeight(float heighmapPositionValue) | 834 | internal void ValidateHeight(float heighmapPositionValue) |
781 | { | 835 | { |
782 | if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z / 2.0f) | 836 | if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z/2.0f) |
783 | { | 837 | { |
784 | Matrix m = rigidBody.WorldTransform; | 838 | Matrix m = rigidBody.WorldTransform; |
785 | MonoXnaCompactMaths.Vector3 v3 = m.Translation; | 839 | Vector3 v3 = m.Translation; |
786 | v3.Z = heighmapPositionValue + _size.Z / 2.0f; | 840 | v3.Z = heighmapPositionValue + _size.Z/2.0f; |
787 | m.Translation = v3; | 841 | m.Translation = v3; |
788 | rigidBody.WorldTransform = m; | 842 | rigidBody.WorldTransform = m; |
789 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO | 843 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO |
790 | Speed(new PhysicsVector(this.rigidBody.LinearVelocity.X, this.rigidBody.LinearVelocity.Y, 0.0f)); | 844 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
791 | } | 845 | } |
792 | } | 846 | } |
847 | |||
793 | internal void UpdateKinetics() | 848 | internal void UpdateKinetics() |
794 | { | 849 | { |
795 | this._position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); | 850 | _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); |
796 | this._velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); | 851 | _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); |
797 | //Orientation it seems that it will be the default. | 852 | //Orientation it seems that it will be the default. |
798 | ReOrient(); | 853 | ReOrient(); |
799 | } | 854 | } |
800 | 855 | ||
801 | #region Methods for updating values of RigidBody | 856 | #region Methods for updating values of RigidBody |
857 | |||
802 | private void Translate() | 858 | private void Translate() |
803 | { | 859 | { |
804 | Translate(this._position); | 860 | Translate(_position); |
805 | } | 861 | } |
862 | |||
806 | private void Translate(PhysicsVector _newPos) | 863 | private void Translate(PhysicsVector _newPos) |
807 | { | 864 | { |
808 | MonoXnaCompactMaths.Vector3 _translation; | 865 | Vector3 _translation; |
809 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; | 866 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; |
810 | rigidBody.Translate(_translation); | 867 | rigidBody.Translate(_translation); |
811 | } | 868 | } |
869 | |||
812 | private void Speed() | 870 | private void Speed() |
813 | { | 871 | { |
814 | Speed(this._velocity); | 872 | Speed(_velocity); |
815 | } | 873 | } |
874 | |||
816 | private void Speed(PhysicsVector _newSpeed) | 875 | private void Speed(PhysicsVector _newSpeed) |
817 | { | 876 | { |
818 | MonoXnaCompactMaths.Vector3 _speed; | 877 | Vector3 _speed; |
819 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); | 878 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); |
820 | rigidBody.LinearVelocity = _speed; | 879 | rigidBody.LinearVelocity = _speed; |
821 | } | 880 | } |
881 | |||
822 | private void ReOrient() | 882 | private void ReOrient() |
823 | { | 883 | { |
824 | ReOrient(this._orientation); | 884 | ReOrient(_orientation); |
825 | } | 885 | } |
886 | |||
826 | private void ReOrient(AxiomQuaternion _newOrient) | 887 | private void ReOrient(AxiomQuaternion _newOrient) |
827 | { | 888 | { |
828 | MonoXnaCompactMaths.Quaternion _newOrientation; | 889 | Quaternion _newOrientation; |
829 | _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); | 890 | _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); |
830 | Matrix _comTransform = rigidBody.CenterOfMassTransform; | 891 | Matrix _comTransform = rigidBody.CenterOfMassTransform; |
831 | BulletXMaths.SetRotation(ref _comTransform, _newOrientation); | 892 | BulletXMaths.SetRotation(ref _comTransform, _newOrientation); |
832 | rigidBody.CenterOfMassTransform = _comTransform; | 893 | rigidBody.CenterOfMassTransform = _comTransform; |
833 | } | 894 | } |
895 | |||
834 | #endregion | 896 | #endregion |
835 | } | 897 | } |
898 | |||
836 | /// <summary> | 899 | /// <summary> |
837 | /// PhysicsActor Prim Class for BulletX | 900 | /// PhysicsActor Prim Class for BulletX |
838 | /// </summary> | 901 | /// </summary> |
@@ -851,27 +914,32 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
851 | //_physical value will be linked with the prim object value | 914 | //_physical value will be linked with the prim object value |
852 | private Boolean _physical = false; | 915 | private Boolean _physical = false; |
853 | 916 | ||
854 | public MonoXnaCompactMaths.Vector3 RigidBodyPosition | 917 | public Vector3 RigidBodyPosition |
855 | { | 918 | { |
856 | get { return this.rigidBody.CenterOfMassPosition; } | 919 | get { return rigidBody.CenterOfMassPosition; } |
857 | } | 920 | } |
921 | |||
858 | public BulletXPrim(BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, AxiomQuaternion rotation) | 922 | public BulletXPrim(BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, AxiomQuaternion rotation) |
859 | : this("", parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, null, null) | 923 | : this("", parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, null, null) |
860 | { | 924 | { |
861 | } | 925 | } |
862 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, | 926 | |
863 | AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | 927 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, |
928 | AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | ||
864 | : this(primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs) | 929 | : this(primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs) |
865 | { | 930 | { |
866 | } | 931 | } |
867 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, PhysicsVector size, | 932 | |
868 | PhysicsVector aceleration, AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | 933 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, |
934 | PhysicsVector size, | ||
935 | PhysicsVector aceleration, AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | ||
869 | { | 936 | { |
870 | if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) throw new Exception("Size 0"); | 937 | if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) throw new Exception("Size 0"); |
871 | if (rotation.Norm == 0f) rotation = AxiomQuaternion.Identity; | 938 | if (rotation.Norm == 0f) rotation = AxiomQuaternion.Identity; |
872 | 939 | ||
873 | _position = pos; | 940 | _position = pos; |
874 | if (_physical) _velocity = velocity; else _velocity = new PhysicsVector(); | 941 | if (_physical) _velocity = velocity; |
942 | else _velocity = new PhysicsVector(); | ||
875 | _size = size; | 943 | _size = size; |
876 | _acceleration = aceleration; | 944 | _acceleration = aceleration; |
877 | _orientation = rotation; | 945 | _orientation = rotation; |
@@ -889,26 +957,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
889 | { | 957 | { |
890 | _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(pos); | 958 | _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(pos); |
891 | //For now all prims are boxes | 959 | //For now all prims are boxes |
892 | CollisionShape _collisionShape = new XnaDevRu.BulletX.BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_size) / 2.0f); | 960 | CollisionShape _collisionShape = new BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_size)/2.0f); |
893 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); | 961 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); |
894 | MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); | 962 | Vector3 _localInertia = new Vector3(); |
895 | if(_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 | 963 | if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 |
896 | rigidBody = new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); | 964 | rigidBody = |
965 | new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, | ||
966 | _friction, _restitution); | ||
897 | //rigidBody.ActivationState = ActivationState.DisableDeactivation; | 967 | //rigidBody.ActivationState = ActivationState.DisableDeactivation; |
898 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition | 968 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition |
899 | MonoXnaCompactMaths.Vector3 _vDebugTranslation; | 969 | Vector3 _vDebugTranslation; |
900 | _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; | 970 | _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; |
901 | rigidBody.Translate(_vDebugTranslation); | 971 | rigidBody.Translate(_vDebugTranslation); |
902 | //--- | 972 | //--- |
903 | parent_scene.ddWorld.AddRigidBody(rigidBody); | 973 | parent_scene.ddWorld.AddRigidBody(rigidBody); |
904 | } | 974 | } |
905 | } | 975 | } |
976 | |||
906 | public override PhysicsVector Position | 977 | public override PhysicsVector Position |
907 | { | 978 | { |
908 | get | 979 | get { return _position; } |
909 | { | ||
910 | return _position; | ||
911 | } | ||
912 | set | 980 | set |
913 | { | 981 | { |
914 | lock (BulletXScene.BulletXLock) | 982 | lock (BulletXScene.BulletXLock) |
@@ -918,12 +986,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
918 | } | 986 | } |
919 | } | 987 | } |
920 | } | 988 | } |
989 | |||
921 | public override PhysicsVector Velocity | 990 | public override PhysicsVector Velocity |
922 | { | 991 | { |
923 | get | 992 | get { return _velocity; } |
924 | { | ||
925 | return _velocity; | ||
926 | } | ||
927 | set | 993 | set |
928 | { | 994 | { |
929 | lock (BulletXScene.BulletXLock) | 995 | lock (BulletXScene.BulletXLock) |
@@ -941,12 +1007,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
941 | } | 1007 | } |
942 | } | 1008 | } |
943 | } | 1009 | } |
1010 | |||
944 | public override PhysicsVector Size | 1011 | public override PhysicsVector Size |
945 | { | 1012 | { |
946 | get | 1013 | get { return _size; } |
947 | { | ||
948 | return _size; | ||
949 | } | ||
950 | set | 1014 | set |
951 | { | 1015 | { |
952 | lock (BulletXScene.BulletXLock) | 1016 | lock (BulletXScene.BulletXLock) |
@@ -956,19 +1020,15 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
956 | } | 1020 | } |
957 | } | 1021 | } |
958 | } | 1022 | } |
1023 | |||
959 | public override PhysicsVector Acceleration | 1024 | public override PhysicsVector Acceleration |
960 | { | 1025 | { |
961 | get | 1026 | get { return _acceleration; } |
962 | { | ||
963 | return _acceleration; | ||
964 | } | ||
965 | } | 1027 | } |
1028 | |||
966 | public override AxiomQuaternion Orientation | 1029 | public override AxiomQuaternion Orientation |
967 | { | 1030 | { |
968 | get | 1031 | get { return _orientation; } |
969 | { | ||
970 | return _orientation; | ||
971 | } | ||
972 | set | 1032 | set |
973 | { | 1033 | { |
974 | lock (BulletXScene.BulletXLock) | 1034 | lock (BulletXScene.BulletXLock) |
@@ -978,43 +1038,34 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
978 | } | 1038 | } |
979 | } | 1039 | } |
980 | } | 1040 | } |
1041 | |||
981 | public float Mass | 1042 | public float Mass |
982 | { | 1043 | { |
983 | get | 1044 | get |
984 | { | 1045 | { |
985 | //For now all prims are boxes | 1046 | //For now all prims are boxes |
986 | return (_physical ? 1 : 0) * _density * _size.X * _size.Y * _size.Z; | 1047 | return (_physical ? 1 : 0)*_density*_size.X*_size.Y*_size.Z; |
987 | } | 1048 | } |
988 | } | 1049 | } |
1050 | |||
989 | public RigidBody RigidBody | 1051 | public RigidBody RigidBody |
990 | { | 1052 | { |
991 | get | 1053 | get { return rigidBody; } |
992 | { | ||
993 | return rigidBody; | ||
994 | } | ||
995 | } | 1054 | } |
1055 | |||
996 | public override bool Flying | 1056 | public override bool Flying |
997 | { | 1057 | { |
998 | get | 1058 | get { return false; //no flying prims for you |
999 | { | ||
1000 | return false; //no flying prims for you | ||
1001 | } | ||
1002 | set | ||
1003 | { | ||
1004 | |||
1005 | } | 1059 | } |
1060 | set { } | ||
1006 | } | 1061 | } |
1062 | |||
1007 | public Boolean Physical | 1063 | public Boolean Physical |
1008 | { | 1064 | { |
1009 | get | 1065 | get { return _physical; } |
1010 | { | 1066 | set { _physical = value; } |
1011 | return _physical; | ||
1012 | } | ||
1013 | set | ||
1014 | { | ||
1015 | _physical = value; | ||
1016 | } | ||
1017 | } | 1067 | } |
1068 | |||
1018 | public void SetAcceleration(PhysicsVector accel) | 1069 | public void SetAcceleration(PhysicsVector accel) |
1019 | { | 1070 | { |
1020 | lock (BulletXScene.BulletXLock) | 1071 | lock (BulletXScene.BulletXLock) |
@@ -1022,6 +1073,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1022 | _acceleration = accel; | 1073 | _acceleration = accel; |
1023 | } | 1074 | } |
1024 | } | 1075 | } |
1076 | |||
1025 | public override bool Kinematic | 1077 | public override bool Kinematic |
1026 | { | 1078 | { |
1027 | get | 1079 | get |
@@ -1034,36 +1086,38 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1034 | //this._prim.Kinematic = value; | 1086 | //this._prim.Kinematic = value; |
1035 | } | 1087 | } |
1036 | } | 1088 | } |
1089 | |||
1037 | public override void AddForce(PhysicsVector force) | 1090 | public override void AddForce(PhysicsVector force) |
1038 | { | 1091 | { |
1039 | |||
1040 | } | 1092 | } |
1093 | |||
1041 | public override void SetMomentum(PhysicsVector momentum) | 1094 | public override void SetMomentum(PhysicsVector momentum) |
1042 | { | 1095 | { |
1043 | |||
1044 | } | 1096 | } |
1097 | |||
1045 | internal void ValidateHeight(float heighmapPositionValue) | 1098 | internal void ValidateHeight(float heighmapPositionValue) |
1046 | { | 1099 | { |
1047 | if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z / 2.0f) | 1100 | if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z/2.0f) |
1048 | { | 1101 | { |
1049 | Matrix m = rigidBody.WorldTransform; | 1102 | Matrix m = rigidBody.WorldTransform; |
1050 | MonoXnaCompactMaths.Vector3 v3 = m.Translation; | 1103 | Vector3 v3 = m.Translation; |
1051 | v3.Z = heighmapPositionValue + _size.Z / 2.0f; | 1104 | v3.Z = heighmapPositionValue + _size.Z/2.0f; |
1052 | m.Translation = v3; | 1105 | m.Translation = v3; |
1053 | rigidBody.WorldTransform = m; | 1106 | rigidBody.WorldTransform = m; |
1054 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO | 1107 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO |
1055 | //Static objects don't have linear velocity | 1108 | //Static objects don't have linear velocity |
1056 | if(_physical) | 1109 | if (_physical) |
1057 | Speed(new PhysicsVector(this.rigidBody.LinearVelocity.X, this.rigidBody.LinearVelocity.Y, 0.0f)); | 1110 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1058 | } | 1111 | } |
1059 | } | 1112 | } |
1113 | |||
1060 | internal void UpdateKinetics() | 1114 | internal void UpdateKinetics() |
1061 | { | 1115 | { |
1062 | if (_physical) //Updates properties. Prim updates its properties physically | 1116 | if (_physical) //Updates properties. Prim updates its properties physically |
1063 | { | 1117 | { |
1064 | this._position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); | 1118 | _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); |
1065 | this._velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); | 1119 | _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); |
1066 | this._orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); | 1120 | _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); |
1067 | } | 1121 | } |
1068 | else //Doesn't updates properties. That's a cancel | 1122 | else //Doesn't updates properties. That's a cancel |
1069 | { | 1123 | { |
@@ -1074,35 +1128,41 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1074 | } | 1128 | } |
1075 | 1129 | ||
1076 | #region Methods for updating values of RigidBody | 1130 | #region Methods for updating values of RigidBody |
1131 | |||
1077 | private void Translate() | 1132 | private void Translate() |
1078 | { | 1133 | { |
1079 | Translate(this._position); | 1134 | Translate(_position); |
1080 | } | 1135 | } |
1136 | |||
1081 | private void Translate(PhysicsVector _newPos) | 1137 | private void Translate(PhysicsVector _newPos) |
1082 | { | 1138 | { |
1083 | MonoXnaCompactMaths.Vector3 _translation; | 1139 | Vector3 _translation; |
1084 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; | 1140 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; |
1085 | rigidBody.Translate(_translation); | 1141 | rigidBody.Translate(_translation); |
1086 | } | 1142 | } |
1143 | |||
1087 | private void Speed() | 1144 | private void Speed() |
1088 | { | 1145 | { |
1089 | Speed(this._velocity); | 1146 | Speed(_velocity); |
1090 | } | 1147 | } |
1148 | |||
1091 | private void Speed(PhysicsVector _newSpeed) | 1149 | private void Speed(PhysicsVector _newSpeed) |
1092 | { | 1150 | { |
1093 | MonoXnaCompactMaths.Vector3 _speed; | 1151 | Vector3 _speed; |
1094 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); | 1152 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); |
1095 | rigidBody.LinearVelocity = _speed; | 1153 | rigidBody.LinearVelocity = _speed; |
1096 | } | 1154 | } |
1155 | |||
1097 | private void ReSize() | 1156 | private void ReSize() |
1098 | { | 1157 | { |
1099 | ReSize(this._size); | 1158 | ReSize(_size); |
1100 | } | 1159 | } |
1160 | |||
1101 | private void ReSize(PhysicsVector _newSize) | 1161 | private void ReSize(PhysicsVector _newSize) |
1102 | { | 1162 | { |
1103 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't | 1163 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't |
1104 | //so i have to do it manually. That's recreating rigidbody | 1164 | //so i have to do it manually. That's recreating rigidbody |
1105 | MonoXnaCompactMaths.Vector3 _newsize; | 1165 | Vector3 _newsize; |
1106 | _newsize = BulletXMaths.PhysicsVectorToXnaVector3(_newSize); | 1166 | _newsize = BulletXMaths.PhysicsVectorToXnaVector3(_newSize); |
1107 | if ((_newsize.X == 0) || (_newsize.Y == 0) || (_newsize.Z == 0)) throw new Exception("Size 0"); | 1167 | if ((_newsize.X == 0) || (_newsize.Y == 0) || (_newsize.Z == 0)) throw new Exception("Size 0"); |
1108 | 1168 | ||
@@ -1114,67 +1174,77 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1114 | Matrix _startTransform = Matrix.Identity; | 1174 | Matrix _startTransform = Matrix.Identity; |
1115 | Matrix _centerOfMassOffset = Matrix.Identity; | 1175 | Matrix _centerOfMassOffset = Matrix.Identity; |
1116 | RigidBody _tmpRigidBody; | 1176 | RigidBody _tmpRigidBody; |
1117 | _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(this._position); | 1177 | _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(_position); |
1118 | //For now all prims are boxes | 1178 | //For now all prims are boxes |
1119 | CollisionShape _collisionShape = new XnaDevRu.BulletX.BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_newSize) / 2.0f); | 1179 | CollisionShape _collisionShape = new BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_newSize)/2.0f); |
1120 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); | 1180 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); |
1121 | MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); | 1181 | Vector3 _localInertia = new Vector3(); |
1122 | if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 | 1182 | if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 |
1123 | _tmpRigidBody = new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); | 1183 | _tmpRigidBody = |
1184 | new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, | ||
1185 | _friction, _restitution); | ||
1124 | //rigidBody.ActivationState = ActivationState.DisableDeactivation; | 1186 | //rigidBody.ActivationState = ActivationState.DisableDeactivation; |
1125 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition | 1187 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition |
1126 | MonoXnaCompactMaths.Vector3 _vDebugTranslation; | 1188 | Vector3 _vDebugTranslation; |
1127 | _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; | 1189 | _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; |
1128 | _tmpRigidBody.Translate(_vDebugTranslation); | 1190 | _tmpRigidBody.Translate(_vDebugTranslation); |
1129 | //--- | 1191 | //--- |
1130 | //There is a bug when trying to remove a rigidBody that is colliding with something.. | 1192 | //There is a bug when trying to remove a rigidBody that is colliding with something.. |
1131 | try | 1193 | try |
1132 | { | 1194 | { |
1133 | this._parent_scene.ddWorld.RemoveRigidBody(rigidBody); | 1195 | _parent_scene.ddWorld.RemoveRigidBody(rigidBody); |
1134 | } | 1196 | } |
1135 | catch(Exception ex) | 1197 | catch (Exception ex) |
1136 | { | 1198 | { |
1137 | this._parent_scene.BulletXMessage(this._parent_scene.is_ex_message + ex.Message, true); | 1199 | _parent_scene.BulletXMessage(_parent_scene.is_ex_message + ex.Message, true); |
1138 | rigidBody.ActivationState = ActivationState.DisableSimulation; | 1200 | rigidBody.ActivationState = ActivationState.DisableSimulation; |
1139 | this._parent_scene.AddForgottenRigidBody(rigidBody); | 1201 | _parent_scene.AddForgottenRigidBody(rigidBody); |
1140 | } | 1202 | } |
1141 | rigidBody = _tmpRigidBody; | 1203 | rigidBody = _tmpRigidBody; |
1142 | this._parent_scene.ddWorld.AddRigidBody(rigidBody); | 1204 | _parent_scene.ddWorld.AddRigidBody(rigidBody); |
1143 | if (_physical) Speed();//Static objects don't have linear velocity | 1205 | if (_physical) Speed(); //Static objects don't have linear velocity |
1144 | ReOrient(); | 1206 | ReOrient(); |
1145 | GC.Collect(); | 1207 | GC.Collect(); |
1146 | } | 1208 | } |
1209 | |||
1147 | private void ReOrient() | 1210 | private void ReOrient() |
1148 | { | 1211 | { |
1149 | ReOrient(this._orientation); | 1212 | ReOrient(_orientation); |
1150 | } | 1213 | } |
1214 | |||
1151 | private void ReOrient(AxiomQuaternion _newOrient) | 1215 | private void ReOrient(AxiomQuaternion _newOrient) |
1152 | { | 1216 | { |
1153 | MonoXnaCompactMaths.Quaternion _newOrientation; | 1217 | Quaternion _newOrientation; |
1154 | _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); | 1218 | _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); |
1155 | Matrix _comTransform = rigidBody.CenterOfMassTransform; | 1219 | Matrix _comTransform = rigidBody.CenterOfMassTransform; |
1156 | BulletXMaths.SetRotation(ref _comTransform, _newOrientation); | 1220 | BulletXMaths.SetRotation(ref _comTransform, _newOrientation); |
1157 | rigidBody.CenterOfMassTransform = _comTransform; | 1221 | rigidBody.CenterOfMassTransform = _comTransform; |
1158 | } | 1222 | } |
1159 | #endregion | ||
1160 | 1223 | ||
1224 | #endregion | ||
1161 | } | 1225 | } |
1226 | |||
1162 | /// <summary> | 1227 | /// <summary> |
1163 | /// This Class manage a HeighField as a RigidBody. This is for to be added in the BulletXScene | 1228 | /// This Class manage a HeighField as a RigidBody. This is for to be added in the BulletXScene |
1164 | /// </summary> | 1229 | /// </summary> |
1165 | internal class BulletXPlanet | 1230 | internal class BulletXPlanet |
1166 | { | 1231 | { |
1167 | private PhysicsVector _staticPosition; | 1232 | private PhysicsVector _staticPosition; |
1168 | private PhysicsVector _staticVelocity; | 1233 | private PhysicsVector _staticVelocity; |
1169 | private AxiomQuaternion _staticOrientation; | 1234 | private AxiomQuaternion _staticOrientation; |
1170 | private float _mass; | 1235 | private float _mass; |
1171 | private BulletXScene _parentscene; | 1236 | private BulletXScene _parentscene; |
1172 | internal float[] _heightField; | 1237 | internal float[] _heightField; |
1173 | private RigidBody _flatPlanet; | 1238 | private RigidBody _flatPlanet; |
1174 | internal RigidBody RigidBody { get { return _flatPlanet; } } | 1239 | |
1240 | internal RigidBody RigidBody | ||
1241 | { | ||
1242 | get { return _flatPlanet; } | ||
1243 | } | ||
1244 | |||
1175 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) | 1245 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) |
1176 | { | 1246 | { |
1177 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY / 2, BulletXScene.MaxXY/2, 0); | 1247 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); |
1178 | _staticVelocity = new PhysicsVector(); | 1248 | _staticVelocity = new PhysicsVector(); |
1179 | _staticOrientation = AxiomQuaternion.Identity; | 1249 | _staticOrientation = AxiomQuaternion.Identity; |
1180 | _mass = 0; //No active | 1250 | _mass = 0; //No active |
@@ -1193,40 +1263,45 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1193 | try | 1263 | try |
1194 | { | 1264 | { |
1195 | _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(_staticPosition); | 1265 | _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(_staticPosition); |
1196 | CollisionShape _collisionShape = new HeightfieldTerrainShape(BulletXScene.MaxXY, BulletXScene.MaxXY, _heightField, (float)BulletXScene.MaxZ, 2, true, false); | 1266 | CollisionShape _collisionShape = |
1267 | new HeightfieldTerrainShape(BulletXScene.MaxXY, BulletXScene.MaxXY, _heightField, | ||
1268 | (float) BulletXScene.MaxZ, 2, true, false); | ||
1197 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); | 1269 | DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); |
1198 | MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); | 1270 | Vector3 _localInertia = new Vector3(); |
1199 | //_collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 | 1271 | //_collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 |
1200 | _flatPlanet = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); | 1272 | _flatPlanet = |
1273 | new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, | ||
1274 | _angularDamping, _friction, _restitution); | ||
1201 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition | 1275 | //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition |
1202 | MonoXnaCompactMaths.Vector3 _vDebugTranslation; | 1276 | Vector3 _vDebugTranslation; |
1203 | _vDebugTranslation = _startTransform.Translation - _flatPlanet.CenterOfMassPosition; | 1277 | _vDebugTranslation = _startTransform.Translation - _flatPlanet.CenterOfMassPosition; |
1204 | _flatPlanet.Translate(_vDebugTranslation); | 1278 | _flatPlanet.Translate(_vDebugTranslation); |
1205 | parent_scene.ddWorld.AddRigidBody(_flatPlanet); | 1279 | parent_scene.ddWorld.AddRigidBody(_flatPlanet); |
1206 | } | 1280 | } |
1207 | catch (Exception ex) | 1281 | catch (Exception ex) |
1208 | { | 1282 | { |
1209 | this._parentscene.BulletXMessage(ex.Message, true); | 1283 | _parentscene.BulletXMessage(ex.Message, true); |
1210 | } | 1284 | } |
1211 | } | 1285 | } |
1212 | this._parentscene.BulletXMessage("BulletXPlanet created.", false); | 1286 | _parentscene.BulletXMessage("BulletXPlanet created.", false); |
1213 | } | 1287 | } |
1214 | internal float HeightValue(MonoXnaCompactMaths.Vector3 position) | 1288 | |
1289 | internal float HeightValue(Vector3 position) | ||
1215 | { | 1290 | { |
1216 | int li_x, li_y; | 1291 | int li_x, li_y; |
1217 | float height; | 1292 | float height; |
1218 | li_x = (int)Math.Round(position.X); | 1293 | li_x = (int) Math.Round(position.X); |
1219 | if (li_x < 0) li_x = 0; | 1294 | if (li_x < 0) li_x = 0; |
1220 | if (li_x >= BulletXScene.MaxXY) li_x = BulletXScene.MaxXY - 1; | 1295 | if (li_x >= BulletXScene.MaxXY) li_x = BulletXScene.MaxXY - 1; |
1221 | li_y = (int)Math.Round(position.Y); | 1296 | li_y = (int) Math.Round(position.Y); |
1222 | if (li_y < 0) li_y = 0; | 1297 | if (li_y < 0) li_y = 0; |
1223 | if (li_y >= BulletXScene.MaxXY) li_y = BulletXScene.MaxXY - 1; | 1298 | if (li_y >= BulletXScene.MaxXY) li_y = BulletXScene.MaxXY - 1; |
1224 | 1299 | ||
1225 | height = ((HeightfieldTerrainShape)this._flatPlanet.CollisionShape).getHeightFieldValue(li_x, li_y); | 1300 | height = ((HeightfieldTerrainShape) _flatPlanet.CollisionShape).getHeightFieldValue(li_x, li_y); |
1226 | if (height < 0) height = 0; | 1301 | if (height < 0) height = 0; |
1227 | else if (height > BulletXScene.MaxZ) height = BulletXScene.MaxZ; | 1302 | else if (height > BulletXScene.MaxZ) height = BulletXScene.MaxZ; |
1228 | 1303 | ||
1229 | return height; | 1304 | return height; |
1230 | } | 1305 | } |
1231 | } | 1306 | } |
1232 | } | 1307 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs index 2355e91..c213b64 100644 --- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs | |||
@@ -27,24 +27,26 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // Information about this assembly is defined by the following | 31 | // Information about this assembly is defined by the following |
31 | // attributes. | 32 | // attributes. |
32 | // | 33 | // |
33 | // change them to the information which is associated with the assembly | 34 | // change them to the information which is associated with the assembly |
34 | // you compile. | 35 | // you compile. |
35 | 36 | ||
36 | [assembly: AssemblyTitle("PhysicsManager")] | 37 | [assembly : AssemblyTitle("PhysicsManager")] |
37 | [assembly: AssemblyDescription("")] | 38 | [assembly : AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 39 | [assembly : AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 40 | [assembly : AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("PhysicsManager")] | 41 | [assembly : AssemblyProduct("PhysicsManager")] |
41 | [assembly: AssemblyCopyright("")] | 42 | [assembly : AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 43 | [assembly : AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 44 | [assembly : AssemblyCulture("")] |
44 | 45 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 46 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 48 | |
49 | [assembly : ComVisible(false)] | ||
48 | 50 | ||
49 | // The assembly version has following format : | 51 | // The assembly version has following format : |
50 | // | 52 | // |
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices; | |||
53 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
55 | 57 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 58 | [assembly : AssemblyVersion("1.0.*")] \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 0fa7455..b59c13a 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -30,7 +30,9 @@ using Axiom.Math; | |||
30 | namespace OpenSim.Region.Physics.Manager | 30 | namespace OpenSim.Region.Physics.Manager |
31 | { | 31 | { |
32 | public delegate void PositionUpdate(PhysicsVector position); | 32 | public delegate void PositionUpdate(PhysicsVector position); |
33 | |||
33 | public delegate void VelocityUpdate(PhysicsVector velocity); | 34 | public delegate void VelocityUpdate(PhysicsVector velocity); |
35 | |||
34 | public delegate void OrientationUpdate(Quaternion orientation); | 36 | public delegate void OrientationUpdate(Quaternion orientation); |
35 | 37 | ||
36 | public abstract class PhysicsActor | 38 | public abstract class PhysicsActor |
@@ -43,52 +45,22 @@ namespace OpenSim.Region.Physics.Manager | |||
43 | 45 | ||
44 | public static PhysicsActor Null | 46 | public static PhysicsActor Null |
45 | { | 47 | { |
46 | get | 48 | get { return new NullPhysicsActor(); } |
47 | { | ||
48 | return new NullPhysicsActor(); | ||
49 | } | ||
50 | } | 49 | } |
51 | 50 | ||
52 | public abstract PhysicsVector Size | 51 | public abstract PhysicsVector Size { get; set; } |
53 | { | ||
54 | get; | ||
55 | set; | ||
56 | } | ||
57 | 52 | ||
58 | public abstract PhysicsVector Position | 53 | public abstract PhysicsVector Position { get; set; } |
59 | { | ||
60 | get; | ||
61 | set; | ||
62 | } | ||
63 | 54 | ||
64 | public abstract PhysicsVector Velocity | 55 | public abstract PhysicsVector Velocity { get; set; } |
65 | { | ||
66 | get; | ||
67 | set; | ||
68 | } | ||
69 | 56 | ||
70 | public abstract PhysicsVector Acceleration | 57 | public abstract PhysicsVector Acceleration { get; } |
71 | { | ||
72 | get; | ||
73 | } | ||
74 | 58 | ||
75 | public abstract Quaternion Orientation | 59 | public abstract Quaternion Orientation { get; set; } |
76 | { | ||
77 | get; | ||
78 | set; | ||
79 | } | ||
80 | 60 | ||
81 | public abstract bool Flying | 61 | public abstract bool Flying { get; set; } |
82 | { | ||
83 | get; | ||
84 | set; | ||
85 | } | ||
86 | 62 | ||
87 | public abstract bool Kinematic | 63 | public abstract bool Kinematic { get; set; } |
88 | { | ||
89 | get; | ||
90 | set; | ||
91 | } | ||
92 | 64 | ||
93 | public abstract void AddForce(PhysicsVector force); | 65 | public abstract void AddForce(PhysicsVector force); |
94 | 66 | ||
@@ -99,50 +71,26 @@ namespace OpenSim.Region.Physics.Manager | |||
99 | { | 71 | { |
100 | public override PhysicsVector Position | 72 | public override PhysicsVector Position |
101 | { | 73 | { |
102 | get | 74 | get { return PhysicsVector.Zero; } |
103 | { | 75 | set { return; } |
104 | return PhysicsVector.Zero; | ||
105 | } | ||
106 | set | ||
107 | { | ||
108 | return; | ||
109 | } | ||
110 | } | 76 | } |
111 | 77 | ||
112 | public override PhysicsVector Size | 78 | public override PhysicsVector Size |
113 | { | 79 | { |
114 | get | 80 | get { return PhysicsVector.Zero; } |
115 | { | 81 | set { return; } |
116 | return PhysicsVector.Zero; | ||
117 | } | ||
118 | set | ||
119 | { | ||
120 | return; | ||
121 | } | ||
122 | } | 82 | } |
123 | 83 | ||
124 | public override PhysicsVector Velocity | 84 | public override PhysicsVector Velocity |
125 | { | 85 | { |
126 | get | 86 | get { return PhysicsVector.Zero; } |
127 | { | 87 | set { return; } |
128 | return PhysicsVector.Zero; | ||
129 | } | ||
130 | set | ||
131 | { | ||
132 | return; | ||
133 | } | ||
134 | } | 88 | } |
135 | 89 | ||
136 | public override Quaternion Orientation | 90 | public override Quaternion Orientation |
137 | { | 91 | { |
138 | get | 92 | get { return Quaternion.Identity; } |
139 | { | 93 | set { } |
140 | return Quaternion.Identity; | ||
141 | } | ||
142 | set | ||
143 | { | ||
144 | |||
145 | } | ||
146 | } | 94 | } |
147 | 95 | ||
148 | public override PhysicsVector Acceleration | 96 | public override PhysicsVector Acceleration |
@@ -152,26 +100,14 @@ namespace OpenSim.Region.Physics.Manager | |||
152 | 100 | ||
153 | public override bool Flying | 101 | public override bool Flying |
154 | { | 102 | { |
155 | get | 103 | get { return false; } |
156 | { | 104 | set { return; } |
157 | return false; | ||
158 | } | ||
159 | set | ||
160 | { | ||
161 | return; | ||
162 | } | ||
163 | } | 105 | } |
164 | 106 | ||
165 | public override bool Kinematic | 107 | public override bool Kinematic |
166 | { | 108 | { |
167 | get | 109 | get { return true; } |
168 | { | 110 | set { return; } |
169 | return true; | ||
170 | } | ||
171 | set | ||
172 | { | ||
173 | return; | ||
174 | } | ||
175 | } | 111 | } |
176 | 112 | ||
177 | public override void AddForce(PhysicsVector force) | 113 | public override void AddForce(PhysicsVector force) |
@@ -184,4 +120,4 @@ namespace OpenSim.Region.Physics.Manager | |||
184 | return; | 120 | return; |
185 | } | 121 | } |
186 | } | 122 | } |
187 | } | 123 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 81bc938..09ebf29 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | |||
@@ -33,77 +33,77 @@ using OpenSim.Framework.Console; | |||
33 | 33 | ||
34 | namespace OpenSim.Region.Physics.Manager | 34 | namespace OpenSim.Region.Physics.Manager |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Description of MyClass. | 37 | /// Description of MyClass. |
38 | /// </summary> | 38 | /// </summary> |
39 | public class PhysicsPluginManager | 39 | public class PhysicsPluginManager |
40 | { | 40 | { |
41 | private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); | 41 | private Dictionary<string, IPhysicsPlugin> _plugins = new Dictionary<string, IPhysicsPlugin>(); |
42 | 42 | ||
43 | public PhysicsPluginManager() | 43 | public PhysicsPluginManager() |
44 | { | 44 | { |
45 | 45 | } | |
46 | } | 46 | |
47 | 47 | public PhysicsScene GetPhysicsScene(string engineName) | |
48 | public PhysicsScene GetPhysicsScene(string engineName) | 48 | { |
49 | { | ||
50 | if (String.IsNullOrEmpty(engineName)) | 49 | if (String.IsNullOrEmpty(engineName)) |
51 | { | 50 | { |
52 | return PhysicsScene.Null; | 51 | return PhysicsScene.Null; |
53 | } | 52 | } |
54 | 53 | ||
55 | if(_plugins.ContainsKey(engineName)) | 54 | if (_plugins.ContainsKey(engineName)) |
56 | { | 55 | { |
57 | MainLog.Instance.Verbose("PHYSICS","creating "+engineName); | 56 | MainLog.Instance.Verbose("PHYSICS", "creating " + engineName); |
58 | return _plugins[engineName].GetScene(); | 57 | return _plugins[engineName].GetScene(); |
59 | } | 58 | } |
60 | else | 59 | else |
61 | { | 60 | { |
62 | MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", engineName); | 61 | MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", engineName); |
63 | throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); | 62 | throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", engineName)); |
64 | } | 63 | } |
65 | } | 64 | } |
66 | 65 | ||
67 | public void LoadPlugins() | 66 | public void LoadPlugins() |
68 | { | 67 | { |
69 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics"); | 68 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics"); |
70 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | 69 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); |
71 | 70 | ||
72 | 71 | ||
73 | for(int i= 0; i<pluginFiles.Length; i++) | 72 | for (int i = 0; i < pluginFiles.Length; i++) |
74 | { | 73 | { |
75 | this.AddPlugin(pluginFiles[i]); | 74 | AddPlugin(pluginFiles[i]); |
76 | } | 75 | } |
77 | } | 76 | } |
78 | 77 | ||
79 | private void AddPlugin(string FileName) | 78 | private void AddPlugin(string FileName) |
80 | { | 79 | { |
81 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 80 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
82 | 81 | ||
83 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 82 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
84 | { | 83 | { |
85 | if (pluginType.IsPublic) | 84 | if (pluginType.IsPublic) |
86 | { | 85 | { |
87 | if (!pluginType.IsAbstract) | 86 | if (!pluginType.IsAbstract) |
88 | { | 87 | { |
89 | Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | 88 | Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); |
90 | 89 | ||
91 | if (typeInterface != null) | 90 | if (typeInterface != null) |
92 | { | 91 | { |
93 | IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 92 | IPhysicsPlugin plug = |
94 | plug.Init(); | 93 | (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
95 | this._plugins.Add(plug.GetName(),plug); | 94 | plug.Init(); |
96 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS","Added physics engine: " + plug.GetName()); | 95 | _plugins.Add(plug.GetName(), plug); |
97 | 96 | MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName()); | |
98 | } | 97 | } |
99 | 98 | ||
100 | typeInterface = null; | 99 | typeInterface = null; |
101 | } | 100 | } |
102 | } | 101 | } |
103 | } | 102 | } |
104 | 103 | ||
105 | pluginAssembly = null; | 104 | pluginAssembly = null; |
106 | } | 105 | } |
106 | |||
107 | //--- | 107 | //--- |
108 | public static void PhysicsPluginMessage(string message, bool isWarning) | 108 | public static void PhysicsPluginMessage(string message, bool isWarning) |
109 | { | 109 | { |
@@ -116,14 +116,15 @@ namespace OpenSim.Region.Physics.Manager | |||
116 | MainLog.Instance.Verbose("PHYSICS", message); | 116 | MainLog.Instance.Verbose("PHYSICS", message); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | |||
119 | //--- | 120 | //--- |
120 | } | 121 | } |
121 | 122 | ||
122 | public interface IPhysicsPlugin | 123 | public interface IPhysicsPlugin |
123 | { | 124 | { |
124 | bool Init(); | 125 | bool Init(); |
125 | PhysicsScene GetScene(); | 126 | PhysicsScene GetScene(); |
126 | string GetName(); | 127 | string GetName(); |
127 | void Dispose(); | 128 | void Dispose(); |
128 | } | 129 | } |
129 | } | 130 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 9ab2997..3f08234 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -25,9 +25,9 @@ | |||
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 Axiom.Math; | ||
28 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
29 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
30 | using Axiom.Math; | ||
31 | 31 | ||
32 | namespace OpenSim.Region.Physics.Manager | 32 | namespace OpenSim.Region.Physics.Manager |
33 | { | 33 | { |
@@ -35,10 +35,7 @@ namespace OpenSim.Region.Physics.Manager | |||
35 | { | 35 | { |
36 | public static PhysicsScene Null | 36 | public static PhysicsScene Null |
37 | { | 37 | { |
38 | get | 38 | get { return new NullPhysicsScene(); } |
39 | { | ||
40 | return new NullPhysicsScene(); | ||
41 | } | ||
42 | } | 39 | } |
43 | 40 | ||
44 | public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position); | 41 | public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position); |
@@ -47,7 +44,8 @@ namespace OpenSim.Region.Physics.Manager | |||
47 | 44 | ||
48 | public abstract void RemovePrim(PhysicsActor prim); | 45 | public abstract void RemovePrim(PhysicsActor prim); |
49 | 46 | ||
50 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation); | 47 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
48 | PhysicsVector size, Quaternion rotation); | ||
51 | 49 | ||
52 | public abstract void Simulate(float timeStep); | 50 | public abstract void Simulate(float timeStep); |
53 | 51 | ||
@@ -57,10 +55,7 @@ namespace OpenSim.Region.Physics.Manager | |||
57 | 55 | ||
58 | public abstract void DeleteTerrain(); | 56 | public abstract void DeleteTerrain(); |
59 | 57 | ||
60 | public abstract bool IsThreaded | 58 | public abstract bool IsThreaded { get; } |
61 | { | ||
62 | get; | ||
63 | } | ||
64 | 59 | ||
65 | private class NullPhysicsScene : PhysicsScene | 60 | private class NullPhysicsScene : PhysicsScene |
66 | { | 61 | { |
@@ -74,12 +69,10 @@ namespace OpenSim.Region.Physics.Manager | |||
74 | 69 | ||
75 | public override void RemoveAvatar(PhysicsActor actor) | 70 | public override void RemoveAvatar(PhysicsActor actor) |
76 | { | 71 | { |
77 | |||
78 | } | 72 | } |
79 | 73 | ||
80 | public override void RemovePrim(PhysicsActor prim) | 74 | public override void RemovePrim(PhysicsActor prim) |
81 | { | 75 | { |
82 | |||
83 | } | 76 | } |
84 | 77 | ||
85 | /* | 78 | /* |
@@ -89,7 +82,9 @@ namespace OpenSim.Region.Physics.Manager | |||
89 | return PhysicsActor.Null; | 82 | return PhysicsActor.Null; |
90 | } | 83 | } |
91 | */ | 84 | */ |
92 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) | 85 | |
86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | ||
87 | PhysicsVector size, Quaternion rotation) | ||
93 | { | 88 | { |
94 | MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); | 89 | MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); |
95 | return PhysicsActor.Null; | 90 | return PhysicsActor.Null; |
@@ -97,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager | |||
97 | 92 | ||
98 | public override void Simulate(float timeStep) | 93 | public override void Simulate(float timeStep) |
99 | { | 94 | { |
100 | m_workIndicator = (m_workIndicator + 1) % 10; | 95 | m_workIndicator = (m_workIndicator + 1)%10; |
101 | 96 | ||
102 | //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); | 97 | //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); |
103 | } | 98 | } |
@@ -114,7 +109,6 @@ namespace OpenSim.Region.Physics.Manager | |||
114 | 109 | ||
115 | public override void DeleteTerrain() | 110 | public override void DeleteTerrain() |
116 | { | 111 | { |
117 | |||
118 | } | 112 | } |
119 | 113 | ||
120 | public override bool IsThreaded | 114 | public override bool IsThreaded |
@@ -123,4 +117,4 @@ namespace OpenSim.Region.Physics.Manager | |||
123 | } | 117 | } |
124 | } | 118 | } |
125 | } | 119 | } |
126 | } | 120 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index 722c5dd..7de37e4 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs | |||
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Physics.Manager | |||
35 | 35 | ||
36 | public PhysicsVector() | 36 | public PhysicsVector() |
37 | { | 37 | { |
38 | |||
39 | } | 38 | } |
40 | 39 | ||
41 | public PhysicsVector(float x, float y, float z) | 40 | public PhysicsVector(float x, float y, float z) |
@@ -49,7 +48,7 @@ namespace OpenSim.Region.Physics.Manager | |||
49 | 48 | ||
50 | public override string ToString() | 49 | public override string ToString() |
51 | { | 50 | { |
52 | return "<" + this.X + "," + this.Y + "," + this.Z + ">"; | 51 | return "<" + X + "," + Y + "," + Z + ">"; |
53 | } | 52 | } |
54 | } | 53 | } |
55 | } | 54 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs index 3f840cc..d110a17 100644 --- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs | |||
@@ -27,24 +27,26 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // Information about this assembly is defined by the following | 31 | // Information about this assembly is defined by the following |
31 | // attributes. | 32 | // attributes. |
32 | // | 33 | // |
33 | // change them to the information which is associated with the assembly | 34 | // change them to the information which is associated with the assembly |
34 | // you compile. | 35 | // you compile. |
35 | 36 | ||
36 | [assembly: AssemblyTitle("RealPhysXplugin")] | 37 | [assembly : AssemblyTitle("RealPhysXplugin")] |
37 | [assembly: AssemblyDescription("")] | 38 | [assembly : AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 39 | [assembly : AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 40 | [assembly : AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("RealPhysXplugin")] | 41 | [assembly : AssemblyProduct("RealPhysXplugin")] |
41 | [assembly: AssemblyCopyright("")] | 42 | [assembly : AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 43 | [assembly : AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 44 | [assembly : AssemblyCulture("")] |
44 | 45 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 46 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 48 | |
49 | [assembly : ComVisible(false)] | ||
48 | 50 | ||
49 | // The assembly version has following format : | 51 | // The assembly version has following format : |
50 | // | 52 | // |
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices; | |||
53 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
55 | 57 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 58 | [assembly : AssemblyVersion("1.0.*")] \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs index 2ace097..13184e2 100644 --- a/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs | |||
@@ -27,10 +27,9 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Globalization; | ||
31 | using System.Diagnostics; | ||
32 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
33 | 31 | using System.Diagnostics; | |
32 | using System.Globalization; | ||
34 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
35 | 34 | ||
36 | public class Vertex : IComparable<Vertex> | 35 | public class Vertex : IComparable<Vertex> |
@@ -76,8 +75,6 @@ public class Vertex : IComparable<Vertex> | |||
76 | { | 75 | { |
77 | return me.CompareTo(other) < 0; | 76 | return me.CompareTo(other) < 0; |
78 | } | 77 | } |
79 | |||
80 | |||
81 | } | 78 | } |
82 | 79 | ||
83 | public class Simplex : IComparable<Simplex> | 80 | public class Simplex : IComparable<Simplex> |
@@ -122,8 +119,7 @@ public class Simplex : IComparable<Simplex> | |||
122 | 119 | ||
123 | return 0; | 120 | return 0; |
124 | } | 121 | } |
125 | 122 | } ; | |
126 | }; | ||
127 | 123 | ||
128 | public class Triangle | 124 | public class Triangle |
129 | { | 125 | { |
@@ -131,9 +127,9 @@ public class Triangle | |||
131 | public Vertex v2; | 127 | public Vertex v2; |
132 | public Vertex v3; | 128 | public Vertex v3; |
133 | 129 | ||
134 | float radius_square; | 130 | private float radius_square; |
135 | float cx; | 131 | private float cx; |
136 | float cy; | 132 | private float cy; |
137 | 133 | ||
138 | public Triangle(Vertex _v1, Vertex _v2, Vertex _v3) | 134 | public Triangle(Vertex _v1, Vertex _v2, Vertex _v3) |
139 | { | 135 | { |
@@ -149,18 +145,18 @@ public class Triangle | |||
149 | float dx, dy; | 145 | float dx, dy; |
150 | float dd; | 146 | float dd; |
151 | 147 | ||
152 | dx = x - this.cx; | 148 | dx = x - cx; |
153 | dy = y - this.cy; | 149 | dy = y - cy; |
154 | 150 | ||
155 | dd = dx * dx + dy * dy; | 151 | dd = dx*dx + dy*dy; |
156 | if (dd < this.radius_square) | 152 | if (dd < radius_square) |
157 | return true; | 153 | return true; |
158 | else | 154 | else |
159 | return false; | 155 | return false; |
160 | } | 156 | } |
161 | 157 | ||
162 | 158 | ||
163 | void CalcCircle() | 159 | private void CalcCircle() |
164 | { | 160 | { |
165 | // Calculate the center and the radius of a circle given by three points p1, p2, p3 | 161 | // Calculate the center and the radius of a circle given by three points p1, p2, p3 |
166 | // It is assumed, that the triangles vertices are already set correctly | 162 | // It is assumed, that the triangles vertices are already set correctly |
@@ -198,8 +194,8 @@ public class Triangle | |||
198 | p3y = v3.point.Y; | 194 | p3y = v3.point.Y; |
199 | 195 | ||
200 | /* calc helping values first */ | 196 | /* calc helping values first */ |
201 | c1 = (p1x * p1x + p1y * p1y - p2x * p2x - p2y * p2y) / 2; | 197 | c1 = (p1x*p1x + p1y*p1y - p2x*p2x - p2y*p2y)/2; |
202 | c2 = (p1x * p1x + p1y * p1y - p3x * p3x - p3y * p3y) / 2; | 198 | c2 = (p1x*p1x + p1y*p1y - p3x*p3x - p3y*p3y)/2; |
203 | 199 | ||
204 | v1x = p1x - p2x; | 200 | v1x = p1x - p2x; |
205 | v1y = p1y - p2y; | 201 | v1y = p1y - p2y; |
@@ -207,35 +203,34 @@ public class Triangle | |||
207 | v2x = p1x - p3x; | 203 | v2x = p1x - p3x; |
208 | v2y = p1y - p3y; | 204 | v2y = p1y - p3y; |
209 | 205 | ||
210 | z = (c1 * v2x - c2 * v1x); | 206 | z = (c1*v2x - c2*v1x); |
211 | n = (v1y * v2x - v2y * v1x); | 207 | n = (v1y*v2x - v2y*v1x); |
212 | 208 | ||
213 | if (n == 0.0) // This is no triangle, i.e there are (at least) two points at the same location | 209 | if (n == 0.0) // This is no triangle, i.e there are (at least) two points at the same location |
214 | { | 210 | { |
215 | radius_square = 0.0f; | 211 | radius_square = 0.0f; |
216 | return; | 212 | return; |
217 | } | 213 | } |
218 | 214 | ||
219 | this.cy = (float)(z / n); | 215 | cy = (float) (z/n); |
220 | 216 | ||
221 | if (v2x != 0.0) | 217 | if (v2x != 0.0) |
222 | { | 218 | { |
223 | this.cx = (float)((c2 - v2y * this.cy) / v2x); | 219 | cx = (float) ((c2 - v2y*cy)/v2x); |
224 | } | 220 | } |
225 | else if (v1x != 0.0) | 221 | else if (v1x != 0.0) |
226 | { | 222 | { |
227 | this.cx = (float)((c1 - v1y * this.cy) / v1x); | 223 | cx = (float) ((c1 - v1y*cy)/v1x); |
228 | } | 224 | } |
229 | else | 225 | else |
230 | { | 226 | { |
231 | Debug.Assert(false, "Malformed triangle"); /* Both terms zero means nothing good */ | 227 | Debug.Assert(false, "Malformed triangle"); /* Both terms zero means nothing good */ |
232 | } | 228 | } |
233 | 229 | ||
234 | rx = (p1x - this.cx); | 230 | rx = (p1x - cx); |
235 | ry = (p1y - this.cy); | 231 | ry = (p1y - cy); |
236 | |||
237 | this.radius_square = (float)(rx * rx + ry * ry); | ||
238 | 232 | ||
233 | radius_square = (float) (rx*rx + ry*ry); | ||
239 | } | 234 | } |
240 | 235 | ||
241 | public List<Simplex> GetSimplices() | 236 | public List<Simplex> GetSimplices() |
@@ -254,17 +249,18 @@ public class Triangle | |||
254 | 249 | ||
255 | public override String ToString() | 250 | public override String ToString() |
256 | { | 251 | { |
257 | |||
258 | NumberFormatInfo nfi = new NumberFormatInfo(); | 252 | NumberFormatInfo nfi = new NumberFormatInfo(); |
259 | nfi.CurrencyDecimalDigits = 2; | 253 | nfi.CurrencyDecimalDigits = 2; |
260 | nfi.CurrencyDecimalSeparator = "."; | 254 | nfi.CurrencyDecimalSeparator = "."; |
261 | 255 | ||
262 | String s1 = "<" + v1.point.X.ToString(nfi) + "," + v1.point.Y.ToString(nfi) + "," + v1.point.Z.ToString(nfi) + ">"; | 256 | String s1 = "<" + v1.point.X.ToString(nfi) + "," + v1.point.Y.ToString(nfi) + "," + v1.point.Z.ToString(nfi) + |
263 | String s2 = "<" + v2.point.X.ToString(nfi) + "," + v2.point.Y.ToString(nfi) + "," + v2.point.Z.ToString(nfi) + ">"; | 257 | ">"; |
264 | String s3 = "<" + v3.point.X.ToString(nfi) + "," + v3.point.Y.ToString(nfi) + "," + v3.point.Z.ToString(nfi) + ">"; | 258 | String s2 = "<" + v2.point.X.ToString(nfi) + "," + v2.point.Y.ToString(nfi) + "," + v2.point.Z.ToString(nfi) + |
259 | ">"; | ||
260 | String s3 = "<" + v3.point.X.ToString(nfi) + "," + v3.point.Y.ToString(nfi) + "," + v3.point.Z.ToString(nfi) + | ||
261 | ">"; | ||
265 | 262 | ||
266 | return s1 + ";" + s2 + ";" + s3; | 263 | return s1 + ";" + s2 + ";" + s3; |
267 | |||
268 | } | 264 | } |
269 | 265 | ||
270 | public PhysicsVector getNormal() | 266 | public PhysicsVector getNormal() |
@@ -281,12 +277,12 @@ public class Triangle | |||
281 | // Cross product for normal | 277 | // Cross product for normal |
282 | PhysicsVector n = new PhysicsVector(); | 278 | PhysicsVector n = new PhysicsVector(); |
283 | float nx, ny, nz; | 279 | float nx, ny, nz; |
284 | n.X = e1.Y * e2.Z - e1.Z * e2.Y; | 280 | n.X = e1.Y*e2.Z - e1.Z*e2.Y; |
285 | n.Y = e1.Z * e2.X - e1.X * e2.Z; | 281 | n.Y = e1.Z*e2.X - e1.X*e2.Z; |
286 | n.Z = e1.X * e2.Y - e1.Y * e2.X; | 282 | n.Z = e1.X*e2.Y - e1.Y*e2.X; |
287 | 283 | ||
288 | // Length | 284 | // Length |
289 | float l = (float)Math.Sqrt(n.X * n.X + n.Y * n.Y + n.Z * n.Z); | 285 | float l = (float) Math.Sqrt(n.X*n.X + n.Y*n.Y + n.Z*n.Z); |
290 | 286 | ||
291 | // Normalized "normal" | 287 | // Normalized "normal" |
292 | n.X /= l; | 288 | n.X /= l; |
@@ -303,6 +299,4 @@ public class Triangle | |||
303 | v1 = v2; | 299 | v1 = v2; |
304 | v2 = vt; | 300 | v2 = vt; |
305 | } | 301 | } |
306 | } | 302 | } \ No newline at end of file |
307 | |||
308 | |||
diff --git a/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs index dd18e24..46de15e 100644 --- a/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs | |||
@@ -27,12 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Globalization; | ||
31 | using System.Diagnostics; | ||
32 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
33 | using System.Text; | ||
34 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
35 | |||
36 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
37 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
38 | 34 | ||
@@ -75,14 +71,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
75 | 71 | ||
76 | public float[] getVertexListAsFloat() | 72 | public float[] getVertexListAsFloat() |
77 | { | 73 | { |
78 | float[] result = new float[vertices.Count * 3]; | 74 | float[] result = new float[vertices.Count*3]; |
79 | for (int i = 0; i < vertices.Count; i++) | 75 | for (int i = 0; i < vertices.Count; i++) |
80 | { | 76 | { |
81 | Vertex v = vertices[i]; | 77 | Vertex v = vertices[i]; |
82 | PhysicsVector point = v.point; | 78 | PhysicsVector point = v.point; |
83 | result[3 * i + 0] = point.X; | 79 | result[3*i + 0] = point.X; |
84 | result[3 * i + 1] = point.Y; | 80 | result[3*i + 1] = point.Y; |
85 | result[3 * i + 2] = point.Z; | 81 | result[3*i + 2] = point.Z; |
86 | } | 82 | } |
87 | GCHandle.Alloc(result, GCHandleType.Pinned); | 83 | GCHandle.Alloc(result, GCHandleType.Pinned); |
88 | return result; | 84 | return result; |
@@ -90,13 +86,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
90 | 86 | ||
91 | public int[] getIndexListAsInt() | 87 | public int[] getIndexListAsInt() |
92 | { | 88 | { |
93 | int[] result = new int[triangles.Count * 3]; | 89 | int[] result = new int[triangles.Count*3]; |
94 | for (int i = 0; i < triangles.Count; i++) | 90 | for (int i = 0; i < triangles.Count; i++) |
95 | { | 91 | { |
96 | Triangle t = triangles[i]; | 92 | Triangle t = triangles[i]; |
97 | result[3 * i + 0] = vertices.IndexOf(t.v1); | 93 | result[3*i + 0] = vertices.IndexOf(t.v1); |
98 | result[3 * i + 1] = vertices.IndexOf(t.v2); | 94 | result[3*i + 1] = vertices.IndexOf(t.v2); |
99 | result[3 * i + 2] = vertices.IndexOf(t.v3); | 95 | result[3*i + 2] = vertices.IndexOf(t.v3); |
100 | } | 96 | } |
101 | GCHandle.Alloc(result, GCHandleType.Pinned); | 97 | GCHandle.Alloc(result, GCHandleType.Pinned); |
102 | return result; | 98 | return result; |
@@ -110,16 +106,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
110 | 106 | ||
111 | foreach (Triangle t in newMesh.triangles) | 107 | foreach (Triangle t in newMesh.triangles) |
112 | Add(t); | 108 | Add(t); |
113 | |||
114 | } | 109 | } |
115 | } | 110 | } |
116 | 111 | ||
117 | 112 | ||
118 | |||
119 | public class Meshmerizer | 113 | public class Meshmerizer |
120 | { | 114 | { |
121 | 115 | private static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v) | |
122 | static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v) | ||
123 | { | 116 | { |
124 | List<Triangle> influenced = new List<Triangle>(); | 117 | List<Triangle> influenced = new List<Triangle>(); |
125 | foreach (Triangle t in triangles) | 118 | foreach (Triangle t in triangles) |
@@ -133,9 +126,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
133 | } | 126 | } |
134 | return influenced; | 127 | return influenced; |
135 | } | 128 | } |
136 | 129 | ||
137 | 130 | ||
138 | static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles, List<int> innerBorders) | 131 | private static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles, |
132 | List<int> innerBorders) | ||
139 | { | 133 | { |
140 | // This is a variant of the delaunay algorithm | 134 | // This is a variant of the delaunay algorithm |
141 | // each time a new vertex is inserted, all triangles that are influenced by it are deleted | 135 | // each time a new vertex is inserted, all triangles that are influenced by it are deleted |
@@ -143,7 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
143 | // It is not very time efficient but easy to implement. | 137 | // It is not very time efficient but easy to implement. |
144 | 138 | ||
145 | int iCurrentVertex; | 139 | int iCurrentVertex; |
146 | int iMaxVertex=vertices.Count; | 140 | int iMaxVertex = vertices.Count; |
147 | for (iCurrentVertex = usedForSeed; iCurrentVertex < iMaxVertex; iCurrentVertex++) | 141 | for (iCurrentVertex = usedForSeed; iCurrentVertex < iMaxVertex; iCurrentVertex++) |
148 | { | 142 | { |
149 | // Background: A triangle mesh fulfills the delaunay condition if (iff!) | 143 | // Background: A triangle mesh fulfills the delaunay condition if (iff!) |
@@ -154,8 +148,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
154 | // do not fulfill this condition with respect to the new triangle | 148 | // do not fulfill this condition with respect to the new triangle |
155 | 149 | ||
156 | // Find the triangles that are influenced by the new vertex | 150 | // Find the triangles that are influenced by the new vertex |
157 | Vertex v=vertices[iCurrentVertex]; | 151 | Vertex v = vertices[iCurrentVertex]; |
158 | List<Triangle> influencedTriangles=FindInfluencedTriangles(triangles, v); | 152 | List<Triangle> influencedTriangles = FindInfluencedTriangles(triangles, v); |
159 | 153 | ||
160 | List<Simplex> simplices = new List<Simplex>(); | 154 | List<Simplex> simplices = new List<Simplex>(); |
161 | 155 | ||
@@ -175,10 +169,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
175 | // Look for duplicate simplices here. | 169 | // Look for duplicate simplices here. |
176 | // Remember, they are directly side by side in the list right now | 170 | // Remember, they are directly side by side in the list right now |
177 | int iSimplex; | 171 | int iSimplex; |
178 | List<Simplex> innerSimplices=new List<Simplex>(); | 172 | List<Simplex> innerSimplices = new List<Simplex>(); |
179 | for (iSimplex = 1; iSimplex < simplices.Count; iSimplex++) // Startindex=1, so we can refer backwards | 173 | for (iSimplex = 1; iSimplex < simplices.Count; iSimplex++) // Startindex=1, so we can refer backwards |
180 | { | 174 | { |
181 | if (simplices[iSimplex - 1].CompareTo(simplices[iSimplex])==0) | 175 | if (simplices[iSimplex - 1].CompareTo(simplices[iSimplex]) == 0) |
182 | { | 176 | { |
183 | innerSimplices.Add(simplices[iSimplex - 1]); | 177 | innerSimplices.Add(simplices[iSimplex - 1]); |
184 | innerSimplices.Add(simplices[iSimplex]); | 178 | innerSimplices.Add(simplices[iSimplex]); |
@@ -187,7 +181,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
187 | 181 | ||
188 | foreach (Simplex s in innerSimplices) | 182 | foreach (Simplex s in innerSimplices) |
189 | { | 183 | { |
190 | simplices.Remove(s); | 184 | simplices.Remove(s); |
191 | } | 185 | } |
192 | 186 | ||
193 | // each simplex still in the list belongs to the hull of the region in question | 187 | // each simplex still in the list belongs to the hull of the region in question |
@@ -210,7 +204,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
210 | foreach (Triangle t in triangles) | 204 | foreach (Triangle t in triangles) |
211 | { | 205 | { |
212 | if ( | 206 | if ( |
213 | innerBorders.Contains(vertices.IndexOf(t.v1)) | 207 | innerBorders.Contains(vertices.IndexOf(t.v1)) |
214 | && innerBorders.Contains(vertices.IndexOf(t.v2)) | 208 | && innerBorders.Contains(vertices.IndexOf(t.v2)) |
215 | && innerBorders.Contains(vertices.IndexOf(t.v3)) | 209 | && innerBorders.Contains(vertices.IndexOf(t.v3)) |
216 | ) | 210 | ) |
@@ -223,18 +217,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
223 | } | 217 | } |
224 | 218 | ||
225 | 219 | ||
226 | static Mesh CreateBoxMeshX(PrimitiveBaseShape primShape, PhysicsVector size) | 220 | private static Mesh CreateBoxMeshX(PrimitiveBaseShape primShape, PhysicsVector size) |
227 | // Builds the x (+ and -) surfaces of a box shaped prim | 221 | // Builds the x (+ and -) surfaces of a box shaped prim |
228 | { | 222 | { |
229 | UInt16 hollowFactor = primShape.ProfileHollow; | 223 | UInt16 hollowFactor = primShape.ProfileHollow; |
230 | Mesh meshMX = new Mesh(); | 224 | Mesh meshMX = new Mesh(); |
231 | 225 | ||
232 | 226 | ||
233 | // Surface 0, -X | 227 | // Surface 0, -X |
234 | meshMX.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 228 | meshMX.Add(new Vertex("-X-Y-Z", -size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f)); |
235 | meshMX.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 229 | meshMX.Add(new Vertex("-X+Y-Z", -size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f)); |
236 | meshMX.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 230 | meshMX.Add(new Vertex("-X-Y+Z", -size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f)); |
237 | meshMX.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 231 | meshMX.Add(new Vertex("-X+Y+Z", -size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f)); |
238 | 232 | ||
239 | meshMX.Add(new Triangle(meshMX.vertices[0], meshMX.vertices[2], meshMX.vertices[1])); | 233 | meshMX.Add(new Triangle(meshMX.vertices[0], meshMX.vertices[2], meshMX.vertices[1])); |
240 | meshMX.Add(new Triangle(meshMX.vertices[1], meshMX.vertices[2], meshMX.vertices[3])); | 234 | meshMX.Add(new Triangle(meshMX.vertices[1], meshMX.vertices[2], meshMX.vertices[3])); |
@@ -242,10 +236,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
242 | 236 | ||
243 | Mesh meshPX = new Mesh(); | 237 | Mesh meshPX = new Mesh(); |
244 | // Surface 1, +X | 238 | // Surface 1, +X |
245 | meshPX.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 239 | meshPX.Add(new Vertex("+X-Y-Z", +size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f)); |
246 | meshPX.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 240 | meshPX.Add(new Vertex("+X+Y-Z", +size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f)); |
247 | meshPX.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 241 | meshPX.Add(new Vertex("+X-Y+Z", +size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f)); |
248 | meshPX.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 242 | meshPX.Add(new Vertex("+X+Y+Z", +size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f)); |
249 | 243 | ||
250 | 244 | ||
251 | meshPX.Add(new Triangle(meshPX.vertices[0], meshPX.vertices[1], meshPX.vertices[2])); | 245 | meshPX.Add(new Triangle(meshPX.vertices[0], meshPX.vertices[1], meshPX.vertices[2])); |
@@ -254,17 +248,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
254 | 248 | ||
255 | if (hollowFactor > 0) | 249 | if (hollowFactor > 0) |
256 | { | 250 | { |
257 | float hollowFactorF = (float)hollowFactor / (float)50000; | 251 | float hollowFactorF = (float) hollowFactor/(float) 50000; |
258 | 252 | ||
259 | Vertex IPP; | 253 | Vertex IPP; |
260 | Vertex IPM; | 254 | Vertex IPM; |
261 | Vertex IMP; | 255 | Vertex IMP; |
262 | Vertex IMM; | 256 | Vertex IMM; |
263 | 257 | ||
264 | IPP = new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 258 | IPP = new Vertex("Inner-X+Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f); |
265 | IPM = new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 259 | IPM = new Vertex("Inner-X+Y-Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
266 | IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 260 | IMP = new Vertex("Inner-X-Y+Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f); |
267 | IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 261 | IMM = new Vertex("Inner-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
268 | 262 | ||
269 | meshMX.Add(IPP); | 263 | meshMX.Add(IPP); |
270 | meshMX.Add(IPM); | 264 | meshMX.Add(IPM); |
@@ -280,11 +274,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
280 | } | 274 | } |
281 | 275 | ||
282 | 276 | ||
283 | 277 | IPP = new Vertex("Inner+X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f); | |
284 | IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 278 | IPM = new Vertex("Inner+X+Y-Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
285 | IPM = new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 279 | IMP = new Vertex("Inner+X-Y+Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f); |
286 | IMP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 280 | IMM = new Vertex("Inner+X-Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
287 | IMM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | ||
288 | 281 | ||
289 | meshPX.Add(IPP); | 282 | meshPX.Add(IPP); |
290 | meshPX.Add(IPM); | 283 | meshPX.Add(IPM); |
@@ -308,18 +301,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
308 | } | 301 | } |
309 | 302 | ||
310 | 303 | ||
311 | 304 | private static Mesh CreateBoxMeshY(PrimitiveBaseShape primShape, PhysicsVector size) | |
312 | static Mesh CreateBoxMeshY(PrimitiveBaseShape primShape, PhysicsVector size) | 305 | // Builds the y (+ and -) surfaces of a box shaped prim |
313 | // Builds the y (+ and -) surfaces of a box shaped prim | ||
314 | { | 306 | { |
315 | UInt16 hollowFactor = primShape.ProfileHollow; | 307 | UInt16 hollowFactor = primShape.ProfileHollow; |
316 | 308 | ||
317 | // (M)inus Y | 309 | // (M)inus Y |
318 | Mesh MeshMY = new Mesh(); | 310 | Mesh MeshMY = new Mesh(); |
319 | MeshMY.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 311 | MeshMY.Add(new Vertex("-X-Y-Z", -size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f)); |
320 | MeshMY.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 312 | MeshMY.Add(new Vertex("+X-Y-Z", +size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f)); |
321 | MeshMY.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 313 | MeshMY.Add(new Vertex("-X-Y+Z", -size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f)); |
322 | MeshMY.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 314 | MeshMY.Add(new Vertex("+X-Y+Z", +size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f)); |
323 | 315 | ||
324 | MeshMY.Add(new Triangle(MeshMY.vertices[0], MeshMY.vertices[1], MeshMY.vertices[2])); | 316 | MeshMY.Add(new Triangle(MeshMY.vertices[0], MeshMY.vertices[1], MeshMY.vertices[2])); |
325 | MeshMY.Add(new Triangle(MeshMY.vertices[2], MeshMY.vertices[1], MeshMY.vertices[3])); | 317 | MeshMY.Add(new Triangle(MeshMY.vertices[2], MeshMY.vertices[1], MeshMY.vertices[3])); |
@@ -327,27 +319,27 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
327 | // (P)lus Y | 319 | // (P)lus Y |
328 | Mesh MeshPY = new Mesh(); | 320 | Mesh MeshPY = new Mesh(); |
329 | 321 | ||
330 | MeshPY.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 322 | MeshPY.Add(new Vertex("-X+Y-Z", -size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f)); |
331 | MeshPY.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 323 | MeshPY.Add(new Vertex("+X+Y-Z", +size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f)); |
332 | MeshPY.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 324 | MeshPY.Add(new Vertex("-X+Y+Z", -size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f)); |
333 | MeshPY.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 325 | MeshPY.Add(new Vertex("+X+Y+Z", +size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f)); |
334 | 326 | ||
335 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[0], MeshPY.vertices[2])); | 327 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[0], MeshPY.vertices[2])); |
336 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[2], MeshPY.vertices[3])); | 328 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[2], MeshPY.vertices[3])); |
337 | 329 | ||
338 | if (hollowFactor > 0) | 330 | if (hollowFactor > 0) |
339 | { | 331 | { |
340 | float hollowFactorF = (float)hollowFactor / (float)50000; | 332 | float hollowFactorF = (float) hollowFactor/(float) 50000; |
341 | 333 | ||
342 | Vertex IPP; | 334 | Vertex IPP; |
343 | Vertex IPM; | 335 | Vertex IPM; |
344 | Vertex IMP; | 336 | Vertex IMP; |
345 | Vertex IMM; | 337 | Vertex IMM; |
346 | 338 | ||
347 | IPP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 339 | IPP = new Vertex("Inner+X-Y+Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f); |
348 | IPM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 340 | IPM = new Vertex("Inner+X-Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
349 | IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 341 | IMP = new Vertex("Inner-X-Y+Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f); |
350 | IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 342 | IMM = new Vertex("Inner-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
351 | 343 | ||
352 | MeshMY.Add(IPP); | 344 | MeshMY.Add(IPP); |
353 | MeshMY.Add(IPM); | 345 | MeshMY.Add(IPM); |
@@ -363,11 +355,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
363 | } | 355 | } |
364 | 356 | ||
365 | 357 | ||
366 | 358 | IPP = new Vertex("Inner+X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f); | |
367 | IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 359 | IPM = new Vertex("Inner+X+Y-Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
368 | IPM=new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 360 | IMP = new Vertex("Inner-X+Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f); |
369 | IMP=new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 361 | IMM = new Vertex("Inner-X+Y-Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f); |
370 | IMM=new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | ||
371 | 362 | ||
372 | MeshPY.Add(IPP); | 363 | MeshPY.Add(IPP); |
373 | MeshPY.Add(IPM); | 364 | MeshPY.Add(IPM); |
@@ -381,9 +372,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
381 | { | 372 | { |
382 | PhysicsVector n = t.getNormal(); | 373 | PhysicsVector n = t.getNormal(); |
383 | } | 374 | } |
384 | |||
385 | |||
386 | |||
387 | } | 375 | } |
388 | 376 | ||
389 | 377 | ||
@@ -393,9 +381,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
393 | 381 | ||
394 | return result; | 382 | return result; |
395 | } | 383 | } |
396 | 384 | ||
397 | static Mesh CreateBoxMeshZ(PrimitiveBaseShape primShape, PhysicsVector size) | 385 | private static Mesh CreateBoxMeshZ(PrimitiveBaseShape primShape, PhysicsVector size) |
398 | // Builds the z (+ and -) surfaces of a box shaped prim | 386 | // Builds the z (+ and -) surfaces of a box shaped prim |
399 | { | 387 | { |
400 | UInt16 hollowFactor = primShape.ProfileHollow; | 388 | UInt16 hollowFactor = primShape.ProfileHollow; |
401 | 389 | ||
@@ -403,10 +391,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
403 | // (M)inus Z | 391 | // (M)inus Z |
404 | Mesh MZ = new Mesh(); | 392 | Mesh MZ = new Mesh(); |
405 | 393 | ||
406 | MZ.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 394 | MZ.Add(new Vertex("-X-Y-Z", -size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f)); |
407 | MZ.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 395 | MZ.Add(new Vertex("+X-Y-Z", +size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f)); |
408 | MZ.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 396 | MZ.Add(new Vertex("-X+Y-Z", -size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f)); |
409 | MZ.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 397 | MZ.Add(new Vertex("+X+Y-Z", +size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f)); |
410 | 398 | ||
411 | 399 | ||
412 | MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[0], MZ.vertices[2])); | 400 | MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[0], MZ.vertices[2])); |
@@ -415,10 +403,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
415 | // (P)lus Z | 403 | // (P)lus Z |
416 | Mesh PZ = new Mesh(); | 404 | Mesh PZ = new Mesh(); |
417 | 405 | ||
418 | PZ.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, 0.0f)); | 406 | PZ.Add(new Vertex("-X-Y+Z", -size.X/2.0f, -size.Y/2.0f, 0.0f)); |
419 | PZ.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, 0.0f)); | 407 | PZ.Add(new Vertex("+X-Y+Z", +size.X/2.0f, -size.Y/2.0f, 0.0f)); |
420 | PZ.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, 0.0f)); | 408 | PZ.Add(new Vertex("-X+Y+Z", -size.X/2.0f, +size.Y/2.0f, 0.0f)); |
421 | PZ.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, 0.0f)); | 409 | PZ.Add(new Vertex("+X+Y+Z", +size.X/2.0f, +size.Y/2.0f, 0.0f)); |
422 | 410 | ||
423 | // Surface 5, +Z | 411 | // Surface 5, +Z |
424 | PZ.Add(new Triangle(PZ.vertices[0], PZ.vertices[1], PZ.vertices[2])); | 412 | PZ.Add(new Triangle(PZ.vertices[0], PZ.vertices[1], PZ.vertices[2])); |
@@ -426,12 +414,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
426 | 414 | ||
427 | if (hollowFactor > 0) | 415 | if (hollowFactor > 0) |
428 | { | 416 | { |
429 | float hollowFactorF = (float)hollowFactor / (float)50000; | 417 | float hollowFactorF = (float) hollowFactor/(float) 50000; |
430 | 418 | ||
431 | MZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 419 | MZ.Add(new Vertex("-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f)); |
432 | MZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 420 | MZ.Add(new Vertex("-X+Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f)); |
433 | MZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 421 | MZ.Add(new Vertex("-X-Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f)); |
434 | MZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 422 | MZ.Add(new Vertex("-X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f)); |
435 | 423 | ||
436 | List<int> innerBorders = new List<int>(); | 424 | List<int> innerBorders = new List<int>(); |
437 | innerBorders.Add(4); | 425 | innerBorders.Add(4); |
@@ -441,10 +429,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
441 | 429 | ||
442 | InsertVertices(MZ.vertices, 4, MZ.triangles, innerBorders); | 430 | InsertVertices(MZ.vertices, 4, MZ.triangles, innerBorders); |
443 | 431 | ||
444 | PZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 432 | PZ.Add(new Vertex("-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f)); |
445 | PZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 433 | PZ.Add(new Vertex("-X+Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f)); |
446 | PZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 434 | PZ.Add(new Vertex("-X-Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f)); |
447 | PZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 435 | PZ.Add(new Vertex("-X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f)); |
448 | 436 | ||
449 | innerBorders = new List<int>(); | 437 | innerBorders = new List<int>(); |
450 | innerBorders.Add(4); | 438 | innerBorders.Add(4); |
@@ -453,16 +441,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
453 | innerBorders.Add(7); | 441 | innerBorders.Add(7); |
454 | 442 | ||
455 | InsertVertices(PZ.vertices, 4, PZ.triangles, innerBorders); | 443 | InsertVertices(PZ.vertices, 4, PZ.triangles, innerBorders); |
456 | |||
457 | } | 444 | } |
458 | 445 | ||
459 | foreach (Vertex v in PZ.vertices) | 446 | foreach (Vertex v in PZ.vertices) |
460 | { | 447 | { |
461 | v.point.Z = size.Z / 2.0f; | 448 | v.point.Z = size.Z/2.0f; |
462 | } | 449 | } |
463 | foreach (Vertex v in MZ.vertices) | 450 | foreach (Vertex v in MZ.vertices) |
464 | { | 451 | { |
465 | v.point.Z = -size.Z / 2.0f; | 452 | v.point.Z = -size.Z/2.0f; |
466 | } | 453 | } |
467 | 454 | ||
468 | foreach (Triangle t in MZ.triangles) | 455 | foreach (Triangle t in MZ.triangles) |
@@ -486,15 +473,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
486 | return result; | 473 | return result; |
487 | } | 474 | } |
488 | 475 | ||
489 | static Mesh CreateBoxMesh(PrimitiveBaseShape primShape, PhysicsVector size) | 476 | private static Mesh CreateBoxMesh(PrimitiveBaseShape primShape, PhysicsVector size) |
490 | { | 477 | { |
491 | Mesh result = new Mesh(); | 478 | Mesh result = new Mesh(); |
492 | 479 | ||
493 | 480 | ||
494 | 481 | Mesh MeshX = CreateBoxMeshX(primShape, size); | |
495 | Mesh MeshX = Meshmerizer.CreateBoxMeshX(primShape, size); | 482 | Mesh MeshY = CreateBoxMeshY(primShape, size); |
496 | Mesh MeshY = Meshmerizer.CreateBoxMeshY(primShape, size); | 483 | Mesh MeshZ = CreateBoxMeshZ(primShape, size); |
497 | Mesh MeshZ = Meshmerizer.CreateBoxMeshZ(primShape, size); | ||
498 | 484 | ||
499 | result.Append(MeshX); | 485 | result.Append(MeshX); |
500 | result.Append(MeshY); | 486 | result.Append(MeshY); |
@@ -504,64 +490,63 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
504 | } | 490 | } |
505 | 491 | ||
506 | 492 | ||
507 | public static void CalcNormals(Mesh mesh) | 493 | public static void CalcNormals(Mesh mesh) |
508 | { | 494 | { |
509 | int iTriangles = mesh.triangles.Count; | 495 | int iTriangles = mesh.triangles.Count; |
510 | 496 | ||
511 | mesh.normals = new float[iTriangles*3]; | 497 | mesh.normals = new float[iTriangles*3]; |
512 | 498 | ||
513 | int i=0; | 499 | int i = 0; |
514 | foreach (Triangle t in mesh.triangles) | 500 | foreach (Triangle t in mesh.triangles) |
515 | { | 501 | { |
516 | |||
517 | float ux, uy, uz; | 502 | float ux, uy, uz; |
518 | float vx, vy, vz; | 503 | float vx, vy, vz; |
519 | float wx, wy, wz; | 504 | float wx, wy, wz; |
520 | 505 | ||
521 | ux = t.v1.point.X; | 506 | ux = t.v1.point.X; |
522 | uy = t.v1.point.Y; | 507 | uy = t.v1.point.Y; |
523 | uz = t.v1.point.Z; | 508 | uz = t.v1.point.Z; |
524 | 509 | ||
525 | vx = t.v2.point.X; | 510 | vx = t.v2.point.X; |
526 | vy = t.v2.point.Y; | 511 | vy = t.v2.point.Y; |
527 | vz = t.v2.point.Z; | 512 | vz = t.v2.point.Z; |
528 | 513 | ||
529 | wx = t.v3.point.X; | 514 | wx = t.v3.point.X; |
530 | wy = t.v3.point.Y; | 515 | wy = t.v3.point.Y; |
531 | wz = t.v3.point.Z; | 516 | wz = t.v3.point.Z; |
532 | 517 | ||
533 | // Vectors for edges | 518 | // Vectors for edges |
534 | float e1x, e1y, e1z; | 519 | float e1x, e1y, e1z; |
535 | float e2x, e2y, e2z; | 520 | float e2x, e2y, e2z; |
536 | 521 | ||
537 | e1x = ux - vx; | 522 | e1x = ux - vx; |
538 | e1y = uy - vy; | 523 | e1y = uy - vy; |
539 | e1z = uz - vz; | 524 | e1z = uz - vz; |
540 | 525 | ||
541 | e2x = ux - wx; | 526 | e2x = ux - wx; |
542 | e2y = uy - wy; | 527 | e2y = uy - wy; |
543 | e2z = uz - wz; | 528 | e2z = uz - wz; |
544 | 529 | ||
545 | 530 | ||
546 | // Cross product for normal | 531 | // Cross product for normal |
547 | float nx, ny, nz; | 532 | float nx, ny, nz; |
548 | nx = e1y * e2z - e1z * e2y; | 533 | nx = e1y*e2z - e1z*e2y; |
549 | ny = e1z * e2x - e1x * e2z; | 534 | ny = e1z*e2x - e1x*e2z; |
550 | nz = e1x * e2y - e1y * e2x; | 535 | nz = e1x*e2y - e1y*e2x; |
551 | 536 | ||
552 | // Length | 537 | // Length |
553 | float l = (float)Math.Sqrt(nx * nx + ny * ny + nz * nz); | 538 | float l = (float) Math.Sqrt(nx*nx + ny*ny + nz*nz); |
554 | 539 | ||
555 | // Normalized "normal" | 540 | // Normalized "normal" |
556 | nx /= l; | 541 | nx /= l; |
557 | ny /= l; | 542 | ny /= l; |
558 | nz /= l; | 543 | nz /= l; |
559 | 544 | ||
560 | mesh.normals[i] = nx; | 545 | mesh.normals[i] = nx; |
561 | mesh.normals[i + 1] = ny; | 546 | mesh.normals[i + 1] = ny; |
562 | mesh.normals[i + 2] = nz; | 547 | mesh.normals[i + 2] = nz; |
563 | 548 | ||
564 | i+=3; | 549 | i += 3; |
565 | } | 550 | } |
566 | } | 551 | } |
567 | 552 | ||
@@ -572,18 +557,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
572 | switch (primShape.ProfileShape) | 557 | switch (primShape.ProfileShape) |
573 | { | 558 | { |
574 | case ProfileShape.Square: | 559 | case ProfileShape.Square: |
575 | mesh=CreateBoxMesh(primShape, size); | 560 | mesh = CreateBoxMesh(primShape, size); |
576 | CalcNormals(mesh); | 561 | CalcNormals(mesh); |
577 | break; | 562 | break; |
578 | default: | 563 | default: |
579 | mesh=null; | 564 | mesh = null; |
580 | break; | 565 | break; |
581 | } | 566 | } |
582 | 567 | ||
583 | return mesh; | 568 | return mesh; |
584 | |||
585 | } | 569 | } |
586 | } | 570 | } |
587 | } | 571 | } \ No newline at end of file |
588 | |||
589 | |||
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index a20452f..c9af6dd 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -25,19 +25,14 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
28 | using System; | 29 | using System; |
29 | using System.Threading; | ||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | |||
32 | using libsecondlife; | ||
33 | |||
34 | using Axiom.Math; | 31 | using Axiom.Math; |
35 | using Ode.NET; | 32 | using Ode.NET; |
36 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.Physics.Manager; |
39 | 35 | ||
40 | |||
41 | namespace OpenSim.Region.Physics.OdePlugin | 36 | namespace OpenSim.Region.Physics.OdePlugin |
42 | { | 37 | { |
43 | /// <summary> | 38 | /// <summary> |
@@ -49,7 +44,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
49 | 44 | ||
50 | public OdePlugin() | 45 | public OdePlugin() |
51 | { | 46 | { |
52 | |||
53 | } | 47 | } |
54 | 48 | ||
55 | public bool Init() | 49 | public bool Init() |
@@ -73,7 +67,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
73 | 67 | ||
74 | public void Dispose() | 68 | public void Dispose() |
75 | { | 69 | { |
76 | |||
77 | } | 70 | } |
78 | } | 71 | } |
79 | 72 | ||
@@ -82,17 +75,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
82 | private static float ODE_STEPSIZE = 0.004f; | 75 | private static float ODE_STEPSIZE = 0.004f; |
83 | private static bool RENDER_FLAG = false; | 76 | private static bool RENDER_FLAG = false; |
84 | private IntPtr contactgroup; | 77 | private IntPtr contactgroup; |
85 | private IntPtr LandGeom=(IntPtr)0; | 78 | private IntPtr LandGeom = (IntPtr) 0; |
86 | private double[] _heightmap; | 79 | private double[] _heightmap; |
87 | private d.NearCallback nearCallback; | 80 | private d.NearCallback nearCallback; |
88 | public d.TriCallback triCallback; | 81 | public d.TriCallback triCallback; |
89 | public d.TriArrayCallback triArrayCallback; | 82 | public d.TriArrayCallback triArrayCallback; |
90 | private List<OdeCharacter> _characters = new List<OdeCharacter>(); | 83 | private List<OdeCharacter> _characters = new List<OdeCharacter>(); |
91 | private List<OdePrim> _prims = new List<OdePrim>(); | 84 | private List<OdePrim> _prims = new List<OdePrim>(); |
92 | public Dictionary<IntPtr, String> geom_name_map=new Dictionary<IntPtr, String>(); | 85 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); |
93 | private d.ContactGeom[] contacts = new d.ContactGeom[30]; | 86 | private d.ContactGeom[] contacts = new d.ContactGeom[30]; |
94 | private d.Contact contact; | 87 | private d.Contact contact; |
95 | private float step_time=0.0f; | 88 | private float step_time = 0.0f; |
96 | public IntPtr world; | 89 | public IntPtr world; |
97 | public IntPtr space; | 90 | public IntPtr space; |
98 | public static Object OdeLock = new Object(); | 91 | public static Object OdeLock = new Object(); |
@@ -140,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
140 | return; | 133 | return; |
141 | 134 | ||
142 | d.GeomClassID id = d.GeomGetClass(g1); | 135 | d.GeomClassID id = d.GeomGetClass(g1); |
143 | if (id==d.GeomClassID.TriMeshClass) | 136 | if (id == d.GeomClassID.TriMeshClass) |
144 | { | 137 | { |
145 | String name1 = null; | 138 | String name1 = null; |
146 | String name2 = null; | 139 | String name2 = null; |
@@ -163,7 +156,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
163 | IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); | 156 | IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); |
164 | d.JointAttach(joint, b1, b2); | 157 | d.JointAttach(joint, b1, b2); |
165 | } | 158 | } |
166 | |||
167 | } | 159 | } |
168 | 160 | ||
169 | private void collision_optimized() | 161 | private void collision_optimized() |
@@ -171,7 +163,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
171 | foreach (OdeCharacter chr in _characters) | 163 | foreach (OdeCharacter chr in _characters) |
172 | { | 164 | { |
173 | d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback); | 165 | d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback); |
174 | foreach (OdeCharacter ch2 in _characters) /// should be a separate space -- lots of avatars will be N**2 slow | 166 | foreach (OdeCharacter ch2 in _characters) |
167 | /// should be a separate space -- lots of avatars will be N**2 slow | ||
175 | { | 168 | { |
176 | d.SpaceCollide2(chr.Shell, ch2.Shell, IntPtr.Zero, nearCallback); | 169 | d.SpaceCollide2(chr.Shell, ch2.Shell, IntPtr.Zero, nearCallback); |
177 | } | 170 | } |
@@ -193,8 +186,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
193 | { | 186 | { |
194 | lock (OdeLock) | 187 | lock (OdeLock) |
195 | { | 188 | { |
196 | ((OdeCharacter)actor).Destroy(); | 189 | ((OdeCharacter) actor).Destroy(); |
197 | _characters.Remove((OdeCharacter)actor); | 190 | _characters.Remove((OdeCharacter) actor); |
198 | } | 191 | } |
199 | } | 192 | } |
200 | 193 | ||
@@ -204,13 +197,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
204 | { | 197 | { |
205 | lock (OdeLock) | 198 | lock (OdeLock) |
206 | { | 199 | { |
207 | d.GeomDestroy(((OdePrim)prim).prim_geom); | 200 | d.GeomDestroy(((OdePrim) prim).prim_geom); |
208 | _prims.Remove((OdePrim)prim); | 201 | _prims.Remove((OdePrim) prim); |
209 | } | 202 | } |
210 | } | 203 | } |
211 | } | 204 | } |
212 | 205 | ||
213 | PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | 206 | private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, |
207 | Mesh mesh, PrimitiveBaseShape pbs) | ||
214 | { | 208 | { |
215 | PhysicsVector pos = new PhysicsVector(); | 209 | PhysicsVector pos = new PhysicsVector(); |
216 | pos.X = position.X; | 210 | pos.X = position.X; |
@@ -235,7 +229,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
235 | } | 229 | } |
236 | 230 | ||
237 | 231 | ||
238 | public int TriArrayCallback(System.IntPtr trimesh, System.IntPtr refObject, int[] triangleIndex, int triCount) | 232 | public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) |
239 | { | 233 | { |
240 | /* String name1 = null; | 234 | /* String name1 = null; |
241 | String name2 = null; | 235 | String name2 = null; |
@@ -254,15 +248,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
254 | return 1; | 248 | return 1; |
255 | } | 249 | } |
256 | 250 | ||
257 | public int TriCallback(System.IntPtr trimesh, System.IntPtr refObject, int triangleIndex) | 251 | public int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex) |
258 | { | 252 | { |
259 | |||
260 | String name1 = null; | 253 | String name1 = null; |
261 | String name2 = null; | 254 | String name2 = null; |
262 | 255 | ||
263 | if (!geom_name_map.TryGetValue(trimesh, out name1)) | 256 | if (!geom_name_map.TryGetValue(trimesh, out name1)) |
264 | { | 257 | { |
265 | name1 = "null"; | 258 | name1 = "null"; |
266 | } | 259 | } |
267 | if (!geom_name_map.TryGetValue(refObject, out name2)) | 260 | if (!geom_name_map.TryGetValue(refObject, out name2)) |
268 | { | 261 | { |
@@ -282,11 +275,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
282 | } | 275 | } |
283 | 276 | ||
284 | 277 | ||
285 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) | 278 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
279 | PhysicsVector size, Quaternion rotation) | ||
286 | { | 280 | { |
287 | PhysicsActor result; | 281 | PhysicsActor result; |
288 | 282 | ||
289 | switch(pbs.ProfileShape) | 283 | switch (pbs.ProfileShape) |
290 | { | 284 | { |
291 | case ProfileShape.Square: | 285 | case ProfileShape.Square: |
292 | /// support simple box & hollow box now; later, more shapes | 286 | /// support simple box & hollow box now; later, more shapes |
@@ -310,7 +304,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
310 | } | 304 | } |
311 | 305 | ||
312 | 306 | ||
313 | |||
314 | public override void Simulate(float timeStep) | 307 | public override void Simulate(float timeStep) |
315 | { | 308 | { |
316 | step_time += timeStep; | 309 | step_time += timeStep; |
@@ -327,11 +320,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
327 | Vector3 rx, ry, rz; | 320 | Vector3 rx, ry, rz; |
328 | p.Orientation.ToAxes(out rx, out ry, out rz); | 321 | p.Orientation.ToAxes(out rx, out ry, out rz); |
329 | Console.WriteLine("RENDER: block; " + p.Size.X + ", " + p.Size.Y + ", " + p.Size.Z + "; " + | 322 | Console.WriteLine("RENDER: block; " + p.Size.X + ", " + p.Size.Y + ", " + p.Size.Z + "; " + |
330 | " 0, 0, 1; " + //shape, size, color | 323 | " 0, 0, 1; " + //shape, size, color |
331 | (p.Position.X - 128.0f) + ", " + (p.Position.Y - 128.0f) + ", " + (p.Position.Z - 33.0f) + "; " + // position | 324 | (p.Position.X - 128.0f) + ", " + (p.Position.Y - 128.0f) + ", " + |
332 | rx.x + "," + ry.x + "," + rz.x + ", " + // rotation | 325 | (p.Position.Z - 33.0f) + "; " + // position |
333 | rx.y + "," + ry.y + "," + rz.y + ", " + | 326 | rx.x + "," + ry.x + "," + rz.x + ", " + // rotation |
334 | rx.z + "," + ry.z + "," + rz.z); | 327 | rx.y + "," + ry.y + "," + rz.y + ", " + |
328 | rx.z + "," + ry.z + "," + rz.z); | ||
335 | } | 329 | } |
336 | } | 330 | } |
337 | int i = 0; | 331 | int i = 0; |
@@ -357,22 +351,27 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
357 | float Zoff = -33.0f; | 351 | float Zoff = -33.0f; |
358 | d.Matrix3 temp = d.BodyGetRotation(actor.Body); | 352 | d.Matrix3 temp = d.BodyGetRotation(actor.Body); |
359 | Console.WriteLine("RENDER: cylinder; " + // shape | 353 | Console.WriteLine("RENDER: cylinder; " + // shape |
360 | OdeCharacter.CAPSULE_RADIUS + ", " + OdeCharacter.CAPSULE_LENGTH + //size | 354 | OdeCharacter.CAPSULE_RADIUS + ", " + OdeCharacter.CAPSULE_LENGTH + //size |
361 | "; 0, 1, 0; " + // color | 355 | "; 0, 1, 0; " + // color |
362 | (actor.Position.X - 128.0f) + ", " + (actor.Position.Y - 128.0f) + ", " + (actor.Position.Z + Zoff) + "; " + // position | 356 | (actor.Position.X - 128.0f) + ", " + (actor.Position.Y - 128.0f) + ", " + |
363 | temp.M00 + "," + temp.M10 + "," + temp.M20 + ", " + // rotation | 357 | (actor.Position.Z + Zoff) + "; " + // position |
364 | temp.M01 + "," + temp.M11 + "," + temp.M21 + ", " + | 358 | temp.M00 + "," + temp.M10 + "," + temp.M20 + ", " + // rotation |
365 | temp.M02 + "," + temp.M12 + "," + temp.M22); | 359 | temp.M01 + "," + temp.M11 + "," + temp.M21 + ", " + |
366 | d.Vector3 caphead; d.BodyGetRelPointPos(actor.Body, 0, 0, OdeCharacter.CAPSULE_LENGTH * .5f, out caphead); | 360 | temp.M02 + "," + temp.M12 + "," + temp.M22); |
367 | d.Vector3 capfoot; d.BodyGetRelPointPos(actor.Body, 0, 0, -OdeCharacter.CAPSULE_LENGTH * .5f, out capfoot); | 361 | d.Vector3 caphead; |
362 | d.BodyGetRelPointPos(actor.Body, 0, 0, OdeCharacter.CAPSULE_LENGTH*.5f, out caphead); | ||
363 | d.Vector3 capfoot; | ||
364 | d.BodyGetRelPointPos(actor.Body, 0, 0, -OdeCharacter.CAPSULE_LENGTH*.5f, out capfoot); | ||
368 | Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size | 365 | Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size |
369 | "; 1, 0, 1; " + //color | 366 | "; 1, 0, 1; " + //color |
370 | (caphead.X - 128.0f) + ", " + (caphead.Y - 128.0f) + ", " + (caphead.Z + Zoff) + "; " + // position | 367 | (caphead.X - 128.0f) + ", " + (caphead.Y - 128.0f) + ", " + (caphead.Z + Zoff) + |
371 | "1,0,0, 0,1,0, 0,0,1"); // rotation | 368 | "; " + // position |
369 | "1,0,0, 0,1,0, 0,0,1"); // rotation | ||
372 | Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size | 370 | Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size |
373 | "; 1, 0, 0; " + //color | 371 | "; 1, 0, 0; " + //color |
374 | (capfoot.X - 128.0f) + ", " + (capfoot.Y - 128.0f) + ", " + (capfoot.Z + Zoff) + "; " + // position | 372 | (capfoot.X - 128.0f) + ", " + (capfoot.Y - 128.0f) + ", " + (capfoot.Z + Zoff) + |
375 | "1,0,0, 0,1,0, 0,0,1"); // rotation | 373 | "; " + // position |
374 | "1,0,0, 0,1,0, 0,0,1"); // rotation | ||
376 | } | 375 | } |
377 | } | 376 | } |
378 | } | 377 | } |
@@ -380,14 +379,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
380 | 379 | ||
381 | public override void GetResults() | 380 | public override void GetResults() |
382 | { | 381 | { |
383 | |||
384 | } | 382 | } |
385 | 383 | ||
386 | public override bool IsThreaded | 384 | public override bool IsThreaded |
387 | { | 385 | { |
388 | get | 386 | get { return (false); // for now we won't be multithreaded |
389 | { | ||
390 | return (false); // for now we won't be multithreaded | ||
391 | } | 387 | } |
392 | } | 388 | } |
393 | 389 | ||
@@ -400,21 +396,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
400 | { | 396 | { |
401 | for (int y = 0; y < 258; y++) | 397 | for (int y = 0; y < 258; y++) |
402 | { | 398 | { |
403 | int xx = x-1; | 399 | int xx = x - 1; |
404 | if (xx < 0) xx = 0; | 400 | if (xx < 0) xx = 0; |
405 | if (xx > 255) xx = 255; | 401 | if (xx > 255) xx = 255; |
406 | int yy = y-1; | 402 | int yy = y - 1; |
407 | if (yy < 0) yy = 0; | 403 | if (yy < 0) yy = 0; |
408 | if (yy > 255) yy = 255; | 404 | if (yy > 255) yy = 255; |
409 | 405 | ||
410 | double val = (double)heightMap[yy * 256 + xx]; | 406 | double val = (double) heightMap[yy*256 + xx]; |
411 | _heightmap[x * 258 + y] = val; | 407 | _heightmap[x*258 + y] = val; |
412 | } | 408 | } |
413 | } | 409 | } |
414 | 410 | ||
415 | lock (OdeLock) | 411 | lock (OdeLock) |
416 | { | 412 | { |
417 | if (!(LandGeom == (IntPtr)0)) | 413 | if (!(LandGeom == (IntPtr) 0)) |
418 | { | 414 | { |
419 | d.SpaceRemove(space, LandGeom); | 415 | d.SpaceRemove(space, LandGeom); |
420 | } | 416 | } |
@@ -422,7 +418,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
422 | d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 258, 258, 258, 258, 1.0f, 0.0f, 2.0f, 0); | 418 | d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 258, 258, 258, 258, 1.0f, 0.0f, 2.0f, 0); |
423 | d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); | 419 | d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); |
424 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); | 420 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); |
425 | this.geom_name_map[LandGeom]="Terrain"; | 421 | geom_name_map[LandGeom] = "Terrain"; |
426 | 422 | ||
427 | d.Matrix3 R = new d.Matrix3(); | 423 | d.Matrix3 R = new d.Matrix3(); |
428 | 424 | ||
@@ -430,7 +426,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
430 | Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0)); | 426 | Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0)); |
431 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); | 427 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); |
432 | 428 | ||
433 | q1 = q1 * q2; | 429 | q1 = q1*q2; |
434 | //q1 = q1 * q3; | 430 | //q1 = q1 * q3; |
435 | Vector3 v3 = new Vector3(); | 431 | Vector3 v3 = new Vector3(); |
436 | float angle = 0; | 432 | float angle = 0; |
@@ -444,7 +440,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
444 | 440 | ||
445 | public override void DeleteTerrain() | 441 | public override void DeleteTerrain() |
446 | { | 442 | { |
447 | |||
448 | } | 443 | } |
449 | } | 444 | } |
450 | 445 | ||
@@ -452,12 +447,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
452 | { | 447 | { |
453 | private PhysicsVector _position; | 448 | private PhysicsVector _position; |
454 | private d.Vector3 _zeroPosition; | 449 | private d.Vector3 _zeroPosition; |
455 | private bool _zeroFlag=false; | 450 | private bool _zeroFlag = false; |
456 | private PhysicsVector _velocity; | 451 | private PhysicsVector _velocity; |
457 | private PhysicsVector _target_velocity; | 452 | private PhysicsVector _target_velocity; |
458 | private PhysicsVector _acceleration; | 453 | private PhysicsVector _acceleration; |
459 | private static float PID_D=4000.0f; | 454 | private static float PID_D = 4000.0f; |
460 | private static float PID_P=7000.0f; | 455 | private static float PID_P = 7000.0f; |
461 | private static float POSTURE_SERVO = 10000.0f; | 456 | private static float POSTURE_SERVO = 10000.0f; |
462 | public static float CAPSULE_RADIUS = 0.5f; | 457 | public static float CAPSULE_RADIUS = 0.5f; |
463 | public static float CAPSULE_LENGTH = 0.9f; | 458 | public static float CAPSULE_LENGTH = 0.9f; |
@@ -484,28 +479,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
484 | d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); | 479 | d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); |
485 | d.GeomSetBody(Shell, Body); | 480 | d.GeomSetBody(Shell, Body); |
486 | } | 481 | } |
487 | parent_scene.geom_name_map[Shell]=avName; | 482 | parent_scene.geom_name_map[Shell] = avName; |
488 | |||
489 | } | 483 | } |
490 | 484 | ||
491 | public override bool Flying | 485 | public override bool Flying |
492 | { | 486 | { |
493 | get | 487 | get { return flying; } |
494 | { | 488 | set { flying = value; } |
495 | return flying; | ||
496 | } | ||
497 | set | ||
498 | { | ||
499 | flying = value; | ||
500 | } | ||
501 | } | 489 | } |
502 | 490 | ||
503 | public override PhysicsVector Position | 491 | public override PhysicsVector Position |
504 | { | 492 | { |
505 | get | 493 | get { return _position; } |
506 | { | ||
507 | return _position; | ||
508 | } | ||
509 | set | 494 | set |
510 | { | 495 | { |
511 | lock (OdeScene.OdeLock) | 496 | lock (OdeScene.OdeLock) |
@@ -518,60 +503,34 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
518 | 503 | ||
519 | public override PhysicsVector Size | 504 | public override PhysicsVector Size |
520 | { | 505 | { |
521 | get | 506 | get { return new PhysicsVector(0, 0, 0); } |
522 | { | 507 | set { } |
523 | return new PhysicsVector(0,0,0); | ||
524 | } | ||
525 | set | ||
526 | { | ||
527 | } | ||
528 | } | 508 | } |
529 | 509 | ||
530 | 510 | ||
531 | public override PhysicsVector Velocity | 511 | public override PhysicsVector Velocity |
532 | { | 512 | { |
533 | get | 513 | get { return _velocity; } |
534 | { | 514 | set { _target_velocity = value; } |
535 | return _velocity; | ||
536 | } | ||
537 | set | ||
538 | { | ||
539 | _target_velocity = value; | ||
540 | } | ||
541 | } | 515 | } |
542 | 516 | ||
543 | public override bool Kinematic | 517 | public override bool Kinematic |
544 | { | 518 | { |
545 | get | 519 | get { return false; } |
546 | { | 520 | set { } |
547 | return false; | ||
548 | } | ||
549 | set | ||
550 | { | ||
551 | |||
552 | } | ||
553 | } | 521 | } |
554 | 522 | ||
555 | public override Quaternion Orientation | 523 | public override Quaternion Orientation |
556 | { | 524 | { |
557 | get | 525 | get { return Quaternion.Identity; } |
558 | { | 526 | set { } |
559 | return Quaternion.Identity; | ||
560 | } | ||
561 | set | ||
562 | { | ||
563 | |||
564 | } | ||
565 | } | 527 | } |
566 | 528 | ||
567 | public override PhysicsVector Acceleration | 529 | public override PhysicsVector Acceleration |
568 | { | 530 | { |
569 | get | 531 | get { return _acceleration; } |
570 | { | ||
571 | return _acceleration; | ||
572 | } | ||
573 | |||
574 | } | 532 | } |
533 | |||
575 | public void SetAcceleration(PhysicsVector accel) | 534 | public void SetAcceleration(PhysicsVector accel) |
576 | { | 535 | { |
577 | _acceleration = accel; | 536 | _acceleration = accel; |
@@ -579,12 +538,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
579 | 538 | ||
580 | public override void AddForce(PhysicsVector force) | 539 | public override void AddForce(PhysicsVector force) |
581 | { | 540 | { |
582 | |||
583 | } | 541 | } |
584 | 542 | ||
585 | public override void SetMomentum(PhysicsVector momentum) | 543 | public override void SetMomentum(PhysicsVector momentum) |
586 | { | 544 | { |
587 | |||
588 | } | 545 | } |
589 | 546 | ||
590 | public void Move(float timeStep) | 547 | public void Move(float timeStep) |
@@ -603,28 +560,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
603 | _zeroPosition = d.BodyGetPosition(Body); | 560 | _zeroPosition = d.BodyGetPosition(Body); |
604 | } | 561 | } |
605 | d.Vector3 pos = d.BodyGetPosition(Body); | 562 | d.Vector3 pos = d.BodyGetPosition(Body); |
606 | vec.X = (_target_velocity.X - vel.X) * PID_D + (_zeroPosition.X - pos.X) * PID_P; | 563 | vec.X = (_target_velocity.X - vel.X)*PID_D + (_zeroPosition.X - pos.X)*PID_P; |
607 | vec.Y = (_target_velocity.Y - vel.Y) * PID_D + (_zeroPosition.Y - pos.Y) * PID_P; | 564 | vec.Y = (_target_velocity.Y - vel.Y)*PID_D + (_zeroPosition.Y - pos.Y)*PID_P; |
608 | if (flying) | 565 | if (flying) |
609 | { | 566 | { |
610 | vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; | 567 | vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P; |
611 | } | 568 | } |
612 | } | 569 | } |
613 | else | 570 | else |
614 | { | 571 | { |
615 | _zeroFlag = false; | 572 | _zeroFlag = false; |
616 | vec.X = (_target_velocity.X - vel.X) * PID_D; | 573 | vec.X = (_target_velocity.X - vel.X)*PID_D; |
617 | vec.Y = (_target_velocity.Y - vel.Y) * PID_D; | 574 | vec.Y = (_target_velocity.Y - vel.Y)*PID_D; |
618 | if (flying) | 575 | if (flying) |
619 | { | 576 | { |
620 | vec.Z = (_target_velocity.Z - vel.Z) * PID_D; | 577 | vec.Z = (_target_velocity.Z - vel.Z)*PID_D; |
621 | } | 578 | } |
622 | } | 579 | } |
623 | if (flying) | 580 | if (flying) |
624 | { | 581 | { |
625 | vec.Z += 10.0f; | 582 | vec.Z += 10.0f; |
626 | } | 583 | } |
627 | d.BodyAddForce(this.Body, vec.X, vec.Y, vec.Z); | 584 | d.BodyAddForce(Body, vec.X, vec.Y, vec.Z); |
628 | 585 | ||
629 | // ok -- let's stand up straight! | 586 | // ok -- let's stand up straight! |
630 | d.Vector3 feet; | 587 | d.Vector3 feet; |
@@ -634,7 +591,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
634 | float posture = head.Z - feet.Z; | 591 | float posture = head.Z - feet.Z; |
635 | 592 | ||
636 | // restoring force proportional to lack of posture: | 593 | // restoring force proportional to lack of posture: |
637 | float servo = (2.5f-posture) * POSTURE_SERVO; | 594 | float servo = (2.5f - posture)*POSTURE_SERVO; |
638 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); | 595 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); |
639 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); | 596 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); |
640 | } | 597 | } |
@@ -650,9 +607,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
650 | if (vec.X > 255.95f) vec.X = 255.95f; | 607 | if (vec.X > 255.95f) vec.X = 255.95f; |
651 | if (vec.Y > 255.95f) vec.Y = 255.95f; | 608 | if (vec.Y > 255.95f) vec.Y = 255.95f; |
652 | 609 | ||
653 | this._position.X = vec.X; | 610 | _position.X = vec.X; |
654 | this._position.Y = vec.Y; | 611 | _position.Y = vec.Y; |
655 | this._position.Z = vec.Z; | 612 | _position.Z = vec.Z; |
656 | 613 | ||
657 | if (_zeroFlag) | 614 | if (_zeroFlag) |
658 | { | 615 | { |
@@ -673,9 +630,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
673 | { | 630 | { |
674 | lock (OdeScene.OdeLock) | 631 | lock (OdeScene.OdeLock) |
675 | { | 632 | { |
676 | d.GeomDestroy(this.Shell); | 633 | d.GeomDestroy(Shell); |
677 | this._parent_scene.geom_name_map.Remove(this.Shell); | 634 | _parent_scene.geom_name_map.Remove(Shell); |
678 | d.BodyDestroy(this.Body); | 635 | d.BodyDestroy(Body); |
679 | } | 636 | } |
680 | } | 637 | } |
681 | } | 638 | } |
@@ -693,7 +650,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
693 | public IntPtr prim_geom; | 650 | public IntPtr prim_geom; |
694 | public IntPtr _triMeshData; | 651 | public IntPtr _triMeshData; |
695 | 652 | ||
696 | public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, | 653 | public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, |
697 | Quaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) | 654 | Quaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) |
698 | { | 655 | { |
699 | _velocity = new PhysicsVector(); | 656 | _velocity = new PhysicsVector(); |
@@ -707,7 +664,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
707 | 664 | ||
708 | lock (OdeScene.OdeLock) | 665 | lock (OdeScene.OdeLock) |
709 | { | 666 | { |
710 | if (mesh!=null) | 667 | if (mesh != null) |
711 | { | 668 | { |
712 | setMesh(parent_scene, mesh); | 669 | setMesh(parent_scene, mesh); |
713 | } | 670 | } |
@@ -723,20 +680,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
723 | myrot.Y = rotation.y; | 680 | myrot.Y = rotation.y; |
724 | myrot.Z = rotation.z; | 681 | myrot.Z = rotation.z; |
725 | d.GeomSetQuaternion(prim_geom, ref myrot); | 682 | d.GeomSetQuaternion(prim_geom, ref myrot); |
726 | parent_scene.geom_name_map[prim_geom] = primName; // don't do .add() here; old geoms get recycled with the same hash | 683 | parent_scene.geom_name_map[prim_geom] = primName; |
684 | // don't do .add() here; old geoms get recycled with the same hash | ||
727 | } | 685 | } |
728 | } | 686 | } |
729 | 687 | ||
730 | public void setMesh(OdeScene parent_scene, Mesh mesh) | 688 | public void setMesh(OdeScene parent_scene, Mesh mesh) |
731 | { | 689 | { |
732 | float[] vertexList = mesh.getVertexListAsFloat(); // Note, that vertextList is pinned in memory | 690 | float[] vertexList = mesh.getVertexListAsFloat(); // Note, that vertextList is pinned in memory |
733 | int[] indexList = mesh.getIndexListAsInt(); // Also pinned, needs release after usage | 691 | int[] indexList = mesh.getIndexListAsInt(); // Also pinned, needs release after usage |
734 | int VertexCount = vertexList.GetLength(0) / 3; | 692 | int VertexCount = vertexList.GetLength(0)/3; |
735 | int IndexCount = indexList.GetLength(0); | 693 | int IndexCount = indexList.GetLength(0); |
736 | 694 | ||
737 | _triMeshData = d.GeomTriMeshDataCreate(); | 695 | _triMeshData = d.GeomTriMeshDataCreate(); |
738 | 696 | ||
739 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3 * sizeof(float), VertexCount, indexList, IndexCount, 3 * sizeof(int)); | 697 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3*sizeof (float), VertexCount, indexList, IndexCount, |
698 | 3*sizeof (int)); | ||
740 | d.GeomTriMeshDataPreprocess(_triMeshData); | 699 | d.GeomTriMeshDataPreprocess(_triMeshData); |
741 | 700 | ||
742 | prim_geom = d.CreateTriMesh(parent_scene.space, _triMeshData, parent_scene.triCallback, null, null); | 701 | prim_geom = d.CreateTriMesh(parent_scene.space, _triMeshData, parent_scene.triCallback, null, null); |
@@ -744,21 +703,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
744 | 703 | ||
745 | public override bool Flying | 704 | public override bool Flying |
746 | { | 705 | { |
747 | get | 706 | get { return false; //no flying prims for you |
748 | { | ||
749 | return false; //no flying prims for you | ||
750 | } | ||
751 | set | ||
752 | { | ||
753 | } | 707 | } |
708 | set { } | ||
754 | } | 709 | } |
755 | 710 | ||
756 | public override PhysicsVector Position | 711 | public override PhysicsVector Position |
757 | { | 712 | { |
758 | get | 713 | get { return _position; } |
759 | { | ||
760 | return _position; | ||
761 | } | ||
762 | set | 714 | set |
763 | { | 715 | { |
764 | _position = value; | 716 | _position = value; |
@@ -771,10 +723,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
771 | 723 | ||
772 | public override PhysicsVector Size | 724 | public override PhysicsVector Size |
773 | { | 725 | { |
774 | get | 726 | get { return _size; } |
775 | { | ||
776 | return _size; | ||
777 | } | ||
778 | set | 727 | set |
779 | { | 728 | { |
780 | _size = value; | 729 | _size = value; |
@@ -798,33 +747,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
798 | 747 | ||
799 | public override PhysicsVector Velocity | 748 | public override PhysicsVector Velocity |
800 | { | 749 | { |
801 | get | 750 | get { return _velocity; } |
802 | { | 751 | set { _velocity = value; } |
803 | return _velocity; | ||
804 | } | ||
805 | set | ||
806 | { | ||
807 | _velocity = value; | ||
808 | } | ||
809 | } | 752 | } |
810 | 753 | ||
811 | public override bool Kinematic | 754 | public override bool Kinematic |
812 | { | 755 | { |
813 | get | 756 | get { return false; } |
814 | { | 757 | set { } |
815 | return false; | ||
816 | } | ||
817 | set | ||
818 | { | ||
819 | } | ||
820 | } | 758 | } |
821 | 759 | ||
822 | public override Quaternion Orientation | 760 | public override Quaternion Orientation |
823 | { | 761 | { |
824 | get | 762 | get { return _orientation; } |
825 | { | ||
826 | return _orientation; | ||
827 | } | ||
828 | set | 763 | set |
829 | { | 764 | { |
830 | _orientation = value; | 765 | _orientation = value; |
@@ -842,15 +777,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
842 | 777 | ||
843 | public override PhysicsVector Acceleration | 778 | public override PhysicsVector Acceleration |
844 | { | 779 | { |
845 | get | 780 | get { return _acceleration; } |
846 | { | ||
847 | return _acceleration; | ||
848 | } | ||
849 | } | 781 | } |
850 | 782 | ||
851 | public void SetAcceleration(PhysicsVector accel) | 783 | public void SetAcceleration(PhysicsVector accel) |
852 | { | 784 | { |
853 | this._acceleration = accel; | 785 | _acceleration = accel; |
854 | } | 786 | } |
855 | 787 | ||
856 | public override void AddForce(PhysicsVector force) | 788 | public override void AddForce(PhysicsVector force) |
@@ -861,4 +793,4 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
861 | { | 793 | { |
862 | } | 794 | } |
863 | } | 795 | } |
864 | } | 796 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs index 3f840cc..d110a17 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs | |||
@@ -27,24 +27,26 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // Information about this assembly is defined by the following | 31 | // Information about this assembly is defined by the following |
31 | // attributes. | 32 | // attributes. |
32 | // | 33 | // |
33 | // change them to the information which is associated with the assembly | 34 | // change them to the information which is associated with the assembly |
34 | // you compile. | 35 | // you compile. |
35 | 36 | ||
36 | [assembly: AssemblyTitle("RealPhysXplugin")] | 37 | [assembly : AssemblyTitle("RealPhysXplugin")] |
37 | [assembly: AssemblyDescription("")] | 38 | [assembly : AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 39 | [assembly : AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 40 | [assembly : AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("RealPhysXplugin")] | 41 | [assembly : AssemblyProduct("RealPhysXplugin")] |
41 | [assembly: AssemblyCopyright("")] | 42 | [assembly : AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 43 | [assembly : AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 44 | [assembly : AssemblyCulture("")] |
44 | 45 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 46 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 48 | |
49 | [assembly : ComVisible(false)] | ||
48 | 50 | ||
49 | // The assembly version has following format : | 51 | // The assembly version has following format : |
50 | // | 52 | // |
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices; | |||
53 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
55 | 57 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 58 | [assembly : AssemblyVersion("1.0.*")] \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index a7cef88..4896359 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -34,102 +34,99 @@ using Quaternion=Axiom.Math.Quaternion; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.PhysXPlugin | 35 | namespace OpenSim.Region.Physics.PhysXPlugin |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Will be the PhysX plugin but for now will be a very basic physics engine | 38 | /// Will be the PhysX plugin but for now will be a very basic physics engine |
39 | /// </summary> | 39 | /// </summary> |
40 | public class PhysXPlugin : IPhysicsPlugin | 40 | public class PhysXPlugin : IPhysicsPlugin |
41 | { | 41 | { |
42 | private PhysXScene _mScene; | 42 | private PhysXScene _mScene; |
43 | 43 | ||
44 | public PhysXPlugin() | 44 | public PhysXPlugin() |
45 | { | 45 | { |
46 | 46 | } | |
47 | } | 47 | |
48 | 48 | public bool Init() | |
49 | public bool Init() | 49 | { |
50 | { | 50 | return true; |
51 | return true; | 51 | } |
52 | } | 52 | |
53 | 53 | public PhysicsScene GetScene() | |
54 | public PhysicsScene GetScene() | 54 | { |
55 | { | 55 | if (_mScene == null) |
56 | if(_mScene == null) | 56 | { |
57 | { | 57 | _mScene = new PhysXScene(); |
58 | _mScene = new PhysXScene(); | 58 | } |
59 | } | 59 | return (_mScene); |
60 | return(_mScene); | 60 | } |
61 | } | 61 | |
62 | 62 | public string GetName() | |
63 | public string GetName() | 63 | { |
64 | { | 64 | return ("RealPhysX"); |
65 | return("RealPhysX"); | 65 | } |
66 | } | 66 | |
67 | 67 | public void Dispose() | |
68 | public void Dispose() | 68 | { |
69 | { | 69 | } |
70 | 70 | } | |
71 | } | 71 | |
72 | } | 72 | public class PhysXScene : PhysicsScene |
73 | 73 | { | |
74 | public class PhysXScene :PhysicsScene | 74 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); |
75 | { | 75 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); |
76 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); | 76 | private float[] _heightMap = null; |
77 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); | 77 | private NxPhysicsSDK mySdk; |
78 | private float[] _heightMap = null; | 78 | private NxScene scene; |
79 | private NxPhysicsSDK mySdk; | 79 | |
80 | private NxScene scene; | 80 | public PhysXScene() |
81 | 81 | { | |
82 | public PhysXScene() | 82 | mySdk = NxPhysicsSDK.CreateSDK(); |
83 | { | 83 | Console.WriteLine("Sdk created - now creating scene"); |
84 | mySdk = NxPhysicsSDK.CreateSDK(); | 84 | scene = mySdk.CreateScene(); |
85 | Console.WriteLine("Sdk created - now creating scene"); | 85 | } |
86 | scene = mySdk.CreateScene(); | 86 | |
87 | 87 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) | |
88 | } | 88 | { |
89 | 89 | Vec3 pos = new Vec3(); | |
90 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position) | 90 | pos.X = position.X; |
91 | { | 91 | pos.Y = position.Y; |
92 | Vec3 pos = new Vec3(); | 92 | pos.Z = position.Z; |
93 | pos.X = position.X; | 93 | PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos)); |
94 | pos.Y = position.Y; | ||
95 | pos.Z = position.Z; | ||
96 | PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); | ||
97 | act.Position = position; | 94 | act.Position = position; |
98 | _characters.Add(act); | 95 | _characters.Add(act); |
99 | return act; | 96 | return act; |
100 | } | 97 | } |
101 | 98 | ||
102 | public override void RemovePrim(PhysicsActor prim) | 99 | public override void RemovePrim(PhysicsActor prim) |
103 | { | 100 | { |
104 | |||
105 | } | 101 | } |
106 | 102 | ||
107 | public override void RemoveAvatar(PhysicsActor actor) | 103 | public override void RemoveAvatar(PhysicsActor actor) |
108 | { | 104 | { |
105 | } | ||
109 | 106 | ||
107 | private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | ||
108 | { | ||
109 | Vec3 pos = new Vec3(); | ||
110 | pos.X = position.X; | ||
111 | pos.Y = position.Y; | ||
112 | pos.Z = position.Z; | ||
113 | Vec3 siz = new Vec3(); | ||
114 | siz.X = size.X; | ||
115 | siz.Y = size.Y; | ||
116 | siz.Z = size.Z; | ||
117 | PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz)); | ||
118 | _prims.Add(act); | ||
119 | return act; | ||
110 | } | 120 | } |
111 | 121 | ||
112 | PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 122 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
113 | { | 123 | PhysicsVector size, Quaternion rotation) |
114 | Vec3 pos = new Vec3(); | ||
115 | pos.X = position.X; | ||
116 | pos.Y = position.Y; | ||
117 | pos.Z = position.Z; | ||
118 | Vec3 siz = new Vec3(); | ||
119 | siz.X = size.X; | ||
120 | siz.Y = size.Y; | ||
121 | siz.Z = size.Z; | ||
122 | PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); | ||
123 | _prims.Add(act); | ||
124 | return act; | ||
125 | } | ||
126 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) | ||
127 | { | 124 | { |
128 | return AddPrim(position, size, rotation); | 125 | return AddPrim(position, size, rotation); |
129 | } | 126 | } |
130 | 127 | ||
131 | public override void Simulate(float timeStep) | 128 | public override void Simulate(float timeStep) |
132 | { | 129 | { |
133 | try | 130 | try |
134 | { | 131 | { |
135 | foreach (PhysXCharacter actor in _characters) | 132 | foreach (PhysXCharacter actor in _characters) |
@@ -149,309 +146,237 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
149 | { | 146 | { |
150 | Console.WriteLine(e.Message); | 147 | Console.WriteLine(e.Message); |
151 | } | 148 | } |
152 | 149 | } | |
153 | } | 150 | |
154 | 151 | public override void GetResults() | |
155 | public override void GetResults() | 152 | { |
156 | { | 153 | } |
157 | 154 | ||
158 | } | 155 | public override bool IsThreaded |
159 | 156 | { | |
160 | public override bool IsThreaded | 157 | get { return (false); // for now we won't be multithreaded |
161 | { | 158 | } |
162 | get | 159 | } |
163 | { | 160 | |
164 | return(false); // for now we won't be multithreaded | 161 | public override void SetTerrain(float[] heightMap) |
165 | } | 162 | { |
166 | } | 163 | if (_heightMap != null) |
167 | |||
168 | public override void SetTerrain(float[] heightMap) | ||
169 | { | ||
170 | if (this._heightMap != null) | ||
171 | { | 164 | { |
172 | Console.WriteLine("PhysX - deleting old terrain"); | 165 | Console.WriteLine("PhysX - deleting old terrain"); |
173 | this.scene.DeleteTerrain(); | 166 | scene.DeleteTerrain(); |
174 | } | 167 | } |
175 | this._heightMap = heightMap; | 168 | _heightMap = heightMap; |
176 | this.scene.AddTerrain(heightMap); | 169 | scene.AddTerrain(heightMap); |
177 | } | 170 | } |
178 | 171 | ||
179 | public override void DeleteTerrain() | 172 | public override void DeleteTerrain() |
180 | { | 173 | { |
181 | this.scene.DeleteTerrain(); | 174 | scene.DeleteTerrain(); |
182 | } | 175 | } |
183 | } | 176 | } |
184 | 177 | ||
185 | public class PhysXCharacter : PhysicsActor | 178 | public class PhysXCharacter : PhysicsActor |
186 | { | 179 | { |
187 | private PhysicsVector _position; | 180 | private PhysicsVector _position; |
188 | private PhysicsVector _velocity; | 181 | private PhysicsVector _velocity; |
189 | private PhysicsVector _acceleration; | 182 | private PhysicsVector _acceleration; |
190 | private NxCharacter _character; | 183 | private NxCharacter _character; |
191 | private bool flying; | 184 | private bool flying; |
192 | private float gravityAccel; | 185 | private float gravityAccel; |
193 | 186 | ||
194 | public PhysXCharacter(NxCharacter character) | 187 | public PhysXCharacter(NxCharacter character) |
195 | { | 188 | { |
196 | _velocity = new PhysicsVector(); | 189 | _velocity = new PhysicsVector(); |
197 | _position = new PhysicsVector(); | 190 | _position = new PhysicsVector(); |
198 | _acceleration = new PhysicsVector(); | 191 | _acceleration = new PhysicsVector(); |
199 | _character = character; | 192 | _character = character; |
200 | } | 193 | } |
201 | 194 | ||
202 | public override bool Flying | 195 | public override bool Flying |
203 | { | 196 | { |
204 | get | 197 | get { return flying; } |
205 | { | 198 | set { flying = value; } |
206 | return flying; | 199 | } |
207 | } | 200 | |
208 | set | 201 | public override PhysicsVector Position |
209 | { | 202 | { |
210 | flying = value; | 203 | get { return _position; } |
211 | } | 204 | set |
212 | } | 205 | { |
213 | 206 | _position = value; | |
214 | public override PhysicsVector Position | ||
215 | { | ||
216 | get | ||
217 | { | ||
218 | return _position; | ||
219 | } | ||
220 | set | ||
221 | { | ||
222 | _position = value; | ||
223 | Vec3 ps = new Vec3(); | 207 | Vec3 ps = new Vec3(); |
224 | ps.X = value.X; | 208 | ps.X = value.X; |
225 | ps.Y = value.Y; | 209 | ps.Y = value.Y; |
226 | ps.Z = value.Z; | 210 | ps.Z = value.Z; |
227 | this._character.Position = ps; | 211 | _character.Position = ps; |
228 | } | 212 | } |
229 | } | 213 | } |
230 | 214 | ||
231 | public override PhysicsVector Size | 215 | public override PhysicsVector Size |
232 | { | 216 | { |
233 | get | 217 | get { return new PhysicsVector(0, 0, 0); } |
218 | set { } | ||
219 | } | ||
220 | |||
221 | public override PhysicsVector Velocity | ||
222 | { | ||
223 | get { return _velocity; } | ||
224 | set { _velocity = value; } | ||
225 | } | ||
226 | |||
227 | public override bool Kinematic | ||
228 | { | ||
229 | get { return false; } | ||
230 | set { } | ||
231 | } | ||
232 | |||
233 | public override Quaternion Orientation | ||
234 | { | ||
235 | get { return Quaternion.Identity; } | ||
236 | set { } | ||
237 | } | ||
238 | |||
239 | public override PhysicsVector Acceleration | ||
240 | { | ||
241 | get { return _acceleration; } | ||
242 | } | ||
243 | |||
244 | public void SetAcceleration(PhysicsVector accel) | ||
245 | { | ||
246 | _acceleration = accel; | ||
247 | } | ||
248 | |||
249 | public override void AddForce(PhysicsVector force) | ||
250 | { | ||
251 | } | ||
252 | |||
253 | public override void SetMomentum(PhysicsVector momentum) | ||
254 | { | ||
255 | } | ||
256 | |||
257 | public void Move(float timeStep) | ||
258 | { | ||
259 | Vec3 vec = new Vec3(); | ||
260 | vec.X = _velocity.X*timeStep; | ||
261 | vec.Y = _velocity.Y*timeStep; | ||
262 | if (flying) | ||
234 | { | 263 | { |
235 | return new PhysicsVector(0,0,0); | 264 | vec.Z = (_velocity.Z)*timeStep; |
236 | } | 265 | } |
237 | set | 266 | else |
267 | { | ||
268 | gravityAccel += -9.8f; | ||
269 | vec.Z = (gravityAccel + _velocity.Z)*timeStep; | ||
270 | } | ||
271 | int res = _character.Move(vec); | ||
272 | if (res == 1) | ||
238 | { | 273 | { |
274 | gravityAccel = 0; | ||
239 | } | 275 | } |
240 | } | 276 | } |
241 | public override PhysicsVector Velocity | ||
242 | { | ||
243 | get | ||
244 | { | ||
245 | return _velocity; | ||
246 | } | ||
247 | set | ||
248 | { | ||
249 | _velocity = value; | ||
250 | } | ||
251 | } | ||
252 | |||
253 | public override bool Kinematic | ||
254 | { | ||
255 | get | ||
256 | { | ||
257 | return false; | ||
258 | } | ||
259 | set | ||
260 | { | ||
261 | |||
262 | } | ||
263 | } | ||
264 | |||
265 | public override Quaternion Orientation | ||
266 | { | ||
267 | get | ||
268 | { | ||
269 | return Quaternion.Identity; | ||
270 | } | ||
271 | set | ||
272 | { | ||
273 | |||
274 | } | ||
275 | } | ||
276 | |||
277 | public override PhysicsVector Acceleration | ||
278 | { | ||
279 | get | ||
280 | { | ||
281 | return _acceleration; | ||
282 | } | ||
283 | |||
284 | } | ||
285 | public void SetAcceleration (PhysicsVector accel) | ||
286 | { | ||
287 | this._acceleration = accel; | ||
288 | } | ||
289 | |||
290 | public override void AddForce(PhysicsVector force) | ||
291 | { | ||
292 | |||
293 | } | ||
294 | |||
295 | public override void SetMomentum(PhysicsVector momentum) | ||
296 | { | ||
297 | |||
298 | } | ||
299 | |||
300 | public void Move(float timeStep) | ||
301 | { | ||
302 | Vec3 vec = new Vec3(); | ||
303 | vec.X = this._velocity.X * timeStep; | ||
304 | vec.Y = this._velocity.Y * timeStep; | ||
305 | if(flying) | ||
306 | { | ||
307 | vec.Z = ( this._velocity.Z) * timeStep; | ||
308 | } | ||
309 | else | ||
310 | { | ||
311 | gravityAccel+= -9.8f; | ||
312 | vec.Z = (gravityAccel + this._velocity.Z) * timeStep; | ||
313 | } | ||
314 | int res = this._character.Move(vec); | ||
315 | if(res == 1) | ||
316 | { | ||
317 | gravityAccel = 0; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | public void UpdatePosition() | ||
322 | { | ||
323 | Vec3 vec = this._character.Position; | ||
324 | this._position.X = vec.X; | ||
325 | this._position.Y = vec.Y; | ||
326 | this._position.Z = vec.Z; | ||
327 | } | ||
328 | } | ||
329 | |||
330 | public class PhysXPrim : PhysicsActor | ||
331 | { | ||
332 | private PhysicsVector _position; | ||
333 | private PhysicsVector _velocity; | ||
334 | private PhysicsVector _acceleration; | ||
335 | private NxActor _prim; | ||
336 | |||
337 | public PhysXPrim(NxActor prim) | ||
338 | { | ||
339 | _velocity = new PhysicsVector(); | ||
340 | _position = new PhysicsVector(); | ||
341 | _acceleration = new PhysicsVector(); | ||
342 | _prim = prim; | ||
343 | } | ||
344 | public override bool Flying | ||
345 | { | ||
346 | get | ||
347 | { | ||
348 | return false; //no flying prims for you | ||
349 | } | ||
350 | set | ||
351 | { | ||
352 | |||
353 | } | ||
354 | } | ||
355 | public override PhysicsVector Position | ||
356 | { | ||
357 | get | ||
358 | { | ||
359 | PhysicsVector pos = new PhysicsVector(); | ||
360 | Vec3 vec = this._prim.Position; | ||
361 | pos.X = vec.X; | ||
362 | pos.Y = vec.Y; | ||
363 | pos.Z = vec.Z; | ||
364 | return pos; | ||
365 | |||
366 | } | ||
367 | set | ||
368 | { | ||
369 | PhysicsVector vec = value; | ||
370 | Vec3 pos = new Vec3(); | ||
371 | pos.X = vec.X; | ||
372 | pos.Y = vec.Y; | ||
373 | pos.Z = vec.Z; | ||
374 | this._prim.Position = pos; | ||
375 | } | ||
376 | } | ||
377 | 277 | ||
378 | public override PhysicsVector Size | 278 | public void UpdatePosition() |
279 | { | ||
280 | Vec3 vec = _character.Position; | ||
281 | _position.X = vec.X; | ||
282 | _position.Y = vec.Y; | ||
283 | _position.Z = vec.Z; | ||
284 | } | ||
285 | } | ||
286 | |||
287 | public class PhysXPrim : PhysicsActor | ||
288 | { | ||
289 | private PhysicsVector _position; | ||
290 | private PhysicsVector _velocity; | ||
291 | private PhysicsVector _acceleration; | ||
292 | private NxActor _prim; | ||
293 | |||
294 | public PhysXPrim(NxActor prim) | ||
295 | { | ||
296 | _velocity = new PhysicsVector(); | ||
297 | _position = new PhysicsVector(); | ||
298 | _acceleration = new PhysicsVector(); | ||
299 | _prim = prim; | ||
300 | } | ||
301 | |||
302 | public override bool Flying | ||
303 | { | ||
304 | get { return false; //no flying prims for you | ||
305 | } | ||
306 | set { } | ||
307 | } | ||
308 | |||
309 | public override PhysicsVector Position | ||
379 | { | 310 | { |
380 | get | 311 | get |
381 | { | 312 | { |
382 | return new PhysicsVector(0, 0, 0); | 313 | PhysicsVector pos = new PhysicsVector(); |
314 | Vec3 vec = _prim.Position; | ||
315 | pos.X = vec.X; | ||
316 | pos.Y = vec.Y; | ||
317 | pos.Z = vec.Z; | ||
318 | return pos; | ||
383 | } | 319 | } |
384 | set | 320 | set |
385 | { | 321 | { |
322 | PhysicsVector vec = value; | ||
323 | Vec3 pos = new Vec3(); | ||
324 | pos.X = vec.X; | ||
325 | pos.Y = vec.Y; | ||
326 | pos.Z = vec.Z; | ||
327 | _prim.Position = pos; | ||
386 | } | 328 | } |
387 | } | 329 | } |
388 | 330 | ||
389 | public override PhysicsVector Velocity | 331 | public override PhysicsVector Size |
390 | { | 332 | { |
391 | get | 333 | get { return new PhysicsVector(0, 0, 0); } |
392 | { | 334 | set { } |
393 | return _velocity; | 335 | } |
394 | } | 336 | |
395 | set | 337 | public override PhysicsVector Velocity |
396 | { | 338 | { |
397 | _velocity = value; | 339 | get { return _velocity; } |
398 | } | 340 | set { _velocity = value; } |
399 | } | 341 | } |
400 | 342 | ||
401 | public override bool Kinematic | 343 | public override bool Kinematic |
402 | { | 344 | { |
403 | get | 345 | get { return _prim.Kinematic; } |
404 | { | 346 | set { _prim.Kinematic = value; } |
405 | return this._prim.Kinematic; | 347 | } |
406 | } | 348 | |
407 | set | 349 | public override Quaternion Orientation |
408 | { | 350 | { |
409 | this._prim.Kinematic = value; | 351 | get |
410 | } | 352 | { |
411 | } | 353 | Quaternion res = new Quaternion(); |
412 | 354 | PhysXWrapper.Quaternion quat = _prim.GetOrientation(); | |
413 | public override Quaternion Orientation | 355 | res.w = quat.W; |
414 | { | 356 | res.x = quat.X; |
415 | get | 357 | res.y = quat.Y; |
416 | { | 358 | res.z = quat.Z; |
417 | Quaternion res = new Quaternion(); | 359 | return res; |
418 | PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); | 360 | } |
419 | res.w = quat.W; | 361 | set { } |
420 | res.x = quat.X; | 362 | } |
421 | res.y = quat.Y; | 363 | |
422 | res.z = quat.Z; | 364 | public override PhysicsVector Acceleration |
423 | return res; | 365 | { |
424 | } | 366 | get { return _acceleration; } |
425 | set | 367 | } |
426 | { | 368 | |
427 | 369 | public void SetAcceleration(PhysicsVector accel) | |
428 | } | 370 | { |
429 | } | 371 | _acceleration = accel; |
430 | 372 | } | |
431 | public override PhysicsVector Acceleration | 373 | |
432 | { | 374 | public override void AddForce(PhysicsVector force) |
433 | get | 375 | { |
434 | { | 376 | } |
435 | return _acceleration; | 377 | |
436 | } | 378 | public override void SetMomentum(PhysicsVector momentum) |
437 | 379 | { | |
438 | } | 380 | } |
439 | public void SetAcceleration (PhysicsVector accel) | 381 | } |
440 | { | 382 | } \ No newline at end of file |
441 | this._acceleration = accel; | ||
442 | } | ||
443 | |||
444 | public override void AddForce(PhysicsVector force) | ||
445 | { | ||
446 | |||
447 | } | ||
448 | |||
449 | public override void SetMomentum(PhysicsVector momentum) | ||
450 | { | ||
451 | |||
452 | } | ||
453 | |||
454 | |||
455 | } | ||
456 | |||
457 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs index a2148ea..c656e01 100644 --- a/OpenSim/Region/ScriptEngine/Common/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
34 | 33 | ||
@@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
53 | { | 52 | { |
54 | //Console.WriteLine("Executor: InitializeLifetimeService()"); | 53 | //Console.WriteLine("Executor: InitializeLifetimeService()"); |
55 | // return null; | 54 | // return null; |
56 | ILease lease = (ILease)base.InitializeLifetimeService(); | 55 | ILease lease = (ILease) base.InitializeLifetimeService(); |
57 | 56 | ||
58 | if (lease.CurrentState == LeaseState.Initial) | 57 | if (lease.CurrentState == LeaseState.Initial) |
59 | { | 58 | { |
@@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
75 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 74 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
76 | //try | 75 | //try |
77 | //{ | 76 | //{ |
78 | if (m_Running == false) | 77 | if (m_Running == false) |
79 | { | 78 | { |
80 | // Script is inactive, do not execute! | 79 | // Script is inactive, do not execute! |
81 | return; | 80 | return; |
82 | } | 81 | } |
83 | 82 | ||
84 | string EventName = m_Script.State() + "_event_" + FunctionName; | 83 | string EventName = m_Script.State() + "_event_" + FunctionName; |
85 | 84 | ||
86 | //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); | 85 | //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); |
87 | 86 | ||
88 | //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); | 87 | //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); |
89 | 88 | ||
90 | if (Events.ContainsKey(EventName) == false) | 89 | if (Events.ContainsKey(EventName) == false) |
90 | { | ||
91 | // Not found, create | ||
92 | Type type = m_Script.GetType(); | ||
93 | try | ||
91 | { | 94 | { |
92 | // Not found, create | 95 | MethodInfo mi = type.GetMethod(EventName); |
93 | Type type = m_Script.GetType(); | 96 | Events.Add(EventName, mi); |
94 | try | ||
95 | { | ||
96 | MethodInfo mi = type.GetMethod(EventName); | ||
97 | Events.Add(EventName, mi); | ||
98 | } | ||
99 | catch | ||
100 | { | ||
101 | // Event name not found, cache it as not found | ||
102 | Events.Add(EventName, null); | ||
103 | } | ||
104 | } | 97 | } |
105 | 98 | catch | |
106 | // Get event | ||
107 | MethodInfo ev = null; | ||
108 | Events.TryGetValue(EventName, out ev); | ||
109 | |||
110 | if (ev == null) // No event by that name! | ||
111 | { | 99 | { |
112 | //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); | 100 | // Event name not found, cache it as not found |
113 | return; | 101 | Events.Add(EventName, null); |
114 | } | 102 | } |
103 | } | ||
104 | |||
105 | // Get event | ||
106 | MethodInfo ev = null; | ||
107 | Events.TryGetValue(EventName, out ev); | ||
108 | |||
109 | if (ev == null) // No event by that name! | ||
110 | { | ||
111 | //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); | ||
112 | return; | ||
113 | } | ||
115 | 114 | ||
116 | // Found | 115 | // Found |
117 | //try | 116 | //try |
118 | //{ | 117 | //{ |
119 | // Invoke it | 118 | // Invoke it |
120 | ev.Invoke(m_Script, args); | 119 | ev.Invoke(m_Script, args); |
121 | 120 | ||
122 | //} | 121 | //} |
123 | //catch (Exception e) | 122 | //catch (Exception e) |
124 | //{ | 123 | //{ |
125 | // // TODO: Send to correct place | 124 | // // TODO: Send to correct place |
126 | // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); | 125 | // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); |
127 | //} | 126 | //} |
128 | 127 | ||
129 | 128 | ||
130 | //} | 129 | //} |
@@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
136 | { | 135 | { |
137 | m_Running = false; | 136 | m_Running = false; |
138 | } | 137 | } |
139 | |||
140 | |||
141 | } | 138 | } |
142 | 139 | } \ No newline at end of file | |
143 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs index df0e824..08c0e9c 100644 --- a/OpenSim/Region/ScriptEngine/Common/IScript.cs +++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Common | 29 | namespace OpenSim.Region.ScriptEngine.Common |
34 | { | 30 | { |
35 | public interface IScript | 31 | public interface IScript |
@@ -37,4 +33,4 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
37 | string State(); | 33 | string State(); |
38 | Executor Exec { get; } | 34 | Executor Exec { get; } |
39 | } | 35 | } |
40 | } | 36 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index ff5c6bf..9cba882 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -26,15 +26,12 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Region.ScriptEngine.Common | 31 | namespace OpenSim.Region.ScriptEngine.Common |
34 | { | 32 | { |
35 | public interface LSL_BuiltIn_Commands_Interface | 33 | public interface LSL_BuiltIn_Commands_Interface |
36 | { | 34 | { |
37 | |||
38 | string State(); | 35 | string State(); |
39 | 36 | ||
40 | double llSin(double f); | 37 | double llSin(double f); |
@@ -404,7 +401,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
404 | //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) | 401 | //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) |
405 | void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); | 402 | void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); |
406 | //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) | 403 | //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) |
407 | void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west); | 404 | void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, |
405 | LSL_Types.Vector3 bottom_south_west); | ||
406 | |||
408 | //wiki: llEjectFromLand(key pest) | 407 | //wiki: llEjectFromLand(key pest) |
409 | void llEjectFromLand(string pest); | 408 | void llEjectFromLand(string pest); |
410 | void llParseString2List(); | 409 | void llParseString2List(); |
@@ -437,7 +436,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
437 | //wiki: double llGetRegionFPS() | 436 | //wiki: double llGetRegionFPS() |
438 | double llGetRegionFPS(); | 437 | double llGetRegionFPS(); |
439 | //wiki: llParticleSystem(List<Object> rules | 438 | //wiki: llParticleSystem(List<Object> rules |
440 | void llParticleSystem(List<Object> rules); | 439 | void llParticleSystem(List<object> rules); |
441 | //wiki: llGroundRepel(double height, integer water, double tau) | 440 | //wiki: llGroundRepel(double height, integer water, double tau) |
442 | void llGroundRepel(double height, int water, double tau); | 441 | void llGroundRepel(double height, int water, double tau); |
443 | void llGiveInventoryList(); | 442 | void llGiveInventoryList(); |
@@ -548,7 +547,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
548 | //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) | 547 | //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) |
549 | List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); | 548 | List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); |
550 | //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) | 549 | //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) |
551 | void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param); | 550 | void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, |
551 | LSL_Types.Quaternion rot, int param); | ||
552 | |||
552 | //wiki: integer llGetObjectPermMask(integer mask) | 553 | //wiki: integer llGetObjectPermMask(integer mask) |
553 | int llGetObjectPermMask(int mask); | 554 | int llGetObjectPermMask(int mask); |
554 | //wiki: llSetObjectPermMask(integer mask, integer value) | 555 | //wiki: llSetObjectPermMask(integer mask, integer value) |
@@ -632,4 +633,4 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
632 | //OpenSim functions | 633 | //OpenSim functions |
633 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | 634 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); |
634 | } | 635 | } |
635 | } | 636 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 7d69379..df3d752 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -41,11 +41,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
41 | public double Z; | 41 | public double Z; |
42 | 42 | ||
43 | public Vector3(Vector3 vector) | 43 | public Vector3(Vector3 vector) |
44 | { | 44 | { |
45 | X = (float)vector.X; | 45 | X = (float) vector.X; |
46 | Y = (float)vector.Y; | 46 | Y = (float) vector.Y; |
47 | Z = (float)vector.Z; | 47 | Z = (float) vector.Z; |
48 | } | 48 | } |
49 | |||
49 | public Vector3(double x, double y, double z) | 50 | public Vector3(double x, double y, double z) |
50 | { | 51 | { |
51 | X = x; | 52 | X = x; |
@@ -53,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
53 | Z = z; | 54 | Z = z; |
54 | } | 55 | } |
55 | } | 56 | } |
57 | |||
56 | [Serializable] | 58 | [Serializable] |
57 | public struct Quaternion | 59 | public struct Quaternion |
58 | { | 60 | { |
@@ -62,12 +64,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
62 | public double R; | 64 | public double R; |
63 | 65 | ||
64 | public Quaternion(Quaternion Quat) | 66 | public Quaternion(Quaternion Quat) |
65 | { | 67 | { |
66 | X = (float)Quat.X; | 68 | X = (float) Quat.X; |
67 | Y = (float)Quat.Y; | 69 | Y = (float) Quat.Y; |
68 | Z = (float)Quat.Z; | 70 | Z = (float) Quat.Z; |
69 | R = (float)Quat.R; | 71 | R = (float) Quat.R; |
70 | } | 72 | } |
73 | |||
71 | public Quaternion(double x, double y, double z, double r) | 74 | public Quaternion(double x, double y, double z, double r) |
72 | { | 75 | { |
73 | X = x; | 76 | X = x; |
@@ -75,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
75 | Z = z; | 78 | Z = z; |
76 | R = r; | 79 | R = r; |
77 | } | 80 | } |
78 | |||
79 | } | 81 | } |
80 | } | 82 | } |
81 | } | 83 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs index 98704d5..48cf45a 100644 --- a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
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 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] | 24 | |
25 | [assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 31 | // Build Number |
30 | // Revision | 32 | // Revision |
31 | // | 33 | // |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 34 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 35 | [assembly : AssemblyVersion("1.0.0.0")] |
36 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs index 391e3aa..bc241ce 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs | |||
@@ -27,27 +27,22 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | ||
34 | using System.Runtime.Remoting; | ||
35 | using System.IO; | ||
36 | using OpenSim.Region.Environment.Scenes; | ||
37 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
38 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | 33 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
39 | using OpenSim.Region.ScriptEngine.Common; | ||
40 | using libsecondlife; | ||
41 | 34 | ||
42 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
43 | { | 36 | { |
44 | public class AppDomainManager | 37 | public class AppDomainManager |
45 | { | 38 | { |
46 | private int maxScriptsPerAppDomain = 1; | 39 | private int maxScriptsPerAppDomain = 1; |
40 | |||
47 | /// <summary> | 41 | /// <summary> |
48 | /// Internal list of all AppDomains | 42 | /// Internal list of all AppDomains |
49 | /// </summary> | 43 | /// </summary> |
50 | private List<AppDomainStructure> appDomains = new List<AppDomainStructure>(); | 44 | private List<AppDomainStructure> appDomains = new List<AppDomainStructure>(); |
45 | |||
51 | /// <summary> | 46 | /// <summary> |
52 | /// Structure to keep track of data around AppDomain | 47 | /// Structure to keep track of data around AppDomain |
53 | /// </summary> | 48 | /// </summary> |
@@ -57,19 +52,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
57 | /// The AppDomain itself | 52 | /// The AppDomain itself |
58 | /// </summary> | 53 | /// </summary> |
59 | public AppDomain CurrentAppDomain; | 54 | public AppDomain CurrentAppDomain; |
55 | |||
60 | /// <summary> | 56 | /// <summary> |
61 | /// Number of scripts loaded into AppDomain | 57 | /// Number of scripts loaded into AppDomain |
62 | /// </summary> | 58 | /// </summary> |
63 | public int ScriptsLoaded; | 59 | public int ScriptsLoaded; |
60 | |||
64 | /// <summary> | 61 | /// <summary> |
65 | /// Number of dead scripts | 62 | /// Number of dead scripts |
66 | /// </summary> | 63 | /// </summary> |
67 | public int ScriptsWaitingUnload; | 64 | public int ScriptsWaitingUnload; |
68 | } | 65 | } |
66 | |||
69 | /// <summary> | 67 | /// <summary> |
70 | /// Current AppDomain | 68 | /// Current AppDomain |
71 | /// </summary> | 69 | /// </summary> |
72 | private AppDomainStructure currentAD; | 70 | private AppDomainStructure currentAD; |
71 | |||
73 | private object getLock = new object(); // Mutex | 72 | private object getLock = new object(); // Mutex |
74 | private object freeLock = new object(); // Mutex | 73 | private object freeLock = new object(); // Mutex |
75 | 74 | ||
@@ -94,22 +93,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
94 | { | 93 | { |
95 | // Add it to AppDomains list and empty current | 94 | // Add it to AppDomains list and empty current |
96 | appDomains.Add(currentAD); | 95 | appDomains.Add(currentAD); |
97 | currentAD = null; | 96 | currentAD = null; |
98 | } | 97 | } |
99 | // No current | 98 | // No current |
100 | if (currentAD == null) | 99 | if (currentAD == null) |
101 | { | 100 | { |
102 | // Create a new current AppDomain | 101 | // Create a new current AppDomain |
103 | currentAD = new AppDomainStructure(); | 102 | currentAD = new AppDomainStructure(); |
104 | currentAD.CurrentAppDomain = PrepareNewAppDomain(); | 103 | currentAD.CurrentAppDomain = PrepareNewAppDomain(); |
105 | } | 104 | } |
106 | 105 | ||
107 | Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); | 106 | Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); |
108 | return currentAD; | 107 | return currentAD; |
109 | } // lock | 108 | } // lock |
110 | } | 109 | } |
111 | 110 | ||
112 | private int AppDomainNameCount; | 111 | private int AppDomainNameCount; |
112 | |||
113 | /// <summary> | 113 | /// <summary> |
114 | /// Create and prepare a new AppDomain for scripts | 114 | /// Create and prepare a new AppDomain for scripts |
115 | /// </summary> | 115 | /// </summary> |
@@ -130,12 +130,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
130 | ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; | 130 | ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; |
131 | 131 | ||
132 | AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); | 132 | AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); |
133 | Console.WriteLine("Loading: " + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); | 133 | Console.WriteLine("Loading: " + |
134 | AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); | ||
134 | AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); | 135 | AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); |
135 | 136 | ||
136 | // Return the new AppDomain | 137 | // Return the new AppDomain |
137 | return AD; | 138 | return AD; |
138 | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
@@ -146,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
146 | lock (freeLock) | 146 | lock (freeLock) |
147 | { | 147 | { |
148 | // Go through all | 148 | // Go through all |
149 | foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) | 149 | foreach (AppDomainStructure ads in new ArrayList(appDomains)) |
150 | { | 150 | { |
151 | // Don't process current AppDomain | 151 | // Don't process current AppDomain |
152 | if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) | 152 | if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) |
@@ -164,23 +164,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
164 | // Unload | 164 | // Unload |
165 | AppDomain.Unload(ads.CurrentAppDomain); | 165 | AppDomain.Unload(ads.CurrentAppDomain); |
166 | #if DEBUG | 166 | #if DEBUG |
167 | Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); | 167 | Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + |
168 | " bytes of memory"); | ||
168 | #endif | 169 | #endif |
169 | } | 170 | } |
170 | } | 171 | } |
171 | } // foreach | 172 | } // foreach |
172 | } // lock | 173 | } // lock |
173 | } | 174 | } |
174 | |||
175 | 175 | ||
176 | 176 | ||
177 | public OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadScript(string FileName) | 177 | public LSL_BaseClass LoadScript(string FileName) |
178 | { | 178 | { |
179 | // Find next available AppDomain to put it in | 179 | // Find next available AppDomain to put it in |
180 | AppDomainStructure FreeAppDomain = GetFreeAppDomain(); | 180 | AppDomainStructure FreeAppDomain = GetFreeAppDomain(); |
181 | 181 | ||
182 | Console.WriteLine("Loading into AppDomain: " + FileName); | 182 | Console.WriteLine("Loading into AppDomain: " + FileName); |
183 | LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); | 183 | LSL_BaseClass mbrt = |
184 | (LSL_BaseClass) | ||
185 | FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); | ||
184 | //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); | 186 | //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); |
185 | FreeAppDomain.ScriptsLoaded++; | 187 | FreeAppDomain.ScriptsLoaded++; |
186 | 188 | ||
@@ -207,7 +209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
207 | } | 209 | } |
208 | 210 | ||
209 | // Lopp through all AppDomains | 211 | // Lopp through all AppDomains |
210 | foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) | 212 | foreach (AppDomainStructure ads in new ArrayList(appDomains)) |
211 | { | 213 | { |
212 | if (ads.CurrentAppDomain == ad) | 214 | if (ads.CurrentAppDomain == ad) |
213 | { | 215 | { |
@@ -219,10 +221,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
219 | } // lock | 221 | } // lock |
220 | 222 | ||
221 | UnloadAppDomains(); // Outsite lock, has its own GetLock | 223 | UnloadAppDomains(); // Outsite lock, has its own GetLock |
222 | |||
223 | |||
224 | } | 224 | } |
225 | |||
226 | |||
227 | } | 225 | } |
228 | } | 226 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs index 49ce8b8..e04a9ed 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs | |||
@@ -26,34 +26,30 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 29 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
34 | { | 30 | { |
35 | public static class Common | 31 | public static class Common |
36 | { | 32 | { |
37 | static public bool debug = true; | 33 | public static bool debug = true; |
38 | static public ScriptEngine mySE; | 34 | public static ScriptEngine mySE; |
39 | 35 | ||
40 | //public delegate void SendToDebugEventDelegate(string Message); | 36 | //public delegate void SendToDebugEventDelegate(string Message); |
41 | //public delegate void SendToLogEventDelegate(string Message); | 37 | //public delegate void SendToLogEventDelegate(string Message); |
42 | //static public event SendToDebugEventDelegate SendToDebugEvent; | 38 | //static public event SendToDebugEventDelegate SendToDebugEvent; |
43 | //static public event SendToLogEventDelegate SendToLogEvent; | 39 | //static public event SendToLogEventDelegate SendToLogEvent; |
44 | 40 | ||
45 | static public void SendToDebug(string Message) | 41 | public static void SendToDebug(string Message) |
46 | { | 42 | { |
47 | //if (Debug == true) | 43 | //if (Debug == true) |
48 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); | 44 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); |
49 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 45 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
50 | } | 46 | } |
51 | static public void SendToLog(string Message) | 47 | |
48 | public static void SendToLog(string Message) | ||
52 | { | 49 | { |
53 | //if (Debug == true) | 50 | //if (Debug == true) |
54 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); | 51 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); |
55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 52 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
56 | } | 53 | } |
57 | } | 54 | } |
58 | 55 | } \ No newline at end of file | |
59 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index a2eee66..7f452e0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -27,16 +27,13 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using Microsoft.CSharp; | ||
34 | using System.CodeDom.Compiler; | 30 | using System.CodeDom.Compiler; |
31 | using System.IO; | ||
35 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Microsoft.CSharp; | ||
36 | 34 | ||
37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
38 | { | 36 | { |
39 | |||
40 | public class Compiler | 37 | public class Compiler |
41 | { | 38 | { |
42 | private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); | 39 | private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); |
@@ -45,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
45 | //private ICodeCompiler icc = codeProvider.CreateCompiler(); | 42 | //private ICodeCompiler icc = codeProvider.CreateCompiler(); |
46 | public string CompileFromFile(string LSOFileName) | 43 | public string CompileFromFile(string LSOFileName) |
47 | { | 44 | { |
48 | switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) | 45 | switch (Path.GetExtension(LSOFileName).ToLower()) |
49 | { | 46 | { |
50 | case ".txt": | 47 | case ".txt": |
51 | case ".lsl": | 48 | case ".lsl": |
@@ -58,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
58 | throw new Exception("Unknown script type."); | 55 | throw new Exception("Unknown script type."); |
59 | } | 56 | } |
60 | } | 57 | } |
58 | |||
61 | /// <summary> | 59 | /// <summary> |
62 | /// Converts script from LSL to CS and calls CompileFromCSText | 60 | /// Converts script from LSL to CS and calls CompileFromCSText |
63 | /// </summary> | 61 | /// </summary> |
@@ -67,13 +65,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
67 | { | 65 | { |
68 | if (Script.Substring(0, 4).ToLower() == "//c#") | 66 | if (Script.Substring(0, 4).ToLower() == "//c#") |
69 | { | 67 | { |
70 | return CompileFromCSText( Script ); | 68 | return CompileFromCSText(Script); |
71 | } | 69 | } |
72 | else | 70 | else |
73 | { | 71 | { |
74 | return CompileFromCSText(LSL_Converter.Convert(Script)); | 72 | return CompileFromCSText(LSL_Converter.Convert(Script)); |
75 | } | 73 | } |
76 | } | 74 | } |
75 | |||
77 | /// <summary> | 76 | /// <summary> |
78 | /// Compile CS script to .Net assembly (.dll) | 77 | /// Compile CS script to .Net assembly (.dll) |
79 | /// </summary> | 78 | /// </summary> |
@@ -81,14 +80,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
81 | /// <returns>Filename to .dll assembly</returns> | 80 | /// <returns>Filename to .dll assembly</returns> |
82 | public string CompileFromCSText(string Script) | 81 | public string CompileFromCSText(string Script) |
83 | { | 82 | { |
84 | |||
85 | |||
86 | // Output assembly name | 83 | // Output assembly name |
87 | scriptCompileCounter++; | 84 | scriptCompileCounter++; |
88 | string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); | 85 | string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); |
89 | try | 86 | try |
90 | { | 87 | { |
91 | System.IO.File.Delete(OutFile); | 88 | File.Delete(OutFile); |
92 | } | 89 | } |
93 | catch (Exception e) | 90 | catch (Exception e) |
94 | { | 91 | { |
@@ -99,12 +96,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
99 | // DEBUG - write source to disk | 96 | // DEBUG - write source to disk |
100 | try | 97 | try |
101 | { | 98 | { |
102 | File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); | 99 | File.WriteAllText( |
100 | Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); | ||
101 | } | ||
102 | catch | ||
103 | { | ||
103 | } | 104 | } |
104 | catch { } | ||
105 | 105 | ||
106 | // Do actual compile | 106 | // Do actual compile |
107 | System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); | 107 | CompilerParameters parameters = new CompilerParameters(); |
108 | parameters.IncludeDebugInformation = true; | 108 | parameters.IncludeDebugInformation = true; |
109 | // Add all available assemblies | 109 | // Add all available assemblies |
110 | foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) | 110 | foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) |
@@ -114,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
114 | } | 114 | } |
115 | 115 | ||
116 | string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | 116 | string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); |
117 | string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); | 117 | string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); |
118 | //Console.WriteLine("Assembly location: " + rootPath); | 118 | //Console.WriteLine("Assembly location: " + rootPath); |
119 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); | 119 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); |
120 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); | 120 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); |
121 | 121 | ||
122 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); | 122 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); |
123 | parameters.GenerateExecutable = false; | 123 | parameters.GenerateExecutable = false; |
124 | parameters.OutputAssembly = OutFile; | 124 | parameters.OutputAssembly = OutFile; |
@@ -129,13 +129,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
129 | // TODO: Return errors to user somehow | 129 | // TODO: Return errors to user somehow |
130 | if (results.Errors.Count > 0) | 130 | if (results.Errors.Count > 0) |
131 | { | 131 | { |
132 | |||
133 | string errtext = ""; | 132 | string errtext = ""; |
134 | foreach (CompilerError CompErr in results.Errors) | 133 | foreach (CompilerError CompErr in results.Errors) |
135 | { | 134 | { |
136 | errtext += "Line number " + (CompErr.Line - 1) + | 135 | errtext += "Line number " + (CompErr.Line - 1) + |
137 | ", Error Number: " + CompErr.ErrorNumber + | 136 | ", Error Number: " + CompErr.ErrorNumber + |
138 | ", '" + CompErr.ErrorText + "'\r\n"; | 137 | ", '" + CompErr.ErrorText + "'\r\n"; |
139 | } | 138 | } |
140 | throw new Exception(errtext); | 139 | throw new Exception(errtext); |
141 | } | 140 | } |
@@ -143,6 +142,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
143 | 142 | ||
144 | return OutFile; | 143 | return OutFile; |
145 | } | 144 | } |
146 | |||
147 | } | 145 | } |
148 | } | 146 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 18eeaa3..0c28617 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -26,9 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | 30 | using System.Text.RegularExpressions; |
33 | 31 | ||
34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 32 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
@@ -51,9 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
51 | dataTypes.Add("rotation", "LSL_Types.Quaternion"); | 49 | dataTypes.Add("rotation", "LSL_Types.Quaternion"); |
52 | dataTypes.Add("list", "list"); | 50 | dataTypes.Add("list", "list"); |
53 | dataTypes.Add("null", "null"); | 51 | dataTypes.Add("null", "null"); |
54 | |||
55 | } | 52 | } |
56 | 53 | ||
57 | public string Convert(string Script) | 54 | public string Convert(string Script) |
58 | { | 55 | { |
59 | string Return = ""; | 56 | string Return = ""; |
@@ -81,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
81 | int quote_replaced_count = 0; | 78 | int quote_replaced_count = 0; |
82 | for (int p = 0; p < Script.Length; p++) | 79 | for (int p = 0; p < Script.Length; p++) |
83 | { | 80 | { |
84 | |||
85 | C = Script.Substring(p, 1); | 81 | C = Script.Substring(p, 1); |
86 | while (true) | 82 | while (true) |
87 | { | 83 | { |
@@ -99,10 +95,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
99 | if (quote == "") | 95 | if (quote == "") |
100 | { | 96 | { |
101 | // We didn't replace quote, probably because of empty string? | 97 | // We didn't replace quote, probably because of empty string? |
102 | _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | 98 | _Script += quote_replacement_string + |
99 | quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | ||
103 | } | 100 | } |
104 | // We just left a quote | 101 | // We just left a quote |
105 | quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); | 102 | quotes.Add( |
103 | quote_replacement_string + | ||
104 | quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); | ||
106 | quote = ""; | 105 | quote = ""; |
107 | } | 106 | } |
108 | break; | 107 | break; |
@@ -112,7 +111,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
112 | { | 111 | { |
113 | // We are not inside a quote | 112 | // We are not inside a quote |
114 | quote_replaced = false; | 113 | quote_replaced = false; |
115 | |||
116 | } | 114 | } |
117 | else | 115 | else |
118 | { | 116 | { |
@@ -120,7 +118,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
120 | if (!quote_replaced) | 118 | if (!quote_replaced) |
121 | { | 119 | { |
122 | // Replace quote | 120 | // Replace quote |
123 | _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | 121 | _Script += quote_replacement_string + |
122 | quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); | ||
124 | quote_replaced = true; | 123 | quote_replaced = true; |
125 | } | 124 | } |
126 | quote += C; | 125 | quote += C; |
@@ -141,7 +140,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
141 | // | 140 | // |
142 | 141 | ||
143 | 142 | ||
144 | |||
145 | // | 143 | // |
146 | // PROCESS STATES | 144 | // PROCESS STATES |
147 | // Remove state definitions and add state names to start of each event within state | 145 | // Remove state definitions and add state names to start of each event within state |
@@ -170,7 +168,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
170 | if (ilevel == 1 && lastlevel == 0) | 168 | if (ilevel == 1 && lastlevel == 0) |
171 | { | 169 | { |
172 | // 0 => 1: Get last | 170 | // 0 => 1: Get last |
173 | Match m = Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 171 | Match m = |
172 | Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", | ||
173 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
174 | 174 | ||
175 | in_state = false; | 175 | in_state = false; |
176 | if (m.Success) | 176 | if (m.Success) |
@@ -179,7 +179,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
179 | in_state = true; | 179 | in_state = true; |
180 | current_statename = m.Groups[1].Captures[0].Value; | 180 | current_statename = m.Groups[1].Captures[0].Value; |
181 | //Console.WriteLine("Current statename: " + current_statename); | 181 | //Console.WriteLine("Current statename: " + current_statename); |
182 | cache = Regex.Replace(cache, @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", "${s1}${s2}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 182 | cache = |
183 | Regex.Replace(cache, | ||
184 | @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", | ||
185 | "${s1}${s2}", | ||
186 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
183 | } | 187 | } |
184 | ret += cache; | 188 | ret += cache; |
185 | cache = ""; | 189 | cache = ""; |
@@ -196,7 +200,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
196 | // void dataserver(key query_id, string data) { | 200 | // void dataserver(key query_id, string data) { |
197 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 201 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
198 | //Console.WriteLine("Replacing using statename: " + current_statename); | 202 | //Console.WriteLine("Replacing using statename: " + current_statename); |
199 | cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 203 | cache = |
204 | Regex.Replace(cache, | ||
205 | @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", | ||
206 | @"$1public " + current_statename + "_event_$2", | ||
207 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
200 | } | 208 | } |
201 | 209 | ||
202 | ret += cache; | 210 | ret += cache; |
@@ -216,32 +224,48 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
216 | ret = ""; | 224 | ret = ""; |
217 | 225 | ||
218 | 226 | ||
219 | |||
220 | foreach (string key in dataTypes.Keys) | 227 | foreach (string key in dataTypes.Keys) |
221 | { | 228 | { |
222 | string val; | 229 | string val; |
223 | dataTypes.TryGetValue(key, out val); | 230 | dataTypes.TryGetValue(key, out val); |
224 | 231 | ||
225 | // Replace CAST - (integer) with (int) | 232 | // Replace CAST - (integer) with (int) |
226 | Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); | 233 | Script = |
234 | Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", | ||
235 | RegexOptions.Compiled | RegexOptions.Multiline); | ||
227 | // Replace return types and function variables - integer a() and f(integer a, integer a) | 236 | // Replace return types and function variables - integer a() and f(integer a, integer a) |
228 | Script = Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", RegexOptions.Compiled | RegexOptions.Multiline); | 237 | Script = |
238 | Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", | ||
239 | RegexOptions.Compiled | RegexOptions.Multiline); | ||
229 | } | 240 | } |
230 | 241 | ||
231 | // Add "void" in front of functions that needs it | 242 | // Add "void" in front of functions that needs it |
232 | Script = Regex.Replace(Script, @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 243 | Script = |
244 | Regex.Replace(Script, | ||
245 | @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", | ||
246 | @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
233 | 247 | ||
234 | // Replace <x,y,z> and <x,y,z,r> | 248 | // Replace <x,y,z> and <x,y,z,r> |
235 | Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 249 | Script = |
236 | Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 250 | Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", |
251 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
252 | Script = | ||
253 | Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", | ||
254 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
237 | 255 | ||
238 | // Replace List []'s | 256 | // Replace List []'s |
239 | Script = Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 257 | Script = |
258 | Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", | ||
259 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
240 | 260 | ||
241 | 261 | ||
242 | // Replace (string) to .ToString() // | 262 | // Replace (string) to .ToString() // |
243 | Script = Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 263 | Script = |
244 | Script = Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 264 | Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", |
265 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
266 | Script = | ||
267 | Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", | ||
268 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | ||
245 | 269 | ||
246 | 270 | ||
247 | // REPLACE BACK QUOTES | 271 | // REPLACE BACK QUOTES |
@@ -256,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
256 | // Add namespace, class name and inheritance | 280 | // Add namespace, class name and inheritance |
257 | 281 | ||
258 | Return = "" + | 282 | Return = "" + |
259 | "using OpenSim.Region.ScriptEngine.Common;"; | 283 | "using OpenSim.Region.ScriptEngine.Common;"; |
260 | //"using System; " + | 284 | //"using System; " + |
261 | //"using System.Collections.Generic; " + | 285 | //"using System.Collections.Generic; " + |
262 | //"using System.Text; " + | 286 | //"using System.Text; " + |
@@ -278,17 +302,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
278 | 302 | ||
279 | 303 | ||
280 | Return += "" + | 304 | Return += "" + |
281 | "namespace SecondLife { "; | 305 | "namespace SecondLife { "; |
282 | Return += "" + | 306 | Return += "" + |
283 | //"[Serializable] " + | 307 | //"[Serializable] " + |
284 | "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; | 308 | "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; |
285 | Return += @"public Script() { } "; | 309 | Return += @"public Script() { } "; |
286 | Return += Script; | 310 | Return += Script; |
287 | Return += "} }\r\n"; | 311 | Return += "} }\r\n"; |
288 | 312 | ||
289 | return Return; | 313 | return Return; |
290 | } | 314 | } |
291 | |||
292 | |||
293 | } | 315 | } |
294 | } | 316 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index ea05efc..f2774d6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -28,12 +28,9 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | ||
33 | using OpenSim.Region.ScriptEngine.Common; | ||
34 | using System.Threading; | ||
35 | using System.Reflection; | ||
36 | using System.Runtime.Remoting.Lifetime; | 31 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Threading; | ||
33 | using OpenSim.Region.ScriptEngine.Common; | ||
37 | using integer = System.Int32; | 34 | using integer = System.Int32; |
38 | using key = System.String; | 35 | using key = System.String; |
39 | using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; | 36 | using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; |
@@ -44,13 +41,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
44 | //[Serializable] | 41 | //[Serializable] |
45 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript | 42 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript |
46 | { | 43 | { |
47 | |||
48 | // Object never expires | 44 | // Object never expires |
49 | public override Object InitializeLifetimeService() | 45 | public override Object InitializeLifetimeService() |
50 | { | 46 | { |
51 | //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); | 47 | //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); |
52 | // return null; | 48 | // return null; |
53 | ILease lease = (ILease)base.InitializeLifetimeService(); | 49 | ILease lease = (ILease) base.InitializeLifetimeService(); |
54 | 50 | ||
55 | if (lease.CurrentState == LeaseState.Initial) | 51 | if (lease.CurrentState == LeaseState.Initial) |
56 | { | 52 | { |
@@ -63,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
63 | 59 | ||
64 | 60 | ||
65 | private Executor m_Exec; | 61 | private Executor m_Exec; |
62 | |||
66 | public Executor Exec | 63 | public Executor Exec |
67 | { | 64 | { |
68 | get | 65 | get |
@@ -79,6 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
79 | public LSL_BaseClass() | 76 | public LSL_BaseClass() |
80 | { | 77 | { |
81 | } | 78 | } |
79 | |||
82 | public string State() | 80 | public string State() |
83 | { | 81 | { |
84 | return m_LSL_Functions.State(); | 82 | return m_LSL_Functions.State(); |
@@ -94,410 +92,1724 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
94 | // Get this AppDomain's settings and display some of them. | 92 | // Get this AppDomain's settings and display some of them. |
95 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; | 93 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; |
96 | Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", | 94 | Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", |
97 | ads.ApplicationName, | 95 | ads.ApplicationName, |
98 | ads.ApplicationBase, | 96 | ads.ApplicationBase, |
99 | ads.ConfigurationFile | 97 | ads.ConfigurationFile |
100 | ); | 98 | ); |
101 | 99 | ||
102 | // Display the name of the calling AppDomain and the name | 100 | // Display the name of the calling AppDomain and the name |
103 | // of the second domain. | 101 | // of the second domain. |
104 | // NOTE: The application's thread has transitioned between | 102 | // NOTE: The application's thread has transitioned between |
105 | // AppDomains. | 103 | // AppDomains. |
106 | Console.WriteLine("Calling to '{0}'.", | 104 | Console.WriteLine("Calling to '{0}'.", |
107 | Thread.GetDomain().FriendlyName | 105 | Thread.GetDomain().FriendlyName |
108 | ); | 106 | ); |
109 | 107 | ||
110 | return; | 108 | return; |
111 | } | 109 | } |
112 | 110 | ||
113 | 111 | ||
114 | |||
115 | // | 112 | // |
116 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 113 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
117 | // | 114 | // |
118 | // They are only forwarders to LSL_BuiltIn_Commands.cs | 115 | // They are only forwarders to LSL_BuiltIn_Commands.cs |
119 | // | 116 | // |
120 | public double llSin(double f) { return m_LSL_Functions.llSin(f); } | 117 | public double llSin(double f) |
121 | public double llCos(double f) { return m_LSL_Functions.llCos(f); } | 118 | { |
122 | public double llTan(double f) { return m_LSL_Functions.llTan(f); } | 119 | return m_LSL_Functions.llSin(f); |
123 | public double llAtan2(double x, double y) { return m_LSL_Functions.llAtan2(x, y); } | 120 | } |
124 | public double llSqrt(double f) { return m_LSL_Functions.llSqrt(f); } | 121 | |
125 | public double llPow(double fbase, double fexponent) { return m_LSL_Functions.llPow(fbase, fexponent); } | 122 | public double llCos(double f) |
126 | public int llAbs(int i) { return m_LSL_Functions.llAbs(i); } | 123 | { |
127 | public double llFabs(double f) { return m_LSL_Functions.llFabs(f); } | 124 | return m_LSL_Functions.llCos(f); |
128 | public double llFrand(double mag) { return m_LSL_Functions.llFrand(mag); } | 125 | } |
129 | public int llFloor(double f) { return m_LSL_Functions.llFloor(f); } | 126 | |
130 | public int llCeil(double f) { return m_LSL_Functions.llCeil(f); } | 127 | public double llTan(double f) |
131 | public int llRound(double f) { return m_LSL_Functions.llRound(f); } | 128 | { |
132 | public double llVecMag(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecMag(v); } | 129 | return m_LSL_Functions.llTan(f); |
133 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecNorm(v); } | 130 | } |
134 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) { return m_LSL_Functions.llVecDist(a, b); } | 131 | |
135 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Euler(r); } | 132 | public double llAtan2(double x, double y) |
136 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) { return m_LSL_Functions.llEuler2Rot(v); } | 133 | { |
137 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return m_LSL_Functions.llAxes2Rot(fwd, left, up); } | 134 | return m_LSL_Functions.llAtan2(x, y); |
138 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Fwd(r); } | 135 | } |
139 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Left(r); } | 136 | |
140 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Up(r); } | 137 | public double llSqrt(double f) |
141 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return m_LSL_Functions.llRotBetween(start, end); } | 138 | { |
142 | public void llWhisper(int channelID, string text) { m_LSL_Functions.llWhisper(channelID, text); } | 139 | return m_LSL_Functions.llSqrt(f); |
143 | public void llSay(int channelID, string text) { m_LSL_Functions.llSay(channelID, text); } | 140 | } |
141 | |||
142 | public double llPow(double fbase, double fexponent) | ||
143 | { | ||
144 | return m_LSL_Functions.llPow(fbase, fexponent); | ||
145 | } | ||
146 | |||
147 | public int llAbs(int i) | ||
148 | { | ||
149 | return m_LSL_Functions.llAbs(i); | ||
150 | } | ||
151 | |||
152 | public double llFabs(double f) | ||
153 | { | ||
154 | return m_LSL_Functions.llFabs(f); | ||
155 | } | ||
156 | |||
157 | public double llFrand(double mag) | ||
158 | { | ||
159 | return m_LSL_Functions.llFrand(mag); | ||
160 | } | ||
161 | |||
162 | public int llFloor(double f) | ||
163 | { | ||
164 | return m_LSL_Functions.llFloor(f); | ||
165 | } | ||
166 | |||
167 | public int llCeil(double f) | ||
168 | { | ||
169 | return m_LSL_Functions.llCeil(f); | ||
170 | } | ||
171 | |||
172 | public int llRound(double f) | ||
173 | { | ||
174 | return m_LSL_Functions.llRound(f); | ||
175 | } | ||
176 | |||
177 | public double llVecMag(vector v) | ||
178 | { | ||
179 | return m_LSL_Functions.llVecMag(v); | ||
180 | } | ||
181 | |||
182 | public vector llVecNorm(vector v) | ||
183 | { | ||
184 | return m_LSL_Functions.llVecNorm(v); | ||
185 | } | ||
186 | |||
187 | public double llVecDist(vector a, vector b) | ||
188 | { | ||
189 | return m_LSL_Functions.llVecDist(a, b); | ||
190 | } | ||
191 | |||
192 | public vector llRot2Euler(rotation r) | ||
193 | { | ||
194 | return m_LSL_Functions.llRot2Euler(r); | ||
195 | } | ||
196 | |||
197 | public rotation llEuler2Rot(vector v) | ||
198 | { | ||
199 | return m_LSL_Functions.llEuler2Rot(v); | ||
200 | } | ||
201 | |||
202 | public rotation llAxes2Rot(vector fwd, vector left, vector up) | ||
203 | { | ||
204 | return m_LSL_Functions.llAxes2Rot(fwd, left, up); | ||
205 | } | ||
206 | |||
207 | public vector llRot2Fwd(rotation r) | ||
208 | { | ||
209 | return m_LSL_Functions.llRot2Fwd(r); | ||
210 | } | ||
211 | |||
212 | public vector llRot2Left(rotation r) | ||
213 | { | ||
214 | return m_LSL_Functions.llRot2Left(r); | ||
215 | } | ||
216 | |||
217 | public vector llRot2Up(rotation r) | ||
218 | { | ||
219 | return m_LSL_Functions.llRot2Up(r); | ||
220 | } | ||
221 | |||
222 | public rotation llRotBetween(vector start, vector end) | ||
223 | { | ||
224 | return m_LSL_Functions.llRotBetween(start, end); | ||
225 | } | ||
226 | |||
227 | public void llWhisper(int channelID, string text) | ||
228 | { | ||
229 | m_LSL_Functions.llWhisper(channelID, text); | ||
230 | } | ||
231 | |||
232 | public void llSay(int channelID, string text) | ||
233 | { | ||
234 | m_LSL_Functions.llSay(channelID, text); | ||
235 | } | ||
236 | |||
144 | // | 237 | // |
145 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 238 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
146 | // | 239 | // |
147 | public void llShout(int channelID, string text) { m_LSL_Functions.llShout(channelID, text); } | 240 | public void llShout(int channelID, string text) |
148 | public int llListen(int channelID, string name, string ID, string msg) { return m_LSL_Functions.llListen(channelID, name, ID, msg); } | 241 | { |
149 | public void llListenControl(int number, int active) { m_LSL_Functions.llListenControl(number, active); } | 242 | m_LSL_Functions.llShout(channelID, text); |
150 | public void llListenRemove(int number) { m_LSL_Functions.llListenRemove(number); } | 243 | } |
151 | public void llSensor(string name, string id, int type, double range, double arc) { m_LSL_Functions.llSensor(name, id, type, range, arc); } | 244 | |
152 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); } | 245 | public int llListen(int channelID, string name, string ID, string msg) |
153 | public void llSensorRemove() { m_LSL_Functions.llSensorRemove(); } | 246 | { |
154 | public string llDetectedName(int number) { return m_LSL_Functions.llDetectedName(number); } | 247 | return m_LSL_Functions.llListen(channelID, name, ID, msg); |
155 | public string llDetectedKey(int number) { return m_LSL_Functions.llDetectedKey(number); } | 248 | } |
156 | public string llDetectedOwner(int number) { return m_LSL_Functions.llDetectedOwner(number); } | 249 | |
157 | public int llDetectedType(int number) { return m_LSL_Functions.llDetectedType(number); } | 250 | public void llListenControl(int number, int active) |
158 | public LSL_Types.Vector3 llDetectedPos(int number) { return m_LSL_Functions.llDetectedPos(number); } | 251 | { |
159 | public LSL_Types.Vector3 llDetectedVel(int number) { return m_LSL_Functions.llDetectedVel(number); } | 252 | m_LSL_Functions.llListenControl(number, active); |
160 | public LSL_Types.Vector3 llDetectedGrab(int number) { return m_LSL_Functions.llDetectedGrab(number); } | 253 | } |
161 | public LSL_Types.Quaternion llDetectedRot(int number) { return m_LSL_Functions.llDetectedRot(number); } | 254 | |
162 | public int llDetectedGroup(int number) { return m_LSL_Functions.llDetectedGroup(number); } | 255 | public void llListenRemove(int number) |
163 | public int llDetectedLinkNumber(int number) { return m_LSL_Functions.llDetectedLinkNumber(number); } | 256 | { |
257 | m_LSL_Functions.llListenRemove(number); | ||
258 | } | ||
259 | |||
260 | public void llSensor(string name, string id, int type, double range, double arc) | ||
261 | { | ||
262 | m_LSL_Functions.llSensor(name, id, type, range, arc); | ||
263 | } | ||
264 | |||
265 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | ||
266 | { | ||
267 | m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); | ||
268 | } | ||
269 | |||
270 | public void llSensorRemove() | ||
271 | { | ||
272 | m_LSL_Functions.llSensorRemove(); | ||
273 | } | ||
274 | |||
275 | public string llDetectedName(int number) | ||
276 | { | ||
277 | return m_LSL_Functions.llDetectedName(number); | ||
278 | } | ||
279 | |||
280 | public string llDetectedKey(int number) | ||
281 | { | ||
282 | return m_LSL_Functions.llDetectedKey(number); | ||
283 | } | ||
284 | |||
285 | public string llDetectedOwner(int number) | ||
286 | { | ||
287 | return m_LSL_Functions.llDetectedOwner(number); | ||
288 | } | ||
289 | |||
290 | public int llDetectedType(int number) | ||
291 | { | ||
292 | return m_LSL_Functions.llDetectedType(number); | ||
293 | } | ||
294 | |||
295 | public vector llDetectedPos(int number) | ||
296 | { | ||
297 | return m_LSL_Functions.llDetectedPos(number); | ||
298 | } | ||
299 | |||
300 | public vector llDetectedVel(int number) | ||
301 | { | ||
302 | return m_LSL_Functions.llDetectedVel(number); | ||
303 | } | ||
304 | |||
305 | public vector llDetectedGrab(int number) | ||
306 | { | ||
307 | return m_LSL_Functions.llDetectedGrab(number); | ||
308 | } | ||
309 | |||
310 | public rotation llDetectedRot(int number) | ||
311 | { | ||
312 | return m_LSL_Functions.llDetectedRot(number); | ||
313 | } | ||
314 | |||
315 | public int llDetectedGroup(int number) | ||
316 | { | ||
317 | return m_LSL_Functions.llDetectedGroup(number); | ||
318 | } | ||
319 | |||
320 | public int llDetectedLinkNumber(int number) | ||
321 | { | ||
322 | return m_LSL_Functions.llDetectedLinkNumber(number); | ||
323 | } | ||
324 | |||
164 | // | 325 | // |
165 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 326 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
166 | // | 327 | // |
167 | public void llDie() { m_LSL_Functions.llDie(); } | 328 | public void llDie() |
168 | public double llGround(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGround(offset); } | 329 | { |
169 | public double llCloud(LSL_Types.Vector3 offset) { return m_LSL_Functions.llCloud(offset); } | 330 | m_LSL_Functions.llDie(); |
170 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWind(offset); } | 331 | } |
171 | public void llSetStatus(int status, int value) { m_LSL_Functions.llSetStatus(status, value); } | 332 | |
172 | public int llGetStatus(int status) { return m_LSL_Functions.llGetStatus(status); } | 333 | public double llGround(vector offset) |
173 | public void llSetScale(LSL_Types.Vector3 scale) { m_LSL_Functions.llSetScale(scale); } | 334 | { |
174 | public LSL_Types.Vector3 llGetScale() { return m_LSL_Functions.llGetScale(); } | 335 | return m_LSL_Functions.llGround(offset); |
175 | public void llSetColor(LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetColor(color, face); } | 336 | } |
176 | public double llGetAlpha(int face) { return m_LSL_Functions.llGetAlpha(face); } | 337 | |
177 | public void llSetAlpha(double alpha, int face) { m_LSL_Functions.llSetAlpha(alpha, face); } | 338 | public double llCloud(vector offset) |
178 | public LSL_Types.Vector3 llGetColor(int face) { return m_LSL_Functions.llGetColor(face); } | 339 | { |
179 | public void llSetTexture(string texture, int face) { m_LSL_Functions.llSetTexture(texture, face); } | 340 | return m_LSL_Functions.llCloud(offset); |
180 | public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); } | 341 | } |
181 | public void llOffsetTexture(double u, double v, int face) { m_LSL_Functions.llOffsetTexture(u, v, face); } | 342 | |
182 | public void llRotateTexture(double rotation, int face) { m_LSL_Functions.llRotateTexture(rotation, face); } | 343 | public vector llWind(vector offset) |
183 | public string llGetTexture(int face) { return m_LSL_Functions.llGetTexture(face); } | 344 | { |
345 | return m_LSL_Functions.llWind(offset); | ||
346 | } | ||
347 | |||
348 | public void llSetStatus(int status, int value) | ||
349 | { | ||
350 | m_LSL_Functions.llSetStatus(status, value); | ||
351 | } | ||
352 | |||
353 | public int llGetStatus(int status) | ||
354 | { | ||
355 | return m_LSL_Functions.llGetStatus(status); | ||
356 | } | ||
357 | |||
358 | public void llSetScale(vector scale) | ||
359 | { | ||
360 | m_LSL_Functions.llSetScale(scale); | ||
361 | } | ||
362 | |||
363 | public vector llGetScale() | ||
364 | { | ||
365 | return m_LSL_Functions.llGetScale(); | ||
366 | } | ||
367 | |||
368 | public void llSetColor(vector color, int face) | ||
369 | { | ||
370 | m_LSL_Functions.llSetColor(color, face); | ||
371 | } | ||
372 | |||
373 | public double llGetAlpha(int face) | ||
374 | { | ||
375 | return m_LSL_Functions.llGetAlpha(face); | ||
376 | } | ||
377 | |||
378 | public void llSetAlpha(double alpha, int face) | ||
379 | { | ||
380 | m_LSL_Functions.llSetAlpha(alpha, face); | ||
381 | } | ||
382 | |||
383 | public vector llGetColor(int face) | ||
384 | { | ||
385 | return m_LSL_Functions.llGetColor(face); | ||
386 | } | ||
387 | |||
388 | public void llSetTexture(string texture, int face) | ||
389 | { | ||
390 | m_LSL_Functions.llSetTexture(texture, face); | ||
391 | } | ||
392 | |||
393 | public void llScaleTexture(double u, double v, int face) | ||
394 | { | ||
395 | m_LSL_Functions.llScaleTexture(u, v, face); | ||
396 | } | ||
397 | |||
398 | public void llOffsetTexture(double u, double v, int face) | ||
399 | { | ||
400 | m_LSL_Functions.llOffsetTexture(u, v, face); | ||
401 | } | ||
402 | |||
403 | public void llRotateTexture(double rotation, int face) | ||
404 | { | ||
405 | m_LSL_Functions.llRotateTexture(rotation, face); | ||
406 | } | ||
407 | |||
408 | public string llGetTexture(int face) | ||
409 | { | ||
410 | return m_LSL_Functions.llGetTexture(face); | ||
411 | } | ||
412 | |||
184 | // | 413 | // |
185 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 414 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
186 | // | 415 | // |
187 | public void llSetPos(LSL_Types.Vector3 pos) { m_LSL_Functions.llSetPos(pos); } | 416 | public void llSetPos(vector pos) |
188 | public LSL_Types.Vector3 llGetPos() { return m_LSL_Functions.llGetPos(); } | 417 | { |
189 | public LSL_Types.Vector3 llGetLocalPos() { return m_LSL_Functions.llGetLocalPos(); } | 418 | m_LSL_Functions.llSetPos(pos); |
190 | public void llSetRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetRot(rot); } | 419 | } |
191 | public LSL_Types.Quaternion llGetRot() { return m_LSL_Functions.llGetRot(); } | 420 | |
192 | public LSL_Types.Quaternion llGetLocalRot() { return m_LSL_Functions.llGetLocalRot(); } | 421 | public vector llGetPos() |
193 | public void llSetForce(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llSetForce(force, local); } | 422 | { |
194 | public LSL_Types.Vector3 llGetForce() { return m_LSL_Functions.llGetForce(); } | 423 | return m_LSL_Functions.llGetPos(); |
195 | public int llTarget(LSL_Types.Vector3 position, double range) { return m_LSL_Functions.llTarget(position, range); } | 424 | } |
196 | public void llTargetRemove(int number) { m_LSL_Functions.llTargetRemove(number); } | 425 | |
197 | public int llRotTarget(LSL_Types.Quaternion rot, double error) { return m_LSL_Functions.llRotTarget(rot, error); } | 426 | public vector llGetLocalPos() |
198 | public void llRotTargetRemove(int number) { m_LSL_Functions.llRotTargetRemove(number); } | 427 | { |
199 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { m_LSL_Functions.llMoveToTarget(target, tau); } | 428 | return m_LSL_Functions.llGetLocalPos(); |
200 | public void llStopMoveToTarget() { m_LSL_Functions.llStopMoveToTarget(); } | 429 | } |
201 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyImpulse(force, local); } | 430 | |
431 | public void llSetRot(rotation rot) | ||
432 | { | ||
433 | m_LSL_Functions.llSetRot(rot); | ||
434 | } | ||
435 | |||
436 | public rotation llGetRot() | ||
437 | { | ||
438 | return m_LSL_Functions.llGetRot(); | ||
439 | } | ||
440 | |||
441 | public rotation llGetLocalRot() | ||
442 | { | ||
443 | return m_LSL_Functions.llGetLocalRot(); | ||
444 | } | ||
445 | |||
446 | public void llSetForce(vector force, int local) | ||
447 | { | ||
448 | m_LSL_Functions.llSetForce(force, local); | ||
449 | } | ||
450 | |||
451 | public vector llGetForce() | ||
452 | { | ||
453 | return m_LSL_Functions.llGetForce(); | ||
454 | } | ||
455 | |||
456 | public int llTarget(vector position, double range) | ||
457 | { | ||
458 | return m_LSL_Functions.llTarget(position, range); | ||
459 | } | ||
460 | |||
461 | public void llTargetRemove(int number) | ||
462 | { | ||
463 | m_LSL_Functions.llTargetRemove(number); | ||
464 | } | ||
465 | |||
466 | public int llRotTarget(rotation rot, double error) | ||
467 | { | ||
468 | return m_LSL_Functions.llRotTarget(rot, error); | ||
469 | } | ||
470 | |||
471 | public void llRotTargetRemove(int number) | ||
472 | { | ||
473 | m_LSL_Functions.llRotTargetRemove(number); | ||
474 | } | ||
475 | |||
476 | public void llMoveToTarget(vector target, double tau) | ||
477 | { | ||
478 | m_LSL_Functions.llMoveToTarget(target, tau); | ||
479 | } | ||
480 | |||
481 | public void llStopMoveToTarget() | ||
482 | { | ||
483 | m_LSL_Functions.llStopMoveToTarget(); | ||
484 | } | ||
485 | |||
486 | public void llApplyImpulse(vector force, int local) | ||
487 | { | ||
488 | m_LSL_Functions.llApplyImpulse(force, local); | ||
489 | } | ||
490 | |||
202 | // | 491 | // |
203 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 492 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
204 | // | 493 | // |
205 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyRotationalImpulse(force, local); } | 494 | public void llApplyRotationalImpulse(vector force, int local) |
206 | public void llSetTorque(LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetTorque(torque, local); } | 495 | { |
207 | public LSL_Types.Vector3 llGetTorque() { return m_LSL_Functions.llGetTorque(); } | 496 | m_LSL_Functions.llApplyRotationalImpulse(force, local); |
208 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetForceAndTorque(force, torque, local); } | 497 | } |
209 | public LSL_Types.Vector3 llGetVel() { return m_LSL_Functions.llGetVel(); } | 498 | |
210 | public LSL_Types.Vector3 llGetAccel() { return m_LSL_Functions.llGetAccel(); } | 499 | public void llSetTorque(vector torque, int local) |
211 | public LSL_Types.Vector3 llGetOmega() { return m_LSL_Functions.llGetOmega(); } | 500 | { |
212 | public double llGetTimeOfDay() { return m_LSL_Functions.llGetTimeOfDay(); } | 501 | m_LSL_Functions.llSetTorque(torque, local); |
213 | public double llGetWallclock() { return m_LSL_Functions.llGetWallclock(); } | 502 | } |
214 | public double llGetTime() { return m_LSL_Functions.llGetTime(); } | 503 | |
215 | public void llResetTime() { m_LSL_Functions.llResetTime(); } | 504 | public vector llGetTorque() |
216 | public double llGetAndResetTime() { return m_LSL_Functions.llGetAndResetTime(); } | 505 | { |
217 | public void llSound() { m_LSL_Functions.llSound(); } | 506 | return m_LSL_Functions.llGetTorque(); |
218 | public void llPlaySound(string sound, double volume) { m_LSL_Functions.llPlaySound(sound, volume); } | 507 | } |
219 | public void llLoopSound(string sound, double volume) { m_LSL_Functions.llLoopSound(sound, volume); } | 508 | |
220 | public void llLoopSoundMaster(string sound, double volume) { m_LSL_Functions.llLoopSoundMaster(sound, volume); } | 509 | public void llSetForceAndTorque(vector force, vector torque, int local) |
221 | public void llLoopSoundSlave(string sound, double volume) { m_LSL_Functions.llLoopSoundSlave(sound, volume); } | 510 | { |
222 | public void llPlaySoundSlave(string sound, double volume) { m_LSL_Functions.llPlaySoundSlave(sound, volume); } | 511 | m_LSL_Functions.llSetForceAndTorque(force, torque, local); |
512 | } | ||
513 | |||
514 | public vector llGetVel() | ||
515 | { | ||
516 | return m_LSL_Functions.llGetVel(); | ||
517 | } | ||
518 | |||
519 | public vector llGetAccel() | ||
520 | { | ||
521 | return m_LSL_Functions.llGetAccel(); | ||
522 | } | ||
523 | |||
524 | public vector llGetOmega() | ||
525 | { | ||
526 | return m_LSL_Functions.llGetOmega(); | ||
527 | } | ||
528 | |||
529 | public double llGetTimeOfDay() | ||
530 | { | ||
531 | return m_LSL_Functions.llGetTimeOfDay(); | ||
532 | } | ||
533 | |||
534 | public double llGetWallclock() | ||
535 | { | ||
536 | return m_LSL_Functions.llGetWallclock(); | ||
537 | } | ||
538 | |||
539 | public double llGetTime() | ||
540 | { | ||
541 | return m_LSL_Functions.llGetTime(); | ||
542 | } | ||
543 | |||
544 | public void llResetTime() | ||
545 | { | ||
546 | m_LSL_Functions.llResetTime(); | ||
547 | } | ||
548 | |||
549 | public double llGetAndResetTime() | ||
550 | { | ||
551 | return m_LSL_Functions.llGetAndResetTime(); | ||
552 | } | ||
553 | |||
554 | public void llSound() | ||
555 | { | ||
556 | m_LSL_Functions.llSound(); | ||
557 | } | ||
558 | |||
559 | public void llPlaySound(string sound, double volume) | ||
560 | { | ||
561 | m_LSL_Functions.llPlaySound(sound, volume); | ||
562 | } | ||
563 | |||
564 | public void llLoopSound(string sound, double volume) | ||
565 | { | ||
566 | m_LSL_Functions.llLoopSound(sound, volume); | ||
567 | } | ||
568 | |||
569 | public void llLoopSoundMaster(string sound, double volume) | ||
570 | { | ||
571 | m_LSL_Functions.llLoopSoundMaster(sound, volume); | ||
572 | } | ||
573 | |||
574 | public void llLoopSoundSlave(string sound, double volume) | ||
575 | { | ||
576 | m_LSL_Functions.llLoopSoundSlave(sound, volume); | ||
577 | } | ||
578 | |||
579 | public void llPlaySoundSlave(string sound, double volume) | ||
580 | { | ||
581 | m_LSL_Functions.llPlaySoundSlave(sound, volume); | ||
582 | } | ||
583 | |||
223 | // | 584 | // |
224 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 585 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
225 | // | 586 | // |
226 | public void llTriggerSound(string sound, double volume) { m_LSL_Functions.llTriggerSound(sound, volume); } | 587 | public void llTriggerSound(string sound, double volume) |
227 | public void llStopSound() { m_LSL_Functions.llStopSound(); } | 588 | { |
228 | public void llPreloadSound(string sound) { m_LSL_Functions.llPreloadSound(sound); } | 589 | m_LSL_Functions.llTriggerSound(sound, volume); |
229 | public string llGetSubString(string src, int start, int end) { return m_LSL_Functions.llGetSubString(src, start, end); } | 590 | } |
230 | public string llDeleteSubString(string src, int start, int end) { return m_LSL_Functions.llDeleteSubString(src, start, end); } | 591 | |
231 | public string llInsertString(string dst, int position, string src) { return m_LSL_Functions.llInsertString(dst, position, src); } | 592 | public void llStopSound() |
232 | public string llToUpper(string source) { return m_LSL_Functions.llToUpper(source); } | 593 | { |
233 | public string llToLower(string source) { return m_LSL_Functions.llToLower(source); } | 594 | m_LSL_Functions.llStopSound(); |
234 | public int llGiveMoney(string destination, int amount) { return m_LSL_Functions.llGiveMoney(destination, amount); } | 595 | } |
235 | public void llMakeExplosion() { m_LSL_Functions.llMakeExplosion(); } | 596 | |
236 | public void llMakeFountain() { m_LSL_Functions.llMakeFountain(); } | 597 | public void llPreloadSound(string sound) |
237 | public void llMakeSmoke() { m_LSL_Functions.llMakeSmoke(); } | 598 | { |
238 | public void llMakeFire() { m_LSL_Functions.llMakeFire(); } | 599 | m_LSL_Functions.llPreloadSound(sound); |
239 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezObject(inventory, pos, rot, param); } | 600 | } |
240 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { m_LSL_Functions.llLookAt(target, strength, damping); } | 601 | |
241 | public void llStopLookAt() { m_LSL_Functions.llStopLookAt(); } | 602 | public string llGetSubString(string src, int start, int end) |
242 | public void llSetTimerEvent(double sec) { m_LSL_Functions.llSetTimerEvent(sec); } | 603 | { |
243 | public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); } | 604 | return m_LSL_Functions.llGetSubString(src, start, end); |
605 | } | ||
606 | |||
607 | public string llDeleteSubString(string src, int start, int end) | ||
608 | { | ||
609 | return m_LSL_Functions.llDeleteSubString(src, start, end); | ||
610 | } | ||
611 | |||
612 | public string llInsertString(string dst, int position, string src) | ||
613 | { | ||
614 | return m_LSL_Functions.llInsertString(dst, position, src); | ||
615 | } | ||
616 | |||
617 | public string llToUpper(string source) | ||
618 | { | ||
619 | return m_LSL_Functions.llToUpper(source); | ||
620 | } | ||
621 | |||
622 | public string llToLower(string source) | ||
623 | { | ||
624 | return m_LSL_Functions.llToLower(source); | ||
625 | } | ||
626 | |||
627 | public int llGiveMoney(string destination, int amount) | ||
628 | { | ||
629 | return m_LSL_Functions.llGiveMoney(destination, amount); | ||
630 | } | ||
631 | |||
632 | public void llMakeExplosion() | ||
633 | { | ||
634 | m_LSL_Functions.llMakeExplosion(); | ||
635 | } | ||
636 | |||
637 | public void llMakeFountain() | ||
638 | { | ||
639 | m_LSL_Functions.llMakeFountain(); | ||
640 | } | ||
641 | |||
642 | public void llMakeSmoke() | ||
643 | { | ||
644 | m_LSL_Functions.llMakeSmoke(); | ||
645 | } | ||
646 | |||
647 | public void llMakeFire() | ||
648 | { | ||
649 | m_LSL_Functions.llMakeFire(); | ||
650 | } | ||
651 | |||
652 | public void llRezObject(string inventory, vector pos, rotation rot, int param) | ||
653 | { | ||
654 | m_LSL_Functions.llRezObject(inventory, pos, rot, param); | ||
655 | } | ||
656 | |||
657 | public void llLookAt(vector target, double strength, double damping) | ||
658 | { | ||
659 | m_LSL_Functions.llLookAt(target, strength, damping); | ||
660 | } | ||
661 | |||
662 | public void llStopLookAt() | ||
663 | { | ||
664 | m_LSL_Functions.llStopLookAt(); | ||
665 | } | ||
666 | |||
667 | public void llSetTimerEvent(double sec) | ||
668 | { | ||
669 | m_LSL_Functions.llSetTimerEvent(sec); | ||
670 | } | ||
671 | |||
672 | public void llSleep(double sec) | ||
673 | { | ||
674 | m_LSL_Functions.llSleep(sec); | ||
675 | } | ||
676 | |||
244 | // | 677 | // |
245 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 678 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
246 | // | 679 | // |
247 | public double llGetMass() { return m_LSL_Functions.llGetMass(); } | 680 | public double llGetMass() |
248 | public void llCollisionFilter(string name, string id, int accept) { m_LSL_Functions.llCollisionFilter(name, id, accept); } | 681 | { |
249 | public void llTakeControls(int controls, int accept, int pass_on) { m_LSL_Functions.llTakeControls(controls, accept, pass_on); } | 682 | return m_LSL_Functions.llGetMass(); |
250 | public void llReleaseControls() { m_LSL_Functions.llReleaseControls(); } | 683 | } |
251 | public void llAttachToAvatar(int attachment) { m_LSL_Functions.llAttachToAvatar(attachment); } | 684 | |
252 | public void llDetachFromAvatar() { m_LSL_Functions.llDetachFromAvatar(); } | 685 | public void llCollisionFilter(string name, string id, int accept) |
253 | public void llTakeCamera() { m_LSL_Functions.llTakeCamera(); } | 686 | { |
254 | public void llReleaseCamera() { m_LSL_Functions.llReleaseCamera(); } | 687 | m_LSL_Functions.llCollisionFilter(name, id, accept); |
255 | public string llGetOwner() { return m_LSL_Functions.llGetOwner(); } | 688 | } |
256 | public void llInstantMessage(string user, string message) { m_LSL_Functions.llInstantMessage(user, message); } | 689 | |
257 | public void llEmail(string address, string subject, string message) { m_LSL_Functions.llEmail(address, subject, message); } | 690 | public void llTakeControls(int controls, int accept, int pass_on) |
258 | public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); } | 691 | { |
259 | public string llGetKey() { return m_LSL_Functions.llGetKey(); } | 692 | m_LSL_Functions.llTakeControls(controls, accept, pass_on); |
260 | public void llSetBuoyancy(double buoyancy) { m_LSL_Functions.llSetBuoyancy(buoyancy); } | 693 | } |
261 | public void llSetHoverHeight(double height, int water, double tau) { m_LSL_Functions.llSetHoverHeight(height, water, tau); } | 694 | |
262 | public void llStopHover() { m_LSL_Functions.llStopHover(); } | 695 | public void llReleaseControls() |
263 | public void llMinEventDelay(double delay) { m_LSL_Functions.llMinEventDelay(delay); } | 696 | { |
264 | public void llSoundPreload() { m_LSL_Functions.llSoundPreload(); } | 697 | m_LSL_Functions.llReleaseControls(); |
265 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { m_LSL_Functions.llRotLookAt(target, strength, damping); } | 698 | } |
699 | |||
700 | public void llAttachToAvatar(int attachment) | ||
701 | { | ||
702 | m_LSL_Functions.llAttachToAvatar(attachment); | ||
703 | } | ||
704 | |||
705 | public void llDetachFromAvatar() | ||
706 | { | ||
707 | m_LSL_Functions.llDetachFromAvatar(); | ||
708 | } | ||
709 | |||
710 | public void llTakeCamera() | ||
711 | { | ||
712 | m_LSL_Functions.llTakeCamera(); | ||
713 | } | ||
714 | |||
715 | public void llReleaseCamera() | ||
716 | { | ||
717 | m_LSL_Functions.llReleaseCamera(); | ||
718 | } | ||
719 | |||
720 | public string llGetOwner() | ||
721 | { | ||
722 | return m_LSL_Functions.llGetOwner(); | ||
723 | } | ||
724 | |||
725 | public void llInstantMessage(string user, string message) | ||
726 | { | ||
727 | m_LSL_Functions.llInstantMessage(user, message); | ||
728 | } | ||
729 | |||
730 | public void llEmail(string address, string subject, string message) | ||
731 | { | ||
732 | m_LSL_Functions.llEmail(address, subject, message); | ||
733 | } | ||
734 | |||
735 | public void llGetNextEmail(string address, string subject) | ||
736 | { | ||
737 | m_LSL_Functions.llGetNextEmail(address, subject); | ||
738 | } | ||
739 | |||
740 | public string llGetKey() | ||
741 | { | ||
742 | return m_LSL_Functions.llGetKey(); | ||
743 | } | ||
744 | |||
745 | public void llSetBuoyancy(double buoyancy) | ||
746 | { | ||
747 | m_LSL_Functions.llSetBuoyancy(buoyancy); | ||
748 | } | ||
749 | |||
750 | public void llSetHoverHeight(double height, int water, double tau) | ||
751 | { | ||
752 | m_LSL_Functions.llSetHoverHeight(height, water, tau); | ||
753 | } | ||
754 | |||
755 | public void llStopHover() | ||
756 | { | ||
757 | m_LSL_Functions.llStopHover(); | ||
758 | } | ||
759 | |||
760 | public void llMinEventDelay(double delay) | ||
761 | { | ||
762 | m_LSL_Functions.llMinEventDelay(delay); | ||
763 | } | ||
764 | |||
765 | public void llSoundPreload() | ||
766 | { | ||
767 | m_LSL_Functions.llSoundPreload(); | ||
768 | } | ||
769 | |||
770 | public void llRotLookAt(rotation target, double strength, double damping) | ||
771 | { | ||
772 | m_LSL_Functions.llRotLookAt(target, strength, damping); | ||
773 | } | ||
774 | |||
266 | // | 775 | // |
267 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 776 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
268 | // | 777 | // |
269 | public int llStringLength(string str) { return m_LSL_Functions.llStringLength(str); } | 778 | public int llStringLength(string str) |
270 | public void llStartAnimation(string anim) { m_LSL_Functions.llStartAnimation(anim); } | 779 | { |
271 | public void llStopAnimation(string anim) { m_LSL_Functions.llStopAnimation(anim); } | 780 | return m_LSL_Functions.llStringLength(str); |
272 | public void llPointAt() { m_LSL_Functions.llPointAt(); } | 781 | } |
273 | public void llStopPointAt() { m_LSL_Functions.llStopPointAt(); } | 782 | |
274 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { m_LSL_Functions.llTargetOmega(axis, spinrate, gain); } | 783 | public void llStartAnimation(string anim) |
275 | public int llGetStartParameter() { return m_LSL_Functions.llGetStartParameter(); } | 784 | { |
276 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { m_LSL_Functions.llGodLikeRezObject(inventory, pos); } | 785 | m_LSL_Functions.llStartAnimation(anim); |
277 | public void llRequestPermissions(string agent, int perm) { m_LSL_Functions.llRequestPermissions(agent, perm); } | 786 | } |
278 | public string llGetPermissionsKey() { return m_LSL_Functions.llGetPermissionsKey(); } | 787 | |
279 | public int llGetPermissions() { return m_LSL_Functions.llGetPermissions(); } | 788 | public void llStopAnimation(string anim) |
280 | public int llGetLinkNumber() { return m_LSL_Functions.llGetLinkNumber(); } | 789 | { |
281 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetLinkColor(linknumber, color, face); } | 790 | m_LSL_Functions.llStopAnimation(anim); |
282 | public void llCreateLink(string target, int parent) { m_LSL_Functions.llCreateLink(target, parent); } | 791 | } |
283 | public void llBreakLink(int linknum) { m_LSL_Functions.llBreakLink(linknum); } | 792 | |
284 | public void llBreakAllLinks() { m_LSL_Functions.llBreakAllLinks(); } | 793 | public void llPointAt() |
285 | public string llGetLinkKey(int linknum) { return m_LSL_Functions.llGetLinkKey(linknum); } | 794 | { |
286 | public void llGetLinkName(int linknum) { m_LSL_Functions.llGetLinkName(linknum); } | 795 | m_LSL_Functions.llPointAt(); |
287 | public int llGetInventoryNumber(int type) { return m_LSL_Functions.llGetInventoryNumber(type); } | 796 | } |
288 | public string llGetInventoryName(int type, int number) { return m_LSL_Functions.llGetInventoryName(type, number); } | 797 | |
798 | public void llStopPointAt() | ||
799 | { | ||
800 | m_LSL_Functions.llStopPointAt(); | ||
801 | } | ||
802 | |||
803 | public void llTargetOmega(vector axis, double spinrate, double gain) | ||
804 | { | ||
805 | m_LSL_Functions.llTargetOmega(axis, spinrate, gain); | ||
806 | } | ||
807 | |||
808 | public int llGetStartParameter() | ||
809 | { | ||
810 | return m_LSL_Functions.llGetStartParameter(); | ||
811 | } | ||
812 | |||
813 | public void llGodLikeRezObject(string inventory, vector pos) | ||
814 | { | ||
815 | m_LSL_Functions.llGodLikeRezObject(inventory, pos); | ||
816 | } | ||
817 | |||
818 | public void llRequestPermissions(string agent, int perm) | ||
819 | { | ||
820 | m_LSL_Functions.llRequestPermissions(agent, perm); | ||
821 | } | ||
822 | |||
823 | public string llGetPermissionsKey() | ||
824 | { | ||
825 | return m_LSL_Functions.llGetPermissionsKey(); | ||
826 | } | ||
827 | |||
828 | public int llGetPermissions() | ||
829 | { | ||
830 | return m_LSL_Functions.llGetPermissions(); | ||
831 | } | ||
832 | |||
833 | public int llGetLinkNumber() | ||
834 | { | ||
835 | return m_LSL_Functions.llGetLinkNumber(); | ||
836 | } | ||
837 | |||
838 | public void llSetLinkColor(int linknumber, vector color, int face) | ||
839 | { | ||
840 | m_LSL_Functions.llSetLinkColor(linknumber, color, face); | ||
841 | } | ||
842 | |||
843 | public void llCreateLink(string target, int parent) | ||
844 | { | ||
845 | m_LSL_Functions.llCreateLink(target, parent); | ||
846 | } | ||
847 | |||
848 | public void llBreakLink(int linknum) | ||
849 | { | ||
850 | m_LSL_Functions.llBreakLink(linknum); | ||
851 | } | ||
852 | |||
853 | public void llBreakAllLinks() | ||
854 | { | ||
855 | m_LSL_Functions.llBreakAllLinks(); | ||
856 | } | ||
857 | |||
858 | public string llGetLinkKey(int linknum) | ||
859 | { | ||
860 | return m_LSL_Functions.llGetLinkKey(linknum); | ||
861 | } | ||
862 | |||
863 | public void llGetLinkName(int linknum) | ||
864 | { | ||
865 | m_LSL_Functions.llGetLinkName(linknum); | ||
866 | } | ||
867 | |||
868 | public int llGetInventoryNumber(int type) | ||
869 | { | ||
870 | return m_LSL_Functions.llGetInventoryNumber(type); | ||
871 | } | ||
872 | |||
873 | public string llGetInventoryName(int type, int number) | ||
874 | { | ||
875 | return m_LSL_Functions.llGetInventoryName(type, number); | ||
876 | } | ||
877 | |||
289 | // | 878 | // |
290 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 879 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
291 | // | 880 | // |
292 | public void llSetScriptState(string name, int run) { m_LSL_Functions.llSetScriptState(name, run); } | 881 | public void llSetScriptState(string name, int run) |
293 | public double llGetEnergy() { return m_LSL_Functions.llGetEnergy(); } | 882 | { |
294 | public void llGiveInventory(string destination, string inventory) { m_LSL_Functions.llGiveInventory(destination, inventory); } | 883 | m_LSL_Functions.llSetScriptState(name, run); |
295 | public void llRemoveInventory(string item) { m_LSL_Functions.llRemoveInventory(item); } | 884 | } |
296 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { m_LSL_Functions.llSetText(text, color, alpha); } | 885 | |
297 | public double llWater(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWater(offset); } | 886 | public double llGetEnergy() |
298 | public void llPassTouches(int pass) { m_LSL_Functions.llPassTouches(pass); } | 887 | { |
299 | public string llRequestAgentData(string id, int data) { return m_LSL_Functions.llRequestAgentData(id, data); } | 888 | return m_LSL_Functions.llGetEnergy(); |
300 | public string llRequestInventoryData(string name) { return m_LSL_Functions.llRequestInventoryData(name); } | 889 | } |
301 | public void llSetDamage(double damage) { m_LSL_Functions.llSetDamage(damage); } | 890 | |
302 | public void llTeleportAgentHome(string agent) { m_LSL_Functions.llTeleportAgentHome(agent); } | 891 | public void llGiveInventory(string destination, string inventory) |
303 | public void llModifyLand(int action, int brush) { m_LSL_Functions.llModifyLand(action, brush); } | 892 | { |
304 | public void llCollisionSound(string impact_sound, double impact_volume) { m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); } | 893 | m_LSL_Functions.llGiveInventory(destination, inventory); |
305 | public void llCollisionSprite(string impact_sprite) { m_LSL_Functions.llCollisionSprite(impact_sprite); } | 894 | } |
306 | public string llGetAnimation(string id) { return m_LSL_Functions.llGetAnimation(id); } | 895 | |
307 | public void llResetScript() { m_LSL_Functions.llResetScript(); } | 896 | public void llRemoveInventory(string item) |
308 | public void llMessageLinked(int linknum, int num, string str, string id) { m_LSL_Functions.llMessageLinked(linknum, num, str, id); } | 897 | { |
309 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); } | 898 | m_LSL_Functions.llRemoveInventory(item); |
310 | public void llPassCollisions(int pass) { m_LSL_Functions.llPassCollisions(pass); } | 899 | } |
311 | public string llGetScriptName() { return m_LSL_Functions.llGetScriptName(); } | 900 | |
312 | public int llGetNumberOfSides() { return m_LSL_Functions.llGetNumberOfSides(); } | 901 | public void llSetText(string text, vector color, double alpha) |
902 | { | ||
903 | m_LSL_Functions.llSetText(text, color, alpha); | ||
904 | } | ||
905 | |||
906 | public double llWater(vector offset) | ||
907 | { | ||
908 | return m_LSL_Functions.llWater(offset); | ||
909 | } | ||
910 | |||
911 | public void llPassTouches(int pass) | ||
912 | { | ||
913 | m_LSL_Functions.llPassTouches(pass); | ||
914 | } | ||
915 | |||
916 | public string llRequestAgentData(string id, int data) | ||
917 | { | ||
918 | return m_LSL_Functions.llRequestAgentData(id, data); | ||
919 | } | ||
920 | |||
921 | public string llRequestInventoryData(string name) | ||
922 | { | ||
923 | return m_LSL_Functions.llRequestInventoryData(name); | ||
924 | } | ||
925 | |||
926 | public void llSetDamage(double damage) | ||
927 | { | ||
928 | m_LSL_Functions.llSetDamage(damage); | ||
929 | } | ||
930 | |||
931 | public void llTeleportAgentHome(string agent) | ||
932 | { | ||
933 | m_LSL_Functions.llTeleportAgentHome(agent); | ||
934 | } | ||
935 | |||
936 | public void llModifyLand(int action, int brush) | ||
937 | { | ||
938 | m_LSL_Functions.llModifyLand(action, brush); | ||
939 | } | ||
940 | |||
941 | public void llCollisionSound(string impact_sound, double impact_volume) | ||
942 | { | ||
943 | m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); | ||
944 | } | ||
945 | |||
946 | public void llCollisionSprite(string impact_sprite) | ||
947 | { | ||
948 | m_LSL_Functions.llCollisionSprite(impact_sprite); | ||
949 | } | ||
950 | |||
951 | public string llGetAnimation(string id) | ||
952 | { | ||
953 | return m_LSL_Functions.llGetAnimation(id); | ||
954 | } | ||
955 | |||
956 | public void llResetScript() | ||
957 | { | ||
958 | m_LSL_Functions.llResetScript(); | ||
959 | } | ||
960 | |||
961 | public void llMessageLinked(int linknum, int num, string str, string id) | ||
962 | { | ||
963 | m_LSL_Functions.llMessageLinked(linknum, num, str, id); | ||
964 | } | ||
965 | |||
966 | public void llPushObject(string target, vector impulse, vector ang_impulse, int local) | ||
967 | { | ||
968 | m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); | ||
969 | } | ||
970 | |||
971 | public void llPassCollisions(int pass) | ||
972 | { | ||
973 | m_LSL_Functions.llPassCollisions(pass); | ||
974 | } | ||
975 | |||
976 | public string llGetScriptName() | ||
977 | { | ||
978 | return m_LSL_Functions.llGetScriptName(); | ||
979 | } | ||
980 | |||
981 | public int llGetNumberOfSides() | ||
982 | { | ||
983 | return m_LSL_Functions.llGetNumberOfSides(); | ||
984 | } | ||
985 | |||
313 | // | 986 | // |
314 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 987 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
315 | // | 988 | // |
316 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return m_LSL_Functions.llAxisAngle2Rot(axis, angle); } | 989 | public rotation llAxisAngle2Rot(vector axis, double angle) |
317 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return m_LSL_Functions.llRot2Axis(rot); } | 990 | { |
318 | public void llRot2Angle() { m_LSL_Functions.llRot2Angle(); } | 991 | return m_LSL_Functions.llAxisAngle2Rot(axis, angle); |
319 | public double llAcos(double val) { return m_LSL_Functions.llAcos(val); } | 992 | } |
320 | public double llAsin(double val) { return m_LSL_Functions.llAsin(val); } | 993 | |
321 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return m_LSL_Functions.llAngleBetween(a, b); } | 994 | public vector llRot2Axis(rotation rot) |
322 | public string llGetInventoryKey(string name) { return m_LSL_Functions.llGetInventoryKey(name); } | 995 | { |
323 | public void llAllowInventoryDrop(int add) { m_LSL_Functions.llAllowInventoryDrop(add); } | 996 | return m_LSL_Functions.llRot2Axis(rot); |
324 | public LSL_Types.Vector3 llGetSunDirection() { return m_LSL_Functions.llGetSunDirection(); } | 997 | } |
325 | public LSL_Types.Vector3 llGetTextureOffset(int face) { return m_LSL_Functions.llGetTextureOffset(face); } | 998 | |
326 | public LSL_Types.Vector3 llGetTextureScale(int side) { return m_LSL_Functions.llGetTextureScale(side); } | 999 | public void llRot2Angle() |
327 | public double llGetTextureRot(int side) { return m_LSL_Functions.llGetTextureRot(side); } | 1000 | { |
328 | public int llSubStringIndex(string source, string pattern) { return m_LSL_Functions.llSubStringIndex(source, pattern); } | 1001 | m_LSL_Functions.llRot2Angle(); |
329 | public string llGetOwnerKey(string id) { return m_LSL_Functions.llGetOwnerKey(id); } | 1002 | } |
330 | public LSL_Types.Vector3 llGetCenterOfMass() { return m_LSL_Functions.llGetCenterOfMass(); } | 1003 | |
331 | public List<string> llListSort(List<string> src, int stride, int ascending) { return m_LSL_Functions.llListSort(src, stride, ascending); } | 1004 | public double llAcos(double val) |
332 | public int llGetListLength(List<string> src) { return m_LSL_Functions.llGetListLength(src); } | 1005 | { |
1006 | return m_LSL_Functions.llAcos(val); | ||
1007 | } | ||
1008 | |||
1009 | public double llAsin(double val) | ||
1010 | { | ||
1011 | return m_LSL_Functions.llAsin(val); | ||
1012 | } | ||
1013 | |||
1014 | public double llAngleBetween(rotation a, rotation b) | ||
1015 | { | ||
1016 | return m_LSL_Functions.llAngleBetween(a, b); | ||
1017 | } | ||
1018 | |||
1019 | public string llGetInventoryKey(string name) | ||
1020 | { | ||
1021 | return m_LSL_Functions.llGetInventoryKey(name); | ||
1022 | } | ||
1023 | |||
1024 | public void llAllowInventoryDrop(int add) | ||
1025 | { | ||
1026 | m_LSL_Functions.llAllowInventoryDrop(add); | ||
1027 | } | ||
1028 | |||
1029 | public vector llGetSunDirection() | ||
1030 | { | ||
1031 | return m_LSL_Functions.llGetSunDirection(); | ||
1032 | } | ||
1033 | |||
1034 | public vector llGetTextureOffset(int face) | ||
1035 | { | ||
1036 | return m_LSL_Functions.llGetTextureOffset(face); | ||
1037 | } | ||
1038 | |||
1039 | public vector llGetTextureScale(int side) | ||
1040 | { | ||
1041 | return m_LSL_Functions.llGetTextureScale(side); | ||
1042 | } | ||
1043 | |||
1044 | public double llGetTextureRot(int side) | ||
1045 | { | ||
1046 | return m_LSL_Functions.llGetTextureRot(side); | ||
1047 | } | ||
1048 | |||
1049 | public int llSubStringIndex(string source, string pattern) | ||
1050 | { | ||
1051 | return m_LSL_Functions.llSubStringIndex(source, pattern); | ||
1052 | } | ||
1053 | |||
1054 | public string llGetOwnerKey(string id) | ||
1055 | { | ||
1056 | return m_LSL_Functions.llGetOwnerKey(id); | ||
1057 | } | ||
1058 | |||
1059 | public vector llGetCenterOfMass() | ||
1060 | { | ||
1061 | return m_LSL_Functions.llGetCenterOfMass(); | ||
1062 | } | ||
1063 | |||
1064 | public List<string> llListSort(List<string> src, int stride, int ascending) | ||
1065 | { | ||
1066 | return m_LSL_Functions.llListSort(src, stride, ascending); | ||
1067 | } | ||
1068 | |||
1069 | public int llGetListLength(List<string> src) | ||
1070 | { | ||
1071 | return m_LSL_Functions.llGetListLength(src); | ||
1072 | } | ||
1073 | |||
333 | // | 1074 | // |
334 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1075 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
335 | // | 1076 | // |
336 | public int llList2Integer(List<string> src, int index) { return m_LSL_Functions.llList2Integer(src, index); } | 1077 | public int llList2Integer(List<string> src, int index) |
337 | public double llList2double(List<string> src, int index) { return m_LSL_Functions.llList2double(src, index); } | 1078 | { |
338 | public string llList2String(List<string> src, int index) { return m_LSL_Functions.llList2String(src, index); } | 1079 | return m_LSL_Functions.llList2Integer(src, index); |
339 | public string llList2Key(List<string> src, int index) { return m_LSL_Functions.llList2Key(src, index); } | 1080 | } |
340 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) { return m_LSL_Functions.llList2Vector(src, index); } | 1081 | |
341 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { return m_LSL_Functions.llList2Rot(src, index); } | 1082 | public double llList2double(List<string> src, int index) |
342 | public List<string> llList2List(List<string> src, int start, int end) { return m_LSL_Functions.llList2List(src, start, end); } | 1083 | { |
343 | public List<string> llDeleteSubList(List<string> src, int start, int end) { return m_LSL_Functions.llDeleteSubList(src, start, end); } | 1084 | return m_LSL_Functions.llList2double(src, index); |
344 | public int llGetListEntryType(List<string> src, int index) { return m_LSL_Functions.llGetListEntryType(src, index); } | 1085 | } |
345 | public string llList2CSV(List<string> src) { return m_LSL_Functions.llList2CSV(src); } | 1086 | |
346 | public List<string> llCSV2List(string src) { return m_LSL_Functions.llCSV2List(src); } | 1087 | public string llList2String(List<string> src, int index) |
347 | public List<string> llListRandomize(List<string> src, int stride) { return m_LSL_Functions.llListRandomize(src, stride); } | 1088 | { |
348 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { return m_LSL_Functions.llList2ListStrided(src, start, end, stride); } | 1089 | return m_LSL_Functions.llList2String(src, index); |
349 | public LSL_Types.Vector3 llGetRegionCorner() { return m_LSL_Functions.llGetRegionCorner(); } | 1090 | } |
350 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) { return m_LSL_Functions.llListInsertList(dest, src, start); } | 1091 | |
351 | public int llListFindList(List<string> src, List<string> test) { return m_LSL_Functions.llListFindList(src, test); } | 1092 | public string llList2Key(List<string> src, int index) |
352 | public string llGetObjectName() { return m_LSL_Functions.llGetObjectName(); } | 1093 | { |
353 | public void llSetObjectName(string name) { m_LSL_Functions.llSetObjectName(name); } | 1094 | return m_LSL_Functions.llList2Key(src, index); |
354 | public string llGetDate() { return m_LSL_Functions.llGetDate(); } | 1095 | } |
355 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return m_LSL_Functions.llEdgeOfWorld(pos, dir); } | 1096 | |
356 | public int llGetAgentInfo(string id) { return m_LSL_Functions.llGetAgentInfo(id); } | 1097 | public vector llList2Vector(List<string> src, int index) |
1098 | { | ||
1099 | return m_LSL_Functions.llList2Vector(src, index); | ||
1100 | } | ||
1101 | |||
1102 | public rotation llList2Rot(List<string> src, int index) | ||
1103 | { | ||
1104 | return m_LSL_Functions.llList2Rot(src, index); | ||
1105 | } | ||
1106 | |||
1107 | public List<string> llList2List(List<string> src, int start, int end) | ||
1108 | { | ||
1109 | return m_LSL_Functions.llList2List(src, start, end); | ||
1110 | } | ||
1111 | |||
1112 | public List<string> llDeleteSubList(List<string> src, int start, int end) | ||
1113 | { | ||
1114 | return m_LSL_Functions.llDeleteSubList(src, start, end); | ||
1115 | } | ||
1116 | |||
1117 | public int llGetListEntryType(List<string> src, int index) | ||
1118 | { | ||
1119 | return m_LSL_Functions.llGetListEntryType(src, index); | ||
1120 | } | ||
1121 | |||
1122 | public string llList2CSV(List<string> src) | ||
1123 | { | ||
1124 | return m_LSL_Functions.llList2CSV(src); | ||
1125 | } | ||
1126 | |||
1127 | public List<string> llCSV2List(string src) | ||
1128 | { | ||
1129 | return m_LSL_Functions.llCSV2List(src); | ||
1130 | } | ||
1131 | |||
1132 | public List<string> llListRandomize(List<string> src, int stride) | ||
1133 | { | ||
1134 | return m_LSL_Functions.llListRandomize(src, stride); | ||
1135 | } | ||
1136 | |||
1137 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | ||
1138 | { | ||
1139 | return m_LSL_Functions.llList2ListStrided(src, start, end, stride); | ||
1140 | } | ||
1141 | |||
1142 | public vector llGetRegionCorner() | ||
1143 | { | ||
1144 | return m_LSL_Functions.llGetRegionCorner(); | ||
1145 | } | ||
1146 | |||
1147 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) | ||
1148 | { | ||
1149 | return m_LSL_Functions.llListInsertList(dest, src, start); | ||
1150 | } | ||
1151 | |||
1152 | public int llListFindList(List<string> src, List<string> test) | ||
1153 | { | ||
1154 | return m_LSL_Functions.llListFindList(src, test); | ||
1155 | } | ||
1156 | |||
1157 | public string llGetObjectName() | ||
1158 | { | ||
1159 | return m_LSL_Functions.llGetObjectName(); | ||
1160 | } | ||
1161 | |||
1162 | public void llSetObjectName(string name) | ||
1163 | { | ||
1164 | m_LSL_Functions.llSetObjectName(name); | ||
1165 | } | ||
1166 | |||
1167 | public string llGetDate() | ||
1168 | { | ||
1169 | return m_LSL_Functions.llGetDate(); | ||
1170 | } | ||
1171 | |||
1172 | public int llEdgeOfWorld(vector pos, vector dir) | ||
1173 | { | ||
1174 | return m_LSL_Functions.llEdgeOfWorld(pos, dir); | ||
1175 | } | ||
1176 | |||
1177 | public int llGetAgentInfo(string id) | ||
1178 | { | ||
1179 | return m_LSL_Functions.llGetAgentInfo(id); | ||
1180 | } | ||
1181 | |||
357 | // | 1182 | // |
358 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1183 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
359 | // | 1184 | // |
360 | public void llAdjustSoundVolume(double volume) { m_LSL_Functions.llAdjustSoundVolume(volume); } | 1185 | public void llAdjustSoundVolume(double volume) |
361 | public void llSetSoundQueueing(int queue) { m_LSL_Functions.llSetSoundQueueing(queue); } | 1186 | { |
362 | public void llSetSoundRadius(double radius) { m_LSL_Functions.llSetSoundRadius(radius); } | 1187 | m_LSL_Functions.llAdjustSoundVolume(volume); |
363 | public string llKey2Name(string id) { return m_LSL_Functions.llKey2Name(id); } | 1188 | } |
364 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); } | 1189 | |
365 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); } | 1190 | public void llSetSoundQueueing(int queue) |
366 | public void llEjectFromLand(string pest) { m_LSL_Functions.llEjectFromLand(pest); } | 1191 | { |
367 | public void llParseString2List() { m_LSL_Functions.llParseString2List(); } | 1192 | m_LSL_Functions.llSetSoundQueueing(queue); |
368 | public int llOverMyLand(string id) { return m_LSL_Functions.llOverMyLand(id); } | 1193 | } |
369 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetLandOwnerAt(pos); } | 1194 | |
370 | public string llGetNotecardLine(string name, int line) { return m_LSL_Functions.llGetNotecardLine(name, line); } | 1195 | public void llSetSoundRadius(double radius) |
371 | public LSL_Types.Vector3 llGetAgentSize(string id) { return m_LSL_Functions.llGetAgentSize(id); } | 1196 | { |
372 | public int llSameGroup(string agent) { return m_LSL_Functions.llSameGroup(agent); } | 1197 | m_LSL_Functions.llSetSoundRadius(radius); |
373 | public void llUnSit(string id) { m_LSL_Functions.llUnSit(id); } | 1198 | } |
374 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundSlope(offset); } | 1199 | |
375 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundNormal(offset); } | 1200 | public string llKey2Name(string id) |
376 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundContour(offset); } | 1201 | { |
377 | public int llGetAttached() { return m_LSL_Functions.llGetAttached(); } | 1202 | return m_LSL_Functions.llKey2Name(id); |
378 | public int llGetFreeMemory() { return m_LSL_Functions.llGetFreeMemory(); } | 1203 | } |
379 | public string llGetRegionName() { return m_LSL_Functions.llGetRegionName(); } | 1204 | |
380 | public double llGetRegionTimeDilation() { return m_LSL_Functions.llGetRegionTimeDilation(); } | 1205 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) |
381 | public double llGetRegionFPS() { return m_LSL_Functions.llGetRegionFPS(); } | 1206 | { |
1207 | m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); | ||
1208 | } | ||
1209 | |||
1210 | public void llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) | ||
1211 | { | ||
1212 | m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); | ||
1213 | } | ||
1214 | |||
1215 | public void llEjectFromLand(string pest) | ||
1216 | { | ||
1217 | m_LSL_Functions.llEjectFromLand(pest); | ||
1218 | } | ||
1219 | |||
1220 | public void llParseString2List() | ||
1221 | { | ||
1222 | m_LSL_Functions.llParseString2List(); | ||
1223 | } | ||
1224 | |||
1225 | public int llOverMyLand(string id) | ||
1226 | { | ||
1227 | return m_LSL_Functions.llOverMyLand(id); | ||
1228 | } | ||
1229 | |||
1230 | public string llGetLandOwnerAt(vector pos) | ||
1231 | { | ||
1232 | return m_LSL_Functions.llGetLandOwnerAt(pos); | ||
1233 | } | ||
1234 | |||
1235 | public string llGetNotecardLine(string name, int line) | ||
1236 | { | ||
1237 | return m_LSL_Functions.llGetNotecardLine(name, line); | ||
1238 | } | ||
1239 | |||
1240 | public vector llGetAgentSize(string id) | ||
1241 | { | ||
1242 | return m_LSL_Functions.llGetAgentSize(id); | ||
1243 | } | ||
1244 | |||
1245 | public int llSameGroup(string agent) | ||
1246 | { | ||
1247 | return m_LSL_Functions.llSameGroup(agent); | ||
1248 | } | ||
1249 | |||
1250 | public void llUnSit(string id) | ||
1251 | { | ||
1252 | m_LSL_Functions.llUnSit(id); | ||
1253 | } | ||
1254 | |||
1255 | public vector llGroundSlope(vector offset) | ||
1256 | { | ||
1257 | return m_LSL_Functions.llGroundSlope(offset); | ||
1258 | } | ||
1259 | |||
1260 | public vector llGroundNormal(vector offset) | ||
1261 | { | ||
1262 | return m_LSL_Functions.llGroundNormal(offset); | ||
1263 | } | ||
1264 | |||
1265 | public vector llGroundContour(vector offset) | ||
1266 | { | ||
1267 | return m_LSL_Functions.llGroundContour(offset); | ||
1268 | } | ||
1269 | |||
1270 | public int llGetAttached() | ||
1271 | { | ||
1272 | return m_LSL_Functions.llGetAttached(); | ||
1273 | } | ||
1274 | |||
1275 | public int llGetFreeMemory() | ||
1276 | { | ||
1277 | return m_LSL_Functions.llGetFreeMemory(); | ||
1278 | } | ||
1279 | |||
1280 | public string llGetRegionName() | ||
1281 | { | ||
1282 | return m_LSL_Functions.llGetRegionName(); | ||
1283 | } | ||
1284 | |||
1285 | public double llGetRegionTimeDilation() | ||
1286 | { | ||
1287 | return m_LSL_Functions.llGetRegionTimeDilation(); | ||
1288 | } | ||
1289 | |||
1290 | public double llGetRegionFPS() | ||
1291 | { | ||
1292 | return m_LSL_Functions.llGetRegionFPS(); | ||
1293 | } | ||
1294 | |||
382 | // | 1295 | // |
383 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1296 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
384 | // | 1297 | // |
385 | public void llParticleSystem(List<Object> rules) { m_LSL_Functions.llParticleSystem(rules); } | 1298 | public void llParticleSystem(List<Object> rules) |
386 | public void llGroundRepel(double height, int water, double tau) { m_LSL_Functions.llGroundRepel(height, water, tau); } | 1299 | { |
387 | public void llGiveInventoryList() { m_LSL_Functions.llGiveInventoryList(); } | 1300 | m_LSL_Functions.llParticleSystem(rules); |
388 | public void llSetVehicleType(int type) { m_LSL_Functions.llSetVehicleType(type); } | 1301 | } |
389 | public void llSetVehicledoubleParam(int param, double value) { m_LSL_Functions.llSetVehicledoubleParam(param, value); } | 1302 | |
390 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { m_LSL_Functions.llSetVehicleVectorParam(param, vec); } | 1303 | public void llGroundRepel(double height, int water, double tau) |
391 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { m_LSL_Functions.llSetVehicleRotationParam(param, rot); } | 1304 | { |
392 | public void llSetVehicleFlags(int flags) { m_LSL_Functions.llSetVehicleFlags(flags); } | 1305 | m_LSL_Functions.llGroundRepel(height, water, tau); |
393 | public void llRemoveVehicleFlags(int flags) { m_LSL_Functions.llRemoveVehicleFlags(flags); } | 1306 | } |
394 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { m_LSL_Functions.llSitTarget(offset, rot); } | 1307 | |
395 | public string llAvatarOnSitTarget() { return m_LSL_Functions.llAvatarOnSitTarget(); } | 1308 | public void llGiveInventoryList() |
396 | public void llAddToLandPassList(string avatar, double hours) { m_LSL_Functions.llAddToLandPassList(avatar, hours); } | 1309 | { |
397 | public void llSetTouchText(string text) { m_LSL_Functions.llSetTouchText(text); } | 1310 | m_LSL_Functions.llGiveInventoryList(); |
398 | public void llSetSitText(string text) { m_LSL_Functions.llSetSitText(text); } | 1311 | } |
399 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraEyeOffset(offset); } | 1312 | |
400 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraAtOffset(offset); } | 1313 | public void llSetVehicleType(int type) |
401 | public void llDumpList2String() { m_LSL_Functions.llDumpList2String(); } | 1314 | { |
402 | public void llScriptDanger(LSL_Types.Vector3 pos) { m_LSL_Functions.llScriptDanger(pos); } | 1315 | m_LSL_Functions.llSetVehicleType(type); |
403 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); } | 1316 | } |
404 | public void llVolumeDetect(int detect) { m_LSL_Functions.llVolumeDetect(detect); } | 1317 | |
405 | public void llResetOtherScript(string name) { m_LSL_Functions.llResetOtherScript(name); } | 1318 | public void llSetVehicledoubleParam(int param, double value) |
406 | public int llGetScriptState(string name) { return m_LSL_Functions.llGetScriptState(name); } | 1319 | { |
407 | public void llRemoteLoadScript() { m_LSL_Functions.llRemoteLoadScript(); } | 1320 | m_LSL_Functions.llSetVehicledoubleParam(param, value); |
408 | public void llSetRemoteScriptAccessPin(int pin) { m_LSL_Functions.llSetRemoteScriptAccessPin(pin); } | 1321 | } |
409 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); } | 1322 | |
1323 | public void llSetVehicleVectorParam(int param, vector vec) | ||
1324 | { | ||
1325 | m_LSL_Functions.llSetVehicleVectorParam(param, vec); | ||
1326 | } | ||
1327 | |||
1328 | public void llSetVehicleRotationParam(int param, rotation rot) | ||
1329 | { | ||
1330 | m_LSL_Functions.llSetVehicleRotationParam(param, rot); | ||
1331 | } | ||
1332 | |||
1333 | public void llSetVehicleFlags(int flags) | ||
1334 | { | ||
1335 | m_LSL_Functions.llSetVehicleFlags(flags); | ||
1336 | } | ||
1337 | |||
1338 | public void llRemoveVehicleFlags(int flags) | ||
1339 | { | ||
1340 | m_LSL_Functions.llRemoveVehicleFlags(flags); | ||
1341 | } | ||
1342 | |||
1343 | public void llSitTarget(vector offset, rotation rot) | ||
1344 | { | ||
1345 | m_LSL_Functions.llSitTarget(offset, rot); | ||
1346 | } | ||
1347 | |||
1348 | public string llAvatarOnSitTarget() | ||
1349 | { | ||
1350 | return m_LSL_Functions.llAvatarOnSitTarget(); | ||
1351 | } | ||
1352 | |||
1353 | public void llAddToLandPassList(string avatar, double hours) | ||
1354 | { | ||
1355 | m_LSL_Functions.llAddToLandPassList(avatar, hours); | ||
1356 | } | ||
1357 | |||
1358 | public void llSetTouchText(string text) | ||
1359 | { | ||
1360 | m_LSL_Functions.llSetTouchText(text); | ||
1361 | } | ||
1362 | |||
1363 | public void llSetSitText(string text) | ||
1364 | { | ||
1365 | m_LSL_Functions.llSetSitText(text); | ||
1366 | } | ||
1367 | |||
1368 | public void llSetCameraEyeOffset(vector offset) | ||
1369 | { | ||
1370 | m_LSL_Functions.llSetCameraEyeOffset(offset); | ||
1371 | } | ||
1372 | |||
1373 | public void llSetCameraAtOffset(vector offset) | ||
1374 | { | ||
1375 | m_LSL_Functions.llSetCameraAtOffset(offset); | ||
1376 | } | ||
1377 | |||
1378 | public void llDumpList2String() | ||
1379 | { | ||
1380 | m_LSL_Functions.llDumpList2String(); | ||
1381 | } | ||
1382 | |||
1383 | public void llScriptDanger(vector pos) | ||
1384 | { | ||
1385 | m_LSL_Functions.llScriptDanger(pos); | ||
1386 | } | ||
1387 | |||
1388 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) | ||
1389 | { | ||
1390 | m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); | ||
1391 | } | ||
1392 | |||
1393 | public void llVolumeDetect(int detect) | ||
1394 | { | ||
1395 | m_LSL_Functions.llVolumeDetect(detect); | ||
1396 | } | ||
1397 | |||
1398 | public void llResetOtherScript(string name) | ||
1399 | { | ||
1400 | m_LSL_Functions.llResetOtherScript(name); | ||
1401 | } | ||
1402 | |||
1403 | public int llGetScriptState(string name) | ||
1404 | { | ||
1405 | return m_LSL_Functions.llGetScriptState(name); | ||
1406 | } | ||
1407 | |||
1408 | public void llRemoteLoadScript() | ||
1409 | { | ||
1410 | m_LSL_Functions.llRemoteLoadScript(); | ||
1411 | } | ||
1412 | |||
1413 | public void llSetRemoteScriptAccessPin(int pin) | ||
1414 | { | ||
1415 | m_LSL_Functions.llSetRemoteScriptAccessPin(pin); | ||
1416 | } | ||
1417 | |||
1418 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) | ||
1419 | { | ||
1420 | m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); | ||
1421 | } | ||
1422 | |||
410 | // | 1423 | // |
411 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1424 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
412 | // | 1425 | // |
413 | public void llOpenRemoteDataChannel() { m_LSL_Functions.llOpenRemoteDataChannel(); } | 1426 | public void llOpenRemoteDataChannel() |
414 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); } | 1427 | { |
415 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); } | 1428 | m_LSL_Functions.llOpenRemoteDataChannel(); |
416 | public void llCloseRemoteDataChannel(string channel) { m_LSL_Functions.llCloseRemoteDataChannel(channel); } | 1429 | } |
417 | public string llMD5String(string src, int nonce) { return m_LSL_Functions.llMD5String(src, nonce); } | 1430 | |
418 | public void llSetPrimitiveParams(List<string> rules) { m_LSL_Functions.llSetPrimitiveParams(rules); } | 1431 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) |
419 | public string llStringToBase64(string str) { return m_LSL_Functions.llStringToBase64(str); } | 1432 | { |
420 | public string llBase64ToString(string str) { return m_LSL_Functions.llBase64ToString(str); } | 1433 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
421 | public void llXorBase64Strings() { m_LSL_Functions.llXorBase64Strings(); } | 1434 | } |
422 | public void llRemoteDataSetRegion() { m_LSL_Functions.llRemoteDataSetRegion(); } | 1435 | |
423 | public double llLog10(double val) { return m_LSL_Functions.llLog10(val); } | 1436 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
424 | public double llLog(double val) { return m_LSL_Functions.llLog(val); } | 1437 | { |
425 | public List<string> llGetAnimationList(string id) { return m_LSL_Functions.llGetAnimationList(id); } | 1438 | m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); |
426 | public void llSetParcelMusicURL(string url) { m_LSL_Functions.llSetParcelMusicURL(url); } | 1439 | } |
427 | public LSL_Types.Vector3 llGetRootPosition() { return m_LSL_Functions.llGetRootPosition(); } | 1440 | |
428 | public LSL_Types.Quaternion llGetRootRotation() { return m_LSL_Functions.llGetRootRotation(); } | 1441 | public void llCloseRemoteDataChannel(string channel) |
429 | public string llGetObjectDesc() { return m_LSL_Functions.llGetObjectDesc(); } | 1442 | { |
430 | public void llSetObjectDesc(string desc) { m_LSL_Functions.llSetObjectDesc(desc); } | 1443 | m_LSL_Functions.llCloseRemoteDataChannel(channel); |
431 | public string llGetCreator() { return m_LSL_Functions.llGetCreator(); } | 1444 | } |
432 | public string llGetTimestamp() { return m_LSL_Functions.llGetTimestamp(); } | 1445 | |
433 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); } | 1446 | public string llMD5String(string src, int nonce) |
434 | public int llGetNumberOfPrims() { return m_LSL_Functions.llGetNumberOfPrims(); } | 1447 | { |
435 | public string llGetNumberOfNotecardLines(string name) { return m_LSL_Functions.llGetNumberOfNotecardLines(name); } | 1448 | return m_LSL_Functions.llMD5String(src, nonce); |
436 | public List<string> llGetBoundingBox(string obj) { return m_LSL_Functions.llGetBoundingBox(obj); } | 1449 | } |
437 | public LSL_Types.Vector3 llGetGeometricCenter() { return m_LSL_Functions.llGetGeometricCenter(); } | 1450 | |
438 | public void llGetPrimitiveParams() { m_LSL_Functions.llGetPrimitiveParams(); } | 1451 | public void llSetPrimitiveParams(List<string> rules) |
1452 | { | ||
1453 | m_LSL_Functions.llSetPrimitiveParams(rules); | ||
1454 | } | ||
1455 | |||
1456 | public string llStringToBase64(string str) | ||
1457 | { | ||
1458 | return m_LSL_Functions.llStringToBase64(str); | ||
1459 | } | ||
1460 | |||
1461 | public string llBase64ToString(string str) | ||
1462 | { | ||
1463 | return m_LSL_Functions.llBase64ToString(str); | ||
1464 | } | ||
1465 | |||
1466 | public void llXorBase64Strings() | ||
1467 | { | ||
1468 | m_LSL_Functions.llXorBase64Strings(); | ||
1469 | } | ||
1470 | |||
1471 | public void llRemoteDataSetRegion() | ||
1472 | { | ||
1473 | m_LSL_Functions.llRemoteDataSetRegion(); | ||
1474 | } | ||
1475 | |||
1476 | public double llLog10(double val) | ||
1477 | { | ||
1478 | return m_LSL_Functions.llLog10(val); | ||
1479 | } | ||
1480 | |||
1481 | public double llLog(double val) | ||
1482 | { | ||
1483 | return m_LSL_Functions.llLog(val); | ||
1484 | } | ||
1485 | |||
1486 | public List<string> llGetAnimationList(string id) | ||
1487 | { | ||
1488 | return m_LSL_Functions.llGetAnimationList(id); | ||
1489 | } | ||
1490 | |||
1491 | public void llSetParcelMusicURL(string url) | ||
1492 | { | ||
1493 | m_LSL_Functions.llSetParcelMusicURL(url); | ||
1494 | } | ||
1495 | |||
1496 | public vector llGetRootPosition() | ||
1497 | { | ||
1498 | return m_LSL_Functions.llGetRootPosition(); | ||
1499 | } | ||
1500 | |||
1501 | public rotation llGetRootRotation() | ||
1502 | { | ||
1503 | return m_LSL_Functions.llGetRootRotation(); | ||
1504 | } | ||
1505 | |||
1506 | public string llGetObjectDesc() | ||
1507 | { | ||
1508 | return m_LSL_Functions.llGetObjectDesc(); | ||
1509 | } | ||
1510 | |||
1511 | public void llSetObjectDesc(string desc) | ||
1512 | { | ||
1513 | m_LSL_Functions.llSetObjectDesc(desc); | ||
1514 | } | ||
1515 | |||
1516 | public string llGetCreator() | ||
1517 | { | ||
1518 | return m_LSL_Functions.llGetCreator(); | ||
1519 | } | ||
1520 | |||
1521 | public string llGetTimestamp() | ||
1522 | { | ||
1523 | return m_LSL_Functions.llGetTimestamp(); | ||
1524 | } | ||
1525 | |||
1526 | public void llSetLinkAlpha(int linknumber, double alpha, int face) | ||
1527 | { | ||
1528 | m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); | ||
1529 | } | ||
1530 | |||
1531 | public int llGetNumberOfPrims() | ||
1532 | { | ||
1533 | return m_LSL_Functions.llGetNumberOfPrims(); | ||
1534 | } | ||
1535 | |||
1536 | public string llGetNumberOfNotecardLines(string name) | ||
1537 | { | ||
1538 | return m_LSL_Functions.llGetNumberOfNotecardLines(name); | ||
1539 | } | ||
1540 | |||
1541 | public List<string> llGetBoundingBox(string obj) | ||
1542 | { | ||
1543 | return m_LSL_Functions.llGetBoundingBox(obj); | ||
1544 | } | ||
1545 | |||
1546 | public vector llGetGeometricCenter() | ||
1547 | { | ||
1548 | return m_LSL_Functions.llGetGeometricCenter(); | ||
1549 | } | ||
1550 | |||
1551 | public void llGetPrimitiveParams() | ||
1552 | { | ||
1553 | m_LSL_Functions.llGetPrimitiveParams(); | ||
1554 | } | ||
1555 | |||
439 | // | 1556 | // |
440 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1557 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
441 | // | 1558 | // |
442 | public string llIntegerToBase64(int number) { return m_LSL_Functions.llIntegerToBase64(number); } | 1559 | public string llIntegerToBase64(int number) |
443 | public int llBase64ToInteger(string str) { return m_LSL_Functions.llBase64ToInteger(str); } | 1560 | { |
444 | public double llGetGMTclock() { return m_LSL_Functions.llGetGMTclock(); } | 1561 | return m_LSL_Functions.llIntegerToBase64(number); |
445 | public string llGetSimulatorHostname() { return m_LSL_Functions.llGetSimulatorHostname(); } | 1562 | } |
446 | public void llSetLocalRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetLocalRot(rot); } | 1563 | |
447 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); } | 1564 | public int llBase64ToInteger(string str) |
448 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); } | 1565 | { |
449 | public int llGetObjectPermMask(int mask) { return m_LSL_Functions.llGetObjectPermMask(mask); } | 1566 | return m_LSL_Functions.llBase64ToInteger(str); |
450 | public void llSetObjectPermMask(int mask, int value) { m_LSL_Functions.llSetObjectPermMask(mask, value); } | 1567 | } |
451 | public void llGetInventoryPermMask(string item, int mask) { m_LSL_Functions.llGetInventoryPermMask(item, mask); } | 1568 | |
452 | public void llSetInventoryPermMask(string item, int mask, int value) { m_LSL_Functions.llSetInventoryPermMask(item, mask, value); } | 1569 | public double llGetGMTclock() |
453 | public string llGetInventoryCreator(string item) { return m_LSL_Functions.llGetInventoryCreator(item); } | 1570 | { |
454 | public void llOwnerSay(string msg) { m_LSL_Functions.llOwnerSay(msg); } | 1571 | return m_LSL_Functions.llGetGMTclock(); |
455 | public void llRequestSimulatorData(string simulator, int data) { m_LSL_Functions.llRequestSimulatorData(simulator, data); } | 1572 | } |
456 | public void llForceMouselook(int mouselook) { m_LSL_Functions.llForceMouselook(mouselook); } | 1573 | |
457 | public double llGetObjectMass(string id) { return m_LSL_Functions.llGetObjectMass(id); } | 1574 | public string llGetSimulatorHostname() |
458 | public void llListReplaceList() { m_LSL_Functions.llListReplaceList(); } | 1575 | { |
459 | public void llLoadURL(string avatar_id, string message, string url) { m_LSL_Functions.llLoadURL(avatar_id, message, url); } | 1576 | return m_LSL_Functions.llGetSimulatorHostname(); |
460 | public void llParcelMediaCommandList(List<string> commandList) { m_LSL_Functions.llParcelMediaCommandList(commandList); } | 1577 | } |
461 | public void llParcelMediaQuery() { m_LSL_Functions.llParcelMediaQuery(); } | 1578 | |
462 | public int llModPow(int a, int b, int c) { return m_LSL_Functions.llModPow(a, b, c); } | 1579 | public void llSetLocalRot(rotation rot) |
1580 | { | ||
1581 | m_LSL_Functions.llSetLocalRot(rot); | ||
1582 | } | ||
1583 | |||
1584 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) | ||
1585 | { | ||
1586 | return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); | ||
1587 | } | ||
1588 | |||
1589 | public void llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, int param) | ||
1590 | { | ||
1591 | m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); | ||
1592 | } | ||
1593 | |||
1594 | public int llGetObjectPermMask(int mask) | ||
1595 | { | ||
1596 | return m_LSL_Functions.llGetObjectPermMask(mask); | ||
1597 | } | ||
1598 | |||
1599 | public void llSetObjectPermMask(int mask, int value) | ||
1600 | { | ||
1601 | m_LSL_Functions.llSetObjectPermMask(mask, value); | ||
1602 | } | ||
1603 | |||
1604 | public void llGetInventoryPermMask(string item, int mask) | ||
1605 | { | ||
1606 | m_LSL_Functions.llGetInventoryPermMask(item, mask); | ||
1607 | } | ||
1608 | |||
1609 | public void llSetInventoryPermMask(string item, int mask, int value) | ||
1610 | { | ||
1611 | m_LSL_Functions.llSetInventoryPermMask(item, mask, value); | ||
1612 | } | ||
1613 | |||
1614 | public string llGetInventoryCreator(string item) | ||
1615 | { | ||
1616 | return m_LSL_Functions.llGetInventoryCreator(item); | ||
1617 | } | ||
1618 | |||
1619 | public void llOwnerSay(string msg) | ||
1620 | { | ||
1621 | m_LSL_Functions.llOwnerSay(msg); | ||
1622 | } | ||
1623 | |||
1624 | public void llRequestSimulatorData(string simulator, int data) | ||
1625 | { | ||
1626 | m_LSL_Functions.llRequestSimulatorData(simulator, data); | ||
1627 | } | ||
1628 | |||
1629 | public void llForceMouselook(int mouselook) | ||
1630 | { | ||
1631 | m_LSL_Functions.llForceMouselook(mouselook); | ||
1632 | } | ||
1633 | |||
1634 | public double llGetObjectMass(string id) | ||
1635 | { | ||
1636 | return m_LSL_Functions.llGetObjectMass(id); | ||
1637 | } | ||
1638 | |||
1639 | public void llListReplaceList() | ||
1640 | { | ||
1641 | m_LSL_Functions.llListReplaceList(); | ||
1642 | } | ||
1643 | |||
1644 | public void llLoadURL(string avatar_id, string message, string url) | ||
1645 | { | ||
1646 | m_LSL_Functions.llLoadURL(avatar_id, message, url); | ||
1647 | } | ||
1648 | |||
1649 | public void llParcelMediaCommandList(List<string> commandList) | ||
1650 | { | ||
1651 | m_LSL_Functions.llParcelMediaCommandList(commandList); | ||
1652 | } | ||
1653 | |||
1654 | public void llParcelMediaQuery() | ||
1655 | { | ||
1656 | m_LSL_Functions.llParcelMediaQuery(); | ||
1657 | } | ||
1658 | |||
1659 | public int llModPow(int a, int b, int c) | ||
1660 | { | ||
1661 | return m_LSL_Functions.llModPow(a, b, c); | ||
1662 | } | ||
1663 | |||
463 | // | 1664 | // |
464 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1665 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
465 | // | 1666 | // |
466 | public int llGetInventoryType(string name) { return m_LSL_Functions.llGetInventoryType(name); } | 1667 | public int llGetInventoryType(string name) |
467 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) { m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); } | 1668 | { |
468 | public LSL_Types.Vector3 llGetCameraPos() { return m_LSL_Functions.llGetCameraPos(); } | 1669 | return m_LSL_Functions.llGetInventoryType(name); |
469 | public LSL_Types.Quaternion llGetCameraRot() { return m_LSL_Functions.llGetCameraRot(); } | 1670 | } |
470 | public void llSetPrimURL() { m_LSL_Functions.llSetPrimURL(); } | 1671 | |
471 | public void llRefreshPrimURL() { m_LSL_Functions.llRefreshPrimURL(); } | 1672 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) |
472 | public string llEscapeURL(string url) { return m_LSL_Functions.llEscapeURL(url); } | 1673 | { |
473 | public string llUnescapeURL(string url) { return m_LSL_Functions.llUnescapeURL(url); } | 1674 | m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); |
474 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { m_LSL_Functions.llMapDestination(simname, pos, look_at); } | 1675 | } |
475 | public void llAddToLandBanList(string avatar, double hours) { m_LSL_Functions.llAddToLandBanList(avatar, hours); } | 1676 | |
476 | public void llRemoveFromLandPassList(string avatar) { m_LSL_Functions.llRemoveFromLandPassList(avatar); } | 1677 | public vector llGetCameraPos() |
477 | public void llRemoveFromLandBanList(string avatar) { m_LSL_Functions.llRemoveFromLandBanList(avatar); } | 1678 | { |
478 | public void llSetCameraParams(List<string> rules) { m_LSL_Functions.llSetCameraParams(rules); } | 1679 | return m_LSL_Functions.llGetCameraPos(); |
479 | public void llClearCameraParams() { m_LSL_Functions.llClearCameraParams(); } | 1680 | } |
480 | public double llListStatistics(int operation, List<string> src) { return m_LSL_Functions.llListStatistics(operation, src); } | 1681 | |
481 | public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } | 1682 | public rotation llGetCameraRot() |
482 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } | 1683 | { |
483 | public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } | 1684 | return m_LSL_Functions.llGetCameraRot(); |
484 | public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } | 1685 | } |
485 | public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } | 1686 | |
486 | public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } | 1687 | public void llSetPrimURL() |
487 | public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } | 1688 | { |
488 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } | 1689 | m_LSL_Functions.llSetPrimURL(); |
489 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelPrimOwners(pos); } | 1690 | } |
490 | public int llGetObjectPrimCount(string object_id) { return m_LSL_Functions.llGetObjectPrimCount(object_id); } | 1691 | |
1692 | public void llRefreshPrimURL() | ||
1693 | { | ||
1694 | m_LSL_Functions.llRefreshPrimURL(); | ||
1695 | } | ||
1696 | |||
1697 | public string llEscapeURL(string url) | ||
1698 | { | ||
1699 | return m_LSL_Functions.llEscapeURL(url); | ||
1700 | } | ||
1701 | |||
1702 | public string llUnescapeURL(string url) | ||
1703 | { | ||
1704 | return m_LSL_Functions.llUnescapeURL(url); | ||
1705 | } | ||
1706 | |||
1707 | public void llMapDestination(string simname, vector pos, vector look_at) | ||
1708 | { | ||
1709 | m_LSL_Functions.llMapDestination(simname, pos, look_at); | ||
1710 | } | ||
1711 | |||
1712 | public void llAddToLandBanList(string avatar, double hours) | ||
1713 | { | ||
1714 | m_LSL_Functions.llAddToLandBanList(avatar, hours); | ||
1715 | } | ||
1716 | |||
1717 | public void llRemoveFromLandPassList(string avatar) | ||
1718 | { | ||
1719 | m_LSL_Functions.llRemoveFromLandPassList(avatar); | ||
1720 | } | ||
1721 | |||
1722 | public void llRemoveFromLandBanList(string avatar) | ||
1723 | { | ||
1724 | m_LSL_Functions.llRemoveFromLandBanList(avatar); | ||
1725 | } | ||
1726 | |||
1727 | public void llSetCameraParams(List<string> rules) | ||
1728 | { | ||
1729 | m_LSL_Functions.llSetCameraParams(rules); | ||
1730 | } | ||
1731 | |||
1732 | public void llClearCameraParams() | ||
1733 | { | ||
1734 | m_LSL_Functions.llClearCameraParams(); | ||
1735 | } | ||
1736 | |||
1737 | public double llListStatistics(int operation, List<string> src) | ||
1738 | { | ||
1739 | return m_LSL_Functions.llListStatistics(operation, src); | ||
1740 | } | ||
1741 | |||
1742 | public int llGetUnixTime() | ||
1743 | { | ||
1744 | return m_LSL_Functions.llGetUnixTime(); | ||
1745 | } | ||
1746 | |||
1747 | public int llGetParcelFlags(vector pos) | ||
1748 | { | ||
1749 | return m_LSL_Functions.llGetParcelFlags(pos); | ||
1750 | } | ||
1751 | |||
1752 | public int llGetRegionFlags() | ||
1753 | { | ||
1754 | return m_LSL_Functions.llGetRegionFlags(); | ||
1755 | } | ||
1756 | |||
1757 | public string llXorBase64StringsCorrect(string str1, string str2) | ||
1758 | { | ||
1759 | return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); | ||
1760 | } | ||
1761 | |||
1762 | public void llHTTPRequest(string url, List<string> parameters, string body) | ||
1763 | { | ||
1764 | m_LSL_Functions.llHTTPRequest(url, parameters, body); | ||
1765 | } | ||
1766 | |||
1767 | public void llResetLandBanList() | ||
1768 | { | ||
1769 | m_LSL_Functions.llResetLandBanList(); | ||
1770 | } | ||
1771 | |||
1772 | public void llResetLandPassList() | ||
1773 | { | ||
1774 | m_LSL_Functions.llResetLandPassList(); | ||
1775 | } | ||
1776 | |||
1777 | public int llGetParcelPrimCount(vector pos, int category, int sim_wide) | ||
1778 | { | ||
1779 | return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); | ||
1780 | } | ||
1781 | |||
1782 | public List<string> llGetParcelPrimOwners(vector pos) | ||
1783 | { | ||
1784 | return m_LSL_Functions.llGetParcelPrimOwners(pos); | ||
1785 | } | ||
1786 | |||
1787 | public int llGetObjectPrimCount(string object_id) | ||
1788 | { | ||
1789 | return m_LSL_Functions.llGetObjectPrimCount(object_id); | ||
1790 | } | ||
1791 | |||
491 | // | 1792 | // |
492 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs | 1793 | // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs |
493 | // | 1794 | // |
494 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } | 1795 | public int llGetParcelMaxPrims(vector pos, int sim_wide) |
495 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } | 1796 | { |
1797 | return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); | ||
1798 | } | ||
1799 | |||
1800 | public List<string> llGetParcelDetails(vector pos, List<string> param) | ||
1801 | { | ||
1802 | return m_LSL_Functions.llGetParcelDetails(pos, param); | ||
1803 | } | ||
496 | 1804 | ||
497 | // | 1805 | // |
498 | // OpenSim Functions | 1806 | // OpenSim Functions |
499 | // | 1807 | // |
500 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } | 1808 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, |
1809 | int timer) | ||
1810 | { | ||
1811 | return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); | ||
1812 | } | ||
501 | 1813 | ||
502 | // LSL CONSTANTS | 1814 | // LSL CONSTANTS |
503 | public const int TRUE = 1; | 1815 | public const int TRUE = 1; |
@@ -803,10 +2115,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
803 | public const double SQRT2 = 1.414213538f; | 2115 | public const double SQRT2 = 1.414213538f; |
804 | 2116 | ||
805 | // Can not be public const? | 2117 | // Can not be public const? |
806 | public LSL_Types.Vector3 ZERO_VECTOR = new LSL_Types.Vector3(0, 0, 0); | 2118 | public vector ZERO_VECTOR = new vector(0, 0, 0); |
807 | public LSL_Types.Quaternion ZERO_ROTATION = new LSL_Types.Quaternion(0, 0, 0, 0); | 2119 | public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); |
808 | |||
809 | |||
810 | |||
811 | } | 2120 | } |
812 | } | 2121 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs index 00eb899..190e6d7 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs | |||
@@ -27,31 +27,32 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
35 | public static class Common | 33 | public static class Common |
36 | { | 34 | { |
37 | static public bool Debug = true; | 35 | public static bool Debug = true; |
38 | static public bool IL_UseTryCatch = true; | 36 | public static bool IL_UseTryCatch = true; |
39 | static public bool IL_CreateConstructor = true; | 37 | public static bool IL_CreateConstructor = true; |
40 | static public bool IL_CreateFunctionList = true; | 38 | public static bool IL_CreateFunctionList = true; |
41 | static public bool IL_ProcessCodeChunks = true; | 39 | public static bool IL_ProcessCodeChunks = true; |
42 | 40 | ||
43 | public delegate void SendToDebugEventDelegate(string Message); | 41 | public delegate void SendToDebugEventDelegate(string Message); |
42 | |||
44 | public delegate void SendToLogEventDelegate(string Message); | 43 | public delegate void SendToLogEventDelegate(string Message); |
45 | static public event SendToDebugEventDelegate SendToDebugEvent; | ||
46 | static public event SendToLogEventDelegate SendToLogEvent; | ||
47 | 44 | ||
48 | static public void SendToDebug(string Message) | 45 | public static event SendToDebugEventDelegate SendToDebugEvent; |
46 | public static event SendToLogEventDelegate SendToLogEvent; | ||
47 | |||
48 | public static void SendToDebug(string Message) | ||
49 | { | 49 | { |
50 | //if (Debug == true) | 50 | //if (Debug == true) |
51 | Console.WriteLine("COMPILER:Debug: " + Message); | 51 | Console.WriteLine("COMPILER:Debug: " + Message); |
52 | SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 52 | SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
53 | } | 53 | } |
54 | static public void SendToLog(string Message) | 54 | |
55 | public static void SendToLog(string Message) | ||
55 | { | 56 | { |
56 | //if (Debug == true) | 57 | //if (Debug == true) |
57 | Console.WriteLine("COMPILER:LOG: " + Message); | 58 | Console.WriteLine("COMPILER:LOG: " + Message); |
@@ -68,6 +69,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
68 | Common.SendToDebug("ReverseFormatString format: " + format); | 69 | Common.SendToDebug("ReverseFormatString format: " + format); |
69 | return string.Format(format, text1); | 70 | return string.Format(format, text1); |
70 | } | 71 | } |
72 | |||
71 | public static string ReverseFormatString(string text1, UInt32 text2, string format) | 73 | public static string ReverseFormatString(string text1, UInt32 text2, string format) |
72 | { | 74 | { |
73 | Common.SendToDebug("ReverseFormatString text1: " + text1); | 75 | Common.SendToDebug("ReverseFormatString text1: " + text1); |
@@ -75,10 +77,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
75 | Common.SendToDebug("ReverseFormatString format: " + format); | 77 | Common.SendToDebug("ReverseFormatString format: " + format); |
76 | return string.Format(format, text1, text2.ToString()); | 78 | return string.Format(format, text1, text2.ToString()); |
77 | } | 79 | } |
80 | |||
78 | public static string Cast_ToString(object obj) | 81 | public static string Cast_ToString(object obj) |
79 | { | 82 | { |
80 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); | 83 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); |
81 | return "ABCDEFGIHJKLMNOPQ123"; | 84 | return "ABCDEFGIHJKLMNOPQ123"; |
82 | } | 85 | } |
83 | } | 86 | } |
84 | } | 87 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs index f060f06..97981cc 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs | |||
@@ -27,20 +27,19 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.IO; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Reflection.Emit; | 32 | using System.Reflection.Emit; |
33 | using System.Text; | ||
32 | using System.Threading; | 34 | using System.Threading; |
33 | 35 | ||
34 | |||
35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
36 | { | 37 | { |
37 | |||
38 | |||
39 | public class Engine | 38 | public class Engine |
40 | { | 39 | { |
41 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; | 40 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; |
42 | private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; | 41 | private string LSO_FileName; // = @"LSO\CloseToDefault.lso"; |
43 | AppDomain appDomain; | 42 | private AppDomain appDomain; |
44 | 43 | ||
45 | public string Compile(string LSOFileName) | 44 | public string Compile(string LSOFileName) |
46 | { | 45 | { |
@@ -52,20 +51,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
52 | 51 | ||
53 | // Create Assembly Name | 52 | // Create Assembly Name |
54 | AssemblyName asmName = new AssemblyName(); | 53 | AssemblyName asmName = new AssemblyName(); |
55 | asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); | 54 | asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName); |
56 | //asmName.Name = "TestAssembly"; | 55 | //asmName.Name = "TestAssembly"; |
57 | 56 | ||
58 | string DLL_FileName = asmName.Name + ".dll"; | 57 | string DLL_FileName = asmName.Name + ".dll"; |
59 | string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; | 58 | string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; |
60 | 59 | ||
61 | Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName)); | 60 | Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName)); |
62 | Common.SendToLog("Assembly name: " + asmName.Name); | 61 | Common.SendToLog("Assembly name: " + asmName.Name); |
63 | Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); | 62 | Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); |
64 | Common.SendToLog("Starting processing of LSL ByteCode..."); | 63 | Common.SendToLog("Starting processing of LSL ByteCode..."); |
65 | Common.SendToLog(""); | 64 | Common.SendToLog(""); |
66 | 65 | ||
67 | 66 | ||
68 | |||
69 | // Create Assembly | 67 | // Create Assembly |
70 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( | 68 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( |
71 | asmName, | 69 | asmName, |
@@ -78,15 +76,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
78 | 76 | ||
79 | // Create a module (and save to disk) | 77 | // Create a module (and save to disk) |
80 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule | 78 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule |
81 | (asmName.Name, | 79 | (asmName.Name, |
82 | DLL_FileName); | 80 | DLL_FileName); |
83 | 81 | ||
84 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); | 82 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); |
85 | // Create a Class (/Type) | 83 | // Create a Class (/Type) |
86 | TypeBuilder typeBuilder = modBuilder.DefineType( | 84 | TypeBuilder typeBuilder = modBuilder.DefineType( |
87 | "LSL_ScriptObject", | 85 | "LSL_ScriptObject", |
88 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit, | 86 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit, |
89 | typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass)); | 87 | typeof (LSL_BaseClass)); |
90 | //, | 88 | //, |
91 | // typeof()); | 89 | // typeof()); |
92 | //, typeof(LSL_BuiltIn_Commands_Interface)); | 90 | //, typeof(LSL_BuiltIn_Commands_Interface)); |
@@ -95,7 +93,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
95 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); | 93 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); |
96 | 94 | ||
97 | 95 | ||
98 | |||
99 | /* | 96 | /* |
100 | * Generate the IL itself | 97 | * Generate the IL itself |
101 | */ | 98 | */ |
@@ -123,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
123 | asmBuilder.Save(DLL_FileName); | 120 | asmBuilder.Save(DLL_FileName); |
124 | 121 | ||
125 | Common.SendToLog("Returning assembly filename: " + DLL_FileName); | 122 | Common.SendToLog("Returning assembly filename: " + DLL_FileName); |
126 | 123 | ||
127 | 124 | ||
128 | return DLL_FileName; | 125 | return DLL_FileName; |
129 | 126 | ||
@@ -135,9 +132,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
135 | //object MyScript = (object)Activator.CreateInstance(type); | 132 | //object MyScript = (object)Activator.CreateInstance(type); |
136 | 133 | ||
137 | 134 | ||
138 | |||
139 | |||
140 | |||
141 | //System.Reflection.MemberInfo[] Members = type.GetMembers(); | 135 | //System.Reflection.MemberInfo[] Members = type.GetMembers(); |
142 | 136 | ||
143 | //Common.SendToLog("Members of assembly " + type.ToString() + ":"); | 137 | //Common.SendToLog("Members of assembly " + type.ToString() + ":"); |
@@ -165,29 +159,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
165 | // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); | 159 | // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); |
166 | 160 | ||
167 | //} | 161 | //} |
168 | |||
169 | |||
170 | } | 162 | } |
171 | 163 | ||
172 | 164 | ||
173 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) | 165 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) |
174 | { | 166 | { |
175 | |||
176 | |||
177 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); | 167 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); |
178 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( | 168 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( |
179 | // MethodAttributes.Public, | 169 | // MethodAttributes.Public, |
180 | // CallingConventions.Standard, | 170 | // CallingConventions.Standard, |
181 | // new Type[0]); | 171 | // new Type[0]); |
182 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( | 172 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( |
183 | MethodAttributes.Public | | 173 | MethodAttributes.Public | |
184 | MethodAttributes.SpecialName | | 174 | MethodAttributes.SpecialName | |
185 | MethodAttributes.RTSpecialName, | 175 | MethodAttributes.RTSpecialName, |
186 | CallingConventions.Standard, | 176 | CallingConventions.Standard, |
187 | new Type[0]); | 177 | new Type[0]); |
188 | 178 | ||
189 | //Define the reflection ConstructorInfor for System.Object | 179 | //Define the reflection ConstructorInfor for System.Object |
190 | ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]); | 180 | ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]); |
191 | 181 | ||
192 | //call constructor of base object | 182 | //call constructor of base object |
193 | ILGenerator il = constructor.GetILGenerator(); | 183 | ILGenerator il = constructor.GetILGenerator(); |
@@ -230,58 +220,61 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
230 | LSO_Struct.StaticBlock sb; | 220 | LSO_Struct.StaticBlock sb; |
231 | LSOP.StaticBlocks.TryGetValue(pos, out sb); | 221 | LSOP.StaticBlocks.TryGetValue(pos, out sb); |
232 | 222 | ||
233 | if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's | 223 | if (sb.ObjectType > 0 && sb.ObjectType < 8) |
234 | |||
235 | il.Emit(OpCodes.Ldarg_0); | ||
236 | // Push position to stack | ||
237 | il.Emit(OpCodes.Ldc_I4, pos); | ||
238 | //il.Emit(OpCodes.Box, typeof(UInt32)); | ||
239 | |||
240 | |||
241 | Type datatype = null; | ||
242 | |||
243 | // Push data to stack | ||
244 | Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")"); | ||
245 | switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType) | ||
246 | { | 224 | { |
247 | case LSO_Enums.Variable_Type_Codes.Float: | 225 | // We don't want void or null's |
248 | case LSO_Enums.Variable_Type_Codes.Integer: | 226 | |
249 | //UInt32 | 227 | il.Emit(OpCodes.Ldarg_0); |
250 | il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); | 228 | // Push position to stack |
251 | datatype = typeof(UInt32); | 229 | il.Emit(OpCodes.Ldc_I4, pos); |
252 | il.Emit(OpCodes.Box, datatype); | 230 | //il.Emit(OpCodes.Box, typeof(UInt32)); |
253 | break; | 231 | |
254 | case LSO_Enums.Variable_Type_Codes.String: | 232 | |
255 | case LSO_Enums.Variable_Type_Codes.Key: | 233 | Type datatype = null; |
256 | //String | 234 | |
257 | LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); | 235 | // Push data to stack |
258 | il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data)); | 236 | Common.SendToDebug("Adding to static (" + pos + ") type: " + |
259 | datatype = typeof(string); | 237 | ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType + |
260 | break; | 238 | ")"); |
261 | case LSO_Enums.Variable_Type_Codes.Vector: | 239 | switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType) |
262 | datatype = typeof(LSO_Enums.Vector); | 240 | { |
263 | //TODO: Not implemented | 241 | case LSO_Enums.Variable_Type_Codes.Float: |
264 | break; | 242 | case LSO_Enums.Variable_Type_Codes.Integer: |
265 | case LSO_Enums.Variable_Type_Codes.Rotation: | 243 | //UInt32 |
266 | //Object | 244 | il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); |
267 | //TODO: Not implemented | 245 | datatype = typeof (UInt32); |
268 | datatype = typeof(LSO_Enums.Rotation); | 246 | il.Emit(OpCodes.Box, datatype); |
269 | break; | 247 | break; |
270 | default: | 248 | case LSO_Enums.Variable_Type_Codes.String: |
271 | datatype = typeof(object); | 249 | case LSO_Enums.Variable_Type_Codes.Key: |
272 | break; | 250 | //String |
273 | } | 251 | LSO_Struct.HeapBlock hb = |
274 | 252 | LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); | |
275 | 253 | il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data)); | |
276 | // Make call | 254 | datatype = typeof (string); |
277 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype })); | 255 | break; |
256 | case LSO_Enums.Variable_Type_Codes.Vector: | ||
257 | datatype = typeof (LSO_Enums.Vector); | ||
258 | //TODO: Not implemented | ||
259 | break; | ||
260 | case LSO_Enums.Variable_Type_Codes.Rotation: | ||
261 | //Object | ||
262 | //TODO: Not implemented | ||
263 | datatype = typeof (LSO_Enums.Rotation); | ||
264 | break; | ||
265 | default: | ||
266 | datatype = typeof (object); | ||
267 | break; | ||
268 | } | ||
269 | |||
270 | |||
271 | // Make call | ||
272 | il.Emit(OpCodes.Call, | ||
273 | typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype})); | ||
278 | } | 274 | } |
279 | |||
280 | } | 275 | } |
281 | 276 | ||
282 | 277 | ||
283 | |||
284 | |||
285 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); | 278 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); |
286 | //il.Emit(OpCodes.Starg_0); | 279 | //il.Emit(OpCodes.Starg_0); |
287 | //// Create LSL function library | 280 | //// Create LSL function library |
@@ -293,8 +286,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
293 | } | 286 | } |
294 | 287 | ||
295 | 288 | ||
296 | |||
297 | |||
298 | // End of class | 289 | // End of class |
299 | } | 290 | } |
300 | } | 291 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs index 65be5e3..2dc8055 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs | |||
@@ -27,30 +27,25 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | 30 | using System.Reflection; |
33 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
34 | 32 | ||
35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
36 | { | 34 | { |
37 | partial class LSO_Parser | 35 | internal partial class LSO_Parser |
38 | { | 36 | { |
39 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) | 37 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) |
40 | { | 38 | { |
41 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, | 39 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, |
42 | TypeAttributes.Public | | 40 | TypeAttributes.Public | |
43 | TypeAttributes.Class | | 41 | TypeAttributes.Class | |
44 | TypeAttributes.AutoClass | | 42 | TypeAttributes.AutoClass | |
45 | TypeAttributes.AnsiClass | | 43 | TypeAttributes.AnsiClass | |
46 | TypeAttributes.BeforeFieldInit | | 44 | TypeAttributes.BeforeFieldInit | |
47 | TypeAttributes.AutoLayout, | 45 | TypeAttributes.AutoLayout, |
48 | typeof(object), | 46 | typeof (object), |
49 | new Type[] { typeof(object) }); | 47 | new Type[] {typeof (object)}); |
50 | return typeBuilder; | 48 | return typeBuilder; |
51 | |||
52 | } | 49 | } |
53 | |||
54 | |||
55 | } | 50 | } |
56 | } | 51 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs index 2fb8e45..b84400c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs | |||
@@ -28,9 +28,6 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | ||
34 | using OpenSim.Region.ScriptEngine.Common; | 31 | using OpenSim.Region.ScriptEngine.Common; |
35 | 32 | ||
36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
@@ -39,9 +36,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
39 | { | 36 | { |
40 | //public MemoryStream LSLStack = new MemoryStream(); | 37 | //public MemoryStream LSLStack = new MemoryStream(); |
41 | public Stack<object> LSLStack = new Stack<object>(); | 38 | public Stack<object> LSLStack = new Stack<object>(); |
42 | public Dictionary<UInt32, object> StaticVariables = new Dictionary<UInt32, object>(); | 39 | public Dictionary<uint, object> StaticVariables = new Dictionary<uint, object>(); |
43 | public Dictionary<UInt32, object> GlobalVariables = new Dictionary<UInt32, object>(); | 40 | public Dictionary<uint, object> GlobalVariables = new Dictionary<uint, object>(); |
44 | public Dictionary<UInt32, object> LocalVariables = new Dictionary<UInt32, object>(); | 41 | public Dictionary<uint, object> LocalVariables = new Dictionary<uint, object>(); |
45 | //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>(); | 42 | //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>(); |
46 | //public void AddFunction(String x) { | 43 | //public void AddFunction(String x) { |
47 | // FunctionList.Add(x); | 44 | // FunctionList.Add(x); |
@@ -54,19 +51,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
54 | //} | 51 | //} |
55 | public UInt32 State = 0; | 52 | public UInt32 State = 0; |
56 | public LSL_BuiltIn_Commands_Interface LSL_Builtins; | 53 | public LSL_BuiltIn_Commands_Interface LSL_Builtins; |
54 | |||
57 | public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn() | 55 | public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn() |
58 | { | 56 | { |
59 | return LSL_Builtins; | 57 | return LSL_Builtins; |
60 | } | 58 | } |
61 | 59 | ||
62 | 60 | ||
63 | public LSL_BaseClass() { } | 61 | public LSL_BaseClass() |
62 | { | ||
63 | } | ||
64 | 64 | ||
65 | 65 | ||
66 | public virtual int OverrideMe() | 66 | public virtual int OverrideMe() |
67 | { | 67 | { |
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | |||
70 | public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins) | 71 | public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins) |
71 | { | 72 | { |
72 | LSL_Builtins = LSLBuiltins; | 73 | LSL_Builtins = LSLBuiltins; |
@@ -81,8 +82,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
81 | Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType()); | 82 | Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType()); |
82 | StaticVariables.Add(index, obj); | 83 | StaticVariables.Add(index, obj); |
83 | } | 84 | } |
84 | |||
85 | |||
86 | |||
87 | } | 85 | } |
88 | } | 86 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs index a75b4c8..c805a01 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
@@ -53,6 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
53 | LocalVariables.Remove(index); | 51 | LocalVariables.Remove(index); |
54 | LocalVariables.Add(index, LSLStack.Peek()); | 52 | LocalVariables.Add(index, LSLStack.Peek()); |
55 | } | 53 | } |
54 | |||
56 | public void StoreToGlobal(UInt32 index) | 55 | public void StoreToGlobal(UInt32 index) |
57 | { | 56 | { |
58 | Common.SendToDebug("::StoreToGlobal " + index); | 57 | Common.SendToDebug("::StoreToGlobal " + index); |
@@ -60,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
60 | GlobalVariables.Remove(index); | 59 | GlobalVariables.Remove(index); |
61 | GlobalVariables.Add(index, LSLStack.Peek()); | 60 | GlobalVariables.Add(index, LSLStack.Peek()); |
62 | } | 61 | } |
62 | |||
63 | public void StoreToStatic(UInt32 index) | 63 | public void StoreToStatic(UInt32 index) |
64 | { | 64 | { |
65 | Common.SendToDebug("::StoreToStatic " + index); | 65 | Common.SendToDebug("::StoreToStatic " + index); |
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
67 | // StaticVariables.Remove(index); | 67 | // StaticVariables.Remove(index); |
68 | StaticVariables.Add(index, LSLStack.Peek()); | 68 | StaticVariables.Add(index, LSLStack.Peek()); |
69 | } | 69 | } |
70 | |||
70 | public void GetFromLocal(UInt32 index) | 71 | public void GetFromLocal(UInt32 index) |
71 | { | 72 | { |
72 | // TODO: How to determine local? | 73 | // TODO: How to determine local? |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
76 | LSLStack.Push(ret); | 77 | LSLStack.Push(ret); |
77 | //return ret; | 78 | //return ret; |
78 | } | 79 | } |
80 | |||
79 | public void GetFromGlobal(UInt32 index) | 81 | public void GetFromGlobal(UInt32 index) |
80 | { | 82 | { |
81 | Common.SendToDebug("::GetFromGlobal " + index); | 83 | Common.SendToDebug("::GetFromGlobal " + index); |
@@ -84,6 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
84 | LSLStack.Push(ret); | 86 | LSLStack.Push(ret); |
85 | //return ret; | 87 | //return ret; |
86 | } | 88 | } |
89 | |||
87 | public void GetFromStatic(UInt32 index) | 90 | public void GetFromStatic(UInt32 index) |
88 | { | 91 | { |
89 | Common.SendToDebug("::GetFromStatic " + index); | 92 | Common.SendToDebug("::GetFromStatic " + index); |
@@ -99,22 +102,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
99 | Common.SendToDebug("::POPToStack"); | 102 | Common.SendToDebug("::POPToStack"); |
100 | //return LSLStack.Pop(); | 103 | //return LSLStack.Pop(); |
101 | object p = LSLStack.Pop(); | 104 | object p = LSLStack.Pop(); |
102 | if (p.GetType() == typeof(UInt32)) | 105 | if (p.GetType() == typeof (UInt32)) |
103 | return (UInt32)p; | 106 | return (UInt32) p; |
104 | if (p.GetType() == typeof(string)) | 107 | if (p.GetType() == typeof (string)) |
105 | return (string)p; | 108 | return (string) p; |
106 | if (p.GetType() == typeof(Int32)) | 109 | if (p.GetType() == typeof (Int32)) |
107 | return (Int32)p; | 110 | return (Int32) p; |
108 | if (p.GetType() == typeof(UInt16)) | 111 | if (p.GetType() == typeof (UInt16)) |
109 | return (UInt16)p; | 112 | return (UInt16) p; |
110 | if (p.GetType() == typeof(float)) | 113 | if (p.GetType() == typeof (float)) |
111 | return (float)p; | 114 | return (float) p; |
112 | if (p.GetType() == typeof(LSO_Enums.Vector)) | 115 | if (p.GetType() == typeof (LSO_Enums.Vector)) |
113 | return (LSO_Enums.Vector)p; | 116 | return (LSO_Enums.Vector) p; |
114 | if (p.GetType() == typeof(LSO_Enums.Rotation)) | 117 | if (p.GetType() == typeof (LSO_Enums.Rotation)) |
115 | return (LSO_Enums.Rotation)p; | 118 | return (LSO_Enums.Rotation) p; |
116 | if (p.GetType() == typeof(LSO_Enums.Key)) | 119 | if (p.GetType() == typeof (LSO_Enums.Key)) |
117 | return (LSO_Enums.Key)p; | 120 | return (LSO_Enums.Key) p; |
118 | 121 | ||
119 | return p; | 122 | return p; |
120 | } | 123 | } |
@@ -151,6 +154,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
151 | LSLStack.Pop(); | 154 | LSLStack.Pop(); |
152 | } | 155 | } |
153 | } | 156 | } |
157 | |||
154 | public void PUSH(object Param) | 158 | public void PUSH(object Param) |
155 | { | 159 | { |
156 | if (Param == null) | 160 | if (Param == null) |
@@ -159,205 +163,218 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
159 | } | 163 | } |
160 | else | 164 | else |
161 | { | 165 | { |
162 | |||
163 | //Common.SendToDebug("::PUSH: " + Param.GetType()); | 166 | //Common.SendToDebug("::PUSH: " + Param.GetType()); |
164 | } | 167 | } |
165 | 168 | ||
166 | LSLStack.Push(Param); | 169 | LSLStack.Push(Param); |
167 | } | 170 | } |
171 | |||
168 | public void ADD(UInt32 Param) | 172 | public void ADD(UInt32 Param) |
169 | { | 173 | { |
170 | Common.SendToDebug("::ADD: " + Param); | 174 | Common.SendToDebug("::ADD: " + Param); |
171 | object o2 = LSLStack.Pop(); | 175 | object o2 = LSLStack.Pop(); |
172 | object o1 = LSLStack.Pop(); | 176 | object o1 = LSLStack.Pop(); |
173 | Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + " (" + o2.ToString() + ")"); | 177 | Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + |
174 | if (o2.GetType() == typeof(string)) | 178 | " (" + o2.ToString() + ")"); |
179 | if (o2.GetType() == typeof (string)) | ||
175 | { | 180 | { |
176 | LSLStack.Push((string)o1 + (string)o2); | 181 | LSLStack.Push((string) o1 + (string) o2); |
177 | return; | 182 | return; |
178 | } | 183 | } |
179 | if (o2.GetType() == typeof(UInt32)) | 184 | if (o2.GetType() == typeof (UInt32)) |
180 | { | 185 | { |
181 | LSLStack.Push((UInt32)o1 + (UInt32)o2); | 186 | LSLStack.Push((UInt32) o1 + (UInt32) o2); |
182 | return; | 187 | return; |
183 | } | 188 | } |
184 | |||
185 | } | 189 | } |
190 | |||
186 | public void SUB(UInt32 Param) | 191 | public void SUB(UInt32 Param) |
187 | { | 192 | { |
188 | Common.SendToDebug("::SUB: " + Param); | 193 | Common.SendToDebug("::SUB: " + Param); |
189 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 194 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
190 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 195 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
191 | LSLStack.Push((UInt32)(i1 - i2)); | 196 | LSLStack.Push((UInt32) (i1 - i2)); |
192 | } | 197 | } |
198 | |||
193 | public void MUL(UInt32 Param) | 199 | public void MUL(UInt32 Param) |
194 | { | 200 | { |
195 | Common.SendToDebug("::SUB: " + Param); | 201 | Common.SendToDebug("::SUB: " + Param); |
196 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 202 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
197 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 203 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
198 | LSLStack.Push((UInt32)(i1 * i2)); | 204 | LSLStack.Push((UInt32) (i1*i2)); |
199 | } | 205 | } |
206 | |||
200 | public void DIV(UInt32 Param) | 207 | public void DIV(UInt32 Param) |
201 | { | 208 | { |
202 | Common.SendToDebug("::DIV: " + Param); | 209 | Common.SendToDebug("::DIV: " + Param); |
203 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 210 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
204 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 211 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
205 | LSLStack.Push((UInt32)(i1 / i2)); | 212 | LSLStack.Push((UInt32) (i1/i2)); |
206 | } | 213 | } |
207 | 214 | ||
208 | 215 | ||
209 | public void MOD(UInt32 Param) | 216 | public void MOD(UInt32 Param) |
210 | { | 217 | { |
211 | Common.SendToDebug("::MOD: " + Param); | 218 | Common.SendToDebug("::MOD: " + Param); |
212 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 219 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
213 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 220 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
214 | LSLStack.Push((UInt32)(i1 % i2)); | 221 | LSLStack.Push((UInt32) (i1%i2)); |
215 | } | 222 | } |
223 | |||
216 | public void EQ(UInt32 Param) | 224 | public void EQ(UInt32 Param) |
217 | { | 225 | { |
218 | Common.SendToDebug("::EQ: " + Param); | 226 | Common.SendToDebug("::EQ: " + Param); |
219 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 227 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
220 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 228 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
221 | if (i1 == i2) | 229 | if (i1 == i2) |
222 | { | 230 | { |
223 | LSLStack.Push((UInt32)1); | 231 | LSLStack.Push((UInt32) 1); |
224 | } | 232 | } |
225 | else | 233 | else |
226 | { | 234 | { |
227 | LSLStack.Push((UInt32)0); | 235 | LSLStack.Push((UInt32) 0); |
228 | } | 236 | } |
229 | } | 237 | } |
238 | |||
230 | public void NEQ(UInt32 Param) | 239 | public void NEQ(UInt32 Param) |
231 | { | 240 | { |
232 | Common.SendToDebug("::NEQ: " + Param); | 241 | Common.SendToDebug("::NEQ: " + Param); |
233 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 242 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
234 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 243 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
235 | if (i1 != i2) | 244 | if (i1 != i2) |
236 | { | 245 | { |
237 | LSLStack.Push((UInt32)1); | 246 | LSLStack.Push((UInt32) 1); |
238 | } | 247 | } |
239 | else | 248 | else |
240 | { | 249 | { |
241 | LSLStack.Push((UInt32)0); | 250 | LSLStack.Push((UInt32) 0); |
242 | } | 251 | } |
243 | } | 252 | } |
253 | |||
244 | public void LEQ(UInt32 Param) | 254 | public void LEQ(UInt32 Param) |
245 | { | 255 | { |
246 | Common.SendToDebug("::LEQ: " + Param); | 256 | Common.SendToDebug("::LEQ: " + Param); |
247 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 257 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
248 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 258 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
249 | if (i1 <= i2) | 259 | if (i1 <= i2) |
250 | { | 260 | { |
251 | LSLStack.Push((UInt32)1); | 261 | LSLStack.Push((UInt32) 1); |
252 | } | 262 | } |
253 | else | 263 | else |
254 | { | 264 | { |
255 | LSLStack.Push((UInt32)0); | 265 | LSLStack.Push((UInt32) 0); |
256 | } | 266 | } |
257 | } | 267 | } |
268 | |||
258 | public void GEQ(UInt32 Param) | 269 | public void GEQ(UInt32 Param) |
259 | { | 270 | { |
260 | Common.SendToDebug("::GEQ: " + Param); | 271 | Common.SendToDebug("::GEQ: " + Param); |
261 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 272 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
262 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 273 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
263 | if (i1 >= i2) | 274 | if (i1 >= i2) |
264 | { | 275 | { |
265 | LSLStack.Push((UInt32)1); | 276 | LSLStack.Push((UInt32) 1); |
266 | } | 277 | } |
267 | else | 278 | else |
268 | { | 279 | { |
269 | LSLStack.Push((UInt32)0); | 280 | LSLStack.Push((UInt32) 0); |
270 | } | 281 | } |
271 | } | 282 | } |
283 | |||
272 | public void LESS(UInt32 Param) | 284 | public void LESS(UInt32 Param) |
273 | { | 285 | { |
274 | Common.SendToDebug("::LESS: " + Param); | 286 | Common.SendToDebug("::LESS: " + Param); |
275 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 287 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
276 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 288 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
277 | if (i1 < i2) | 289 | if (i1 < i2) |
278 | { | 290 | { |
279 | LSLStack.Push((UInt32)1); | 291 | LSLStack.Push((UInt32) 1); |
280 | } | 292 | } |
281 | else | 293 | else |
282 | { | 294 | { |
283 | LSLStack.Push((UInt32)0); | 295 | LSLStack.Push((UInt32) 0); |
284 | } | 296 | } |
285 | } | 297 | } |
298 | |||
286 | public void GREATER(UInt32 Param) | 299 | public void GREATER(UInt32 Param) |
287 | { | 300 | { |
288 | Common.SendToDebug("::GREATER: " + Param); | 301 | Common.SendToDebug("::GREATER: " + Param); |
289 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 302 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
290 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 303 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
291 | if (i1 > i2) | 304 | if (i1 > i2) |
292 | { | 305 | { |
293 | LSLStack.Push((UInt32)1); | 306 | LSLStack.Push((UInt32) 1); |
294 | } | 307 | } |
295 | else | 308 | else |
296 | { | 309 | { |
297 | LSLStack.Push((UInt32)0); | 310 | LSLStack.Push((UInt32) 0); |
298 | } | 311 | } |
299 | } | 312 | } |
300 | 313 | ||
301 | 314 | ||
302 | |||
303 | public void BITAND() | 315 | public void BITAND() |
304 | { | 316 | { |
305 | Common.SendToDebug("::BITAND"); | 317 | Common.SendToDebug("::BITAND"); |
306 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 318 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
307 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 319 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
308 | LSLStack.Push((UInt32)(i1 & i2)); | 320 | LSLStack.Push((UInt32) (i1 & i2)); |
309 | } | 321 | } |
322 | |||
310 | public void BITOR() | 323 | public void BITOR() |
311 | { | 324 | { |
312 | Common.SendToDebug("::BITOR"); | 325 | Common.SendToDebug("::BITOR"); |
313 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 326 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
314 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 327 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
315 | LSLStack.Push((UInt32)(i1 | i2)); | 328 | LSLStack.Push((UInt32) (i1 | i2)); |
316 | } | 329 | } |
330 | |||
317 | public void BITXOR() | 331 | public void BITXOR() |
318 | { | 332 | { |
319 | Common.SendToDebug("::BITXOR"); | 333 | Common.SendToDebug("::BITXOR"); |
320 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 334 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
321 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 335 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
322 | LSLStack.Push((UInt32)(i1 ^ i2)); | 336 | LSLStack.Push((UInt32) (i1 ^ i2)); |
323 | } | 337 | } |
338 | |||
324 | public void BOOLAND() | 339 | public void BOOLAND() |
325 | { | 340 | { |
326 | Common.SendToDebug("::BOOLAND"); | 341 | Common.SendToDebug("::BOOLAND"); |
327 | bool b2 = bool.Parse((string)LSLStack.Pop()); | 342 | bool b2 = bool.Parse((string) LSLStack.Pop()); |
328 | bool b1 = bool.Parse((string)LSLStack.Pop()); | 343 | bool b1 = bool.Parse((string) LSLStack.Pop()); |
329 | if (b1 && b2) | 344 | if (b1 && b2) |
330 | { | 345 | { |
331 | LSLStack.Push((UInt32)1); | 346 | LSLStack.Push((UInt32) 1); |
332 | } | 347 | } |
333 | else | 348 | else |
334 | { | 349 | { |
335 | LSLStack.Push((UInt32)0); | 350 | LSLStack.Push((UInt32) 0); |
336 | } | 351 | } |
337 | } | 352 | } |
353 | |||
338 | public void BOOLOR() | 354 | public void BOOLOR() |
339 | { | 355 | { |
340 | Common.SendToDebug("::BOOLOR"); | 356 | Common.SendToDebug("::BOOLOR"); |
341 | bool b2 = bool.Parse((string)LSLStack.Pop()); | 357 | bool b2 = bool.Parse((string) LSLStack.Pop()); |
342 | bool b1 = bool.Parse((string)LSLStack.Pop()); | 358 | bool b1 = bool.Parse((string) LSLStack.Pop()); |
343 | 359 | ||
344 | if (b1 || b2) | 360 | if (b1 || b2) |
345 | { | 361 | { |
346 | LSLStack.Push((UInt32)1); | 362 | LSLStack.Push((UInt32) 1); |
347 | } | 363 | } |
348 | else | 364 | else |
349 | { | 365 | { |
350 | LSLStack.Push((UInt32)0); | 366 | LSLStack.Push((UInt32) 0); |
351 | } | 367 | } |
352 | |||
353 | } | 368 | } |
369 | |||
354 | public void NEG(UInt32 Param) | 370 | public void NEG(UInt32 Param) |
355 | { | 371 | { |
356 | Common.SendToDebug("::NEG: " + Param); | 372 | Common.SendToDebug("::NEG: " + Param); |
357 | //UInt32 i2 = (UInt32)LSLStack.Pop(); | 373 | //UInt32 i2 = (UInt32)LSLStack.Pop(); |
358 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 374 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
359 | LSLStack.Push((UInt32)(i1 * -1)); | 375 | LSLStack.Push((UInt32) (i1*-1)); |
360 | } | 376 | } |
377 | |||
361 | public void BITNOT() | 378 | public void BITNOT() |
362 | { | 379 | { |
363 | //Common.SendToDebug("::BITNOT"); | 380 | //Common.SendToDebug("::BITNOT"); |
@@ -365,6 +382,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
365 | //UInt32 i1 = (UInt32)LSLStack.Pop(); | 382 | //UInt32 i1 = (UInt32)LSLStack.Pop(); |
366 | //LSLStack.Push((UInt32)(i1 / i2)); | 383 | //LSLStack.Push((UInt32)(i1 / i2)); |
367 | } | 384 | } |
385 | |||
368 | public void BOOLNOT() | 386 | public void BOOLNOT() |
369 | { | 387 | { |
370 | //Common.SendToDebug("::BOOLNOT"); | 388 | //Common.SendToDebug("::BOOLNOT"); |
@@ -372,7 +390,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
372 | //UInt32 i1 = (UInt32)LSLStack.Pop(); | 390 | //UInt32 i1 = (UInt32)LSLStack.Pop(); |
373 | //LSLStack.Push((UInt32)(i1)); | 391 | //LSLStack.Push((UInt32)(i1)); |
374 | } | 392 | } |
375 | |||
376 | |||
377 | } | 393 | } |
378 | } | 394 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs index 5f01bf5..8b233ba 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 29 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 30 | { |
35 | public class LSL_CLRInterface | 31 | public class LSL_CLRInterface |
@@ -76,4 +72,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
76 | //void event_http_response(); | 72 | //void event_http_response(); |
77 | } | 73 | } |
78 | } | 74 | } |
79 | } | 75 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs index ee166a6..e1d7768 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs | |||
@@ -27,32 +27,28 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | 30 | using System.Reflection; |
33 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
34 | using OpenSim.Region.ScriptEngine.Common; | 32 | using OpenSim.Region.ScriptEngine.Common; |
35 | 33 | ||
36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
37 | { | 35 | { |
38 | partial class LSO_Parser | 36 | internal partial class LSO_Parser |
39 | { | 37 | { |
40 | //internal Stack<Type> ILStack = new Stack<Type>(); | 38 | //internal Stack<Type> ILStack = new Stack<Type>(); |
41 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); | 39 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); |
42 | 40 | ||
43 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) | 41 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) |
44 | { | 42 | { |
45 | |||
46 | byte bp1; | 43 | byte bp1; |
47 | UInt32 u32p1; | 44 | UInt32 u32p1; |
48 | float fp1; | 45 | float fp1; |
49 | UInt16 opcode = br_read(1)[0]; | 46 | UInt16 opcode = br_read(1)[0]; |
50 | Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); | 47 | Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString()); |
51 | string idesc = ((LSO_Enums.Operation_Table)opcode).ToString(); | 48 | string idesc = ((LSO_Enums.Operation_Table) opcode).ToString(); |
52 | switch ((LSO_Enums.Operation_Table)opcode) | 49 | switch ((LSO_Enums.Operation_Table) opcode) |
53 | { | 50 | { |
54 | 51 | /*************** | |
55 | /*************** | ||
56 | * IMPLEMENTED * | 52 | * IMPLEMENTED * |
57 | ***************/ | 53 | ***************/ |
58 | case LSO_Enums.Operation_Table.NOOP: | 54 | case LSO_Enums.Operation_Table.NOOP: |
@@ -60,33 +56,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
60 | case LSO_Enums.Operation_Table.PUSHSP: | 56 | case LSO_Enums.Operation_Table.PUSHSP: |
61 | // Push Stack Top (Memory Address) to stack | 57 | // Push Stack Top (Memory Address) to stack |
62 | Common.SendToDebug("Instruction " + idesc); | 58 | Common.SendToDebug("Instruction " + idesc); |
63 | Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack"); | 59 | Common.SendToDebug("Instruction " + idesc + |
64 | IL_Push(il, (UInt32)myHeader.SP); | 60 | ": Description: Pushing Stack Top (Memory Address from header) to stack"); |
61 | IL_Push(il, (UInt32) myHeader.SP); | ||
65 | break; | 62 | break; |
66 | // BYTE | 63 | // BYTE |
67 | case LSO_Enums.Operation_Table.PUSHARGB: | 64 | case LSO_Enums.Operation_Table.PUSHARGB: |
68 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 65 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
69 | break; | 66 | break; |
70 | // INTEGER | 67 | // INTEGER |
71 | case LSO_Enums.Operation_Table.PUSHARGI: | 68 | case LSO_Enums.Operation_Table.PUSHARGI: |
72 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 69 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
73 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); | 70 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); |
74 | IL_Push(il, u32p1); | 71 | IL_Push(il, u32p1); |
75 | break; | 72 | break; |
76 | // FLOAT | 73 | // FLOAT |
77 | case LSO_Enums.Operation_Table.PUSHARGF: | 74 | case LSO_Enums.Operation_Table.PUSHARGF: |
78 | fp1 = BitConverter.ToUInt32(br_read(4), 0); | 75 | fp1 = BitConverter.ToUInt32(br_read(4), 0); |
79 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); | 76 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); |
80 | IL_Push(il, fp1); | 77 | IL_Push(il, fp1); |
81 | break; | 78 | break; |
82 | // STRING | 79 | // STRING |
83 | case LSO_Enums.Operation_Table.PUSHARGS: | 80 | case LSO_Enums.Operation_Table.PUSHARGS: |
84 | string s = Read_String(); | 81 | string s = Read_String(); |
85 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); | 82 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); |
86 | IL_Debug(il, "OPCODE: " + idesc + ":" + s); | 83 | IL_Debug(il, "OPCODE: " + idesc + ":" + s); |
87 | IL_Push(il, s); | 84 | IL_Push(il, s); |
88 | break; | 85 | break; |
89 | // VECTOR z,y,x | 86 | // VECTOR z,y,x |
90 | case LSO_Enums.Operation_Table.PUSHARGV: | 87 | case LSO_Enums.Operation_Table.PUSHARGV: |
91 | LSO_Enums.Vector v = new LSO_Enums.Vector(); | 88 | LSO_Enums.Vector v = new LSO_Enums.Vector(); |
92 | v.Z = BitConverter.ToUInt32(br_read(4), 0); | 89 | v.Z = BitConverter.ToUInt32(br_read(4), 0); |
@@ -97,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
97 | Common.SendToDebug("Param1 X: " + v.X); | 94 | Common.SendToDebug("Param1 X: " + v.X); |
98 | IL_Push(il, v); | 95 | IL_Push(il, v); |
99 | break; | 96 | break; |
100 | // ROTATION s,z,y,x | 97 | // ROTATION s,z,y,x |
101 | case LSO_Enums.Operation_Table.PUSHARGQ: | 98 | case LSO_Enums.Operation_Table.PUSHARGQ: |
102 | LSO_Enums.Rotation r = new LSO_Enums.Rotation(); | 99 | LSO_Enums.Rotation r = new LSO_Enums.Rotation(); |
103 | r.S = BitConverter.ToUInt32(br_read(4), 0); | 100 | r.S = BitConverter.ToUInt32(br_read(4), 0); |
@@ -112,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
112 | break; | 109 | break; |
113 | 110 | ||
114 | case LSO_Enums.Operation_Table.PUSHE: | 111 | case LSO_Enums.Operation_Table.PUSHE: |
115 | IL_Push(il, (UInt32)0); | 112 | IL_Push(il, (UInt32) 0); |
116 | break; | 113 | break; |
117 | 114 | ||
118 | case LSO_Enums.Operation_Table.PUSHARGE: | 115 | case LSO_Enums.Operation_Table.PUSHARGE: |
@@ -121,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
121 | //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); | 118 | //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); |
122 | IL_Push(il, u32p1); | 119 | IL_Push(il, u32p1); |
123 | break; | 120 | break; |
124 | // BYTE | 121 | // BYTE |
125 | case LSO_Enums.Operation_Table.ADD: | 122 | case LSO_Enums.Operation_Table.ADD: |
126 | case LSO_Enums.Operation_Table.SUB: | 123 | case LSO_Enums.Operation_Table.SUB: |
127 | case LSO_Enums.Operation_Table.MUL: | 124 | case LSO_Enums.Operation_Table.MUL: |
@@ -136,10 +133,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
136 | case LSO_Enums.Operation_Table.MOD: | 133 | case LSO_Enums.Operation_Table.MOD: |
137 | bp1 = br_read(1)[0]; | 134 | bp1 = br_read(1)[0]; |
138 | Common.SendToDebug("Param1: " + bp1); | 135 | Common.SendToDebug("Param1: " + bp1); |
139 | IL_CallBaseFunction(il, idesc, (UInt32)bp1); | 136 | IL_CallBaseFunction(il, idesc, (UInt32) bp1); |
140 | break; | 137 | break; |
141 | 138 | ||
142 | // NO ARGUMENTS | 139 | // NO ARGUMENTS |
143 | case LSO_Enums.Operation_Table.BITAND: | 140 | case LSO_Enums.Operation_Table.BITAND: |
144 | case LSO_Enums.Operation_Table.BITOR: | 141 | case LSO_Enums.Operation_Table.BITOR: |
145 | case LSO_Enums.Operation_Table.BITXOR: | 142 | case LSO_Enums.Operation_Table.BITXOR: |
@@ -149,22 +146,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
149 | case LSO_Enums.Operation_Table.BOOLNOT: | 146 | case LSO_Enums.Operation_Table.BOOLNOT: |
150 | IL_CallBaseFunction(il, idesc); | 147 | IL_CallBaseFunction(il, idesc); |
151 | break; | 148 | break; |
152 | // SHORT | 149 | // SHORT |
153 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: | 150 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: |
154 | // TODO: What is size of short? | 151 | // TODO: What is size of short? |
155 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); | 152 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); |
156 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString()); | 153 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + |
154 | ((LSO_Enums.BuiltIn_Functions) U16p1).ToString()); | ||
157 | //Common.SendToDebug("Param1: " + U16p1); | 155 | //Common.SendToDebug("Param1: " + U16p1); |
158 | string fname = ((LSO_Enums.BuiltIn_Functions)U16p1).ToString(); | 156 | string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString(); |
159 | 157 | ||
160 | bool cmdFound = false; | 158 | bool cmdFound = false; |
161 | foreach (MethodInfo mi in typeof(LSL_BuiltIn_Commands_Interface).GetMethods()) | 159 | foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods()) |
162 | { | 160 | { |
163 | // Found command | 161 | // Found command |
164 | if (mi.Name == fname) | 162 | if (mi.Name == fname) |
165 | { | 163 | { |
166 | il.Emit(OpCodes.Ldarg_0); | 164 | il.Emit(OpCodes.Ldarg_0); |
167 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] { })); | 165 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {})); |
168 | // Pop required number of items from my stack to .Net stack | 166 | // Pop required number of items from my stack to .Net stack |
169 | IL_PopToStack(il, mi.GetParameters().Length); | 167 | IL_PopToStack(il, mi.GetParameters().Length); |
170 | il.Emit(OpCodes.Callvirt, mi); | 168 | il.Emit(OpCodes.Callvirt, mi); |
@@ -179,7 +177,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
179 | 177 | ||
180 | break; | 178 | break; |
181 | 179 | ||
182 | // RETURN | 180 | // RETURN |
183 | case LSO_Enums.Operation_Table.RETURN: | 181 | case LSO_Enums.Operation_Table.RETURN: |
184 | 182 | ||
185 | Common.SendToDebug("OPCODE: RETURN"); | 183 | Common.SendToDebug("OPCODE: RETURN"); |
@@ -195,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
195 | IL_Pop(il); | 193 | IL_Pop(il); |
196 | break; | 194 | break; |
197 | 195 | ||
198 | // LONG | 196 | // LONG |
199 | case LSO_Enums.Operation_Table.STORE: | 197 | case LSO_Enums.Operation_Table.STORE: |
200 | case LSO_Enums.Operation_Table.STORES: | 198 | case LSO_Enums.Operation_Table.STORES: |
201 | case LSO_Enums.Operation_Table.STOREL: | 199 | case LSO_Enums.Operation_Table.STOREL: |
@@ -238,7 +236,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
238 | IL_Pop(il); | 236 | IL_Pop(il); |
239 | break; | 237 | break; |
240 | 238 | ||
241 | // PUSH FROM LOCAL FRAME | 239 | // PUSH FROM LOCAL FRAME |
242 | case LSO_Enums.Operation_Table.PUSH: | 240 | case LSO_Enums.Operation_Table.PUSH: |
243 | case LSO_Enums.Operation_Table.PUSHS: | 241 | case LSO_Enums.Operation_Table.PUSHS: |
244 | case LSO_Enums.Operation_Table.PUSHL: | 242 | case LSO_Enums.Operation_Table.PUSHL: |
@@ -250,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
250 | 248 | ||
251 | break; | 249 | break; |
252 | 250 | ||
253 | // PUSH FROM STATIC FRAME | 251 | // PUSH FROM STATIC FRAME |
254 | case LSO_Enums.Operation_Table.PUSHG: | 252 | case LSO_Enums.Operation_Table.PUSHG: |
255 | case LSO_Enums.Operation_Table.PUSHGS: | 253 | case LSO_Enums.Operation_Table.PUSHGS: |
256 | case LSO_Enums.Operation_Table.PUSHGL: | 254 | case LSO_Enums.Operation_Table.PUSHGL: |
@@ -262,26 +260,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
262 | break; | 260 | break; |
263 | 261 | ||
264 | 262 | ||
265 | /*********************** | 263 | /*********************** |
266 | * NOT IMPLEMENTED YET * | 264 | * NOT IMPLEMENTED YET * |
267 | ***********************/ | 265 | ***********************/ |
268 | 266 | ||
269 | 267 | ||
270 | |||
271 | case LSO_Enums.Operation_Table.POPIP: | 268 | case LSO_Enums.Operation_Table.POPIP: |
272 | case LSO_Enums.Operation_Table.POPSP: | 269 | case LSO_Enums.Operation_Table.POPSP: |
273 | case LSO_Enums.Operation_Table.POPSLR: | 270 | case LSO_Enums.Operation_Table.POPSLR: |
274 | case LSO_Enums.Operation_Table.POPARG: | 271 | case LSO_Enums.Operation_Table.POPARG: |
275 | case LSO_Enums.Operation_Table.POPBP: | 272 | case LSO_Enums.Operation_Table.POPBP: |
276 | //Common.SendToDebug("Instruction " + idesc + ": Ignored"); | 273 | //Common.SendToDebug("Instruction " + idesc + ": Ignored"); |
277 | Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); | 274 | Common.SendToDebug("Instruction " + idesc + |
275 | ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); | ||
278 | //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 276 | //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
279 | IL_Pop(il); | 277 | IL_Pop(il); |
280 | break; | 278 | break; |
281 | 279 | ||
282 | 280 | ||
283 | 281 | // None | |
284 | // None | ||
285 | case LSO_Enums.Operation_Table.PUSHIP: | 282 | case LSO_Enums.Operation_Table.PUSHIP: |
286 | // PUSH INSTRUCTION POINTER | 283 | // PUSH INSTRUCTION POINTER |
287 | break; | 284 | break; |
@@ -293,17 +290,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
293 | break; | 290 | break; |
294 | 291 | ||
295 | 292 | ||
296 | // LONG | 293 | // LONG |
297 | case LSO_Enums.Operation_Table.JUMP: | 294 | case LSO_Enums.Operation_Table.JUMP: |
298 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 295 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
299 | break; | 296 | break; |
300 | // BYTE, LONG | 297 | // BYTE, LONG |
301 | case LSO_Enums.Operation_Table.JUMPIF: | 298 | case LSO_Enums.Operation_Table.JUMPIF: |
302 | case LSO_Enums.Operation_Table.JUMPNIF: | 299 | case LSO_Enums.Operation_Table.JUMPNIF: |
303 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 300 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
304 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); | 301 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); |
305 | break; | 302 | break; |
306 | // LONG | 303 | // LONG |
307 | case LSO_Enums.Operation_Table.STATE: | 304 | case LSO_Enums.Operation_Table.STATE: |
308 | bp1 = br_read(1)[0]; | 305 | bp1 = br_read(1)[0]; |
309 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack | 306 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack |
@@ -315,12 +312,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
315 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 312 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
316 | Common.SendToDebug("ERROR: Function CALL not implemented yet."); | 313 | Common.SendToDebug("ERROR: Function CALL not implemented yet."); |
317 | break; | 314 | break; |
318 | // BYTE | 315 | // BYTE |
319 | case LSO_Enums.Operation_Table.CAST: | 316 | case LSO_Enums.Operation_Table.CAST: |
320 | bp1 = br_read(1)[0]; | 317 | bp1 = br_read(1)[0]; |
321 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)); | 318 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + |
319 | ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)); | ||
322 | Common.SendToDebug("Param1: " + bp1); | 320 | Common.SendToDebug("Param1: " + bp1); |
323 | switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1) | 321 | switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1) |
324 | { | 322 | { |
325 | case LSO_Enums.OpCode_Cast_TypeDefs.String: | 323 | case LSO_Enums.OpCode_Cast_TypeDefs.String: |
326 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); | 324 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); |
@@ -330,12 +328,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
330 | break; | 328 | break; |
331 | } | 329 | } |
332 | break; | 330 | break; |
333 | // LONG | 331 | // LONG |
334 | case LSO_Enums.Operation_Table.STACKTOS: | 332 | case LSO_Enums.Operation_Table.STACKTOS: |
335 | case LSO_Enums.Operation_Table.STACKTOL: | 333 | case LSO_Enums.Operation_Table.STACKTOL: |
336 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 334 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
337 | break; | 335 | break; |
338 | // BYTE | 336 | // BYTE |
339 | case LSO_Enums.Operation_Table.PRINT: | 337 | case LSO_Enums.Operation_Table.PRINT: |
340 | case LSO_Enums.Operation_Table.CALLLIB: | 338 | case LSO_Enums.Operation_Table.CALLLIB: |
341 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 339 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
@@ -348,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
348 | { | 346 | { |
349 | IL_PopToStack(il, 1); | 347 | IL_PopToStack(il, 1); |
350 | } | 348 | } |
349 | |||
351 | private void IL_PopToStack(ILGenerator il, int count) | 350 | private void IL_PopToStack(ILGenerator il, int count) |
352 | { | 351 | { |
353 | Common.SendToDebug("IL_PopToStack();"); | 352 | Common.SendToDebug("IL_PopToStack();"); |
@@ -360,31 +359,35 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
360 | // new Type[] { })); | 359 | // new Type[] { })); |
361 | } | 360 | } |
362 | } | 361 | } |
362 | |||
363 | private void IL_Pop(ILGenerator il) | 363 | private void IL_Pop(ILGenerator il) |
364 | { | 364 | { |
365 | Common.SendToDebug("IL_Pop();"); | 365 | Common.SendToDebug("IL_Pop();"); |
366 | IL_CallBaseFunction(il, "POP"); | 366 | IL_CallBaseFunction(il, "POP"); |
367 | } | 367 | } |
368 | |||
368 | private void IL_Debug(ILGenerator il, string text) | 369 | private void IL_Debug(ILGenerator il, string text) |
369 | { | 370 | { |
370 | il.Emit(OpCodes.Ldstr, text); | 371 | il.Emit(OpCodes.Ldstr, text); |
371 | il.Emit(OpCodes.Call, typeof(Common).GetMethod("SendToDebug", | 372 | il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug", |
372 | new Type[] { typeof(string) } | 373 | new Type[] {typeof (string)} |
373 | )); | 374 | )); |
374 | } | 375 | } |
376 | |||
375 | private void IL_CallBaseFunction(ILGenerator il, string methodname) | 377 | private void IL_CallBaseFunction(ILGenerator il, string methodname) |
376 | { | 378 | { |
377 | il.Emit(OpCodes.Ldarg_0); | 379 | il.Emit(OpCodes.Ldarg_0); |
378 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { })); | 380 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {})); |
379 | } | 381 | } |
382 | |||
380 | private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) | 383 | private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) |
381 | { | 384 | { |
382 | il.Emit(OpCodes.Ldarg_0); | 385 | il.Emit(OpCodes.Ldarg_0); |
383 | if (data.GetType() == typeof(string)) | 386 | if (data.GetType() == typeof (string)) |
384 | il.Emit(OpCodes.Ldstr, (string)data); | 387 | il.Emit(OpCodes.Ldstr, (string) data); |
385 | if (data.GetType() == typeof(UInt32)) | 388 | if (data.GetType() == typeof (UInt32)) |
386 | il.Emit(OpCodes.Ldc_I4, (UInt32)data); | 389 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); |
387 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { data.GetType() })); | 390 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()})); |
388 | } | 391 | } |
389 | 392 | ||
390 | private void IL_Push(ILGenerator il, object data) | 393 | private void IL_Push(ILGenerator il, object data) |
@@ -394,43 +397,39 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
394 | 397 | ||
395 | IL_PushDataTypeToILStack(il, data); | 398 | IL_PushDataTypeToILStack(il, data); |
396 | 399 | ||
397 | il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("PUSH", new Type[] { data.GetType() })); | 400 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()})); |
398 | |||
399 | } | 401 | } |
400 | 402 | ||
401 | private void IL_PushDataTypeToILStack(ILGenerator il, object data) | 403 | private void IL_PushDataTypeToILStack(ILGenerator il, object data) |
402 | { | 404 | { |
403 | if (data.GetType() == typeof(UInt16)) | 405 | if (data.GetType() == typeof (UInt16)) |
404 | { | 406 | { |
405 | il.Emit(OpCodes.Ldc_I4, (UInt16)data); | 407 | il.Emit(OpCodes.Ldc_I4, (UInt16) data); |
406 | il.Emit(OpCodes.Box, data.GetType()); | 408 | il.Emit(OpCodes.Box, data.GetType()); |
407 | } | 409 | } |
408 | if (data.GetType() == typeof(UInt32)) | 410 | if (data.GetType() == typeof (UInt32)) |
409 | { | 411 | { |
410 | il.Emit(OpCodes.Ldc_I4, (UInt32)data); | 412 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); |
411 | il.Emit(OpCodes.Box, data.GetType()); | 413 | il.Emit(OpCodes.Box, data.GetType()); |
412 | } | 414 | } |
413 | if (data.GetType() == typeof(Int32)) | 415 | if (data.GetType() == typeof (Int32)) |
414 | { | 416 | { |
415 | il.Emit(OpCodes.Ldc_I4, (Int32)data); | 417 | il.Emit(OpCodes.Ldc_I4, (Int32) data); |
416 | il.Emit(OpCodes.Box, data.GetType()); | 418 | il.Emit(OpCodes.Box, data.GetType()); |
417 | } | 419 | } |
418 | if (data.GetType() == typeof(float)) | 420 | if (data.GetType() == typeof (float)) |
419 | { | 421 | { |
420 | il.Emit(OpCodes.Ldc_I4, (float)data); | 422 | il.Emit(OpCodes.Ldc_I4, (float) data); |
421 | il.Emit(OpCodes.Box, data.GetType()); | 423 | il.Emit(OpCodes.Box, data.GetType()); |
422 | } | 424 | } |
423 | if (data.GetType() == typeof(string)) | 425 | if (data.GetType() == typeof (string)) |
424 | il.Emit(OpCodes.Ldstr, (string)data); | 426 | il.Emit(OpCodes.Ldstr, (string) data); |
425 | //if (data.GetType() == typeof(LSO_Enums.Rotation)) | 427 | //if (data.GetType() == typeof(LSO_Enums.Rotation)) |
426 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); | 428 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); |
427 | //if (data.GetType() == typeof(LSO_Enums.Vector)) | 429 | //if (data.GetType() == typeof(LSO_Enums.Vector)) |
428 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); | 430 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); |
429 | //if (data.GetType() == typeof(LSO_Enums.Key)) | 431 | //if (data.GetType() == typeof(LSO_Enums.Key)) |
430 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); | 432 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); |
431 | |||
432 | } | 433 | } |
433 | |||
434 | |||
435 | } | 434 | } |
436 | } | 435 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs index 30ce314..a7e3018 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
@@ -47,6 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
47 | String = 51, | 45 | String = 51, |
48 | UInt32 = 17 | 46 | UInt32 = 17 |
49 | } | 47 | } |
48 | |||
50 | [Serializable] | 49 | [Serializable] |
51 | public enum OpCode_Cast_TypeDefs | 50 | public enum OpCode_Cast_TypeDefs |
52 | { | 51 | { |
@@ -66,6 +65,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
66 | public UInt32 Y; | 65 | public UInt32 Y; |
67 | public UInt32 X; | 66 | public UInt32 X; |
68 | } | 67 | } |
68 | |||
69 | [Serializable] | 69 | [Serializable] |
70 | public struct Rotation | 70 | public struct Rotation |
71 | { | 71 | { |
@@ -74,6 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
74 | public UInt32 Y; | 74 | public UInt32 Y; |
75 | public UInt32 X; | 75 | public UInt32 X; |
76 | } | 76 | } |
77 | |||
77 | [Serializable] | 78 | [Serializable] |
78 | public enum Variable_Type_Codes | 79 | public enum Variable_Type_Codes |
79 | { | 80 | { |
@@ -87,6 +88,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
87 | List = 7, | 88 | List = 7, |
88 | Null = 8 | 89 | Null = 8 |
89 | } | 90 | } |
91 | |||
90 | [Serializable] | 92 | [Serializable] |
91 | public enum Event_Mask_Values | 93 | public enum Event_Mask_Values |
92 | { | 94 | { |
@@ -124,6 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
124 | remote_data = 31, | 126 | remote_data = 31, |
125 | http_response = 32 | 127 | http_response = 32 |
126 | } | 128 | } |
129 | |||
127 | [Serializable] | 130 | [Serializable] |
128 | public enum Operation_Table | 131 | public enum Operation_Table |
129 | { | 132 | { |
@@ -220,6 +223,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
220 | SHL = 0xe0, | 223 | SHL = 0xe0, |
221 | SHR = 0xe1 | 224 | SHR = 0xe1 |
222 | } | 225 | } |
226 | |||
223 | [Serializable] | 227 | [Serializable] |
224 | public enum BuiltIn_Functions | 228 | public enum BuiltIn_Functions |
225 | { | 229 | { |
@@ -552,6 +556,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
552 | llGetParcelMaxPrims = 326, | 556 | llGetParcelMaxPrims = 326, |
553 | llGetParcelDetails = 327 | 557 | llGetParcelDetails = 327 |
554 | } | 558 | } |
555 | |||
556 | } | 559 | } |
557 | } | 560 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs index ba97375..a0b4977f 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs | |||
@@ -27,15 +27,16 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Reflection.Emit; | 34 | using System.Reflection.Emit; |
35 | using System.Text; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
37 | { | 38 | { |
38 | partial class LSO_Parser | 39 | internal partial class LSO_Parser |
39 | { | 40 | { |
40 | private string FileName; | 41 | private string FileName; |
41 | private FileStream fs; | 42 | private FileStream fs; |
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
45 | //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); | 46 | //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); |
46 | 47 | ||
47 | private TypeBuilder typeBuilder; | 48 | private TypeBuilder typeBuilder; |
48 | private System.Collections.Generic.List<string> EventList = new System.Collections.Generic.List<string>(); | 49 | private List<string> EventList = new List<string>(); |
49 | 50 | ||
50 | public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) | 51 | public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) |
51 | { | 52 | { |
@@ -59,11 +60,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
59 | Common.SendToDebug("Opening filename: " + FileName); | 60 | Common.SendToDebug("Opening filename: " + FileName); |
60 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); | 61 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); |
61 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); | 62 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); |
62 | |||
63 | } | 63 | } |
64 | |||
64 | internal void CloseFile() | 65 | internal void CloseFile() |
65 | { | 66 | { |
66 | |||
67 | // Close | 67 | // Close |
68 | br.Close(); | 68 | br.Close(); |
69 | fs.Close(); | 69 | fs.Close(); |
@@ -75,9 +75,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
75 | /// </summary> | 75 | /// </summary> |
76 | public void Parse() | 76 | public void Parse() |
77 | { | 77 | { |
78 | |||
79 | |||
80 | |||
81 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. | 78 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. |
82 | 79 | ||
83 | 80 | ||
@@ -148,14 +145,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
148 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 145 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
149 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 146 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
150 | myStaticBlock.ObjectType = br_read(1)[0]; | 147 | myStaticBlock.ObjectType = br_read(1)[0]; |
151 | Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); | 148 | Common.SendToDebug("Static Block ObjectType: " + |
149 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); | ||
152 | myStaticBlock.Unknown = br_read(1)[0]; | 150 | myStaticBlock.Unknown = br_read(1)[0]; |
153 | // Size of datatype varies -- what about strings? | 151 | // Size of datatype varies -- what about strings? |
154 | if (myStaticBlock.ObjectType != 0) | 152 | if (myStaticBlock.ObjectType != 0) |
155 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); | 153 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); |
156 | 154 | ||
157 | StaticBlocks.Add((UInt32)startReadPos, myStaticBlock); | 155 | StaticBlocks.Add((UInt32) startReadPos, myStaticBlock); |
158 | |||
159 | } | 156 | } |
160 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); | 157 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); |
161 | 158 | ||
@@ -183,7 +180,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
183 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) | 180 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) |
184 | // Note! Absolute position | 181 | // Note! Absolute position |
185 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; | 182 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; |
186 | Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); | 183 | Common.SendToDebug("Fuction " + i + " code chunk position: " + |
184 | myFunctionBlock.CodeChunkPointer[i]); | ||
187 | } | 185 | } |
188 | } | 186 | } |
189 | } | 187 | } |
@@ -204,14 +202,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
204 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); | 202 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); |
205 | // Position is relative to state frame | 203 | // Position is relative to state frame |
206 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); | 204 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); |
207 | myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); | 205 | myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8)); |
208 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); | 206 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); |
209 | Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); | 207 | Common.SendToDebug("Total potential EventMask bits: " + |
208 | myStateFrameBlock.StatePointer[i].EventMask.Count); | ||
210 | 209 | ||
211 | //// Read STATE BLOCK | 210 | //// Read STATE BLOCK |
212 | //long CurPos = fs.Position; | 211 | //long CurPos = fs.Position; |
213 | //fs.Seek(CurPos, SeekOrigin.Begin); | 212 | //fs.Seek(CurPos, SeekOrigin.Begin); |
214 | |||
215 | } | 213 | } |
216 | } | 214 | } |
217 | 215 | ||
@@ -224,19 +222,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
224 | // Go through all State Frame Pointers found | 222 | // Go through all State Frame Pointers found |
225 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 223 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
226 | { | 224 | { |
227 | |||
228 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); | 225 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); |
229 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); | 226 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); |
230 | 227 | ||
231 | // READ: STATE BLOCK HEADER | 228 | // READ: STATE BLOCK HEADER |
232 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); | 229 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); |
233 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note | 230 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note |
234 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 231 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
235 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; | 232 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; |
236 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note | 233 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note |
237 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); | 234 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); |
238 | Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); | 235 | Common.SendToDebug("State block Header Size: " + |
239 | Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | 236 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); |
237 | Common.SendToDebug("State block Header End Pos: " + | ||
238 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | ||
240 | 239 | ||
241 | // We need to count number of bits flagged in EventMask? | 240 | // We need to count number of bits flagged in EventMask? |
242 | 241 | ||
@@ -245,27 +244,36 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
245 | 244 | ||
246 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE | 245 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE |
247 | //TODO: Create event hooks | 246 | //TODO: Create event hooks |
248 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; | 247 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = |
248 | new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; | ||
249 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 249 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
250 | { | 250 | { |
251 | |||
252 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) | 251 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) |
253 | { | 252 | { |
254 | // We got an event | 253 | // We got an event |
255 | // READ: STATE BLOCK HANDLER | 254 | // READ: STATE BLOCK HANDLER |
256 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); | 255 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + |
257 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); | 256 | " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " + |
258 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); | 257 | fs.Position); |
259 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); | 258 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = |
260 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize); | 259 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos + |
260 | BitConverter.ToUInt32(br_read(4), 0); | ||
261 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = | ||
262 | BitConverter.ToUInt32(br_read(4), 0); | ||
263 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + | ||
264 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " + | ||
265 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. | ||
266 | CodeChunkPointer); | ||
267 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + | ||
268 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " + | ||
269 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. | ||
270 | CallFrameSize); | ||
261 | } | 271 | } |
262 | } | 272 | } |
263 | } | 273 | } |
264 | } | 274 | } |
265 | 275 | ||
266 | 276 | ||
267 | |||
268 | |||
269 | //// READ FUNCTION CODE CHUNKS | 277 | //// READ FUNCTION CODE CHUNKS |
270 | //// Functions + Function start pos (GFR) | 278 | //// Functions + Function start pos (GFR) |
271 | //// TODO: Somehow be able to identify and reference this | 279 | //// TODO: Somehow be able to identify and reference this |
@@ -291,37 +299,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
291 | // two level search ain't no good | 299 | // two level search ain't no good |
292 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 300 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
293 | { | 301 | { |
294 | |||
295 | |||
296 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) | 302 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) |
297 | { | 303 | { |
298 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); | 304 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + |
305 | (LSO_Enums.Event_Mask_Values) ii); | ||
299 | 306 | ||
300 | 307 | ||
301 | // Override a Method / Function | 308 | // Override a Method / Function |
302 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii; | 309 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii; |
303 | Common.SendToDebug("Event Name: " + eventname); | 310 | Common.SendToDebug("Event Name: " + eventname); |
304 | if (Common.IL_ProcessCodeChunks) | 311 | if (Common.IL_ProcessCodeChunks) |
305 | { | 312 | { |
306 | EventList.Add(eventname); | 313 | EventList.Add(eventname); |
307 | 314 | ||
308 | // JUMP TO CODE PROCESSOR | 315 | // JUMP TO CODE PROCESSOR |
309 | ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname); | 316 | ProcessCodeChunk( |
317 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, | ||
318 | typeBuilder, eventname); | ||
310 | } | 319 | } |
311 | } | 320 | } |
312 | |||
313 | } | 321 | } |
314 | |||
315 | } | 322 | } |
316 | |||
317 | } | 323 | } |
318 | 324 | ||
319 | 325 | ||
320 | |||
321 | |||
322 | if (Common.IL_CreateFunctionList) | 326 | if (Common.IL_CreateFunctionList) |
323 | IL_INSERT_FUNCTIONLIST(); | 327 | IL_INSERT_FUNCTIONLIST(); |
324 | |||
325 | } | 328 | } |
326 | 329 | ||
327 | internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) | 330 | internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) |
@@ -342,11 +345,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
342 | 345 | ||
343 | 346 | ||
344 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); | 347 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); |
345 | Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); | 348 | Common.SendToDebug("Heap Block ObjectType: " + |
349 | ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString()); | ||
346 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); | 350 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); |
347 | 351 | ||
348 | return myHeapBlock; | 352 | return myHeapBlock; |
349 | } | 353 | } |
354 | |||
350 | private byte[] br_read(int len) | 355 | private byte[] br_read(int len) |
351 | { | 356 | { |
352 | if (len <= 0) | 357 | if (len <= 0) |
@@ -365,6 +370,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
365 | throw (e); | 370 | throw (e); |
366 | } | 371 | } |
367 | } | 372 | } |
373 | |||
368 | //private byte[] br_read_smallendian(int len) | 374 | //private byte[] br_read_smallendian(int len) |
369 | //{ | 375 | //{ |
370 | // byte[] bytes = new byte[len]; | 376 | // byte[] bytes = new byte[len]; |
@@ -373,29 +379,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
373 | //} | 379 | //} |
374 | private Type getLLObjectType(byte objectCode) | 380 | private Type getLLObjectType(byte objectCode) |
375 | { | 381 | { |
376 | switch ((LSO_Enums.Variable_Type_Codes)objectCode) | 382 | switch ((LSO_Enums.Variable_Type_Codes) objectCode) |
377 | { | 383 | { |
378 | case LSO_Enums.Variable_Type_Codes.Void: return typeof(void); | 384 | case LSO_Enums.Variable_Type_Codes.Void: |
379 | case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32); | 385 | return typeof (void); |
380 | case LSO_Enums.Variable_Type_Codes.Float: return typeof(float); | 386 | case LSO_Enums.Variable_Type_Codes.Integer: |
381 | case LSO_Enums.Variable_Type_Codes.String: return typeof(string); | 387 | return typeof (UInt32); |
382 | case LSO_Enums.Variable_Type_Codes.Key: return typeof(string); | 388 | case LSO_Enums.Variable_Type_Codes.Float: |
383 | case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector); | 389 | return typeof (float); |
384 | case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation); | 390 | case LSO_Enums.Variable_Type_Codes.String: |
391 | return typeof (string); | ||
392 | case LSO_Enums.Variable_Type_Codes.Key: | ||
393 | return typeof (string); | ||
394 | case LSO_Enums.Variable_Type_Codes.Vector: | ||
395 | return typeof (LSO_Enums.Vector); | ||
396 | case LSO_Enums.Variable_Type_Codes.Rotation: | ||
397 | return typeof (LSO_Enums.Rotation); | ||
385 | case LSO_Enums.Variable_Type_Codes.List: | 398 | case LSO_Enums.Variable_Type_Codes.List: |
386 | Common.SendToDebug("TODO: List datatype not implemented yet!"); | 399 | Common.SendToDebug("TODO: List datatype not implemented yet!"); |
387 | return typeof(System.Collections.ArrayList); | 400 | return typeof (ArrayList); |
388 | case LSO_Enums.Variable_Type_Codes.Null: | 401 | case LSO_Enums.Variable_Type_Codes.Null: |
389 | Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); | 402 | Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); |
390 | return typeof(string); | 403 | return typeof (string); |
391 | default: | 404 | default: |
392 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); | 405 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + |
393 | return typeof(object); | 406 | " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); |
407 | return typeof (object); | ||
394 | } | 408 | } |
395 | } | 409 | } |
410 | |||
396 | private int getObjectSize(byte ObjectType) | 411 | private int getObjectSize(byte ObjectType) |
397 | { | 412 | { |
398 | switch ((LSO_Enums.Variable_Type_Codes)ObjectType) | 413 | switch ((LSO_Enums.Variable_Type_Codes) ObjectType) |
399 | { | 414 | { |
400 | case LSO_Enums.Variable_Type_Codes.Integer: | 415 | case LSO_Enums.Variable_Type_Codes.Integer: |
401 | case LSO_Enums.Variable_Type_Codes.Float: | 416 | case LSO_Enums.Variable_Type_Codes.Float: |
@@ -411,13 +426,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
411 | return 0; | 426 | return 0; |
412 | } | 427 | } |
413 | } | 428 | } |
429 | |||
414 | private string Read_String() | 430 | private string Read_String() |
415 | { | 431 | { |
416 | string ret = ""; | 432 | string ret = ""; |
417 | byte reader = br_read(1)[0]; | 433 | byte reader = br_read(1)[0]; |
418 | while (reader != 0x000) | 434 | while (reader != 0x000) |
419 | { | 435 | { |
420 | ret += (char)reader; | 436 | ret += (char) reader; |
421 | reader = br_read(1)[0]; | 437 | reader = br_read(1)[0]; |
422 | } | 438 | } |
423 | return ret; | 439 | return ret; |
@@ -431,7 +447,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
431 | /// <param name="eventname">Name of event (function) to generate</param> | 447 | /// <param name="eventname">Name of event (function) to generate</param> |
432 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) | 448 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) |
433 | { | 449 | { |
434 | |||
435 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); | 450 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); |
436 | 451 | ||
437 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); | 452 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); |
@@ -442,12 +457,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
442 | myCodeChunk.Comment = Read_String(); | 457 | myCodeChunk.Comment = Read_String(); |
443 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); | 458 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); |
444 | myCodeChunk.ReturnTypePos = br_read(1)[0]; | 459 | myCodeChunk.ReturnTypePos = br_read(1)[0]; |
445 | myCodeChunk.ReturnType = GetStaticBlock((long)myCodeChunk.ReturnTypePos + (long)myHeader.GVR); | 460 | myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR); |
446 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + ((LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType.ObjectType).ToString()); | 461 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + |
462 | ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString()); | ||
447 | 463 | ||
448 | 464 | ||
449 | // TODO: How to determine number of codechunks -- does this method work? | 465 | // TODO: How to determine number of codechunks -- does this method work? |
450 | myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); | 466 | myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>(); |
451 | byte reader = br_read(1)[0]; | 467 | byte reader = br_read(1)[0]; |
452 | reader = br_read(1)[0]; | 468 | reader = br_read(1)[0]; |
453 | 469 | ||
@@ -464,14 +480,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
464 | CCA.NullString = reader; | 480 | CCA.NullString = reader; |
465 | CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); | 481 | CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); |
466 | myCodeChunk.CodeChunkArguments.Add(CCA); | 482 | myCodeChunk.CodeChunkArguments.Add(CCA); |
467 | Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + ": " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType.ObjectType); | 483 | Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + |
484 | ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType); | ||
468 | } | 485 | } |
469 | // Create string array | 486 | // Create string array |
470 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; | 487 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; |
471 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) | 488 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) |
472 | { | 489 | { |
473 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); | 490 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); |
474 | Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).ToString()); | 491 | Common.SendToDebug("Method argument " + _ic + ": " + |
492 | getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType). | ||
493 | ToString()); | ||
475 | } | 494 | } |
476 | // End marker is 0x000 | 495 | // End marker is 0x000 |
477 | myCodeChunk.EndMarker = reader; | 496 | myCodeChunk.EndMarker = reader; |
@@ -483,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
483 | 502 | ||
484 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); | 503 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); |
485 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 504 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
486 | MethodAttributes.Public, | 505 | MethodAttributes.Public, |
487 | typeof(void), | 506 | typeof (void), |
488 | new Type[] { typeof(object) }); | 507 | new Type[] {typeof (object)}); |
489 | //MethodArgs); | 508 | //MethodArgs); |
490 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), | 509 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), |
491 | // new Type[] { typeof(object) }, //); | 510 | // new Type[] { typeof(object) }, //); |
@@ -504,7 +523,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
504 | IL_INSERT_TRY(il, eventname); | 523 | IL_INSERT_TRY(il, eventname); |
505 | 524 | ||
506 | 525 | ||
507 | |||
508 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | 526 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); |
509 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 527 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
510 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod | 528 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod |
@@ -520,7 +538,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
520 | } | 538 | } |
521 | 539 | ||
522 | 540 | ||
523 | |||
524 | // | 541 | // |
525 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL | 542 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL |
526 | // | 543 | // |
@@ -538,12 +555,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
538 | il.Emit(OpCodes.Ret); | 555 | il.Emit(OpCodes.Ret); |
539 | 556 | ||
540 | return; | 557 | return; |
541 | |||
542 | } | 558 | } |
543 | 559 | ||
544 | private void IL_INSERT_FUNCTIONLIST() | 560 | private void IL_INSERT_FUNCTIONLIST() |
545 | { | 561 | { |
546 | |||
547 | Common.SendToDebug("Creating function list"); | 562 | Common.SendToDebug("Creating function list"); |
548 | 563 | ||
549 | 564 | ||
@@ -557,11 +572,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
557 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); | 572 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); |
558 | 573 | ||
559 | 574 | ||
560 | |||
561 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 575 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
562 | MethodAttributes.Public, | 576 | MethodAttributes.Public, |
563 | typeof(string[]), | 577 | typeof (string[]), |
564 | null); | 578 | null); |
565 | 579 | ||
566 | //typeBuilder.DefineMethodOverride(methodBuilder, | 580 | //typeBuilder.DefineMethodOverride(methodBuilder, |
567 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | 581 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); |
@@ -569,8 +583,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
569 | ILGenerator il = methodBuilder.GetILGenerator(); | 583 | ILGenerator il = methodBuilder.GetILGenerator(); |
570 | 584 | ||
571 | 585 | ||
572 | |||
573 | |||
574 | // IL_INSERT_TRY(il, eventname); | 586 | // IL_INSERT_TRY(il, eventname); |
575 | 587 | ||
576 | // // Push string to stack | 588 | // // Push string to stack |
@@ -586,37 +598,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
586 | 598 | ||
587 | ////il.Emit(OpCodes.Ldarg_0); | 599 | ////il.Emit(OpCodes.Ldarg_0); |
588 | 600 | ||
589 | il.DeclareLocal(typeof(string[])); | 601 | il.DeclareLocal(typeof (string[])); |
590 | 602 | ||
591 | ////il.Emit(OpCodes.Ldarg_0); | 603 | ////il.Emit(OpCodes.Ldarg_0); |
592 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length | 604 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length |
593 | il.Emit(OpCodes.Newarr, typeof(String)); // create new string array | 605 | il.Emit(OpCodes.Newarr, typeof (String)); // create new string array |
594 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack | 606 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack |
595 | ////SetFunctionList | 607 | ////SetFunctionList |
596 | 608 | ||
597 | for (int lv = 0; lv < EventList.Count; lv++) | 609 | for (int lv = 0; lv < EventList.Count; lv++) |
598 | { | 610 | { |
599 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | 611 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack |
600 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position | 612 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position |
601 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | 613 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value |
602 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value | 614 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value |
603 | 615 | ||
604 | //il.Emit(OpCodes.Ldarg_0); | 616 | //il.Emit(OpCodes.Ldarg_0); |
605 | //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | 617 | //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value |
606 | //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); | 618 | //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); |
607 | |||
608 | } | 619 | } |
609 | 620 | ||
610 | 621 | ||
611 | |||
612 | // IL_INSERT_END_TRY(il, eventname); | 622 | // IL_INSERT_END_TRY(il, eventname); |
613 | 623 | ||
614 | 624 | ||
615 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | 625 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack |
616 | // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); | 626 | // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); |
617 | 627 | ||
618 | il.Emit(OpCodes.Ret); // Return | 628 | il.Emit(OpCodes.Ret); // Return |
619 | |||
620 | } | 629 | } |
621 | 630 | ||
622 | 631 | ||
@@ -631,7 +640,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
631 | // Push "Hello World!" string to stack | 640 | // Push "Hello World!" string to stack |
632 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 641 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
633 | //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); | 642 | //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); |
634 | |||
635 | } | 643 | } |
636 | 644 | ||
637 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) | 645 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) |
@@ -640,7 +648,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
640 | * CATCH | 648 | * CATCH |
641 | */ | 649 | */ |
642 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); | 650 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); |
643 | il.BeginCatchBlock(typeof(Exception)); | 651 | il.BeginCatchBlock(typeof (Exception)); |
644 | 652 | ||
645 | // Push "Hello World!" string to stack | 653 | // Push "Hello World!" string to stack |
646 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 654 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
@@ -648,18 +656,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
648 | 656 | ||
649 | //call void [mscorlib]System.Console::WriteLine(string) | 657 | //call void [mscorlib]System.Console::WriteLine(string) |
650 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 658 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
651 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 659 | il.Emit(OpCodes.Call, typeof (Console).GetMethod |
652 | ("Write", new Type[] { typeof(string) })); | 660 | ("Write", new Type[] {typeof (string)})); |
653 | 661 | ||
654 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 662 | //callvirt instance string [mscorlib]System.Exception::get_Message() |
655 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); | 663 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); |
656 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod | 664 | il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod |
657 | ("get_Message")); | 665 | ("get_Message")); |
658 | 666 | ||
659 | //call void [mscorlib]System.Console::WriteLine(string) | 667 | //call void [mscorlib]System.Console::WriteLine(string) |
660 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 668 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
661 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 669 | il.Emit(OpCodes.Call, typeof (Console).GetMethod |
662 | ("WriteLine", new Type[] { typeof(string) })); | 670 | ("WriteLine", new Type[] {typeof (string)})); |
663 | 671 | ||
664 | /* | 672 | /* |
665 | * CLR END TRY | 673 | * CLR END TRY |
@@ -673,7 +681,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
673 | long FirstPos = fs.Position; | 681 | long FirstPos = fs.Position; |
674 | try | 682 | try |
675 | { | 683 | { |
676 | UInt32 position = (UInt32)pos; | 684 | UInt32 position = (UInt32) pos; |
677 | // STATIC BLOCK | 685 | // STATIC BLOCK |
678 | Common.SendToDebug("Reading STATIC BLOCK at: " + position); | 686 | Common.SendToDebug("Reading STATIC BLOCK at: " + position); |
679 | fs.Seek(position, SeekOrigin.Begin); | 687 | fs.Seek(position, SeekOrigin.Begin); |
@@ -683,7 +691,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
683 | Common.SendToDebug("Found cached STATIC BLOCK"); | 691 | Common.SendToDebug("Found cached STATIC BLOCK"); |
684 | 692 | ||
685 | 693 | ||
686 | |||
687 | return StaticBlocks[pos]; | 694 | return StaticBlocks[pos]; |
688 | } | 695 | } |
689 | 696 | ||
@@ -699,7 +706,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
699 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 706 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
700 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 707 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
701 | myStaticBlock.ObjectType = br_read(1)[0]; | 708 | myStaticBlock.ObjectType = br_read(1)[0]; |
702 | Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); | 709 | Common.SendToDebug("Static Block ObjectType: " + |
710 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); | ||
703 | myStaticBlock.Unknown = br_read(1)[0]; | 711 | myStaticBlock.Unknown = br_read(1)[0]; |
704 | // Size of datatype varies | 712 | // Size of datatype varies |
705 | if (myStaticBlock.ObjectType != 0) | 713 | if (myStaticBlock.ObjectType != 0) |
@@ -715,8 +723,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
715 | // Go back to original read pos | 723 | // Go back to original read pos |
716 | fs.Seek(FirstPos, SeekOrigin.Begin); | 724 | fs.Seek(FirstPos, SeekOrigin.Begin); |
717 | } | 725 | } |
718 | |||
719 | } | 726 | } |
720 | |||
721 | } | 727 | } |
722 | } | 728 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs index baeda38..cf64638 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs | |||
@@ -28,14 +28,13 @@ | |||
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections; | ||
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
32 | using System.Text; | ||
33 | 33 | ||
34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | 34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO |
35 | { | 35 | { |
36 | static class LSO_Struct | 36 | internal static class LSO_Struct |
37 | { | 37 | { |
38 | |||
39 | public struct Header | 38 | public struct Header |
40 | { | 39 | { |
41 | public UInt32 TM; | 40 | public UInt32 TM; |
@@ -69,6 +68,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
69 | public byte Unknown; | 68 | public byte Unknown; |
70 | public byte[] BlockVariable; | 69 | public byte[] BlockVariable; |
71 | } | 70 | } |
71 | |||
72 | /* Not actually a structure | 72 | /* Not actually a structure |
73 | public struct StaticBlockVariable | 73 | public struct StaticBlockVariable |
74 | { | 74 | { |
@@ -80,6 +80,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
80 | public byte[] Rotation_16; | 80 | public byte[] Rotation_16; |
81 | public UInt32 Pointer_List_Structure; | 81 | public UInt32 Pointer_List_Structure; |
82 | } */ | 82 | } */ |
83 | |||
83 | public struct HeapBlock | 84 | public struct HeapBlock |
84 | { | 85 | { |
85 | public Int32 DataBlockSize; | 86 | public Int32 DataBlockSize; |
@@ -87,17 +88,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
87 | public UInt16 ReferenceCount; | 88 | public UInt16 ReferenceCount; |
88 | public byte[] Data; | 89 | public byte[] Data; |
89 | } | 90 | } |
91 | |||
90 | public struct StateFrameBlock | 92 | public struct StateFrameBlock |
91 | { | 93 | { |
92 | public UInt32 StateCount; | 94 | public UInt32 StateCount; |
93 | public StatePointerBlock[] StatePointer; | 95 | public StatePointerBlock[] StatePointer; |
94 | } | 96 | } |
97 | |||
95 | public struct StatePointerBlock | 98 | public struct StatePointerBlock |
96 | { | 99 | { |
97 | public UInt32 Location; | 100 | public UInt32 Location; |
98 | public System.Collections.BitArray EventMask; | 101 | public BitArray EventMask; |
99 | public StateBlock StateBlock; | 102 | public StateBlock StateBlock; |
100 | } | 103 | } |
104 | |||
101 | public struct StateBlock | 105 | public struct StateBlock |
102 | { | 106 | { |
103 | public UInt32 StartPos; | 107 | public UInt32 StartPos; |
@@ -106,25 +110,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
106 | public byte Unknown; | 110 | public byte Unknown; |
107 | public StateBlockHandler[] StateBlockHandlers; | 111 | public StateBlockHandler[] StateBlockHandlers; |
108 | } | 112 | } |
113 | |||
109 | public struct StateBlockHandler | 114 | public struct StateBlockHandler |
110 | { | 115 | { |
111 | public UInt32 CodeChunkPointer; | 116 | public UInt32 CodeChunkPointer; |
112 | public UInt32 CallFrameSize; | 117 | public UInt32 CallFrameSize; |
113 | } | 118 | } |
119 | |||
114 | public struct FunctionBlock | 120 | public struct FunctionBlock |
115 | { | 121 | { |
116 | public UInt32 FunctionCount; | 122 | public UInt32 FunctionCount; |
117 | public UInt32[] CodeChunkPointer; | 123 | public UInt32[] CodeChunkPointer; |
118 | } | 124 | } |
125 | |||
119 | public struct CodeChunk | 126 | public struct CodeChunk |
120 | { | 127 | { |
121 | public UInt32 CodeChunkHeaderSize; | 128 | public UInt32 CodeChunkHeaderSize; |
122 | public string Comment; | 129 | public string Comment; |
123 | public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; | 130 | public List<CodeChunkArgument> CodeChunkArguments; |
124 | public byte EndMarker; | 131 | public byte EndMarker; |
125 | public byte ReturnTypePos; | 132 | public byte ReturnTypePos; |
126 | public StaticBlock ReturnType; | 133 | public StaticBlock ReturnType; |
127 | } | 134 | } |
135 | |||
128 | public struct CodeChunkArgument | 136 | public struct CodeChunkArgument |
129 | { | 137 | { |
130 | public byte FunctionReturnTypePos; | 138 | public byte FunctionReturnTypePos; |
@@ -132,4 +140,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO | |||
132 | public StaticBlock FunctionReturnType; | 140 | public StaticBlock FunctionReturnType; |
133 | } | 141 | } |
134 | } | 142 | } |
135 | } | 143 | } \ No newline at end of file |
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 b94cf90..737dee6 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 | |||
@@ -26,19 +26,18 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Axiom.Math; | ||
30 | using System; | 29 | using System; |
31 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Runtime.Remoting.Lifetime; | ||
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | ||
34 | using Axiom.Math; | ||
33 | using libsecondlife; | 35 | using libsecondlife; |
34 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 38 | using OpenSim.Region.Environment.Scenes; |
38 | using OpenSim.Region.ScriptEngine.Common; | 39 | using OpenSim.Region.ScriptEngine.Common; |
39 | using OpenSim.Framework.Console; | 40 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
40 | using OpenSim.Framework; | ||
41 | using System.Runtime.Remoting.Lifetime; | ||
42 | 41 | ||
43 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | 42 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler |
44 | { | 43 | { |
@@ -53,8 +52,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
53 | /// </summary> | 52 | /// </summary> |
54 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface | 53 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface |
55 | { | 54 | { |
56 | 55 | private ASCIIEncoding enc = new ASCIIEncoding(); | |
57 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
58 | private ScriptEngine m_ScriptEngine; | 56 | private ScriptEngine m_ScriptEngine; |
59 | private SceneObjectPart m_host; | 57 | private SceneObjectPart m_host; |
60 | private uint m_localID; | 58 | private uint m_localID; |
@@ -86,7 +84,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
86 | { | 84 | { |
87 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); | 85 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); |
88 | // return null; | 86 | // return null; |
89 | ILease lease = (ILease)base.InitializeLifetimeService(); | 87 | ILease lease = (ILease) base.InitializeLifetimeService(); |
90 | 88 | ||
91 | if (lease.CurrentState == LeaseState.Initial) | 89 | if (lease.CurrentState == LeaseState.Initial) |
92 | { | 90 | { |
@@ -105,79 +103,130 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
105 | 103 | ||
106 | //These are the implementations of the various ll-functions used by the LSL scripts. | 104 | //These are the implementations of the various ll-functions used by the LSL scripts. |
107 | //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 | 105 | //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 |
108 | public double llSin(double f) { return (double)Math.Sin(f); } | 106 | public double llSin(double f) |
109 | public double llCos(double f) { return (double)Math.Cos(f); } | 107 | { |
110 | public double llTan(double f) { return (double)Math.Tan(f); } | 108 | return (double) Math.Sin(f); |
111 | public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } | 109 | } |
112 | public double llSqrt(double f) { return (double)Math.Sqrt(f); } | 110 | |
113 | public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } | 111 | public double llCos(double f) |
114 | public int llAbs(int i) { return (int)Math.Abs(i); } | 112 | { |
115 | public double llFabs(double f) { return (double)Math.Abs(f); } | 113 | return (double) Math.Cos(f); |
114 | } | ||
115 | |||
116 | public double llTan(double f) | ||
117 | { | ||
118 | return (double) Math.Tan(f); | ||
119 | } | ||
120 | |||
121 | public double llAtan2(double x, double y) | ||
122 | { | ||
123 | return (double) Math.Atan2(y, x); | ||
124 | } | ||
125 | |||
126 | public double llSqrt(double f) | ||
127 | { | ||
128 | return (double) Math.Sqrt(f); | ||
129 | } | ||
130 | |||
131 | public double llPow(double fbase, double fexponent) | ||
132 | { | ||
133 | return (double) Math.Pow(fbase, fexponent); | ||
134 | } | ||
135 | |||
136 | public int llAbs(int i) | ||
137 | { | ||
138 | return (int) Math.Abs(i); | ||
139 | } | ||
140 | |||
141 | public double llFabs(double f) | ||
142 | { | ||
143 | return (double) Math.Abs(f); | ||
144 | } | ||
116 | 145 | ||
117 | public double llFrand(double mag) | 146 | public double llFrand(double mag) |
118 | { | 147 | { |
119 | lock (Util.RandomClass) | 148 | lock (Util.RandomClass) |
120 | { | 149 | { |
121 | return Util.RandomClass.Next((int)mag); | 150 | return Util.RandomClass.Next((int) mag); |
122 | } | 151 | } |
123 | } | 152 | } |
124 | 153 | ||
125 | public int llFloor(double f) { return (int)Math.Floor(f); } | 154 | public int llFloor(double f) |
126 | public int llCeil(double f) { return (int)Math.Ceiling(f); } | 155 | { |
127 | public int llRound(double f) { return (int)Math.Round(f, 3); } | 156 | return (int) Math.Floor(f); |
157 | } | ||
158 | |||
159 | public int llCeil(double f) | ||
160 | { | ||
161 | return (int) Math.Ceiling(f); | ||
162 | } | ||
163 | |||
164 | public int llRound(double f) | ||
165 | { | ||
166 | return (int) Math.Round(f, 3); | ||
167 | } | ||
128 | 168 | ||
129 | //This next group are vector operations involving squaring and square root. ckrinke | 169 | //This next group are vector operations involving squaring and square root. ckrinke |
130 | public double llVecMag(LSL_Types.Vector3 v) | 170 | public double llVecMag(LSL_Types.Vector3 v) |
131 | { | 171 | { |
132 | return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); | 172 | return (v.X*v.X + v.Y*v.Y + v.Z*v.Z); |
133 | } | 173 | } |
134 | 174 | ||
135 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) | 175 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) |
136 | { | 176 | { |
137 | double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; | 177 | double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z; |
138 | LSL_Types.Vector3 nor = new LSL_Types.Vector3(); | 178 | LSL_Types.Vector3 nor = new LSL_Types.Vector3(); |
139 | nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; | 179 | nor.X = v.X/mag; |
180 | nor.Y = v.Y/mag; | ||
181 | nor.Z = v.Z/mag; | ||
140 | return nor; | 182 | return nor; |
141 | } | 183 | } |
142 | 184 | ||
143 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) | 185 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) |
144 | { | 186 | { |
145 | double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; | 187 | double dx = a.X - b.X; |
146 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); | 188 | double dy = a.Y - b.Y; |
189 | double dz = a.Z - b.Z; | ||
190 | return Math.Sqrt(dx*dx + dy*dy + dz*dz); | ||
147 | } | 191 | } |
148 | 192 | ||
149 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke | 193 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke |
150 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) | 194 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) |
151 | { | 195 | { |
152 | //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke | 196 | //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke |
153 | LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); | 197 | LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R); |
154 | double m = (t.X + t.Y + t.Z + t.R); | 198 | double m = (t.X + t.Y + t.Z + t.R); |
155 | if (m == 0) return new LSL_Types.Vector3(); | 199 | if (m == 0) return new LSL_Types.Vector3(); |
156 | double n = 2 * (r.Y * r.R + r.X * r.Z); | 200 | double n = 2*(r.Y*r.R + r.X*r.Z); |
157 | double p = m * m - n * n; | 201 | double p = m*m - n*n; |
158 | if (p > 0) | 202 | if (p > 0) |
159 | 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)), | 203 | 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)), |
160 | 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))); | 204 | Math.Atan2(n, Math.Sqrt(p)), |
205 | Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R))); | ||
161 | else if (n > 0) | 206 | else if (n > 0) |
162 | 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)); | 207 | 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)); |
163 | else | 208 | else |
164 | 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)); | 209 | 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)); |
165 | } | 210 | } |
166 | 211 | ||
167 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) | 212 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) |
168 | { | 213 | { |
169 | //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 | 214 | //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 |
170 | float err = 0.00001f; | 215 | float err = 0.00001f; |
171 | double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); | 216 | double ax = Math.Sin(v.X/2); |
172 | double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); | 217 | double aw = Math.Cos(v.X/2); |
173 | double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); | 218 | double by = Math.Sin(v.Y/2); |
219 | double bw = Math.Cos(v.Y/2); | ||
220 | double cz = Math.Sin(v.Z/2); | ||
221 | double cw = Math.Cos(v.Z/2); | ||
174 | LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); | 222 | LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); |
175 | LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); | 223 | LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); |
176 | LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); | 224 | LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); |
177 | LSL_Types.Quaternion a = new LSL_Types.Quaternion(); | 225 | LSL_Types.Quaternion a = new LSL_Types.Quaternion(); |
178 | //This multiplication doesnt compile, yet. a = a1 * a2 * a3; | 226 | //This multiplication doesnt compile, yet. a = a1 * a2 * a3; |
179 | LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, | 227 | LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz, |
180 | aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); | 228 | aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw, |
229 | aw*bw*cw - ax*by*cz); | ||
181 | LSL_Types.Quaternion c = new LSL_Types.Quaternion(); | 230 | LSL_Types.Quaternion c = new LSL_Types.Quaternion(); |
182 | //This addition doesnt compile yet c = a + b; | 231 | //This addition doesnt compile yet c = a + b; |
183 | LSL_Types.Quaternion d = new LSL_Types.Quaternion(); | 232 | LSL_Types.Quaternion d = new LSL_Types.Quaternion(); |
@@ -194,11 +243,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
194 | return new LSL_Types.Quaternion(); | 243 | return new LSL_Types.Quaternion(); |
195 | } | 244 | } |
196 | 245 | ||
197 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } | 246 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) |
198 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | 247 | { |
199 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | 248 | return new LSL_Types.Quaternion(); |
200 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } | 249 | } |
201 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } | 250 | |
251 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) | ||
252 | { | ||
253 | return new LSL_Types.Vector3(); | ||
254 | } | ||
255 | |||
256 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) | ||
257 | { | ||
258 | return new LSL_Types.Vector3(); | ||
259 | } | ||
260 | |||
261 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) | ||
262 | { | ||
263 | return new LSL_Types.Vector3(); | ||
264 | } | ||
265 | |||
266 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) | ||
267 | { | ||
268 | return new LSL_Types.Quaternion(); | ||
269 | } | ||
202 | 270 | ||
203 | public void llWhisper(int channelID, string text) | 271 | public void llWhisper(int channelID, string text) |
204 | { | 272 | { |
@@ -214,7 +282,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
214 | { | 282 | { |
215 | //type for say is 1 | 283 | //type for say is 1 |
216 | World.SimChat(Helpers.StringToField(text), | 284 | World.SimChat(Helpers.StringToField(text), |
217 | 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 285 | 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
218 | 286 | ||
219 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 287 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
220 | wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text); | 288 | wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text); |
@@ -230,82 +298,217 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
230 | wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text); | 298 | wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text); |
231 | } | 299 | } |
232 | 300 | ||
233 | public int llListen(int channelID, string name, string ID, string msg) { | 301 | public int llListen(int channelID, string name, string ID, string msg) |
234 | 302 | { | |
235 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 303 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
236 | return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg); | 304 | return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg); |
237 | |||
238 | } | 305 | } |
239 | 306 | ||
240 | public void llListenControl(int number, int active) { | 307 | public void llListenControl(int number, int active) |
241 | 308 | { | |
242 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 309 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
243 | wComm.ListenControl(number, active); | 310 | wComm.ListenControl(number, active); |
244 | |||
245 | } | 311 | } |
246 | 312 | ||
247 | public void llListenRemove(int number) { | 313 | public void llListenRemove(int number) |
248 | 314 | { | |
249 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 315 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
250 | wComm.ListenRemove(number); | 316 | wComm.ListenRemove(number); |
251 | 317 | } | |
252 | } | 318 | |
253 | 319 | public void llSensor(string name, string id, int type, double range, double arc) | |
254 | public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } | 320 | { |
255 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } | 321 | NotImplemented("llSensor"); |
256 | public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } | 322 | return; |
257 | public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } | 323 | } |
258 | public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } | 324 | |
259 | public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } | 325 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) |
260 | public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } | 326 | { |
261 | public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } | 327 | NotImplemented("llSensorRepeat"); |
262 | public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } | 328 | return; |
263 | public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } | 329 | } |
264 | public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } | 330 | |
265 | public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } | 331 | public void llSensorRemove() |
266 | public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } | 332 | { |
267 | public void llDie() { NotImplemented("llDie"); return; } | 333 | NotImplemented("llSensorRemove"); |
268 | public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } | 334 | return; |
269 | public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } | 335 | } |
270 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } | 336 | |
271 | public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } | 337 | public string llDetectedName(int number) |
272 | public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } | 338 | { |
339 | NotImplemented("llDetectedName"); | ||
340 | return ""; | ||
341 | } | ||
342 | |||
343 | public string llDetectedKey(int number) | ||
344 | { | ||
345 | NotImplemented("llDetectedKey"); | ||
346 | return ""; | ||
347 | } | ||
348 | |||
349 | public string llDetectedOwner(int number) | ||
350 | { | ||
351 | NotImplemented("llDetectedOwner"); | ||
352 | return ""; | ||
353 | } | ||
354 | |||
355 | public int llDetectedType(int number) | ||
356 | { | ||
357 | NotImplemented("llDetectedType"); | ||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | public LSL_Types.Vector3 llDetectedPos(int number) | ||
362 | { | ||
363 | NotImplemented("llDetectedPos"); | ||
364 | return new LSL_Types.Vector3(); | ||
365 | } | ||
366 | |||
367 | public LSL_Types.Vector3 llDetectedVel(int number) | ||
368 | { | ||
369 | NotImplemented("llDetectedVel"); | ||
370 | return new LSL_Types.Vector3(); | ||
371 | } | ||
372 | |||
373 | public LSL_Types.Vector3 llDetectedGrab(int number) | ||
374 | { | ||
375 | NotImplemented("llDetectedGrab"); | ||
376 | return new LSL_Types.Vector3(); | ||
377 | } | ||
378 | |||
379 | public LSL_Types.Quaternion llDetectedRot(int number) | ||
380 | { | ||
381 | NotImplemented("llDetectedRot"); | ||
382 | return new LSL_Types.Quaternion(); | ||
383 | } | ||
384 | |||
385 | public int llDetectedGroup(int number) | ||
386 | { | ||
387 | NotImplemented("llDetectedGroup"); | ||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | public int llDetectedLinkNumber(int number) | ||
392 | { | ||
393 | NotImplemented("llDetectedLinkNumber"); | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | public void llDie() | ||
398 | { | ||
399 | NotImplemented("llDie"); | ||
400 | return; | ||
401 | } | ||
402 | |||
403 | public double llGround(LSL_Types.Vector3 offset) | ||
404 | { | ||
405 | NotImplemented("llGround"); | ||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | public double llCloud(LSL_Types.Vector3 offset) | ||
410 | { | ||
411 | NotImplemented("llCloud"); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) | ||
416 | { | ||
417 | NotImplemented("llWind"); | ||
418 | return new LSL_Types.Vector3(); | ||
419 | } | ||
420 | |||
421 | public void llSetStatus(int status, int value) | ||
422 | { | ||
423 | NotImplemented("llSetStatus"); | ||
424 | return; | ||
425 | } | ||
426 | |||
427 | public int llGetStatus(int status) | ||
428 | { | ||
429 | NotImplemented("llGetStatus"); | ||
430 | return 0; | ||
431 | } | ||
273 | 432 | ||
274 | public void llSetScale(LSL_Types.Vector3 scale) | 433 | public void llSetScale(LSL_Types.Vector3 scale) |
275 | { | 434 | { |
276 | // TODO: this needs to trigger a persistance save as well | 435 | // TODO: this needs to trigger a persistance save as well |
277 | LLVector3 tmp = m_host.Scale; | 436 | LLVector3 tmp = m_host.Scale; |
278 | tmp.X = (float)scale.X; | 437 | tmp.X = (float) scale.X; |
279 | tmp.Y = (float)scale.Y; | 438 | tmp.Y = (float) scale.Y; |
280 | tmp.Z = (float)scale.Z; | 439 | tmp.Z = (float) scale.Z; |
281 | m_host.Scale = tmp; | 440 | m_host.Scale = tmp; |
282 | return; | 441 | return; |
283 | } | 442 | } |
443 | |||
284 | public LSL_Types.Vector3 llGetScale() | 444 | public LSL_Types.Vector3 llGetScale() |
285 | { | 445 | { |
286 | return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); | 446 | return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); |
287 | } | 447 | } |
288 | 448 | ||
289 | public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } | 449 | public void llSetColor(LSL_Types.Vector3 color, int face) |
290 | public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } | 450 | { |
291 | public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } | 451 | NotImplemented("llSetColor"); |
292 | public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } | 452 | return; |
293 | public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } | 453 | } |
294 | public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } | 454 | |
295 | public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } | 455 | public double llGetAlpha(int face) |
296 | public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } | 456 | { |
457 | NotImplemented("llGetAlpha"); | ||
458 | return 0; | ||
459 | } | ||
460 | |||
461 | public void llSetAlpha(double alpha, int face) | ||
462 | { | ||
463 | NotImplemented("llSetAlpha"); | ||
464 | return; | ||
465 | } | ||
466 | |||
467 | public LSL_Types.Vector3 llGetColor(int face) | ||
468 | { | ||
469 | NotImplemented("llGetColor"); | ||
470 | return new LSL_Types.Vector3(); | ||
471 | } | ||
472 | |||
473 | public void llSetTexture(string texture, int face) | ||
474 | { | ||
475 | NotImplemented("llSetTexture"); | ||
476 | return; | ||
477 | } | ||
478 | |||
479 | public void llScaleTexture(double u, double v, int face) | ||
480 | { | ||
481 | NotImplemented("llScaleTexture"); | ||
482 | return; | ||
483 | } | ||
484 | |||
485 | public void llOffsetTexture(double u, double v, int face) | ||
486 | { | ||
487 | NotImplemented("llOffsetTexture"); | ||
488 | return; | ||
489 | } | ||
297 | 490 | ||
298 | public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } | 491 | public void llRotateTexture(double rotation, int face) |
492 | { | ||
493 | NotImplemented("llRotateTexture"); | ||
494 | return; | ||
495 | } | ||
496 | |||
497 | public string llGetTexture(int face) | ||
498 | { | ||
499 | NotImplemented("llGetTexture"); | ||
500 | return ""; | ||
501 | } | ||
299 | 502 | ||
300 | public void llSetPos(LSL_Types.Vector3 pos) | 503 | public void llSetPos(LSL_Types.Vector3 pos) |
301 | { | 504 | { |
302 | if (m_host.ParentID != 0) | 505 | if (m_host.ParentID != 0) |
303 | { | 506 | { |
304 | m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 507 | m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); |
305 | } | 508 | } |
306 | else | 509 | else |
307 | { | 510 | { |
308 | m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 511 | m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); |
309 | } | 512 | } |
310 | } | 513 | } |
311 | 514 | ||
@@ -331,51 +534,183 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
331 | m_host.AbsolutePosition.Z); | 534 | m_host.AbsolutePosition.Z); |
332 | } | 535 | } |
333 | } | 536 | } |
537 | |||
334 | public void llSetRot(LSL_Types.Quaternion rot) | 538 | public void llSetRot(LSL_Types.Quaternion rot) |
335 | { | 539 | { |
336 | m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); | 540 | m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R)); |
337 | } | 541 | } |
542 | |||
338 | public LSL_Types.Quaternion llGetRot() | 543 | public LSL_Types.Quaternion llGetRot() |
339 | { | 544 | { |
340 | LLQuaternion q = m_host.RotationOffset; | 545 | LLQuaternion q = m_host.RotationOffset; |
341 | return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | 546 | return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); |
342 | } | 547 | } |
343 | public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } | 548 | |
344 | public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } | 549 | public LSL_Types.Quaternion llGetLocalRot() |
345 | public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } | 550 | { |
346 | public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } | 551 | NotImplemented("llGetLocalRot"); |
347 | public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } | 552 | return new LSL_Types.Quaternion(); |
348 | public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } | 553 | } |
349 | public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } | 554 | |
350 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } | 555 | public void llSetForce(LSL_Types.Vector3 force, int local) |
351 | public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } | 556 | { |
352 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } | 557 | NotImplemented("llSetForce"); |
353 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } | 558 | } |
354 | public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } | 559 | |
355 | public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } | 560 | public LSL_Types.Vector3 llGetForce() |
356 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } | 561 | { |
357 | public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } | 562 | NotImplemented("llGetForce"); |
358 | public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } | 563 | return new LSL_Types.Vector3(); |
359 | public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } | 564 | } |
360 | public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } | 565 | |
566 | public int llTarget(LSL_Types.Vector3 position, double range) | ||
567 | { | ||
568 | NotImplemented("llTarget"); | ||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | public void llTargetRemove(int number) | ||
573 | { | ||
574 | NotImplemented("llTargetRemove"); | ||
575 | } | ||
576 | |||
577 | public int llRotTarget(LSL_Types.Quaternion rot, double error) | ||
578 | { | ||
579 | NotImplemented("llRotTarget"); | ||
580 | return 0; | ||
581 | } | ||
582 | |||
583 | public void llRotTargetRemove(int number) | ||
584 | { | ||
585 | NotImplemented("llRotTargetRemove"); | ||
586 | } | ||
587 | |||
588 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) | ||
589 | { | ||
590 | NotImplemented("llMoveToTarget"); | ||
591 | } | ||
592 | |||
593 | public void llStopMoveToTarget() | ||
594 | { | ||
595 | NotImplemented("llStopMoveToTarget"); | ||
596 | } | ||
597 | |||
598 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) | ||
599 | { | ||
600 | NotImplemented("llApplyImpulse"); | ||
601 | } | ||
602 | |||
603 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) | ||
604 | { | ||
605 | NotImplemented("llApplyRotationalImpulse"); | ||
606 | } | ||
607 | |||
608 | public void llSetTorque(LSL_Types.Vector3 torque, int local) | ||
609 | { | ||
610 | NotImplemented("llSetTorque"); | ||
611 | } | ||
612 | |||
613 | public LSL_Types.Vector3 llGetTorque() | ||
614 | { | ||
615 | NotImplemented("llGetTorque"); | ||
616 | return new LSL_Types.Vector3(); | ||
617 | } | ||
618 | |||
619 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) | ||
620 | { | ||
621 | NotImplemented("llSetForceAndTorque"); | ||
622 | } | ||
623 | |||
624 | public LSL_Types.Vector3 llGetVel() | ||
625 | { | ||
626 | NotImplemented("llGetVel"); | ||
627 | return new LSL_Types.Vector3(); | ||
628 | } | ||
629 | |||
630 | public LSL_Types.Vector3 llGetAccel() | ||
631 | { | ||
632 | NotImplemented("llGetAccel"); | ||
633 | return new LSL_Types.Vector3(); | ||
634 | } | ||
635 | |||
636 | public LSL_Types.Vector3 llGetOmega() | ||
637 | { | ||
638 | NotImplemented("llGetOmega"); | ||
639 | return new LSL_Types.Vector3(); | ||
640 | } | ||
641 | |||
642 | public double llGetTimeOfDay() | ||
643 | { | ||
644 | NotImplemented("llGetTimeOfDay"); | ||
645 | return 0; | ||
646 | } | ||
361 | 647 | ||
362 | public double llGetWallclock() | 648 | public double llGetWallclock() |
363 | { | 649 | { |
364 | return DateTime.Now.TimeOfDay.TotalSeconds; | 650 | return DateTime.Now.TimeOfDay.TotalSeconds; |
365 | } | 651 | } |
366 | 652 | ||
367 | public double llGetTime() { NotImplemented("llGetTime"); return 0; } | 653 | public double llGetTime() |
368 | public void llResetTime() { NotImplemented("llResetTime"); } | 654 | { |
369 | public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } | 655 | NotImplemented("llGetTime"); |
370 | public void llSound() { NotImplemented("llSound"); } | 656 | return 0; |
371 | public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } | 657 | } |
372 | public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } | 658 | |
373 | public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } | 659 | public void llResetTime() |
374 | public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } | 660 | { |
375 | public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } | 661 | NotImplemented("llResetTime"); |
376 | public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } | 662 | } |
377 | public void llStopSound() { NotImplemented("llStopSound"); } | 663 | |
378 | public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } | 664 | public double llGetAndResetTime() |
665 | { | ||
666 | NotImplemented("llGetAndResetTime"); | ||
667 | return 0; | ||
668 | } | ||
669 | |||
670 | public void llSound() | ||
671 | { | ||
672 | NotImplemented("llSound"); | ||
673 | } | ||
674 | |||
675 | public void llPlaySound(string sound, double volume) | ||
676 | { | ||
677 | NotImplemented("llPlaySound"); | ||
678 | } | ||
679 | |||
680 | public void llLoopSound(string sound, double volume) | ||
681 | { | ||
682 | NotImplemented("llLoopSound"); | ||
683 | } | ||
684 | |||
685 | public void llLoopSoundMaster(string sound, double volume) | ||
686 | { | ||
687 | NotImplemented("llLoopSoundMaster"); | ||
688 | } | ||
689 | |||
690 | public void llLoopSoundSlave(string sound, double volume) | ||
691 | { | ||
692 | NotImplemented("llLoopSoundSlave"); | ||
693 | } | ||
694 | |||
695 | public void llPlaySoundSlave(string sound, double volume) | ||
696 | { | ||
697 | NotImplemented("llPlaySoundSlave"); | ||
698 | } | ||
699 | |||
700 | public void llTriggerSound(string sound, double volume) | ||
701 | { | ||
702 | NotImplemented("llTriggerSound"); | ||
703 | } | ||
704 | |||
705 | public void llStopSound() | ||
706 | { | ||
707 | NotImplemented("llStopSound"); | ||
708 | } | ||
709 | |||
710 | public void llPreloadSound(string sound) | ||
711 | { | ||
712 | NotImplemented("llPreloadSound"); | ||
713 | } | ||
379 | 714 | ||
380 | public string llGetSubString(string src, int start, int end) | 715 | public string llGetSubString(string src, int start, int end) |
381 | { | 716 | { |
@@ -386,10 +721,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
386 | { | 721 | { |
387 | return src.Remove(start, end - start); | 722 | return src.Remove(start, end - start); |
388 | } | 723 | } |
724 | |||
389 | public string llInsertString(string dst, int position, string src) | 725 | public string llInsertString(string dst, int position, string src) |
390 | { | 726 | { |
391 | return dst.Insert(position, src); | 727 | return dst.Insert(position, src); |
392 | } | 728 | } |
729 | |||
393 | public string llToUpper(string src) | 730 | public string llToUpper(string src) |
394 | { | 731 | { |
395 | return src.ToUpper(); | 732 | return src.ToUpper(); |
@@ -400,14 +737,46 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
400 | return src.ToLower(); | 737 | return src.ToLower(); |
401 | } | 738 | } |
402 | 739 | ||
403 | public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } | 740 | public int llGiveMoney(string destination, int amount) |
404 | public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } | 741 | { |
405 | public void llMakeFountain() { NotImplemented("llMakeFountain"); } | 742 | NotImplemented("llGiveMoney"); |
406 | public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } | 743 | return 0; |
407 | public void llMakeFire() { NotImplemented("llMakeFire"); } | 744 | } |
408 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } | 745 | |
409 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } | 746 | public void llMakeExplosion() |
410 | public void llStopLookAt() { NotImplemented("llStopLookAt"); } | 747 | { |
748 | NotImplemented("llMakeExplosion"); | ||
749 | } | ||
750 | |||
751 | public void llMakeFountain() | ||
752 | { | ||
753 | NotImplemented("llMakeFountain"); | ||
754 | } | ||
755 | |||
756 | public void llMakeSmoke() | ||
757 | { | ||
758 | NotImplemented("llMakeSmoke"); | ||
759 | } | ||
760 | |||
761 | public void llMakeFire() | ||
762 | { | ||
763 | NotImplemented("llMakeFire"); | ||
764 | } | ||
765 | |||
766 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) | ||
767 | { | ||
768 | NotImplemented("llRezObject"); | ||
769 | } | ||
770 | |||
771 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) | ||
772 | { | ||
773 | NotImplemented("llLookAt"); | ||
774 | } | ||
775 | |||
776 | public void llStopLookAt() | ||
777 | { | ||
778 | NotImplemented("llStopLookAt"); | ||
779 | } | ||
411 | 780 | ||
412 | public void llSetTimerEvent(double sec) | 781 | public void llSetTimerEvent(double sec) |
413 | { | 782 | { |
@@ -417,38 +786,104 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
417 | 786 | ||
418 | public void llSleep(double sec) | 787 | public void llSleep(double sec) |
419 | { | 788 | { |
420 | System.Threading.Thread.Sleep((int)(sec * 1000)); | 789 | Thread.Sleep((int) (sec*1000)); |
790 | } | ||
791 | |||
792 | public double llGetMass() | ||
793 | { | ||
794 | NotImplemented("llGetMass"); | ||
795 | return 0; | ||
796 | } | ||
797 | |||
798 | public void llCollisionFilter(string name, string id, int accept) | ||
799 | { | ||
800 | NotImplemented("llCollisionFilter"); | ||
801 | } | ||
802 | |||
803 | public void llTakeControls(int controls, int accept, int pass_on) | ||
804 | { | ||
805 | NotImplemented("llTakeControls"); | ||
806 | } | ||
807 | |||
808 | public void llReleaseControls() | ||
809 | { | ||
810 | NotImplemented("llReleaseControls"); | ||
811 | } | ||
812 | |||
813 | public void llAttachToAvatar(int attachment) | ||
814 | { | ||
815 | NotImplemented("llAttachToAvatar"); | ||
816 | } | ||
817 | |||
818 | public void llDetachFromAvatar() | ||
819 | { | ||
820 | NotImplemented("llDetachFromAvatar"); | ||
821 | } | ||
822 | |||
823 | public void llTakeCamera() | ||
824 | { | ||
825 | NotImplemented("llTakeCamera"); | ||
421 | } | 826 | } |
422 | 827 | ||
423 | public double llGetMass() { NotImplemented("llGetMass"); return 0; } | 828 | public void llReleaseCamera() |
424 | public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } | 829 | { |
425 | public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } | 830 | NotImplemented("llReleaseCamera"); |
426 | public void llReleaseControls() { NotImplemented("llReleaseControls"); } | 831 | } |
427 | public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } | ||
428 | public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } | ||
429 | public void llTakeCamera() { NotImplemented("llTakeCamera"); } | ||
430 | public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } | ||
431 | 832 | ||
432 | public string llGetOwner() | 833 | public string llGetOwner() |
433 | { | 834 | { |
434 | return m_host.ObjectOwner.ToStringHyphenated(); | 835 | return m_host.ObjectOwner.ToStringHyphenated(); |
435 | } | 836 | } |
436 | 837 | ||
437 | public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } | 838 | public void llInstantMessage(string user, string message) |
438 | public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } | 839 | { |
439 | public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } | 840 | NotImplemented("llInstantMessage"); |
841 | } | ||
842 | |||
843 | public void llEmail(string address, string subject, string message) | ||
844 | { | ||
845 | NotImplemented("llEmail"); | ||
846 | } | ||
847 | |||
848 | public void llGetNextEmail(string address, string subject) | ||
849 | { | ||
850 | NotImplemented("llGetNextEmail"); | ||
851 | } | ||
440 | 852 | ||
441 | public string llGetKey() | 853 | public string llGetKey() |
442 | { | 854 | { |
443 | return m_host.UUID.ToStringHyphenated(); | 855 | return m_host.UUID.ToStringHyphenated(); |
444 | } | 856 | } |
445 | 857 | ||
446 | public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } | 858 | public void llSetBuoyancy(double buoyancy) |
447 | public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } | 859 | { |
448 | public void llStopHover() { NotImplemented("llStopHover"); } | 860 | NotImplemented("llSetBuoyancy"); |
449 | public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } | 861 | } |
450 | public void llSoundPreload() { NotImplemented("llSoundPreload"); } | 862 | |
451 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } | 863 | public void llSetHoverHeight(double height, int water, double tau) |
864 | { | ||
865 | NotImplemented("llSetHoverHeight"); | ||
866 | } | ||
867 | |||
868 | public void llStopHover() | ||
869 | { | ||
870 | NotImplemented("llStopHover"); | ||
871 | } | ||
872 | |||
873 | public void llMinEventDelay(double delay) | ||
874 | { | ||
875 | NotImplemented("llMinEventDelay"); | ||
876 | } | ||
877 | |||
878 | public void llSoundPreload() | ||
879 | { | ||
880 | NotImplemented("llSoundPreload"); | ||
881 | } | ||
882 | |||
883 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) | ||
884 | { | ||
885 | NotImplemented("llRotLookAt"); | ||
886 | } | ||
452 | 887 | ||
453 | public int llStringLength(string str) | 888 | public int llStringLength(string str) |
454 | { | 889 | { |
@@ -462,88 +897,289 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
462 | } | 897 | } |
463 | } | 898 | } |
464 | 899 | ||
465 | public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } | 900 | public void llStartAnimation(string anim) |
466 | public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } | 901 | { |
467 | public void llPointAt() { NotImplemented("llPointAt"); } | 902 | NotImplemented("llStartAnimation"); |
468 | public void llStopPointAt() { NotImplemented("llStopPointAt"); } | 903 | } |
469 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } | 904 | |
470 | public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } | 905 | public void llStopAnimation(string anim) |
471 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } | 906 | { |
472 | public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } | 907 | NotImplemented("llStopAnimation"); |
473 | public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } | 908 | } |
474 | public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } | 909 | |
475 | public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } | 910 | public void llPointAt() |
476 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } | 911 | { |
477 | public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } | 912 | NotImplemented("llPointAt"); |
478 | public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } | 913 | } |
479 | public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } | 914 | |
480 | public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } | 915 | public void llStopPointAt() |
481 | public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } | 916 | { |
482 | public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } | 917 | NotImplemented("llStopPointAt"); |
483 | public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } | 918 | } |
484 | public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } | 919 | |
485 | public double llGetEnergy() { return 1.0f; } | 920 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) |
486 | public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } | 921 | { |
487 | public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } | 922 | NotImplemented("llTargetOmega"); |
923 | } | ||
924 | |||
925 | public int llGetStartParameter() | ||
926 | { | ||
927 | NotImplemented("llGetStartParameter"); | ||
928 | return 0; | ||
929 | } | ||
930 | |||
931 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) | ||
932 | { | ||
933 | NotImplemented("llGodLikeRezObject"); | ||
934 | } | ||
935 | |||
936 | public void llRequestPermissions(string agent, int perm) | ||
937 | { | ||
938 | NotImplemented("llRequestPermissions"); | ||
939 | } | ||
940 | |||
941 | public string llGetPermissionsKey() | ||
942 | { | ||
943 | NotImplemented("llGetPermissionsKey"); | ||
944 | return ""; | ||
945 | } | ||
946 | |||
947 | public int llGetPermissions() | ||
948 | { | ||
949 | NotImplemented("llGetPermissions"); | ||
950 | return 0; | ||
951 | } | ||
952 | |||
953 | public int llGetLinkNumber() | ||
954 | { | ||
955 | NotImplemented("llGetLinkNumber"); | ||
956 | return 0; | ||
957 | } | ||
958 | |||
959 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) | ||
960 | { | ||
961 | NotImplemented("llSetLinkColor"); | ||
962 | } | ||
963 | |||
964 | public void llCreateLink(string target, int parent) | ||
965 | { | ||
966 | NotImplemented("llCreateLink"); | ||
967 | } | ||
968 | |||
969 | public void llBreakLink(int linknum) | ||
970 | { | ||
971 | NotImplemented("llBreakLink"); | ||
972 | } | ||
973 | |||
974 | public void llBreakAllLinks() | ||
975 | { | ||
976 | NotImplemented("llBreakAllLinks"); | ||
977 | } | ||
978 | |||
979 | public string llGetLinkKey(int linknum) | ||
980 | { | ||
981 | NotImplemented("llGetLinkKey"); | ||
982 | return ""; | ||
983 | } | ||
984 | |||
985 | public void llGetLinkName(int linknum) | ||
986 | { | ||
987 | NotImplemented("llGetLinkName"); | ||
988 | } | ||
989 | |||
990 | public int llGetInventoryNumber(int type) | ||
991 | { | ||
992 | NotImplemented("llGetInventoryNumber"); | ||
993 | return 0; | ||
994 | } | ||
995 | |||
996 | public string llGetInventoryName(int type, int number) | ||
997 | { | ||
998 | NotImplemented("llGetInventoryName"); | ||
999 | return ""; | ||
1000 | } | ||
1001 | |||
1002 | public void llSetScriptState(string name, int run) | ||
1003 | { | ||
1004 | NotImplemented("llSetScriptState"); | ||
1005 | } | ||
1006 | |||
1007 | public double llGetEnergy() | ||
1008 | { | ||
1009 | return 1.0f; | ||
1010 | } | ||
1011 | |||
1012 | public void llGiveInventory(string destination, string inventory) | ||
1013 | { | ||
1014 | NotImplemented("llGiveInventory"); | ||
1015 | } | ||
1016 | |||
1017 | public void llRemoveInventory(string item) | ||
1018 | { | ||
1019 | NotImplemented("llRemoveInventory"); | ||
1020 | } | ||
488 | 1021 | ||
489 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) | 1022 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) |
490 | { | 1023 | { |
491 | Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); | 1024 | Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z); |
492 | m_host.SetText(text, av3, alpha); | 1025 | m_host.SetText(text, av3, alpha); |
493 | } | 1026 | } |
494 | 1027 | ||
495 | 1028 | ||
496 | public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } | 1029 | public double llWater(LSL_Types.Vector3 offset) |
497 | public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } | 1030 | { |
498 | public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } | 1031 | NotImplemented("llWater"); |
499 | public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } | 1032 | return 0; |
500 | public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } | 1033 | } |
501 | public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } | 1034 | |
502 | public void llModifyLand(int action, int brush) { } | 1035 | public void llPassTouches(int pass) |
503 | public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } | 1036 | { |
504 | public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } | 1037 | NotImplemented("llPassTouches"); |
505 | public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } | 1038 | } |
506 | public void llResetScript() | 1039 | |
1040 | public string llRequestAgentData(string id, int data) | ||
1041 | { | ||
1042 | NotImplemented("llRequestAgentData"); | ||
1043 | return ""; | ||
1044 | } | ||
1045 | |||
1046 | public string llRequestInventoryData(string name) | ||
1047 | { | ||
1048 | NotImplemented("llRequestInventoryData"); | ||
1049 | return ""; | ||
1050 | } | ||
1051 | |||
1052 | public void llSetDamage(double damage) | ||
1053 | { | ||
1054 | NotImplemented("llSetDamage"); | ||
1055 | } | ||
1056 | |||
1057 | public void llTeleportAgentHome(string agent) | ||
1058 | { | ||
1059 | NotImplemented("llTeleportAgentHome"); | ||
1060 | } | ||
1061 | |||
1062 | public void llModifyLand(int action, int brush) | ||
1063 | { | ||
1064 | } | ||
1065 | |||
1066 | public void llCollisionSound(string impact_sound, double impact_volume) | ||
1067 | { | ||
1068 | NotImplemented("llCollisionSound"); | ||
1069 | } | ||
1070 | |||
1071 | public void llCollisionSprite(string impact_sprite) | ||
1072 | { | ||
1073 | NotImplemented("llCollisionSprite"); | ||
1074 | } | ||
1075 | |||
1076 | public string llGetAnimation(string id) | ||
1077 | { | ||
1078 | NotImplemented("llGetAnimation"); | ||
1079 | return ""; | ||
1080 | } | ||
1081 | |||
1082 | public void llResetScript() | ||
507 | { | 1083 | { |
508 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); | 1084 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); |
509 | } | 1085 | } |
510 | public void llMessageLinked(int linknum, int num, string str, string id) { } | ||
511 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } | ||
512 | public void llPassCollisions(int pass) { } | ||
513 | public string llGetScriptName() { return ""; } | ||
514 | 1086 | ||
515 | public int llGetNumberOfSides() { return 0; } | 1087 | public void llMessageLinked(int linknum, int num, string str, string id) |
1088 | { | ||
1089 | } | ||
1090 | |||
1091 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) | ||
1092 | { | ||
1093 | } | ||
1094 | |||
1095 | public void llPassCollisions(int pass) | ||
1096 | { | ||
1097 | } | ||
1098 | |||
1099 | public string llGetScriptName() | ||
1100 | { | ||
1101 | return ""; | ||
1102 | } | ||
1103 | |||
1104 | public int llGetNumberOfSides() | ||
1105 | { | ||
1106 | return 0; | ||
1107 | } | ||
1108 | |||
1109 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) | ||
1110 | { | ||
1111 | return new LSL_Types.Quaternion(); | ||
1112 | } | ||
1113 | |||
1114 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) | ||
1115 | { | ||
1116 | return new LSL_Types.Vector3(); | ||
1117 | } | ||
516 | 1118 | ||
517 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } | 1119 | public void llRot2Angle() |
518 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } | 1120 | { |
519 | public void llRot2Angle() { } | 1121 | } |
520 | 1122 | ||
521 | public double llAcos(double val) | 1123 | public double llAcos(double val) |
522 | { | 1124 | { |
523 | return (double)Math.Acos(val); | 1125 | return (double) Math.Acos(val); |
524 | } | 1126 | } |
525 | 1127 | ||
526 | public double llAsin(double val) | 1128 | public double llAsin(double val) |
527 | { | 1129 | { |
528 | return (double)Math.Asin(val); | 1130 | return (double) Math.Asin(val); |
529 | } | 1131 | } |
530 | 1132 | ||
531 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } | 1133 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) |
532 | public string llGetInventoryKey(string name) { return ""; } | 1134 | { |
533 | public void llAllowInventoryDrop(int add) { } | 1135 | return 0; |
534 | public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } | 1136 | } |
535 | public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } | 1137 | |
536 | public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } | 1138 | public string llGetInventoryKey(string name) |
537 | public double llGetTextureRot(int side) { return 0; } | 1139 | { |
1140 | return ""; | ||
1141 | } | ||
1142 | |||
1143 | public void llAllowInventoryDrop(int add) | ||
1144 | { | ||
1145 | } | ||
1146 | |||
1147 | public LSL_Types.Vector3 llGetSunDirection() | ||
1148 | { | ||
1149 | return new LSL_Types.Vector3(); | ||
1150 | } | ||
1151 | |||
1152 | public LSL_Types.Vector3 llGetTextureOffset(int face) | ||
1153 | { | ||
1154 | return new LSL_Types.Vector3(); | ||
1155 | } | ||
1156 | |||
1157 | public LSL_Types.Vector3 llGetTextureScale(int side) | ||
1158 | { | ||
1159 | return new LSL_Types.Vector3(); | ||
1160 | } | ||
1161 | |||
1162 | public double llGetTextureRot(int side) | ||
1163 | { | ||
1164 | return 0; | ||
1165 | } | ||
538 | 1166 | ||
539 | public int llSubStringIndex(string source, string pattern) | 1167 | public int llSubStringIndex(string source, string pattern) |
540 | { | 1168 | { |
541 | return source.IndexOf(pattern); | 1169 | return source.IndexOf(pattern); |
542 | } | 1170 | } |
543 | 1171 | ||
544 | public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } | 1172 | public string llGetOwnerKey(string id) |
1173 | { | ||
1174 | NotImplemented("llGetOwnerKey"); | ||
1175 | return ""; | ||
1176 | } | ||
545 | 1177 | ||
546 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } | 1178 | public LSL_Types.Vector3 llGetCenterOfMass() |
1179 | { | ||
1180 | NotImplemented("llGetCenterOfMass"); | ||
1181 | return new LSL_Types.Vector3(); | ||
1182 | } | ||
547 | 1183 | ||
548 | public List<string> llListSort(List<string> src, int stride, int ascending) | 1184 | public List<string> llListSort(List<string> src, int stride, int ascending) |
549 | { | 1185 | { |
@@ -577,7 +1213,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
577 | ret.AddRange(ls); | 1213 | ret.AddRange(ls); |
578 | } | 1214 | } |
579 | 1215 | ||
580 | if (ascending == LSL.LSL_BaseClass.TRUE) | 1216 | if (ascending == LSL_BaseClass.TRUE) |
581 | return ret; | 1217 | return ret; |
582 | ret.Reverse(); | 1218 | ret.Reverse(); |
583 | return ret; | 1219 | return ret; |
@@ -616,12 +1252,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
616 | 1252 | ||
617 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) | 1253 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) |
618 | { | 1254 | { |
619 | return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); | 1255 | return |
1256 | new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), | ||
1257 | double.Parse(src[index + 2])); | ||
620 | } | 1258 | } |
1259 | |||
621 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) | 1260 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) |
622 | { | 1261 | { |
623 | return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); | 1262 | return |
1263 | new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), | ||
1264 | double.Parse(src[index + 2]), double.Parse(src[index + 3])); | ||
624 | } | 1265 | } |
1266 | |||
625 | public List<string> llList2List(List<string> src, int start, int end) | 1267 | public List<string> llList2List(List<string> src, int start, int end) |
626 | { | 1268 | { |
627 | if (end > start) | 1269 | if (end > start) |
@@ -638,18 +1280,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
638 | ret.AddRange(src.GetRange(0, end)); | 1280 | ret.AddRange(src.GetRange(0, end)); |
639 | return ret; | 1281 | return ret; |
640 | } | 1282 | } |
641 | |||
642 | |||
643 | |||
644 | |||
645 | } | 1283 | } |
1284 | |||
646 | public List<string> llDeleteSubList(List<string> src, int start, int end) | 1285 | public List<string> llDeleteSubList(List<string> src, int start, int end) |
647 | { | 1286 | { |
648 | List<string> ret = new List<string>(src); | 1287 | List<string> ret = new List<string>(src); |
649 | ret.RemoveRange(start, end - start); | 1288 | ret.RemoveRange(start, end - start); |
650 | return ret; | 1289 | return ret; |
651 | } | 1290 | } |
652 | public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } | 1291 | |
1292 | public int llGetListEntryType(List<string> src, int index) | ||
1293 | { | ||
1294 | NotImplemented("llGetListEntryType"); | ||
1295 | return 0; | ||
1296 | } | ||
1297 | |||
653 | public string llList2CSV(List<string> src) | 1298 | public string llList2CSV(List<string> src) |
654 | { | 1299 | { |
655 | string ret = ""; | 1300 | string ret = ""; |
@@ -661,6 +1306,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
661 | } | 1306 | } |
662 | return ret; | 1307 | return ret; |
663 | } | 1308 | } |
1309 | |||
664 | public List<string> llCSV2List(string src) | 1310 | public List<string> llCSV2List(string src) |
665 | { | 1311 | { |
666 | List<string> ret = new List<string>(); | 1312 | List<string> ret = new List<string>(); |
@@ -670,6 +1316,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
670 | } | 1316 | } |
671 | return ret; | 1317 | return ret; |
672 | } | 1318 | } |
1319 | |||
673 | public List<string> llListRandomize(List<string> src, int stride) | 1320 | public List<string> llListRandomize(List<string> src, int stride) |
674 | { | 1321 | { |
675 | int s = stride; | 1322 | int s = stride; |
@@ -711,9 +1358,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
711 | } | 1358 | } |
712 | 1359 | ||
713 | return ret; | 1360 | return ret; |
714 | |||
715 | |||
716 | } | 1361 | } |
1362 | |||
717 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | 1363 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) |
718 | { | 1364 | { |
719 | List<string> ret = new List<string>(); | 1365 | List<string> ret = new List<string>(); |
@@ -739,12 +1385,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
739 | 1385 | ||
740 | public LSL_Types.Vector3 llGetRegionCorner() | 1386 | public LSL_Types.Vector3 llGetRegionCorner() |
741 | { | 1387 | { |
742 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); | 1388 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0); |
743 | } | 1389 | } |
744 | 1390 | ||
745 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) | 1391 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) |
746 | { | 1392 | { |
747 | |||
748 | List<string> ret = new List<string>(dest); | 1393 | List<string> ret = new List<string>(dest); |
749 | //foreach (string s in src.Reverse()) | 1394 | //foreach (string s in src.Reverse()) |
750 | for (int ci = src.Count - 1; ci > -1; ci--) | 1395 | for (int ci = src.Count - 1; ci > -1; ci--) |
@@ -753,13 +1398,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
753 | } | 1398 | } |
754 | return ret; | 1399 | return ret; |
755 | } | 1400 | } |
1401 | |||
756 | public int llListFindList(List<string> src, List<string> test) | 1402 | public int llListFindList(List<string> src, List<string> test) |
757 | { | 1403 | { |
758 | foreach (string s in test) | 1404 | foreach (string s in test) |
759 | { | 1405 | { |
760 | for (int ci = 0; ci < src.Count; ci++) | 1406 | for (int ci = 0; ci < src.Count; ci++) |
761 | { | 1407 | { |
762 | |||
763 | if (s == src[ci]) | 1408 | if (s == src[ci]) |
764 | return ci; | 1409 | return ci; |
765 | } | 1410 | } |
@@ -784,37 +1429,139 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
784 | return result; | 1429 | return result; |
785 | } | 1430 | } |
786 | 1431 | ||
787 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } | 1432 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) |
788 | public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } | 1433 | { |
789 | public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } | 1434 | NotImplemented("llEdgeOfWorld"); |
790 | public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } | 1435 | return 0; |
791 | public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } | 1436 | } |
792 | public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } | 1437 | |
793 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } | 1438 | public int llGetAgentInfo(string id) |
794 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } | 1439 | { |
795 | public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } | 1440 | NotImplemented("llGetAgentInfo"); |
796 | 1441 | return 0; | |
797 | public void llParseString2List() { NotImplemented("llParseString2List"); } | 1442 | } |
798 | 1443 | ||
799 | public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } | 1444 | public void llAdjustSoundVolume(double volume) |
800 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } | 1445 | { |
801 | public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } | 1446 | NotImplemented("llAdjustSoundVolume"); |
802 | public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } | 1447 | } |
803 | public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } | 1448 | |
804 | public void llUnSit(string id) { NotImplemented("llUnSit"); } | 1449 | public void llSetSoundQueueing(int queue) |
805 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } | 1450 | { |
806 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } | 1451 | NotImplemented("llSetSoundQueueing"); |
807 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } | 1452 | } |
808 | public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } | 1453 | |
809 | public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } | 1454 | public void llSetSoundRadius(double radius) |
1455 | { | ||
1456 | NotImplemented("llSetSoundRadius"); | ||
1457 | } | ||
1458 | |||
1459 | public string llKey2Name(string id) | ||
1460 | { | ||
1461 | NotImplemented("llKey2Name"); | ||
1462 | return ""; | ||
1463 | } | ||
1464 | |||
1465 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
1466 | { | ||
1467 | NotImplemented("llSetTextureAnim"); | ||
1468 | } | ||
1469 | |||
1470 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, | ||
1471 | LSL_Types.Vector3 bottom_south_west) | ||
1472 | { | ||
1473 | NotImplemented("llTriggerSoundLimited"); | ||
1474 | } | ||
1475 | |||
1476 | public void llEjectFromLand(string pest) | ||
1477 | { | ||
1478 | NotImplemented("llEjectFromLand"); | ||
1479 | } | ||
1480 | |||
1481 | public void llParseString2List() | ||
1482 | { | ||
1483 | NotImplemented("llParseString2List"); | ||
1484 | } | ||
1485 | |||
1486 | public int llOverMyLand(string id) | ||
1487 | { | ||
1488 | NotImplemented("llOverMyLand"); | ||
1489 | return 0; | ||
1490 | } | ||
1491 | |||
1492 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) | ||
1493 | { | ||
1494 | NotImplemented("llGetLandOwnerAt"); | ||
1495 | return ""; | ||
1496 | } | ||
1497 | |||
1498 | public string llGetNotecardLine(string name, int line) | ||
1499 | { | ||
1500 | NotImplemented("llGetNotecardLine"); | ||
1501 | return ""; | ||
1502 | } | ||
1503 | |||
1504 | public LSL_Types.Vector3 llGetAgentSize(string id) | ||
1505 | { | ||
1506 | NotImplemented("llGetAgentSize"); | ||
1507 | return new LSL_Types.Vector3(); | ||
1508 | } | ||
1509 | |||
1510 | public int llSameGroup(string agent) | ||
1511 | { | ||
1512 | NotImplemented("llSameGroup"); | ||
1513 | return 0; | ||
1514 | } | ||
1515 | |||
1516 | public void llUnSit(string id) | ||
1517 | { | ||
1518 | NotImplemented("llUnSit"); | ||
1519 | } | ||
1520 | |||
1521 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) | ||
1522 | { | ||
1523 | NotImplemented("llGroundSlope"); | ||
1524 | return new LSL_Types.Vector3(); | ||
1525 | } | ||
1526 | |||
1527 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) | ||
1528 | { | ||
1529 | NotImplemented("llGroundNormal"); | ||
1530 | return new LSL_Types.Vector3(); | ||
1531 | } | ||
1532 | |||
1533 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) | ||
1534 | { | ||
1535 | NotImplemented("llGroundContour"); | ||
1536 | return new LSL_Types.Vector3(); | ||
1537 | } | ||
1538 | |||
1539 | public int llGetAttached() | ||
1540 | { | ||
1541 | NotImplemented("llGetAttached"); | ||
1542 | return 0; | ||
1543 | } | ||
1544 | |||
1545 | public int llGetFreeMemory() | ||
1546 | { | ||
1547 | NotImplemented("llGetFreeMemory"); | ||
1548 | return 0; | ||
1549 | } | ||
810 | 1550 | ||
811 | public string llGetRegionName() | 1551 | public string llGetRegionName() |
812 | { | 1552 | { |
813 | return World.RegionInfo.RegionName; | 1553 | return World.RegionInfo.RegionName; |
814 | } | 1554 | } |
815 | 1555 | ||
816 | public double llGetRegionTimeDilation() { return 1.0f; } | 1556 | public double llGetRegionTimeDilation() |
817 | public double llGetRegionFPS() { return 10.0f; } | 1557 | { |
1558 | return 1.0f; | ||
1559 | } | ||
1560 | |||
1561 | public double llGetRegionFPS() | ||
1562 | { | ||
1563 | return 10.0f; | ||
1564 | } | ||
818 | 1565 | ||
819 | /* particle system rules should be coming into this routine as doubles, that is | 1566 | /* particle system rules should be coming into this routine as doubles, that is |
820 | rule[0] should be an integer from this list and rule[1] should be the arg | 1567 | rule[0] should be an integer from this list and rule[1] should be the arg |
@@ -824,6 +1571,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
824 | We iterate through the list for 'Count' elements, incrementing by two for each | 1571 | We iterate through the list for 'Count' elements, incrementing by two for each |
825 | iteration and set the members of Primitive.ParticleSystem, one at a time. | 1572 | iteration and set the members of Primitive.ParticleSystem, one at a time. |
826 | */ | 1573 | */ |
1574 | |||
827 | public enum PrimitiveRule : int | 1575 | public enum PrimitiveRule : int |
828 | { | 1576 | { |
829 | PSYS_PART_FLAGS = 0, | 1577 | PSYS_PART_FLAGS = 0, |
@@ -854,109 +1602,152 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
854 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | 1602 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); |
855 | for (int i = 0; i < rules.Count; i += 2) | 1603 | for (int i = 0; i < rules.Count; i += 2) |
856 | { | 1604 | { |
857 | switch ((int)rules[i]) | 1605 | switch ((int) rules[i]) |
858 | { | 1606 | { |
859 | case (int)PrimitiveRule.PSYS_PART_FLAGS: | 1607 | case (int) PrimitiveRule.PSYS_PART_FLAGS: |
860 | prules.PartFlags = (uint)rules[i + 1]; | 1608 | prules.PartFlags = (uint) rules[i + 1]; |
861 | break; | 1609 | break; |
862 | 1610 | ||
863 | case (int)PrimitiveRule.PSYS_PART_START_COLOR: | 1611 | case (int) PrimitiveRule.PSYS_PART_START_COLOR: |
864 | prules.PartStartColor = (LLColor)rules[i + 1]; | 1612 | prules.PartStartColor = (LLColor) rules[i + 1]; |
865 | break; | 1613 | break; |
866 | 1614 | ||
867 | case (int)PrimitiveRule.PSYS_PART_START_ALPHA: | 1615 | case (int) PrimitiveRule.PSYS_PART_START_ALPHA: |
868 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1616 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
869 | break; | 1617 | break; |
870 | 1618 | ||
871 | case (int)PrimitiveRule.PSYS_PART_END_COLOR: | 1619 | case (int) PrimitiveRule.PSYS_PART_END_COLOR: |
872 | prules.PartEndColor = (LLColor)rules[i + 1]; | 1620 | prules.PartEndColor = (LLColor) rules[i + 1]; |
873 | break; | 1621 | break; |
874 | 1622 | ||
875 | case (int)PrimitiveRule.PSYS_PART_END_ALPHA: | 1623 | case (int) PrimitiveRule.PSYS_PART_END_ALPHA: |
876 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1624 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
877 | break; | 1625 | break; |
878 | 1626 | ||
879 | case (int)PrimitiveRule.PSYS_PART_START_SCALE: | 1627 | case (int) PrimitiveRule.PSYS_PART_START_SCALE: |
880 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1628 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
881 | break; | 1629 | break; |
882 | 1630 | ||
883 | case (int)PrimitiveRule.PSYS_PART_END_SCALE: | 1631 | case (int) PrimitiveRule.PSYS_PART_END_SCALE: |
884 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1632 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
885 | break; | 1633 | break; |
886 | 1634 | ||
887 | case (int)PrimitiveRule.PSYS_PART_MAX_AGE: | 1635 | case (int) PrimitiveRule.PSYS_PART_MAX_AGE: |
888 | prules.MaxAge = (float)rules[i + 1]; | 1636 | prules.MaxAge = (float) rules[i + 1]; |
889 | break; | 1637 | break; |
890 | 1638 | ||
891 | case (int)PrimitiveRule.PSYS_SRC_ACCEL: | 1639 | case (int) PrimitiveRule.PSYS_SRC_ACCEL: |
892 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1640 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
893 | break; | 1641 | break; |
894 | 1642 | ||
895 | case (int)PrimitiveRule.PSYS_SRC_PATTERN: | 1643 | case (int) PrimitiveRule.PSYS_SRC_PATTERN: |
896 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 1644 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
897 | break; | 1645 | break; |
898 | 1646 | ||
899 | case (int)PrimitiveRule.PSYS_SRC_TEXTURE: | 1647 | case (int) PrimitiveRule.PSYS_SRC_TEXTURE: |
900 | prules.Texture = (LLUUID)rules[i + 1]; | 1648 | prules.Texture = (LLUUID) rules[i + 1]; |
901 | break; | 1649 | break; |
902 | 1650 | ||
903 | case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: | 1651 | case (int) PrimitiveRule.PSYS_SRC_BURST_RATE: |
904 | prules.BurstRate = (float)rules[i + 1]; | 1652 | prules.BurstRate = (float) rules[i + 1]; |
905 | break; | 1653 | break; |
906 | 1654 | ||
907 | case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: | 1655 | case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: |
908 | prules.BurstPartCount = (byte)rules[i + 1]; | 1656 | prules.BurstPartCount = (byte) rules[i + 1]; |
909 | break; | 1657 | break; |
910 | 1658 | ||
911 | case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: | 1659 | case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS: |
912 | prules.BurstRadius = (float)rules[i + 1]; | 1660 | prules.BurstRadius = (float) rules[i + 1]; |
913 | break; | 1661 | break; |
914 | 1662 | ||
915 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: | 1663 | case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: |
916 | prules.BurstSpeedMin = (float)rules[i + 1]; | 1664 | prules.BurstSpeedMin = (float) rules[i + 1]; |
917 | break; | 1665 | break; |
918 | 1666 | ||
919 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: | 1667 | case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: |
920 | prules.BurstSpeedMax = (float)rules[i + 1]; | 1668 | prules.BurstSpeedMax = (float) rules[i + 1]; |
921 | break; | 1669 | break; |
922 | 1670 | ||
923 | case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: | 1671 | case (int) PrimitiveRule.PSYS_SRC_MAX_AGE: |
924 | prules.MaxAge = (float)rules[i + 1]; | 1672 | prules.MaxAge = (float) rules[i + 1]; |
925 | break; | 1673 | break; |
926 | 1674 | ||
927 | case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: | 1675 | case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY: |
928 | prules.Target = (LLUUID)rules[i + 1]; | 1676 | prules.Target = (LLUUID) rules[i + 1]; |
929 | break; | 1677 | break; |
930 | 1678 | ||
931 | case (int)PrimitiveRule.PSYS_SRC_OMEGA: | 1679 | case (int) PrimitiveRule.PSYS_SRC_OMEGA: |
932 | //cast?? prules.MaxAge = (float)rules[i + 1]; | 1680 | //cast?? prules.MaxAge = (float)rules[i + 1]; |
933 | break; | 1681 | break; |
934 | 1682 | ||
935 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: | 1683 | case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: |
936 | prules.InnerAngle = (float)rules[i + 1]; | 1684 | prules.InnerAngle = (float) rules[i + 1]; |
937 | break; | 1685 | break; |
938 | 1686 | ||
939 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: | 1687 | case (int) PrimitiveRule.PSYS_SRC_ANGLE_END: |
940 | prules.OuterAngle = (float)rules[i + 1]; | 1688 | prules.OuterAngle = (float) rules[i + 1]; |
941 | break; | 1689 | break; |
942 | |||
943 | } | 1690 | } |
944 | } | 1691 | } |
945 | 1692 | ||
946 | m_host.AddNewParticleSystem(prules); | 1693 | m_host.AddNewParticleSystem(prules); |
947 | } | 1694 | } |
948 | 1695 | ||
949 | public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } | 1696 | public void llGroundRepel(double height, int water, double tau) |
950 | public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } | 1697 | { |
951 | public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } | 1698 | NotImplemented("llGroundRepel"); |
952 | public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } | 1699 | } |
953 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } | 1700 | |
954 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } | 1701 | public void llGiveInventoryList() |
955 | public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } | 1702 | { |
956 | public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } | 1703 | NotImplemented("llGiveInventoryList"); |
957 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } | 1704 | } |
958 | public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } | 1705 | |
959 | public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } | 1706 | public void llSetVehicleType(int type) |
1707 | { | ||
1708 | NotImplemented("llSetVehicleType"); | ||
1709 | } | ||
1710 | |||
1711 | public void llSetVehicledoubleParam(int param, double value) | ||
1712 | { | ||
1713 | NotImplemented("llSetVehicledoubleParam"); | ||
1714 | } | ||
1715 | |||
1716 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) | ||
1717 | { | ||
1718 | NotImplemented("llSetVehicleVectorParam"); | ||
1719 | } | ||
1720 | |||
1721 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) | ||
1722 | { | ||
1723 | NotImplemented("llSetVehicleRotationParam"); | ||
1724 | } | ||
1725 | |||
1726 | public void llSetVehicleFlags(int flags) | ||
1727 | { | ||
1728 | NotImplemented("llSetVehicleFlags"); | ||
1729 | } | ||
1730 | |||
1731 | public void llRemoveVehicleFlags(int flags) | ||
1732 | { | ||
1733 | NotImplemented("llRemoveVehicleFlags"); | ||
1734 | } | ||
1735 | |||
1736 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) | ||
1737 | { | ||
1738 | NotImplemented("llSitTarget"); | ||
1739 | } | ||
1740 | |||
1741 | public string llAvatarOnSitTarget() | ||
1742 | { | ||
1743 | NotImplemented("llAvatarOnSitTarget"); | ||
1744 | return ""; | ||
1745 | } | ||
1746 | |||
1747 | public void llAddToLandPassList(string avatar, double hours) | ||
1748 | { | ||
1749 | NotImplemented("llAddToLandPassList"); | ||
1750 | } | ||
960 | 1751 | ||
961 | public void llSetTouchText(string text) | 1752 | public void llSetTouchText(string text) |
962 | { | 1753 | { |
@@ -968,49 +1759,91 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
968 | m_host.SitName = text; | 1759 | m_host.SitName = text; |
969 | } | 1760 | } |
970 | 1761 | ||
971 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } | 1762 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) |
972 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } | 1763 | { |
973 | public void llDumpList2String() { NotImplemented("llDumpList2String"); } | 1764 | NotImplemented("llSetCameraEyeOffset"); |
974 | public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } | 1765 | } |
975 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); } | ||
976 | public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); } | ||
977 | public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); } | ||
978 | 1766 | ||
979 | public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } | 1767 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) |
1768 | { | ||
1769 | NotImplemented("llSetCameraAtOffset"); | ||
1770 | } | ||
980 | 1771 | ||
981 | public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } | 1772 | public void llDumpList2String() |
982 | public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } | 1773 | { |
983 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } | 1774 | NotImplemented("llDumpList2String"); |
1775 | } | ||
1776 | |||
1777 | public void llScriptDanger(LSL_Types.Vector3 pos) | ||
1778 | { | ||
1779 | NotImplemented("llScriptDanger"); | ||
1780 | } | ||
1781 | |||
1782 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) | ||
1783 | { | ||
1784 | NotImplemented("llDialog"); | ||
1785 | } | ||
1786 | |||
1787 | public void llVolumeDetect(int detect) | ||
1788 | { | ||
1789 | NotImplemented("llVolumeDetect"); | ||
1790 | } | ||
1791 | |||
1792 | public void llResetOtherScript(string name) | ||
1793 | { | ||
1794 | NotImplemented("llResetOtherScript"); | ||
1795 | } | ||
1796 | |||
1797 | public int llGetScriptState(string name) | ||
1798 | { | ||
1799 | NotImplemented("llGetScriptState"); | ||
1800 | return 0; | ||
1801 | } | ||
1802 | |||
1803 | public void llRemoteLoadScript() | ||
1804 | { | ||
1805 | NotImplemented("llRemoteLoadScript"); | ||
1806 | } | ||
1807 | |||
1808 | public void llSetRemoteScriptAccessPin(int pin) | ||
1809 | { | ||
1810 | NotImplemented("llSetRemoteScriptAccessPin"); | ||
1811 | } | ||
1812 | |||
1813 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) | ||
1814 | { | ||
1815 | NotImplemented("llRemoteLoadScriptPin"); | ||
1816 | } | ||
984 | 1817 | ||
985 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) | 1818 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) |
986 | // Not sure where these constants should live: | 1819 | // Not sure where these constants should live: |
987 | // REMOTE_DATA_CHANNEL = 1 | 1820 | // REMOTE_DATA_CHANNEL = 1 |
988 | // REMOTE_DATA_REQUEST = 2 | 1821 | // REMOTE_DATA_REQUEST = 2 |
989 | // REMOTE_DATA_REPLY = 3 | 1822 | // REMOTE_DATA_REPLY = 3 |
990 | public void llOpenRemoteDataChannel() { | 1823 | public void llOpenRemoteDataChannel() |
991 | 1824 | { | |
992 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 1825 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
993 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); | 1826 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); |
994 | object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" }; | 1827 | object[] resobj = new object[] {1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, ""}; |
995 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); | 1828 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); |
996 | |||
997 | } | 1829 | } |
998 | 1830 | ||
999 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } | 1831 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) |
1832 | { | ||
1833 | NotImplemented("llSendRemoteData"); | ||
1834 | return ""; | ||
1835 | } | ||
1000 | 1836 | ||
1001 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | 1837 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
1002 | { | 1838 | { |
1003 | |||
1004 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 1839 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
1005 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | 1840 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); |
1006 | |||
1007 | } | 1841 | } |
1008 | |||
1009 | public void llCloseRemoteDataChannel(string channel) { | ||
1010 | 1842 | ||
1843 | public void llCloseRemoteDataChannel(string channel) | ||
1844 | { | ||
1011 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 1845 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
1012 | xmlrpcMod.CloseXMLRPCChannel(channel); | 1846 | xmlrpcMod.CloseXMLRPCChannel(channel); |
1013 | |||
1014 | } | 1847 | } |
1015 | 1848 | ||
1016 | public string llMD5String(string src, int nonce) | 1849 | public string llMD5String(string src, int nonce) |
@@ -1018,14 +1851,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1018 | return Util.Md5Hash(src + ":" + nonce.ToString()); | 1851 | return Util.Md5Hash(src + ":" + nonce.ToString()); |
1019 | } | 1852 | } |
1020 | 1853 | ||
1021 | public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } | 1854 | public void llSetPrimitiveParams(List<string> rules) |
1022 | public string llStringToBase64(string str) | ||
1023 | { | 1855 | { |
1856 | NotImplemented("llSetPrimitiveParams"); | ||
1857 | } | ||
1024 | 1858 | ||
1859 | public string llStringToBase64(string str) | ||
1860 | { | ||
1025 | try | 1861 | try |
1026 | { | 1862 | { |
1027 | byte[] encData_byte = new byte[str.Length]; | 1863 | byte[] encData_byte = new byte[str.Length]; |
1028 | encData_byte = System.Text.Encoding.UTF8.GetBytes(str); | 1864 | encData_byte = Encoding.UTF8.GetBytes(str); |
1029 | string encodedData = Convert.ToBase64String(encData_byte); | 1865 | string encodedData = Convert.ToBase64String(encData_byte); |
1030 | return encodedData; | 1866 | return encodedData; |
1031 | } | 1867 | } |
@@ -1037,11 +1873,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1037 | 1873 | ||
1038 | public string llBase64ToString(string str) | 1874 | public string llBase64ToString(string str) |
1039 | { | 1875 | { |
1040 | System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); | 1876 | UTF8Encoding encoder = new UTF8Encoding(); |
1041 | System.Text.Decoder utf8Decode = encoder.GetDecoder(); | 1877 | Decoder utf8Decode = encoder.GetDecoder(); |
1042 | try | 1878 | try |
1043 | { | 1879 | { |
1044 | |||
1045 | byte[] todecode_byte = Convert.FromBase64String(str); | 1880 | byte[] todecode_byte = Convert.FromBase64String(str); |
1046 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | 1881 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); |
1047 | char[] decoded_char = new char[charCount]; | 1882 | char[] decoded_char = new char[charCount]; |
@@ -1054,16 +1889,49 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1054 | throw new Exception("Error in base64Decode" + e.Message); | 1889 | throw new Exception("Error in base64Decode" + e.Message); |
1055 | } | 1890 | } |
1056 | } | 1891 | } |
1057 | public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } | ||
1058 | public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } | ||
1059 | public double llLog10(double val) { return (double)Math.Log10(val); } | ||
1060 | public double llLog(double val) { return (double)Math.Log(val); } | ||
1061 | public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); } | ||
1062 | public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); } | ||
1063 | 1892 | ||
1064 | public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } | 1893 | public void llXorBase64Strings() |
1894 | { | ||
1895 | throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); | ||
1896 | } | ||
1897 | |||
1898 | public void llRemoteDataSetRegion() | ||
1899 | { | ||
1900 | NotImplemented("llRemoteDataSetRegion"); | ||
1901 | } | ||
1902 | |||
1903 | public double llLog10(double val) | ||
1904 | { | ||
1905 | return (double) Math.Log10(val); | ||
1906 | } | ||
1065 | 1907 | ||
1066 | public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } | 1908 | public double llLog(double val) |
1909 | { | ||
1910 | return (double) Math.Log(val); | ||
1911 | } | ||
1912 | |||
1913 | public List<string> llGetAnimationList(string id) | ||
1914 | { | ||
1915 | NotImplemented("llGetAnimationList"); | ||
1916 | return new List<string>(); | ||
1917 | } | ||
1918 | |||
1919 | public void llSetParcelMusicURL(string url) | ||
1920 | { | ||
1921 | NotImplemented("llSetParcelMusicURL"); | ||
1922 | } | ||
1923 | |||
1924 | public LSL_Types.Vector3 llGetRootPosition() | ||
1925 | { | ||
1926 | NotImplemented("llGetRootPosition"); | ||
1927 | return new LSL_Types.Vector3(); | ||
1928 | } | ||
1929 | |||
1930 | public LSL_Types.Quaternion llGetRootRotation() | ||
1931 | { | ||
1932 | NotImplemented("llGetRootRotation"); | ||
1933 | return new LSL_Types.Quaternion(); | ||
1934 | } | ||
1067 | 1935 | ||
1068 | public string llGetObjectDesc() | 1936 | public string llGetObjectDesc() |
1069 | { | 1937 | { |
@@ -1080,20 +1948,55 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1080 | return m_host.ObjectCreator.ToStringHyphenated(); | 1948 | return m_host.ObjectCreator.ToStringHyphenated(); |
1081 | } | 1949 | } |
1082 | 1950 | ||
1083 | public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } | 1951 | public string llGetTimestamp() |
1084 | public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } | 1952 | { |
1085 | public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } | 1953 | return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); |
1086 | public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } | 1954 | } |
1087 | public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } | 1955 | |
1088 | public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } | 1956 | public void llSetLinkAlpha(int linknumber, double alpha, int face) |
1089 | public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } | 1957 | { |
1958 | NotImplemented("llSetLinkAlpha"); | ||
1959 | } | ||
1960 | |||
1961 | public int llGetNumberOfPrims() | ||
1962 | { | ||
1963 | NotImplemented("llGetNumberOfPrims"); | ||
1964 | return 0; | ||
1965 | } | ||
1966 | |||
1967 | public string llGetNumberOfNotecardLines(string name) | ||
1968 | { | ||
1969 | NotImplemented("llGetNumberOfNotecardLines"); | ||
1970 | return ""; | ||
1971 | } | ||
1972 | |||
1973 | public List<string> llGetBoundingBox(string obj) | ||
1974 | { | ||
1975 | NotImplemented("llGetBoundingBox"); | ||
1976 | return new List<string>(); | ||
1977 | } | ||
1978 | |||
1979 | public LSL_Types.Vector3 llGetGeometricCenter() | ||
1980 | { | ||
1981 | NotImplemented("llGetGeometricCenter"); | ||
1982 | return new LSL_Types.Vector3(); | ||
1983 | } | ||
1984 | |||
1985 | public void llGetPrimitiveParams() | ||
1986 | { | ||
1987 | NotImplemented("llGetPrimitiveParams"); | ||
1988 | } | ||
1989 | |||
1090 | public string llIntegerToBase64(int number) | 1990 | public string llIntegerToBase64(int number) |
1091 | { | 1991 | { |
1092 | NotImplemented("llIntegerToBase64"); return ""; | 1992 | NotImplemented("llIntegerToBase64"); |
1993 | return ""; | ||
1093 | } | 1994 | } |
1995 | |||
1094 | public int llBase64ToInteger(string str) | 1996 | public int llBase64ToInteger(string str) |
1095 | { | 1997 | { |
1096 | NotImplemented("llBase64ToInteger"); return 0; | 1998 | NotImplemented("llBase64ToInteger"); |
1999 | return 0; | ||
1097 | } | 2000 | } |
1098 | 2001 | ||
1099 | public double llGetGMTclock() | 2002 | public double llGetGMTclock() |
@@ -1106,31 +2009,92 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1106 | return System.Environment.MachineName; | 2009 | return System.Environment.MachineName; |
1107 | } | 2010 | } |
1108 | 2011 | ||
1109 | public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } | 2012 | public void llSetLocalRot(LSL_Types.Quaternion rot) |
1110 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } | 2013 | { |
1111 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } | 2014 | NotImplemented("llSetLocalRot"); |
2015 | } | ||
1112 | 2016 | ||
1113 | public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } | 2017 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) |
2018 | { | ||
2019 | NotImplemented("llParseStringKeepNulls"); | ||
2020 | return new List<string>(); | ||
2021 | } | ||
1114 | 2022 | ||
1115 | public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } | 2023 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, |
2024 | LSL_Types.Quaternion rot, int param) | ||
2025 | { | ||
2026 | NotImplemented("llRezAtRoot"); | ||
2027 | } | ||
1116 | 2028 | ||
1117 | public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } | 2029 | public int llGetObjectPermMask(int mask) |
1118 | public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } | 2030 | { |
1119 | public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } | 2031 | NotImplemented("llGetObjectPermMask"); |
1120 | public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } | 2032 | return 0; |
1121 | public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } | 2033 | } |
1122 | public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } | 2034 | |
1123 | public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } | 2035 | public void llSetObjectPermMask(int mask, int value) |
1124 | public void llListReplaceList() { NotImplemented("llListReplaceList"); } | 2036 | { |
2037 | NotImplemented("llSetObjectPermMask"); | ||
2038 | } | ||
2039 | |||
2040 | public void llGetInventoryPermMask(string item, int mask) | ||
2041 | { | ||
2042 | NotImplemented("llGetInventoryPermMask"); | ||
2043 | } | ||
2044 | |||
2045 | public void llSetInventoryPermMask(string item, int mask, int value) | ||
2046 | { | ||
2047 | NotImplemented("llSetInventoryPermMask"); | ||
2048 | } | ||
2049 | |||
2050 | public string llGetInventoryCreator(string item) | ||
2051 | { | ||
2052 | NotImplemented("llGetInventoryCreator"); | ||
2053 | return ""; | ||
2054 | } | ||
2055 | |||
2056 | public void llOwnerSay(string msg) | ||
2057 | { | ||
2058 | NotImplemented("llOwnerSay"); | ||
2059 | } | ||
2060 | |||
2061 | public void llRequestSimulatorData(string simulator, int data) | ||
2062 | { | ||
2063 | NotImplemented("llRequestSimulatorData"); | ||
2064 | } | ||
2065 | |||
2066 | public void llForceMouselook(int mouselook) | ||
2067 | { | ||
2068 | NotImplemented("llForceMouselook"); | ||
2069 | } | ||
2070 | |||
2071 | public double llGetObjectMass(string id) | ||
2072 | { | ||
2073 | NotImplemented("llGetObjectMass"); | ||
2074 | return 0; | ||
2075 | } | ||
2076 | |||
2077 | public void llListReplaceList() | ||
2078 | { | ||
2079 | NotImplemented("llListReplaceList"); | ||
2080 | } | ||
1125 | 2081 | ||
1126 | public void llLoadURL(string avatar_id, string message, string url) | 2082 | public void llLoadURL(string avatar_id, string message, string url) |
1127 | { | 2083 | { |
1128 | LLUUID avatarId = new LLUUID(avatar_id); | 2084 | LLUUID avatarId = new LLUUID(avatar_id); |
1129 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); | 2085 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, |
2086 | url); | ||
1130 | } | 2087 | } |
1131 | 2088 | ||
1132 | public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } | 2089 | public void llParcelMediaCommandList(List<string> commandList) |
1133 | public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } | 2090 | { |
2091 | NotImplemented("llParcelMediaCommandList"); | ||
2092 | } | ||
2093 | |||
2094 | public void llParcelMediaQuery() | ||
2095 | { | ||
2096 | NotImplemented("llParcelMediaQuery"); | ||
2097 | } | ||
1134 | 2098 | ||
1135 | public int llModPow(int a, int b, int c) | 2099 | public int llModPow(int a, int b, int c) |
1136 | { | 2100 | { |
@@ -1139,13 +2103,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1139 | return Convert.ToInt32(tmp); | 2103 | return Convert.ToInt32(tmp); |
1140 | } | 2104 | } |
1141 | 2105 | ||
1142 | public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } | 2106 | public int llGetInventoryType(string name) |
2107 | { | ||
2108 | NotImplemented("llGetInventoryType"); | ||
2109 | return 0; | ||
2110 | } | ||
2111 | |||
2112 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) | ||
2113 | { | ||
2114 | NotImplemented("llSetPayPrice"); | ||
2115 | } | ||
2116 | |||
2117 | public LSL_Types.Vector3 llGetCameraPos() | ||
2118 | { | ||
2119 | NotImplemented("llGetCameraPos"); | ||
2120 | return new LSL_Types.Vector3(); | ||
2121 | } | ||
2122 | |||
2123 | public LSL_Types.Quaternion llGetCameraRot() | ||
2124 | { | ||
2125 | NotImplemented("llGetCameraRot"); | ||
2126 | return new LSL_Types.Quaternion(); | ||
2127 | } | ||
2128 | |||
2129 | public void llSetPrimURL() | ||
2130 | { | ||
2131 | NotImplemented("llSetPrimURL"); | ||
2132 | } | ||
1143 | 2133 | ||
1144 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } | 2134 | public void llRefreshPrimURL() |
1145 | public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } | 2135 | { |
1146 | public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } | 2136 | NotImplemented("llRefreshPrimURL"); |
1147 | public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } | 2137 | } |
1148 | public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } | ||
1149 | 2138 | ||
1150 | public string llEscapeURL(string url) | 2139 | public string llEscapeURL(string url) |
1151 | { | 2140 | { |
@@ -1170,21 +2159,60 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1170 | return "llUnescapeURL: " + ex.ToString(); | 2159 | return "llUnescapeURL: " + ex.ToString(); |
1171 | } | 2160 | } |
1172 | } | 2161 | } |
1173 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } | 2162 | |
1174 | public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } | 2163 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) |
1175 | public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } | 2164 | { |
1176 | public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } | 2165 | NotImplemented("llMapDestination"); |
1177 | public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } | 2166 | } |
1178 | public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } | 2167 | |
1179 | public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } | 2168 | public void llAddToLandBanList(string avatar, double hours) |
2169 | { | ||
2170 | NotImplemented("llAddToLandBanList"); | ||
2171 | } | ||
2172 | |||
2173 | public void llRemoveFromLandPassList(string avatar) | ||
2174 | { | ||
2175 | NotImplemented("llRemoveFromLandPassList"); | ||
2176 | } | ||
2177 | |||
2178 | public void llRemoveFromLandBanList(string avatar) | ||
2179 | { | ||
2180 | NotImplemented("llRemoveFromLandBanList"); | ||
2181 | } | ||
2182 | |||
2183 | public void llSetCameraParams(List<string> rules) | ||
2184 | { | ||
2185 | NotImplemented("llSetCameraParams"); | ||
2186 | } | ||
2187 | |||
2188 | public void llClearCameraParams() | ||
2189 | { | ||
2190 | NotImplemented("llClearCameraParams"); | ||
2191 | } | ||
2192 | |||
2193 | public double llListStatistics(int operation, List<string> src) | ||
2194 | { | ||
2195 | NotImplemented("llListStatistics"); | ||
2196 | return 0; | ||
2197 | } | ||
1180 | 2198 | ||
1181 | public int llGetUnixTime() | 2199 | public int llGetUnixTime() |
1182 | { | 2200 | { |
1183 | return Util.UnixTimeSinceEpoch(); | 2201 | return Util.UnixTimeSinceEpoch(); |
1184 | } | 2202 | } |
1185 | 2203 | ||
1186 | public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } | 2204 | public int llGetParcelFlags(LSL_Types.Vector3 pos) |
1187 | public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } | 2205 | { |
2206 | NotImplemented("llGetParcelFlags"); | ||
2207 | return 0; | ||
2208 | } | ||
2209 | |||
2210 | public int llGetRegionFlags() | ||
2211 | { | ||
2212 | NotImplemented("llGetRegionFlags"); | ||
2213 | return 0; | ||
2214 | } | ||
2215 | |||
1188 | public string llXorBase64StringsCorrect(string str1, string str2) | 2216 | public string llXorBase64StringsCorrect(string str1, string str2) |
1189 | { | 2217 | { |
1190 | string ret = ""; | 2218 | string ret = ""; |
@@ -1201,27 +2229,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1201 | } | 2229 | } |
1202 | return llStringToBase64(ret); | 2230 | return llStringToBase64(ret); |
1203 | } | 2231 | } |
2232 | |||
1204 | public void llHTTPRequest(string url, List<string> parameters, string body) | 2233 | public void llHTTPRequest(string url, List<string> parameters, string body) |
1205 | { | 2234 | { |
1206 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); | 2235 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); |
1207 | } | 2236 | } |
1208 | public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } | 2237 | |
1209 | public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } | 2238 | public void llResetLandBanList() |
1210 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } | 2239 | { |
1211 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } | 2240 | NotImplemented("llResetLandBanList"); |
1212 | public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } | 2241 | } |
1213 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } | 2242 | |
1214 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } | 2243 | public void llResetLandPassList() |
2244 | { | ||
2245 | NotImplemented("llResetLandPassList"); | ||
2246 | } | ||
2247 | |||
2248 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) | ||
2249 | { | ||
2250 | NotImplemented("llGetParcelPrimCount"); | ||
2251 | return 0; | ||
2252 | } | ||
2253 | |||
2254 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) | ||
2255 | { | ||
2256 | NotImplemented("llGetParcelPrimOwners"); | ||
2257 | return new List<string>(); | ||
2258 | } | ||
2259 | |||
2260 | public int llGetObjectPrimCount(string object_id) | ||
2261 | { | ||
2262 | NotImplemented("llGetObjectPrimCount"); | ||
2263 | return 0; | ||
2264 | } | ||
2265 | |||
2266 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) | ||
2267 | { | ||
2268 | NotImplemented("llGetParcelMaxPrims"); | ||
2269 | return 0; | ||
2270 | } | ||
2271 | |||
2272 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) | ||
2273 | { | ||
2274 | NotImplemented("llGetParcelDetails"); | ||
2275 | return new List<string>(); | ||
2276 | } | ||
1215 | 2277 | ||
1216 | // | 2278 | // |
1217 | // OpenSim functions | 2279 | // OpenSim functions |
1218 | // | 2280 | // |
1219 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) | 2281 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, |
2282 | int timer) | ||
1220 | { | 2283 | { |
1221 | if (dynamicID == "") | 2284 | if (dynamicID == "") |
1222 | { | 2285 | { |
1223 | IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); | 2286 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); |
1224 | LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer); | 2287 | LLUUID createdTexture = |
2288 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | ||
2289 | extraParams, timer); | ||
1225 | return createdTexture.ToStringHyphenated(); | 2290 | return createdTexture.ToStringHyphenated(); |
1226 | } | 2291 | } |
1227 | else | 2292 | else |
@@ -1237,6 +2302,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
1237 | if (throwErrorOnNotImplemented) | 2302 | if (throwErrorOnNotImplemented) |
1238 | throw new NotImplementedException("Command not implemented: " + Command); | 2303 | throw new NotImplementedException("Command not implemented: " + Command); |
1239 | } | 2304 | } |
1240 | |||
1241 | } | 2305 | } |
1242 | } | 2306 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 8f0a591..85ac597 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs | |||
@@ -27,11 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | 30 | using libsecondlife; |
33 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | 32 | ||
36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
37 | { | 34 | { |
@@ -39,7 +36,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
39 | /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. | 36 | /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. |
40 | /// </summary> | 37 | /// </summary> |
41 | [Serializable] | 38 | [Serializable] |
42 | class EventManager | 39 | internal class EventManager |
43 | { | 40 | { |
44 | private ScriptEngine myScriptEngine; | 41 | private ScriptEngine myScriptEngine; |
45 | //public IScriptHost TEMP_OBJECT_ID; | 42 | //public IScriptHost TEMP_OBJECT_ID; |
@@ -55,7 +52,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
55 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 52 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
56 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 53 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
57 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 54 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
58 | |||
59 | } | 55 | } |
60 | 56 | ||
61 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 57 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
@@ -63,17 +59,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
63 | // Add to queue for all scripts in ObjectID object | 59 | // Add to queue for all scripts in ObjectID object |
64 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); | 60 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); |
65 | //Console.WriteLine("touch_start localID: " + localID); | 61 | //Console.WriteLine("touch_start localID: " + localID); |
66 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); | 62 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1}); |
67 | } | 63 | } |
64 | |||
68 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 65 | public void OnRezScript(uint localID, LLUUID itemID, string script) |
69 | { | 66 | { |
70 | //myScriptEngine.myScriptManager.StartScript( | 67 | //myScriptEngine.myScriptManager.StartScript( |
71 | // Path.Combine("ScriptEngines", "Default.lsl"), | 68 | // Path.Combine("ScriptEngines", "Default.lsl"), |
72 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() | 69 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() |
73 | //); | 70 | //); |
74 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); | 71 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + |
72 | script.Length); | ||
75 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); | 73 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); |
76 | } | 74 | } |
75 | |||
77 | public void OnRemoveScript(uint localID, LLUUID itemID) | 76 | public void OnRemoveScript(uint localID, LLUUID itemID) |
78 | { | 77 | { |
79 | //myScriptEngine.myScriptManager.StartScript( | 78 | //myScriptEngine.myScriptManager.StartScript( |
@@ -84,48 +83,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
84 | myScriptEngine.m_ScriptManager.StopScript( | 83 | myScriptEngine.m_ScriptManager.StopScript( |
85 | localID, | 84 | localID, |
86 | itemID | 85 | itemID |
87 | ); | 86 | ); |
88 | |||
89 | } | 87 | } |
90 | 88 | ||
91 | // TODO: Replace placeholders below | 89 | // TODO: Replace placeholders below |
92 | // These needs to be hooked up to OpenSim during init of this class | 90 | // These needs to be hooked up to OpenSim during init of this class |
93 | // then queued in EventQueueManager. | 91 | // then queued in EventQueueManager. |
94 | // When queued in EventQueueManager they need to be LSL compatible (name and params) | 92 | // When queued in EventQueueManager they need to be LSL compatible (name and params) |
95 | 93 | ||
96 | //public void state_entry() { } // | 94 | //public void state_entry() { } // |
97 | public void state_exit() { } | 95 | public void state_exit() |
96 | { | ||
97 | } | ||
98 | |||
98 | //public void touch_start() { } | 99 | //public void touch_start() { } |
99 | public void touch() { } | 100 | public void touch() |
100 | public void touch_end() { } | 101 | { |
101 | public void collision_start() { } | 102 | } |
102 | public void collision() { } | 103 | |
103 | public void collision_end() { } | 104 | public void touch_end() |
104 | public void land_collision_start() { } | 105 | { |
105 | public void land_collision() { } | 106 | } |
106 | public void land_collision_end() { } | 107 | |
107 | public void timer() { } | 108 | public void collision_start() |
108 | public void listen() { } | 109 | { |
109 | public void on_rez() { } | 110 | } |
110 | public void sensor() { } | 111 | |
111 | public void no_sensor() { } | 112 | public void collision() |
112 | public void control() { } | 113 | { |
113 | public void money() { } | 114 | } |
114 | public void email() { } | 115 | |
115 | public void at_target() { } | 116 | public void collision_end() |
116 | public void not_at_target() { } | 117 | { |
117 | public void at_rot_target() { } | 118 | } |
118 | public void not_at_rot_target() { } | 119 | |
119 | public void run_time_permissions() { } | 120 | public void land_collision_start() |
120 | public void changed() { } | 121 | { |
121 | public void attach() { } | 122 | } |
122 | public void dataserver() { } | 123 | |
123 | public void link_message() { } | 124 | public void land_collision() |
124 | public void moving_start() { } | 125 | { |
125 | public void moving_end() { } | 126 | } |
126 | public void object_rez() { } | 127 | |
127 | public void remote_data() { } | 128 | public void land_collision_end() |
128 | public void http_response() { } | 129 | { |
130 | } | ||
131 | |||
132 | public void timer() | ||
133 | { | ||
134 | } | ||
135 | |||
136 | public void listen() | ||
137 | { | ||
138 | } | ||
139 | |||
140 | public void on_rez() | ||
141 | { | ||
142 | } | ||
143 | |||
144 | public void sensor() | ||
145 | { | ||
146 | } | ||
147 | |||
148 | public void no_sensor() | ||
149 | { | ||
150 | } | ||
151 | |||
152 | public void control() | ||
153 | { | ||
154 | } | ||
155 | |||
156 | public void money() | ||
157 | { | ||
158 | } | ||
159 | |||
160 | public void email() | ||
161 | { | ||
162 | } | ||
163 | |||
164 | public void at_target() | ||
165 | { | ||
166 | } | ||
167 | |||
168 | public void not_at_target() | ||
169 | { | ||
170 | } | ||
171 | |||
172 | public void at_rot_target() | ||
173 | { | ||
174 | } | ||
175 | |||
176 | public void not_at_rot_target() | ||
177 | { | ||
178 | } | ||
179 | |||
180 | public void run_time_permissions() | ||
181 | { | ||
182 | } | ||
183 | |||
184 | public void changed() | ||
185 | { | ||
186 | } | ||
187 | |||
188 | public void attach() | ||
189 | { | ||
190 | } | ||
191 | |||
192 | public void dataserver() | ||
193 | { | ||
194 | } | ||
195 | |||
196 | public void link_message() | ||
197 | { | ||
198 | } | ||
199 | |||
200 | public void moving_start() | ||
201 | { | ||
202 | } | ||
203 | |||
204 | public void moving_end() | ||
205 | { | ||
206 | } | ||
207 | |||
208 | public void object_rez() | ||
209 | { | ||
210 | } | ||
211 | |||
212 | public void remote_data() | ||
213 | { | ||
214 | } | ||
129 | 215 | ||
216 | public void http_response() | ||
217 | { | ||
218 | } | ||
130 | } | 219 | } |
131 | } | 220 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index aa36ea2..d7491d9 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | |||
@@ -27,12 +27,11 @@ | |||
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Reflection; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
36 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | 35 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
37 | 36 | ||
38 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
@@ -42,25 +41,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
42 | /// Events are queued and executed in separate thread | 41 | /// Events are queued and executed in separate thread |
43 | /// </summary> | 42 | /// </summary> |
44 | [Serializable] | 43 | [Serializable] |
45 | class EventQueueManager | 44 | internal class EventQueueManager |
46 | { | 45 | { |
47 | /// <summary> | 46 | /// <summary> |
48 | /// List of threads processing event queue | 47 | /// List of threads processing event queue |
49 | /// </summary> | 48 | /// </summary> |
50 | private List<Thread> eventQueueThreads = new List<Thread>(); | 49 | private List<Thread> eventQueueThreads = new List<Thread>(); |
50 | |||
51 | private object queueLock = new object(); // Mutex lock object | 51 | private object queueLock = new object(); // Mutex lock object |
52 | |||
52 | /// <summary> | 53 | /// <summary> |
53 | /// How many ms to sleep if queue is empty | 54 | /// How many ms to sleep if queue is empty |
54 | /// </summary> | 55 | /// </summary> |
55 | private int nothingToDoSleepms = 50; | 56 | private int nothingToDoSleepms = 50; |
57 | |||
56 | /// <summary> | 58 | /// <summary> |
57 | /// How many threads to process queue with | 59 | /// How many threads to process queue with |
58 | /// </summary> | 60 | /// </summary> |
59 | private int numberOfThreads = 2; | 61 | private int numberOfThreads = 2; |
62 | |||
60 | /// <summary> | 63 | /// <summary> |
61 | /// Queue containing events waiting to be executed | 64 | /// Queue containing events waiting to be executed |
62 | /// </summary> | 65 | /// </summary> |
63 | private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); | 66 | private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); |
67 | |||
64 | /// <summary> | 68 | /// <summary> |
65 | /// Queue item structure | 69 | /// Queue item structure |
66 | /// </summary> | 70 | /// </summary> |
@@ -76,9 +80,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
76 | /// List of localID locks for mutex processing of script events | 80 | /// List of localID locks for mutex processing of script events |
77 | /// </summary> | 81 | /// </summary> |
78 | private List<uint> objectLocks = new List<uint>(); | 82 | private List<uint> objectLocks = new List<uint>(); |
83 | |||
79 | private object tryLockLock = new object(); // Mutex lock object | 84 | private object tryLockLock = new object(); // Mutex lock object |
80 | 85 | ||
81 | private ScriptEngine m_ScriptEngine; | 86 | private ScriptEngine m_ScriptEngine; |
87 | |||
82 | public EventQueueManager(ScriptEngine _ScriptEngine) | 88 | public EventQueueManager(ScriptEngine _ScriptEngine) |
83 | { | 89 | { |
84 | m_ScriptEngine = _ScriptEngine; | 90 | m_ScriptEngine = _ScriptEngine; |
@@ -96,11 +102,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
96 | EventQueueThread.Start(); | 102 | EventQueueThread.Start(); |
97 | } | 103 | } |
98 | } | 104 | } |
105 | |||
99 | ~EventQueueManager() | 106 | ~EventQueueManager() |
100 | { | 107 | { |
101 | |||
102 | // Kill worker threads | 108 | // Kill worker threads |
103 | foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads)) | 109 | foreach (Thread EventQueueThread in new ArrayList(eventQueueThreads)) |
104 | { | 110 | { |
105 | if (EventQueueThread != null && EventQueueThread.IsAlive == true) | 111 | if (EventQueueThread != null && EventQueueThread.IsAlive == true) |
106 | { | 112 | { |
@@ -118,7 +124,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
118 | eventQueueThreads.Clear(); | 124 | eventQueueThreads.Clear(); |
119 | // Todo: Clean up our queues | 125 | // Todo: Clean up our queues |
120 | eventQueue.Clear(); | 126 | eventQueue.Clear(); |
121 | |||
122 | } | 127 | } |
123 | 128 | ||
124 | /// <summary> | 129 | /// <summary> |
@@ -176,18 +181,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
176 | // Execute function | 181 | // Execute function |
177 | try | 182 | try |
178 | { | 183 | { |
179 | m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param); | 184 | m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, |
185 | QIS.functionName, QIS.param); | ||
180 | } | 186 | } |
181 | catch (Exception e) | 187 | catch (Exception e) |
182 | { | 188 | { |
183 | // DISPLAY ERROR INWORLD | 189 | // DISPLAY ERROR INWORLD |
184 | string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; | 190 | string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; |
185 | if (e.InnerException != null) | 191 | if (e.InnerException != null) |
186 | { // Send inner exception | 192 | { |
193 | // Send inner exception | ||
187 | text += e.InnerException.Message.ToString(); | 194 | text += e.InnerException.Message.ToString(); |
188 | } | 195 | } |
189 | else | 196 | else |
190 | { // Send normal | 197 | { |
198 | // Send normal | ||
191 | text += e.Message.ToString(); | 199 | text += e.Message.ToString(); |
192 | } | 200 | } |
193 | try | 201 | try |
@@ -195,28 +203,33 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
195 | if (text.Length > 1500) | 203 | if (text.Length > 1500) |
196 | text = text.Substring(0, 1500); | 204 | text = text.Substring(0, 1500); |
197 | IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); | 205 | IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); |
198 | //if (m_host != null) | 206 | //if (m_host != null) |
199 | //{ | 207 | //{ |
200 | m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 208 | m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, |
201 | } catch { | 209 | m_host.AbsolutePosition, m_host.Name, m_host.UUID); |
202 | //} | 210 | } |
203 | //else | 211 | catch |
204 | //{ | 212 | { |
213 | //} | ||
214 | //else | ||
215 | //{ | ||
205 | // T oconsole | 216 | // T oconsole |
206 | Console.WriteLine("Unable to send text in-world:\r\n" + text); | 217 | Console.WriteLine("Unable to send text in-world:\r\n" + text); |
207 | } | 218 | } |
208 | |||
209 | } | 219 | } |
210 | finally | 220 | finally |
211 | { | 221 | { |
212 | ReleaseLock(QIS.localID); | 222 | ReleaseLock(QIS.localID); |
213 | } | 223 | } |
214 | } | 224 | } |
215 | |||
216 | } // Something in queue | 225 | } // Something in queue |
217 | } catch (ThreadAbortException tae) { | 226 | } |
227 | catch (ThreadAbortException tae) | ||
228 | { | ||
218 | throw tae; | 229 | throw tae; |
219 | } catch (Exception e) { | 230 | } |
231 | catch (Exception e) | ||
232 | { | ||
220 | Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); | 233 | Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); |
221 | } | 234 | } |
222 | } // while | 235 | } // while |
@@ -283,15 +296,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
283 | return; | 296 | return; |
284 | } | 297 | } |
285 | 298 | ||
286 | Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); | 299 | Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = |
300 | m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); | ||
287 | 301 | ||
288 | foreach ( LLUUID itemID in scriptKeys ) | 302 | foreach (LLUUID itemID in scriptKeys) |
289 | { | 303 | { |
290 | // Add to each script in that object | 304 | // Add to each script in that object |
291 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? | 305 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? |
292 | AddToScriptQueue(localID, itemID, FunctionName, param); | 306 | AddToScriptQueue(localID, itemID, FunctionName, param); |
293 | } | 307 | } |
294 | |||
295 | } | 308 | } |
296 | 309 | ||
297 | /// <summary> | 310 | /// <summary> |
@@ -316,6 +329,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
316 | eventQueue.Enqueue(QIS); | 329 | eventQueue.Enqueue(QIS); |
317 | } | 330 | } |
318 | } | 331 | } |
319 | |||
320 | } | 332 | } |
321 | } | 333 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs index e6c2c47..5061629 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs | |||
@@ -28,24 +28,23 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | using System.Threading; | 31 | using System.Threading; |
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using OpenSim.Region.ScriptEngine.Common; | ||
35 | using OpenSim.Region.Environment.Modules; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 33 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Modules; | ||
37 | 35 | ||
38 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
39 | { | 37 | { |
40 | /// <summary> | 38 | /// <summary> |
41 | /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. | 39 | /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. |
42 | /// </summary> | 40 | /// </summary> |
43 | class LSLLongCmdHandler | 41 | internal class LSLLongCmdHandler |
44 | { | 42 | { |
45 | private Thread cmdHandlerThread; | 43 | private Thread cmdHandlerThread; |
46 | private int cmdHandlerThreadCycleSleepms = 100; | 44 | private int cmdHandlerThreadCycleSleepms = 100; |
47 | 45 | ||
48 | private ScriptEngine m_ScriptEngine; | 46 | private ScriptEngine m_ScriptEngine; |
47 | |||
49 | public LSLLongCmdHandler(ScriptEngine _ScriptEngine) | 48 | public LSLLongCmdHandler(ScriptEngine _ScriptEngine) |
50 | { | 49 | { |
51 | m_ScriptEngine = _ScriptEngine; | 50 | m_ScriptEngine = _ScriptEngine; |
@@ -56,8 +55,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
56 | cmdHandlerThread.Priority = ThreadPriority.BelowNormal; | 55 | cmdHandlerThread.Priority = ThreadPriority.BelowNormal; |
57 | cmdHandlerThread.IsBackground = true; | 56 | cmdHandlerThread.IsBackground = true; |
58 | cmdHandlerThread.Start(); | 57 | cmdHandlerThread.Start(); |
59 | |||
60 | } | 58 | } |
59 | |||
61 | ~LSLLongCmdHandler() | 60 | ~LSLLongCmdHandler() |
62 | { | 61 | { |
63 | // Shut down thread | 62 | // Shut down thread |
@@ -72,7 +71,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
72 | } | 71 | } |
73 | } | 72 | } |
74 | } | 73 | } |
75 | catch { } | 74 | catch |
75 | { | ||
76 | } | ||
76 | } | 77 | } |
77 | 78 | ||
78 | private void CmdHandlerThreadLoop() | 79 | private void CmdHandlerThreadLoop() |
@@ -124,8 +125,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
124 | public double interval; | 125 | public double interval; |
125 | public DateTime next; | 126 | public DateTime next; |
126 | } | 127 | } |
128 | |||
127 | private List<TimerClass> Timers = new List<TimerClass>(); | 129 | private List<TimerClass> Timers = new List<TimerClass>(); |
128 | private object TimerListLock = new object(); | 130 | private object TimerListLock = new object(); |
131 | |||
129 | public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) | 132 | public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) |
130 | { | 133 | { |
131 | Console.WriteLine("SetTimerEvent"); | 134 | Console.WriteLine("SetTimerEvent"); |
@@ -146,6 +149,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
146 | Timers.Add(ts); | 149 | Timers.Add(ts); |
147 | } | 150 | } |
148 | } | 151 | } |
152 | |||
149 | public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) | 153 | public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) |
150 | { | 154 | { |
151 | // Remove from timer | 155 | // Remove from timer |
@@ -163,6 +167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
163 | Timers = NewTimers; | 167 | Timers = NewTimers; |
164 | } | 168 | } |
165 | } | 169 | } |
170 | |||
166 | public void CheckTimerEvents() | 171 | public void CheckTimerEvents() |
167 | { | 172 | { |
168 | // Nothing to do here? | 173 | // Nothing to do here? |
@@ -171,7 +176,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
171 | 176 | ||
172 | lock (TimerListLock) | 177 | lock (TimerListLock) |
173 | { | 178 | { |
174 | |||
175 | // Go through all timers | 179 | // Go through all timers |
176 | foreach (TimerClass ts in Timers) | 180 | foreach (TimerClass ts in Timers) |
177 | { | 181 | { |
@@ -179,7 +183,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
179 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) | 183 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) |
180 | { | 184 | { |
181 | // Add it to queue | 185 | // Add it to queue |
182 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); | 186 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", |
187 | new object[] {}); | ||
183 | // set next interval | 188 | // set next interval |
184 | 189 | ||
185 | 190 | ||
@@ -188,6 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
188 | } | 193 | } |
189 | } // lock | 194 | } // lock |
190 | } | 195 | } |
196 | |||
191 | #endregion | 197 | #endregion |
192 | 198 | ||
193 | #region HTTP REQUEST | 199 | #region HTTP REQUEST |
@@ -213,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
213 | { | 219 | { |
214 | // TODO: SEND REQUEST!!! | 220 | // TODO: SEND REQUEST!!! |
215 | } | 221 | } |
222 | |||
216 | public void Stop() | 223 | public void Stop() |
217 | { | 224 | { |
218 | // TODO: Cancel any ongoing request | 225 | // TODO: Cancel any ongoing request |
219 | } | 226 | } |
227 | |||
220 | public bool CheckResponse() | 228 | public bool CheckResponse() |
221 | { | 229 | { |
222 | // TODO: Check if we got a response yet, return true if so -- false if not | 230 | // TODO: Check if we got a response yet, return true if so -- false if not |
@@ -227,11 +235,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
227 | //response_status | 235 | //response_status |
228 | //response_metadata | 236 | //response_metadata |
229 | //response_body | 237 | //response_body |
230 | |||
231 | } | 238 | } |
232 | } | 239 | } |
240 | |||
233 | private List<HttpClass> HttpRequests = new List<HttpClass>(); | 241 | private List<HttpClass> HttpRequests = new List<HttpClass>(); |
234 | private object HttpListLock = new object(); | 242 | private object HttpListLock = new object(); |
243 | |||
235 | public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) | 244 | public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) |
236 | { | 245 | { |
237 | Console.WriteLine("StartHttpRequest"); | 246 | Console.WriteLine("StartHttpRequest"); |
@@ -244,11 +253,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
244 | htc.body = body; | 253 | htc.body = body; |
245 | lock (HttpListLock) | 254 | lock (HttpListLock) |
246 | { | 255 | { |
247 | |||
248 | //ADD REQUEST | 256 | //ADD REQUEST |
249 | HttpRequests.Add(htc); | 257 | HttpRequests.Add(htc); |
250 | } | 258 | } |
251 | } | 259 | } |
260 | |||
252 | public void StopHttpRequest(uint m_localID, LLUUID m_itemID) | 261 | public void StopHttpRequest(uint m_localID, LLUUID m_itemID) |
253 | { | 262 | { |
254 | // Remove from list | 263 | // Remove from list |
@@ -272,6 +281,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
272 | HttpRequests = NewHttpList; | 281 | HttpRequests = NewHttpList; |
273 | } | 282 | } |
274 | } | 283 | } |
284 | |||
275 | public void CheckHttpRequests() | 285 | public void CheckHttpRequests() |
276 | { | 286 | { |
277 | // Nothing to do here? | 287 | // Nothing to do here? |
@@ -282,68 +292,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
282 | { | 292 | { |
283 | foreach (HttpClass ts in HttpRequests) | 293 | foreach (HttpClass ts in HttpRequests) |
284 | { | 294 | { |
285 | |||
286 | if (ts.CheckResponse() == true) | 295 | if (ts.CheckResponse() == true) |
287 | { | 296 | { |
288 | // Add it to event queue | 297 | // Add it to event queue |
289 | //key request_id, integer status, list metadata, string body | 298 | //key request_id, integer status, list metadata, string body |
290 | object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; | 299 | object[] resobj = |
291 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); | 300 | new object[] |
301 | {ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body}; | ||
302 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", | ||
303 | resobj); | ||
292 | // Now stop it | 304 | // Now stop it |
293 | StopHttpRequest(ts.localID, ts.itemID); | 305 | StopHttpRequest(ts.localID, ts.itemID); |
294 | } | 306 | } |
295 | } | 307 | } |
296 | } // lock | 308 | } // lock |
297 | } | 309 | } |
310 | |||
298 | #endregion | 311 | #endregion |
299 | 312 | ||
300 | public void CheckXMLRPCRequests() | 313 | public void CheckXMLRPCRequests() |
301 | { | 314 | { |
302 | |||
303 | IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 315 | IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
304 | 316 | ||
305 | while (xmlrpc.hasRequests()) | 317 | while (xmlrpc.hasRequests()) |
306 | { | 318 | { |
307 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); | 319 | RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); |
308 | System.Console.WriteLine("PICKED REQUEST"); | 320 | Console.WriteLine("PICKED REQUEST"); |
309 | 321 | ||
310 | //Deliver data to prim's remote_data handler | 322 | //Deliver data to prim's remote_data handler |
311 | object[] resobj = new object[] { | 323 | object[] resobj = new object[] |
312 | 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), rInfo.GetStrVal() | 324 | { |
313 | }; | 325 | 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), |
326 | rInfo.GetStrVal() | ||
327 | }; | ||
314 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 328 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
315 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj | 329 | rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj |
316 | ); | 330 | ); |
317 | |||
318 | } | 331 | } |
319 | |||
320 | } | 332 | } |
321 | 333 | ||
322 | public void CheckListeners() | 334 | public void CheckListeners() |
323 | { | 335 | { |
324 | |||
325 | IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 336 | IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
326 | 337 | ||
327 | while (comms.HasMessages()) | 338 | while (comms.HasMessages()) |
328 | { | 339 | { |
329 | ListenerInfo lInfo = comms.GetNextMessage(); | 340 | ListenerInfo lInfo = comms.GetNextMessage(); |
330 | System.Console.WriteLine("PICKED LISTENER"); | 341 | Console.WriteLine("PICKED LISTENER"); |
331 | 342 | ||
332 | //Deliver data to prim's listen handler | 343 | //Deliver data to prim's listen handler |
333 | object[] resobj = new object[] { | 344 | object[] resobj = new object[] |
334 | lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() | 345 | { |
335 | }; | 346 | lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() |
347 | }; | ||
336 | 348 | ||
337 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 349 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
338 | lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj | 350 | lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj |
339 | ); | 351 | ); |
340 | |||
341 | } | 352 | } |
342 | |||
343 | } | 353 | } |
344 | |||
345 | |||
346 | |||
347 | |||
348 | } | 354 | } |
349 | } | 355 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs index 0aa1a0b..00027ca 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
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 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] | 24 | |
25 | [assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices; | |||
31 | // | 33 | // |
32 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
33 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
34 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 38bf746..eaa3a09 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -27,14 +27,10 @@ | |||
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 Nini.Config; |
31 | using System.Text; | ||
32 | using OpenSim.Framework.Console; | 31 | using OpenSim.Framework.Console; |
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
35 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
36 | using libsecondlife; | 33 | using OpenSim.Region.Environment.Scenes; |
37 | using Nini.Config; | ||
38 | 34 | ||
39 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
40 | { | 36 | { |
@@ -42,17 +38,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
42 | /// This is the root object for ScriptEngine | 38 | /// This is the root object for ScriptEngine |
43 | /// </summary> | 39 | /// </summary> |
44 | [Serializable] | 40 | [Serializable] |
45 | public class ScriptEngine :IRegionModule | 41 | public class ScriptEngine : IRegionModule |
46 | { | 42 | { |
47 | 43 | internal Scene World; | |
48 | internal OpenSim.Region.Environment.Scenes.Scene World; | 44 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
49 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 45 | internal EventQueueManager m_EventQueueManager; // Executes events |
50 | internal EventQueueManager m_EventQueueManager; // Executes events | 46 | internal ScriptManager m_ScriptManager; // Load, unload and execute scripts |
51 | internal ScriptManager m_ScriptManager; // Load, unload and execute scripts | ||
52 | internal AppDomainManager m_AppDomainManager; | 47 | internal AppDomainManager m_AppDomainManager; |
53 | internal LSLLongCmdHandler m_LSLLongCmdHandler; | 48 | internal LSLLongCmdHandler m_LSLLongCmdHandler; |
54 | 49 | ||
55 | private OpenSim.Framework.Console.LogBase m_log; | 50 | private LogBase m_log; |
56 | 51 | ||
57 | public ScriptEngine() | 52 | public ScriptEngine() |
58 | { | 53 | { |
@@ -65,9 +60,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
65 | get { return m_log; } | 60 | get { return m_log; } |
66 | } | 61 | } |
67 | 62 | ||
68 | public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) | 63 | public void InitializeEngine(Scene Sceneworld, LogBase logger) |
69 | { | 64 | { |
70 | |||
71 | World = Sceneworld; | 65 | World = Sceneworld; |
72 | m_log = logger; | 66 | m_log = logger; |
73 | 67 | ||
@@ -84,10 +78,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
84 | 78 | ||
85 | // Should we iterate the region for scripts that needs starting? | 79 | // Should we iterate the region for scripts that needs starting? |
86 | // Or can we assume we are loaded before anything else so we can use proper events? | 80 | // Or can we assume we are loaded before anything else so we can use proper events? |
87 | |||
88 | |||
89 | } | 81 | } |
90 | 82 | ||
91 | public void Shutdown() | 83 | public void Shutdown() |
92 | { | 84 | { |
93 | // We are shutting down | 85 | // We are shutting down |
@@ -106,12 +98,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
106 | 98 | ||
107 | public void Initialise(Scene scene, IConfigSource config) | 99 | public void Initialise(Scene scene, IConfigSource config) |
108 | { | 100 | { |
109 | this.InitializeEngine(scene, MainLog.Instance); | 101 | InitializeEngine(scene, MainLog.Instance); |
110 | } | 102 | } |
111 | 103 | ||
112 | public void PostInitialise() | 104 | public void PostInitialise() |
113 | { | 105 | { |
114 | |||
115 | } | 106 | } |
116 | 107 | ||
117 | public void Close() | 108 | public void Close() |
@@ -130,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
130 | 121 | ||
131 | #endregion | 122 | #endregion |
132 | } | 123 | } |
133 | } | 124 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 381fd8c..54a5ef5 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -28,19 +28,14 @@ | |||
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.IO; |
32 | using System.Threading; | ||
33 | using System.Reflection; | 32 | using System.Reflection; |
34 | using System.Runtime.Remoting; | ||
35 | using System.Runtime.Serialization; | ||
36 | using System.Runtime.Serialization.Formatters.Binary; | 33 | using System.Runtime.Serialization.Formatters.Binary; |
34 | using System.Threading; | ||
35 | using libsecondlife; | ||
37 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
38 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
39 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 37 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; |
40 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | 38 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
41 | using OpenSim.Region.ScriptEngine.Common; | ||
42 | using libsecondlife; | ||
43 | |||
44 | 39 | ||
45 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 40 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
46 | { | 41 | { |
@@ -53,16 +48,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
53 | public class ScriptManager | 48 | public class ScriptManager |
54 | { | 49 | { |
55 | #region Declares | 50 | #region Declares |
51 | |||
56 | private Thread scriptLoadUnloadThread; | 52 | private Thread scriptLoadUnloadThread; |
57 | private int scriptLoadUnloadThread_IdleSleepms = 100; | 53 | private int scriptLoadUnloadThread_IdleSleepms = 100; |
58 | private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>(); | 54 | private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>(); |
59 | private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>(); | 55 | private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>(); |
56 | |||
60 | private struct LoadStruct | 57 | private struct LoadStruct |
61 | { | 58 | { |
62 | public uint localID; | 59 | public uint localID; |
63 | public LLUUID itemID; | 60 | public LLUUID itemID; |
64 | public string script; | 61 | public string script; |
65 | } | 62 | } |
63 | |||
66 | private struct UnloadStruct | 64 | private struct UnloadStruct |
67 | { | 65 | { |
68 | public uint localID; | 66 | public uint localID; |
@@ -72,17 +70,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
72 | // Object<string, Script<string, script>> | 70 | // Object<string, Script<string, script>> |
73 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. | 71 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. |
74 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 72 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
75 | internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); | 73 | internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = |
74 | new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); | ||
75 | |||
76 | public Scene World | 76 | public Scene World |
77 | { | 77 | { |
78 | get | 78 | get { return m_scriptEngine.World; } |
79 | { | ||
80 | return m_scriptEngine.World; | ||
81 | } | ||
82 | } | 79 | } |
83 | #endregion | 80 | |
81 | #endregion | ||
82 | |||
84 | #region Object init/shutdown | 83 | #region Object init/shutdown |
84 | |||
85 | private ScriptEngine m_scriptEngine; | 85 | private ScriptEngine m_scriptEngine; |
86 | |||
86 | public ScriptManager(ScriptEngine scriptEngine) | 87 | public ScriptManager(ScriptEngine scriptEngine) |
87 | { | 88 | { |
88 | m_scriptEngine = scriptEngine; | 89 | m_scriptEngine = scriptEngine; |
@@ -92,9 +93,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
92 | scriptLoadUnloadThread.IsBackground = true; | 93 | scriptLoadUnloadThread.IsBackground = true; |
93 | scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; | 94 | scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; |
94 | scriptLoadUnloadThread.Start(); | 95 | scriptLoadUnloadThread.Start(); |
95 | |||
96 | } | 96 | } |
97 | ~ScriptManager () | 97 | |
98 | ~ScriptManager() | ||
98 | { | 99 | { |
99 | // Abort load/unload thread | 100 | // Abort load/unload thread |
100 | try | 101 | try |
@@ -112,8 +113,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
112 | { | 113 | { |
113 | } | 114 | } |
114 | } | 115 | } |
116 | |||
115 | #endregion | 117 | #endregion |
118 | |||
116 | #region Load / Unload scripts (Thread loop) | 119 | #region Load / Unload scripts (Thread loop) |
120 | |||
117 | private void ScriptLoadUnloadThreadLoop() | 121 | private void ScriptLoadUnloadThreadLoop() |
118 | { | 122 | { |
119 | try | 123 | try |
@@ -134,9 +138,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
134 | UnloadStruct item = unloadQueue.Dequeue(); | 138 | UnloadStruct item = unloadQueue.Dequeue(); |
135 | _StopScript(item.localID, item.itemID); | 139 | _StopScript(item.localID, item.itemID); |
136 | } | 140 | } |
137 | |||
138 | |||
139 | |||
140 | } | 141 | } |
141 | } | 142 | } |
142 | catch (ThreadAbortException tae) | 143 | catch (ThreadAbortException tae) |
@@ -145,21 +146,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
145 | a = ""; | 146 | a = ""; |
146 | // Expected | 147 | // Expected |
147 | } | 148 | } |
148 | |||
149 | } | 149 | } |
150 | |||
150 | #endregion | 151 | #endregion |
152 | |||
151 | #region Helper functions | 153 | #region Helper functions |
154 | |||
152 | private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) | 155 | private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) |
153 | { | 156 | { |
154 | |||
155 | //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); | 157 | //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); |
156 | return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; | 158 | return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; |
157 | |||
158 | } | 159 | } |
159 | 160 | ||
160 | |||
161 | #endregion | 161 | #endregion |
162 | |||
162 | #region Internal functions to keep track of script | 163 | #region Internal functions to keep track of script |
164 | |||
163 | internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID) | 165 | internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID) |
164 | { | 166 | { |
165 | if (Scripts.ContainsKey(localID) == false) | 167 | if (Scripts.ContainsKey(localID) == false) |
@@ -169,7 +171,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
169 | Scripts.TryGetValue(localID, out Obj); | 171 | Scripts.TryGetValue(localID, out Obj); |
170 | 172 | ||
171 | return Obj.Keys; | 173 | return Obj.Keys; |
172 | |||
173 | } | 174 | } |
174 | 175 | ||
175 | internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) | 176 | internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) |
@@ -187,8 +188,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
187 | Obj.TryGetValue(itemID, out Script); | 188 | Obj.TryGetValue(itemID, out Script); |
188 | 189 | ||
189 | return Script; | 190 | return Script; |
190 | |||
191 | } | 191 | } |
192 | |||
192 | internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) | 193 | internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) |
193 | { | 194 | { |
194 | // Create object if it doesn't exist | 195 | // Create object if it doesn't exist |
@@ -205,8 +206,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
205 | 206 | ||
206 | // Add to object | 207 | // Add to object |
207 | Obj.Add(itemID, Script); | 208 | Obj.Add(itemID, Script); |
208 | |||
209 | } | 209 | } |
210 | |||
210 | internal void RemoveScript(uint localID, LLUUID itemID) | 211 | internal void RemoveScript(uint localID, LLUUID itemID) |
211 | { | 212 | { |
212 | // Don't have that object? | 213 | // Don't have that object? |
@@ -218,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
218 | Scripts.TryGetValue(localID, out Obj); | 219 | Scripts.TryGetValue(localID, out Obj); |
219 | if (Obj.ContainsKey(itemID) == true) | 220 | if (Obj.ContainsKey(itemID) == true) |
220 | Obj.Remove(itemID); | 221 | Obj.Remove(itemID); |
221 | |||
222 | } | 222 | } |
223 | |||
223 | #endregion | 224 | #endregion |
225 | |||
224 | #region Start/Stop/Reset script | 226 | #region Start/Stop/Reset script |
227 | |||
225 | /// <summary> | 228 | /// <summary> |
226 | /// Fetches, loads and hooks up a script to an objects events | 229 | /// Fetches, loads and hooks up a script to an objects events |
227 | /// </summary> | 230 | /// </summary> |
@@ -235,6 +238,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
235 | ls.script = Script; | 238 | ls.script = Script; |
236 | loadQueue.Enqueue(ls); | 239 | loadQueue.Enqueue(ls); |
237 | } | 240 | } |
241 | |||
238 | /// <summary> | 242 | /// <summary> |
239 | /// Disables and unloads a script | 243 | /// Disables and unloads a script |
240 | /// </summary> | 244 | /// </summary> |
@@ -247,6 +251,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
247 | ls.itemID = itemID; | 251 | ls.itemID = itemID; |
248 | unloadQueue.Enqueue(ls); | 252 | unloadQueue.Enqueue(ls); |
249 | } | 253 | } |
254 | |||
250 | public void ResetScript(uint localID, LLUUID itemID) | 255 | public void ResetScript(uint localID, LLUUID itemID) |
251 | { | 256 | { |
252 | string script = GetScript(localID, itemID).SourceCode; | 257 | string script = GetScript(localID, itemID).SourceCode; |
@@ -267,12 +272,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
267 | 272 | ||
268 | try | 273 | try |
269 | { | 274 | { |
270 | |||
271 | |||
272 | |||
273 | |||
274 | // Create a new instance of the compiler (currently we don't want reuse) | 275 | // Create a new instance of the compiler (currently we don't want reuse) |
275 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); | 276 | Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); |
276 | // Compile (We assume LSL) | 277 | // Compile (We assume LSL) |
277 | ScriptSource = LSLCompiler.CompileFromLSLText(Script); | 278 | ScriptSource = LSLCompiler.CompileFromLSLText(Script); |
278 | //Console.WriteLine("Compilation of " + FileName + " done"); | 279 | //Console.WriteLine("Compilation of " + FileName + " done"); |
@@ -289,10 +290,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
289 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); | 290 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); |
290 | 291 | ||
291 | #if DEBUG | 292 | #if DEBUG |
292 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); | 293 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); |
293 | #endif | 294 | #endif |
294 | 295 | ||
295 | CompiledScript.SourceCode = ScriptSource; | 296 | CompiledScript.SourceCode = ScriptSource; |
296 | // Add it to our script memstruct | 297 | // Add it to our script memstruct |
297 | SetScript(localID, itemID, CompiledScript); | 298 | SetScript(localID, itemID, CompiledScript); |
298 | 299 | ||
@@ -306,9 +307,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
306 | CompiledScript.Start(LSLB); | 307 | CompiledScript.Start(LSLB); |
307 | 308 | ||
308 | // Fire the first start-event | 309 | // Fire the first start-event |
309 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); | 310 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {}); |
310 | |||
311 | |||
312 | } | 311 | } |
313 | catch (Exception e) | 312 | catch (Exception e) |
314 | { | 313 | { |
@@ -326,9 +325,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
326 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); | 325 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); |
327 | } | 326 | } |
328 | } | 327 | } |
329 | |||
330 | |||
331 | |||
332 | } | 328 | } |
333 | 329 | ||
334 | private void _StopScript(uint localID, LLUUID itemID) | 330 | private void _StopScript(uint localID, LLUUID itemID) |
@@ -359,19 +355,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
359 | // Tell AppDomain that we have stopped script | 355 | // Tell AppDomain that we have stopped script |
360 | m_scriptEngine.m_AppDomainManager.StopScript(ad); | 356 | m_scriptEngine.m_AppDomainManager.StopScript(ad); |
361 | } | 357 | } |
362 | catch(Exception e) | 358 | catch (Exception e) |
363 | { | 359 | { |
364 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString()); | 360 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + |
361 | ": " + e.ToString()); | ||
365 | } | 362 | } |
366 | } | 363 | } |
367 | private string ProcessYield(string FileName) | 364 | |
365 | private string ProcessYield(string FileName) | ||
368 | { | 366 | { |
369 | // TODO: Create a new assembly and copy old but insert Yield Code | 367 | // TODO: Create a new assembly and copy old but insert Yield Code |
370 | //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); | 368 | //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); |
371 | return FileName; | 369 | return FileName; |
372 | } | 370 | } |
371 | |||
373 | #endregion | 372 | #endregion |
373 | |||
374 | #region Perform event execution in script | 374 | #region Perform event execution in script |
375 | |||
375 | /// <summary> | 376 | /// <summary> |
376 | /// Execute a LL-event-function in Script | 377 | /// Execute a LL-event-function in Script |
377 | /// </summary> | 378 | /// </summary> |
@@ -381,7 +382,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
381 | /// <param name="args">Arguments to pass to function</param> | 382 | /// <param name="args">Arguments to pass to function</param> |
382 | internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) | 383 | internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) |
383 | { | 384 | { |
384 | |||
385 | // Execute a function in the script | 385 | // Execute a function in the script |
386 | //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); | 386 | //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); |
387 | LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); | 387 | LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); |
@@ -390,28 +390,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
390 | 390 | ||
391 | // Must be done in correct AppDomain, so leaving it up to the script itself | 391 | // Must be done in correct AppDomain, so leaving it up to the script itself |
392 | Script.Exec.ExecuteEvent(FunctionName, args); | 392 | Script.Exec.ExecuteEvent(FunctionName, args); |
393 | |||
394 | } | 393 | } |
394 | |||
395 | #endregion | 395 | #endregion |
396 | 396 | ||
397 | #region Script serialization/deserialization | 397 | #region Script serialization/deserialization |
398 | |||
398 | public void GetSerializedScript(uint localID, LLUUID itemID) | 399 | public void GetSerializedScript(uint localID, LLUUID itemID) |
399 | { | 400 | { |
400 | // Serialize the script and return it | 401 | // Serialize the script and return it |
401 | // Should not be a problem | 402 | // Should not be a problem |
402 | System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID); | 403 | FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID); |
403 | BinaryFormatter b = new BinaryFormatter(); | 404 | BinaryFormatter b = new BinaryFormatter(); |
404 | b.Serialize(fs, GetScript(localID,itemID)); | 405 | b.Serialize(fs, GetScript(localID, itemID)); |
405 | fs.Close(); | 406 | fs.Close(); |
406 | |||
407 | |||
408 | } | 407 | } |
408 | |||
409 | public void PutSerializedScript(uint localID, LLUUID itemID) | 409 | public void PutSerializedScript(uint localID, LLUUID itemID) |
410 | { | 410 | { |
411 | // Deserialize the script and inject it into an AppDomain | 411 | // Deserialize the script and inject it into an AppDomain |
412 | 412 | ||
413 | // How to inject into an AppDomain? | 413 | // How to inject into an AppDomain? |
414 | } | 414 | } |
415 | |||
415 | #endregion | 416 | #endregion |
416 | } | 417 | } |
417 | } | 418 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs index 8f935f1..072c249 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs | |||
@@ -27,12 +27,9 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.IO; |
31 | using System.Text; | ||
32 | using Rail.Transformation; | ||
33 | using Rail.Reflect; | 31 | using Rail.Reflect; |
34 | using Rail.Exceptions; | 32 | using Rail.Transformation; |
35 | using Rail.MSIL; | ||
36 | 33 | ||
37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
38 | { | 35 | { |
@@ -40,25 +37,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
40 | /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! | 37 | /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! |
41 | /// Its offspring will be the actual implementation. | 38 | /// Its offspring will be the actual implementation. |
42 | /// </summary> | 39 | /// </summary> |
43 | class TempDotNetMicroThreadingCodeInjector | 40 | internal class TempDotNetMicroThreadingCodeInjector |
44 | { | 41 | { |
45 | public static string TestFix(string FileName) | 42 | public static string TestFix(string FileName) |
46 | { | 43 | { |
47 | string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); | 44 | string ret = Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); |
48 | 45 | ||
49 | Console.WriteLine("Loading: \"" + FileName + "\""); | 46 | Console.WriteLine("Loading: \"" + FileName + "\""); |
50 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); | 47 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); |
51 | 48 | ||
52 | 49 | ||
53 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe | 50 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe |
54 | RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); | 51 | RTypeDef type = (RTypeDef) rAssembly.RModuleDef.GetType("SecondLife.Script"); |
55 | 52 | ||
56 | //Get the methods in the type | 53 | //Get the methods in the type |
57 | RMethod[] m = type.GetMethods(); | 54 | RMethod[] m = type.GetMethods(); |
58 | 55 | ||
59 | //Create a MethodPrologueAdder visitor object with the method to add | 56 | //Create a MethodPrologueAdder visitor object with the method to add |
60 | //and with the flag that enables local variable creation set to true | 57 | //and with the flag that enables local variable creation set to true |
61 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); | 58 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef) m[0], true); |
62 | 59 | ||
63 | //Apply the changes to the assembly | 60 | //Apply the changes to the assembly |
64 | rAssembly.Accept(mpa); | 61 | rAssembly.Accept(mpa); |
@@ -67,7 +64,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
67 | rAssembly.SaveAssembly(ret); | 64 | rAssembly.SaveAssembly(ret); |
68 | 65 | ||
69 | return ret; | 66 | return ret; |
70 | |||
71 | } | 67 | } |
72 | } | 68 | } |
73 | } | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 729db7e..1b16a07 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -29,10 +29,11 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Data; | 31 | using System.Data; |
32 | using System.IO; | ||
32 | using libsecondlife; | 33 | using libsecondlife; |
33 | using Mono.Data.SqliteClient; | 34 | using Mono.Data.SqliteClient; |
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.LandManagement; | 38 | using OpenSim.Region.Environment.LandManagement; |
38 | using OpenSim.Region.Environment.Scenes; | 39 | using OpenSim.Region.Environment.Scenes; |
@@ -55,6 +56,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
55 | * Public Interface Functions | 56 | * Public Interface Functions |
56 | * | 57 | * |
57 | **********************************************************************/ | 58 | **********************************************************************/ |
59 | |||
58 | public void Initialise(string dbfile, string dbname) | 60 | public void Initialise(string dbfile, string dbname) |
59 | { | 61 | { |
60 | string connectionString = "URI=file:" + dbfile + ",version=3"; | 62 | string connectionString = "URI=file:" + dbfile + ",version=3"; |
@@ -80,17 +82,18 @@ namespace OpenSim.DataStore.MonoSqlite | |||
80 | // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); | 82 | // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); |
81 | TestTables(conn); | 83 | TestTables(conn); |
82 | 84 | ||
83 | lock(ds) { | 85 | lock (ds) |
86 | { | ||
84 | ds.Tables.Add(createPrimTable()); | 87 | ds.Tables.Add(createPrimTable()); |
85 | setupPrimCommands(primDa, conn); | 88 | setupPrimCommands(primDa, conn); |
86 | primDa.Fill(ds.Tables["prims"]); | 89 | primDa.Fill(ds.Tables["prims"]); |
87 | 90 | ||
88 | ds.Tables.Add(createShapeTable()); | 91 | ds.Tables.Add(createShapeTable()); |
89 | setupShapeCommands(shapeDa, conn); | 92 | setupShapeCommands(shapeDa, conn); |
90 | 93 | ||
91 | ds.Tables.Add(createTerrainTable()); | 94 | ds.Tables.Add(createTerrainTable()); |
92 | setupTerrainCommands(terrainDa, conn); | 95 | setupTerrainCommands(terrainDa, conn); |
93 | 96 | ||
94 | // WORKAROUND: This is a work around for sqlite on | 97 | // WORKAROUND: This is a work around for sqlite on |
95 | // windows, which gets really unhappy with blob columns | 98 | // windows, which gets really unhappy with blob columns |
96 | // that have no sample data in them. At some point we | 99 | // that have no sample data in them. At some point we |
@@ -118,7 +121,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
118 | 121 | ||
119 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) | 122 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) |
120 | { | 123 | { |
121 | lock (ds) { | 124 | lock (ds) |
125 | { | ||
122 | foreach (SceneObjectPart prim in obj.Children.Values) | 126 | foreach (SceneObjectPart prim in obj.Children.Values) |
123 | { | 127 | { |
124 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); | 128 | MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); |
@@ -136,11 +140,12 @@ namespace OpenSim.DataStore.MonoSqlite | |||
136 | DataTable shapes = ds.Tables["primshapes"]; | 140 | DataTable shapes = ds.Tables["primshapes"]; |
137 | 141 | ||
138 | string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; | 142 | string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; |
139 | lock (ds) { | 143 | lock (ds) |
144 | { | ||
140 | DataRow[] primRows = prims.Select(selectExp); | 145 | DataRow[] primRows = prims.Select(selectExp); |
141 | foreach (DataRow row in primRows) | 146 | foreach (DataRow row in primRows) |
142 | { | 147 | { |
143 | LLUUID uuid = new LLUUID((string)row["UUID"]); | 148 | LLUUID uuid = new LLUUID((string) row["UUID"]); |
144 | DataRow shapeRow = shapes.Rows.Find(uuid); | 149 | DataRow shapeRow = shapes.Rows.Find(uuid); |
145 | if (shapeRow != null) | 150 | if (shapeRow != null) |
146 | { | 151 | { |
@@ -149,7 +154,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
149 | row.Delete(); | 154 | row.Delete(); |
150 | } | 155 | } |
151 | } | 156 | } |
152 | 157 | ||
153 | Commit(); | 158 | Commit(); |
154 | } | 159 | } |
155 | 160 | ||
@@ -165,16 +170,18 @@ namespace OpenSim.DataStore.MonoSqlite | |||
165 | string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; | 170 | string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; |
166 | string orderByParent = "ParentID ASC"; | 171 | string orderByParent = "ParentID ASC"; |
167 | 172 | ||
168 | lock (ds) { | 173 | lock (ds) |
174 | { | ||
169 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 175 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
170 | MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 176 | MainLog.Instance.Verbose("DATASTORE", |
171 | 177 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | |
178 | |||
172 | foreach (DataRow primRow in primsForRegion) | 179 | foreach (DataRow primRow in primsForRegion) |
173 | { | 180 | { |
174 | try | 181 | try |
175 | { | 182 | { |
176 | string uuid = (string)primRow["UUID"]; | 183 | string uuid = (string) primRow["UUID"]; |
177 | string objID = (string)primRow["SceneGroupID"]; | 184 | string objID = (string) primRow["SceneGroupID"]; |
178 | if (uuid == objID) //is new SceneObjectGroup ? | 185 | if (uuid == objID) //is new SceneObjectGroup ? |
179 | { | 186 | { |
180 | SceneObjectGroup group = new SceneObjectGroup(); | 187 | SceneObjectGroup group = new SceneObjectGroup(); |
@@ -186,12 +193,13 @@ namespace OpenSim.DataStore.MonoSqlite | |||
186 | } | 193 | } |
187 | else | 194 | else |
188 | { | 195 | { |
189 | MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); | 196 | MainLog.Instance.Notice( |
197 | "No shape found for prim in storage, so setting default box shape"); | ||
190 | prim.Shape = BoxShape.Default; | 198 | prim.Shape = BoxShape.Default; |
191 | } | 199 | } |
192 | group.AddPart(prim); | 200 | group.AddPart(prim); |
193 | group.RootPart = prim; | 201 | group.RootPart = prim; |
194 | 202 | ||
195 | createdObjects.Add(group.UUID, group); | 203 | createdObjects.Add(group.UUID, group); |
196 | retvals.Add(group); | 204 | retvals.Add(group); |
197 | } | 205 | } |
@@ -205,7 +213,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
205 | } | 213 | } |
206 | else | 214 | else |
207 | { | 215 | { |
208 | MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); | 216 | MainLog.Instance.Notice( |
217 | "No shape found for prim in storage, so setting default box shape"); | ||
209 | prim.Shape = BoxShape.Default; | 218 | prim.Shape = BoxShape.Default; |
210 | } | 219 | } |
211 | createdObjects[new LLUUID(objID)].AddPart(prim); | 220 | createdObjects[new LLUUID(objID)].AddPart(prim); |
@@ -228,46 +237,48 @@ namespace OpenSim.DataStore.MonoSqlite | |||
228 | 237 | ||
229 | public void StoreTerrain(double[,] ter, LLUUID regionID) | 238 | public void StoreTerrain(double[,] ter, LLUUID regionID) |
230 | { | 239 | { |
231 | int revision = OpenSim.Framework.Util.UnixTimeSinceEpoch(); | 240 | int revision = Util.UnixTimeSinceEpoch(); |
232 | 241 | ||
233 | MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); | 242 | MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); |
234 | 243 | ||
235 | DataTable terrain = ds.Tables["terrain"]; | 244 | DataTable terrain = ds.Tables["terrain"]; |
236 | lock (ds) { | 245 | lock (ds) |
246 | { | ||
237 | DataRow newrow = terrain.NewRow(); | 247 | DataRow newrow = terrain.NewRow(); |
238 | fillTerrainRow(newrow, regionID, revision, ter); | 248 | fillTerrainRow(newrow, regionID, revision, ter); |
239 | terrain.Rows.Add(newrow); | 249 | terrain.Rows.Add(newrow); |
240 | 250 | ||
241 | Commit(); | 251 | Commit(); |
242 | } | 252 | } |
243 | } | 253 | } |
244 | 254 | ||
245 | public double[,] LoadTerrain(LLUUID regionID) | 255 | public double[,] LoadTerrain(LLUUID regionID) |
246 | { | 256 | { |
247 | double[,] terret = new double[256, 256]; | 257 | double[,] terret = new double[256,256]; |
248 | terret.Initialize(); | 258 | terret.Initialize(); |
249 | 259 | ||
250 | DataTable terrain = ds.Tables["terrain"]; | 260 | DataTable terrain = ds.Tables["terrain"]; |
251 | 261 | ||
252 | lock (ds) { | 262 | lock (ds) |
253 | DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'","Revision DESC"); | 263 | { |
254 | 264 | DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'", "Revision DESC"); | |
265 | |||
255 | int rev = 0; | 266 | int rev = 0; |
256 | 267 | ||
257 | if (rows.Length > 0) | 268 | if (rows.Length > 0) |
258 | { | 269 | { |
259 | DataRow row = rows[0]; | 270 | DataRow row = rows[0]; |
260 | 271 | ||
261 | byte[] heightmap = (byte[])row["Heightfield"]; | 272 | byte[] heightmap = (byte[]) row["Heightfield"]; |
262 | for (int x = 0; x < 256; x++) | 273 | for (int x = 0; x < 256; x++) |
263 | { | 274 | { |
264 | for (int y = 0; y < 256; y++) | 275 | for (int y = 0; y < 256; y++) |
265 | { | 276 | { |
266 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); | 277 | terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); |
267 | } | 278 | } |
268 | } | 279 | } |
269 | 280 | ||
270 | rev = (int)row["Revision"]; | 281 | rev = (int) row["Revision"]; |
271 | } | 282 | } |
272 | else | 283 | else |
273 | { | 284 | { |
@@ -275,7 +286,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
275 | return null; | 286 | return null; |
276 | } | 287 | } |
277 | 288 | ||
278 | 289 | ||
279 | MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); | 290 | MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); |
280 | } | 291 | } |
281 | 292 | ||
@@ -284,12 +295,10 @@ namespace OpenSim.DataStore.MonoSqlite | |||
284 | 295 | ||
285 | public void RemoveLandObject(uint id) | 296 | public void RemoveLandObject(uint id) |
286 | { | 297 | { |
287 | |||
288 | } | 298 | } |
289 | 299 | ||
290 | public void StoreParcel(Land parcel) | 300 | public void StoreParcel(Land parcel) |
291 | { | 301 | { |
292 | |||
293 | } | 302 | } |
294 | 303 | ||
295 | public List<Land> LoadLandObjects() | 304 | public List<Land> LoadLandObjects() |
@@ -299,7 +308,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
299 | 308 | ||
300 | public void Commit() | 309 | public void Commit() |
301 | { | 310 | { |
302 | lock (ds) { | 311 | lock (ds) |
312 | { | ||
303 | primDa.Update(ds, "prims"); | 313 | primDa.Update(ds, "prims"); |
304 | shapeDa.Update(ds, "primshapes"); | 314 | shapeDa.Update(ds, "primshapes"); |
305 | terrainDa.Update(ds, "terrain"); | 315 | terrainDa.Update(ds, "terrain"); |
@@ -320,7 +330,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
320 | * | 330 | * |
321 | **********************************************************************/ | 331 | **********************************************************************/ |
322 | 332 | ||
323 | private void createCol(DataTable dt, string name, System.Type type) | 333 | private void createCol(DataTable dt, string name, Type type) |
324 | { | 334 | { |
325 | DataColumn col = new DataColumn(name, type); | 335 | DataColumn col = new DataColumn(name, type); |
326 | dt.Columns.Add(col); | 336 | dt.Columns.Add(col); |
@@ -330,9 +340,9 @@ namespace OpenSim.DataStore.MonoSqlite | |||
330 | { | 340 | { |
331 | DataTable terrain = new DataTable("terrain"); | 341 | DataTable terrain = new DataTable("terrain"); |
332 | 342 | ||
333 | createCol(terrain, "RegionUUID", typeof(System.String)); | 343 | createCol(terrain, "RegionUUID", typeof (String)); |
334 | createCol(terrain, "Revision", typeof(System.Int32)); | 344 | createCol(terrain, "Revision", typeof (Int32)); |
335 | createCol(terrain, "Heightfield", typeof(System.Byte[])); | 345 | createCol(terrain, "Heightfield", typeof (Byte[])); |
336 | 346 | ||
337 | return terrain; | 347 | return terrain; |
338 | } | 348 | } |
@@ -341,52 +351,52 @@ namespace OpenSim.DataStore.MonoSqlite | |||
341 | { | 351 | { |
342 | DataTable prims = new DataTable("prims"); | 352 | DataTable prims = new DataTable("prims"); |
343 | 353 | ||
344 | createCol(prims, "UUID", typeof(System.String)); | 354 | createCol(prims, "UUID", typeof (String)); |
345 | createCol(prims, "RegionUUID", typeof(System.String)); | 355 | createCol(prims, "RegionUUID", typeof (String)); |
346 | createCol(prims, "ParentID", typeof(System.Int32)); | 356 | createCol(prims, "ParentID", typeof (Int32)); |
347 | createCol(prims, "CreationDate", typeof(System.Int32)); | 357 | createCol(prims, "CreationDate", typeof (Int32)); |
348 | createCol(prims, "Name", typeof(System.String)); | 358 | createCol(prims, "Name", typeof (String)); |
349 | createCol(prims, "SceneGroupID", typeof(System.String)); | 359 | createCol(prims, "SceneGroupID", typeof (String)); |
350 | // various text fields | 360 | // various text fields |
351 | createCol(prims, "Text", typeof(System.String)); | 361 | createCol(prims, "Text", typeof (String)); |
352 | createCol(prims, "Description", typeof(System.String)); | 362 | createCol(prims, "Description", typeof (String)); |
353 | createCol(prims, "SitName", typeof(System.String)); | 363 | createCol(prims, "SitName", typeof (String)); |
354 | createCol(prims, "TouchName", typeof(System.String)); | 364 | createCol(prims, "TouchName", typeof (String)); |
355 | // permissions | 365 | // permissions |
356 | createCol(prims, "ObjectFlags", typeof(System.Int32)); | 366 | createCol(prims, "ObjectFlags", typeof (Int32)); |
357 | createCol(prims, "CreatorID", typeof(System.String)); | 367 | createCol(prims, "CreatorID", typeof (String)); |
358 | createCol(prims, "OwnerID", typeof(System.String)); | 368 | createCol(prims, "OwnerID", typeof (String)); |
359 | createCol(prims, "GroupID", typeof(System.String)); | 369 | createCol(prims, "GroupID", typeof (String)); |
360 | createCol(prims, "LastOwnerID", typeof(System.String)); | 370 | createCol(prims, "LastOwnerID", typeof (String)); |
361 | createCol(prims, "OwnerMask", typeof(System.Int32)); | 371 | createCol(prims, "OwnerMask", typeof (Int32)); |
362 | createCol(prims, "NextOwnerMask", typeof(System.Int32)); | 372 | createCol(prims, "NextOwnerMask", typeof (Int32)); |
363 | createCol(prims, "GroupMask", typeof(System.Int32)); | 373 | createCol(prims, "GroupMask", typeof (Int32)); |
364 | createCol(prims, "EveryoneMask", typeof(System.Int32)); | 374 | createCol(prims, "EveryoneMask", typeof (Int32)); |
365 | createCol(prims, "BaseMask", typeof(System.Int32)); | 375 | createCol(prims, "BaseMask", typeof (Int32)); |
366 | // vectors | 376 | // vectors |
367 | createCol(prims, "PositionX", typeof(System.Double)); | 377 | createCol(prims, "PositionX", typeof (Double)); |
368 | createCol(prims, "PositionY", typeof(System.Double)); | 378 | createCol(prims, "PositionY", typeof (Double)); |
369 | createCol(prims, "PositionZ", typeof(System.Double)); | 379 | createCol(prims, "PositionZ", typeof (Double)); |
370 | createCol(prims, "GroupPositionX", typeof(System.Double)); | 380 | createCol(prims, "GroupPositionX", typeof (Double)); |
371 | createCol(prims, "GroupPositionY", typeof(System.Double)); | 381 | createCol(prims, "GroupPositionY", typeof (Double)); |
372 | createCol(prims, "GroupPositionZ", typeof(System.Double)); | 382 | createCol(prims, "GroupPositionZ", typeof (Double)); |
373 | createCol(prims, "VelocityX", typeof(System.Double)); | 383 | createCol(prims, "VelocityX", typeof (Double)); |
374 | createCol(prims, "VelocityY", typeof(System.Double)); | 384 | createCol(prims, "VelocityY", typeof (Double)); |
375 | createCol(prims, "VelocityZ", typeof(System.Double)); | 385 | createCol(prims, "VelocityZ", typeof (Double)); |
376 | createCol(prims, "AngularVelocityX", typeof(System.Double)); | 386 | createCol(prims, "AngularVelocityX", typeof (Double)); |
377 | createCol(prims, "AngularVelocityY", typeof(System.Double)); | 387 | createCol(prims, "AngularVelocityY", typeof (Double)); |
378 | createCol(prims, "AngularVelocityZ", typeof(System.Double)); | 388 | createCol(prims, "AngularVelocityZ", typeof (Double)); |
379 | createCol(prims, "AccelerationX", typeof(System.Double)); | 389 | createCol(prims, "AccelerationX", typeof (Double)); |
380 | createCol(prims, "AccelerationY", typeof(System.Double)); | 390 | createCol(prims, "AccelerationY", typeof (Double)); |
381 | createCol(prims, "AccelerationZ", typeof(System.Double)); | 391 | createCol(prims, "AccelerationZ", typeof (Double)); |
382 | // quaternions | 392 | // quaternions |
383 | createCol(prims, "RotationX", typeof(System.Double)); | 393 | createCol(prims, "RotationX", typeof (Double)); |
384 | createCol(prims, "RotationY", typeof(System.Double)); | 394 | createCol(prims, "RotationY", typeof (Double)); |
385 | createCol(prims, "RotationZ", typeof(System.Double)); | 395 | createCol(prims, "RotationZ", typeof (Double)); |
386 | createCol(prims, "RotationW", typeof(System.Double)); | 396 | createCol(prims, "RotationW", typeof (Double)); |
387 | 397 | ||
388 | // Add in contraints | 398 | // Add in contraints |
389 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 399 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; |
390 | 400 | ||
391 | return prims; | 401 | return prims; |
392 | } | 402 | } |
@@ -394,40 +404,40 @@ namespace OpenSim.DataStore.MonoSqlite | |||
394 | private DataTable createShapeTable() | 404 | private DataTable createShapeTable() |
395 | { | 405 | { |
396 | DataTable shapes = new DataTable("primshapes"); | 406 | DataTable shapes = new DataTable("primshapes"); |
397 | createCol(shapes, "UUID", typeof(System.String)); | 407 | createCol(shapes, "UUID", typeof (String)); |
398 | // shape is an enum | 408 | // shape is an enum |
399 | createCol(shapes, "Shape", typeof(System.Int32)); | 409 | createCol(shapes, "Shape", typeof (Int32)); |
400 | // vectors | 410 | // vectors |
401 | createCol(shapes, "ScaleX", typeof(System.Double)); | 411 | createCol(shapes, "ScaleX", typeof (Double)); |
402 | createCol(shapes, "ScaleY", typeof(System.Double)); | 412 | createCol(shapes, "ScaleY", typeof (Double)); |
403 | createCol(shapes, "ScaleZ", typeof(System.Double)); | 413 | createCol(shapes, "ScaleZ", typeof (Double)); |
404 | // paths | 414 | // paths |
405 | createCol(shapes, "PCode", typeof(System.Int32)); | 415 | createCol(shapes, "PCode", typeof (Int32)); |
406 | createCol(shapes, "PathBegin", typeof(System.Int32)); | 416 | createCol(shapes, "PathBegin", typeof (Int32)); |
407 | createCol(shapes, "PathEnd", typeof(System.Int32)); | 417 | createCol(shapes, "PathEnd", typeof (Int32)); |
408 | createCol(shapes, "PathScaleX", typeof(System.Int32)); | 418 | createCol(shapes, "PathScaleX", typeof (Int32)); |
409 | createCol(shapes, "PathScaleY", typeof(System.Int32)); | 419 | createCol(shapes, "PathScaleY", typeof (Int32)); |
410 | createCol(shapes, "PathShearX", typeof(System.Int32)); | 420 | createCol(shapes, "PathShearX", typeof (Int32)); |
411 | createCol(shapes, "PathShearY", typeof(System.Int32)); | 421 | createCol(shapes, "PathShearY", typeof (Int32)); |
412 | createCol(shapes, "PathSkew", typeof(System.Int32)); | 422 | createCol(shapes, "PathSkew", typeof (Int32)); |
413 | createCol(shapes, "PathCurve", typeof(System.Int32)); | 423 | createCol(shapes, "PathCurve", typeof (Int32)); |
414 | createCol(shapes, "PathRadiusOffset", typeof(System.Int32)); | 424 | createCol(shapes, "PathRadiusOffset", typeof (Int32)); |
415 | createCol(shapes, "PathRevolutions", typeof(System.Int32)); | 425 | createCol(shapes, "PathRevolutions", typeof (Int32)); |
416 | createCol(shapes, "PathTaperX", typeof(System.Int32)); | 426 | createCol(shapes, "PathTaperX", typeof (Int32)); |
417 | createCol(shapes, "PathTaperY", typeof(System.Int32)); | 427 | createCol(shapes, "PathTaperY", typeof (Int32)); |
418 | createCol(shapes, "PathTwist", typeof(System.Int32)); | 428 | createCol(shapes, "PathTwist", typeof (Int32)); |
419 | createCol(shapes, "PathTwistBegin", typeof(System.Int32)); | 429 | createCol(shapes, "PathTwistBegin", typeof (Int32)); |
420 | // profile | 430 | // profile |
421 | createCol(shapes, "ProfileBegin", typeof(System.Int32)); | 431 | createCol(shapes, "ProfileBegin", typeof (Int32)); |
422 | createCol(shapes, "ProfileEnd", typeof(System.Int32)); | 432 | createCol(shapes, "ProfileEnd", typeof (Int32)); |
423 | createCol(shapes, "ProfileCurve", typeof(System.Int32)); | 433 | createCol(shapes, "ProfileCurve", typeof (Int32)); |
424 | createCol(shapes, "ProfileHollow", typeof(System.Int32)); | 434 | createCol(shapes, "ProfileHollow", typeof (Int32)); |
425 | // text TODO: this isn't right, but I'm not sure the right | 435 | // text TODO: this isn't right, but I'm not sure the right |
426 | // way to specify this as a blob atm | 436 | // way to specify this as a blob atm |
427 | createCol(shapes, "Texture", typeof(System.Byte[])); | 437 | createCol(shapes, "Texture", typeof (Byte[])); |
428 | createCol(shapes, "ExtraParams", typeof(System.Byte[])); | 438 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
429 | 439 | ||
430 | shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; | 440 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; |
431 | 441 | ||
432 | return shapes; | 442 | return shapes; |
433 | } | 443 | } |
@@ -446,23 +456,23 @@ namespace OpenSim.DataStore.MonoSqlite | |||
446 | // interesting has to be done to actually get these values | 456 | // interesting has to be done to actually get these values |
447 | // back out. Not enough time to figure it out yet. | 457 | // back out. Not enough time to figure it out yet. |
448 | SceneObjectPart prim = new SceneObjectPart(); | 458 | SceneObjectPart prim = new SceneObjectPart(); |
449 | prim.UUID = new LLUUID((String)row["UUID"]); | 459 | prim.UUID = new LLUUID((String) row["UUID"]); |
450 | // explicit conversion of integers is required, which sort | 460 | // explicit conversion of integers is required, which sort |
451 | // of sucks. No idea if there is a shortcut here or not. | 461 | // of sucks. No idea if there is a shortcut here or not. |
452 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); | 462 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); |
453 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | 463 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); |
454 | prim.Name = (String)row["Name"]; | 464 | prim.Name = (String) row["Name"]; |
455 | // various text fields | 465 | // various text fields |
456 | prim.Text = (String)row["Text"]; | 466 | prim.Text = (String) row["Text"]; |
457 | prim.Description = (String)row["Description"]; | 467 | prim.Description = (String) row["Description"]; |
458 | prim.SitName = (String)row["SitName"]; | 468 | prim.SitName = (String) row["SitName"]; |
459 | prim.TouchName = (String)row["TouchName"]; | 469 | prim.TouchName = (String) row["TouchName"]; |
460 | // permissions | 470 | // permissions |
461 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); | 471 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); |
462 | prim.CreatorID = new LLUUID((String)row["CreatorID"]); | 472 | prim.CreatorID = new LLUUID((String) row["CreatorID"]); |
463 | prim.OwnerID = new LLUUID((String)row["OwnerID"]); | 473 | prim.OwnerID = new LLUUID((String) row["OwnerID"]); |
464 | prim.GroupID = new LLUUID((String)row["GroupID"]); | 474 | prim.GroupID = new LLUUID((String) row["GroupID"]); |
465 | prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); | 475 | prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]); |
466 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); | 476 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); |
467 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); | 477 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); |
468 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); | 478 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); |
@@ -510,8 +520,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
510 | row["RegionUUID"] = regionUUID; | 520 | row["RegionUUID"] = regionUUID; |
511 | row["Revision"] = rev; | 521 | row["Revision"] = rev; |
512 | 522 | ||
513 | System.IO.MemoryStream str = new System.IO.MemoryStream(65536 * sizeof(double)); | 523 | MemoryStream str = new MemoryStream(65536*sizeof (double)); |
514 | System.IO.BinaryWriter bw = new System.IO.BinaryWriter(str); | 524 | BinaryWriter bw = new BinaryWriter(str); |
515 | 525 | ||
516 | // TODO: COMPATIBILITY - Add byte-order conversions | 526 | // TODO: COMPATIBILITY - Add byte-order conversions |
517 | for (int x = 0; x < 256; x++) | 527 | for (int x = 0; x < 256; x++) |
@@ -599,8 +609,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
599 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); | 609 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); |
600 | // text TODO: this isn't right] = but I'm not sure the right | 610 | // text TODO: this isn't right] = but I'm not sure the right |
601 | // way to specify this as a blob atm | 611 | // way to specify this as a blob atm |
602 | s.TextureEntry = (byte[])row["Texture"]; | 612 | s.TextureEntry = (byte[]) row["Texture"]; |
603 | s.ExtraParams = (byte[])row["ExtraParams"]; | 613 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
604 | // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); | 614 | // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); |
605 | // string texture = encoding.GetString((Byte[])row["Texture"]); | 615 | // string texture = encoding.GetString((Byte[])row["Texture"]); |
606 | // if (!texture.StartsWith("<")) | 616 | // if (!texture.StartsWith("<")) |
@@ -751,7 +761,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
751 | foreach (DataColumn col in dt.Columns) | 761 | foreach (DataColumn col in dt.Columns) |
752 | { | 762 | { |
753 | if (subsql.Length > 0) | 763 | if (subsql.Length > 0) |
754 | { // a map function would rock so much here | 764 | { |
765 | // a map function would rock so much here | ||
755 | subsql += ", "; | 766 | subsql += ", "; |
756 | } | 767 | } |
757 | subsql += col.ColumnName + "= :" + col.ColumnName; | 768 | subsql += col.ColumnName + "= :" + col.ColumnName; |
@@ -778,7 +789,8 @@ namespace OpenSim.DataStore.MonoSqlite | |||
778 | foreach (DataColumn col in dt.Columns) | 789 | foreach (DataColumn col in dt.Columns) |
779 | { | 790 | { |
780 | if (subsql.Length > 0) | 791 | if (subsql.Length > 0) |
781 | { // a map function would rock so much here | 792 | { |
793 | // a map function would rock so much here | ||
782 | subsql += ",\n"; | 794 | subsql += ",\n"; |
783 | } | 795 | } |
784 | subsql += col.ColumnName + " " + sqliteType(col.DataType); | 796 | subsql += col.ColumnName + " " + sqliteType(col.DataType); |
@@ -812,7 +824,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
812 | /// for us. | 824 | /// for us. |
813 | ///</summary> | 825 | ///</summary> |
814 | ///<returns>a built sqlite parameter</returns> | 826 | ///<returns>a built sqlite parameter</returns> |
815 | private SqliteParameter createSqliteParameter(string name, System.Type type) | 827 | private SqliteParameter createSqliteParameter(string name, Type type) |
816 | { | 828 | { |
817 | SqliteParameter param = new SqliteParameter(); | 829 | SqliteParameter param = new SqliteParameter(); |
818 | param.ParameterName = ":" + name; | 830 | param.ParameterName = ":" + name; |
@@ -831,7 +843,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
831 | da.UpdateCommand.Connection = conn; | 843 | da.UpdateCommand.Connection = conn; |
832 | 844 | ||
833 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); | 845 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); |
834 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); | 846 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); |
835 | delete.Connection = conn; | 847 | delete.Connection = conn; |
836 | da.DeleteCommand = delete; | 848 | da.DeleteCommand = delete; |
837 | } | 849 | } |
@@ -851,7 +863,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
851 | da.UpdateCommand.Connection = conn; | 863 | da.UpdateCommand.Connection = conn; |
852 | 864 | ||
853 | SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); | 865 | SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); |
854 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); | 866 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); |
855 | delete.Connection = conn; | 867 | delete.Connection = conn; |
856 | da.DeleteCommand = delete; | 868 | da.DeleteCommand = delete; |
857 | } | 869 | } |
@@ -871,8 +883,9 @@ namespace OpenSim.DataStore.MonoSqlite | |||
871 | { | 883 | { |
872 | pcmd.ExecuteNonQuery(); | 884 | pcmd.ExecuteNonQuery(); |
873 | } | 885 | } |
874 | catch (SqliteSyntaxException) { | 886 | catch (SqliteSyntaxException) |
875 | MainLog.Instance.Warn("SQLITE","Primitives Table Already Exists"); | 887 | { |
888 | MainLog.Instance.Warn("SQLITE", "Primitives Table Already Exists"); | ||
876 | } | 889 | } |
877 | 890 | ||
878 | try | 891 | try |
@@ -912,7 +925,7 @@ namespace OpenSim.DataStore.MonoSqlite | |||
912 | sDa.Fill(tmpDS, "primshapes"); | 925 | sDa.Fill(tmpDS, "primshapes"); |
913 | tDa.Fill(tmpDS, "terrain"); | 926 | tDa.Fill(tmpDS, "terrain"); |
914 | } | 927 | } |
915 | catch (Mono.Data.SqliteClient.SqliteSyntaxException) | 928 | catch (SqliteSyntaxException) |
916 | { | 929 | { |
917 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); | 930 | MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); |
918 | InitDB(conn); | 931 | InitDB(conn); |
@@ -957,27 +970,27 @@ namespace OpenSim.DataStore.MonoSqlite | |||
957 | 970 | ||
958 | private DbType dbtypeFromType(Type type) | 971 | private DbType dbtypeFromType(Type type) |
959 | { | 972 | { |
960 | if (type == typeof(System.String)) | 973 | if (type == typeof (String)) |
961 | { | 974 | { |
962 | return DbType.String; | 975 | return DbType.String; |
963 | } | 976 | } |
964 | else if (type == typeof(System.Int32)) | 977 | else if (type == typeof (Int32)) |
965 | { | 978 | { |
966 | return DbType.Int32; | 979 | return DbType.Int32; |
967 | } | 980 | } |
968 | else if (type == typeof(System.Double)) | 981 | else if (type == typeof (Double)) |
969 | { | 982 | { |
970 | return DbType.Double; | 983 | return DbType.Double; |
971 | } | 984 | } |
972 | else if (type == typeof(System.Byte)) | 985 | else if (type == typeof (Byte)) |
973 | { | 986 | { |
974 | return DbType.Byte; | 987 | return DbType.Byte; |
975 | } | 988 | } |
976 | else if (type == typeof(System.Double)) | 989 | else if (type == typeof (Double)) |
977 | { | 990 | { |
978 | return DbType.Double; | 991 | return DbType.Double; |
979 | } | 992 | } |
980 | else if (type == typeof(System.Byte[])) | 993 | else if (type == typeof (Byte[])) |
981 | { | 994 | { |
982 | return DbType.Binary; | 995 | return DbType.Binary; |
983 | } | 996 | } |
@@ -991,19 +1004,19 @@ namespace OpenSim.DataStore.MonoSqlite | |||
991 | // slightly differently. | 1004 | // slightly differently. |
992 | private string sqliteType(Type type) | 1005 | private string sqliteType(Type type) |
993 | { | 1006 | { |
994 | if (type == typeof(System.String)) | 1007 | if (type == typeof (String)) |
995 | { | 1008 | { |
996 | return "varchar(255)"; | 1009 | return "varchar(255)"; |
997 | } | 1010 | } |
998 | else if (type == typeof(System.Int32)) | 1011 | else if (type == typeof (Int32)) |
999 | { | 1012 | { |
1000 | return "integer"; | 1013 | return "integer"; |
1001 | } | 1014 | } |
1002 | else if (type == typeof(System.Double)) | 1015 | else if (type == typeof (Double)) |
1003 | { | 1016 | { |
1004 | return "float"; | 1017 | return "float"; |
1005 | } | 1018 | } |
1006 | else if (type == typeof(System.Byte[])) | 1019 | else if (type == typeof (Byte[])) |
1007 | { | 1020 | { |
1008 | return "blob"; | 1021 | return "blob"; |
1009 | } | 1022 | } |
@@ -1013,4 +1026,4 @@ namespace OpenSim.DataStore.MonoSqlite | |||
1013 | } | 1026 | } |
1014 | } | 1027 | } |
1015 | } | 1028 | } |
1016 | } | 1029 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index f726ea2..4e1f71e 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | |||
@@ -26,21 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | |||
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.Environment.LandManagement; | ||
35 | using OpenSim.Region.Environment.Interfaces; | ||
36 | using OpenSim.Framework.Console; | ||
37 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Region.Environment.Interfaces; | ||
32 | using OpenSim.Region.Environment.LandManagement; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
38 | 34 | ||
39 | namespace OpenSim.DataStore.NullStorage | 35 | namespace OpenSim.DataStore.NullStorage |
40 | { | 36 | { |
41 | public class NullDataStore : IRegionDataStore | 37 | public class NullDataStore : IRegionDataStore |
42 | { | 38 | { |
43 | |||
44 | public void Initialise(string dbfile, string dbname) | 39 | public void Initialise(string dbfile, string dbname) |
45 | { | 40 | { |
46 | return; | 41 | return; |
@@ -48,12 +43,10 @@ namespace OpenSim.DataStore.NullStorage | |||
48 | 43 | ||
49 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) | 44 | public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) |
50 | { | 45 | { |
51 | |||
52 | } | 46 | } |
53 | 47 | ||
54 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 48 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
55 | { | 49 | { |
56 | |||
57 | } | 50 | } |
58 | 51 | ||
59 | public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) | 52 | public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) |
@@ -63,7 +56,6 @@ namespace OpenSim.DataStore.NullStorage | |||
63 | 56 | ||
64 | public void StoreTerrain(double[,] ter, LLUUID regionID) | 57 | public void StoreTerrain(double[,] ter, LLUUID regionID) |
65 | { | 58 | { |
66 | |||
67 | } | 59 | } |
68 | 60 | ||
69 | public double[,] LoadTerrain(LLUUID regionID) | 61 | public double[,] LoadTerrain(LLUUID regionID) |
@@ -73,12 +65,10 @@ namespace OpenSim.DataStore.NullStorage | |||
73 | 65 | ||
74 | public void RemoveLandObject(uint id) | 66 | public void RemoveLandObject(uint id) |
75 | { | 67 | { |
76 | |||
77 | } | 68 | } |
78 | 69 | ||
79 | public void StoreParcel(Land land) | 70 | public void StoreParcel(Land land) |
80 | { | 71 | { |
81 | |||
82 | } | 72 | } |
83 | 73 | ||
84 | public List<Land> LoadLandObjects() | 74 | public List<Land> LoadLandObjects() |
@@ -88,7 +78,6 @@ namespace OpenSim.DataStore.NullStorage | |||
88 | 78 | ||
89 | public void Shutdown() | 79 | public void Shutdown() |
90 | { | 80 | { |
91 | |||
92 | } | 81 | } |
93 | } | 82 | } |
94 | } | 83 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs index fd86315..7608202 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs | |||
@@ -1,26 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
4 | 3 | ||
5 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 6 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.DataStore.NullStorage")] | 7 | |
9 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.DataStore.NullStorage")] |
10 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
11 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
12 | [assembly: AssemblyProduct("OpenSim.DataStore.NullStorage")] | 11 | [assembly : AssemblyCompany("")] |
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.DataStore.NullStorage")] |
14 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
15 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
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 | |
21 | [assembly : ComVisible(false)] | ||
21 | 22 | ||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
23 | [assembly: Guid("b4a1656d-de22-4080-a970-fd8166acbf16")] | 24 | |
25 | [assembly : Guid("b4a1656d-de22-4080-a970-fd8166acbf16")] | ||
24 | 26 | ||
25 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
26 | // | 28 | // |
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices; | |||
31 | // | 33 | // |
32 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
33 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
34 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs index e1c3191..e531f01 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs | |||
@@ -1,4 +1,4 @@ | |||
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 | * |
@@ -27,25 +27,29 @@ | |||
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | |||
30 | // General Information about an assembly is controlled through the following | 31 | // General Information about an assembly is controlled through the following |
31 | // set of attributes. Change these attribute values to modify the information | 32 | // set of attributes. Change these attribute values to modify the information |
32 | // associated with an assembly. | 33 | // associated with an assembly. |
33 | [assembly: AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")] | 34 | |
34 | [assembly: AssemblyDescription("")] | 35 | [assembly : AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")] |
35 | [assembly: AssemblyConfiguration("")] | 36 | [assembly : AssemblyDescription("")] |
36 | [assembly: AssemblyCompany("")] | 37 | [assembly : AssemblyConfiguration("")] |
37 | [assembly: AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")] | 38 | [assembly : AssemblyCompany("")] |
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | 39 | [assembly : AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")] |
39 | [assembly: AssemblyTrademark("")] | 40 | [assembly : AssemblyCopyright("Copyright © 2007")] |
40 | [assembly: AssemblyCulture("")] | 41 | [assembly : AssemblyTrademark("")] |
42 | [assembly : AssemblyCulture("")] | ||
41 | 43 | ||
42 | // Setting ComVisible to false makes the types in this assembly not visible | 44 | // Setting ComVisible to false makes the types in this assembly not visible |
43 | // to COM components. If you need to access a type in this assembly from | 45 | // to COM components. If you need to access a type in this assembly from |
44 | // COM, set the ComVisible attribute to true on that type. | 46 | // COM, set the ComVisible attribute to true on that type. |
45 | [assembly: ComVisible(false)] | 47 | |
48 | [assembly : ComVisible(false)] | ||
46 | 49 | ||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 50 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
48 | [assembly: Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")] | 51 | |
52 | [assembly : Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")] | ||
49 | 53 | ||
50 | // Version information for an assembly consists of the following four values: | 54 | // Version information for an assembly consists of the following four values: |
51 | // | 55 | // |
@@ -56,5 +60,6 @@ using System.Runtime.InteropServices; | |||
56 | // | 60 | // |
57 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
58 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
59 | [assembly: AssemblyVersion("1.0.0.0")] | 63 | |
60 | [assembly: AssemblyFileVersion("1.0.0.0")] | 64 | [assembly : AssemblyVersion("1.0.0.0")] |
65 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index c8c6e51..bbbb4d7 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -29,11 +29,11 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
32 | using System.Globalization; | ||
32 | using System.IO; | 33 | using System.IO; |
34 | using System.Threading; | ||
33 | using libTerrain; | 35 | using libTerrain; |
34 | using OpenJPEGNet; | 36 | using OpenJPEGNet; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using System.Globalization; | ||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | 38 | ||
39 | namespace OpenSim.Region.Terrain | 39 | namespace OpenSim.Region.Terrain |
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Terrain | |||
51 | 51 | ||
52 | public class TerrainEngine | 52 | public class TerrainEngine |
53 | { | 53 | { |
54 | public static System.Threading.Mutex fileIOLock = new System.Threading.Mutex(); | 54 | public static Mutex fileIOLock = new Mutex(); |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Plugin library for scripts | 57 | /// Plugin library for scripts |
@@ -95,12 +95,13 @@ namespace OpenSim.Region.Terrain | |||
95 | /// </summary> | 95 | /// </summary> |
96 | public int tainted; | 96 | public int tainted; |
97 | 97 | ||
98 | int w, h; | 98 | private int w, h; |
99 | 99 | ||
100 | /// <summary> | 100 | /// <summary> |
101 | /// Used to determine what offset to use when loading singular heightmaps across multiple sims | 101 | /// Used to determine what offset to use when loading singular heightmaps across multiple sims |
102 | /// </summary> | 102 | /// </summary> |
103 | private int offsetX; | 103 | private int offsetX; |
104 | |||
104 | private int offsetY; | 105 | private int offsetY; |
105 | 106 | ||
106 | 107 | ||
@@ -139,13 +140,13 @@ namespace OpenSim.Region.Terrain | |||
139 | 140 | ||
140 | public bool Tainted(int x, int y) | 141 | public bool Tainted(int x, int y) |
141 | { | 142 | { |
142 | return (heightmap.diff[x / 16, y / 16] != 0); | 143 | return (heightmap.diff[x/16, y/16] != 0); |
143 | } | 144 | } |
144 | 145 | ||
145 | public void ResetTaint() | 146 | public void ResetTaint() |
146 | { | 147 | { |
147 | tainted = 0; | 148 | tainted = 0; |
148 | heightmap.diff = new int[w / 16, h / 16]; | 149 | heightmap.diff = new int[w/16,h/16]; |
149 | } | 150 | } |
150 | 151 | ||
151 | //Testing to see if moving the TerraForming packet handling code into here works well | 152 | //Testing to see if moving the TerraForming packet handling code into here works well |
@@ -158,40 +159,40 @@ namespace OpenSim.Region.Terrain | |||
158 | /// <param name="action">The action to be performed</param> | 159 | /// <param name="action">The action to be performed</param> |
159 | /// <param name="north">Distance from the north border where the cursor is located</param> | 160 | /// <param name="north">Distance from the north border where the cursor is located</param> |
160 | /// <param name="west">Distance from the west border where the cursor is located</param> | 161 | /// <param name="west">Distance from the west border where the cursor is located</param> |
161 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser) | 162 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, |
163 | IClientAPI remoteUser) | ||
162 | { | 164 | { |
163 | |||
164 | // Shiny. | 165 | // Shiny. |
165 | double size = (double)(1 << brushsize); | 166 | double size = (double) (1 << brushsize); |
166 | 167 | ||
167 | switch (action) | 168 | switch (action) |
168 | { | 169 | { |
169 | case 0: | 170 | case 0: |
170 | // flatten terrain | 171 | // flatten terrain |
171 | this.FlattenTerrain(west, north, size, (double)seconds / 5.0); | 172 | FlattenTerrain(west, north, size, (double) seconds/5.0); |
172 | break; | 173 | break; |
173 | case 1: | 174 | case 1: |
174 | // raise terrain | 175 | // raise terrain |
175 | this.RaiseTerrain(west, north, size, (double)seconds / 5.0); | 176 | RaiseTerrain(west, north, size, (double) seconds/5.0); |
176 | break; | 177 | break; |
177 | case 2: | 178 | case 2: |
178 | //lower terrain | 179 | //lower terrain |
179 | this.LowerTerrain(west, north, size, (double)seconds / 5.0); | 180 | LowerTerrain(west, north, size, (double) seconds/5.0); |
180 | break; | 181 | break; |
181 | case 3: | 182 | case 3: |
182 | // smooth terrain | 183 | // smooth terrain |
183 | this.SmoothTerrain(west, north, size, (double)seconds / 5.0); | 184 | SmoothTerrain(west, north, size, (double) seconds/5.0); |
184 | break; | 185 | break; |
185 | case 4: | 186 | case 4: |
186 | // noise | 187 | // noise |
187 | this.NoiseTerrain(west, north, size, (double)seconds / 5.0); | 188 | NoiseTerrain(west, north, size, (double) seconds/5.0); |
188 | break; | 189 | break; |
189 | case 5: | 190 | case 5: |
190 | // revert | 191 | // revert |
191 | this.RevertTerrain(west, north, size, (double)seconds / 5.0); | 192 | RevertTerrain(west, north, size, (double) seconds/5.0); |
192 | break; | 193 | break; |
193 | 194 | ||
194 | // CLIENT EXTENSIONS GO HERE | 195 | // CLIENT EXTENSIONS GO HERE |
195 | case 128: | 196 | case 128: |
196 | // erode-thermal | 197 | // erode-thermal |
197 | break; | 198 | break; |
@@ -207,9 +208,9 @@ namespace OpenSim.Region.Terrain | |||
207 | { | 208 | { |
208 | for (int y = 0; y < 16; y++) | 209 | for (int y = 0; y < 16; y++) |
209 | { | 210 | { |
210 | if (this.Tainted(x * 16, y * 16)) | 211 | if (Tainted(x*16, y*16)) |
211 | { | 212 | { |
212 | remoteUser.SendLayerData(x, y, this.GetHeights1D()); | 213 | remoteUser.SendLayerData(x, y, GetHeights1D()); |
213 | } | 214 | } |
214 | } | 215 | } |
215 | } | 216 | } |
@@ -249,12 +250,12 @@ namespace OpenSim.Region.Terrain | |||
249 | /// <returns>A float[65536] array containing the heightmap</returns> | 250 | /// <returns>A float[65536] array containing the heightmap</returns> |
250 | public float[] GetHeights1D() | 251 | public float[] GetHeights1D() |
251 | { | 252 | { |
252 | float[] heights = new float[w * h]; | 253 | float[] heights = new float[w*h]; |
253 | int i; | 254 | int i; |
254 | 255 | ||
255 | for (i = 0; i < w * h; i++) | 256 | for (i = 0; i < w*h; i++) |
256 | { | 257 | { |
257 | heights[i] = (float)heightmap.map[i % w, i / w]; | 258 | heights[i] = (float) heightmap.map[i%w, i/w]; |
258 | } | 259 | } |
259 | 260 | ||
260 | return heights; | 261 | return heights; |
@@ -266,13 +267,13 @@ namespace OpenSim.Region.Terrain | |||
266 | /// <returns>An array of 256,256 values containing the heightmap</returns> | 267 | /// <returns>An array of 256,256 values containing the heightmap</returns> |
267 | public float[,] GetHeights2D() | 268 | public float[,] GetHeights2D() |
268 | { | 269 | { |
269 | float[,] heights = new float[w, h]; | 270 | float[,] heights = new float[w,h]; |
270 | int x, y; | 271 | int x, y; |
271 | for (x = 0; x < w; x++) | 272 | for (x = 0; x < w; x++) |
272 | { | 273 | { |
273 | for (y = 0; y < h; y++) | 274 | for (y = 0; y < h; y++) |
274 | { | 275 | { |
275 | heights[x, y] = (float)heightmap.map[x, y]; | 276 | heights[x, y] = (float) heightmap.map[x, y]; |
276 | } | 277 | } |
277 | } | 278 | } |
278 | return heights; | 279 | return heights; |
@@ -294,9 +295,9 @@ namespace OpenSim.Region.Terrain | |||
294 | public void GetHeights1D(float[] heights) | 295 | public void GetHeights1D(float[] heights) |
295 | { | 296 | { |
296 | int i; | 297 | int i; |
297 | for (i = 0; i < w * h; i++) | 298 | for (i = 0; i < w*h; i++) |
298 | { | 299 | { |
299 | heightmap.map[i % w, i / w] = heights[i]; | 300 | heightmap.map[i%w, i/w] = heights[i]; |
300 | } | 301 | } |
301 | 302 | ||
302 | tainted++; | 303 | tainted++; |
@@ -313,7 +314,7 @@ namespace OpenSim.Region.Terrain | |||
313 | { | 314 | { |
314 | for (y = 0; y < h; y++) | 315 | for (y = 0; y < h; y++) |
315 | { | 316 | { |
316 | heightmap.Set(x, y, (double)heights[x, y]); | 317 | heightmap.Set(x, y, (double) heights[x, y]); |
317 | } | 318 | } |
318 | } | 319 | } |
319 | SaveRevertMap(); | 320 | SaveRevertMap(); |
@@ -376,28 +377,36 @@ namespace OpenSim.Region.Terrain | |||
376 | 377 | ||
377 | try | 378 | try |
378 | { | 379 | { |
379 | |||
380 | switch (command) | 380 | switch (command) |
381 | { | 381 | { |
382 | case "help": | 382 | case "help": |
383 | resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; | 383 | resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; |
384 | resultText += "terrain hills <type> <number of hills> <min height> <max height> <island t/f> <additive t/f> <noisy t/f>\n"; | 384 | resultText += |
385 | "terrain hills <type> <number of hills> <min height> <max height> <island t/f> <additive t/f> <noisy t/f>\n"; | ||
385 | resultText += " type should be spheres, blocks, cones, or squared\n"; | 386 | resultText += " type should be spheres, blocks, cones, or squared\n"; |
386 | resultText += "terrain voronoi <points> <blocksize> - generates a worley fractal with X points per block"; | 387 | resultText += |
388 | "terrain voronoi <points> <blocksize> - generates a worley fractal with X points per block"; | ||
387 | resultText += "terrain seed <seed> - sets the random seed value to <seed>\n"; | 389 | resultText += "terrain seed <seed> - sets the random seed value to <seed>\n"; |
388 | resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; | 390 | resultText += |
389 | resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n"; | 391 | "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; |
390 | resultText += "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n"; | 392 | resultText += |
391 | resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n"; | 393 | "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n"; |
394 | resultText += | ||
395 | "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n"; | ||
396 | resultText += | ||
397 | "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n"; | ||
392 | resultText += "terrain fill <val> - fills a terrain at the specified height\n"; | 398 | resultText += "terrain fill <val> - fills a terrain at the specified height\n"; |
393 | resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest t/f> <fluid dynamics t/f>\n"; | 399 | resultText += |
400 | "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest t/f> <fluid dynamics t/f>\n"; | ||
394 | resultText += "terrain erode thermal <talus> <rounds> <carry>\n"; | 401 | resultText += "terrain erode thermal <talus> <rounds> <carry>\n"; |
395 | resultText += "terrain erode hydraulic <rain> <evaporation> <solubility> <frequency> <rounds>\n"; | 402 | resultText += "terrain erode hydraulic <rain> <evaporation> <solubility> <frequency> <rounds>\n"; |
396 | resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; | 403 | resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; |
397 | resultText += "terrain revert - reverts the terrain to the stored original\n"; | 404 | resultText += "terrain revert - reverts the terrain to the stored original\n"; |
398 | resultText += "terrain bake - saves the current terrain into the revert map\n"; | 405 | resultText += "terrain bake - saves the current terrain into the revert map\n"; |
399 | resultText += "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n"; | 406 | resultText += |
400 | resultText += "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n"; | 407 | "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n"; |
408 | resultText += | ||
409 | "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n"; | ||
401 | foreach (KeyValuePair<string, ITerrainFilter> filter in customFilters.filters) | 410 | foreach (KeyValuePair<string, ITerrainFilter> filter in customFilters.filters) |
402 | { | 411 | { |
403 | resultText += filter.Value.Help(); | 412 | resultText += filter.Value.Help(); |
@@ -466,8 +475,8 @@ namespace OpenSim.Region.Terrain | |||
466 | 475 | ||
467 | case "load": | 476 | case "load": |
468 | string filenameL = args[2].Replace("%name%", simName); | 477 | string filenameL = args[2].Replace("%name%", simName); |
469 | filenameL = filenameL.Replace("%x%", this.offsetX.ToString()); | 478 | filenameL = filenameL.Replace("%x%", offsetX.ToString()); |
470 | filenameL = filenameL.Replace("%y%", this.offsetY.ToString()); | 479 | filenameL = filenameL.Replace("%y%", offsetY.ToString()); |
471 | 480 | ||
472 | switch (args[1].ToLower()) | 481 | switch (args[1].ToLower()) |
473 | { | 482 | { |
@@ -499,11 +508,11 @@ namespace OpenSim.Region.Terrain | |||
499 | { | 508 | { |
500 | case "f32": | 509 | case "f32": |
501 | LoadFromFileF32(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), | 510 | LoadFromFileF32(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), |
502 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | 511 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); |
503 | break; | 512 | break; |
504 | case "img": | 513 | case "img": |
505 | LoadFromFileIMG(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), | 514 | LoadFromFileIMG(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), |
506 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | 515 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); |
507 | break; | 516 | break; |
508 | default: | 517 | default: |
509 | resultText = "Unknown or unsupported image or data format"; | 518 | resultText = "Unknown or unsupported image or data format"; |
@@ -513,8 +522,8 @@ namespace OpenSim.Region.Terrain | |||
513 | 522 | ||
514 | case "save": | 523 | case "save": |
515 | string filename = args[2].Replace("%name%", simName); | 524 | string filename = args[2].Replace("%name%", simName); |
516 | filename = filename.Replace("%x%", this.offsetX.ToString()); | 525 | filename = filename.Replace("%x%", offsetX.ToString()); |
517 | filename = filename.Replace("%y%", this.offsetY.ToString()); | 526 | filename = filename.Replace("%y%", offsetY.ToString()); |
518 | 527 | ||
519 | switch (args[1].ToLower()) | 528 | switch (args[1].ToLower()) |
520 | { | 529 | { |
@@ -589,15 +598,20 @@ namespace OpenSim.Region.Terrain | |||
589 | { | 598 | { |
590 | case "aerobic": | 599 | case "aerobic": |
591 | // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest | 600 | // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest |
592 | heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), Convert.ToBoolean(args[8])); | 601 | heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), |
602 | Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), | ||
603 | Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), | ||
604 | Convert.ToBoolean(args[8])); | ||
593 | break; | 605 | break; |
594 | case "thermal": | 606 | case "thermal": |
595 | heightmap.ThermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); | 607 | heightmap.ThermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), |
608 | Convert.ToDouble(args[4])); | ||
596 | break; | 609 | break; |
597 | case "hydraulic": | 610 | case "hydraulic": |
598 | Channel rainMap = new Channel(w, h); | 611 | Channel rainMap = new Channel(w, h); |
599 | rainMap.Fill(Convert.ToDouble(args[2])); | 612 | rainMap.Fill(Convert.ToDouble(args[2])); |
600 | heightmap.HydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | 613 | heightmap.HydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), |
614 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | ||
601 | break; | 615 | break; |
602 | default: | 616 | default: |
603 | resultText = "Unknown erosion type"; | 617 | resultText = "Unknown erosion type"; |
@@ -624,8 +638,10 @@ namespace OpenSim.Region.Terrain | |||
624 | if (args.GetLength(0) > 2) | 638 | if (args.GetLength(0) > 2) |
625 | { | 639 | { |
626 | int.TryParse(args[2].ToString(), out count); | 640 | int.TryParse(args[2].ToString(), out count); |
627 | double.TryParse(args[3].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeMin); | 641 | double.TryParse(args[3].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, |
628 | double.TryParse(args[4].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeRange); | 642 | out sizeMin); |
643 | double.TryParse(args[4].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | ||
644 | out sizeRange); | ||
629 | bool.TryParse(args[5].ToString(), out island); | 645 | bool.TryParse(args[5].ToString(), out island); |
630 | bool.TryParse(args[6].ToString(), out additive); | 646 | bool.TryParse(args[6].ToString(), out additive); |
631 | bool.TryParse(args[7].ToString(), out noisy); | 647 | bool.TryParse(args[7].ToString(), out noisy); |
@@ -669,7 +685,7 @@ namespace OpenSim.Region.Terrain | |||
669 | /// <param name="max">Maximum value of the new array</param> | 685 | /// <param name="max">Maximum value of the new array</param> |
670 | public void SetRange(float min, float max) | 686 | public void SetRange(float min, float max) |
671 | { | 687 | { |
672 | heightmap.Normalise((double)min, (double)max); | 688 | heightmap.Normalise((double) min, (double) max); |
673 | tainted++; | 689 | tainted++; |
674 | } | 690 | } |
675 | 691 | ||
@@ -713,7 +729,7 @@ namespace OpenSim.Region.Terrain | |||
713 | { | 729 | { |
714 | for (x = 0; x < w; x++) | 730 | for (x = 0; x < w; x++) |
715 | { | 731 | { |
716 | heightmap.map[x, y] = (double)bs.ReadSingle(); | 732 | heightmap.map[x, y] = (double) bs.ReadSingle(); |
717 | } | 733 | } |
718 | } | 734 | } |
719 | 735 | ||
@@ -736,11 +752,10 @@ namespace OpenSim.Region.Terrain | |||
736 | fileIOLock.WaitOne(); | 752 | fileIOLock.WaitOne(); |
737 | try | 753 | try |
738 | { | 754 | { |
755 | int sectionToLoadX = ((offsetX - lowerboundX)*w); | ||
756 | int sectionToLoadY = ((offsetY - lowerboundY)*h); | ||
739 | 757 | ||
740 | int sectionToLoadX = ((this.offsetX - lowerboundX) * this.w); | 758 | double[,] tempMap = new double[dimensionX,dimensionY]; |
741 | int sectionToLoadY = ((this.offsetY - lowerboundY) * this.h); | ||
742 | |||
743 | double[,] tempMap = new double[dimensionX, dimensionY]; | ||
744 | 759 | ||
745 | FileInfo file = new FileInfo(filename); | 760 | FileInfo file = new FileInfo(filename); |
746 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 761 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
@@ -751,7 +766,7 @@ namespace OpenSim.Region.Terrain | |||
751 | { | 766 | { |
752 | for (y = 0; y < dimensionY; y++) | 767 | for (y = 0; y < dimensionY; y++) |
753 | { | 768 | { |
754 | tempMap[x, y] = (double)bs.ReadSingle(); | 769 | tempMap[x, y] = (double) bs.ReadSingle(); |
755 | } | 770 | } |
756 | } | 771 | } |
757 | 772 | ||
@@ -784,19 +799,19 @@ namespace OpenSim.Region.Terrain | |||
784 | /// <param name="lowerboundY">Where sim coords begin for this patch</param> | 799 | /// <param name="lowerboundY">Where sim coords begin for this patch</param> |
785 | public void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY) | 800 | public void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY) |
786 | { | 801 | { |
787 | int sectionToLoadX = ((this.offsetX - lowerboundX) * this.w); | 802 | int sectionToLoadX = ((offsetX - lowerboundX)*w); |
788 | int sectionToLoadY = ((this.offsetY - lowerboundY) * this.h); | 803 | int sectionToLoadY = ((offsetY - lowerboundY)*h); |
789 | 804 | ||
790 | double[,] tempMap = new double[dimensionX, dimensionY]; | 805 | double[,] tempMap = new double[dimensionX,dimensionY]; |
791 | 806 | ||
792 | System.Drawing.Bitmap lgrBmp = new Bitmap(filename); | 807 | Bitmap lgrBmp = new Bitmap(filename); |
793 | 808 | ||
794 | int x, y; | 809 | int x, y; |
795 | for (x = 0; x < dimensionX; x++) | 810 | for (x = 0; x < dimensionX; x++) |
796 | { | 811 | { |
797 | for (y = 0; y < dimensionY; y++) | 812 | for (y = 0; y < dimensionY; y++) |
798 | { | 813 | { |
799 | tempMap[x, y] = (float)lgrBmp.GetPixel(x, y).GetBrightness(); | 814 | tempMap[x, y] = (float) lgrBmp.GetPixel(x, y).GetBrightness(); |
800 | } | 815 | } |
801 | } | 816 | } |
802 | 817 | ||
@@ -826,7 +841,7 @@ namespace OpenSim.Region.Terrain | |||
826 | { | 841 | { |
827 | for (x = 0; x < w; x++) | 842 | for (x = 0; x < w; x++) |
828 | { | 843 | { |
829 | heightmap.map[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0); | 844 | heightmap.map[x, y] = (double) bs.ReadByte()*((double) bs.ReadByte()/127.0); |
830 | bs.ReadBytes(11); // Advance the stream to next bytes. | 845 | bs.ReadBytes(11); // Advance the stream to next bytes. |
831 | } | 846 | } |
832 | } | 847 | } |
@@ -875,7 +890,7 @@ namespace OpenSim.Region.Terrain | |||
875 | { | 890 | { |
876 | for (x = 0; x < w; x++) | 891 | for (x = 0; x < w; x++) |
877 | { | 892 | { |
878 | bs.Write((float)heightmap.Get(x, y)); | 893 | bs.Write((float) heightmap.Get(x, y)); |
879 | } | 894 | } |
880 | } | 895 | } |
881 | 896 | ||
@@ -897,27 +912,27 @@ namespace OpenSim.Region.Terrain | |||
897 | int x, y; | 912 | int x, y; |
898 | 913 | ||
899 | // Used for the 'green' channel. | 914 | // Used for the 'green' channel. |
900 | byte avgMultiplier = (byte)heightmap.Avg(); | 915 | byte avgMultiplier = (byte) heightmap.Avg(); |
901 | byte backupMultiplier = (byte)revertmap.Avg(); | 916 | byte backupMultiplier = (byte) revertmap.Avg(); |
902 | 917 | ||
903 | // Limit the multiplier so it can represent points >64m. | 918 | // Limit the multiplier so it can represent points >64m. |
904 | if (avgMultiplier > 196) | 919 | if (avgMultiplier > 196) |
905 | avgMultiplier = 196; | 920 | avgMultiplier = 196; |
906 | if(backupMultiplier > 196) | 921 | if (backupMultiplier > 196) |
907 | backupMultiplier = 196; | 922 | backupMultiplier = 196; |
908 | // Make sure it's at least one to prevent a div by zero | 923 | // Make sure it's at least one to prevent a div by zero |
909 | if (avgMultiplier < 1) | 924 | if (avgMultiplier < 1) |
910 | avgMultiplier = 1; | 925 | avgMultiplier = 1; |
911 | if(backupMultiplier < 1) | 926 | if (backupMultiplier < 1) |
912 | backupMultiplier = 1; | 927 | backupMultiplier = 1; |
913 | 928 | ||
914 | for (y = 0; y < h; y++) | 929 | for (y = 0; y < h; y++) |
915 | { | 930 | { |
916 | for (x = 0; x < h; x++) | 931 | for (x = 0; x < h; x++) |
917 | { | 932 | { |
918 | byte red = (byte)(heightmap.Get(x, y) / ((double)avgMultiplier / 128.0)); | 933 | byte red = (byte) (heightmap.Get(x, y)/((double) avgMultiplier/128.0)); |
919 | byte green = avgMultiplier; | 934 | byte green = avgMultiplier; |
920 | byte blue = (byte)watermap.Get(x, y); | 935 | byte blue = (byte) watermap.Get(x, y); |
921 | byte alpha1 = 0; // Land Parcels | 936 | byte alpha1 = 0; // Land Parcels |
922 | byte alpha2 = 0; // For Sale Land | 937 | byte alpha2 = 0; // For Sale Land |
923 | byte alpha3 = 0; // Public Edit Object | 938 | byte alpha3 = 0; // Public Edit Object |
@@ -926,7 +941,7 @@ namespace OpenSim.Region.Terrain | |||
926 | byte alpha6 = 255; // Flying Allowed | 941 | byte alpha6 = 255; // Flying Allowed |
927 | byte alpha7 = 255; // Create Landmark | 942 | byte alpha7 = 255; // Create Landmark |
928 | byte alpha8 = 255; // Outside Scripts | 943 | byte alpha8 = 255; // Outside Scripts |
929 | byte alpha9 = (byte)(revertmap.Get(x, y) / ((double)backupMultiplier / 128.0)); | 944 | byte alpha9 = (byte) (revertmap.Get(x, y)/((double) backupMultiplier/128.0)); |
930 | byte alpha10 = backupMultiplier; | 945 | byte alpha10 = backupMultiplier; |
931 | 946 | ||
932 | binStream.Write(red); | 947 | binStream.Write(red); |
@@ -966,7 +981,7 @@ namespace OpenSim.Region.Terrain | |||
966 | { | 981 | { |
967 | for (j = 0; j < 256; j++) | 982 | for (j = 0; j < 256; j++) |
968 | { | 983 | { |
969 | lookupHeightTable[i + (j * 256)] = ((double)i * ((double)j / 127.0)); | 984 | lookupHeightTable[i + (j*256)] = ((double) i*((double) j/127.0)); |
970 | } | 985 | } |
971 | } | 986 | } |
972 | 987 | ||
@@ -988,9 +1003,9 @@ namespace OpenSim.Region.Terrain | |||
988 | } | 1003 | } |
989 | } | 1004 | } |
990 | 1005 | ||
991 | byte red = (byte)(index & 0xFF); | 1006 | byte red = (byte) (index & 0xFF); |
992 | byte green = (byte)((index >> 8) & 0xFF); | 1007 | byte green = (byte) ((index >> 8) & 0xFF); |
993 | byte blue = (byte)watermap.Get(x, y); | 1008 | byte blue = (byte) watermap.Get(x, y); |
994 | byte alpha1 = 0; // Land Parcels | 1009 | byte alpha1 = 0; // Land Parcels |
995 | byte alpha2 = 0; // For Sale Land | 1010 | byte alpha2 = 0; // For Sale Land |
996 | byte alpha3 = 0; // Public Edit Object | 1011 | byte alpha3 = 0; // Public Edit Object |
@@ -1140,7 +1155,7 @@ namespace OpenSim.Region.Terrain | |||
1140 | smoothed.Smooth(amount); | 1155 | smoothed.Smooth(amount); |
1141 | 1156 | ||
1142 | Channel mask = new Channel(); | 1157 | Channel mask = new Channel(); |
1143 | mask.Raise(rx,ry,size,amount); | 1158 | mask.Raise(rx, ry, size, amount); |
1144 | 1159 | ||
1145 | heightmap.Blend(smoothed, mask); | 1160 | heightmap.Blend(smoothed, mask); |
1146 | } | 1161 | } |
@@ -1221,8 +1236,7 @@ namespace OpenSim.Region.Terrain | |||
1221 | { | 1236 | { |
1222 | Bitmap bmp = TerrainToBitmap(gradientmap); | 1237 | Bitmap bmp = TerrainToBitmap(gradientmap); |
1223 | 1238 | ||
1224 | imageData = OpenJPEG.EncodeFromImage(bmp, true ); | 1239 | imageData = OpenJPEG.EncodeFromImage(bmp, true); |
1225 | |||
1226 | } | 1240 | } |
1227 | catch (Exception e) | 1241 | catch (Exception e) |
1228 | { | 1242 | { |
@@ -1252,12 +1266,11 @@ namespace OpenSim.Region.Terrain | |||
1252 | for (int x = 0; x < copy.w; x++) | 1266 | for (int x = 0; x < copy.w; x++) |
1253 | { | 1267 | { |
1254 | // 512 is the largest possible height before colours clamp | 1268 | // 512 is the largest possible height before colours clamp |
1255 | int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(x, y) / 512.0), 0.0) * (pallete - 1)); | 1269 | int colorindex = (int) (Math.Max(Math.Min(1.0, copy.Get(x, y)/512.0), 0.0)*(pallete - 1)); |
1256 | bmp.SetPixel(x, y, colours[colorindex]); | 1270 | bmp.SetPixel(x, y, colours[colorindex]); |
1257 | } | 1271 | } |
1258 | } | 1272 | } |
1259 | return bmp; | 1273 | return bmp; |
1260 | } | 1274 | } |
1261 | |||
1262 | } | 1275 | } |
1263 | } | 1276 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs index 2ae55f0..8c29c6a 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs | |||
@@ -87,11 +87,12 @@ namespace OpenSim.Region.Terrain | |||
87 | { | 87 | { |
88 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) | 88 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) |
89 | { | 89 | { |
90 | Type testInterface = pluginType.GetInterface("ITerrainFilter",true); | 90 | Type testInterface = pluginType.GetInterface("ITerrainFilter", true); |
91 | 91 | ||
92 | if (testInterface != null) | 92 | if (testInterface != null) |
93 | { | 93 | { |
94 | ITerrainFilter filter = (ITerrainFilter)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | 94 | ITerrainFilter filter = |
95 | (ITerrainFilter) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | ||
95 | 96 | ||
96 | string filterName = filter.Register(); | 97 | string filterName = filter.Register(); |
97 | Console.WriteLine("Plugin: " + filterName + " loaded."); | 98 | Console.WriteLine("Plugin: " + filterName + " loaded."); |
@@ -107,7 +108,6 @@ namespace OpenSim.Region.Terrain | |||
107 | } | 108 | } |
108 | } | 109 | } |
109 | } | 110 | } |
110 | |||
111 | } | 111 | } |
112 | 112 | ||
113 | public void LoadFilterCSharp(string filename) | 113 | public void LoadFilterCSharp(string filename) |
@@ -122,4 +122,4 @@ namespace OpenSim.Region.Terrain | |||
122 | LoadFilter(compiler, filename); | 122 | LoadFilter(compiler, filename); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs index 8359f8e..8b5fbed 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs | |||
@@ -26,18 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Drawing; | 29 | using System.Drawing; |
30 | using System.Drawing.Imaging; | ||
33 | 31 | ||
34 | namespace libTerrain | 32 | namespace libTerrain |
35 | { | 33 | { |
36 | class Raster | 34 | internal class Raster |
37 | { | 35 | { |
38 | int w; | 36 | private int w; |
39 | int h; | 37 | private int h; |
40 | Bitmap bmp; | 38 | private Bitmap bmp; |
41 | 39 | ||
42 | /// <summary> | 40 | /// <summary> |
43 | /// Creates a new Raster channel for use with bitmap or GDI functions | 41 | /// Creates a new Raster channel for use with bitmap or GDI functions |
@@ -48,7 +46,7 @@ namespace libTerrain | |||
48 | { | 46 | { |
49 | w = width; | 47 | w = width; |
50 | h = height; | 48 | h = height; |
51 | bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 49 | bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb); |
52 | } | 50 | } |
53 | 51 | ||
54 | /// <summary> | 52 | /// <summary> |
@@ -65,7 +63,7 @@ namespace libTerrain | |||
65 | for (y = 0; y < bmp.Height; y++) | 63 | for (y = 0; y < bmp.Height; y++) |
66 | { | 64 | { |
67 | Color val = bmp.GetPixel(x, y); | 65 | Color val = bmp.GetPixel(x, y); |
68 | chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; | 66 | chan.map[x, y] = (((double) val.R + (double) val.G + (double) val.B)/3.0)/255.0; |
69 | } | 67 | } |
70 | } | 68 | } |
71 | 69 | ||
@@ -86,7 +84,7 @@ namespace libTerrain | |||
86 | sf.LineAlignment = StringAlignment.Center; | 84 | sf.LineAlignment = StringAlignment.Center; |
87 | 85 | ||
88 | Graphics gd = Graphics.FromImage(bmp); | 86 | Graphics gd = Graphics.FromImage(bmp); |
89 | gd.DrawString(txt, new Font(font, (float)size), new SolidBrush(Color.White), area, sf); | 87 | gd.DrawString(txt, new Font(font, (float) size), new SolidBrush(Color.White), area, sf); |
90 | } | 88 | } |
91 | } | 89 | } |
92 | } | 90 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs index 093bfb1..4cb70c2 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs | |||
@@ -26,12 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | /* Channel |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | |||
34 | /* Channel | ||
35 | * A channel is a single heightmap array | 30 | * A channel is a single heightmap array |
36 | * */ | 31 | * */ |
37 | 32 | ||
@@ -50,17 +45,16 @@ namespace libTerrain | |||
50 | { | 45 | { |
51 | w = 256; | 46 | w = 256; |
52 | h = 256; | 47 | h = 256; |
53 | map = new double[w, h]; | 48 | map = new double[w,h]; |
54 | diff = new int[(int)(w / 16), (int)(h / 16)]; | 49 | diff = new int[(int) (w/16),(int) (h/16)]; |
55 | } | 50 | } |
56 | 51 | ||
57 | public Channel(int width, int height) | 52 | public Channel(int width, int height) |
58 | { | 53 | { |
59 | w = width; | 54 | w = width; |
60 | h = height; | 55 | h = height; |
61 | map = new double[w, h]; | 56 | map = new double[w,h]; |
62 | diff = new int[(int)(w / 16), (int)(h / 16)]; | 57 | diff = new int[(int) (w/16),(int) (h/16)]; |
63 | } | 58 | } |
64 | |||
65 | } | 59 | } |
66 | } | 60 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs index 730f206..2ad784b 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | 31 | ||
34 | namespace libTerrain | 32 | namespace libTerrain |
35 | { | 33 | { |
@@ -39,6 +37,7 @@ namespace libTerrain | |||
39 | { | 37 | { |
40 | return w; | 38 | return w; |
41 | } | 39 | } |
40 | |||
42 | public int GetHeight() | 41 | public int GetHeight() |
43 | { | 42 | { |
44 | return h; | 43 | return h; |
@@ -47,7 +46,7 @@ namespace libTerrain | |||
47 | public Channel Copy() | 46 | public Channel Copy() |
48 | { | 47 | { |
49 | Channel x = new Channel(w, h); | 48 | Channel x = new Channel(w, h); |
50 | x.map = (double[,])this.map.Clone(); | 49 | x.map = (double[,]) map.Clone(); |
51 | return x; | 50 | return x; |
52 | } | 51 | } |
53 | 52 | ||
@@ -58,9 +57,9 @@ namespace libTerrain | |||
58 | 57 | ||
59 | public void SetDiff(int val) | 58 | public void SetDiff(int val) |
60 | { | 59 | { |
61 | for (int x = 0; x < w / 16; x++) | 60 | for (int x = 0; x < w/16; x++) |
62 | { | 61 | { |
63 | for (int y = 0; y < h / 16; y++) | 62 | for (int y = 0; y < h/16; y++) |
64 | { | 63 | { |
65 | diff[x, y] = val; | 64 | diff[x, y] = val; |
66 | } | 65 | } |
@@ -69,7 +68,7 @@ namespace libTerrain | |||
69 | 68 | ||
70 | public void SetDiff(int x, int y) | 69 | public void SetDiff(int x, int y) |
71 | { | 70 | { |
72 | diff[x / 16, y / 16]++; | 71 | diff[x/16, y/16]++; |
73 | } | 72 | } |
74 | 73 | ||
75 | public void Set(int x, int y, double val) | 74 | public void Set(int x, int y, double val) |
@@ -124,10 +123,10 @@ namespace libTerrain | |||
124 | y = 0.0; | 123 | y = 0.0; |
125 | 124 | ||
126 | int stepSize = 1; | 125 | int stepSize = 1; |
127 | double h00 = Get((int)x, (int)y); | 126 | double h00 = Get((int) x, (int) y); |
128 | double h10 = Get((int)x + stepSize, (int)y); | 127 | double h10 = Get((int) x + stepSize, (int) y); |
129 | double h01 = Get((int)x, (int)y + stepSize); | 128 | double h01 = Get((int) x, (int) y + stepSize); |
130 | double h11 = Get((int)x + stepSize, (int)y + stepSize); | 129 | double h11 = Get((int) x + stepSize, (int) y + stepSize); |
131 | double h1 = h00; | 130 | double h1 = h00; |
132 | double h2 = h10; | 131 | double h2 = h10; |
133 | double h3 = h01; | 132 | double h3 = h01; |
@@ -136,9 +135,9 @@ namespace libTerrain | |||
136 | double a10 = h2 - h1; | 135 | double a10 = h2 - h1; |
137 | double a01 = h3 - h1; | 136 | double a01 = h3 - h1; |
138 | double a11 = h1 - h2 - h3 + h4; | 137 | double a11 = h1 - h2 - h3 + h4; |
139 | double partialx = x - (int)x; | 138 | double partialx = x - (int) x; |
140 | double partialz = y - (int)y; | 139 | double partialz = y - (int) y; |
141 | double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); | 140 | double hi = a00 + (a10*partialx) + (a01*partialz) + (a11*partialx*partialz); |
142 | return hi; | 141 | return hi; |
143 | } | 142 | } |
144 | 143 | ||
@@ -159,7 +158,7 @@ namespace libTerrain | |||
159 | { | 158 | { |
160 | SetDiff(x, y); | 159 | SetDiff(x, y); |
161 | 160 | ||
162 | map[x % w, y % h] = val; | 161 | map[x%w, y%h] = val; |
163 | } | 162 | } |
164 | 163 | ||
165 | public void SetWrapClip(int x, int y, double val) | 164 | public void SetWrapClip(int x, int y, double val) |
@@ -171,7 +170,7 @@ namespace libTerrain | |||
171 | if (val < 0.0) | 170 | if (val < 0.0) |
172 | val = 0.0; | 171 | val = 0.0; |
173 | 172 | ||
174 | map[x % w, y % h] = val; | 173 | map[x%w, y%h] = val; |
175 | } | 174 | } |
176 | 175 | ||
177 | public void Fill(double val) | 176 | public void Fill(double val) |
@@ -255,7 +254,7 @@ namespace libTerrain | |||
255 | 254 | ||
256 | public double Avg() | 255 | public double Avg() |
257 | { | 256 | { |
258 | return Sum() / (w * h); | 257 | return Sum()/(w*h); |
259 | } | 258 | } |
260 | 259 | ||
261 | public bool ContainsNaN() | 260 | public bool ContainsNaN() |
@@ -274,4 +273,4 @@ namespace libTerrain | |||
274 | return false; | 273 | return false; |
275 | } | 274 | } |
276 | } | 275 | } |
277 | } | 276 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs index 45bb06b..e753847 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | 31 | ||
34 | namespace libTerrain | 32 | namespace libTerrain |
35 | { | 33 | { |
@@ -58,12 +56,12 @@ namespace libTerrain | |||
58 | 56 | ||
59 | // Establish the average height under the area | 57 | // Establish the average height under the area |
60 | Channel newmap = new Channel(w, h); | 58 | Channel newmap = new Channel(w, h); |
61 | newmap.map = (double[,])map.Clone(); | 59 | newmap.map = (double[,]) map.Clone(); |
62 | 60 | ||
63 | newmap *= temp; | 61 | newmap *= temp; |
64 | 62 | ||
65 | double total_terrain = newmap.Sum(); | 63 | double total_terrain = newmap.Sum(); |
66 | double avg_height = total_terrain / total_mod; | 64 | double avg_height = total_terrain/total_mod; |
67 | 65 | ||
68 | // Create a flat terrain using the average height | 66 | // Create a flat terrain using the average height |
69 | Channel flat = new Channel(w, h); | 67 | Channel flat = new Channel(w, h); |
@@ -72,7 +70,6 @@ namespace libTerrain | |||
72 | // Blend the current terrain with the average height terrain | 70 | // Blend the current terrain with the average height terrain |
73 | // using the "raised" empty terrain as a mask | 71 | // using the "raised" empty terrain as a mask |
74 | Blend(flat, temp); | 72 | Blend(flat, temp); |
75 | |||
76 | } | 73 | } |
77 | 74 | ||
78 | private void FlattenFast(double rx, double ry, double size, double amount) | 75 | private void FlattenFast(double rx, double ry, double size, double amount) |
@@ -81,10 +78,10 @@ namespace libTerrain | |||
81 | double avg = 0; | 78 | double avg = 0; |
82 | double div = 0; | 79 | double div = 0; |
83 | 80 | ||
84 | int minX = Math.Max(0, (int)(rx - (size + 1))); | 81 | int minX = Math.Max(0, (int) (rx - (size + 1))); |
85 | int maxX = Math.Min(w, (int)(rx + (size + 1))); | 82 | int maxX = Math.Min(w, (int) (rx + (size + 1))); |
86 | int minY = Math.Max(0, (int)(ry - (size + 1))); | 83 | int minY = Math.Max(0, (int) (ry - (size + 1))); |
87 | int maxY = Math.Min(h, (int)(ry + (size + 1))); | 84 | int maxY = Math.Min(h, (int) (ry + (size + 1))); |
88 | 85 | ||
89 | for (x = minX; x < maxX; x++) | 86 | for (x = minX; x < maxX; x++) |
90 | { | 87 | { |
@@ -92,17 +89,17 @@ namespace libTerrain | |||
92 | { | 89 | { |
93 | double z = size; | 90 | double z = size; |
94 | z *= z; | 91 | z *= z; |
95 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | 92 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); |
96 | 93 | ||
97 | if (z < 0) | 94 | if (z < 0) |
98 | z = 0; | 95 | z = 0; |
99 | 96 | ||
100 | avg += z * amount; | 97 | avg += z*amount; |
101 | div += z; | 98 | div += z; |
102 | } | 99 | } |
103 | } | 100 | } |
104 | 101 | ||
105 | double height = avg / div; | 102 | double height = avg/div; |
106 | 103 | ||
107 | for (x = minX; x < maxX; x++) | 104 | for (x = minX; x < maxX; x++) |
108 | { | 105 | { |
@@ -110,7 +107,7 @@ namespace libTerrain | |||
110 | { | 107 | { |
111 | double z = size; | 108 | double z = size; |
112 | z *= z; | 109 | z *= z; |
113 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | 110 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); |
114 | 111 | ||
115 | if (z < 0) | 112 | if (z < 0) |
116 | z = 0; | 113 | z = 0; |
@@ -123,19 +120,19 @@ namespace libTerrain | |||
123 | public void Flatten(Channel mask, double amount) | 120 | public void Flatten(Channel mask, double amount) |
124 | { | 121 | { |
125 | // Generate the mask | 122 | // Generate the mask |
126 | Channel temp = mask * amount; | 123 | Channel temp = mask*amount; |
127 | temp.Clip(0, 1); // Cut off out-of-bounds values | 124 | temp.Clip(0, 1); // Cut off out-of-bounds values |
128 | 125 | ||
129 | double total_mod = temp.Sum(); | 126 | double total_mod = temp.Sum(); |
130 | 127 | ||
131 | // Establish the average height under the area | 128 | // Establish the average height under the area |
132 | Channel map = new Channel(w, h); | 129 | Channel map = new Channel(w, h); |
133 | map.map = (double[,])this.map.Clone(); | 130 | map.map = (double[,]) this.map.Clone(); |
134 | 131 | ||
135 | map *= temp; | 132 | map *= temp; |
136 | 133 | ||
137 | double total_terrain = map.Sum(); | 134 | double total_terrain = map.Sum(); |
138 | double avg_height = total_terrain / total_mod; | 135 | double avg_height = total_terrain/total_mod; |
139 | 136 | ||
140 | // Create a flat terrain using the average height | 137 | // Create a flat terrain using the average height |
141 | Channel flat = new Channel(w, h); | 138 | Channel flat = new Channel(w, h); |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs index 15631df..9e8f3a4 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | ||
32 | using System.Text; | ||
33 | 31 | ||
34 | namespace libTerrain | 32 | namespace libTerrain |
35 | { | 33 | { |
@@ -63,12 +61,12 @@ namespace libTerrain | |||
63 | { | 61 | { |
64 | double z = size; | 62 | double z = size; |
65 | z *= z; | 63 | z *= z; |
66 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | 64 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); |
67 | 65 | ||
68 | if (z < 0) | 66 | if (z < 0) |
69 | z = 0; | 67 | z = 0; |
70 | 68 | ||
71 | Set(x, y, map[x, y] + (z * amount)); | 69 | Set(x, y, map[x, y] + (z*amount)); |
72 | } | 70 | } |
73 | } | 71 | } |
74 | } | 72 | } |
@@ -88,12 +86,12 @@ namespace libTerrain | |||
88 | for (y = 0; y < h; y++) | 86 | for (y = 0; y < h; y++) |
89 | { | 87 | { |
90 | double z = size; | 88 | double z = size; |
91 | z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); | 89 | z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry))); |
92 | 90 | ||
93 | if (z < 0) | 91 | if (z < 0) |
94 | z = 0; | 92 | z = 0; |
95 | 93 | ||
96 | Set(x, y, map[x, y] + (z * amount)); | 94 | Set(x, y, map[x, y] + (z*amount)); |
97 | } | 95 | } |
98 | } | 96 | } |
99 | } | 97 | } |
@@ -126,12 +124,12 @@ namespace libTerrain | |||
126 | { | 124 | { |
127 | double z = size; | 125 | double z = size; |
128 | z *= z; | 126 | z *= z; |
129 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | 127 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); |
130 | 128 | ||
131 | if (z < 0) | 129 | if (z < 0) |
132 | z = 0; | 130 | z = 0; |
133 | 131 | ||
134 | Set(x, y, map[x, y] - (z * amount)); | 132 | Set(x, y, map[x, y] - (z*amount)); |
135 | } | 133 | } |
136 | } | 134 | } |
137 | } | 135 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs index 5949759..b4eda47 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs | |||
@@ -27,9 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Drawing.Imaging; | ||
33 | 32 | ||
34 | namespace libTerrain | 33 | namespace libTerrain |
35 | { | 34 | { |
@@ -48,7 +47,7 @@ namespace libTerrain | |||
48 | for (y = 0; y < bit.Height; y++) | 47 | for (y = 0; y < bit.Height; y++) |
49 | { | 48 | { |
50 | Color val = bit.GetPixel(x, y); | 49 | Color val = bit.GetPixel(x, y); |
51 | chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; | 50 | chan.map[x, y] = (((double) val.R + (double) val.G + (double) val.B)/3.0)/255.0; |
52 | } | 51 | } |
53 | } | 52 | } |
54 | 53 | ||
@@ -57,21 +56,21 @@ namespace libTerrain | |||
57 | 56 | ||
58 | public void SaveImage(string filename) | 57 | public void SaveImage(string filename) |
59 | { | 58 | { |
60 | Channel outmap = this.Copy(); | 59 | Channel outmap = Copy(); |
61 | outmap.Normalise(); | 60 | outmap.Normalise(); |
62 | 61 | ||
63 | Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 62 | Bitmap bit = new Bitmap(w, h, PixelFormat.Format24bppRgb); |
64 | int x, y; | 63 | int x, y; |
65 | for (x = 0; x < w; x++) | 64 | for (x = 0; x < w; x++) |
66 | { | 65 | { |
67 | for (y = 0; y < h; y++) | 66 | for (y = 0; y < h; y++) |
68 | { | 67 | { |
69 | int val = Math.Min(255, (int)(outmap.map[x,y] * 255)); | 68 | int val = Math.Min(255, (int) (outmap.map[x, y]*255)); |
70 | Color col = Color.FromArgb(val,val,val); | 69 | Color col = Color.FromArgb(val, val, val); |
71 | bit.SetPixel(x, y, col); | 70 | bit.SetPixel(x, y, col); |
72 | } | 71 | } |
73 | } | 72 | } |
74 | bit.Save(filename); | 73 | bit.Save(filename); |
75 | } | 74 | } |
76 | } | 75 | } |
77 | } | 76 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs index 3a9b7f7..65badd1 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -60,19 +58,19 @@ namespace libTerrain | |||
60 | } | 58 | } |
61 | if (val < 512) | 59 | if (val < 512) |
62 | { | 60 | { |
63 | ret[0] = (val % 256); | 61 | ret[0] = (val%256); |
64 | ret[1] = 255; | 62 | ret[1] = 255; |
65 | return ret; | 63 | return ret; |
66 | } | 64 | } |
67 | if (val < 768) | 65 | if (val < 768) |
68 | { | 66 | { |
69 | ret[0] = 255; | 67 | ret[0] = 255; |
70 | ret[1] = 255 - (val % 256); | 68 | ret[1] = 255 - (val%256); |
71 | return ret; | 69 | return ret; |
72 | } | 70 | } |
73 | if (val < 1024) | 71 | if (val < 1024) |
74 | { | 72 | { |
75 | ret[0] = 255 - (val % 256); | 73 | ret[0] = 255 - (val%256); |
76 | ret[1] = 255; | 74 | ret[1] = 255; |
77 | return ret; | 75 | return ret; |
78 | } | 76 | } |
@@ -100,7 +98,7 @@ namespace libTerrain | |||
100 | { | 98 | { |
101 | for (int y = 0; y < h; y++) | 99 | for (int y = 0; y < h; y++) |
102 | { | 100 | { |
103 | double miny = Tools.LinearInterpolate(a[1], b[1], (double)x / (double)w); | 101 | double miny = Tools.LinearInterpolate(a[1], b[1], (double) x/(double) w); |
104 | 102 | ||
105 | if (v >= 0.5) | 103 | if (v >= 0.5) |
106 | { | 104 | { |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs index 8a1b048..b6e2491 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs | |||
@@ -26,15 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace libTerrain | 29 | namespace libTerrain |
34 | { | 30 | { |
35 | partial class Channel | 31 | partial class Channel |
36 | { | 32 | { |
37 | |||
38 | public void GradientCube() | 33 | public void GradientCube() |
39 | { | 34 | { |
40 | SetDiff(); | 35 | SetDiff(); |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs index 7cea800..6806748 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -44,7 +42,8 @@ namespace libTerrain | |||
44 | /// <param name="island">Whether to bias hills towards the center of the map</param> | 42 | /// <param name="island">Whether to bias hills towards the center of the map</param> |
45 | /// <param name="additive">Whether to add hills together or to pick the largest value</param> | 43 | /// <param name="additive">Whether to add hills together or to pick the largest value</param> |
46 | /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> | 44 | /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> |
47 | public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) | 45 | public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, |
46 | bool noisy) | ||
48 | { | 47 | { |
49 | SetDiff(); | 48 | SetDiff(); |
50 | 49 | ||
@@ -55,20 +54,20 @@ namespace libTerrain | |||
55 | 54 | ||
56 | for (i = 0; i < number; i++) | 55 | for (i = 0; i < number; i++) |
57 | { | 56 | { |
58 | double rx = Math.Min(255.0, random.NextDouble() * w); | 57 | double rx = Math.Min(255.0, random.NextDouble()*w); |
59 | double ry = Math.Min(255.0, random.NextDouble() * h); | 58 | double ry = Math.Min(255.0, random.NextDouble()*h); |
60 | double rand = random.NextDouble(); | 59 | double rand = random.NextDouble(); |
61 | 60 | ||
62 | if (island) | 61 | if (island) |
63 | { | 62 | { |
64 | // Move everything towards the center | 63 | // Move everything towards the center |
65 | rx -= w / 2; | 64 | rx -= w/2; |
66 | rx /= 2; | 65 | rx /= 2; |
67 | rx += w / 2; | 66 | rx += w/2; |
68 | 67 | ||
69 | ry -= h / 2; | 68 | ry -= h/2; |
70 | ry /= 2; | 69 | ry /= 2; |
71 | ry += h / 2; | 70 | ry += h/2; |
72 | } | 71 | } |
73 | 72 | ||
74 | for (x = 0; x < w; x++) | 73 | for (x = 0; x < w; x++) |
@@ -78,9 +77,9 @@ namespace libTerrain | |||
78 | if (noisy) | 77 | if (noisy) |
79 | rand = random.NextDouble(); | 78 | rand = random.NextDouble(); |
80 | 79 | ||
81 | double z = (scale_min + (scale_range * rand)); | 80 | double z = (scale_min + (scale_range*rand)); |
82 | z *= z; | 81 | z *= z; |
83 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | 82 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); |
84 | 83 | ||
85 | if (z < 0) | 84 | if (z < 0) |
86 | z = 0; | 85 | z = 0; |
@@ -121,20 +120,20 @@ namespace libTerrain | |||
121 | 120 | ||
122 | for (i = 0; i < number; i++) | 121 | for (i = 0; i < number; i++) |
123 | { | 122 | { |
124 | double rx = Math.Min(255.0, random.NextDouble() * w); | 123 | double rx = Math.Min(255.0, random.NextDouble()*w); |
125 | double ry = Math.Min(255.0, random.NextDouble() * h); | 124 | double ry = Math.Min(255.0, random.NextDouble()*h); |
126 | double rand = random.NextDouble(); | 125 | double rand = random.NextDouble(); |
127 | 126 | ||
128 | if (island) | 127 | if (island) |
129 | { | 128 | { |
130 | // Move everything towards the center | 129 | // Move everything towards the center |
131 | rx -= w / 2; | 130 | rx -= w/2; |
132 | rx /= 2; | 131 | rx /= 2; |
133 | rx += w / 2; | 132 | rx += w/2; |
134 | 133 | ||
135 | ry -= h / 2; | 134 | ry -= h/2; |
136 | ry /= 2; | 135 | ry /= 2; |
137 | ry += h / 2; | 136 | ry += h/2; |
138 | } | 137 | } |
139 | 138 | ||
140 | for (x = 0; x < w; x++) | 139 | for (x = 0; x < w; x++) |
@@ -144,8 +143,8 @@ namespace libTerrain | |||
144 | if (noisy) | 143 | if (noisy) |
145 | rand = random.NextDouble(); | 144 | rand = random.NextDouble(); |
146 | 145 | ||
147 | double z = (scale_min + (scale_range * rand)); | 146 | double z = (scale_min + (scale_range*rand)); |
148 | z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); | 147 | z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry))); |
149 | 148 | ||
150 | if (z < 0) | 149 | if (z < 0) |
151 | z = 0; | 150 | z = 0; |
@@ -176,20 +175,20 @@ namespace libTerrain | |||
176 | 175 | ||
177 | for (i = 0; i < number; i++) | 176 | for (i = 0; i < number; i++) |
178 | { | 177 | { |
179 | double rx = Math.Min(255.0, random.NextDouble() * w); | 178 | double rx = Math.Min(255.0, random.NextDouble()*w); |
180 | double ry = Math.Min(255.0, random.NextDouble() * h); | 179 | double ry = Math.Min(255.0, random.NextDouble()*h); |
181 | double rand = random.NextDouble(); | 180 | double rand = random.NextDouble(); |
182 | 181 | ||
183 | if (island) | 182 | if (island) |
184 | { | 183 | { |
185 | // Move everything towards the center | 184 | // Move everything towards the center |
186 | rx -= w / 2; | 185 | rx -= w/2; |
187 | rx /= 2; | 186 | rx /= 2; |
188 | rx += w / 2; | 187 | rx += w/2; |
189 | 188 | ||
190 | ry -= h / 2; | 189 | ry -= h/2; |
191 | ry /= 2; | 190 | ry /= 2; |
192 | ry += h / 2; | 191 | ry += h/2; |
193 | } | 192 | } |
194 | 193 | ||
195 | for (x = 0; x < w; x++) | 194 | for (x = 0; x < w; x++) |
@@ -199,8 +198,8 @@ namespace libTerrain | |||
199 | if (noisy) | 198 | if (noisy) |
200 | rand = random.NextDouble(); | 199 | rand = random.NextDouble(); |
201 | 200 | ||
202 | double z = (scale_min + (scale_range * rand)); | 201 | double z = (scale_min + (scale_range*rand)); |
203 | z -= Math.Abs(x-rx) + Math.Abs(y-ry); | 202 | z -= Math.Abs(x - rx) + Math.Abs(y - ry); |
204 | //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); | 203 | //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); |
205 | 204 | ||
206 | if (z < 0) | 205 | if (z < 0) |
@@ -221,7 +220,8 @@ namespace libTerrain | |||
221 | Normalise(); | 220 | Normalise(); |
222 | } | 221 | } |
223 | 222 | ||
224 | public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) | 223 | public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, |
224 | bool noisy) | ||
225 | { | 225 | { |
226 | SetDiff(); | 226 | SetDiff(); |
227 | 227 | ||
@@ -232,20 +232,20 @@ namespace libTerrain | |||
232 | 232 | ||
233 | for (i = 0; i < number; i++) | 233 | for (i = 0; i < number; i++) |
234 | { | 234 | { |
235 | double rx = Math.Min(255.0, random.NextDouble() * w); | 235 | double rx = Math.Min(255.0, random.NextDouble()*w); |
236 | double ry = Math.Min(255.0, random.NextDouble() * h); | 236 | double ry = Math.Min(255.0, random.NextDouble()*h); |
237 | double rand = random.NextDouble(); | 237 | double rand = random.NextDouble(); |
238 | 238 | ||
239 | if (island) | 239 | if (island) |
240 | { | 240 | { |
241 | // Move everything towards the center | 241 | // Move everything towards the center |
242 | rx -= w / 2; | 242 | rx -= w/2; |
243 | rx /= 2; | 243 | rx /= 2; |
244 | rx += w / 2; | 244 | rx += w/2; |
245 | 245 | ||
246 | ry -= h / 2; | 246 | ry -= h/2; |
247 | ry /= 2; | 247 | ry /= 2; |
248 | ry += h / 2; | 248 | ry += h/2; |
249 | } | 249 | } |
250 | 250 | ||
251 | for (x = 0; x < w; x++) | 251 | for (x = 0; x < w; x++) |
@@ -255,11 +255,11 @@ namespace libTerrain | |||
255 | if (noisy) | 255 | if (noisy) |
256 | rand = random.NextDouble(); | 256 | rand = random.NextDouble(); |
257 | 257 | ||
258 | double z = (scale_min + (scale_range * rand)); | 258 | double z = (scale_min + (scale_range*rand)); |
259 | z *= z * z * z; | 259 | z *= z*z*z; |
260 | double dx = Math.Abs(x - rx); | 260 | double dx = Math.Abs(x - rx); |
261 | double dy = Math.Abs(y - ry); | 261 | double dy = Math.Abs(y - ry); |
262 | z -= (dx * dx * dx * dx) + (dy * dy * dy * dy); | 262 | z -= (dx*dx*dx*dx) + (dy*dy*dy*dy); |
263 | 263 | ||
264 | if (z < 0) | 264 | if (z < 0) |
265 | z = 0; | 265 | z = 0; |
@@ -278,6 +278,5 @@ namespace libTerrain | |||
278 | 278 | ||
279 | Normalise(); | 279 | Normalise(); |
280 | } | 280 | } |
281 | |||
282 | } | 281 | } |
283 | } | 282 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs index 43ae37a..5d39cd5 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -53,4 +51,4 @@ namespace libTerrain | |||
53 | } | 51 | } |
54 | } | 52 | } |
55 | } | 53 | } |
56 | } | 54 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs index d7e0dcd..10eaf71 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | 31 | ||
33 | namespace libTerrain | 32 | namespace libTerrain |
34 | { | 33 | { |
@@ -36,10 +35,10 @@ namespace libTerrain | |||
36 | { | 35 | { |
37 | private double[] CoordinatesToPolar(int x, int y) | 36 | private double[] CoordinatesToPolar(int x, int y) |
38 | { | 37 | { |
39 | double theta = Math.Atan2(x - (w / 2), y - (h / 2)); | 38 | double theta = Math.Atan2(x - (w/2), y - (h/2)); |
40 | double rx = (double)x - ((double)w / 2); | 39 | double rx = (double) x - ((double) w/2); |
41 | double ry = (double)y - ((double)h / 2); | 40 | double ry = (double) y - ((double) h/2); |
42 | double r = Math.Sqrt((rx * rx) + (ry * ry)); | 41 | double r = Math.Sqrt((rx*rx) + (ry*ry)); |
43 | 42 | ||
44 | double[] coords = new double[2]; | 43 | double[] coords = new double[2]; |
45 | coords[0] = r; | 44 | coords[0] = r; |
@@ -47,15 +46,16 @@ namespace libTerrain | |||
47 | return coords; | 46 | return coords; |
48 | } | 47 | } |
49 | 48 | ||
50 | public int[] PolarToCoordinates(double r, double theta) { | 49 | public int[] PolarToCoordinates(double r, double theta) |
50 | { | ||
51 | double nx; | 51 | double nx; |
52 | double ny; | 52 | double ny; |
53 | 53 | ||
54 | nx = (double)r * Math.Cos(theta); | 54 | nx = (double) r*Math.Cos(theta); |
55 | ny = (double)r * Math.Sin(theta); | 55 | ny = (double) r*Math.Sin(theta); |
56 | 56 | ||
57 | nx += w / 2; | 57 | nx += w/2; |
58 | ny += h / 2; | 58 | ny += h/2; |
59 | 59 | ||
60 | if (nx >= w) | 60 | if (nx >= w) |
61 | nx = w - 1; | 61 | nx = w - 1; |
@@ -70,8 +70,8 @@ namespace libTerrain | |||
70 | ny = 0; | 70 | ny = 0; |
71 | 71 | ||
72 | int[] coords = new int[2]; | 72 | int[] coords = new int[2]; |
73 | coords[0] = (int)nx; | 73 | coords[0] = (int) nx; |
74 | coords[1] = (int)ny; | 74 | coords[1] = (int) ny; |
75 | return coords; | 75 | return coords; |
76 | } | 76 | } |
77 | 77 | ||
@@ -79,19 +79,19 @@ namespace libTerrain | |||
79 | { | 79 | { |
80 | SetDiff(); | 80 | SetDiff(); |
81 | 81 | ||
82 | Channel n = this.Copy(); | 82 | Channel n = Copy(); |
83 | 83 | ||
84 | int x, y; | 84 | int x, y; |
85 | for (x = 0; x < w; x++) | 85 | for (x = 0; x < w; x++) |
86 | { | 86 | { |
87 | for (y = 0; y < h; y++) | 87 | for (y = 0; y < h; y++) |
88 | { | 88 | { |
89 | double[] coords = CoordinatesToPolar(x,y); | 89 | double[] coords = CoordinatesToPolar(x, y); |
90 | 90 | ||
91 | coords[0] += w / 2.0; | 91 | coords[0] += w/2.0; |
92 | coords[1] += h / 2.0; | 92 | coords[1] += h/2.0; |
93 | 93 | ||
94 | map[x, y] = n.map[(int)coords[0] % n.w, (int)coords[1] % n.h]; | 94 | map[x, y] = n.map[(int) coords[0]%n.w, (int) coords[1]%n.h]; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | } | 97 | } |
@@ -108,12 +108,13 @@ namespace libTerrain | |||
108 | r += incRadius; | 108 | r += incRadius; |
109 | theta += incAngle; | 109 | theta += incAngle; |
110 | 110 | ||
111 | int[] coords = PolarToCoordinates(r,theta); | 111 | int[] coords = PolarToCoordinates(r, theta); |
112 | Raise(coords[0], coords[1], 20, 1); | 112 | Raise(coords[0], coords[1], 20, 1); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle, double[] c) | 116 | public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle, |
117 | double[] c) | ||
117 | { | 118 | { |
118 | SetDiff(); | 119 | SetDiff(); |
119 | 120 | ||
@@ -128,7 +129,7 @@ namespace libTerrain | |||
128 | theta += incAngle; | 129 | theta += incAngle; |
129 | 130 | ||
130 | int[] coords = PolarToCoordinates(r, theta); | 131 | int[] coords = PolarToCoordinates(r, theta); |
131 | points.Add(new Point2D(coords[0],coords[1])); | 132 | points.Add(new Point2D(coords[0], coords[1])); |
132 | } | 133 | } |
133 | 134 | ||
134 | VoronoiDiagram(points, c); | 135 | VoronoiDiagram(points, c); |
@@ -145,9 +146,9 @@ namespace libTerrain | |||
145 | for (y = 0; y < h; y++) | 146 | for (y = 0; y < h; y++) |
146 | { | 147 | { |
147 | z++; | 148 | z++; |
148 | double dx = Math.Abs((w / 2) - x); | 149 | double dx = Math.Abs((w/2) - x); |
149 | double dy = Math.Abs((h / 2) - y); | 150 | double dy = Math.Abs((h/2) - y); |
150 | map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); | 151 | map[x, y] += Math.Sin(dx/wid) + Math.Cos(dy/hig); |
151 | } | 152 | } |
152 | } | 153 | } |
153 | Normalise(); | 154 | Normalise(); |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs index e2f9560..0159b87 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | 31 | ||
33 | namespace libTerrain | 32 | namespace libTerrain |
34 | { | 33 | { |
@@ -57,8 +56,8 @@ namespace libTerrain | |||
57 | { | 56 | { |
58 | for (i = 0; i < pointsPerBlock; i++) | 57 | for (i = 0; i < pointsPerBlock; i++) |
59 | { | 58 | { |
60 | double pX = x + (generator.NextDouble() * (double)blockSize); | 59 | double pX = x + (generator.NextDouble()*(double) blockSize); |
61 | double pY = y + (generator.NextDouble() * (double)blockSize); | 60 | double pY = y + (generator.NextDouble()*(double) blockSize); |
62 | 61 | ||
63 | points.Add(new Point2D(pX, pY)); | 62 | points.Add(new Point2D(pX, pY)); |
64 | } | 63 | } |
@@ -75,10 +74,10 @@ namespace libTerrain | |||
75 | for (i = 0; i < points.Count; i++) | 74 | for (i = 0; i < points.Count; i++) |
76 | { | 75 | { |
77 | double dx, dy; | 76 | double dx, dy; |
78 | dx = Math.Abs((double)x - points[i].x); | 77 | dx = Math.Abs((double) x - points[i].x); |
79 | dy = Math.Abs((double)y - points[i].y); | 78 | dy = Math.Abs((double) y - points[i].y); |
80 | 79 | ||
81 | distances[i] = (dx * dx + dy * dy); | 80 | distances[i] = (dx*dx + dy*dy); |
82 | } | 81 | } |
83 | 82 | ||
84 | Array.Sort(distances); | 83 | Array.Sort(distances); |
@@ -92,7 +91,7 @@ namespace libTerrain | |||
92 | if (i >= points.Count) | 91 | if (i >= points.Count) |
93 | break; | 92 | break; |
94 | 93 | ||
95 | f += c[i] * distances[i]; | 94 | f += c[i]*distances[i]; |
96 | } | 95 | } |
97 | 96 | ||
98 | map[x, y] = f; | 97 | map[x, y] = f; |
@@ -119,10 +118,10 @@ namespace libTerrain | |||
119 | for (i = 0; i < points.Count; i++) | 118 | for (i = 0; i < points.Count; i++) |
120 | { | 119 | { |
121 | double dx, dy; | 120 | double dx, dy; |
122 | dx = Math.Abs((double)x - points[i].x); | 121 | dx = Math.Abs((double) x - points[i].x); |
123 | dy = Math.Abs((double)y - points[i].y); | 122 | dy = Math.Abs((double) y - points[i].y); |
124 | 123 | ||
125 | distances[i] = (dx * dx + dy * dy); | 124 | distances[i] = (dx*dx + dy*dy); |
126 | } | 125 | } |
127 | 126 | ||
128 | Array.Sort(distances); | 127 | Array.Sort(distances); |
@@ -136,7 +135,7 @@ namespace libTerrain | |||
136 | if (i >= points.Count) | 135 | if (i >= points.Count) |
137 | break; | 136 | break; |
138 | 137 | ||
139 | f += c[i] * distances[i]; | 138 | f += c[i]*distances[i]; |
140 | } | 139 | } |
141 | 140 | ||
142 | map[x, y] = f; | 141 | map[x, y] = f; |
@@ -162,8 +161,8 @@ namespace libTerrain | |||
162 | { | 161 | { |
163 | for (i = 0; i < pointsPerBlock; i++) | 162 | for (i = 0; i < pointsPerBlock; i++) |
164 | { | 163 | { |
165 | double pX = x + (generator.NextDouble() * (double)blockSize); | 164 | double pX = x + (generator.NextDouble()*(double) blockSize); |
166 | double pY = y + (generator.NextDouble() * (double)blockSize); | 165 | double pY = y + (generator.NextDouble()*(double) blockSize); |
167 | 166 | ||
168 | points.Add(new Point2D(pX, pY)); | 167 | points.Add(new Point2D(pX, pY)); |
169 | } | 168 | } |
@@ -180,10 +179,10 @@ namespace libTerrain | |||
180 | for (i = 0; i < points.Count; i++) | 179 | for (i = 0; i < points.Count; i++) |
181 | { | 180 | { |
182 | double dx, dy; | 181 | double dx, dy; |
183 | dx = Math.Abs((double)x - points[i].x); | 182 | dx = Math.Abs((double) x - points[i].x); |
184 | dy = Math.Abs((double)y - points[i].y); | 183 | dy = Math.Abs((double) y - points[i].y); |
185 | 184 | ||
186 | distances[i] = (dx * dx + dy * dy); | 185 | distances[i] = (dx*dx + dy*dy); |
187 | } | 186 | } |
188 | 187 | ||
189 | //Array.Sort(distances); | 188 | //Array.Sort(distances); |
@@ -191,7 +190,7 @@ namespace libTerrain | |||
191 | double f = 0.0; | 190 | double f = 0.0; |
192 | 191 | ||
193 | double min = double.MaxValue; | 192 | double min = double.MaxValue; |
194 | for (int j = 0; j < distances.Length;j++ ) | 193 | for (int j = 0; j < distances.Length; j++) |
195 | { | 194 | { |
196 | if (distances[j] < min) | 195 | if (distances[j] < min) |
197 | { | 196 | { |
@@ -211,4 +210,4 @@ namespace libTerrain | |||
211 | Normalise(); | 210 | Normalise(); |
212 | } | 211 | } |
213 | } | 212 | } |
214 | } | 213 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs index 788134d..deb2e0e 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -54,18 +52,18 @@ namespace libTerrain | |||
54 | double rx, ry; | 52 | double rx, ry; |
55 | if (centerspawn) | 53 | if (centerspawn) |
56 | { | 54 | { |
57 | rx = w / 2.0; | 55 | rx = w/2.0; |
58 | ry = h / 2.0; | 56 | ry = h/2.0; |
59 | } | 57 | } |
60 | else | 58 | else |
61 | { | 59 | { |
62 | rx = random.NextDouble() * (w - 1); | 60 | rx = random.NextDouble()*(w - 1); |
63 | ry = random.NextDouble() * (h - 1); | 61 | ry = random.NextDouble()*(h - 1); |
64 | } | 62 | } |
65 | for (j = 0; j < rounds; j++) | 63 | for (j = 0; j < rounds; j++) |
66 | { | 64 | { |
67 | rx += (random.NextDouble() * movement) - (movement / 2.0); | 65 | rx += (random.NextDouble()*movement) - (movement/2.0); |
68 | ry += (random.NextDouble() * movement) - (movement / 2.0); | 66 | ry += (random.NextDouble()*movement) - (movement/2.0); |
69 | Raise(rx, ry, size, 1.0); | 67 | Raise(rx, ry, size, 1.0); |
70 | } | 68 | } |
71 | } | 69 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs index 0155791..24df5b9 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -49,13 +47,13 @@ namespace libTerrain | |||
49 | { | 47 | { |
50 | for (y = 0; y < h; y++) | 48 | for (y = 0; y < h; y++) |
51 | { | 49 | { |
52 | map[x, y] = (map[x, y] - min) * (1.0 / (max - min)); | 50 | map[x, y] = (map[x, y] - min)*(1.0/(max - min)); |
53 | } | 51 | } |
54 | } | 52 | } |
55 | } | 53 | } |
56 | else | 54 | else |
57 | { | 55 | { |
58 | this.Fill(0.5); | 56 | Fill(0.5); |
59 | } | 57 | } |
60 | 58 | ||
61 | return this; | 59 | return this; |
@@ -82,7 +80,7 @@ namespace libTerrain | |||
82 | { | 80 | { |
83 | if (min != max) | 81 | if (min != max) |
84 | { | 82 | { |
85 | double val = (map[x, y] - min) * (1.0 / max - min); | 83 | double val = (map[x, y] - min)*(1.0/max - min); |
86 | val *= maxv - minv; | 84 | val *= maxv - minv; |
87 | val += minv; | 85 | val += minv; |
88 | 86 | ||
@@ -179,9 +177,9 @@ namespace libTerrain | |||
179 | SetDiff(); | 177 | SetDiff(); |
180 | 178 | ||
181 | double area = amount; | 179 | double area = amount; |
182 | double step = amount / 4.0; | 180 | double step = amount/4.0; |
183 | 181 | ||
184 | double[,] manipulate = new double[w, h]; | 182 | double[,] manipulate = new double[w,h]; |
185 | int x, y; | 183 | int x, y; |
186 | double n, l; | 184 | double n, l; |
187 | for (x = 0; x < w; x++) | 185 | for (x = 0; x < w; x++) |
@@ -200,7 +198,7 @@ namespace libTerrain | |||
200 | } | 198 | } |
201 | } | 199 | } |
202 | 200 | ||
203 | manipulate[x, y] = average / avgsteps; | 201 | manipulate[x, y] = average/avgsteps; |
204 | } | 202 | } |
205 | } | 203 | } |
206 | map = manipulate; | 204 | map = manipulate; |
@@ -211,7 +209,7 @@ namespace libTerrain | |||
211 | SetDiff(); | 209 | SetDiff(); |
212 | 210 | ||
213 | // Simple pertubation filter | 211 | // Simple pertubation filter |
214 | double[,] manipulated = new double[w, h]; | 212 | double[,] manipulated = new double[w,h]; |
215 | Random generator = new Random(seed); // Seeds FTW! | 213 | Random generator = new Random(seed); // Seeds FTW! |
216 | //double amount = 8.0; | 214 | //double amount = 8.0; |
217 | 215 | ||
@@ -220,8 +218,8 @@ namespace libTerrain | |||
220 | { | 218 | { |
221 | for (y = 0; y < h; y++) | 219 | for (y = 0; y < h; y++) |
222 | { | 220 | { |
223 | double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); | 221 | double offset_x = (double) x + (generator.NextDouble()*amount) - (amount/2.0); |
224 | double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); | 222 | double offset_y = (double) y + (generator.NextDouble()*amount) - (amount/2.0); |
225 | double p = GetBilinearInterpolate(offset_x, offset_y); | 223 | double p = GetBilinearInterpolate(offset_x, offset_y); |
226 | manipulated[x, y] = p; | 224 | manipulated[x, y] = p; |
227 | } | 225 | } |
@@ -232,7 +230,7 @@ namespace libTerrain | |||
232 | public void PertubationMask(Channel mask) | 230 | public void PertubationMask(Channel mask) |
233 | { | 231 | { |
234 | // Simple pertubation filter | 232 | // Simple pertubation filter |
235 | double[,] manipulated = new double[w, h]; | 233 | double[,] manipulated = new double[w,h]; |
236 | Random generator = new Random(seed); // Seeds FTW! | 234 | Random generator = new Random(seed); // Seeds FTW! |
237 | //double amount = 8.0; | 235 | //double amount = 8.0; |
238 | 236 | ||
@@ -244,8 +242,8 @@ namespace libTerrain | |||
244 | for (y = 0; y < h; y++) | 242 | for (y = 0; y < h; y++) |
245 | { | 243 | { |
246 | amount = mask.map[x, y]; | 244 | amount = mask.map[x, y]; |
247 | double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); | 245 | double offset_x = (double) x + (generator.NextDouble()*amount) - (amount/2.0); |
248 | double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); | 246 | double offset_y = (double) y + (generator.NextDouble()*amount) - (amount/2.0); |
249 | 247 | ||
250 | if (offset_x > w) | 248 | if (offset_x > w) |
251 | offset_x = w - 1; | 249 | offset_x = w - 1; |
@@ -267,7 +265,7 @@ namespace libTerrain | |||
267 | public void Distort(Channel mask, double str) | 265 | public void Distort(Channel mask, double str) |
268 | { | 266 | { |
269 | // Simple pertubation filter | 267 | // Simple pertubation filter |
270 | double[,] manipulated = new double[w, h]; | 268 | double[,] manipulated = new double[w,h]; |
271 | 269 | ||
272 | double amount; | 270 | double amount; |
273 | 271 | ||
@@ -277,8 +275,8 @@ namespace libTerrain | |||
277 | for (y = 0; y < h; y++) | 275 | for (y = 0; y < h; y++) |
278 | { | 276 | { |
279 | amount = mask.map[x, y]; | 277 | amount = mask.map[x, y]; |
280 | double offset_x = (double)x + (amount * str) - (0.5 * str); | 278 | double offset_x = (double) x + (amount*str) - (0.5*str); |
281 | double offset_y = (double)y + (amount * str) - (0.5 * str); | 279 | double offset_y = (double) y + (amount*str) - (0.5*str); |
282 | 280 | ||
283 | if (offset_x > w) | 281 | if (offset_x > w) |
284 | offset_x = w - 1; | 282 | offset_x = w - 1; |
@@ -295,13 +293,12 @@ namespace libTerrain | |||
295 | } | 293 | } |
296 | } | 294 | } |
297 | map = manipulated; | 295 | map = manipulated; |
298 | |||
299 | } | 296 | } |
300 | 297 | ||
301 | public void Distort(Channel mask, Channel mask2, double str) | 298 | public void Distort(Channel mask, Channel mask2, double str) |
302 | { | 299 | { |
303 | // Simple pertubation filter | 300 | // Simple pertubation filter |
304 | double[,] manipulated = new double[w, h]; | 301 | double[,] manipulated = new double[w,h]; |
305 | 302 | ||
306 | double amountX; | 303 | double amountX; |
307 | double amountY; | 304 | double amountY; |
@@ -313,8 +310,8 @@ namespace libTerrain | |||
313 | { | 310 | { |
314 | amountX = mask.map[x, y]; | 311 | amountX = mask.map[x, y]; |
315 | amountY = mask2.map[x, y]; | 312 | amountY = mask2.map[x, y]; |
316 | double offset_x = (double)x + (amountX * str) - (0.5 * str); | 313 | double offset_x = (double) x + (amountX*str) - (0.5*str); |
317 | double offset_y = (double)y + (amountY * str) - (0.5 * str); | 314 | double offset_y = (double) y + (amountY*str) - (0.5*str); |
318 | 315 | ||
319 | if (offset_x > w) | 316 | if (offset_x > w) |
320 | offset_x = w - 1; | 317 | offset_x = w - 1; |
@@ -331,7 +328,6 @@ namespace libTerrain | |||
331 | } | 328 | } |
332 | } | 329 | } |
333 | map = manipulated; | 330 | map = manipulated; |
334 | |||
335 | } | 331 | } |
336 | 332 | ||
337 | public Channel Blend(Channel other, double amount) | 333 | public Channel Blend(Channel other, double amount) |
@@ -360,4 +356,4 @@ namespace libTerrain | |||
360 | return this; | 356 | return this; |
361 | } | 357 | } |
362 | } | 358 | } |
363 | } | 359 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs index ca93c25..c8584e8 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -74,17 +72,18 @@ namespace libTerrain | |||
74 | /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param> | 72 | /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param> |
75 | /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param> | 73 | /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param> |
76 | /// <param name="lowest">Drop sediment at the lowest point?</param> | 74 | /// <param name="lowest">Drop sediment at the lowest point?</param> |
77 | public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry, int rounds, bool lowest, bool usingFluidDynamics) | 75 | public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry, |
76 | int rounds, bool lowest, bool usingFluidDynamics) | ||
78 | { | 77 | { |
79 | bool debugImages = false; | 78 | bool debugImages = false; |
80 | 79 | ||
81 | Channel wind = new Channel(w, h) ; | 80 | Channel wind = new Channel(w, h); |
82 | Channel sediment = new Channel(w, h); | 81 | Channel sediment = new Channel(w, h); |
83 | int x, y, i, j; | 82 | int x, y, i, j; |
84 | 83 | ||
85 | this.Normalise(); | 84 | Normalise(); |
86 | 85 | ||
87 | wind = this.Copy(); | 86 | wind = Copy(); |
88 | wind.Noise(); | 87 | wind.Noise(); |
89 | 88 | ||
90 | if (debugImages) | 89 | if (debugImages) |
@@ -120,7 +119,7 @@ namespace libTerrain | |||
120 | surfacearea += Math.Abs(target - me); | 119 | surfacearea += Math.Abs(target - me); |
121 | } | 120 | } |
122 | 121 | ||
123 | double amount = surfacearea * wind.map[x, y] * carry; | 122 | double amount = surfacearea*wind.map[x, y]*carry; |
124 | 123 | ||
125 | if (amount < 0) | 124 | if (amount < 0) |
126 | amount = 0; | 125 | amount = 0; |
@@ -147,7 +146,7 @@ namespace libTerrain | |||
147 | } | 146 | } |
148 | else | 147 | else |
149 | { | 148 | { |
150 | wind.Pertubation(15); // Can do better later | 149 | wind.Pertubation(15); // Can do better later |
151 | wind.seed++; | 150 | wind.seed++; |
152 | sediment.Pertubation(10); // Sediment is blown around a bit | 151 | sediment.Pertubation(10); // Sediment is blown around a bit |
153 | sediment.seed++; | 152 | sediment.seed++; |
@@ -175,12 +174,12 @@ namespace libTerrain | |||
175 | 174 | ||
176 | if (target < min && lowest) | 175 | if (target < min && lowest) |
177 | { | 176 | { |
178 | minside = (int[])coords.Clone(); | 177 | minside = (int[]) coords.Clone(); |
179 | min = target; | 178 | min = target; |
180 | } | 179 | } |
181 | } | 180 | } |
182 | 181 | ||
183 | double amount = surfacearea * (1.0 - wind.map[x, y]) * carry; | 182 | double amount = surfacearea*(1.0 - wind.map[x, y])*carry; |
184 | 183 | ||
185 | if (amount < 0) | 184 | if (amount < 0) |
186 | amount = 0; | 185 | amount = 0; |
@@ -199,7 +198,7 @@ namespace libTerrain | |||
199 | wind.Normalise(); | 198 | wind.Normalise(); |
200 | wind *= windspeed; | 199 | wind *= windspeed; |
201 | 200 | ||
202 | this.Normalise(); | 201 | Normalise(); |
203 | } | 202 | } |
204 | 203 | ||
205 | Channel myself = this; | 204 | Channel myself = this; |
@@ -207,7 +206,7 @@ namespace libTerrain | |||
207 | myself.Normalise(); | 206 | myself.Normalise(); |
208 | 207 | ||
209 | if (debugImages) | 208 | if (debugImages) |
210 | this.SaveImage("testimg/output.png"); | 209 | SaveImage("testimg/output.png"); |
211 | } | 210 | } |
212 | } | 211 | } |
213 | } \ No newline at end of file | 212 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs index 4f58f71..0e47e1b 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -44,7 +42,7 @@ namespace libTerrain | |||
44 | Channel waterFlow = new Channel(w, h); | 42 | Channel waterFlow = new Channel(w, h); |
45 | 43 | ||
46 | NeighbourSystem type = NeighbourSystem.Moore; | 44 | NeighbourSystem type = NeighbourSystem.Moore; |
47 | int NEIGHBOUR_ME = 4; | 45 | int NEIGHBOUR_ME = 4; |
48 | 46 | ||
49 | int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; | 47 | int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; |
50 | 48 | ||
@@ -52,7 +50,7 @@ namespace libTerrain | |||
52 | { | 50 | { |
53 | water += rain; | 51 | water += rain; |
54 | 52 | ||
55 | sediment = terrain * water; | 53 | sediment = terrain*water; |
56 | terrain -= sediment; | 54 | terrain -= sediment; |
57 | 55 | ||
58 | for (int x = 1; x < w - 1; x++) | 56 | for (int x = 1; x < w - 1; x++) |
@@ -72,7 +70,8 @@ namespace libTerrain | |||
72 | coords[0] += x; | 70 | coords[0] += x; |
73 | coords[1] += y; | 71 | coords[1] += y; |
74 | 72 | ||
75 | heights[j] = map[coords[0], coords[1]] + water.map[coords[0], coords[1]] + sediment.map[coords[0], coords[1]]; | 73 | heights[j] = map[coords[0], coords[1]] + water.map[coords[0], coords[1]] + |
74 | sediment.map[coords[0], coords[1]]; | ||
76 | diffs[j] = heightCenter - heights[j]; | 75 | diffs[j] = heightCenter - heights[j]; |
77 | } | 76 | } |
78 | } | 77 | } |
@@ -97,13 +96,13 @@ namespace libTerrain | |||
97 | if (totalCellsCounted == 1) | 96 | if (totalCellsCounted == 1) |
98 | continue; | 97 | continue; |
99 | 98 | ||
100 | double averageHeight = totalHeight / totalCellsCounted; | 99 | double averageHeight = totalHeight/totalCellsCounted; |
101 | double waterAmount = Math.Min(water.map[x, y], heightCenter - averageHeight); | 100 | double waterAmount = Math.Min(water.map[x, y], heightCenter - averageHeight); |
102 | 101 | ||
103 | // TODO: Check this. | 102 | // TODO: Check this. |
104 | waterFlow.map[x, y] += waterFlow.map[x, y] - waterAmount; | 103 | waterFlow.map[x, y] += waterFlow.map[x, y] - waterAmount; |
105 | 104 | ||
106 | double totalInverseDiff = waterAmount / totalHeightDiff; | 105 | double totalInverseDiff = waterAmount/totalHeightDiff; |
107 | 106 | ||
108 | for (int j = 0; j < NEIGHBOUR_MAX; j++) | 107 | for (int j = 0; j < NEIGHBOUR_MAX; j++) |
109 | { | 108 | { |
@@ -115,7 +114,8 @@ namespace libTerrain | |||
115 | 114 | ||
116 | if (diffs[j] > 0) | 115 | if (diffs[j] > 0) |
117 | { | 116 | { |
118 | waterFlow.SetWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff); | 117 | waterFlow.SetWrap(coords[0], coords[1], |
118 | waterFlow.map[coords[0], coords[1]] + diffs[j]*totalInverseDiff); | ||
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
@@ -131,7 +131,7 @@ namespace libTerrain | |||
131 | { | 131 | { |
132 | for (int y = 0; y < h; y++) | 132 | for (int y = 0; y < h; y++) |
133 | { | 133 | { |
134 | double deposition = sediment.map[x, y] - water.map[x, y] * solubility; | 134 | double deposition = sediment.map[x, y] - water.map[x, y]*solubility; |
135 | if (deposition > 0) | 135 | if (deposition > 0) |
136 | { | 136 | { |
137 | sediment.map[x, y] -= deposition; | 137 | sediment.map[x, y] -= deposition; |
@@ -139,7 +139,6 @@ namespace libTerrain | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | } | 141 | } |
142 | |||
143 | } | 142 | } |
144 | } | 143 | } |
145 | } | 144 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs index 401cf95..8c16d7c 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace libTerrain | 29 | namespace libTerrain |
34 | { | 30 | { |
35 | partial class Channel | 31 | partial class Channel |
@@ -42,7 +38,7 @@ namespace libTerrain | |||
42 | 38 | ||
43 | private static int nsIX(int i, int j, int N) | 39 | private static int nsIX(int i, int j, int N) |
44 | { | 40 | { |
45 | return ((i) + (N + 2) * (j)); | 41 | return ((i) + (N + 2)*(j)); |
46 | } | 42 | } |
47 | 43 | ||
48 | private static void nsSwap(ref double x0, ref double x) | 44 | private static void nsSwap(ref double x0, ref double x) |
@@ -62,10 +58,10 @@ namespace libTerrain | |||
62 | private void nsAddSource(int N, ref double[] x, ref double[] s, double dt) | 58 | private void nsAddSource(int N, ref double[] x, ref double[] s, double dt) |
63 | { | 59 | { |
64 | int i; | 60 | int i; |
65 | int size = (N + 2) * (N + 2); | 61 | int size = (N + 2)*(N + 2); |
66 | for (i = 0; i < size; i++) | 62 | for (i = 0; i < size; i++) |
67 | { | 63 | { |
68 | x[i] += dt * s[i]; | 64 | x[i] += dt*s[i]; |
69 | } | 65 | } |
70 | } | 66 | } |
71 | 67 | ||
@@ -74,15 +70,15 @@ namespace libTerrain | |||
74 | int i; | 70 | int i; |
75 | for (i = 0; i <= N; i++) | 71 | for (i = 0; i <= N; i++) |
76 | { | 72 | { |
77 | x[nsIX(0, i, N)] = b == 1 ? -x[nsIX(1, i, N)] : x[nsIX(1, i, N)]; | 73 | x[nsIX(0, i, N)] = b == 1 ? -x[nsIX(1, i, N)] : x[nsIX(1, i, N)]; |
78 | x[nsIX(0, N + 1, N)] = b == 1 ? -x[nsIX(N, i, N)] : x[nsIX(N, i, N)]; | 74 | x[nsIX(0, N + 1, N)] = b == 1 ? -x[nsIX(N, i, N)] : x[nsIX(N, i, N)]; |
79 | x[nsIX(i, 0, N)] = b == 2 ? -x[nsIX(i, 1, N)] : x[nsIX(i, 1, N)]; | 75 | x[nsIX(i, 0, N)] = b == 2 ? -x[nsIX(i, 1, N)] : x[nsIX(i, 1, N)]; |
80 | x[nsIX(i, N + 1, N)] = b == 2 ? -x[nsIX(i, N, N)] : x[nsIX(i, N, N)]; | 76 | x[nsIX(i, N + 1, N)] = b == 2 ? -x[nsIX(i, N, N)] : x[nsIX(i, N, N)]; |
81 | } | 77 | } |
82 | x[nsIX(0, 0, N)] = 0.5f * (x[nsIX(1, 0, N)] + x[nsIX(0, 1, N)]); | 78 | x[nsIX(0, 0, N)] = 0.5f*(x[nsIX(1, 0, N)] + x[nsIX(0, 1, N)]); |
83 | x[nsIX(0, N + 1, N)] = 0.5f * (x[nsIX(1, N + 1, N)] + x[nsIX(0, N, N)]); | 79 | x[nsIX(0, N + 1, N)] = 0.5f*(x[nsIX(1, N + 1, N)] + x[nsIX(0, N, N)]); |
84 | x[nsIX(N + 1, 0, N)] = 0.5f * (x[nsIX(N, 0, N)] + x[nsIX(N + 1, 1, N)]); | 80 | x[nsIX(N + 1, 0, N)] = 0.5f*(x[nsIX(N, 0, N)] + x[nsIX(N + 1, 1, N)]); |
85 | x[nsIX(N + 1, N + 1, N)] = 0.5f * (x[nsIX(N, N + 1, N)] + x[nsIX(N + 1, N, N)]); | 81 | x[nsIX(N + 1, N + 1, N)] = 0.5f*(x[nsIX(N, N + 1, N)] + x[nsIX(N + 1, N, N)]); |
86 | } | 82 | } |
87 | 83 | ||
88 | private void nsLinSolve(int N, int b, ref double[] x, ref double[] x0, double a, double c) | 84 | private void nsLinSolve(int N, int b, ref double[] x, ref double[] x0, double a, double c) |
@@ -92,11 +88,11 @@ namespace libTerrain | |||
92 | { | 88 | { |
93 | for (j = 1; j <= N; j++) | 89 | for (j = 1; j <= N; j++) |
94 | { | 90 | { |
95 | x[nsIX(i, j, N)] = (x0[nsIX(i, j, N)] + a * | 91 | x[nsIX(i, j, N)] = (x0[nsIX(i, j, N)] + a* |
96 | (x[nsIX(i - 1, j, N)] + | 92 | (x[nsIX(i - 1, j, N)] + |
97 | x[nsIX(i + 1, j, N)] + | 93 | x[nsIX(i + 1, j, N)] + |
98 | x[nsIX(i, j - 1, N)] + x[nsIX(i, j + 1, N)]) | 94 | x[nsIX(i, j - 1, N)] + x[nsIX(i, j + 1, N)]) |
99 | ) / c; | 95 | )/c; |
100 | } | 96 | } |
101 | } | 97 | } |
102 | 98 | ||
@@ -105,8 +101,8 @@ namespace libTerrain | |||
105 | 101 | ||
106 | private void nsDiffuse(int N, int b, ref double[] x, ref double[] x0, double diff, double dt) | 102 | private void nsDiffuse(int N, int b, ref double[] x, ref double[] x0, double diff, double dt) |
107 | { | 103 | { |
108 | double a = dt * diff * N * N; | 104 | double a = dt*diff*N*N; |
109 | nsLinSolve(N, b, ref x, ref x0, a, 1 + 4 * a); | 105 | nsLinSolve(N, b, ref x, ref x0, a, 1 + 4*a); |
110 | } | 106 | } |
111 | 107 | ||
112 | private void nsAdvect(int N, int b, ref double[] d, ref double[] d0, ref double[] u, ref double[] v, double dt) | 108 | private void nsAdvect(int N, int b, ref double[] d, ref double[] d0, ref double[] u, ref double[] v, double dt) |
@@ -114,27 +110,27 @@ namespace libTerrain | |||
114 | int i, j, i0, j0, i1, j1; | 110 | int i, j, i0, j0, i1, j1; |
115 | double x, y, s0, t0, s1, t1, dt0; | 111 | double x, y, s0, t0, s1, t1, dt0; |
116 | 112 | ||
117 | dt0 = dt * N; | 113 | dt0 = dt*N; |
118 | 114 | ||
119 | for (i = 1; i <= N; i++) | 115 | for (i = 1; i <= N; i++) |
120 | { | 116 | { |
121 | for (j = 1; j <= N; j++) | 117 | for (j = 1; j <= N; j++) |
122 | { | 118 | { |
123 | x = i - dt0 * u[nsIX(i, j, N)]; | 119 | x = i - dt0*u[nsIX(i, j, N)]; |
124 | y = j - dt0 * v[nsIX(i, j, N)]; | 120 | y = j - dt0*v[nsIX(i, j, N)]; |
125 | 121 | ||
126 | if (x < 0.5) | 122 | if (x < 0.5) |
127 | x = 0.5; | 123 | x = 0.5; |
128 | if (x > N + 0.5) | 124 | if (x > N + 0.5) |
129 | x = N + 0.5; | 125 | x = N + 0.5; |
130 | i0 = (int)x; | 126 | i0 = (int) x; |
131 | i1 = i0 + 1; | 127 | i1 = i0 + 1; |
132 | 128 | ||
133 | if (y < 0.5) | 129 | if (y < 0.5) |
134 | y = 0.5; | 130 | y = 0.5; |
135 | if (y > N + 0.5) | 131 | if (y > N + 0.5) |
136 | y = N + 0.5; | 132 | y = N + 0.5; |
137 | j0 = (int)y; | 133 | j0 = (int) y; |
138 | j1 = j0 + 1; | 134 | j1 = j0 + 1; |
139 | 135 | ||
140 | s1 = x - i0; | 136 | s1 = x - i0; |
@@ -142,8 +138,8 @@ namespace libTerrain | |||
142 | t1 = y - j0; | 138 | t1 = y - j0; |
143 | t0 = 1 - t1; | 139 | t0 = 1 - t1; |
144 | 140 | ||
145 | d[nsIX(i, j, N)] = s0 * (t0 * d0[nsIX(i0, j0, N)] + t1 * d0[nsIX(i0, j1, N)]) + | 141 | d[nsIX(i, j, N)] = s0*(t0*d0[nsIX(i0, j0, N)] + t1*d0[nsIX(i0, j1, N)]) + |
146 | s1 * (t0 * d0[nsIX(i1, j0, N)] + t1 * d0[nsIX(i1, j1, N)]); | 142 | s1*(t0*d0[nsIX(i1, j0, N)] + t1*d0[nsIX(i1, j1, N)]); |
147 | } | 143 | } |
148 | } | 144 | } |
149 | 145 | ||
@@ -158,7 +154,9 @@ namespace libTerrain | |||
158 | { | 154 | { |
159 | for (j = 1; j <= N; j++) | 155 | for (j = 1; j <= N; j++) |
160 | { | 156 | { |
161 | div[nsIX(i, j, N)] = -0.5 * (u[nsIX(i + 1, j, N)] - u[nsIX(i - 1, j, N)] + v[nsIX(i, j + 1, N)] - v[nsIX(i, j - 1, N)]) / N; | 157 | div[nsIX(i, j, N)] = -0.5* |
158 | (u[nsIX(i + 1, j, N)] - u[nsIX(i - 1, j, N)] + v[nsIX(i, j + 1, N)] - | ||
159 | v[nsIX(i, j - 1, N)])/N; | ||
162 | p[nsIX(i, j, N)] = 0; | 160 | p[nsIX(i, j, N)] = 0; |
163 | } | 161 | } |
164 | } | 162 | } |
@@ -172,8 +170,8 @@ namespace libTerrain | |||
172 | { | 170 | { |
173 | for (j = 1; j <= N; j++) | 171 | for (j = 1; j <= N; j++) |
174 | { | 172 | { |
175 | u[nsIX(i, j, N)] -= 0.5 * N * (p[nsIX(i + 1, j, N)] - p[nsIX(i - 1, j, N)]); | 173 | u[nsIX(i, j, N)] -= 0.5*N*(p[nsIX(i + 1, j, N)] - p[nsIX(i - 1, j, N)]); |
176 | v[nsIX(i, j, N)] -= 0.5 * N * (p[nsIX(i, j + 1, N)] - p[nsIX(i, j - 1, N)]); | 174 | v[nsIX(i, j, N)] -= 0.5*N*(p[nsIX(i, j + 1, N)] - p[nsIX(i, j - 1, N)]); |
177 | } | 175 | } |
178 | } | 176 | } |
179 | 177 | ||
@@ -181,7 +179,8 @@ namespace libTerrain | |||
181 | nsSetBnd(N, 2, ref v); | 179 | nsSetBnd(N, 2, ref v); |
182 | } | 180 | } |
183 | 181 | ||
184 | private void nsDensStep(int N, ref double[] x, ref double[] x0, ref double[] u, ref double[] v, double diff, double dt) | 182 | private void nsDensStep(int N, ref double[] x, ref double[] x0, ref double[] u, ref double[] v, double diff, |
183 | double dt) | ||
185 | { | 184 | { |
186 | nsAddSource(N, ref x, ref x0, dt); | 185 | nsAddSource(N, ref x, ref x0, dt); |
187 | nsSwap(ref x0, ref x); | 186 | nsSwap(ref x0, ref x); |
@@ -190,7 +189,8 @@ namespace libTerrain | |||
190 | nsAdvect(N, 0, ref x, ref x0, ref u, ref v, dt); | 189 | nsAdvect(N, 0, ref x, ref x0, ref u, ref v, dt); |
191 | } | 190 | } |
192 | 191 | ||
193 | private void nsVelStep(int N, ref double[] u, ref double[] v, ref double[] u0, ref double[] v0, double visc, double dt) | 192 | private void nsVelStep(int N, ref double[] u, ref double[] v, ref double[] u0, ref double[] v0, double visc, |
193 | double dt) | ||
194 | { | 194 | { |
195 | nsAddSource(N, ref u, ref u0, dt); | 195 | nsAddSource(N, ref u, ref u0, dt); |
196 | nsAddSource(N, ref v, ref v0, dt); | 196 | nsAddSource(N, ref v, ref v0, dt); |
@@ -236,17 +236,17 @@ namespace libTerrain | |||
236 | 236 | ||
237 | private void nsSimulate(int N, int rounds, double dt, double diff, double visc) | 237 | private void nsSimulate(int N, int rounds, double dt, double diff, double visc) |
238 | { | 238 | { |
239 | int size = (N * 2) * (N * 2); | 239 | int size = (N*2)*(N*2); |
240 | 240 | ||
241 | double[] u = new double[size]; // Force, X axis | 241 | double[] u = new double[size]; // Force, X axis |
242 | double[] v = new double[size]; // Force, Y axis | 242 | double[] v = new double[size]; // Force, Y axis |
243 | double[] u_prev = new double[size]; | 243 | double[] u_prev = new double[size]; |
244 | double[] v_prev = new double[size]; | 244 | double[] v_prev = new double[size]; |
245 | double[] dens = new double[size]; | 245 | double[] dens = new double[size]; |
246 | double[] dens_prev = new double[size]; | 246 | double[] dens_prev = new double[size]; |
247 | 247 | ||
248 | nsDoublesToBuffer(this.map, N, ref dens); | 248 | nsDoublesToBuffer(map, N, ref dens); |
249 | nsDoublesToBuffer(this.map, N, ref dens_prev); | 249 | nsDoublesToBuffer(map, N, ref dens_prev); |
250 | 250 | ||
251 | for (int i = 0; i < rounds; i++) | 251 | for (int i = 0; i < rounds; i++) |
252 | { | 252 | { |
@@ -258,7 +258,7 @@ namespace libTerrain | |||
258 | nsDensStep(N, ref dens, ref dens_prev, ref u, ref v, diff, dt); | 258 | nsDensStep(N, ref dens, ref dens_prev, ref u, ref v, diff, dt); |
259 | } | 259 | } |
260 | 260 | ||
261 | nsBufferToDoubles(ref dens, N, ref this.map); | 261 | nsBufferToDoubles(ref dens, N, ref map); |
262 | } | 262 | } |
263 | 263 | ||
264 | /// <summary> | 264 | /// <summary> |
@@ -270,14 +270,14 @@ namespace libTerrain | |||
270 | /// <param name="visc">Fluid viscosity (Recommended: 0.0)</param> | 270 | /// <param name="visc">Fluid viscosity (Recommended: 0.0)</param> |
271 | public void navierStokes(int rounds, double dt, double diff, double visc) | 271 | public void navierStokes(int rounds, double dt, double diff, double visc) |
272 | { | 272 | { |
273 | nsSimulate(this.h, rounds, dt, diff, visc); | 273 | nsSimulate(h, rounds, dt, diff, visc); |
274 | } | 274 | } |
275 | 275 | ||
276 | public void navierStokes(int rounds, double dt, double diff, double visc, ref double[,] uret, ref double[,] vret) | 276 | public void navierStokes(int rounds, double dt, double diff, double visc, ref double[,] uret, ref double[,] vret) |
277 | { | 277 | { |
278 | int N = this.h; | 278 | int N = h; |
279 | 279 | ||
280 | int size = (N * 2) * (N * 2); | 280 | int size = (N*2)*(N*2); |
281 | 281 | ||
282 | double[] u = new double[size]; // Force, X axis | 282 | double[] u = new double[size]; // Force, X axis |
283 | double[] v = new double[size]; // Force, Y axis | 283 | double[] v = new double[size]; // Force, Y axis |
@@ -286,8 +286,8 @@ namespace libTerrain | |||
286 | double[] dens = new double[size]; | 286 | double[] dens = new double[size]; |
287 | double[] dens_prev = new double[size]; | 287 | double[] dens_prev = new double[size]; |
288 | 288 | ||
289 | nsDoublesToBuffer(this.map, N, ref dens); | 289 | nsDoublesToBuffer(map, N, ref dens); |
290 | nsDoublesToBuffer(this.map, N, ref dens_prev); | 290 | nsDoublesToBuffer(map, N, ref dens_prev); |
291 | 291 | ||
292 | for (int i = 0; i < rounds; i++) | 292 | for (int i = 0; i < rounds; i++) |
293 | { | 293 | { |
@@ -301,7 +301,7 @@ namespace libTerrain | |||
301 | 301 | ||
302 | nsBufferToDoubles(ref u, N, ref uret); | 302 | nsBufferToDoubles(ref u, N, ref uret); |
303 | nsBufferToDoubles(ref v, N, ref vret); | 303 | nsBufferToDoubles(ref v, N, ref vret); |
304 | nsBufferToDoubles(ref dens, N, ref this.map); | 304 | nsBufferToDoubles(ref dens, N, ref map); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | } \ No newline at end of file | 307 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs index 9148c3c..0ca3d48 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace libTerrain | 29 | namespace libTerrain |
34 | { | 30 | { |
35 | partial class Channel | 31 | partial class Channel |
@@ -47,10 +43,11 @@ namespace libTerrain | |||
47 | double[,] lastFrame; | 43 | double[,] lastFrame; |
48 | double[,] thisFrame; | 44 | double[,] thisFrame; |
49 | 45 | ||
50 | lastFrame = (double[,])map.Clone(); | 46 | lastFrame = (double[,]) map.Clone(); |
51 | thisFrame = (double[,])map.Clone(); | 47 | thisFrame = (double[,]) map.Clone(); |
52 | 48 | ||
53 | NeighbourSystem type = NeighbourSystem.Moore; // Using moore neighbourhood (twice as computationally expensive) | 49 | NeighbourSystem type = NeighbourSystem.Moore; |
50 | // Using moore neighbourhood (twice as computationally expensive) | ||
54 | int NEIGHBOUR_ME = 4; // I am always 4 in both systems. | 51 | int NEIGHBOUR_ME = 4; // I am always 4 in both systems. |
55 | 52 | ||
56 | int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; | 53 | int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; |
@@ -88,19 +85,18 @@ namespace libTerrain | |||
88 | 85 | ||
89 | if (target > heightF + talus) | 86 | if (target > heightF + talus) |
90 | { | 87 | { |
91 | double calc = c * ((target - heightF) - talus); | 88 | double calc = c*((target - heightF) - talus); |
92 | heightF += calc; | 89 | heightF += calc; |
93 | target -= calc; | 90 | target -= calc; |
94 | } | 91 | } |
95 | 92 | ||
96 | thisFrame[x, y] = heightF; | 93 | thisFrame[x, y] = heightF; |
97 | thisFrame[coords[0], coords[1]] = target; | 94 | thisFrame[coords[0], coords[1]] = target; |
98 | |||
99 | } | 95 | } |
100 | } | 96 | } |
101 | } | 97 | } |
102 | } | 98 | } |
103 | lastFrame = (double[,])thisFrame.Clone(); | 99 | lastFrame = (double[,]) thisFrame.Clone(); |
104 | } | 100 | } |
105 | 101 | ||
106 | map = thisFrame; | 102 | map = thisFrame; |
@@ -109,4 +105,4 @@ namespace libTerrain | |||
109 | return this; | 105 | return this; |
110 | } | 106 | } |
111 | } | 107 | } |
112 | } | 108 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs index 316bd9a..4004747 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs | |||
@@ -26,19 +26,15 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace libTerrain | 29 | namespace libTerrain |
34 | { | 30 | { |
35 | partial class Channel | 31 | partial class Channel |
36 | { | 32 | { |
37 | enum NeighbourSystem | 33 | private enum NeighbourSystem |
38 | { | 34 | { |
39 | Moore, | 35 | Moore, |
40 | VonNeumann | 36 | VonNeumann |
41 | }; | 37 | } ; |
42 | 38 | ||
43 | private int[] Neighbours(NeighbourSystem type, int index) | 39 | private int[] Neighbours(NeighbourSystem type, int index) |
44 | { | 40 | { |
@@ -138,4 +134,4 @@ namespace libTerrain | |||
138 | return coord; | 134 | return coord; |
139 | } | 135 | } |
140 | } | 136 | } |
141 | } | 137 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs index 0306e58..ae7530c 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
@@ -138,7 +136,7 @@ namespace libTerrain | |||
138 | { | 136 | { |
139 | for (y = 0; y < A.h; y++) | 137 | for (y = 0; y < A.h; y++) |
140 | { | 138 | { |
141 | A.map[x, y] = Math.Pow(A.map[x,y],B.map[x, y]); | 139 | A.map[x, y] = Math.Pow(A.map[x, y], B.map[x, y]); |
142 | } | 140 | } |
143 | } | 141 | } |
144 | 142 | ||
@@ -230,7 +228,7 @@ namespace libTerrain | |||
230 | { | 228 | { |
231 | for (y = 0; y < A.h; y++) | 229 | for (y = 0; y < A.h; y++) |
232 | { | 230 | { |
233 | A.map[x, y] = Math.Pow(A.map[x,y],B); | 231 | A.map[x, y] = Math.Pow(A.map[x, y], B); |
234 | } | 232 | } |
235 | } | 233 | } |
236 | 234 | ||
@@ -238,6 +236,5 @@ namespace libTerrain | |||
238 | 236 | ||
239 | return A; | 237 | return A; |
240 | } | 238 | } |
241 | |||
242 | } | 239 | } |
243 | } | 240 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs index 9985f03..1d52da9 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace libTerrain | 29 | namespace libTerrain |
34 | { | 30 | { |
35 | public class Point2D | 31 | public class Point2D |
@@ -43,4 +39,4 @@ namespace libTerrain | |||
43 | y = Y; | 39 | y = Y; |
44 | } | 40 | } |
45 | } | 41 | } |
46 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs index 3207f15..d805794 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs | |||
@@ -27,33 +27,34 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace libTerrain | 31 | namespace libTerrain |
34 | { | 32 | { |
35 | class Tools | 33 | internal class Tools |
36 | { | 34 | { |
37 | public static double LinearInterpolate(double a, double b, double amount) | 35 | public static double LinearInterpolate(double a, double b, double amount) |
38 | { | 36 | { |
39 | return a + ((b - a) * amount); | 37 | return a + ((b - a)*amount); |
40 | } | 38 | } |
41 | 39 | ||
42 | public static double ExponentialInterpolate(double a, double b, double amount) | 40 | public static double ExponentialInterpolate(double a, double b, double amount) |
43 | { | 41 | { |
44 | a = Math.Pow(a, amount); | 42 | a = Math.Pow(a, amount); |
45 | b = Math.Pow(b - a, 1.0 - amount); | 43 | b = Math.Pow(b - a, 1.0 - amount); |
46 | return a+b; | 44 | return a + b; |
47 | } | 45 | } |
48 | 46 | ||
49 | public static int PowerOf2Log2(int n) { | 47 | public static int PowerOf2Log2(int n) |
50 | for (int i = 0; i < 31; i++) { | 48 | { |
51 | if ((n & 1) == 1) { | 49 | for (int i = 0; i < 31; i++) |
52 | return i; | 50 | { |
53 | } | 51 | if ((n & 1) == 1) |
54 | n >>= 1; | 52 | { |
55 | } | 53 | return i; |
56 | return 0; | 54 | } |
57 | } | 55 | n >>= 1; |
56 | } | ||
57 | return 0; | ||
58 | } | ||
58 | } | 59 | } |
59 | } | 60 | } \ No newline at end of file |