diff options
Diffstat (limited to 'src')
66 files changed, 0 insertions, 7184 deletions
diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs deleted file mode 100644 index b88eb75..0000000 --- a/src/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | //------------------------------------------------------------------------------ | ||
6 | // <auto-generated> | ||
7 | // This code was generated by a tool. | ||
8 | // Runtime Version:2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </auto-generated> | ||
13 | //------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.0.0.1")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim")] | ||
19 | [assembly: AssemblyDescriptionAttribute("The C# implementation of the simulator portion of OGS")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/Assets/AssetCache.cs b/src/Assets/AssetCache.cs deleted file mode 100644 index d35b482..0000000 --- a/src/Assets/AssetCache.cs +++ /dev/null | |||
@@ -1,436 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Threading; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim; | ||
34 | using OpenSim.GridServers; | ||
35 | |||
36 | namespace OpenSim.Assets | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Manages local cache of assets and their sending to viewers. | ||
40 | /// </summary> | ||
41 | public class AssetCache : IAssetReceiver | ||
42 | { | ||
43 | public Dictionary<libsecondlife.LLUUID, AssetInfo> Assets; | ||
44 | public Dictionary<libsecondlife.LLUUID, TextureImage> Textures; | ||
45 | |||
46 | public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers | ||
47 | public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent | ||
48 | |||
49 | public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server | ||
50 | public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server | ||
51 | |||
52 | private IAssetServer _assetServer; | ||
53 | private Thread _assetCacheThread; | ||
54 | |||
55 | /// <summary> | ||
56 | /// | ||
57 | /// </summary> | ||
58 | public AssetCache( IAssetServer assetServer) | ||
59 | { | ||
60 | _assetServer = assetServer; | ||
61 | _assetServer.SetReceiver(this); | ||
62 | Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo> (); | ||
63 | Textures = new Dictionary<libsecondlife.LLUUID, TextureImage> (); | ||
64 | this._assetCacheThread = new Thread( new ThreadStart(RunAssetManager)); | ||
65 | this._assetCacheThread.IsBackground = true; | ||
66 | this._assetCacheThread.Start(); | ||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// | ||
71 | /// </summary> | ||
72 | private void RunAssetManager() | ||
73 | { | ||
74 | this.ProcessAssetQueue(); | ||
75 | this.ProcessTextureQueue(); | ||
76 | Thread.Sleep(100); | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// | ||
81 | /// </summary> | ||
82 | private void ProcessTextureQueue() | ||
83 | { | ||
84 | if(this.TextureRequests.Count == 0) | ||
85 | { | ||
86 | //no requests waiting | ||
87 | return; | ||
88 | } | ||
89 | int num; | ||
90 | |||
91 | if(this.TextureRequests.Count < 5) | ||
92 | { | ||
93 | //lower than 5 so do all of them | ||
94 | num = this.TextureRequests.Count; | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | num=5; | ||
99 | } | ||
100 | AssetRequest req; | ||
101 | for(int i = 0; i < num; i++) | ||
102 | { | ||
103 | req=(AssetRequest)this.TextureRequests[i]; | ||
104 | |||
105 | if(req.PacketCounter == 0) | ||
106 | { | ||
107 | //first time for this request so send imagedata packet | ||
108 | if(req.NumPackets == 1) | ||
109 | { | ||
110 | //only one packet so send whole file | ||
111 | ImageDataPacket im = new ImageDataPacket(); | ||
112 | im.ImageID.Packets = 1; | ||
113 | im.ImageID.ID = req.ImageInfo.FullID; | ||
114 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
115 | im.ImageData.Data = req.ImageInfo.Data; | ||
116 | im.ImageID.Codec = 2; | ||
117 | req.RequestUser.OutPacket(im); | ||
118 | req.PacketCounter++; | ||
119 | //req.ImageInfo.l= time; | ||
120 | //System.Console.WriteLine("sent texture: "+req.image_info.FullID); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | //more than one packet so split file up | ||
125 | ImageDataPacket im = new ImageDataPacket(); | ||
126 | im.ImageID.Packets = (ushort)req.NumPackets; | ||
127 | im.ImageID.ID = req.ImageInfo.FullID; | ||
128 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
129 | im.ImageData.Data = new byte[600]; | ||
130 | Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); | ||
131 | im.ImageID.Codec = 2; | ||
132 | req.RequestUser.OutPacket(im); | ||
133 | req.PacketCounter++; | ||
134 | //req.ImageInfo.last_used = time; | ||
135 | //System.Console.WriteLine("sent first packet of texture: | ||
136 | } | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | //send imagepacket | ||
141 | //more than one packet so split file up | ||
142 | ImagePacketPacket im = new ImagePacketPacket(); | ||
143 | im.ImageID.Packet = (ushort)req.PacketCounter; | ||
144 | im.ImageID.ID = req.ImageInfo.FullID; | ||
145 | int size = req.ImageInfo.Data.Length - 600 - 1000*(req.PacketCounter - 1); | ||
146 | if(size > 1000) size = 1000; | ||
147 | im.ImageData.Data = new byte[size]; | ||
148 | Array.Copy(req.ImageInfo.Data, 600 + 1000*(req.PacketCounter - 1), im.ImageData.Data, 0, size); | ||
149 | req.RequestUser.OutPacket(im); | ||
150 | req.PacketCounter++; | ||
151 | //req.ImageInfo.last_used = time; | ||
152 | //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | //remove requests that have been completed | ||
157 | int count = 0; | ||
158 | for(int i = 0; i < num; i++) | ||
159 | { | ||
160 | req=(AssetRequest)this.TextureRequests[count]; | ||
161 | if(req.PacketCounter == req.NumPackets) | ||
162 | { | ||
163 | this.TextureRequests.Remove(req); | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | count++; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | } | ||
172 | public void AssetReceived(AssetBase asset, bool IsTexture) | ||
173 | { | ||
174 | //check if it is a texture or not | ||
175 | //then add to the correct cache list | ||
176 | //then check for waiting requests for this asset/texture (in the Requested lists) | ||
177 | //and move those requests into the Requests list. | ||
178 | if(IsTexture) | ||
179 | { | ||
180 | TextureImage image = new TextureImage(asset); | ||
181 | this.Textures.Add(image.FullID, image); | ||
182 | if(this.RequestedTextures.ContainsKey(image.FullID)) | ||
183 | { | ||
184 | AssetRequest req = this.RequestedTextures[image.FullID]; | ||
185 | req.ImageInfo = image; | ||
186 | this.RequestedTextures.Remove(image.FullID); | ||
187 | this.TextureRequests.Add(req); | ||
188 | } | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | AssetInfo assetInf = new AssetInfo(asset); | ||
193 | this.Assets.Add(assetInf.FullID, assetInf); | ||
194 | if(this.RequestedAssets.ContainsKey(assetInf.FullID)) | ||
195 | { | ||
196 | AssetRequest req = this.RequestedAssets[assetInf.FullID]; | ||
197 | req.AssetInf = assetInf; | ||
198 | this.RequestedAssets.Remove(assetInf.FullID); | ||
199 | this.AssetRequests.Add(req); | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | |||
204 | public void AssetNotFound(AssetBase asset) | ||
205 | { | ||
206 | //the asset server had no knowledge of requested asset | ||
207 | |||
208 | } | ||
209 | |||
210 | #region Assets | ||
211 | /// <summary> | ||
212 | /// | ||
213 | /// </summary> | ||
214 | /// <param name="userInfo"></param> | ||
215 | /// <param name="transferRequest"></param> | ||
216 | public void AddAssetRequest(OpenSimClient userInfo, TransferRequestPacket transferRequest) | ||
217 | { | ||
218 | LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); | ||
219 | //check to see if asset is in local cache, if not we need to request it from asset server. | ||
220 | if(!this.Assets.ContainsKey(requestID)) | ||
221 | { | ||
222 | //not found asset | ||
223 | // so request from asset server | ||
224 | AssetRequest request = new AssetRequest(); | ||
225 | request.RequestUser = userInfo; | ||
226 | request.RequestAssetID = requestID; | ||
227 | request.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
228 | this.RequestedAssets.Add(requestID,request); | ||
229 | this._assetServer.RequestAsset(requestID, false); | ||
230 | return; | ||
231 | } | ||
232 | //it is in our cache | ||
233 | AssetInfo asset = this.Assets[requestID]; | ||
234 | |||
235 | //work out how many packets it should be sent in | ||
236 | // and add to the AssetRequests list | ||
237 | AssetRequest req = new AssetRequest(); | ||
238 | req.RequestUser = userInfo; | ||
239 | req.RequestAssetID = requestID; | ||
240 | req.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
241 | req.AssetInf = asset; | ||
242 | |||
243 | if(asset.Data.LongLength>600) | ||
244 | { | ||
245 | //over 600 bytes so split up file | ||
246 | req.NumPackets = 1 + (int)(asset.Data.Length-600+999)/1000; | ||
247 | } | ||
248 | else | ||
249 | { | ||
250 | req.NumPackets = 1; | ||
251 | } | ||
252 | |||
253 | this.AssetRequests.Add(req); | ||
254 | } | ||
255 | |||
256 | /// <summary> | ||
257 | /// | ||
258 | /// </summary> | ||
259 | private void ProcessAssetQueue() | ||
260 | { | ||
261 | if(this.AssetRequests.Count == 0) | ||
262 | { | ||
263 | //no requests waiting | ||
264 | return; | ||
265 | } | ||
266 | int num; | ||
267 | |||
268 | if(this.AssetRequests.Count < 5) | ||
269 | { | ||
270 | //lower than 5 so do all of them | ||
271 | num = this.AssetRequests.Count; | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | num=5; | ||
276 | } | ||
277 | AssetRequest req; | ||
278 | for(int i = 0; i < num; i++) | ||
279 | { | ||
280 | req=(AssetRequest)this.AssetRequests[i]; | ||
281 | |||
282 | TransferInfoPacket Transfer = new TransferInfoPacket(); | ||
283 | Transfer.TransferInfo.ChannelType = 2; | ||
284 | Transfer.TransferInfo.Status = 0; | ||
285 | Transfer.TransferInfo.TargetType = 0; | ||
286 | Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); | ||
287 | Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; | ||
288 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | ||
289 | req.RequestUser.OutPacket(Transfer); | ||
290 | |||
291 | if(req.NumPackets == 1) | ||
292 | { | ||
293 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
294 | TransferPacket.TransferData.Packet = 0; | ||
295 | TransferPacket.TransferData.ChannelType = 2; | ||
296 | TransferPacket.TransferData.TransferID=req.TransferRequestID; | ||
297 | TransferPacket.TransferData.Data = req.AssetInf.Data; | ||
298 | TransferPacket.TransferData.Status = 1; | ||
299 | req.RequestUser.OutPacket(TransferPacket); | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | //more than one packet so split file up , for now it can't be bigger than 2000 bytes | ||
304 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
305 | TransferPacket.TransferData.Packet = 0; | ||
306 | TransferPacket.TransferData.ChannelType = 2; | ||
307 | TransferPacket.TransferData.TransferID=req.TransferRequestID; | ||
308 | byte[] chunk = new byte[1000]; | ||
309 | Array.Copy(req.AssetInf.Data,chunk,1000); | ||
310 | TransferPacket.TransferData.Data = chunk; | ||
311 | TransferPacket.TransferData.Status = 0; | ||
312 | req.RequestUser.OutPacket(TransferPacket); | ||
313 | |||
314 | TransferPacket = new TransferPacketPacket(); | ||
315 | TransferPacket.TransferData.Packet = 1; | ||
316 | TransferPacket.TransferData.ChannelType = 2; | ||
317 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
318 | byte[] chunk1 = new byte[(req.AssetInf.Data.Length-1000)]; | ||
319 | Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); | ||
320 | TransferPacket.TransferData.Data = chunk1; | ||
321 | TransferPacket.TransferData.Status = 1; | ||
322 | req.RequestUser.OutPacket(TransferPacket); | ||
323 | } | ||
324 | |||
325 | } | ||
326 | |||
327 | //remove requests that have been completed | ||
328 | for(int i = 0; i < num; i++) | ||
329 | { | ||
330 | this.AssetRequests.RemoveAt(0); | ||
331 | } | ||
332 | |||
333 | } | ||
334 | |||
335 | #endregion | ||
336 | |||
337 | #region Textures | ||
338 | /// <summary> | ||
339 | /// | ||
340 | /// </summary> | ||
341 | /// <param name="userInfo"></param> | ||
342 | /// <param name="imageID"></param> | ||
343 | public void AddTextureRequest(OpenSimClient userInfo, LLUUID imageID) | ||
344 | { | ||
345 | //check to see if texture is in local cache, if not request from asset server | ||
346 | if(!this.Textures.ContainsKey(imageID)) | ||
347 | { | ||
348 | //not is cache so request from asset server | ||
349 | AssetRequest request = new AssetRequest(); | ||
350 | request.RequestUser = userInfo; | ||
351 | request.RequestAssetID = imageID; | ||
352 | request.IsTextureRequest = true; | ||
353 | this.RequestedTextures.Add(imageID, request); | ||
354 | this._assetServer.RequestAsset(imageID, true); | ||
355 | return; | ||
356 | } | ||
357 | TextureImage imag = this.Textures[imageID]; | ||
358 | AssetRequest req = new AssetRequest(); | ||
359 | req.RequestUser = userInfo; | ||
360 | req.RequestAssetID = imageID; | ||
361 | req.IsTextureRequest = true; | ||
362 | req.ImageInfo = imag; | ||
363 | |||
364 | if(imag.Data.LongLength>600) | ||
365 | { | ||
366 | //over 600 bytes so split up file | ||
367 | req.NumPackets = 1 + (int)(imag.Data.Length-600+999)/1000; | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | req.NumPackets = 1; | ||
372 | } | ||
373 | |||
374 | this.TextureRequests.Add(req); | ||
375 | } | ||
376 | #endregion | ||
377 | |||
378 | } | ||
379 | |||
380 | public class AssetRequest | ||
381 | { | ||
382 | public OpenSimClient RequestUser; | ||
383 | public LLUUID RequestAssetID; | ||
384 | public AssetInfo AssetInf; | ||
385 | public TextureImage ImageInfo; | ||
386 | public LLUUID TransferRequestID; | ||
387 | public long DataPointer = 0; | ||
388 | public int NumPackets = 0; | ||
389 | public int PacketCounter = 0; | ||
390 | public bool IsTextureRequest; | ||
391 | //public bool AssetInCache; | ||
392 | //public int TimeRequested; | ||
393 | |||
394 | public AssetRequest() | ||
395 | { | ||
396 | |||
397 | } | ||
398 | } | ||
399 | |||
400 | public class AssetInfo : AssetBase | ||
401 | { | ||
402 | public AssetInfo() | ||
403 | { | ||
404 | |||
405 | } | ||
406 | |||
407 | public AssetInfo(AssetBase aBase) | ||
408 | { | ||
409 | Data= aBase.Data; | ||
410 | FullID = aBase.FullID; | ||
411 | Type = aBase.Type; | ||
412 | InvType = aBase.InvType; | ||
413 | Name= aBase.Name; | ||
414 | Description = aBase.Description; | ||
415 | } | ||
416 | } | ||
417 | |||
418 | public class TextureImage : AssetBase | ||
419 | { | ||
420 | public TextureImage() | ||
421 | { | ||
422 | |||
423 | } | ||
424 | |||
425 | public TextureImage(AssetBase aBase) | ||
426 | { | ||
427 | Data= aBase.Data; | ||
428 | FullID = aBase.FullID; | ||
429 | Type = aBase.Type; | ||
430 | InvType = aBase.InvType; | ||
431 | Name= aBase.Name; | ||
432 | Description = aBase.Description; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | } | ||
diff --git a/src/CAPS/SimHttp.cs b/src/CAPS/SimHttp.cs deleted file mode 100644 index c0373de..0000000 --- a/src/CAPS/SimHttp.cs +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSimCAPS project, http://osgrid.org/ | ||
3 | |||
4 | |||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using Nwc.XmlRpc; | ||
33 | using System.Threading; | ||
34 | using System.Text.RegularExpressions; | ||
35 | using System.Net; | ||
36 | using System.IO; | ||
37 | using System.Collections; | ||
38 | using System.Collections.Generic; | ||
39 | using libsecondlife; | ||
40 | using ServerConsole; | ||
41 | using OpenSim.GridServers; | ||
42 | |||
43 | namespace OpenSim | ||
44 | { | ||
45 | // Dummy HTTP server, does nothing useful for now | ||
46 | |||
47 | public class SimCAPSHTTPServer { | ||
48 | public Thread HTTPD; | ||
49 | public HttpListener Listener; | ||
50 | |||
51 | public SimCAPSHTTPServer() { | ||
52 | ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server"); | ||
53 | HTTPD = new Thread(new ThreadStart(StartHTTP)); | ||
54 | HTTPD.Start(); | ||
55 | } | ||
56 | |||
57 | public void StartHTTP() { | ||
58 | try | ||
59 | { | ||
60 | ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); | ||
61 | Listener = new HttpListener(); | ||
62 | |||
63 | Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/"); | ||
64 | Listener.Start(); | ||
65 | |||
66 | HttpListenerContext context; | ||
67 | while(true) { | ||
68 | context = Listener.GetContext(); | ||
69 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); | ||
70 | } | ||
71 | } | ||
72 | catch (Exception e) | ||
73 | { | ||
74 | ServerConsole.MainConsole.Instance.WriteLine(e.Message); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | static string ParseXMLRPC(string requestBody) { | ||
79 | try | ||
80 | { | ||
81 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | ||
82 | |||
83 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
84 | switch(request.MethodName) { | ||
85 | case "expect_user": | ||
86 | GridServers.agentcircuitdata agent_data = new GridServers.agentcircuitdata(); | ||
87 | agent_data.SessionID = new LLUUID((string)requestData["session_id"]); | ||
88 | agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); | ||
89 | agent_data.firstname = (string)requestData["firstname"]; | ||
90 | agent_data.lastname = (string)requestData["lastname"]; | ||
91 | agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); | ||
92 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
93 | if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote") | ||
94 | { | ||
95 | ((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data); | ||
96 | } | ||
97 | return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; | ||
98 | break; | ||
99 | } | ||
100 | } | ||
101 | catch(Exception e) | ||
102 | { | ||
103 | Console.WriteLine(e.ToString()); | ||
104 | } | ||
105 | return ""; | ||
106 | } | ||
107 | |||
108 | static string ParseREST(string requestBody, string requestURL) { | ||
109 | return ""; | ||
110 | } | ||
111 | |||
112 | static string ParseLLSDXML(string requestBody) { | ||
113 | // dummy function for now - IMPLEMENT ME! | ||
114 | return ""; | ||
115 | } | ||
116 | |||
117 | static void HandleRequest(Object stateinfo) { | ||
118 | HttpListenerContext context=(HttpListenerContext)stateinfo; | ||
119 | |||
120 | HttpListenerRequest request = context.Request; | ||
121 | HttpListenerResponse response = context.Response; | ||
122 | |||
123 | response.KeepAlive=false; | ||
124 | response.SendChunked=false; | ||
125 | |||
126 | System.IO.Stream body = request.InputStream; | ||
127 | System.Text.Encoding encoding = System.Text.Encoding.UTF8; | ||
128 | System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); | ||
129 | |||
130 | string requestBody = reader.ReadToEnd(); | ||
131 | body.Close(); | ||
132 | reader.Close(); | ||
133 | |||
134 | string responseString=""; | ||
135 | switch(request.ContentType) { | ||
136 | case "text/xml": | ||
137 | // must be XML-RPC, so pass to the XML-RPC parser | ||
138 | |||
139 | responseString=ParseXMLRPC(requestBody); | ||
140 | response.AddHeader("Content-type","text/xml"); | ||
141 | break; | ||
142 | |||
143 | case "application/xml": | ||
144 | // probably LLSD we hope, otherwise it should be ignored by the parser | ||
145 | responseString=ParseLLSDXML(requestBody); | ||
146 | response.AddHeader("Content-type","application/xml"); | ||
147 | break; | ||
148 | |||
149 | case null: | ||
150 | // must be REST or invalid crap, so pass to the REST parser | ||
151 | responseString=ParseREST(request.Url.OriginalString,requestBody); | ||
152 | break; | ||
153 | } | ||
154 | |||
155 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); | ||
156 | System.IO.Stream output = response.OutputStream; | ||
157 | response.SendChunked=false; | ||
158 | response.ContentLength64=buffer.Length; | ||
159 | output.Write(buffer,0,buffer.Length); | ||
160 | output.Close(); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | |||
165 | } | ||
diff --git a/src/Config.cs b/src/Config.cs deleted file mode 100644 index 1c0a6cc..0000000 --- a/src/Config.cs +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | * Copyright (c) <year>, <copyright holder> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.IO; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.world; | ||
35 | |||
36 | namespace OpenSim | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// This class handles connection to the underlying database used for configuration of the region. | ||
40 | /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate | ||
41 | /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from | ||
42 | /// what is hardcoded here and then saved into opensim.yap for future startups. | ||
43 | /// </summary> | ||
44 | |||
45 | |||
46 | public abstract class SimConfig | ||
47 | { | ||
48 | public string RegionName; | ||
49 | |||
50 | public uint RegionLocX; | ||
51 | public uint RegionLocY; | ||
52 | public ulong RegionHandle; | ||
53 | |||
54 | public int IPListenPort; | ||
55 | public string IPListenAddr; | ||
56 | |||
57 | public string AssetURL; | ||
58 | public string AssetSendKey; | ||
59 | |||
60 | public string GridURL; | ||
61 | public string GridSendKey; | ||
62 | public string GridRecvKey; | ||
63 | public string UserURL; | ||
64 | public string UserSendKey; | ||
65 | public string UserRecvKey; | ||
66 | |||
67 | |||
68 | public abstract void InitConfig(); | ||
69 | public abstract void LoadFromGrid(); | ||
70 | public abstract World LoadWorld(); | ||
71 | public abstract void SaveMap(); | ||
72 | |||
73 | } | ||
74 | |||
75 | public interface ISimConfig | ||
76 | { | ||
77 | SimConfig GetConfigObject(); | ||
78 | } | ||
79 | } | ||
diff --git a/src/Config/SimConfig/AssemblyInfo.cs b/src/Config/SimConfig/AssemblyInfo.cs deleted file mode 100644 index 7fabd63..0000000 --- a/src/Config/SimConfig/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-simconfig")] | ||
19 | [assembly: AssemblyDescriptionAttribute("The default configuration handler")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs deleted file mode 100644 index 1b696fe..0000000 --- a/src/Config/SimConfig/Db4SimConfig.cs +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using OpenSim; | ||
30 | using OpenSim.world; | ||
31 | using Db4objects.Db4o; | ||
32 | |||
33 | namespace Db40SimConfig | ||
34 | { | ||
35 | public class Db40ConfigPlugin: ISimConfig | ||
36 | { | ||
37 | public SimConfig GetConfigObject() | ||
38 | { | ||
39 | ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll"); | ||
40 | return ( new DbSimConfig()); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public class DbSimConfig :SimConfig | ||
45 | { | ||
46 | private IObjectContainer db; | ||
47 | |||
48 | public void LoadDefaults() { | ||
49 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
50 | |||
51 | this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test"); | ||
52 | this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997")); | ||
53 | this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996")); | ||
54 | this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000")); | ||
55 | this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1"); | ||
56 | |||
57 | if(!OpenSim_Main.sim.sandbox) | ||
58 | { | ||
59 | this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: "); | ||
60 | this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: "); | ||
61 | this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: "); | ||
62 | this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid server: "); | ||
63 | this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid server: "); | ||
64 | this.UserURL=ServerConsole.MainConsole.Instance.CmdPrompt("User server URL: "); | ||
65 | this.UserSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to user server: "); | ||
66 | this.UserRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from user server: "); | ||
67 | } | ||
68 | this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); | ||
69 | } | ||
70 | |||
71 | public override void InitConfig() { | ||
72 | try { | ||
73 | db = Db4oFactory.OpenFile("opensim.yap"); | ||
74 | IObjectSet result = db.Get(typeof(DbSimConfig)); | ||
75 | if(result.Count==1) { | ||
76 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); | ||
77 | foreach (DbSimConfig cfg in result) { | ||
78 | this.RegionName = cfg.RegionName; | ||
79 | this.RegionLocX = cfg.RegionLocX; | ||
80 | this.RegionLocY = cfg.RegionLocY; | ||
81 | this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); | ||
82 | this.IPListenPort = cfg.IPListenPort; | ||
83 | this.IPListenAddr = cfg.IPListenAddr; | ||
84 | this.AssetURL = cfg.AssetURL; | ||
85 | this.AssetSendKey = cfg.AssetSendKey; | ||
86 | this.GridURL = cfg.GridURL; | ||
87 | this.GridSendKey = cfg.GridSendKey; | ||
88 | } | ||
89 | } else { | ||
90 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
91 | LoadDefaults(); | ||
92 | ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database"); | ||
93 | db.Set(this); | ||
94 | } | ||
95 | } catch(Exception e) { | ||
96 | db.Close(); | ||
97 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured"); | ||
98 | ServerConsole.MainConsole.Instance.WriteLine(e.ToString()); | ||
99 | } | ||
100 | |||
101 | ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:"); | ||
102 | ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName); | ||
103 | ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | ||
104 | ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); | ||
105 | ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); | ||
106 | ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString()); | ||
107 | ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL); | ||
108 | ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey); | ||
109 | ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL); | ||
110 | ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey); | ||
111 | } | ||
112 | |||
113 | public override World LoadWorld() | ||
114 | { | ||
115 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); | ||
116 | World blank = new World(); | ||
117 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); | ||
118 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
119 | if(world_result.Count>0) { | ||
120 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); | ||
121 | MapStorage map=(MapStorage)world_result.Next(); | ||
122 | blank.LandMap = map.Map; | ||
123 | } else { | ||
124 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); | ||
125 | HeightmapGenHills hills = new HeightmapGenHills(); | ||
126 | blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
127 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); | ||
128 | MapStorage map= new MapStorage(); | ||
129 | map.Map = blank.LandMap; | ||
130 | db.Set(map); | ||
131 | db.Commit(); | ||
132 | } | ||
133 | return blank; | ||
134 | } | ||
135 | |||
136 | public override void SaveMap() | ||
137 | { | ||
138 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
139 | if(world_result.Count>0) { | ||
140 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database"); | ||
141 | MapStorage map=(MapStorage)world_result.Next(); | ||
142 | db.Delete(map); | ||
143 | } | ||
144 | MapStorage map1= new MapStorage(); | ||
145 | map1.Map = OpenSim_Main.local_world.LandMap; | ||
146 | db.Set(map1); | ||
147 | db.Commit(); | ||
148 | } | ||
149 | |||
150 | public override void LoadFromGrid() { | ||
151 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); | ||
152 | // TODO: Make this crap work | ||
153 | /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login"); | ||
154 | WebResponse GridResponse = GridLogin.GetResponse(); | ||
155 | byte[] idata = new byte[(int)GridResponse.ContentLength]; | ||
156 | BinaryReader br = new BinaryReader(GridResponse.GetResponseStream()); | ||
157 | |||
158 | br.Close(); | ||
159 | GridResponse.Close(); | ||
160 | */ | ||
161 | } | ||
162 | |||
163 | public void Shutdown() { | ||
164 | db.Close(); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | public class MapStorage | ||
169 | { | ||
170 | public float[] Map; | ||
171 | |||
172 | public MapStorage() | ||
173 | { | ||
174 | |||
175 | } | ||
176 | } | ||
177 | } | ||
diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj deleted file mode 100644 index 43e9499..0000000 --- a/src/Config/SimConfig/SimConfig.csproj +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>SimConfig</RootNamespace> | ||
5 | <AssemblyName>SimConfig</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{B063760D-DB8D-4F64-B6FE-335FAD1E650A}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>..\..\..\bin\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>..\..\..\bin\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="Db4objects.Db4o"> | ||
30 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="Db4SimConfig.cs" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
39 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
40 | <Name>ServerConsole</Name> | ||
41 | </ProjectReference> | ||
42 | <ProjectReference Include="..\..\Second-server.csproj"> | ||
43 | <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project> | ||
44 | <Name>Second-server</Name> | ||
45 | </ProjectReference> | ||
46 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
47 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
48 | <Name>GridInterfaces</Name> | ||
49 | </ProjectReference> | ||
50 | </ItemGroup> | ||
51 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
52 | </Project> \ No newline at end of file | ||
diff --git a/src/Config/default.build b/src/Config/default.build deleted file mode 100644 index 9e13ca6..0000000 --- a/src/Config/default.build +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../bin/SimConfig.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="SimConfig/AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-simconfig" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="The default configuration handler" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/SimConfig.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin/" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Data.dll" /> | ||
42 | <include name="System.Xml.dll" /> | ||
43 | <include name="ServerConsole.dll" /> | ||
44 | <include name="GridInterfaces.dll" /> | ||
45 | <include name="OpenSim.exe" /> | ||
46 | <include name="Db4objects.Db4o.dll" /> | ||
47 | </references> | ||
48 | <sources basedir="SimConfig/"> | ||
49 | <include name="*.cs" /> | ||
50 | </sources> | ||
51 | </csc> | ||
52 | </target> | ||
53 | </project> | ||
diff --git a/src/GridInterfaces/AssemblyInfo.cs b/src/GridInterfaces/AssemblyInfo.cs deleted file mode 100644 index 32f1380..0000000 --- a/src/GridInterfaces/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-gridinterfaces")] | ||
19 | [assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/GridInterfaces/GridInterfaces.csproj b/src/GridInterfaces/GridInterfaces.csproj deleted file mode 100644 index 197994f..0000000 --- a/src/GridInterfaces/GridInterfaces.csproj +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>GridInterfaces</RootNamespace> | ||
5 | <AssemblyName>GridInterfaces</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="libsecondlife"> | ||
30 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="IAssetServer.cs" /> | ||
36 | <Compile Include="IGridServer.cs" /> | ||
37 | <Compile Include="ILocalStorage.cs" /> | ||
38 | </ItemGroup> | ||
39 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
40 | </Project> \ No newline at end of file | ||
diff --git a/src/GridInterfaces/IAssetServer.cs b/src/GridInterfaces/IAssetServer.cs deleted file mode 100644 index 6050a6c..0000000 --- a/src/GridInterfaces/IAssetServer.cs +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Net; | ||
29 | using System.Net.Sockets; | ||
30 | using System.IO; | ||
31 | using System.Threading; | ||
32 | using libsecondlife; | ||
33 | |||
34 | |||
35 | namespace OpenSim.GridServers | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Description of IAssetServer. | ||
39 | /// </summary> | ||
40 | |||
41 | public interface IAssetServer | ||
42 | { | ||
43 | void SetReceiver(IAssetReceiver receiver); | ||
44 | void RequestAsset(LLUUID assetID, bool isTexture); | ||
45 | void UpdateAsset(AssetBase asset); | ||
46 | void UploadNewAsset(AssetBase asset); | ||
47 | void SetServerInfo(string ServerUrl, string ServerKey); | ||
48 | } | ||
49 | |||
50 | // could change to delegate? | ||
51 | public interface IAssetReceiver | ||
52 | { | ||
53 | void AssetReceived(AssetBase asset, bool IsTexture); | ||
54 | void AssetNotFound(AssetBase asset); | ||
55 | } | ||
56 | |||
57 | public struct ARequest | ||
58 | { | ||
59 | public LLUUID AssetID; | ||
60 | public bool IsTexture; | ||
61 | } | ||
62 | |||
63 | public class AssetBase | ||
64 | { | ||
65 | public byte[] Data; | ||
66 | public LLUUID FullID; | ||
67 | public sbyte Type; | ||
68 | public sbyte InvType; | ||
69 | public string Name; | ||
70 | public string Description; | ||
71 | |||
72 | public AssetBase() | ||
73 | { | ||
74 | |||
75 | } | ||
76 | } | ||
77 | |||
78 | public interface IAssetPlugin | ||
79 | { | ||
80 | IAssetServer GetAssetServer(); | ||
81 | } | ||
82 | } | ||
diff --git a/src/GridInterfaces/IGridServer.cs b/src/GridInterfaces/IGridServer.cs deleted file mode 100644 index dcb8ef2..0000000 --- a/src/GridInterfaces/IGridServer.cs +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.IO; | ||
34 | using libsecondlife; | ||
35 | using OpenSim; | ||
36 | |||
37 | namespace OpenSim.GridServers | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Handles connection to Grid Servers. | ||
41 | /// also Sim to Sim connections? | ||
42 | /// </summary> | ||
43 | |||
44 | |||
45 | |||
46 | |||
47 | public interface IGridServer | ||
48 | { | ||
49 | UUIDBlock RequestUUIDBlock(); | ||
50 | neighbourinfo[] RequestNeighbours(ulong regionhandle); //should return a array of neighbouring regions | ||
51 | AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
52 | bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
53 | string GetName(); | ||
54 | bool RequestConnection(); | ||
55 | void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey); | ||
56 | } | ||
57 | |||
58 | public abstract class RemoteGridBase : IGridServer | ||
59 | { | ||
60 | public abstract Dictionary<uint, agentcircuitdata> agentcircuits { | ||
61 | get; | ||
62 | set; | ||
63 | } | ||
64 | |||
65 | public abstract UUIDBlock RequestUUIDBlock(); | ||
66 | public abstract neighbourinfo[] RequestNeighbours(ulong regionhandle); | ||
67 | public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
68 | public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
69 | public abstract string GetName(); | ||
70 | public abstract bool RequestConnection(); | ||
71 | public abstract void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey); | ||
72 | } | ||
73 | |||
74 | public abstract class LocalGridBase : IGridServer | ||
75 | { | ||
76 | public abstract UUIDBlock RequestUUIDBlock(); | ||
77 | public abstract neighbourinfo[] RequestNeighbours(ulong regionhandle); | ||
78 | public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
79 | public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); | ||
80 | public abstract string GetName(); | ||
81 | public abstract bool RequestConnection(); | ||
82 | public abstract void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey); | ||
83 | public abstract void AddNewSession(Login session); | ||
84 | } | ||
85 | |||
86 | public struct UUIDBlock | ||
87 | { | ||
88 | public LLUUID BlockStart; | ||
89 | public LLUUID BlockEnd; | ||
90 | } | ||
91 | |||
92 | public class AuthenticateResponse | ||
93 | { | ||
94 | public bool Authorised; | ||
95 | public Login LoginInfo; | ||
96 | |||
97 | public AuthenticateResponse() | ||
98 | { | ||
99 | |||
100 | } | ||
101 | |||
102 | } | ||
103 | |||
104 | public class Login | ||
105 | { | ||
106 | public string First = "Test"; | ||
107 | public string Last = "User"; | ||
108 | public LLUUID Agent; | ||
109 | public LLUUID Session; | ||
110 | public LLUUID InventoryFolder; | ||
111 | public LLUUID BaseFolder; | ||
112 | public Login() | ||
113 | { | ||
114 | |||
115 | } | ||
116 | } | ||
117 | |||
118 | public interface IGridPlugin | ||
119 | { | ||
120 | IGridServer GetGridServer(); | ||
121 | } | ||
122 | |||
123 | public class agentcircuitdata | ||
124 | { | ||
125 | public agentcircuitdata() { } | ||
126 | public LLUUID AgentID; | ||
127 | public LLUUID SessionID; | ||
128 | public LLUUID SecureSessionID; | ||
129 | public string firstname; | ||
130 | public string lastname; | ||
131 | public uint circuitcode; | ||
132 | public bool child_agent; | ||
133 | } | ||
134 | |||
135 | public class neighbourinfo | ||
136 | { | ||
137 | public neighbourinfo() { } | ||
138 | public ulong regionhandle; | ||
139 | public uint RegionLocX; | ||
140 | public uint RegionLocY; | ||
141 | public string sim_ip; | ||
142 | public uint sim_port; | ||
143 | } | ||
144 | |||
145 | } | ||
diff --git a/src/GridInterfaces/ILocalStorage.cs b/src/GridInterfaces/ILocalStorage.cs deleted file mode 100644 index 6b7ded6..0000000 --- a/src/GridInterfaces/ILocalStorage.cs +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | |||
31 | namespace GridInterfaces | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// ILocalStorage. Really hacked together right now needs cleaning up | ||
35 | /// </summary> | ||
36 | public interface ILocalStorage | ||
37 | { | ||
38 | void StorePrim(PrimData prim); | ||
39 | void RemovePrim(LLUUID primID); | ||
40 | void LoadPrimitives(ILocalStorageReceiver receiver); | ||
41 | void ShutDown(); | ||
42 | } | ||
43 | |||
44 | public interface ILocalStorageReceiver | ||
45 | { | ||
46 | void PrimFromStorage(PrimData prim); | ||
47 | } | ||
48 | |||
49 | |||
50 | public class PrimData | ||
51 | { | ||
52 | public LLUUID OwnerID; | ||
53 | public byte PCode; | ||
54 | public byte PathBegin; | ||
55 | public byte PathEnd; | ||
56 | public byte PathScaleX; | ||
57 | public byte PathScaleY; | ||
58 | public byte PathShearX; | ||
59 | public byte PathShearY; | ||
60 | public sbyte PathSkew; | ||
61 | public byte ProfileBegin; | ||
62 | public byte ProfileEnd; | ||
63 | public LLVector3 Scale; | ||
64 | public byte PathCurve; | ||
65 | public byte ProfileCurve; | ||
66 | public uint ParentID=0; | ||
67 | public byte ProfileHollow; | ||
68 | public sbyte PathRadiusOffset; | ||
69 | public byte PathRevolutions; | ||
70 | public sbyte PathTaperX; | ||
71 | public sbyte PathTaperY; | ||
72 | public sbyte PathTwist; | ||
73 | public sbyte PathTwistBegin; | ||
74 | |||
75 | //following only used during prim storage | ||
76 | public LLVector3 Position; | ||
77 | public LLQuaternion Rotation; | ||
78 | public uint LocalID; | ||
79 | public LLUUID FullID; | ||
80 | |||
81 | public PrimData() | ||
82 | { | ||
83 | |||
84 | } | ||
85 | } | ||
86 | } | ||
diff --git a/src/GridInterfaces/default.build b/src/GridInterfaces/default.build deleted file mode 100644 index dd02448..0000000 --- a/src/GridInterfaces/default.build +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/GridInterfaces.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-gridinterfaces" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="Definitions for OGS interface" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/GridInterfaces.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | <include name="OpenSim.Framework.dll" /> | ||
43 | <include name="libsecondlife.dll" /> | ||
44 | </references> | ||
45 | <sources basedir="./"> | ||
46 | <include name="*.cs" /> | ||
47 | </sources> | ||
48 | </csc> | ||
49 | </target> | ||
50 | </project> | ||
diff --git a/src/GridServers/LoginServer.cs b/src/GridServers/LoginServer.cs deleted file mode 100644 index dbf211d..0000000 --- a/src/GridServers/LoginServer.cs +++ /dev/null | |||
@@ -1,350 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using Nwc.XmlRpc; | ||
29 | using System; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.Text; | ||
34 | using System.Text.RegularExpressions; | ||
35 | using System.Threading; | ||
36 | using System.Collections; | ||
37 | using System.Security.Cryptography; | ||
38 | using System.Xml; | ||
39 | using libsecondlife; | ||
40 | using OpenSim; | ||
41 | using OpenSim.Framework; | ||
42 | |||
43 | namespace OpenSim.GridServers | ||
44 | { | ||
45 | |||
46 | /// <summary> | ||
47 | /// When running in local (default) mode , handles client logins. | ||
48 | /// </summary> | ||
49 | public class LoginServer : LoginService | ||
50 | { | ||
51 | public LoginServer(IGridServer gridServer) | ||
52 | { | ||
53 | _gridServer = gridServer; | ||
54 | } | ||
55 | |||
56 | private IGridServer _gridServer; | ||
57 | private ushort _loginPort = 8080; | ||
58 | public IPAddress clientAddress = IPAddress.Loopback; | ||
59 | public IPAddress remoteAddress = IPAddress.Any; | ||
60 | private Socket loginServer; | ||
61 | private int NumClients; | ||
62 | private string _defaultResponse; | ||
63 | |||
64 | private string _mpasswd; | ||
65 | private bool _needPasswd=false; | ||
66 | |||
67 | // InitializeLogin: initialize the login | ||
68 | private void InitializeLogin() { | ||
69 | loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | ||
70 | loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort)); | ||
71 | loginServer.Listen(1); | ||
72 | |||
73 | this._needPasswd=false; | ||
74 | //read in default response string | ||
75 | StreamReader SR; | ||
76 | string lines; | ||
77 | SR=File.OpenText("new-login.dat"); | ||
78 | |||
79 | //lines=SR.ReadLine(); | ||
80 | |||
81 | while(!SR.EndOfStream) | ||
82 | { | ||
83 | lines = SR.ReadLine(); | ||
84 | _defaultResponse += lines; | ||
85 | //lines = SR.ReadLine(); | ||
86 | } | ||
87 | SR.Close(); | ||
88 | this._mpasswd = EncodePassword("testpass"); | ||
89 | } | ||
90 | |||
91 | public void Startup() | ||
92 | { | ||
93 | this.InitializeLogin(); | ||
94 | Thread runLoginProxy = new Thread(new ThreadStart(RunLogin)); | ||
95 | runLoginProxy.IsBackground = true; | ||
96 | runLoginProxy.Start(); | ||
97 | } | ||
98 | |||
99 | private void RunLogin() | ||
100 | { | ||
101 | Console.WriteLine("Starting Login Server"); | ||
102 | try | ||
103 | { | ||
104 | for (;;) | ||
105 | { | ||
106 | Socket client = loginServer.Accept(); | ||
107 | IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint; | ||
108 | |||
109 | |||
110 | NetworkStream networkStream = new NetworkStream(client); | ||
111 | StreamReader networkReader = new StreamReader(networkStream); | ||
112 | StreamWriter networkWriter = new StreamWriter(networkStream); | ||
113 | |||
114 | try | ||
115 | { | ||
116 | LoginRequest(networkReader, networkWriter); | ||
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | Console.WriteLine(e.Message); | ||
121 | } | ||
122 | |||
123 | networkWriter.Close(); | ||
124 | networkReader.Close(); | ||
125 | networkStream.Close(); | ||
126 | |||
127 | client.Close(); | ||
128 | |||
129 | // send any packets queued for injection | ||
130 | |||
131 | } | ||
132 | } | ||
133 | catch (Exception e) | ||
134 | { | ||
135 | Console.WriteLine(e.Message); | ||
136 | Console.WriteLine(e.StackTrace); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | // ProxyLogin: proxy a login request | ||
141 | private void LoginRequest(StreamReader reader, StreamWriter writer) | ||
142 | { | ||
143 | lock(this) | ||
144 | { | ||
145 | string line; | ||
146 | int contentLength = 0; | ||
147 | // read HTTP header | ||
148 | do | ||
149 | { | ||
150 | // read one line of the header | ||
151 | line = reader.ReadLine(); | ||
152 | |||
153 | // check for premature EOF | ||
154 | if (line == null) | ||
155 | throw new Exception("EOF in client HTTP header"); | ||
156 | |||
157 | // look for Content-Length | ||
158 | Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line); | ||
159 | if (match.Success) | ||
160 | contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString()); | ||
161 | } while (line != ""); | ||
162 | |||
163 | // read the HTTP body into a buffer | ||
164 | char[] content = new char[contentLength]; | ||
165 | reader.Read(content, 0, contentLength); | ||
166 | |||
167 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); | ||
168 | if(request.MethodName == "login_to_simulator") | ||
169 | { | ||
170 | XmlRpcResponse response = ProcessRequest(request); | ||
171 | |||
172 | // forward the XML-RPC response to the client | ||
173 | writer.WriteLine("HTTP/1.0 200 OK"); | ||
174 | writer.WriteLine("Content-type: text/xml"); | ||
175 | writer.WriteLine(); | ||
176 | |||
177 | XmlTextWriter responseWriter = new XmlTextWriter(writer); | ||
178 | XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response); | ||
179 | responseWriter.Close(); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); | ||
184 | writer.WriteLine(); | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | |||
189 | private XmlRpcResponse ProcessRequest(XmlRpcRequest request) | ||
190 | { | ||
191 | XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); | ||
192 | |||
193 | Hashtable responseData = (Hashtable)response.Value; | ||
194 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
195 | |||
196 | string first; | ||
197 | string last; | ||
198 | string passwd; | ||
199 | LLUUID Agent; | ||
200 | LLUUID Session; | ||
201 | |||
202 | //get login name | ||
203 | if(requestData.Contains("first")) | ||
204 | { | ||
205 | first = (string)requestData["first"]; | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | first = "test"; | ||
210 | } | ||
211 | |||
212 | if(requestData.Contains("last")) | ||
213 | { | ||
214 | last = (string)requestData["last"]; | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | last = "User"+NumClients.ToString(); | ||
219 | } | ||
220 | |||
221 | if(requestData.Contains("passwd")) | ||
222 | { | ||
223 | passwd = (string)requestData["passwd"]; | ||
224 | } | ||
225 | else | ||
226 | { | ||
227 | passwd = "notfound"; | ||
228 | } | ||
229 | |||
230 | if( !Authenticate(first, last, passwd)) | ||
231 | { | ||
232 | responseData["reason"] = "key"; | ||
233 | responseData["message"] = "You have entered an invalid name/password combination. Check Caps/lock."; | ||
234 | responseData["login"] = "false"; | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | NumClients++; | ||
239 | |||
240 | //create a agent and session LLUUID | ||
241 | Agent = GetAgentId( first, last ); | ||
242 | Session = LLUUID.Random(); | ||
243 | |||
244 | //create some login info | ||
245 | Hashtable LoginFlagsHash = new Hashtable(); | ||
246 | LoginFlagsHash["daylight_savings"]="N"; | ||
247 | LoginFlagsHash["stipend_since_login"]="N"; | ||
248 | LoginFlagsHash["gendered"]="Y"; | ||
249 | LoginFlagsHash["ever_logged_in"]="Y"; | ||
250 | ArrayList LoginFlags=new ArrayList(); | ||
251 | LoginFlags.Add(LoginFlagsHash); | ||
252 | |||
253 | Hashtable GlobalT = new Hashtable(); | ||
254 | GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
255 | GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
256 | GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
257 | ArrayList GlobalTextures = new ArrayList(); | ||
258 | GlobalTextures.Add(GlobalT); | ||
259 | |||
260 | responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; | ||
261 | responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; | ||
262 | responseData["agent_id"] = Agent.ToStringHyphenated(); | ||
263 | responseData["session_id"] = Session.ToStringHyphenated(); | ||
264 | responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds; | ||
265 | responseData["login-flags"]=LoginFlags; | ||
266 | responseData["global-textures"]=GlobalTextures; | ||
267 | |||
268 | //inventory | ||
269 | ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"]; | ||
270 | Hashtable Inventory1 = (Hashtable)InventoryList[0]; | ||
271 | Hashtable Inventory2 = (Hashtable)InventoryList[1]; | ||
272 | LLUUID BaseFolderID = LLUUID.Random(); | ||
273 | LLUUID InventoryFolderID = LLUUID.Random(); | ||
274 | Inventory2["name"] = "Base"; | ||
275 | Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated(); | ||
276 | Inventory2["type_default"] =6; | ||
277 | Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated(); | ||
278 | |||
279 | ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"]; | ||
280 | Hashtable Inventoryroot = (Hashtable)InventoryRoot[0]; | ||
281 | Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated(); | ||
282 | |||
283 | CustomiseLoginResponse( responseData, first, last ); | ||
284 | |||
285 | Login _login = new Login(); | ||
286 | //copy data to login object | ||
287 | _login.First = first; | ||
288 | _login.Last = last; | ||
289 | _login.Agent = Agent; | ||
290 | _login.Session = Session; | ||
291 | _login.BaseFolder = BaseFolderID; | ||
292 | _login.InventoryFolder = InventoryFolderID; | ||
293 | |||
294 | //working on local computer if so lets add to the gridserver's list of sessions? | ||
295 | if(OpenSim_Main.gridServers.GridServer.GetName() == "Local") | ||
296 | { | ||
297 | ((LocalGridBase)this._gridServer).AddNewSession(_login); | ||
298 | } | ||
299 | } | ||
300 | return response; | ||
301 | } | ||
302 | |||
303 | protected virtual void CustomiseLoginResponse( Hashtable responseData, string first, string last ) | ||
304 | { | ||
305 | } | ||
306 | |||
307 | protected virtual LLUUID GetAgentId(string firstName, string lastName) | ||
308 | { | ||
309 | return LLUUID.Random(); | ||
310 | } | ||
311 | |||
312 | protected virtual bool Authenticate(string first, string last, string passwd) | ||
313 | { | ||
314 | if(this._needPasswd) | ||
315 | { | ||
316 | //every user needs the password to login | ||
317 | string encodedPass = passwd.Remove(0,3); //remove $1$ | ||
318 | if(encodedPass == this._mpasswd) | ||
319 | { | ||
320 | return true; | ||
321 | } | ||
322 | else | ||
323 | { | ||
324 | return false; | ||
325 | } | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | //do not need password to login | ||
330 | return true; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | private static string EncodePassword(string passwd) | ||
335 | { | ||
336 | Byte[] originalBytes; | ||
337 | Byte[] encodedBytes; | ||
338 | MD5 md5; | ||
339 | |||
340 | md5 = new MD5CryptoServiceProvider(); | ||
341 | originalBytes = ASCIIEncoding.Default.GetBytes(passwd); | ||
342 | encodedBytes = md5.ComputeHash(originalBytes); | ||
343 | |||
344 | return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); | ||
345 | } | ||
346 | |||
347 | } | ||
348 | |||
349 | |||
350 | } | ||
diff --git a/src/HeightMapGenHills.cs b/src/HeightMapGenHills.cs deleted file mode 100644 index e7589af..0000000 --- a/src/HeightMapGenHills.cs +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim | ||
31 | { | ||
32 | public class HeightmapGenHills | ||
33 | { | ||
34 | private Random Rand = new Random(); | ||
35 | private int NumHills; | ||
36 | private float HillMin; | ||
37 | private float HillMax; | ||
38 | private bool Island; | ||
39 | private float[] heightmap; | ||
40 | |||
41 | public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island) | ||
42 | { | ||
43 | NumHills = numHills; | ||
44 | HillMin = hillMin; | ||
45 | HillMax = hillMax; | ||
46 | Island = island; | ||
47 | |||
48 | heightmap = new float[256 * 256]; | ||
49 | |||
50 | for (int i = 0; i < numHills; i++) | ||
51 | { | ||
52 | AddHill(); | ||
53 | } | ||
54 | |||
55 | Normalize(); | ||
56 | |||
57 | return heightmap; | ||
58 | } | ||
59 | |||
60 | private void AddHill() | ||
61 | { | ||
62 | float x, y; | ||
63 | float radius = RandomRange(HillMin, HillMax); | ||
64 | |||
65 | if (Island) | ||
66 | { | ||
67 | // Which direction from the center of the map the hill is placed | ||
68 | float theta = RandomRange(0, 6.28f); | ||
69 | |||
70 | // How far from the center of the map to place the hill. The radius | ||
71 | // is subtracted from the range to prevent any part of the hill from | ||
72 | // reaching the edge of the map | ||
73 | float distance = RandomRange(radius / 2.0f, 128.0f - radius); | ||
74 | |||
75 | x = 128.0f + (float)Math.Cos(theta) * distance; | ||
76 | y = 128.0f + (float)Math.Sin(theta) * distance; | ||
77 | } | ||
78 | else | ||
79 | { | ||
80 | x = RandomRange(-radius, 256.0f + radius); | ||
81 | y = RandomRange(-radius, 256.0f + radius); | ||
82 | } | ||
83 | |||
84 | float radiusSq = radius * radius; | ||
85 | float distSq; | ||
86 | float height; | ||
87 | |||
88 | int xMin = (int)(x - radius) - 1; | ||
89 | int xMax = (int)(x + radius) + 1; | ||
90 | if (xMin < 0) xMin = 0; | ||
91 | if (xMax > 255) xMax = 255; | ||
92 | |||
93 | int yMin = (int)(y - radius) - 1; | ||
94 | int yMax = (int)(y + radius) + 1; | ||
95 | if (yMin < 0) yMin = 0; | ||
96 | if (yMax > 255) yMax = 255; | ||
97 | |||
98 | // Loop through each affected cell and determine the height at that point | ||
99 | for (int v = yMin; v <= yMax; ++v) | ||
100 | { | ||
101 | float fv = (float)v; | ||
102 | |||
103 | for (int h = xMin; h <= xMax; ++h) | ||
104 | { | ||
105 | float fh = (float)h; | ||
106 | |||
107 | // Determine how far from the center of this hill this point is | ||
108 | distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv); | ||
109 | height = radiusSq - distSq; | ||
110 | |||
111 | // Don't add negative hill values | ||
112 | if (height > 0.0f) heightmap[h + v * 256] += height; | ||
113 | } | ||
114 | } | ||
115 | } | ||
116 | |||
117 | private void Normalize() | ||
118 | { | ||
119 | float min = heightmap[0]; | ||
120 | float max = heightmap[0]; | ||
121 | |||
122 | for (int x = 0; x < 256; x++) | ||
123 | { | ||
124 | for (int y = 0; y < 256; y++) | ||
125 | { | ||
126 | if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256]; | ||
127 | if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256]; | ||
128 | } | ||
129 | } | ||
130 | |||
131 | // Avoid a rare divide by zero | ||
132 | if (min != max) | ||
133 | { | ||
134 | for (int x = 0; x < 256; x++) | ||
135 | { | ||
136 | for (int y = 0; y < 256; y++) | ||
137 | { | ||
138 | heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin); | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | } | ||
143 | |||
144 | private float RandomRange(float min, float max) | ||
145 | { | ||
146 | return (float)Rand.NextDouble() * (max - min) + min; | ||
147 | } | ||
148 | } | ||
149 | } | ||
diff --git a/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/src/LocalServers/LocalGridServers/AssemblyInfo.cs deleted file mode 100644 index 4b17ba2..0000000 --- a/src/LocalServers/LocalGridServers/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-localservers")] | ||
19 | [assembly: AssemblyDescriptionAttribute("local grid servers")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/LocalServers/LocalGridServers/LocalGrid.cs b/src/LocalServers/LocalGridServers/LocalGrid.cs deleted file mode 100644 index bd377d3..0000000 --- a/src/LocalServers/LocalGridServers/LocalGrid.cs +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Threading; | ||
30 | using OpenSim.GridServers; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace LocalGridServers | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | /// | ||
39 | public class LocalGridPlugin : IGridPlugin | ||
40 | { | ||
41 | public LocalGridPlugin() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public IGridServer GetGridServer() | ||
47 | { | ||
48 | return(new LocalGridServer()); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public class LocalAssetPlugin : IAssetPlugin | ||
53 | { | ||
54 | public LocalAssetPlugin() | ||
55 | { | ||
56 | |||
57 | } | ||
58 | |||
59 | public IAssetServer GetAssetServer() | ||
60 | { | ||
61 | return(new LocalAssetServer()); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public class LocalAssetServer : IAssetServer | ||
66 | { | ||
67 | private IAssetReceiver _receiver; | ||
68 | private BlockingQueue<ARequest> _assetRequests; | ||
69 | |||
70 | public LocalAssetServer() | ||
71 | { | ||
72 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
73 | ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created"); | ||
74 | } | ||
75 | |||
76 | public void SetReceiver(IAssetReceiver receiver) | ||
77 | { | ||
78 | this._receiver = receiver; | ||
79 | } | ||
80 | |||
81 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
82 | { | ||
83 | ARequest req = new ARequest(); | ||
84 | req.AssetID = assetID; | ||
85 | req.IsTexture = isTexture; | ||
86 | //this._assetRequests.Enqueue(req); | ||
87 | } | ||
88 | |||
89 | public void UpdateAsset(AssetBase asset) | ||
90 | { | ||
91 | |||
92 | } | ||
93 | |||
94 | public void UploadNewAsset(AssetBase asset) | ||
95 | { | ||
96 | |||
97 | } | ||
98 | |||
99 | public void SetServerInfo(string ServerUrl, string SendKey) | ||
100 | { | ||
101 | |||
102 | } | ||
103 | |||
104 | private void RunRequests() | ||
105 | { | ||
106 | while(true) | ||
107 | { | ||
108 | Thread.Sleep(1000); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public class LocalGridServer : LocalGridBase | ||
114 | { | ||
115 | public List<Login> Sessions = new List<Login>(); | ||
116 | |||
117 | public LocalGridServer() | ||
118 | { | ||
119 | Sessions = new List<Login>(); | ||
120 | ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); | ||
121 | } | ||
122 | |||
123 | public override string GetName() | ||
124 | { | ||
125 | return "Local"; | ||
126 | } | ||
127 | |||
128 | public override bool RequestConnection() | ||
129 | { | ||
130 | return true; | ||
131 | } | ||
132 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
133 | { | ||
134 | //we are running local | ||
135 | AuthenticateResponse user = new AuthenticateResponse(); | ||
136 | |||
137 | lock(this.Sessions) | ||
138 | { | ||
139 | |||
140 | for(int i = 0; i < Sessions.Count; i++) | ||
141 | { | ||
142 | if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID)) | ||
143 | { | ||
144 | user.Authorised = true; | ||
145 | user.LoginInfo = Sessions[i]; | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | return(user); | ||
150 | } | ||
151 | |||
152 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
153 | { | ||
154 | return(true); | ||
155 | } | ||
156 | |||
157 | public override UUIDBlock RequestUUIDBlock() | ||
158 | { | ||
159 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
160 | return(uuidBlock); | ||
161 | } | ||
162 | |||
163 | public override neighbourinfo[] RequestNeighbours(ulong regionhandle) | ||
164 | { | ||
165 | return new neighbourinfo[8]; | ||
166 | } | ||
167 | |||
168 | public override void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey) | ||
169 | { | ||
170 | |||
171 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// used by the local login server to inform us of new sessions | ||
175 | /// </summary> | ||
176 | /// <param name="session"></param> | ||
177 | public override void AddNewSession(Login session) | ||
178 | { | ||
179 | lock(this.Sessions) | ||
180 | { | ||
181 | this.Sessions.Add(session); | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | |||
186 | public class BlockingQueue< T > { | ||
187 | private Queue< T > _queue = new Queue< T >(); | ||
188 | private object _queueSync = new object(); | ||
189 | |||
190 | public void Enqueue(T value) | ||
191 | { | ||
192 | lock(_queueSync) | ||
193 | { | ||
194 | _queue.Enqueue(value); | ||
195 | Monitor.Pulse(_queueSync); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | public T Dequeue() | ||
200 | { | ||
201 | lock(_queueSync) | ||
202 | { | ||
203 | if( _queue.Count < 1) | ||
204 | Monitor.Wait(_queueSync); | ||
205 | |||
206 | return _queue.Dequeue(); | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
211 | } | ||
diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.csproj b/src/LocalServers/LocalGridServers/LocalGridServers.csproj deleted file mode 100644 index 7a5ce3d..0000000 --- a/src/LocalServers/LocalGridServers/LocalGridServers.csproj +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>LocalGridServers</RootNamespace> | ||
5 | <AssemblyName>LocalGridServers</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="libsecondlife"> | ||
30 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="LocalGrid.cs" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
39 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
40 | <Name>ServerConsole</Name> | ||
41 | </ProjectReference> | ||
42 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
43 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
44 | <Name>GridInterfaces</Name> | ||
45 | </ProjectReference> | ||
46 | </ItemGroup> | ||
47 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
48 | </Project> \ No newline at end of file | ||
diff --git a/src/LocalServers/default.build b/src/LocalServers/default.build deleted file mode 100644 index 14c52cd..0000000 --- a/src/LocalServers/default.build +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/LocalGridServers.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="LocalGridServers/AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-localservers" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="local grid servers" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/LocalGridServers.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | <include name="libsecondlife.dll" /> | ||
43 | <include name="GridInterfaces.dll" /> | ||
44 | <include name="ServerConsole.dll" /> | ||
45 | </references> | ||
46 | <sources basedir="LocalGridServers/"> | ||
47 | <include name="*.cs" /> | ||
48 | </sources> | ||
49 | </csc> | ||
50 | </target> | ||
51 | </project> | ||
diff --git a/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs b/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs deleted file mode 100644 index 0c5ff75..0000000 --- a/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-localstorage")] | ||
19 | [assembly: AssemblyDescriptionAttribute("The local storage handler")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs b/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs deleted file mode 100644 index bb9825c..0000000 --- a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using Db4objects.Db4o; | ||
30 | using Db4objects.Db4o.Query; | ||
31 | using libsecondlife; | ||
32 | using GridInterfaces; | ||
33 | |||
34 | namespace Db4LocalStorage | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// | ||
38 | /// </summary> | ||
39 | public class Db4LocalStorage : ILocalStorage | ||
40 | { | ||
41 | private IObjectContainer db; | ||
42 | |||
43 | public Db4LocalStorage() | ||
44 | { | ||
45 | try | ||
46 | { | ||
47 | db = Db4oFactory.OpenFile("localworld.yap"); | ||
48 | ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage creation"); | ||
49 | } | ||
50 | catch(Exception e) | ||
51 | { | ||
52 | db.Close(); | ||
53 | ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured"); | ||
54 | ServerConsole.MainConsole.Instance.WriteLine(e.ToString()); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | public void StorePrim(PrimData prim) | ||
59 | { | ||
60 | IObjectSet result = db.Query(new UUIDQuery(prim.FullID)); | ||
61 | if(result.Count>0) | ||
62 | { | ||
63 | //prim already in storage | ||
64 | //so update it | ||
65 | PrimData found = (PrimData) result.Next(); | ||
66 | found.PathBegin = prim.PathBegin; | ||
67 | found.PathCurve= prim.PathCurve; | ||
68 | found.PathEnd = prim.PathEnd; | ||
69 | found.PathRadiusOffset = prim.PathRadiusOffset; | ||
70 | found.PathRevolutions = prim.PathRevolutions; | ||
71 | found.PathScaleX= prim.PathScaleX; | ||
72 | found.PathScaleY = prim.PathScaleY; | ||
73 | found.PathShearX = prim.PathShearX; | ||
74 | found.PathShearY = prim.PathShearY; | ||
75 | found.PathSkew = prim.PathSkew; | ||
76 | found.PathTaperX = prim.PathTaperX; | ||
77 | found.PathTaperY = prim.PathTaperY; | ||
78 | found.PathTwist = prim.PathTwist; | ||
79 | found.PathTwistBegin = prim.PathTwistBegin; | ||
80 | found.PCode = prim.PCode; | ||
81 | found.ProfileBegin = prim.ProfileBegin; | ||
82 | found.ProfileCurve = prim.ProfileCurve; | ||
83 | found.ProfileEnd = prim.ProfileEnd; | ||
84 | found.ProfileHollow = prim.ProfileHollow; | ||
85 | found.Position = prim.Position; | ||
86 | found.Rotation = prim.Rotation; | ||
87 | db.Set(found); | ||
88 | db.Commit(); | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | //not in storage | ||
93 | db.Set(prim); | ||
94 | db.Commit(); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public void RemovePrim(LLUUID primID) | ||
99 | { | ||
100 | IObjectSet result = db.Query(new UUIDQuery(primID)); | ||
101 | if(result.Count>0) | ||
102 | { | ||
103 | PrimData found = (PrimData) result.Next(); | ||
104 | db.Delete(found); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | |||
109 | public void LoadPrimitives(ILocalStorageReceiver receiver) | ||
110 | { | ||
111 | IObjectSet result = db.Get(typeof(PrimData)); | ||
112 | ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count); | ||
113 | foreach (PrimData prim in result) { | ||
114 | receiver.PrimFromStorage(prim); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | public void ShutDown() | ||
119 | { | ||
120 | db.Commit(); | ||
121 | db.Close(); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public class UUIDQuery : Predicate | ||
126 | { | ||
127 | private LLUUID _findID; | ||
128 | |||
129 | public UUIDQuery(LLUUID find) | ||
130 | { | ||
131 | _findID = find; | ||
132 | } | ||
133 | public bool Match(PrimData prim) | ||
134 | { | ||
135 | return (prim.FullID == _findID); | ||
136 | } | ||
137 | } | ||
138 | |||
139 | } | ||
diff --git a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj b/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj deleted file mode 100644 index c00771c..0000000 --- a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>Db4LocalStorage</RootNamespace> | ||
5 | <AssemblyName>Db4LocalStorage</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{74784F23-B0FD-484C-82C1-96C0215733DC}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="libsecondlife"> | ||
30 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | <Reference Include="Db4objects.Db4o"> | ||
34 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
35 | <SpecificVersion>False</SpecificVersion> | ||
36 | </Reference> | ||
37 | </ItemGroup> | ||
38 | <ItemGroup> | ||
39 | <Compile Include="Db4LocalStorage.cs" /> | ||
40 | </ItemGroup> | ||
41 | <ItemGroup> | ||
42 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
43 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
44 | <Name>ServerConsole</Name> | ||
45 | </ProjectReference> | ||
46 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
47 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
48 | <Name>GridInterfaces</Name> | ||
49 | </ProjectReference> | ||
50 | </ItemGroup> | ||
51 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
52 | </Project> \ No newline at end of file | ||
diff --git a/src/LocalStorage/default.build b/src/LocalStorage/default.build deleted file mode 100644 index 5ed183e..0000000 --- a/src/LocalStorage/default.build +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../bin/Db4LocalStorage.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="Db4LocalStorage/AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-localstorage" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="The local storage handler" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/Db4LocalStorage.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin/" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Data.dll" /> | ||
42 | <include name="System.Xml.dll" /> | ||
43 | <include name="libsecondlife.dll" /> | ||
44 | <include name="GridInterfaces.dll" /> | ||
45 | <include name="ServerConsole.dll" /> | ||
46 | <include name="Db4objects.Db4o.dll" /> | ||
47 | </references> | ||
48 | <sources basedir="Db4LocalStorage/"> | ||
49 | <include name="*.cs" /> | ||
50 | </sources> | ||
51 | </csc> | ||
52 | </target> | ||
53 | </project> | ||
diff --git a/src/Main.cs b/src/Main.cs deleted file mode 100644 index a738d03..0000000 --- a/src/Main.cs +++ /dev/null | |||
@@ -1,338 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | |||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using System.Threading; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.Timers; | ||
37 | using System.Reflection; | ||
38 | using System.Collections; | ||
39 | using System.Collections.Generic; | ||
40 | using libsecondlife; | ||
41 | using libsecondlife.Packets; | ||
42 | using OpenSim.world; | ||
43 | using OpenSim.GridServers; | ||
44 | using OpenSim.Assets; | ||
45 | using ServerConsole; | ||
46 | using PhysicsSystem; | ||
47 | |||
48 | namespace OpenSim | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// Description of MainForm. | ||
52 | /// </summary> | ||
53 | public class OpenSim_Main | ||
54 | { | ||
55 | public static OpenSim_Main sim; | ||
56 | public static SimConfig cfg; | ||
57 | public static World local_world; | ||
58 | public static Grid gridServers; | ||
59 | public static SimCAPSHTTPServer http_server; | ||
60 | |||
61 | public static Socket Server; | ||
62 | private static IPEndPoint ServerIncoming; | ||
63 | private static byte[] RecvBuffer = new byte[4096]; | ||
64 | private byte[] ZeroBuffer = new byte[8192]; | ||
65 | private static IPEndPoint ipeSender; | ||
66 | private static EndPoint epSender; | ||
67 | private static AsyncCallback ReceivedData; | ||
68 | |||
69 | public AssetCache assetCache; | ||
70 | public DateTime startuptime; | ||
71 | public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>(); | ||
72 | private PhysicsManager physManager; | ||
73 | private System.Timers.Timer timer1 = new System.Timers.Timer(); | ||
74 | private string ConfigDll = "SimConfig.dll"; | ||
75 | private string _physicsEngine = "PhysX"; | ||
76 | public bool sandbox = false; | ||
77 | public bool loginserver = false; | ||
78 | |||
79 | [STAThread] | ||
80 | public static void Main( string[] args ) | ||
81 | { | ||
82 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); | ||
83 | Console.WriteLine("Starting...\n"); | ||
84 | ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); | ||
85 | |||
86 | sim = new OpenSim_Main(); | ||
87 | |||
88 | sim.sandbox = false; | ||
89 | sim.loginserver = false; | ||
90 | sim._physicsEngine = "PhysX"; | ||
91 | |||
92 | for (int i = 0; i < args.Length; i++) | ||
93 | { | ||
94 | if(args[i] == "-sandbox") | ||
95 | { | ||
96 | sim.sandbox = true; | ||
97 | } | ||
98 | |||
99 | if(args[i] == "-loginserver") | ||
100 | { | ||
101 | sim.loginserver = true; | ||
102 | } | ||
103 | if(args[i] == "-realphysx") | ||
104 | { | ||
105 | sim._physicsEngine = "RealPhysX"; | ||
106 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | OpenSim_Main.gridServers = new Grid(); | ||
111 | if(sim.sandbox) | ||
112 | { | ||
113 | OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; | ||
114 | OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; | ||
115 | OpenSim_Main.gridServers.LoadPlugins(); | ||
116 | ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode"); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll"; | ||
121 | OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll"; | ||
122 | OpenSim_Main.gridServers.LoadPlugins(); | ||
123 | ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); | ||
124 | } | ||
125 | |||
126 | if(sim.loginserver && sim.sandbox) | ||
127 | { | ||
128 | LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); | ||
129 | loginServer.Startup(); | ||
130 | } | ||
131 | sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); | ||
132 | |||
133 | sim.Startup(); | ||
134 | |||
135 | while(true) { | ||
136 | ServerConsole.MainConsole.Instance.MainConsolePrompt(); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | private OpenSim_Main() { | ||
141 | } | ||
142 | |||
143 | private void Startup() { | ||
144 | startuptime=DateTime.Now; | ||
145 | |||
146 | // We check our local database first, then the grid for config options | ||
147 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); | ||
148 | cfg = this.LoadConfigDll(this.ConfigDll); | ||
149 | cfg.InitConfig(); | ||
150 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); | ||
151 | cfg.LoadFromGrid(); | ||
152 | |||
153 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); | ||
154 | ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); | ||
155 | local_world = cfg.LoadWorld(); | ||
156 | |||
157 | this.physManager = new PhysicsSystem.PhysicsManager(); | ||
158 | this.physManager.LoadPlugins(); | ||
159 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); | ||
160 | local_world.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use | ||
161 | local_world.PhysScene.SetTerrain(local_world.LandMap); | ||
162 | |||
163 | OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey); | ||
164 | OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey, OpenSim_Main.cfg.GridRecvKey, OpenSim_Main.cfg.UserURL, OpenSim_Main.cfg.UserSendKey, OpenSim_Main.cfg.UserRecvKey); | ||
165 | |||
166 | local_world.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded. | ||
167 | local_world.LoadPrimsFromStorage(); | ||
168 | |||
169 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); | ||
170 | http_server = new SimCAPSHTTPServer(); | ||
171 | |||
172 | timer1.Enabled = true; | ||
173 | timer1.Interval = 100; | ||
174 | timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick); | ||
175 | |||
176 | MainServerListener(); | ||
177 | |||
178 | } | ||
179 | |||
180 | private SimConfig LoadConfigDll(string dllName) | ||
181 | { | ||
182 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
183 | SimConfig config = null; | ||
184 | |||
185 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
186 | { | ||
187 | if (pluginType.IsPublic) | ||
188 | { | ||
189 | if (!pluginType.IsAbstract) | ||
190 | { | ||
191 | Type typeInterface = pluginType.GetInterface("ISimConfig", true); | ||
192 | |||
193 | if (typeInterface != null) | ||
194 | { | ||
195 | ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
196 | config = plug.GetConfigObject(); | ||
197 | break; | ||
198 | } | ||
199 | |||
200 | typeInterface = null; | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | pluginAssembly = null; | ||
205 | return config; | ||
206 | } | ||
207 | |||
208 | private void OnReceivedData(IAsyncResult result) { | ||
209 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
210 | epSender = (EndPoint)ipeSender; | ||
211 | Packet packet = null; | ||
212 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
213 | int packetEnd = numBytes - 1; | ||
214 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | ||
215 | |||
216 | // This is either a new client or a packet to send to an old one | ||
217 | if(ClientThreads.ContainsKey(epSender)) { | ||
218 | ClientThreads[epSender].InPacket(packet); | ||
219 | } else if( packet.Type == PacketType.UseCircuitCode ) { // new client | ||
220 | OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet); | ||
221 | ClientThreads.Add(epSender, newuser); | ||
222 | } else { // invalid client | ||
223 | Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); | ||
224 | } | ||
225 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
226 | } | ||
227 | |||
228 | private void MainServerListener() { | ||
229 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); | ||
230 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); | ||
231 | |||
232 | ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); | ||
233 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | ||
234 | Server.Bind(ServerIncoming); | ||
235 | |||
236 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); | ||
237 | |||
238 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
239 | epSender = (EndPoint) ipeSender; | ||
240 | ReceivedData = new AsyncCallback(this.OnReceivedData); | ||
241 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
242 | |||
243 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening..."); | ||
244 | |||
245 | } | ||
246 | |||
247 | public static void Shutdown() { | ||
248 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads"); | ||
249 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread"); | ||
250 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients"); | ||
251 | // IMPLEMENT THIS | ||
252 | ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); | ||
253 | OpenSim_Main.local_world.Close(); | ||
254 | ServerConsole.MainConsole.Instance.Close(); | ||
255 | Environment.Exit(0); | ||
256 | } | ||
257 | |||
258 | void Timer1Tick( object sender, System.EventArgs e ) | ||
259 | { | ||
260 | |||
261 | local_world.Update(); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | public class Grid | ||
266 | { | ||
267 | public IAssetServer AssetServer; | ||
268 | public IGridServer GridServer; | ||
269 | public string AssetDll = ""; | ||
270 | public string GridDll = ""; | ||
271 | |||
272 | public Grid() | ||
273 | { | ||
274 | } | ||
275 | |||
276 | public void LoadPlugins() | ||
277 | { | ||
278 | this.AssetServer = this.LoadAssetDll(this.AssetDll); | ||
279 | this.GridServer = this.LoadGridDll(this.GridDll); | ||
280 | } | ||
281 | |||
282 | private IAssetServer LoadAssetDll(string dllName) | ||
283 | { | ||
284 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
285 | IAssetServer server = null; | ||
286 | |||
287 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
288 | { | ||
289 | if (pluginType.IsPublic) | ||
290 | { | ||
291 | if (!pluginType.IsAbstract) | ||
292 | { | ||
293 | Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); | ||
294 | |||
295 | if (typeInterface != null) | ||
296 | { | ||
297 | IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
298 | server = plug.GetAssetServer(); | ||
299 | break; | ||
300 | } | ||
301 | |||
302 | typeInterface = null; | ||
303 | } | ||
304 | } | ||
305 | } | ||
306 | pluginAssembly = null; | ||
307 | return server; | ||
308 | } | ||
309 | |||
310 | private IGridServer LoadGridDll(string dllName) | ||
311 | { | ||
312 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
313 | IGridServer server = null; | ||
314 | |||
315 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
316 | { | ||
317 | if (pluginType.IsPublic) | ||
318 | { | ||
319 | if (!pluginType.IsAbstract) | ||
320 | { | ||
321 | Type typeInterface = pluginType.GetInterface("IGridPlugin", true); | ||
322 | |||
323 | if (typeInterface != null) | ||
324 | { | ||
325 | IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
326 | server = plug.GetGridServer(); | ||
327 | break; | ||
328 | } | ||
329 | |||
330 | typeInterface = null; | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | pluginAssembly = null; | ||
335 | return server; | ||
336 | } | ||
337 | } | ||
338 | } | ||
diff --git a/src/OpenSim.Framework/AssemblyInfo.cs b/src/OpenSim.Framework/AssemblyInfo.cs deleted file mode 100644 index 32f1380..0000000 --- a/src/OpenSim.Framework/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-gridinterfaces")] | ||
19 | [assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/OpenSim.Framework/LoginService.cs b/src/OpenSim.Framework/LoginService.cs deleted file mode 100644 index 85fe761..0000000 --- a/src/OpenSim.Framework/LoginService.cs +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using Nwc.XmlRpc; | ||
6 | using OpenSim.GridServers; | ||
7 | using libsecondlife; | ||
8 | |||
9 | namespace OpenSim.Framework | ||
10 | { | ||
11 | public abstract class LoginService | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
diff --git a/src/OpenSim.Framework/OpenSim.Framework.csproj b/src/OpenSim.Framework/OpenSim.Framework.csproj deleted file mode 100644 index ec586c3..0000000 --- a/src/OpenSim.Framework/OpenSim.Framework.csproj +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{407CE85B-628C-4788-9DBC-49BCEFC3A84F}</ProjectGuid> | ||
8 | <OutputType>Library</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>OpenSim.Framework</RootNamespace> | ||
11 | <AssemblyName>OpenGrid.Framework</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="System" /> | ||
36 | <Reference Include="System.Data" /> | ||
37 | <Reference Include="System.Xml" /> | ||
38 | </ItemGroup> | ||
39 | <ItemGroup> | ||
40 | <Compile Include="LoginService.cs" /> | ||
41 | </ItemGroup> | ||
42 | <ItemGroup> | ||
43 | <ProjectReference Include="..\GridInterfaces\GridInterfaces.csproj"> | ||
44 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
45 | <Name>GridInterfaces</Name> | ||
46 | </ProjectReference> | ||
47 | </ItemGroup> | ||
48 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
49 | </Project> \ No newline at end of file | ||
diff --git a/src/OpenSim.Framework/Properties/AssemblyInfo.cs b/src/OpenSim.Framework/Properties/AssemblyInfo.cs deleted file mode 100644 index 72e55b9..0000000 --- a/src/OpenSim.Framework/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("Playahead AB")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework")] | ||
13 | [assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
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 | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("67d2b810-0969-4550-ab2b-d2f5ac191191")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/src/OpenSim.Framework/default.build b/src/OpenSim.Framework/default.build deleted file mode 100644 index 57dfee8..0000000 --- a/src/OpenSim.Framework/default.build +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim.Framework" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim.Framework</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/OpenSim.Framework.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-gridinterfaces" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="Definitions for OGS interface" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/OpenSim.Framework.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | <include name="libsecondlife.dll" /> | ||
43 | <include name="GridInterfaces.dll" /> | ||
44 | </references> | ||
45 | <sources basedir="./"> | ||
46 | <include name="*.cs" /> | ||
47 | </sources> | ||
48 | </csc> | ||
49 | </target> | ||
50 | </project> | ||
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs deleted file mode 100644 index dd698e4..0000000 --- a/src/OpenSimClient.cs +++ /dev/null | |||
@@ -1,471 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using libsecondlife; | ||
31 | using libsecondlife.Packets; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using System.Timers; | ||
37 | using OpenSim.GridServers; | ||
38 | using OpenSim.world; | ||
39 | |||
40 | namespace OpenSim | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Handles new client connections | ||
44 | /// Constructor takes a single Packet and authenticates everything | ||
45 | /// </summary> | ||
46 | public class OpenSimClient { | ||
47 | |||
48 | public LLUUID AgentID; | ||
49 | public LLUUID SessionID; | ||
50 | public uint CircuitCode; | ||
51 | public world.Avatar ClientAvatar; | ||
52 | private UseCircuitCodePacket cirpack; | ||
53 | private Thread ClientThread; | ||
54 | public EndPoint userEP; | ||
55 | private BlockingQueue<QueItem> PacketQueue; | ||
56 | private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | ||
57 | private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); | ||
58 | private System.Timers.Timer AckTimer; | ||
59 | private uint Sequence = 0; | ||
60 | private object SequenceLock = new object(); | ||
61 | private const int MAX_APPENDED_ACKS = 10; | ||
62 | private const int RESEND_TIMEOUT = 4000; | ||
63 | private const int MAX_SEQUENCE = 0xFFFFFF; | ||
64 | |||
65 | public void ack_pack(Packet Pack) { | ||
66 | //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); | ||
67 | //ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; | ||
68 | //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); | ||
69 | //ack_it.Packets[0].ID = Pack.Header.ID; | ||
70 | //ack_it.Header.Reliable = false; | ||
71 | |||
72 | //OutPacket(ack_it); | ||
73 | |||
74 | if (Pack.Header.Reliable) { | ||
75 | lock (PendingAcks) { | ||
76 | uint sequence = (uint)Pack.Header.Sequence; | ||
77 | if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | |||
82 | public void ProcessInPacket(Packet Pack) { | ||
83 | ack_pack(Pack); | ||
84 | switch(Pack.Type) { | ||
85 | case PacketType.CompleteAgentMovement: | ||
86 | ClientAvatar.CompleteMovement(OpenSim_Main.local_world); | ||
87 | ClientAvatar.SendInitialPosition(); | ||
88 | break; | ||
89 | case PacketType.RegionHandshakeReply: | ||
90 | OpenSim_Main.local_world.SendLayerData(this); | ||
91 | break; | ||
92 | case PacketType.AgentWearablesRequest: | ||
93 | ClientAvatar.SendInitialAppearance(); | ||
94 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
95 | if(client.AgentID != this.AgentID) | ||
96 | { | ||
97 | ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); | ||
98 | this.OutPacket(objupdate); | ||
99 | client.ClientAvatar.SendAppearanceToOtherAgent(this); | ||
100 | } | ||
101 | } | ||
102 | OpenSim_Main.local_world.GetInitialPrims(this); | ||
103 | break; | ||
104 | case PacketType.ObjectAdd: | ||
105 | OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); | ||
106 | break; | ||
107 | case PacketType.ObjectLink: | ||
108 | ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString()); | ||
109 | break; | ||
110 | case PacketType.ObjectScale: | ||
111 | ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString()); | ||
112 | break; | ||
113 | case PacketType.ObjectShape: | ||
114 | ObjectShapePacket shape = (ObjectShapePacket)Pack; | ||
115 | for(int i =0; i <shape.ObjectData.Length; i++) | ||
116 | { | ||
117 | foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) | ||
118 | { | ||
119 | if(ent.localid == shape.ObjectData[i].ObjectLocalID) | ||
120 | { | ||
121 | ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | break; | ||
126 | case PacketType.MultipleObjectUpdate : | ||
127 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack; | ||
128 | |||
129 | for( int i = 0; i < multipleupdate.ObjectData.Length; i++ ) | ||
130 | { | ||
131 | if( multipleupdate.ObjectData[ i ].Type == 9 ) //change position | ||
132 | { | ||
133 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 ); | ||
134 | foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) | ||
135 | { | ||
136 | if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID) | ||
137 | { | ||
138 | ((OpenSim.world.Primitive)ent).UpdatePosition( pos); | ||
139 | |||
140 | } | ||
141 | } | ||
142 | |||
143 | //should update stored position of the prim | ||
144 | } | ||
145 | else if(multipleupdate.ObjectData[i].Type == 10 )//rotation | ||
146 | { | ||
147 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
148 | foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) | ||
149 | { | ||
150 | if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID) | ||
151 | { | ||
152 | ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W); | ||
153 | ((OpenSim.world.Primitive)ent).UpdateFlag = true; | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | else if(multipleupdate.ObjectData[i].Type == 13 )//scale | ||
158 | { | ||
159 | |||
160 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[ i ].Data, 12 ); | ||
161 | foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) | ||
162 | { | ||
163 | if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID) | ||
164 | { | ||
165 | ((OpenSim.world.Primitive)ent).Scale = scale; | ||
166 | } | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | break; | ||
171 | case PacketType.TransferRequest: | ||
172 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | ||
173 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
174 | OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer); | ||
175 | break; | ||
176 | case PacketType.AgentUpdate: | ||
177 | ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); | ||
178 | break; | ||
179 | case PacketType.LogoutRequest: | ||
180 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | ||
181 | //tell all clients to kill our object | ||
182 | KillObjectPacket kill = new KillObjectPacket(); | ||
183 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
184 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
185 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | ||
186 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
187 | client.OutPacket(kill); | ||
188 | } | ||
189 | OpenSim_Main.gridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); | ||
190 | lock(OpenSim_Main.local_world.Entities) { | ||
191 | OpenSim_Main.local_world.Entities.Remove(this.AgentID); | ||
192 | } | ||
193 | //need to do other cleaning up here too | ||
194 | OpenSim_Main.sim.ClientThreads.Remove(this.userEP); | ||
195 | this.ClientThread.Abort(); | ||
196 | break; | ||
197 | case PacketType.ChatFromViewer: | ||
198 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
199 | if(Helpers.FieldToString(inchatpack.ChatData.Message)=="") break; | ||
200 | |||
201 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
202 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
203 | reply.ChatData.Audible = 1; | ||
204 | reply.ChatData.Message = inchatpack.ChatData.Message; | ||
205 | reply.ChatData.ChatType = 1; | ||
206 | reply.ChatData.SourceType = 1; | ||
207 | reply.ChatData.Position = this.ClientAvatar.position; | ||
208 | reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); | ||
209 | reply.ChatData.OwnerID = this.AgentID; | ||
210 | reply.ChatData.SourceID = this.AgentID; | ||
211 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
212 | client.OutPacket(reply); | ||
213 | } | ||
214 | break; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | private void ResendUnacked() | ||
219 | { | ||
220 | int now = Environment.TickCount; | ||
221 | |||
222 | lock (NeedAck) | ||
223 | { | ||
224 | foreach (Packet packet in NeedAck.Values) | ||
225 | { | ||
226 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) | ||
227 | { | ||
228 | ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " + | ||
229 | (now - packet.TickCount) + "ms have passed"); | ||
230 | |||
231 | packet.Header.Resent = true; | ||
232 | OutPacket(packet); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | |||
238 | private void SendAcks() | ||
239 | { | ||
240 | lock (PendingAcks) | ||
241 | { | ||
242 | if (PendingAcks.Count > 0) | ||
243 | { | ||
244 | if (PendingAcks.Count > 250) | ||
245 | { | ||
246 | // FIXME: Handle the odd case where we have too many pending ACKs queued up | ||
247 | ServerConsole.MainConsole.Instance.WriteLine("Too many ACKs queued up!"); | ||
248 | return; | ||
249 | } | ||
250 | |||
251 | ServerConsole.MainConsole.Instance.WriteLine("Sending PacketAck"); | ||
252 | |||
253 | |||
254 | int i = 0; | ||
255 | PacketAckPacket acks = new PacketAckPacket(); | ||
256 | acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; | ||
257 | |||
258 | foreach (uint ack in PendingAcks.Values) | ||
259 | { | ||
260 | acks.Packets[i] = new PacketAckPacket.PacketsBlock(); | ||
261 | acks.Packets[i].ID = ack; | ||
262 | i++; | ||
263 | } | ||
264 | |||
265 | acks.Header.Reliable = false; | ||
266 | OutPacket(acks); | ||
267 | |||
268 | PendingAcks.Clear(); | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | |||
273 | private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) | ||
274 | { | ||
275 | SendAcks(); | ||
276 | ResendUnacked(); | ||
277 | } | ||
278 | |||
279 | public void ProcessOutPacket(Packet Pack) { | ||
280 | |||
281 | // Keep track of when this packet was sent out | ||
282 | Pack.TickCount = Environment.TickCount; | ||
283 | |||
284 | if (!Pack.Header.Resent) | ||
285 | { | ||
286 | // Set the sequence number | ||
287 | lock (SequenceLock) | ||
288 | { | ||
289 | if (Sequence >= MAX_SEQUENCE) | ||
290 | Sequence = 1; | ||
291 | else | ||
292 | Sequence++; | ||
293 | Pack.Header.Sequence = Sequence; | ||
294 | } | ||
295 | |||
296 | if (Pack.Header.Reliable) //DIRTY HACK | ||
297 | { | ||
298 | lock (NeedAck) | ||
299 | { | ||
300 | if (!NeedAck.ContainsKey(Pack.Header.Sequence)) | ||
301 | { | ||
302 | NeedAck.Add(Pack.Header.Sequence, Pack); | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | // Client.Log("Attempted to add a duplicate sequence number (" + | ||
307 | // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + | ||
308 | // packet.Type.ToString(), Helpers.LogLevel.Warning); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | // Don't append ACKs to resent packets, in case that's what was causing the | ||
313 | // delivery to fail | ||
314 | if (!Pack.Header.Resent) | ||
315 | { | ||
316 | // Append any ACKs that need to be sent out to this packet | ||
317 | lock (PendingAcks) | ||
318 | { | ||
319 | if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && | ||
320 | Pack.Type != PacketType.PacketAck && | ||
321 | Pack.Type != PacketType.LogoutRequest) | ||
322 | { | ||
323 | Pack.Header.AckList = new uint[PendingAcks.Count]; | ||
324 | int i = 0; | ||
325 | |||
326 | foreach (uint ack in PendingAcks.Values) | ||
327 | { | ||
328 | Pack.Header.AckList[i] = ack; | ||
329 | i++; | ||
330 | } | ||
331 | |||
332 | PendingAcks.Clear(); | ||
333 | Pack.Header.AppendedAcks = true; | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | |||
340 | //ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString()); | ||
341 | |||
342 | byte[] ZeroOutBuffer = new byte[4096]; | ||
343 | byte[] sendbuffer; | ||
344 | sendbuffer = Pack.ToBytes(); | ||
345 | |||
346 | try { | ||
347 | if (Pack.Header.Zerocoded) { | ||
348 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | ||
349 | OpenSim_Main.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None,userEP); | ||
350 | } else { | ||
351 | OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP); | ||
352 | } | ||
353 | } catch (Exception) { | ||
354 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); | ||
355 | ClientThread.Abort(); | ||
356 | } | ||
357 | |||
358 | } | ||
359 | |||
360 | public void InPacket(Packet NewPack) { | ||
361 | // Handle appended ACKs | ||
362 | if (NewPack.Header.AppendedAcks) | ||
363 | { | ||
364 | lock (NeedAck) | ||
365 | { | ||
366 | foreach (uint ack in NewPack.Header.AckList) | ||
367 | { | ||
368 | NeedAck.Remove(ack); | ||
369 | } | ||
370 | } | ||
371 | } | ||
372 | |||
373 | // Handle PacketAck packets | ||
374 | if (NewPack.Type == PacketType.PacketAck) | ||
375 | { | ||
376 | PacketAckPacket ackPacket = (PacketAckPacket)NewPack; | ||
377 | |||
378 | lock (NeedAck) | ||
379 | { | ||
380 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) | ||
381 | { | ||
382 | NeedAck.Remove(block.ID); | ||
383 | } | ||
384 | } | ||
385 | } else if( ( NewPack.Type == PacketType.StartPingCheck ) ) { | ||
386 | //reply to pingcheck | ||
387 | libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; | ||
388 | libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); | ||
389 | endPing.PingID.PingID = startPing.PingID.PingID; | ||
390 | OutPacket(endPing); | ||
391 | } | ||
392 | else | ||
393 | { | ||
394 | QueItem item = new QueItem(); | ||
395 | item.Packet = NewPack; | ||
396 | item.Incoming = true; | ||
397 | this.PacketQueue.Enqueue(item); | ||
398 | } | ||
399 | |||
400 | } | ||
401 | |||
402 | public void OutPacket(Packet NewPack) { | ||
403 | QueItem item = new QueItem(); | ||
404 | item.Packet = NewPack; | ||
405 | item.Incoming = false; | ||
406 | this.PacketQueue.Enqueue(item); | ||
407 | } | ||
408 | |||
409 | public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) { | ||
410 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); | ||
411 | cirpack = initialcirpack; | ||
412 | userEP = remoteEP; | ||
413 | PacketQueue = new BlockingQueue<QueItem>(); | ||
414 | AckTimer = new System.Timers.Timer(500); | ||
415 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | ||
416 | AckTimer.Start(); | ||
417 | |||
418 | ClientThread = new Thread(new ThreadStart(AuthUser)); | ||
419 | ClientThread.IsBackground = true; | ||
420 | ClientThread.Start(); | ||
421 | } | ||
422 | |||
423 | private void ClientLoop() { | ||
424 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop"); | ||
425 | while(true) { | ||
426 | QueItem nextPacket = PacketQueue.Dequeue(); | ||
427 | if(nextPacket.Incoming) | ||
428 | { | ||
429 | //is a incoming packet | ||
430 | ProcessInPacket(nextPacket.Packet); | ||
431 | } | ||
432 | else | ||
433 | { | ||
434 | //is a out going packet | ||
435 | ProcessOutPacket(nextPacket.Packet); | ||
436 | } | ||
437 | } | ||
438 | } | ||
439 | |||
440 | private void InitNewClient() { | ||
441 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); | ||
442 | OpenSim_Main.local_world.AddViewerAgent(this); | ||
443 | world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID]; | ||
444 | this.ClientAvatar=(world.Avatar)tempent; | ||
445 | } | ||
446 | |||
447 | private void AuthUser() | ||
448 | { | ||
449 | AuthenticateResponse sessionInfo = OpenSim_Main.gridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | ||
450 | if(!sessionInfo.Authorised) | ||
451 | { | ||
452 | //session/circuit not authorised | ||
453 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); | ||
454 | ClientThread.Abort(); | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); | ||
459 | //session is authorised | ||
460 | this.AgentID=cirpack.CircuitCode.ID; | ||
461 | this.SessionID=cirpack.CircuitCode.SessionID; | ||
462 | this.CircuitCode=cirpack.CircuitCode.Code; | ||
463 | InitNewClient(); | ||
464 | this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; | ||
465 | this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; | ||
466 | ClientLoop(); | ||
467 | } | ||
468 | } | ||
469 | } | ||
470 | |||
471 | } | ||
diff --git a/src/OpenSimConsole.cs b/src/OpenSimConsole.cs deleted file mode 100644 index cf8b648..0000000 --- a/src/OpenSimConsole.cs +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Threading; | ||
32 | using System.IO; | ||
33 | using System.Net; | ||
34 | using libsecondlife; | ||
35 | using libsecondlife.Packets; | ||
36 | using ServerConsole; | ||
37 | |||
38 | namespace OpenSim | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Description of ServerConsole. | ||
42 | /// </summary> | ||
43 | public class MServerConsole : ConsoleBase | ||
44 | { | ||
45 | |||
46 | private ConsoleType ConsType; | ||
47 | StreamWriter Log; | ||
48 | |||
49 | |||
50 | // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! | ||
51 | // constype - the type of console to use (see enum ConsoleType) | ||
52 | // sparam - depending on the console type: | ||
53 | // TCP - the IP to bind to (127.0.0.1 if blank) | ||
54 | // Local - param ignored | ||
55 | // SimChat - the AgentID of this sim's admin | ||
56 | // and for the iparam: | ||
57 | // TCP - the port to bind to | ||
58 | // Local - param ignored | ||
59 | // SimChat - the chat channel to accept commands from | ||
60 | public MServerConsole(ConsoleType constype, string sparam, int iparam) { | ||
61 | ConsType = constype; | ||
62 | switch(constype) { | ||
63 | case ConsoleType.Local: | ||
64 | |||
65 | Console.WriteLine("ServerConsole.cs - creating new local console"); | ||
66 | Console.WriteLine("Logs will be saved to current directory in opensim-console.log"); | ||
67 | Log=File.AppendText("opensim-console.log"); | ||
68 | Log.WriteLine("========================================================================"); | ||
69 | //Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString()); | ||
70 | break; | ||
71 | case ConsoleType.TCP: | ||
72 | break; | ||
73 | case ConsoleType.SimChat: | ||
74 | break; | ||
75 | |||
76 | default: | ||
77 | Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); | ||
78 | break; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | public override void Close() { | ||
83 | Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString()); | ||
84 | Log.Close(); | ||
85 | } | ||
86 | |||
87 | public override void Write(string format, params object[] args) | ||
88 | { | ||
89 | Log.Write(format, args); | ||
90 | Console.Write(format, args); | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | public override void WriteLine(string format, params object[] args) | ||
95 | { | ||
96 | Log.WriteLine(format, args); | ||
97 | Console.WriteLine(format, args); | ||
98 | return; | ||
99 | } | ||
100 | |||
101 | public override string ReadLine() | ||
102 | { | ||
103 | string TempStr=Console.ReadLine(); | ||
104 | Log.WriteLine(TempStr); | ||
105 | return TempStr; | ||
106 | } | ||
107 | |||
108 | public override int Read() { | ||
109 | int TempInt= Console.Read(); | ||
110 | Log.Write((char)TempInt); | ||
111 | return TempInt; | ||
112 | } | ||
113 | |||
114 | // Displays a command prompt and waits for the user to enter a string, then returns that string | ||
115 | public override string CmdPrompt(string prompt) { | ||
116 | this.Write(prompt); | ||
117 | return this.ReadLine(); | ||
118 | } | ||
119 | |||
120 | // Displays a command prompt and returns a default value if the user simply presses enter | ||
121 | public override string CmdPrompt(string prompt, string defaultresponse) { | ||
122 | string temp=CmdPrompt(prompt); | ||
123 | if(temp=="") { | ||
124 | return defaultresponse; | ||
125 | } else { | ||
126 | return temp; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | ||
131 | public override string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) { | ||
132 | bool itisdone=false; | ||
133 | string temp=CmdPrompt(prompt,defaultresponse); | ||
134 | while(itisdone==false) { | ||
135 | if((temp==OptionA) || (temp==OptionB)) { | ||
136 | itisdone=true; | ||
137 | } else { | ||
138 | this.WriteLine("Valid options are " + OptionA + " or " + OptionB); | ||
139 | temp=CmdPrompt(prompt,defaultresponse); | ||
140 | } | ||
141 | } | ||
142 | return temp; | ||
143 | } | ||
144 | |||
145 | // Runs a command with a number of parameters | ||
146 | public override Object RunCmd(string Cmd, string[] cmdparams) { | ||
147 | switch(Cmd) { | ||
148 | case "help": | ||
149 | this.WriteLine("show users - show info about connected users"); | ||
150 | this.WriteLine("shutdown - disconnect all clients and shutdown"); | ||
151 | this.WriteLine("regenerate - regenerate the sim's terrain"); | ||
152 | break; | ||
153 | |||
154 | case "show": | ||
155 | ShowCommands(cmdparams[0]); | ||
156 | break; | ||
157 | |||
158 | case "regenerate": | ||
159 | OpenSim_Main.local_world.RegenerateTerrain(); | ||
160 | break; | ||
161 | |||
162 | case "shutdown": | ||
163 | OpenSim_Main.Shutdown(); | ||
164 | break; | ||
165 | } | ||
166 | return null; | ||
167 | } | ||
168 | |||
169 | // Shows data about something | ||
170 | public override void ShowCommands(string ShowWhat) { | ||
171 | switch(ShowWhat) { | ||
172 | case "uptime": | ||
173 | this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString()); | ||
174 | this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString()); | ||
175 | break; | ||
176 | case "users": | ||
177 | OpenSim.world.Avatar TempAv; | ||
178 | this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP")); | ||
179 | foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) { | ||
180 | if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar") | ||
181 | { | ||
182 | TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; | ||
183 | this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); | ||
184 | } | ||
185 | } | ||
186 | break; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | // Displays a prompt to the user and then runs the command they entered | ||
191 | public override void MainConsolePrompt() { | ||
192 | string[] tempstrarray; | ||
193 | string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # "); | ||
194 | tempstrarray = tempstr.Split(' '); | ||
195 | string cmd=tempstrarray[0]; | ||
196 | Array.Reverse(tempstrarray); | ||
197 | Array.Resize<string>(ref tempstrarray,tempstrarray.Length-1); | ||
198 | Array.Reverse(tempstrarray); | ||
199 | string[] cmdparams=(string[])tempstrarray; | ||
200 | RunCmd(cmd,cmdparams); | ||
201 | } | ||
202 | |||
203 | |||
204 | public override void SetStatus(string status) | ||
205 | { | ||
206 | Console.Write( status + "\r" ); | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
211 | |||
diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 90fc127..0000000 --- a/src/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("opensim")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("Playahead AB")] | ||
12 | [assembly: AssemblyProduct("opensim")] | ||
13 | [assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
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 | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("1d09756b-a461-4302-b6fe-15c455317909")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs deleted file mode 100644 index 7d3f314..0000000 --- a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-remoteservers")] | ||
19 | [assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs deleted file mode 100644 index adb3d0f..0000000 --- a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs +++ /dev/null | |||
@@ -1,279 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Threading; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.IO; | ||
34 | using System.Xml; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.GridServers; | ||
37 | |||
38 | namespace RemoteGridServers | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// | ||
42 | /// </summary> | ||
43 | /// | ||
44 | |||
45 | public class RemoteGridPlugin : IGridPlugin | ||
46 | { | ||
47 | public RemoteGridPlugin() | ||
48 | { | ||
49 | |||
50 | } | ||
51 | |||
52 | public IGridServer GetGridServer() | ||
53 | { | ||
54 | return(new RemoteGridServer()); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | public class RemoteAssetPlugin : IAssetPlugin | ||
59 | { | ||
60 | public RemoteAssetPlugin() | ||
61 | { | ||
62 | |||
63 | } | ||
64 | |||
65 | public IAssetServer GetAssetServer() | ||
66 | { | ||
67 | return(new RemoteAssetServer()); | ||
68 | } | ||
69 | } | ||
70 | public class RemoteGridServer : RemoteGridBase | ||
71 | { | ||
72 | private string GridServerUrl; | ||
73 | private string GridSendKey; | ||
74 | private string GridRecvKey; | ||
75 | private string UserServerUrl; | ||
76 | private string UserSendKey; | ||
77 | private string UserRecvKey; | ||
78 | |||
79 | private Dictionary<uint, agentcircuitdata> AgentCircuits = new Dictionary<uint, agentcircuitdata>(); | ||
80 | |||
81 | public override Dictionary<uint, agentcircuitdata> agentcircuits { | ||
82 | get {return AgentCircuits;} | ||
83 | set {AgentCircuits=value;} | ||
84 | } | ||
85 | |||
86 | public RemoteGridServer() | ||
87 | { | ||
88 | ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); | ||
89 | } | ||
90 | |||
91 | public override bool RequestConnection() | ||
92 | { | ||
93 | return true; | ||
94 | } | ||
95 | |||
96 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
97 | { | ||
98 | agentcircuitdata validcircuit=this.AgentCircuits[circuitcode]; | ||
99 | AuthenticateResponse user = new AuthenticateResponse(); | ||
100 | if((sessionID==validcircuit.SessionID) && (agentID==validcircuit.AgentID)) | ||
101 | { | ||
102 | // YAY! Valid login | ||
103 | user.Authorised = true; | ||
104 | user.LoginInfo = new Login(); | ||
105 | user.LoginInfo.Agent = agentID; | ||
106 | user.LoginInfo.Session = sessionID; | ||
107 | user.LoginInfo.First = validcircuit.firstname; | ||
108 | user.LoginInfo.Last = validcircuit.lastname; | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | // Invalid | ||
113 | user.Authorised = false; | ||
114 | } | ||
115 | |||
116 | return(user); | ||
117 | } | ||
118 | |||
119 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
120 | { | ||
121 | WebRequest DeleteSession = WebRequest.Create(UserServerUrl + "/usersessions/" + sessionID.ToString()); | ||
122 | DeleteSession.Method="DELETE"; | ||
123 | DeleteSession.ContentType="text/plaintext"; | ||
124 | DeleteSession.ContentLength=0; | ||
125 | |||
126 | StreamWriter stOut = new StreamWriter (DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII); | ||
127 | stOut.Write(""); | ||
128 | stOut.Close(); | ||
129 | |||
130 | StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream()); | ||
131 | string GridResponse = stIn.ReadToEnd(); | ||
132 | stIn.Close(); | ||
133 | return(true); | ||
134 | } | ||
135 | |||
136 | public override UUIDBlock RequestUUIDBlock() | ||
137 | { | ||
138 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
139 | return(uuidBlock); | ||
140 | } | ||
141 | |||
142 | public override neighbourinfo[] RequestNeighbours(ulong regionhandle) | ||
143 | { | ||
144 | ArrayList neighbourlist = new ArrayList(); | ||
145 | |||
146 | WebRequest FindNeighbours = WebRequest.Create(GridServerUrl + "/regions/" + regionhandle.ToString() + "/neighbours"); | ||
147 | FindNeighbours.ContentType="text/plaintext"; | ||
148 | FindNeighbours.ContentLength=0; | ||
149 | |||
150 | StreamWriter stOut = new StreamWriter (FindNeighbours.GetRequestStream(), System.Text.Encoding.ASCII); | ||
151 | stOut.Write(""); | ||
152 | stOut.Close(); | ||
153 | |||
154 | |||
155 | XmlDocument GridRespXml = new XmlDocument(); | ||
156 | GridRespXml.Load(FindNeighbours.GetResponse().GetResponseStream()); | ||
157 | |||
158 | |||
159 | XmlNode NeighboursRoot = GridRespXml.FirstChild; | ||
160 | if(NeighboursRoot.Name != "neighbours") { | ||
161 | return new neighbourinfo[0]; | ||
162 | } | ||
163 | |||
164 | FindNeighbours.GetResponse().GetResponseStream().Close(); | ||
165 | |||
166 | return new neighbourinfo[0]; | ||
167 | } | ||
168 | |||
169 | public override void SetServerInfo(string UserServerUrl, string UserSendKey, string UserRecvKey, string GridServerUrl, string GridSendKey, string GridRecvKey) | ||
170 | { | ||
171 | this.UserServerUrl = UserServerUrl; | ||
172 | this.UserSendKey = UserSendKey; | ||
173 | this.UserRecvKey = UserRecvKey; | ||
174 | this.GridServerUrl = GridServerUrl; | ||
175 | this.GridSendKey = GridSendKey; | ||
176 | this.GridRecvKey = GridRecvKey; | ||
177 | } | ||
178 | |||
179 | public override string GetName() | ||
180 | { | ||
181 | return "Remote"; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | |||
186 | public class RemoteAssetServer : IAssetServer | ||
187 | { | ||
188 | private IAssetReceiver _receiver; | ||
189 | private BlockingQueue<ARequest> _assetRequests; | ||
190 | private Thread _remoteAssetServerThread; | ||
191 | private string AssetServerUrl; | ||
192 | private string AssetSendKey; | ||
193 | |||
194 | public RemoteAssetServer() | ||
195 | { | ||
196 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
197 | this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
198 | this._remoteAssetServerThread.IsBackground = true; | ||
199 | this._remoteAssetServerThread.Start(); | ||
200 | ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created"); | ||
201 | } | ||
202 | |||
203 | public void SetReceiver(IAssetReceiver receiver) | ||
204 | { | ||
205 | this._receiver = receiver; | ||
206 | } | ||
207 | |||
208 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
209 | { | ||
210 | ARequest req = new ARequest(); | ||
211 | req.AssetID = assetID; | ||
212 | req.IsTexture = isTexture; | ||
213 | this._assetRequests.Enqueue(req); | ||
214 | } | ||
215 | |||
216 | public void UpdateAsset(AssetBase asset) | ||
217 | { | ||
218 | |||
219 | } | ||
220 | |||
221 | public void UploadNewAsset(AssetBase asset) | ||
222 | { | ||
223 | |||
224 | } | ||
225 | |||
226 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
227 | { | ||
228 | this.AssetServerUrl = ServerUrl; | ||
229 | this.AssetSendKey = ServerKey; | ||
230 | } | ||
231 | |||
232 | private void RunRequests() | ||
233 | { | ||
234 | while(true) | ||
235 | { | ||
236 | //we need to add support for the asset server not knowing about a requested asset | ||
237 | ARequest req = this._assetRequests.Dequeue(); | ||
238 | LLUUID assetID = req.AssetID; | ||
239 | ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it"); | ||
240 | WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data"); | ||
241 | WebResponse AssetResponse = AssetLoad.GetResponse(); | ||
242 | byte[] idata = new byte[(int)AssetResponse.ContentLength]; | ||
243 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); | ||
244 | idata = br.ReadBytes((int)AssetResponse.ContentLength); | ||
245 | br.Close(); | ||
246 | |||
247 | AssetBase asset = new AssetBase(); | ||
248 | asset.FullID = assetID; | ||
249 | asset.Data = idata; | ||
250 | _receiver.AssetReceived(asset, req.IsTexture ); | ||
251 | } | ||
252 | } | ||
253 | } | ||
254 | |||
255 | public class BlockingQueue< T > { | ||
256 | private Queue< T > _queue = new Queue< T >(); | ||
257 | private object _queueSync = new object(); | ||
258 | |||
259 | public void Enqueue(T value) | ||
260 | { | ||
261 | lock(_queueSync) | ||
262 | { | ||
263 | _queue.Enqueue(value); | ||
264 | Monitor.Pulse(_queueSync); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | public T Dequeue() | ||
269 | { | ||
270 | lock(_queueSync) | ||
271 | { | ||
272 | if( _queue.Count < 1) | ||
273 | Monitor.Wait(_queueSync); | ||
274 | |||
275 | return _queue.Dequeue(); | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | } | ||
diff --git a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj deleted file mode 100644 index f1c5649..0000000 --- a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>RemoteGridServers</RootNamespace> | ||
5 | <AssemblyName>RemoteGridServers</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="libsecondlife"> | ||
30 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="RemoteGrid.cs" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
39 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
40 | <Name>ServerConsole</Name> | ||
41 | </ProjectReference> | ||
42 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
43 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
44 | <Name>GridInterfaces</Name> | ||
45 | </ProjectReference> | ||
46 | </ItemGroup> | ||
47 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
48 | </Project> \ No newline at end of file | ||
diff --git a/src/RemoteServers/default.build b/src/RemoteServers/default.build deleted file mode 100644 index f8e6977..0000000 --- a/src/RemoteServers/default.build +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/RemoteGridServers.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="RemoteGridServers/AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-remoteservers" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="Connects to remote OGS installation" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/RemoteGridServers.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | <include name="libsecondlife.dll" /> | ||
43 | <include name="GridInterfaces.dll" /> | ||
44 | <include name="ServerConsole.dll" /> | ||
45 | </references> | ||
46 | <sources basedir="RemoteGridServers/"> | ||
47 | <include name="*.cs" /> | ||
48 | </sources> | ||
49 | </csc> | ||
50 | </target> | ||
51 | </project> | ||
diff --git a/src/Second-server.csproj b/src/Second-server.csproj deleted file mode 100644 index 7c0d17c..0000000 --- a/src/Second-server.csproj +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Exe</OutputType> | ||
4 | <RootNamespace>OpenSim</RootNamespace> | ||
5 | <AssemblyName>OpenSim</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</ProjectGuid> | ||
9 | <StartupObject>OpenSim.OpenSim_Main</StartupObject> | ||
10 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
11 | <NoStdLib>False</NoStdLib> | ||
12 | <WarningLevel>4</WarningLevel> | ||
13 | <TreatWarningsAsErrors>false</TreatWarningsAsErrors> | ||
14 | </PropertyGroup> | ||
15 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
16 | <OutputPath>bin\</OutputPath> | ||
17 | <Optimize>False</Optimize> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <DebugSymbols>true</DebugSymbols> | ||
20 | <DebugType>Full</DebugType> | ||
21 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
22 | </PropertyGroup> | ||
23 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
24 | <OutputPath>..\bin\</OutputPath> | ||
25 | <Optimize>True</Optimize> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <DebugSymbols>False</DebugSymbols> | ||
28 | <DebugType>None</DebugType> | ||
29 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
30 | </PropertyGroup> | ||
31 | <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> | ||
32 | <RegisterForComInterop>False</RegisterForComInterop> | ||
33 | <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> | ||
34 | <BaseAddress>4194304</BaseAddress> | ||
35 | <PlatformTarget>AnyCPU</PlatformTarget> | ||
36 | <FileAlignment>4096</FileAlignment> | ||
37 | </PropertyGroup> | ||
38 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
39 | <OutputPath>..\bin\</OutputPath> | ||
40 | </PropertyGroup> | ||
41 | <ItemGroup> | ||
42 | <Reference Include="System" /> | ||
43 | <Reference Include="System.Data" /> | ||
44 | <Reference Include="System.Xml" /> | ||
45 | <Reference Include="libsecondlife"> | ||
46 | <HintPath>..\bin\libsecondlife.dll</HintPath> | ||
47 | <SpecificVersion>False</SpecificVersion> | ||
48 | </Reference> | ||
49 | <Reference Include="Axiom.MathLib"> | ||
50 | <HintPath>..\bin\Axiom.MathLib.dll</HintPath> | ||
51 | <SpecificVersion>False</SpecificVersion> | ||
52 | </Reference> | ||
53 | <Reference Include="log4net"> | ||
54 | <HintPath>..\bin\log4net.dll</HintPath> | ||
55 | <SpecificVersion>False</SpecificVersion> | ||
56 | </Reference> | ||
57 | </ItemGroup> | ||
58 | <ItemGroup> | ||
59 | <Compile Include="Config.cs" /> | ||
60 | <Compile Include="Main.cs" /> | ||
61 | <Compile Include="OpenSimClient.cs" /> | ||
62 | <Compile Include="types\Mesh.cs" /> | ||
63 | <Compile Include="types\Triangle.cs" /> | ||
64 | <Compile Include="Util.cs" /> | ||
65 | <Compile Include="world\Avatar.cs" /> | ||
66 | <Compile Include="world\Entity.cs" /> | ||
67 | <Compile Include="world\Primitive.cs" /> | ||
68 | <Compile Include="world\ScriptEngine.cs" /> | ||
69 | <Compile Include="world\scripting\IScript.cs" /> | ||
70 | <Compile Include="world\SurfacePatch.cs" /> | ||
71 | <Compile Include="world\World.cs" /> | ||
72 | <Compile Include="GridServers\LoginServer.cs" /> | ||
73 | <Compile Include="Assets\AssetCache.cs" /> | ||
74 | <Compile Include="OpenSimConsole.cs" /> | ||
75 | <Compile Include="HeightMapGenHills.cs" /> | ||
76 | <Compile Include="VersionInfo.cs" /> | ||
77 | <Compile Include="CAPS\SimHttp.cs" /> | ||
78 | </ItemGroup> | ||
79 | <ItemGroup> | ||
80 | <ProjectReference Include="GridInterfaces\GridInterfaces.csproj"> | ||
81 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
82 | <Name>GridInterfaces</Name> | ||
83 | </ProjectReference> | ||
84 | <ProjectReference Include="LocalServers\LocalGridServers\LocalGridServers.csproj"> | ||
85 | <Project>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</Project> | ||
86 | <Name>LocalGridServers</Name> | ||
87 | </ProjectReference> | ||
88 | <ProjectReference Include="LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj"> | ||
89 | <Project>{74784F23-B0FD-484C-82C1-96C0215733DC}</Project> | ||
90 | <Name>Db4LocalStorage</Name> | ||
91 | </ProjectReference> | ||
92 | <ProjectReference Include="OpenSim.Framework\OpenSim.Framework.csproj"> | ||
93 | <Project>{407CE85B-628C-4788-9DBC-49BCEFC3A84F}</Project> | ||
94 | <Name>OpenSim.Framework</Name> | ||
95 | </ProjectReference> | ||
96 | <ProjectReference Include="physics\PhysicsManager.csproj"> | ||
97 | <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> | ||
98 | <Name>PhysicsManager</Name> | ||
99 | </ProjectReference> | ||
100 | <ProjectReference Include="RemoteServers\RemoteGridServers\RemoteGridServers.csproj"> | ||
101 | <Project>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</Project> | ||
102 | <Name>RemoteGridServers</Name> | ||
103 | </ProjectReference> | ||
104 | <ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
105 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
106 | <Name>ServerConsole</Name> | ||
107 | </ProjectReference> | ||
108 | </ItemGroup> | ||
109 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
110 | </Project> \ No newline at end of file | ||
diff --git a/src/ServerConsole/ServerConsole/AssemblyInfo.cs b/src/ServerConsole/ServerConsole/AssemblyInfo.cs deleted file mode 100644 index e6b64d6..0000000 --- a/src/ServerConsole/ServerConsole/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-serverconsole")] | ||
19 | [assembly: AssemblyDescriptionAttribute("The default server console")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/ServerConsole/ServerConsole/ServerConsole.cs b/src/ServerConsole/ServerConsole/ServerConsole.cs deleted file mode 100644 index 27d97e5..0000000 --- a/src/ServerConsole/ServerConsole/ServerConsole.cs +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | |||
29 | namespace ServerConsole | ||
30 | { | ||
31 | public class MainConsole { | ||
32 | |||
33 | private static ConsoleBase instance; | ||
34 | |||
35 | public static ConsoleBase Instance | ||
36 | { | ||
37 | get | ||
38 | { | ||
39 | return instance; | ||
40 | } | ||
41 | set | ||
42 | { | ||
43 | instance = value; | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | public abstract class ConsoleBase | ||
49 | { | ||
50 | |||
51 | public enum ConsoleType { | ||
52 | Local, // Use stdio | ||
53 | TCP, // Use TCP/telnet | ||
54 | SimChat // Use in-world chat (for gods) | ||
55 | } | ||
56 | |||
57 | public abstract void Close(); | ||
58 | |||
59 | public abstract void Write(string format, params object[] args); | ||
60 | |||
61 | public abstract void WriteLine(string format, params object[] args); | ||
62 | |||
63 | public abstract string ReadLine(); | ||
64 | |||
65 | public abstract int Read() ; | ||
66 | |||
67 | // Displays a command prompt and waits for the user to enter a string, then returns that string | ||
68 | public abstract string CmdPrompt(string prompt) ; | ||
69 | |||
70 | // Displays a command prompt and returns a default value if the user simply presses enter | ||
71 | public abstract string CmdPrompt(string prompt, string defaultresponse); | ||
72 | |||
73 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | ||
74 | public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) ; | ||
75 | |||
76 | // Runs a command with a number of parameters | ||
77 | public abstract Object RunCmd(string Cmd, string[] cmdparams) ; | ||
78 | |||
79 | // Shows data about something | ||
80 | public abstract void ShowCommands(string ShowWhat) ; | ||
81 | |||
82 | // Displays a prompt to the user and then runs the command they entered | ||
83 | public abstract void MainConsolePrompt() ; | ||
84 | |||
85 | public abstract void SetStatus( string status ); | ||
86 | } | ||
87 | } | ||
diff --git a/src/ServerConsole/ServerConsole/ServerConsole.csproj b/src/ServerConsole/ServerConsole/ServerConsole.csproj deleted file mode 100644 index d1094de..0000000 --- a/src/ServerConsole/ServerConsole/ServerConsole.csproj +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>ServerConsole</RootNamespace> | ||
5 | <AssemblyName>ServerConsole</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | </ItemGroup> | ||
30 | <ItemGroup> | ||
31 | <Compile Include="ServerConsole.cs" /> | ||
32 | </ItemGroup> | ||
33 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
34 | </Project> \ No newline at end of file | ||
diff --git a/src/ServerConsole/default.build b/src/ServerConsole/default.build deleted file mode 100644 index 0de930a..0000000 --- a/src/ServerConsole/default.build +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/ServerConsole.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="ServerConsole/AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-serverconsole" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="The default server console" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/ServerConsole.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | </references> | ||
43 | <sources basedir="ServerConsole/"> | ||
44 | <include name="*.cs" /> | ||
45 | </sources> | ||
46 | </csc> | ||
47 | </target> | ||
48 | </project> | ||
diff --git a/src/Util.cs b/src/Util.cs deleted file mode 100644 index 477390e..0000000 --- a/src/Util.cs +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | * Copyright (c) <year>, <copyright holder> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Threading; | ||
33 | using libsecondlife; | ||
34 | using libsecondlife.Packets; | ||
35 | |||
36 | namespace OpenSim | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// </summary> | ||
40 | /// | ||
41 | public class Util | ||
42 | { | ||
43 | public static ulong UIntsToLong(uint X, uint Y) | ||
44 | { | ||
45 | return Helpers.UIntsToLong(X,Y); | ||
46 | } | ||
47 | public Util() | ||
48 | { | ||
49 | |||
50 | } | ||
51 | } | ||
52 | |||
53 | public class QueItem { | ||
54 | public QueItem() | ||
55 | { | ||
56 | } | ||
57 | |||
58 | public Packet Packet; | ||
59 | public bool Incoming; | ||
60 | } | ||
61 | |||
62 | /* this is in IGridServer.cs, so there should be no reason for it to be here as well | ||
63 | public class agentcircuitdata | ||
64 | { | ||
65 | public agentcircuitdata() { } | ||
66 | public LLUUID AgentID; | ||
67 | public LLUUID SessionID; | ||
68 | public LLUUID SecureSessionID; | ||
69 | public string firstname; | ||
70 | public string lastname; | ||
71 | public uint circuitcode; | ||
72 | } | ||
73 | */ | ||
74 | |||
75 | public class BlockingQueue< T > { | ||
76 | private Queue< T > _queue = new Queue< T >(); | ||
77 | private object _queueSync = new object(); | ||
78 | |||
79 | public void Enqueue(T value) | ||
80 | { | ||
81 | lock(_queueSync) | ||
82 | { | ||
83 | _queue.Enqueue(value); | ||
84 | Monitor.Pulse(_queueSync); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | public T Dequeue() | ||
89 | { | ||
90 | lock(_queueSync) | ||
91 | { | ||
92 | if( _queue.Count < 1) | ||
93 | Monitor.Wait(_queueSync); | ||
94 | |||
95 | return _queue.Dequeue(); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | } | ||
diff --git a/src/VersionInfo.cs b/src/VersionInfo.cs deleted file mode 100644 index 5cfd136..0000000 --- a/src/VersionInfo.cs +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | |||
29 | namespace OpenSim | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public static string Version = "0.1, Build 1174381410, Revision 240M"; | ||
36 | } | ||
37 | } | ||
diff --git a/src/VersionInfo.cs.template b/src/VersionInfo.cs.template deleted file mode 100644 index e4e1b95..0000000 --- a/src/VersionInfo.cs.template +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | |||
29 | namespace OpenSim | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public static string Version = "@@VERSION"; | ||
36 | } | ||
37 | } | ||
diff --git a/src/opensim.sln b/src/opensim.sln deleted file mode 100644 index c4be551..0000000 --- a/src/opensim.sln +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 |  | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # Visual Studio 2005 | ||
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" | ||
5 | EndProject | ||
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces\GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}" | ||
7 | EndProject | ||
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" | ||
9 | EndProject | ||
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}" | ||
11 | EndProject | ||
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalServers\LocalGridServers\LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" | ||
13 | EndProject | ||
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteServers\RemoteGridServers\RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}" | ||
15 | EndProject | ||
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "Config\SimConfig\SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}" | ||
17 | EndProject | ||
18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}" | ||
19 | EndProject | ||
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicPhysicsplugin", "physics\plugins\BasicPhysicsplugin.csproj", "{52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}" | ||
21 | EndProject | ||
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealPhysXplugin", "physics\RealPhysX\RealPhysXplugin\RealPhysXplugin.csproj", "{56C1D214-F389-4228-921A-0A3A0712C159}" | ||
23 | EndProject | ||
24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "OpenSim.Framework\OpenSim.Framework.csproj", "{407CE85B-628C-4788-9DBC-49BCEFC3A84F}" | ||
25 | EndProject | ||
26 | Global | ||
27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
28 | Debug|Any CPU = Debug|Any CPU | ||
29 | Release|Any CPU = Release|Any CPU | ||
30 | EndGlobalSection | ||
31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
32 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
33 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
34 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
35 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
36 | {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
37 | {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
38 | {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
39 | {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
40 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
41 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
42 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
43 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
44 | {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
45 | {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
46 | {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
47 | {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU | ||
48 | {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
49 | {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
50 | {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
51 | {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.Build.0 = Release|Any CPU | ||
52 | {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
53 | {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
54 | {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
55 | {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
56 | {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
57 | {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
58 | {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
59 | {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
60 | {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
61 | {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
62 | {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
63 | {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
64 | {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
65 | {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
66 | {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
67 | {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
68 | {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
69 | {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
70 | {56C1D214-F389-4228-921A-0A3A0712C159}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
71 | {56C1D214-F389-4228-921A-0A3A0712C159}.Release|Any CPU.Build.0 = Release|Any CPU | ||
72 | {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
73 | {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
74 | {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
75 | {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
76 | EndGlobalSection | ||
77 | GlobalSection(SolutionProperties) = preSolution | ||
78 | HideSolutionNode = FALSE | ||
79 | EndGlobalSection | ||
80 | EndGlobal | ||
diff --git a/src/physics/AssemblyInfo.cs b/src/physics/AssemblyInfo.cs deleted file mode 100644 index c6a4efa..0000000 --- a/src/physics/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-physicsmanager")] | ||
19 | [assembly: AssemblyDescriptionAttribute("Handles physics plugins")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs deleted file mode 100644 index 1fee628..0000000 --- a/src/physics/PhysicsManager.cs +++ /dev/null | |||
@@ -1,285 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | |||
33 | namespace PhysicsSystem | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Description of MyClass. | ||
37 | /// </summary> | ||
38 | public class PhysicsManager | ||
39 | { | ||
40 | private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); | ||
41 | |||
42 | public PhysicsManager() | ||
43 | { | ||
44 | |||
45 | } | ||
46 | |||
47 | public PhysicsScene GetPhysicsScene(string engineName) | ||
48 | { | ||
49 | if( String.IsNullOrEmpty( engineName ) ) | ||
50 | { | ||
51 | return new NullPhysicsScene(); | ||
52 | } | ||
53 | |||
54 | if(_plugins.ContainsKey(engineName)) | ||
55 | { | ||
56 | ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); | ||
57 | return _plugins[engineName].GetScene(); | ||
58 | } | ||
59 | else | ||
60 | { | ||
61 | string error = String.Format("couldn't find physicsEngine: {0}", engineName); | ||
62 | ServerConsole.MainConsole.Instance.WriteLine( error ); | ||
63 | throw new ArgumentException( error ); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | public void LoadPlugins() | ||
68 | { | ||
69 | string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); | ||
70 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | ||
71 | |||
72 | |||
73 | for(int i= 0; i<pluginFiles.Length; i++) | ||
74 | { | ||
75 | this.AddPlugin(pluginFiles[i]); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | private void AddPlugin(string FileName) | ||
80 | { | ||
81 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
82 | |||
83 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
84 | { | ||
85 | if (pluginType.IsPublic) | ||
86 | { | ||
87 | if (!pluginType.IsAbstract) | ||
88 | { | ||
89 | Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | ||
90 | |||
91 | if (typeInterface != null) | ||
92 | { | ||
93 | IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
94 | plug.Init(); | ||
95 | this._plugins.Add(plug.GetName(),plug); | ||
96 | |||
97 | } | ||
98 | |||
99 | typeInterface = null; | ||
100 | } | ||
101 | } | ||
102 | } | ||
103 | |||
104 | pluginAssembly = null; | ||
105 | } | ||
106 | } | ||
107 | public interface IPhysicsPlugin | ||
108 | { | ||
109 | bool Init(); | ||
110 | PhysicsScene GetScene(); | ||
111 | string GetName(); | ||
112 | void Dispose(); | ||
113 | } | ||
114 | |||
115 | public abstract class PhysicsScene | ||
116 | { | ||
117 | public static PhysicsScene Null | ||
118 | { | ||
119 | get | ||
120 | { | ||
121 | return new NullPhysicsScene(); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public abstract PhysicsActor AddAvatar(PhysicsVector position); | ||
126 | |||
127 | public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); | ||
128 | |||
129 | public abstract void Simulate(float timeStep); | ||
130 | |||
131 | public abstract void GetResults(); | ||
132 | |||
133 | public abstract void SetTerrain(float[] heightMap); | ||
134 | |||
135 | public abstract bool IsThreaded | ||
136 | { | ||
137 | get; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | public class NullPhysicsScene : PhysicsScene | ||
142 | { | ||
143 | private static int m_workIndicator; | ||
144 | |||
145 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
146 | { | ||
147 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position ); | ||
148 | return PhysicsActor.Null; | ||
149 | } | ||
150 | |||
151 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
152 | { | ||
153 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size ); | ||
154 | return PhysicsActor.Null; | ||
155 | } | ||
156 | |||
157 | public override void Simulate(float timeStep) | ||
158 | { | ||
159 | m_workIndicator = ( m_workIndicator + 1 ) % 10; | ||
160 | |||
161 | ServerConsole.MainConsole.Instance.SetStatus( m_workIndicator.ToString() ); | ||
162 | } | ||
163 | |||
164 | public override void GetResults() | ||
165 | { | ||
166 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()" ); | ||
167 | } | ||
168 | |||
169 | public override void SetTerrain(float[] heightMap) | ||
170 | { | ||
171 | ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length ); | ||
172 | } | ||
173 | |||
174 | public override bool IsThreaded | ||
175 | { | ||
176 | get { return false; } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | public abstract class PhysicsActor | ||
181 | { | ||
182 | public static readonly PhysicsActor Null = new NullPhysicsActor(); | ||
183 | |||
184 | public abstract PhysicsVector Position | ||
185 | { | ||
186 | get; | ||
187 | set; | ||
188 | } | ||
189 | |||
190 | public abstract PhysicsVector Velocity | ||
191 | { | ||
192 | get; | ||
193 | set; | ||
194 | } | ||
195 | |||
196 | public abstract PhysicsVector Acceleration | ||
197 | { | ||
198 | get; | ||
199 | } | ||
200 | public abstract bool Flying | ||
201 | { | ||
202 | get; | ||
203 | set; | ||
204 | } | ||
205 | |||
206 | public abstract void AddForce(PhysicsVector force); | ||
207 | |||
208 | public abstract void SetMomentum(PhysicsVector momentum); | ||
209 | } | ||
210 | |||
211 | public class NullPhysicsActor : PhysicsActor | ||
212 | { | ||
213 | public override PhysicsVector Position | ||
214 | { | ||
215 | get | ||
216 | { | ||
217 | return PhysicsVector.Zero; | ||
218 | } | ||
219 | set | ||
220 | { | ||
221 | return; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | public override PhysicsVector Velocity | ||
226 | { | ||
227 | get | ||
228 | { | ||
229 | return PhysicsVector.Zero; | ||
230 | } | ||
231 | set | ||
232 | { | ||
233 | return; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | public override PhysicsVector Acceleration | ||
238 | { | ||
239 | get { return PhysicsVector.Zero; } | ||
240 | } | ||
241 | |||
242 | public override bool Flying | ||
243 | { | ||
244 | get | ||
245 | { | ||
246 | return false; | ||
247 | } | ||
248 | set | ||
249 | { | ||
250 | return; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | public override void AddForce(PhysicsVector force) | ||
255 | { | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | public override void SetMomentum(PhysicsVector momentum) | ||
260 | { | ||
261 | return; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | public class PhysicsVector | ||
266 | { | ||
267 | public float X; | ||
268 | public float Y; | ||
269 | public float Z; | ||
270 | |||
271 | public PhysicsVector() | ||
272 | { | ||
273 | |||
274 | } | ||
275 | |||
276 | public PhysicsVector(float x, float y, float z) | ||
277 | { | ||
278 | X = x; | ||
279 | Y = y; | ||
280 | Z = z; | ||
281 | } | ||
282 | |||
283 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | ||
284 | } | ||
285 | } | ||
diff --git a/src/physics/PhysicsManager.csproj b/src/physics/PhysicsManager.csproj deleted file mode 100644 index 3eadfe7..0000000 --- a/src/physics/PhysicsManager.csproj +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>PhysicsManager</RootNamespace> | ||
5 | <AssemblyName>PhysicsManager</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | </ItemGroup> | ||
30 | <ItemGroup> | ||
31 | <Compile Include="PhysicsManager.cs" /> | ||
32 | </ItemGroup> | ||
33 | <ItemGroup> | ||
34 | <ProjectReference Include="..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
35 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
36 | <Name>ServerConsole</Name> | ||
37 | </ProjectReference> | ||
38 | </ItemGroup> | ||
39 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
40 | </Project> \ No newline at end of file | ||
diff --git a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs b/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs deleted file mode 100644 index 913aae7..0000000 --- a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // Information about this assembly is defined by the following | ||
6 | // attributes. | ||
7 | // | ||
8 | // change them to the information which is associated with the assembly | ||
9 | // you compile. | ||
10 | |||
11 | [assembly: AssemblyTitle("RealPhysXplugin")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("RealPhysXplugin")] | ||
16 | [assembly: AssemblyCopyright("")] | ||
17 | [assembly: AssemblyTrademark("")] | ||
18 | [assembly: AssemblyCulture("")] | ||
19 | |||
20 | // This sets the default COM visibility of types in the assembly to invisible. | ||
21 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
22 | [assembly: ComVisible(false)] | ||
23 | |||
24 | // The assembly version has following format : | ||
25 | // | ||
26 | // Major.Minor.Build.Revision | ||
27 | // | ||
28 | // You can specify all values by your own or you can build default build and revision | ||
29 | // numbers with the '*' character (the default): | ||
30 | |||
31 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs b/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs deleted file mode 100644 index 9576a40..0000000 --- a/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs +++ /dev/null | |||
@@ -1,361 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | /* | ||
28 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
29 | * | ||
30 | * Redistribution and use in source and binary forms, with or without | ||
31 | * modification, are permitted provided that the following conditions are met: | ||
32 | * * Redistributions of source code must retain the above copyright | ||
33 | * notice, this list of conditions and the following disclaimer. | ||
34 | * * Redistributions in binary form must reproduce the above copyright | ||
35 | * notice, this list of conditions and the following disclaimer in the | ||
36 | * documentation and/or other materials provided with the distribution. | ||
37 | * * Neither the name of the <organization> nor the | ||
38 | * names of its contributors may be used to endorse or promote products | ||
39 | * derived from this software without specific prior written permission. | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
42 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
43 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
44 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
45 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
46 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
48 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
49 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
50 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * | ||
52 | */ | ||
53 | using System; | ||
54 | using System.Collections.Generic; | ||
55 | using PhysicsSystem; | ||
56 | using PhysXWrapper; | ||
57 | |||
58 | namespace PhysXplugin | ||
59 | { | ||
60 | /// <summary> | ||
61 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
62 | /// </summary> | ||
63 | public class PhysXPlugin : IPhysicsPlugin | ||
64 | { | ||
65 | private PhysXScene _mScene; | ||
66 | |||
67 | public PhysXPlugin() | ||
68 | { | ||
69 | |||
70 | } | ||
71 | |||
72 | public bool Init() | ||
73 | { | ||
74 | return true; | ||
75 | } | ||
76 | |||
77 | public PhysicsScene GetScene() | ||
78 | { | ||
79 | if(_mScene == null) | ||
80 | { | ||
81 | _mScene = new PhysXScene(); | ||
82 | } | ||
83 | return(_mScene); | ||
84 | } | ||
85 | |||
86 | public string GetName() | ||
87 | { | ||
88 | return("RealPhysX"); | ||
89 | } | ||
90 | |||
91 | public void Dispose() | ||
92 | { | ||
93 | |||
94 | } | ||
95 | } | ||
96 | |||
97 | public class PhysXScene :PhysicsScene | ||
98 | { | ||
99 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); | ||
100 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); | ||
101 | private float[] _heightMap; | ||
102 | private NxPhysicsSDK mySdk; | ||
103 | private NxScene scene; | ||
104 | |||
105 | public PhysXScene() | ||
106 | { | ||
107 | mySdk = NxPhysicsSDK.CreateSDK(); | ||
108 | scene = mySdk.CreateScene(); | ||
109 | |||
110 | } | ||
111 | |||
112 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
113 | { | ||
114 | Vec3 pos = new Vec3(); | ||
115 | pos.X = position.X; | ||
116 | pos.Y = position.Y; | ||
117 | pos.Z = position.Z; | ||
118 | PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); | ||
119 | act.Position = position; | ||
120 | _characters.Add(act); | ||
121 | return act; | ||
122 | } | ||
123 | |||
124 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
125 | { | ||
126 | Vec3 pos = new Vec3(); | ||
127 | pos.X = position.X; | ||
128 | pos.Y = position.Y; | ||
129 | pos.Z = position.Z; | ||
130 | Vec3 siz = new Vec3(); | ||
131 | siz.X = size.X; | ||
132 | siz.Y = size.Y; | ||
133 | siz.Z = size.Z; | ||
134 | PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); | ||
135 | _prims.Add(act); | ||
136 | return act; | ||
137 | } | ||
138 | public override void Simulate(float timeStep) | ||
139 | { | ||
140 | foreach (PhysXCharacter actor in _characters) | ||
141 | { | ||
142 | actor.Move(timeStep); | ||
143 | } | ||
144 | scene.Simulate(timeStep); | ||
145 | scene.FetchResults(); | ||
146 | scene.UpdateControllers(); | ||
147 | |||
148 | foreach (PhysXCharacter actor in _characters) | ||
149 | { | ||
150 | actor.UpdatePosition(); | ||
151 | } | ||
152 | |||
153 | } | ||
154 | |||
155 | public override void GetResults() | ||
156 | { | ||
157 | |||
158 | } | ||
159 | |||
160 | public override bool IsThreaded | ||
161 | { | ||
162 | get | ||
163 | { | ||
164 | return(false); // for now we won't be multithreaded | ||
165 | } | ||
166 | } | ||
167 | |||
168 | public override void SetTerrain(float[] heightMap) | ||
169 | { | ||
170 | this._heightMap = heightMap; | ||
171 | this.scene.AddTerrain(heightMap); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | public class PhysXCharacter : PhysicsActor | ||
176 | { | ||
177 | private PhysicsVector _position; | ||
178 | private PhysicsVector _velocity; | ||
179 | private PhysicsVector _acceleration; | ||
180 | private NxCharacter _character; | ||
181 | private bool flying; | ||
182 | |||
183 | public PhysXCharacter(NxCharacter character) | ||
184 | { | ||
185 | _velocity = new PhysicsVector(); | ||
186 | _position = new PhysicsVector(); | ||
187 | _acceleration = new PhysicsVector(); | ||
188 | _character = character; | ||
189 | } | ||
190 | |||
191 | public override bool Flying | ||
192 | { | ||
193 | get | ||
194 | { | ||
195 | return flying; | ||
196 | } | ||
197 | set | ||
198 | { | ||
199 | flying = value; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | public override PhysicsVector Position | ||
204 | { | ||
205 | get | ||
206 | { | ||
207 | return _position; | ||
208 | } | ||
209 | set | ||
210 | { | ||
211 | _position = value; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public override PhysicsVector Velocity | ||
216 | { | ||
217 | get | ||
218 | { | ||
219 | return _velocity; | ||
220 | } | ||
221 | set | ||
222 | { | ||
223 | _velocity = value; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | public override PhysicsVector Acceleration | ||
228 | { | ||
229 | get | ||
230 | { | ||
231 | return _acceleration; | ||
232 | } | ||
233 | |||
234 | } | ||
235 | public void SetAcceleration (PhysicsVector accel) | ||
236 | { | ||
237 | this._acceleration = accel; | ||
238 | } | ||
239 | |||
240 | public override void AddForce(PhysicsVector force) | ||
241 | { | ||
242 | |||
243 | } | ||
244 | |||
245 | public override void SetMomentum(PhysicsVector momentum) | ||
246 | { | ||
247 | |||
248 | } | ||
249 | |||
250 | public void Move(float timeStep) | ||
251 | { | ||
252 | Vec3 vec = new Vec3(); | ||
253 | vec.X = this._velocity.X * timeStep; | ||
254 | vec.Y = this._velocity.Y * timeStep; | ||
255 | if(flying) | ||
256 | { | ||
257 | vec.Z = ( this._velocity.Z) * timeStep; | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | vec.Z = (-9.8f + this._velocity.Z) * timeStep; | ||
262 | } | ||
263 | this._character.Move(vec); | ||
264 | } | ||
265 | |||
266 | public void UpdatePosition() | ||
267 | { | ||
268 | Vec3 vec = this._character.Position; | ||
269 | this._position.X = vec.X; | ||
270 | this._position.Y = vec.Y; | ||
271 | this._position.Z = vec.Z; | ||
272 | } | ||
273 | } | ||
274 | |||
275 | public class PhysXPrim : PhysicsActor | ||
276 | { | ||
277 | private PhysicsVector _position; | ||
278 | private PhysicsVector _velocity; | ||
279 | private PhysicsVector _acceleration; | ||
280 | private NxActor _prim; | ||
281 | |||
282 | public PhysXPrim(NxActor prim) | ||
283 | { | ||
284 | _velocity = new PhysicsVector(); | ||
285 | _position = new PhysicsVector(); | ||
286 | _acceleration = new PhysicsVector(); | ||
287 | _prim = prim; | ||
288 | } | ||
289 | public override bool Flying | ||
290 | { | ||
291 | get | ||
292 | { | ||
293 | return false; //no flying prims for you | ||
294 | } | ||
295 | set | ||
296 | { | ||
297 | |||
298 | } | ||
299 | } | ||
300 | public override PhysicsVector Position | ||
301 | { | ||
302 | get | ||
303 | { | ||
304 | PhysicsVector pos = new PhysicsVector(); | ||
305 | Vec3 vec = this._prim.Position; | ||
306 | pos.X = vec.X; | ||
307 | pos.Y = vec.Y; | ||
308 | pos.Z = vec.Z; | ||
309 | return pos; | ||
310 | |||
311 | } | ||
312 | set | ||
313 | { | ||
314 | PhysicsVector vec = value; | ||
315 | Vec3 pos = new Vec3(); | ||
316 | pos.X = vec.X; | ||
317 | pos.Y = vec.Y; | ||
318 | pos.Z = vec.Z; | ||
319 | this._prim.Position = pos; | ||
320 | } | ||
321 | } | ||
322 | |||
323 | public override PhysicsVector Velocity | ||
324 | { | ||
325 | get | ||
326 | { | ||
327 | return _velocity; | ||
328 | } | ||
329 | set | ||
330 | { | ||
331 | _velocity = value; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | public override PhysicsVector Acceleration | ||
336 | { | ||
337 | get | ||
338 | { | ||
339 | return _acceleration; | ||
340 | } | ||
341 | |||
342 | } | ||
343 | public void SetAcceleration (PhysicsVector accel) | ||
344 | { | ||
345 | this._acceleration = accel; | ||
346 | } | ||
347 | |||
348 | public override void AddForce(PhysicsVector force) | ||
349 | { | ||
350 | |||
351 | } | ||
352 | |||
353 | public override void SetMomentum(PhysicsVector momentum) | ||
354 | { | ||
355 | |||
356 | } | ||
357 | |||
358 | |||
359 | } | ||
360 | |||
361 | } | ||
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj deleted file mode 100644 index 554df5e..0000000 --- a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>RealPhysXplugin</RootNamespace> | ||
5 | <AssemblyName>RealPhysXplugin</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{56C1D214-F389-4228-921A-0A3A0712C159}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>..\..\..\..\bin\Physics\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>..\..\..\..\bin\Physics\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="PhysX_Wrapper_Dotnet"> | ||
30 | <HintPath>..\..\..\..\bin\PhysX_Wrapper_Dotnet.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | <Private>False</Private> | ||
33 | </Reference> | ||
34 | </ItemGroup> | ||
35 | <ItemGroup> | ||
36 | <Compile Include="RealPhysX.cs" /> | ||
37 | </ItemGroup> | ||
38 | <ItemGroup> | ||
39 | <ProjectReference Include="..\..\PhysicsManager.csproj"> | ||
40 | <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> | ||
41 | <Name>PhysicsManager</Name> | ||
42 | <Private>False</Private> | ||
43 | </ProjectReference> | ||
44 | </ItemGroup> | ||
45 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
46 | </Project> \ No newline at end of file | ||
diff --git a/src/physics/default.build b/src/physics/default.build deleted file mode 100644 index 01d2415..0000000 --- a/src/physics/default.build +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/PhysicsManager.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-physicsmanager" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="Handles physics plugins" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/PhysicsManager.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System.dll" /> | ||
41 | <include name="System.Xml.dll" /> | ||
42 | <include name="ServerConsole.dll" /> | ||
43 | </references> | ||
44 | <sources basedir="./"> | ||
45 | <include name="*.cs" /> | ||
46 | </sources> | ||
47 | </csc> | ||
48 | </target> | ||
49 | </project> | ||
diff --git a/src/physics/plugins/AssemblyInfo.cs b/src/physics/plugins/AssemblyInfo.cs deleted file mode 100644 index 4cd5558..0000000 --- a/src/physics/plugins/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")] | ||
19 | [assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/physics/plugins/BasicPhysicsplugin.csproj b/src/physics/plugins/BasicPhysicsplugin.csproj deleted file mode 100644 index b3f47d3..0000000 --- a/src/physics/plugins/BasicPhysicsplugin.csproj +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}</ProjectGuid> | ||
8 | <OutputType>Library</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>BasicPhysicsplugin</RootNamespace> | ||
11 | <AssemblyName>BasicPhysicsplugin</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>..\..\..\bin\Physics\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="Axiom.MathLib, Version=0.7.0.25497, Culture=neutral"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | ||
34 | <Private>False</Private> | ||
35 | </Reference> | ||
36 | <Reference Include="System" /> | ||
37 | <Reference Include="System.Data" /> | ||
38 | <Reference Include="System.Xml" /> | ||
39 | </ItemGroup> | ||
40 | <ItemGroup> | ||
41 | <Compile Include="PhysXplugin.cs" /> | ||
42 | </ItemGroup> | ||
43 | <ItemGroup> | ||
44 | <ProjectReference Include="..\PhysicsManager.csproj"> | ||
45 | <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> | ||
46 | <Name>PhysicsManager</Name> | ||
47 | <Private>False</Private> | ||
48 | </ProjectReference> | ||
49 | </ItemGroup> | ||
50 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
51 | </Project> \ No newline at end of file | ||
diff --git a/src/physics/plugins/PhysXplugin.cs b/src/physics/plugins/PhysXplugin.cs deleted file mode 100644 index 8c09dc8..0000000 --- a/src/physics/plugins/PhysXplugin.cs +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using PhysicsSystem; | ||
30 | |||
31 | namespace PhysXplugin | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
35 | /// </summary> | ||
36 | public class PhysXPlugin : IPhysicsPlugin | ||
37 | { | ||
38 | private PhysXScene _mScene; | ||
39 | |||
40 | public PhysXPlugin() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | |||
45 | public bool Init() | ||
46 | { | ||
47 | return true; | ||
48 | } | ||
49 | |||
50 | public PhysicsScene GetScene() | ||
51 | { | ||
52 | if(_mScene == null) | ||
53 | { | ||
54 | _mScene = new PhysXScene(); | ||
55 | } | ||
56 | return(_mScene); | ||
57 | } | ||
58 | |||
59 | public string GetName() | ||
60 | { | ||
61 | return("PhysX"); | ||
62 | } | ||
63 | |||
64 | public void Dispose() | ||
65 | { | ||
66 | |||
67 | } | ||
68 | } | ||
69 | |||
70 | public class PhysXScene :PhysicsScene | ||
71 | { | ||
72 | private List<PhysXActor> _actors = new List<PhysXActor>(); | ||
73 | private float[] _heightMap; | ||
74 | |||
75 | public PhysXScene() | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
81 | { | ||
82 | PhysXActor act = new PhysXActor(); | ||
83 | act.Position = position; | ||
84 | _actors.Add(act); | ||
85 | return act; | ||
86 | } | ||
87 | |||
88 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) | ||
89 | { | ||
90 | return null; | ||
91 | } | ||
92 | |||
93 | public override void Simulate(float timeStep) | ||
94 | { | ||
95 | foreach (PhysXActor actor in _actors) | ||
96 | { | ||
97 | actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); | ||
98 | actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); | ||
99 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | ||
100 | /*if(actor.Flying) | ||
101 | { | ||
102 | actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); | ||
107 | } | ||
108 | if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) | ||
109 | {*/ | ||
110 | actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; | ||
111 | //} | ||
112 | if(actor.Position.X<0) | ||
113 | { | ||
114 | actor.Position.X = 0; | ||
115 | actor.Velocity.X = 0; | ||
116 | } | ||
117 | if(actor.Position.Y < 0) | ||
118 | { | ||
119 | actor.Position.Y = 0; | ||
120 | actor.Velocity.Y = 0; | ||
121 | } | ||
122 | if(actor.Position.X > 255) | ||
123 | { | ||
124 | actor.Position.X = 255; | ||
125 | actor.Velocity.X = 0; | ||
126 | } | ||
127 | if(actor.Position.Y > 255) | ||
128 | { | ||
129 | actor.Position.Y = 255; | ||
130 | actor.Velocity.X = 0; | ||
131 | } | ||
132 | } | ||
133 | } | ||
134 | |||
135 | public override void GetResults() | ||
136 | { | ||
137 | |||
138 | } | ||
139 | |||
140 | public override bool IsThreaded | ||
141 | { | ||
142 | get | ||
143 | { | ||
144 | return(false); // for now we won't be multithreaded | ||
145 | } | ||
146 | } | ||
147 | |||
148 | public override void SetTerrain(float[] heightMap) | ||
149 | { | ||
150 | this._heightMap = heightMap; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | public class PhysXActor : PhysicsActor | ||
155 | { | ||
156 | private PhysicsVector _position; | ||
157 | private PhysicsVector _velocity; | ||
158 | private PhysicsVector _acceleration; | ||
159 | private bool flying; | ||
160 | public PhysXActor() | ||
161 | { | ||
162 | _velocity = new PhysicsVector(); | ||
163 | _position = new PhysicsVector(); | ||
164 | _acceleration = new PhysicsVector(); | ||
165 | } | ||
166 | |||
167 | public override bool Flying | ||
168 | { | ||
169 | get | ||
170 | { | ||
171 | return false; | ||
172 | } | ||
173 | set | ||
174 | { | ||
175 | flying= value; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | public override PhysicsVector Position | ||
180 | { | ||
181 | get | ||
182 | { | ||
183 | return _position; | ||
184 | } | ||
185 | set | ||
186 | { | ||
187 | _position = value; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | public override PhysicsVector Velocity | ||
192 | { | ||
193 | get | ||
194 | { | ||
195 | return _velocity; | ||
196 | } | ||
197 | set | ||
198 | { | ||
199 | _velocity = value; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | public override PhysicsVector Acceleration | ||
204 | { | ||
205 | get | ||
206 | { | ||
207 | return _acceleration; | ||
208 | } | ||
209 | |||
210 | } | ||
211 | public void SetAcceleration (PhysicsVector accel) | ||
212 | { | ||
213 | this._acceleration = accel; | ||
214 | } | ||
215 | |||
216 | public override void AddForce(PhysicsVector force) | ||
217 | { | ||
218 | |||
219 | } | ||
220 | |||
221 | public override void SetMomentum(PhysicsVector momentum) | ||
222 | { | ||
223 | |||
224 | } | ||
225 | } | ||
226 | |||
227 | } | ||
diff --git a/src/physics/plugins/default.build b/src/physics/plugins/default.build deleted file mode 100644 index 66056a5..0000000 --- a/src/physics/plugins/default.build +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../../bin/Physics/PhysXplugin.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-physicsmanager-physx" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="PhysX plugin for OpenSim" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <mkdir dir="../../../bin/Physics"/> | ||
39 | |||
40 | <csc target="library" output="../../../bin/Physics/PhysXplugin.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
41 | <references basedir="../../../bin" failonempty="true"> | ||
42 | <include name="System.dll" /> | ||
43 | <include name="System.Xml.dll" /> | ||
44 | <include name="PhysicsManager.dll" /> | ||
45 | </references> | ||
46 | <sources basedir="./"> | ||
47 | <include name="*.cs" /> | ||
48 | </sources> | ||
49 | </csc> | ||
50 | </target> | ||
51 | </project> | ||
diff --git a/src/types/Mesh.cs b/src/types/Mesh.cs deleted file mode 100644 index 3e00c91..0000000 --- a/src/types/Mesh.cs +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.types | ||
6 | { | ||
7 | // TODO: This will need some performance tuning no doubt. | ||
8 | public class Mesh | ||
9 | { | ||
10 | public List<Triangle> mesh; | ||
11 | |||
12 | public Mesh() | ||
13 | { | ||
14 | mesh = new List<Triangle>(); | ||
15 | } | ||
16 | |||
17 | public void AddTri(Triangle tri) | ||
18 | { | ||
19 | mesh.Add(tri); | ||
20 | } | ||
21 | |||
22 | public static Mesh operator +(Mesh a, Mesh b) | ||
23 | { | ||
24 | a.mesh.AddRange(b.mesh); | ||
25 | return a; | ||
26 | } | ||
27 | } | ||
28 | } | ||
diff --git a/src/types/Triangle.cs b/src/types/Triangle.cs deleted file mode 100644 index 8dfea6e..0000000 --- a/src/types/Triangle.cs +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Axiom.MathLib; | ||
5 | |||
6 | namespace OpenSim.types | ||
7 | { | ||
8 | public class Triangle | ||
9 | { | ||
10 | Vector3 a; | ||
11 | Vector3 b; | ||
12 | Vector3 c; | ||
13 | |||
14 | public Triangle() | ||
15 | { | ||
16 | a = new Vector3(); | ||
17 | b = new Vector3(); | ||
18 | c = new Vector3(); | ||
19 | } | ||
20 | |||
21 | public Triangle(Vector3 A, Vector3 B, Vector3 C) | ||
22 | { | ||
23 | a = A; | ||
24 | b = B; | ||
25 | c = C; | ||
26 | } | ||
27 | } | ||
28 | } | ||
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs deleted file mode 100644 index facfeee..0000000 --- a/src/world/Avatar.cs +++ /dev/null | |||
@@ -1,487 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.IO; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using PhysicsSystem; | ||
8 | using Axiom.MathLib; | ||
9 | |||
10 | namespace OpenSim.world | ||
11 | { | ||
12 | public class Avatar : Entity | ||
13 | { | ||
14 | public static bool PhysicsEngineFlying; | ||
15 | public string firstname; | ||
16 | public string lastname; | ||
17 | public OpenSimClient ControllingClient; | ||
18 | private PhysicsActor _physActor; | ||
19 | private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | ||
20 | private bool updateflag; | ||
21 | private byte movementflag; | ||
22 | private List<NewForce> forcesList = new List<NewForce>(); | ||
23 | private short _updateCount; | ||
24 | private Axiom.MathLib.Quaternion bodyRot; | ||
25 | |||
26 | public Avatar(OpenSimClient TheClient) { | ||
27 | ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); | ||
28 | ControllingClient=TheClient; | ||
29 | position = new LLVector3(100.0f,100.0f,30.0f); | ||
30 | position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1; | ||
31 | } | ||
32 | |||
33 | public PhysicsActor PhysActor | ||
34 | { | ||
35 | set | ||
36 | { | ||
37 | this._physActor = value; | ||
38 | } | ||
39 | } | ||
40 | public override void addForces() | ||
41 | { | ||
42 | lock(this.forcesList) | ||
43 | { | ||
44 | if(this.forcesList.Count>0) | ||
45 | { | ||
46 | for(int i=0 ; i < this.forcesList.Count; i++) | ||
47 | { | ||
48 | NewForce force = this.forcesList[i]; | ||
49 | PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); | ||
50 | this._physActor.Velocity = phyVector; | ||
51 | this.updateflag = true; | ||
52 | this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this | ||
53 | // but as we are setting the velocity (rather than using real forces) at the moment it is okay. | ||
54 | } | ||
55 | for(int i=0 ; i < this.forcesList.Count; i++) | ||
56 | { | ||
57 | this.forcesList.RemoveAt(0); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public override void update() | ||
64 | { | ||
65 | |||
66 | if(this.updateflag) | ||
67 | { | ||
68 | //need to send movement info | ||
69 | //so create the improvedterseobjectupdate packet | ||
70 | //use CreateTerseBlock() | ||
71 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
72 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
73 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
74 | terse.RegionData.TimeDilation = 64096; | ||
75 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
76 | terse.ObjectData[0] = terseBlock; | ||
77 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
78 | client.OutPacket(terse); | ||
79 | } | ||
80 | |||
81 | updateflag =false; | ||
82 | //this._updateCount = 0; | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | //if((movementflag & 1) !=0) | ||
87 | //{ | ||
88 | _updateCount++; | ||
89 | if(( (!PhysicsEngineFlying) && (_updateCount>3)) || (_updateCount>0)) | ||
90 | { | ||
91 | //It has been a while since last update was sent so lets send one. | ||
92 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | ||
93 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
94 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
95 | terse.RegionData.TimeDilation = 64096; | ||
96 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
97 | terse.ObjectData[0] = terseBlock; | ||
98 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
99 | client.OutPacket(terse); | ||
100 | } | ||
101 | _updateCount = 0; | ||
102 | } | ||
103 | //} | ||
104 | } | ||
105 | } | ||
106 | |||
107 | public static void SetupTemplate(string name) | ||
108 | { | ||
109 | int i = 0; | ||
110 | FileInfo fInfo = new FileInfo(name); | ||
111 | long numBytes = fInfo.Length; | ||
112 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
113 | BinaryReader br = new BinaryReader(fStream); | ||
114 | byte [] data1 = br.ReadBytes((int)numBytes); | ||
115 | br.Close(); | ||
116 | fStream.Close(); | ||
117 | |||
118 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
119 | |||
120 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
121 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); | ||
122 | pos.X = 100f; | ||
123 | objdata.ID = 8880000; | ||
124 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | ||
125 | libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f); | ||
126 | //objdata.FullID=user.AgentID; | ||
127 | byte[] pb = pos.GetBytes(); | ||
128 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
129 | |||
130 | Avatar.AvatarTemplate = objdata; | ||
131 | } | ||
132 | |||
133 | public void CompleteMovement(World RegionInfo) { | ||
134 | ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); | ||
135 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | ||
136 | mov.AgentData.SessionID = this.ControllingClient.SessionID; | ||
137 | mov.AgentData.AgentID = this.ControllingClient.AgentID; | ||
138 | mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
139 | // TODO - dynamicalise this stuff | ||
140 | mov.Data.Timestamp = 1172750370; | ||
141 | mov.Data.Position = new LLVector3(100f, 100f, 23f); | ||
142 | mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); | ||
143 | |||
144 | ControllingClient.OutPacket(mov); | ||
145 | } | ||
146 | |||
147 | public void SendInitialPosition() { | ||
148 | |||
149 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
150 | //send a objectupdate packet with information about the clients avatar | ||
151 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
152 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
153 | objupdate.RegionData.TimeDilation = 64096; | ||
154 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
155 | |||
156 | objupdate.ObjectData[0] = AvatarTemplate; | ||
157 | //give this avatar object a local id and assign the user a name | ||
158 | objupdate.ObjectData[0].ID = this.localid; | ||
159 | objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
160 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
161 | |||
162 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); | ||
163 | |||
164 | byte[] pb = pos2.GetBytes(); | ||
165 | |||
166 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
167 | OpenSim_Main.local_world._localNumber++; | ||
168 | |||
169 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) | ||
170 | { | ||
171 | client.OutPacket(objupdate); | ||
172 | if(client.AgentID != ControllingClient.AgentID) | ||
173 | { | ||
174 | SendAppearanceToOtherAgent(client); | ||
175 | } | ||
176 | } | ||
177 | //this.ControllingClient.OutPacket(objupdate); | ||
178 | } | ||
179 | |||
180 | public void SendInitialAppearance() { | ||
181 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
182 | aw.AgentData.AgentID = this.ControllingClient.AgentID; | ||
183 | aw.AgentData.SerialNum = 0; | ||
184 | aw.AgentData.SessionID = ControllingClient.SessionID; | ||
185 | |||
186 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
187 | AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
188 | awb.WearableType = (byte)0; | ||
189 | awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
190 | awb.ItemID = LLUUID.Random(); | ||
191 | aw.WearableData[0] = awb; | ||
192 | |||
193 | for(int i=1; i<13; i++) | ||
194 | { | ||
195 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
196 | awb.WearableType = (byte)i; | ||
197 | awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
198 | awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
199 | aw.WearableData[i] = awb; | ||
200 | } | ||
201 | |||
202 | ControllingClient.OutPacket(aw); | ||
203 | } | ||
204 | |||
205 | public ObjectUpdatePacket CreateUpdatePacket() | ||
206 | { | ||
207 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
208 | //send a objectupdate packet with information about the clients avatar | ||
209 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
210 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
211 | objupdate.RegionData.TimeDilation = 64096; | ||
212 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
213 | |||
214 | objupdate.ObjectData[0] = AvatarTemplate; | ||
215 | //give this avatar object a local id and assign the user a name | ||
216 | objupdate.ObjectData[0].ID = this.localid; | ||
217 | objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
218 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
219 | |||
220 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z); | ||
221 | |||
222 | byte[] pb = pos2.GetBytes(); | ||
223 | |||
224 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
225 | return objupdate; | ||
226 | } | ||
227 | |||
228 | public void SendAppearanceToOtherAgent(OpenSimClient userInfo) | ||
229 | { | ||
230 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
231 | |||
232 | |||
233 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
234 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); | ||
235 | |||
236 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); | ||
237 | avp.ObjectData.TextureEntry = ntex.ToBytes(); | ||
238 | |||
239 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
240 | for(int i = 0; i < 218; i++) | ||
241 | { | ||
242 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
243 | avblock.ParamValue = (byte)100; | ||
244 | avp.VisualParam[i] = avblock; | ||
245 | } | ||
246 | |||
247 | avp.Sender.IsTrial = false; | ||
248 | avp.Sender.ID = ControllingClient.AgentID; | ||
249 | userInfo.OutPacket(avp); | ||
250 | |||
251 | } | ||
252 | |||
253 | public void HandleUpdate(AgentUpdatePacket pack) { | ||
254 | if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) !=0) | ||
255 | { | ||
256 | this._physActor.Flying = true; | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | this._physActor.Flying = false; | ||
261 | } | ||
262 | if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { | ||
263 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
264 | if(((movementflag & 1) ==0) || (q!= this.bodyRot)) | ||
265 | { | ||
266 | //we should add a new force to the list | ||
267 | // but for now we will deal with velocities | ||
268 | NewForce newVelocity = new NewForce(); | ||
269 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); | ||
270 | Axiom.MathLib.Vector3 direc = q * v3; | ||
271 | direc.Normalize(); | ||
272 | |||
273 | //work out velocity for sim physics system | ||
274 | direc = direc * ((0.03f) * 128f); | ||
275 | if(this._physActor.Flying) | ||
276 | direc *=2; | ||
277 | |||
278 | newVelocity.X = direc.x; | ||
279 | newVelocity.Y = direc.y; | ||
280 | newVelocity.Z = direc.z; | ||
281 | this.forcesList.Add(newVelocity); | ||
282 | movementflag = 1; | ||
283 | this.bodyRot = q; | ||
284 | } | ||
285 | } | ||
286 | else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) !=0) &&(PhysicsEngineFlying)) { | ||
287 | if(((movementflag & 2) ==0) && this._physActor.Flying) | ||
288 | { | ||
289 | //we should add a new force to the list | ||
290 | // but for now we will deal with velocities | ||
291 | NewForce newVelocity = new NewForce(); | ||
292 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1); | ||
293 | Axiom.MathLib.Vector3 direc = v3; | ||
294 | direc.Normalize(); | ||
295 | |||
296 | //work out velocity for sim physics system | ||
297 | direc = direc * ((0.03f) * 128f *2); | ||
298 | newVelocity.X = direc.x; | ||
299 | newVelocity.Y = direc.y; | ||
300 | newVelocity.Z = direc.z; | ||
301 | this.forcesList.Add(newVelocity); | ||
302 | movementflag = 2; | ||
303 | } | ||
304 | } | ||
305 | else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) !=0) && (PhysicsEngineFlying)) { | ||
306 | if(((movementflag & 4) ==0) && this._physActor.Flying) | ||
307 | { | ||
308 | //we should add a new force to the list | ||
309 | // but for now we will deal with velocities | ||
310 | NewForce newVelocity = new NewForce(); | ||
311 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1); | ||
312 | //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
313 | Axiom.MathLib.Vector3 direc = v3; | ||
314 | direc.Normalize(); | ||
315 | |||
316 | //work out velocity for sim physics system | ||
317 | direc = direc * ((0.03f) * 128f *2); | ||
318 | newVelocity.X = direc.x; | ||
319 | newVelocity.Y = direc.y; | ||
320 | newVelocity.Z = direc.z; | ||
321 | this.forcesList.Add(newVelocity); | ||
322 | movementflag = 4; | ||
323 | } | ||
324 | } | ||
325 | else if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) !=0) { | ||
326 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); | ||
327 | if(((movementflag & 8) ==0) || (q!= this.bodyRot)) | ||
328 | { | ||
329 | //we should add a new force to the list | ||
330 | // but for now we will deal with velocities | ||
331 | NewForce newVelocity = new NewForce(); | ||
332 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); | ||
333 | Axiom.MathLib.Vector3 direc = q * v3; | ||
334 | direc.Normalize(); | ||
335 | |||
336 | //work out velocity for sim physics system | ||
337 | direc = direc * ((0.03f) * 128f); | ||
338 | if(this._physActor.Flying) | ||
339 | direc *=2; | ||
340 | |||
341 | newVelocity.X = direc.x; | ||
342 | newVelocity.Y = direc.y; | ||
343 | newVelocity.Z = direc.z; | ||
344 | this.forcesList.Add(newVelocity); | ||
345 | movementflag = 8; | ||
346 | this.bodyRot = q; | ||
347 | } | ||
348 | } | ||
349 | else | ||
350 | { | ||
351 | if((movementflag) !=0) | ||
352 | { | ||
353 | NewForce newVelocity = new NewForce(); | ||
354 | newVelocity.X = 0; | ||
355 | newVelocity.Y = 0; | ||
356 | newVelocity.Z = 0; | ||
357 | this.forcesList.Add(newVelocity); | ||
358 | movementflag = 0; | ||
359 | } | ||
360 | } | ||
361 | } | ||
362 | |||
363 | //should be moved somewhere else | ||
364 | public void SendRegionHandshake(World RegionInfo) { | ||
365 | ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); | ||
366 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
367 | RegionHandshakePacket handshake = new RegionHandshakePacket(); | ||
368 | |||
369 | ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); | ||
370 | handshake.RegionInfo.BillableFactor = 0; | ||
371 | handshake.RegionInfo.IsEstateManager = false; | ||
372 | handshake.RegionInfo.TerrainHeightRange00 = 60; | ||
373 | handshake.RegionInfo.TerrainHeightRange01 = 60; | ||
374 | handshake.RegionInfo.TerrainHeightRange10 = 60; | ||
375 | handshake.RegionInfo.TerrainHeightRange11 = 60; | ||
376 | handshake.RegionInfo.TerrainStartHeight00 = 10; | ||
377 | handshake.RegionInfo.TerrainStartHeight01 = 10; | ||
378 | handshake.RegionInfo.TerrainStartHeight10 = 10; | ||
379 | handshake.RegionInfo.TerrainStartHeight11 = 10; | ||
380 | handshake.RegionInfo.SimAccess = 13; | ||
381 | handshake.RegionInfo.WaterHeight = 20; | ||
382 | handshake.RegionInfo.RegionFlags = 72458694; | ||
383 | handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0"); | ||
384 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
385 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | ||
386 | handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); | ||
387 | handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); | ||
388 | handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); | ||
389 | handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
390 | handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
391 | handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
392 | handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
393 | handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); | ||
394 | |||
395 | ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); | ||
396 | this.ControllingClient.OutPacket(handshake); | ||
397 | } | ||
398 | |||
399 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() | ||
400 | { | ||
401 | byte[] bytes = new byte[60]; | ||
402 | int i=0; | ||
403 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
404 | |||
405 | dat.TextureEntry = AvatarTemplate.TextureEntry; | ||
406 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | ||
407 | |||
408 | uint ID = this.localid; | ||
409 | |||
410 | bytes[i++] = (byte)(ID % 256); | ||
411 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
412 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
413 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
414 | bytes[i++] = 0; | ||
415 | bytes[i++] = 1; | ||
416 | i += 14; | ||
417 | bytes[i++] = 128; | ||
418 | bytes[i++] = 63; | ||
419 | |||
420 | byte[] pb = pos2.GetBytes(); | ||
421 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
422 | i += 12; | ||
423 | ushort InternVelocityX; | ||
424 | ushort InternVelocityY; | ||
425 | ushort InternVelocityZ; | ||
426 | |||
427 | Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); | ||
428 | internDirec = internDirec /128.0f; | ||
429 | internDirec.x += 1; | ||
430 | internDirec.y += 1; | ||
431 | internDirec.z += 1; | ||
432 | |||
433 | InternVelocityX = (ushort)(32768 * internDirec.x); | ||
434 | InternVelocityY = (ushort)(32768 * internDirec.y); | ||
435 | InternVelocityZ = (ushort)(32768 * internDirec.z); | ||
436 | |||
437 | ushort ac = 32767; | ||
438 | bytes[i++] = (byte)(InternVelocityX % 256); | ||
439 | bytes[i++] = (byte)((InternVelocityX >> 8) % 256); | ||
440 | bytes[i++] = (byte)(InternVelocityY % 256); | ||
441 | bytes[i++] = (byte)((InternVelocityY>> 8) % 256); | ||
442 | bytes[i++] = (byte)(InternVelocityZ % 256); | ||
443 | bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); | ||
444 | |||
445 | //accel | ||
446 | bytes[i++] = (byte)(ac % 256); | ||
447 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
448 | bytes[i++] = (byte)(ac % 256); | ||
449 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
450 | bytes[i++] = (byte)(ac % 256); | ||
451 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
452 | |||
453 | //rot | ||
454 | bytes[i++] = (byte)(ac % 256); | ||
455 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
456 | bytes[i++] = (byte)(ac % 256); | ||
457 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
458 | bytes[i++] = (byte)(ac % 256); | ||
459 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
460 | bytes[i++] = (byte)(ac % 256); | ||
461 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
462 | |||
463 | //rotation vel | ||
464 | bytes[i++] = (byte)(ac % 256); | ||
465 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
466 | bytes[i++] = (byte)(ac % 256); | ||
467 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
468 | bytes[i++] = (byte)(ac % 256); | ||
469 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
470 | |||
471 | dat.Data=bytes; | ||
472 | return(dat); | ||
473 | } | ||
474 | } | ||
475 | |||
476 | public class NewForce | ||
477 | { | ||
478 | public float X; | ||
479 | public float Y; | ||
480 | public float Z; | ||
481 | |||
482 | public NewForce() | ||
483 | { | ||
484 | |||
485 | } | ||
486 | } | ||
487 | } | ||
diff --git a/src/world/Entity.cs b/src/world/Entity.cs deleted file mode 100644 index ee4b2e4..0000000 --- a/src/world/Entity.cs +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Axiom.MathLib; | ||
5 | using OpenSim.types; | ||
6 | using libsecondlife; | ||
7 | |||
8 | namespace OpenSim.world | ||
9 | { | ||
10 | public class Entity | ||
11 | { | ||
12 | public libsecondlife.LLUUID uuid; | ||
13 | public uint localid; | ||
14 | public LLVector3 position; | ||
15 | public LLVector3 velocity; | ||
16 | public Quaternion rotation; | ||
17 | protected string name; | ||
18 | protected List<Entity> children; | ||
19 | |||
20 | public Entity() | ||
21 | { | ||
22 | uuid = new libsecondlife.LLUUID(); | ||
23 | localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition! | ||
24 | position = new LLVector3(); | ||
25 | velocity = new LLVector3(); | ||
26 | rotation = new Quaternion(); | ||
27 | name = "(basic entity)"; | ||
28 | children = new List<Entity>(); | ||
29 | } | ||
30 | public virtual void addForces() | ||
31 | { | ||
32 | foreach (Entity child in children) | ||
33 | { | ||
34 | child.addForces(); | ||
35 | } | ||
36 | } | ||
37 | public virtual void update() { | ||
38 | // Do any per-frame updates needed that are applicable to every type of entity | ||
39 | foreach (Entity child in children) | ||
40 | { | ||
41 | child.update(); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | public virtual string getName() | ||
46 | { | ||
47 | return name; | ||
48 | } | ||
49 | |||
50 | public virtual Mesh getMesh() | ||
51 | { | ||
52 | Mesh mesh = new Mesh(); | ||
53 | |||
54 | foreach (Entity child in children) | ||
55 | { | ||
56 | mesh += child.getMesh(); | ||
57 | } | ||
58 | |||
59 | return mesh; | ||
60 | } | ||
61 | |||
62 | public virtual void BackUp() | ||
63 | { | ||
64 | |||
65 | } | ||
66 | } | ||
67 | } | ||
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs deleted file mode 100644 index 6be33ef..0000000 --- a/src/world/Primitive.cs +++ /dev/null | |||
@@ -1,429 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.types; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using GridInterfaces; | ||
8 | using PhysicsSystem; | ||
9 | |||
10 | namespace OpenSim.world | ||
11 | { | ||
12 | public class Primitive : Entity | ||
13 | { | ||
14 | protected float mesh_cutbegin; | ||
15 | protected float mesh_cutend; | ||
16 | protected PrimData primData; | ||
17 | protected bool newPrimFlag; | ||
18 | protected bool updateFlag; | ||
19 | protected bool dirtyFlag; | ||
20 | private ObjectUpdatePacket OurPacket; | ||
21 | private PhysicsActor _physActor; | ||
22 | private bool physicsEnabled; | ||
23 | |||
24 | public bool PhysicsEnabled | ||
25 | { | ||
26 | get | ||
27 | { | ||
28 | return physicsEnabled; | ||
29 | } | ||
30 | set | ||
31 | { | ||
32 | physicsEnabled = value; | ||
33 | } | ||
34 | } | ||
35 | public bool UpdateFlag | ||
36 | { | ||
37 | get | ||
38 | { | ||
39 | return updateFlag; | ||
40 | } | ||
41 | set | ||
42 | { | ||
43 | updateFlag = value; | ||
44 | } | ||
45 | } | ||
46 | public LLVector3 Scale | ||
47 | { | ||
48 | set | ||
49 | { | ||
50 | this.primData.Scale = value; | ||
51 | this.dirtyFlag = true; | ||
52 | } | ||
53 | get | ||
54 | { | ||
55 | return this.primData.Scale; | ||
56 | } | ||
57 | } | ||
58 | public PhysicsActor PhysActor | ||
59 | { | ||
60 | set | ||
61 | { | ||
62 | this._physActor = value; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | public Primitive() | ||
67 | { | ||
68 | mesh_cutbegin = 0.0f; | ||
69 | mesh_cutend = 1.0f; | ||
70 | } | ||
71 | |||
72 | public override Mesh getMesh() | ||
73 | { | ||
74 | Mesh mesh = new Mesh(); | ||
75 | Triangle tri = new Triangle( | ||
76 | new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), | ||
77 | new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), | ||
78 | new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); | ||
79 | |||
80 | mesh.AddTri(tri); | ||
81 | mesh += base.getMesh(); | ||
82 | |||
83 | return mesh; | ||
84 | } | ||
85 | |||
86 | public void UpdatePosition( LLVector3 pos) | ||
87 | { | ||
88 | this.position = pos; | ||
89 | if(this._physActor != null && this.physicsEnabled) | ||
90 | { | ||
91 | this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z); | ||
92 | } | ||
93 | this.updateFlag = true; | ||
94 | } | ||
95 | |||
96 | public override void update() | ||
97 | { | ||
98 | if(this.newPrimFlag) | ||
99 | { | ||
100 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
101 | client.OutPacket(OurPacket); | ||
102 | } | ||
103 | this.newPrimFlag = false; | ||
104 | } | ||
105 | else if(this.updateFlag) | ||
106 | { | ||
107 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
108 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
109 | terse.RegionData.TimeDilation = 64096; | ||
110 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
111 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
112 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
113 | client.OutPacket(terse); | ||
114 | } | ||
115 | this.updateFlag = false; | ||
116 | } | ||
117 | else if(this.dirtyFlag) | ||
118 | { | ||
119 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
120 | UpdateClient(client); | ||
121 | } | ||
122 | this.dirtyFlag = false; | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | if(this._physActor != null && this.physicsEnabled) | ||
127 | { | ||
128 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
129 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
130 | terse.RegionData.TimeDilation = 64096; | ||
131 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
132 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
133 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
134 | client.OutPacket(terse); | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | |||
140 | public void UpdateClient(OpenSimClient RemoteClient) | ||
141 | { | ||
142 | |||
143 | LLVector3 lPos; | ||
144 | if( this._physActor != null && this.physicsEnabled) | ||
145 | { | ||
146 | PhysicsVector pPos = this._physActor.Position; | ||
147 | lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z); | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | lPos = this.position; | ||
152 | } | ||
153 | byte[] pb = lPos.GetBytes(); | ||
154 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
155 | |||
156 | // OurPacket should be update with the follwing in updateShape() rather than having to do it here | ||
157 | OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
158 | OurPacket.ObjectData[0].PCode = this.primData.PCode; | ||
159 | OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
160 | OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
161 | OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
162 | OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
163 | OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
164 | OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
165 | OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
166 | OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
167 | OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
168 | OurPacket.ObjectData[0].Scale = this.primData.Scale; | ||
169 | OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
170 | OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
171 | OurPacket.ObjectData[0].ParentID = 0; | ||
172 | OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
173 | //finish off copying rest of shape data | ||
174 | OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
175 | OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
176 | OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
177 | OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
178 | OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
179 | OurPacket.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin; | ||
180 | |||
181 | RemoteClient.OutPacket(OurPacket); | ||
182 | } | ||
183 | |||
184 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
185 | { | ||
186 | this.primData.PathBegin = addPacket.PathBegin; | ||
187 | this.primData.PathEnd = addPacket.PathEnd; | ||
188 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
189 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
190 | this.primData.PathShearX = addPacket.PathShearX; | ||
191 | this.primData.PathShearY = addPacket.PathShearY; | ||
192 | this.primData.PathSkew = addPacket.PathSkew; | ||
193 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
194 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
195 | this.primData.PathCurve = addPacket.PathCurve; | ||
196 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
197 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
198 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
199 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
200 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
201 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
202 | this.primData.PathTwist = addPacket.PathTwist; | ||
203 | this.primData.PathTwistBegin =addPacket.PathTwistBegin; | ||
204 | this.dirtyFlag = true; | ||
205 | } | ||
206 | |||
207 | public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) | ||
208 | { | ||
209 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
210 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
211 | objupdate.RegionData.TimeDilation = 64096; | ||
212 | |||
213 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
214 | PrimData PData = new PrimData(); | ||
215 | this.primData = PData; | ||
216 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
217 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
218 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
219 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
220 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
221 | objupdate.ObjectData[0].Text = new byte[0]; | ||
222 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
223 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); | ||
224 | objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); | ||
225 | objupdate.ObjectData[0].Material = 3; | ||
226 | objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; | ||
227 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
228 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
229 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
230 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
231 | objupdate.ObjectData[0].State = 0; | ||
232 | objupdate.ObjectData[0].Data = new byte[0]; | ||
233 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; | ||
234 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; | ||
235 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; | ||
236 | PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; | ||
237 | PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; | ||
238 | PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; | ||
239 | PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; | ||
240 | PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; | ||
241 | PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; | ||
242 | PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
243 | PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
244 | PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; | ||
245 | PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; | ||
246 | PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
247 | PData.ParentID = objupdate.ObjectData[0].ParentID = 0; | ||
248 | PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
249 | |||
250 | PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
251 | PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
252 | PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX; | ||
253 | PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY; | ||
254 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; | ||
255 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
256 | |||
257 | //finish off copying rest of shape data | ||
258 | |||
259 | objupdate.ObjectData[0].ID = (uint)(localID); | ||
260 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID- 702000).ToString("00000")); | ||
261 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
262 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
263 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
264 | LLVector3 pos1= addPacket.ObjectData.RayEnd; | ||
265 | //update position | ||
266 | byte[] pb = pos1.GetBytes(); | ||
267 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
268 | |||
269 | this.newPrimFlag = true; | ||
270 | this.uuid = objupdate.ObjectData[0].FullID; | ||
271 | this.localid = objupdate.ObjectData[0].ID; | ||
272 | this.position = pos1; | ||
273 | this.OurPacket = objupdate; | ||
274 | } | ||
275 | |||
276 | public void CreateFromStorage(PrimData store) | ||
277 | { | ||
278 | //need to clean this up as it shares a lot of code with CreateFromPacket() | ||
279 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
280 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
281 | objupdate.RegionData.TimeDilation = 64096; | ||
282 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
283 | |||
284 | this.primData = store; | ||
285 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
286 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
287 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
288 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
289 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
290 | objupdate.ObjectData[0].Text = new byte[0]; | ||
291 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
292 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); | ||
293 | objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); | ||
294 | objupdate.ObjectData[0].Material = 3; | ||
295 | objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; | ||
296 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
297 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
298 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
299 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
300 | objupdate.ObjectData[0].State = 0; | ||
301 | objupdate.ObjectData[0].Data = new byte[0]; | ||
302 | objupdate.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
303 | objupdate.ObjectData[0].PCode = this.primData.PCode; | ||
304 | objupdate.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
305 | objupdate.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
306 | objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
307 | objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
308 | objupdate.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
309 | objupdate.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
310 | objupdate.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
311 | objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
312 | objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
313 | objupdate.ObjectData[0].Scale = this.primData.Scale; | ||
314 | objupdate.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
315 | objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
316 | objupdate.ObjectData[0].ParentID = 0; | ||
317 | objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
318 | //finish off copying rest of shape data | ||
319 | objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
320 | objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
321 | objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
322 | objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
323 | objupdate.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
324 | objupdate.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin; | ||
325 | |||
326 | objupdate.ObjectData[0].ID = (uint)store.LocalID; | ||
327 | objupdate.ObjectData[0].FullID = store.FullID; | ||
328 | |||
329 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
330 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
331 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
332 | LLVector3 pos1= store.Position; | ||
333 | //update position | ||
334 | byte[] pb = pos1.GetBytes(); | ||
335 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
336 | |||
337 | this.uuid = objupdate.ObjectData[0].FullID; | ||
338 | this.localid = objupdate.ObjectData[0].ID; | ||
339 | this.position = pos1; | ||
340 | this.OurPacket = objupdate; | ||
341 | |||
342 | } | ||
343 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
344 | { | ||
345 | uint ID = this.localid; | ||
346 | byte[] bytes = new byte[60]; | ||
347 | |||
348 | int i = 0; | ||
349 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
350 | dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; | ||
351 | |||
352 | bytes[i++] = (byte)(ID % 256); | ||
353 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
354 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
355 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
356 | bytes[i++]= 0; | ||
357 | bytes[i++]= 0; | ||
358 | |||
359 | LLVector3 lPos; | ||
360 | if( this._physActor != null && this.physicsEnabled) | ||
361 | { | ||
362 | PhysicsVector pPos = this._physActor.Position; | ||
363 | lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z); | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | lPos = this.position; | ||
368 | } | ||
369 | byte[] pb = lPos.GetBytes(); | ||
370 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
371 | i += 12; | ||
372 | ushort ac = 32767; | ||
373 | |||
374 | //vel | ||
375 | bytes[i++] = (byte)(ac % 256); | ||
376 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
377 | bytes[i++] = (byte)(ac % 256); | ||
378 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
379 | bytes[i++] = (byte)(ac % 256); | ||
380 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
381 | |||
382 | //accel | ||
383 | bytes[i++] = (byte)(ac % 256); | ||
384 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
385 | bytes[i++] = (byte)(ac % 256); | ||
386 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
387 | bytes[i++] = (byte)(ac % 256); | ||
388 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
389 | |||
390 | ushort rw, rx,ry,rz; | ||
391 | rw = (ushort)(32768 * (this.rotation.w+1)); | ||
392 | rx = (ushort)(32768 * (this.rotation.x+1)); | ||
393 | ry = (ushort)(32768 * (this.rotation.y+1)); | ||
394 | rz = (ushort)(32768 * (this.rotation.z+1)); | ||
395 | |||
396 | //rot | ||
397 | bytes[i++] = (byte)(rx % 256); | ||
398 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
399 | bytes[i++] = (byte)(ry % 256); | ||
400 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
401 | bytes[i++] = (byte)(rz % 256); | ||
402 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
403 | bytes[i++] = (byte)(rw % 256); | ||
404 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
405 | |||
406 | //rotation vel | ||
407 | bytes[i++] = (byte)(ac % 256); | ||
408 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
409 | bytes[i++] = (byte)(ac % 256); | ||
410 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
411 | bytes[i++] = (byte)(ac % 256); | ||
412 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
413 | |||
414 | dat.Data=bytes; | ||
415 | return dat; | ||
416 | } | ||
417 | |||
418 | public override void BackUp() | ||
419 | { | ||
420 | |||
421 | this.primData.FullID = this.uuid; | ||
422 | this.primData.LocalID = this.localid; | ||
423 | this.primData.Position = this.position; | ||
424 | this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w); | ||
425 | OpenSim_Main.local_world.localStorage.StorePrim(this.primData); | ||
426 | } | ||
427 | } | ||
428 | |||
429 | } | ||
diff --git a/src/world/ScriptEngine.cs b/src/world/ScriptEngine.cs deleted file mode 100644 index f20a08e..0000000 --- a/src/world/ScriptEngine.cs +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.world | ||
6 | { | ||
7 | public class ScriptEngine | ||
8 | { | ||
9 | public ScriptEngine(World env) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | public void LoadScript() | ||
14 | { | ||
15 | |||
16 | } | ||
17 | } | ||
18 | } | ||
diff --git a/src/world/SurfacePatch.cs b/src/world/SurfacePatch.cs deleted file mode 100644 index 71e4116..0000000 --- a/src/world/SurfacePatch.cs +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.world | ||
6 | { | ||
7 | public class SurfacePatch | ||
8 | { | ||
9 | public float[] HeightMap; | ||
10 | |||
11 | public SurfacePatch() { | ||
12 | HeightMap = new float[16*16]; | ||
13 | |||
14 | int xinc; | ||
15 | int yinc; | ||
16 | for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) { | ||
17 | HeightMap[xinc+(yinc*16)]=100.0f; | ||
18 | } | ||
19 | |||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/world/World.cs b/src/world/World.cs deleted file mode 100644 index e1c84bc..0000000 --- a/src/world/World.cs +++ /dev/null | |||
@@ -1,208 +0,0 @@ | |||
1 | using System; | ||
2 | using libsecondlife; | ||
3 | using libsecondlife.Packets; | ||
4 | using System.Collections.Generic; | ||
5 | using System.Text; | ||
6 | using System.Reflection; | ||
7 | using System.IO; | ||
8 | using PhysicsSystem; | ||
9 | using GridInterfaces; | ||
10 | |||
11 | namespace OpenSim.world | ||
12 | { | ||
13 | public class World : ILocalStorageReceiver | ||
14 | { | ||
15 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | ||
16 | public float[] LandMap; | ||
17 | public ScriptEngine Scripts; | ||
18 | public uint _localNumber=0; | ||
19 | private PhysicsScene phyScene; | ||
20 | private float timeStep= 0.1f; | ||
21 | private libsecondlife.TerrainManager TerrainManager; | ||
22 | public ILocalStorage localStorage; | ||
23 | private Random Rand = new Random(); | ||
24 | private uint _primCount = 702000; | ||
25 | private int storageCount; | ||
26 | |||
27 | public World() | ||
28 | { | ||
29 | ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); | ||
30 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | ||
31 | |||
32 | ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); | ||
33 | TerrainManager = new TerrainManager(new SecondLife()); | ||
34 | Avatar.SetupTemplate("avatar-template.dat"); | ||
35 | // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); | ||
36 | // Initialise this only after the world has loaded | ||
37 | // Scripts = new ScriptEngine(this); | ||
38 | } | ||
39 | |||
40 | public PhysicsScene PhysScene | ||
41 | { | ||
42 | set | ||
43 | { | ||
44 | this.phyScene = value; | ||
45 | } | ||
46 | get | ||
47 | { | ||
48 | return(this.phyScene); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public void Update() | ||
53 | { | ||
54 | if(this.phyScene.IsThreaded) | ||
55 | { | ||
56 | this.phyScene.GetResults(); | ||
57 | |||
58 | } | ||
59 | |||
60 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
61 | { | ||
62 | Entities[UUID].addForces(); | ||
63 | } | ||
64 | |||
65 | this.phyScene.Simulate(timeStep); | ||
66 | |||
67 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
68 | { | ||
69 | Entities[UUID].update(); | ||
70 | } | ||
71 | |||
72 | //backup world data | ||
73 | this.storageCount++; | ||
74 | if(storageCount> 300) //set to how often you want to backup | ||
75 | { | ||
76 | this.Backup(); | ||
77 | storageCount =0; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | public bool LoadStorageDLL(string dllName) | ||
82 | { | ||
83 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
84 | ILocalStorage store = null; | ||
85 | |||
86 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
87 | { | ||
88 | if (pluginType.IsPublic) | ||
89 | { | ||
90 | if (!pluginType.IsAbstract) | ||
91 | { | ||
92 | Type typeInterface = pluginType.GetInterface("ILocalStorage", true); | ||
93 | |||
94 | if (typeInterface != null) | ||
95 | { | ||
96 | ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
97 | store = plug; | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | typeInterface = null; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | pluginAssembly = null; | ||
106 | this.localStorage = store; | ||
107 | return(store == null); | ||
108 | } | ||
109 | |||
110 | public void RegenerateTerrain() | ||
111 | { | ||
112 | HeightmapGenHills hills = new HeightmapGenHills(); | ||
113 | this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
114 | this.phyScene.SetTerrain(this.LandMap); | ||
115 | OpenSim_Main.cfg.SaveMap(); | ||
116 | |||
117 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
118 | this.SendLayerData(client); | ||
119 | } | ||
120 | } | ||
121 | public void LoadPrimsFromStorage() | ||
122 | { | ||
123 | ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); | ||
124 | this.localStorage.LoadPrimitives(this); | ||
125 | } | ||
126 | |||
127 | public void PrimFromStorage(PrimData prim) | ||
128 | { | ||
129 | if(prim.LocalID >= this._primCount) | ||
130 | { | ||
131 | _primCount = prim.LocalID + 1; | ||
132 | } | ||
133 | ServerConsole.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); | ||
134 | Primitive nPrim = new Primitive(); | ||
135 | nPrim.CreateFromStorage(prim); | ||
136 | this.Entities.Add(nPrim.uuid, nPrim); | ||
137 | } | ||
138 | |||
139 | public void Close() | ||
140 | { | ||
141 | this.localStorage.ShutDown(); | ||
142 | } | ||
143 | |||
144 | public void SendLayerData(OpenSimClient RemoteClient) { | ||
145 | int[] patches = new int[4]; | ||
146 | |||
147 | for (int y = 0; y < 16; y++) | ||
148 | { | ||
149 | for (int x = 0; x < 16; x = x + 4) | ||
150 | { | ||
151 | patches[0] = x + 0 + y * 16; | ||
152 | patches[1] = x + 1 + y * 16; | ||
153 | patches[2] = x + 2 + y * 16; | ||
154 | patches[3] = x + 3 + y * 16; | ||
155 | |||
156 | Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); | ||
157 | RemoteClient.OutPacket(layerpack); | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | |||
162 | public void GetInitialPrims(OpenSimClient RemoteClient) | ||
163 | { | ||
164 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
165 | { | ||
166 | if(Entities[UUID].ToString()== "OpenSim.world.Primitive") | ||
167 | { | ||
168 | ((OpenSim.world.Primitive)Entities[UUID]).UpdateClient(RemoteClient); | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | |||
173 | public void AddViewerAgent(OpenSimClient AgentClient) { | ||
174 | ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | ||
175 | Avatar NewAvatar = new Avatar(AgentClient); | ||
176 | ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); | ||
177 | ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); | ||
178 | NewAvatar.SendRegionHandshake(this); | ||
179 | PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); | ||
180 | NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); | ||
181 | this.Entities.Add(AgentClient.AgentID, NewAvatar); | ||
182 | } | ||
183 | |||
184 | public void AddNewPrim(ObjectAddPacket addPacket, OpenSimClient AgentClient) | ||
185 | { | ||
186 | ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); | ||
187 | Primitive prim = new Primitive(); | ||
188 | prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); | ||
189 | PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); | ||
190 | PhysicsVector pSize = new PhysicsVector( 0.25f, 0.25f, 0.25f); | ||
191 | //prim.PhysActor = this.phyScene.AddPrim(pVec, pSize ); | ||
192 | //prim.PhysicsEnabled = true; | ||
193 | this.Entities.Add(prim.uuid, prim); | ||
194 | this._primCount++; | ||
195 | } | ||
196 | |||
197 | public bool Backup() { | ||
198 | /* TODO: Save the current world entities state. */ | ||
199 | ServerConsole.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives"); | ||
200 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
201 | { | ||
202 | Entities[UUID].BackUp(); | ||
203 | } | ||
204 | return true; | ||
205 | } | ||
206 | |||
207 | } | ||
208 | } | ||
diff --git a/src/world/scripting/IScript.cs b/src/world/scripting/IScript.cs deleted file mode 100644 index 550594d..0000000 --- a/src/world/scripting/IScript.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.world.scripting | ||
6 | { | ||
7 | public interface IScriptHost { | ||
8 | bool Register(IScript iscript); | ||
9 | } | ||
10 | public interface IScript | ||
11 | { | ||
12 | string Name{get;set;} | ||
13 | IScriptHost Host{get;set;} | ||
14 | void Show(); | ||
15 | } | ||
16 | } | ||