aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMW2007-08-27 15:34:21 +0000
committerMW2007-08-27 15:34:21 +0000
commit653a4ff22ddb80d586a19648a239f01322ef78be (patch)
tree0a72cc52c2e14391f66ea59df4c209b1cc7f4930 /OpenSim/Region
parentStopped EntityBase from implementing IScriptHost, as don't think it should, m... (diff)
downloadopensim-SC-653a4ff22ddb80d586a19648a239f01322ef78be.zip
opensim-SC-653a4ff22ddb80d586a19648a239f01322ef78be.tar.gz
opensim-SC-653a4ff22ddb80d586a19648a239f01322ef78be.tar.bz2
opensim-SC-653a4ff22ddb80d586a19648a239f01322ef78be.tar.xz
Deleted a few old files that are no longer used.
Deleted the GridInterfaces projects, and for now moved the old local asset server into Framework.Communications, as we prepare to rewrite the asset cache and asset server. Deleted Framework.manager as I am sure this is no longer in use.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs6
-rw-r--r--OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs357
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive(Old).cs724
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject(Old).cs319
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs2
-rw-r--r--OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs1
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs1
-rw-r--r--OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs56
-rw-r--r--OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs403
-rw-r--r--OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs56
-rw-r--r--OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs133
14 files changed, 9 insertions, 2066 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 955f179..ec660f3 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -231,7 +231,11 @@ namespace OpenSim
231 protected override void Initialize() 231 protected override void Initialize()
232 { 232 {
233 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 233 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
234 m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 234
235 LocalAssetServer assetServer = new LocalAssetServer();
236 assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
237 m_assetCache = new AssetCache(assetServer);
238 // m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
235 } 239 }
236 240
237 protected override LogBase CreateLog() 241 protected override LogBase CreateLog()
diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
deleted file mode 100644
index 6a05ba2..0000000
--- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs
+++ /dev/null
@@ -1,357 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using libsecondlife;
31using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types;
34using OpenSim.Framework.Utilities;
35using OpenSim.Framework.Communications.Caches;
36
37
38namespace OpenSim.Region.ClientStack
39{
40 partial class ClientView
41 {
42 public class AgentAssetUpload
43 {
44 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
45 private ClientView ourClient;
46 private AssetCache m_assetCache;
47 // private InventoryCache m_inventoryCache;
48
49 public AgentAssetUpload(ClientView client, AssetCache assetCache )
50 {
51 this.ourClient = client;
52 m_assetCache = assetCache;
53 // m_inventoryCache = inventoryCache;
54 }
55
56 public void AddUpload(LLUUID transactionID, AssetBase asset)
57 {
58 AssetTransaction upload = new AssetTransaction();
59 lock (this.transactions)
60 {
61 upload.Asset = asset;
62 upload.TransactionID = transactionID;
63 this.transactions.Add(transactionID, upload);
64 }
65 if (upload.Asset.Data.Length > 2)
66 {
67 //is complete
68 upload.UploadComplete = true;
69 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
70 response.AssetBlock.Type = asset.Type;
71 response.AssetBlock.Success = true;
72 response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID);
73 this.ourClient.OutPacket(response);
74 m_assetCache.AddAsset(asset);
75 }
76 else
77 {
78 upload.UploadComplete = false;
79 upload.XferID = Util.GetNextXferID();
80 RequestXferPacket xfer = new RequestXferPacket();
81 xfer.XferID.ID = upload.XferID;
82 xfer.XferID.VFileType = upload.Asset.Type;
83 xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID);
84 xfer.XferID.FilePath = 0;
85 xfer.XferID.Filename = new byte[0];
86 this.ourClient.OutPacket(xfer);
87 }
88
89 }
90
91 public AssetBase GetUpload(LLUUID transactionID)
92 {
93 if (this.transactions.ContainsKey(transactionID))
94 {
95 return this.transactions[transactionID].Asset;
96 }
97
98 return null;
99 }
100
101 public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
102 {
103 // Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString());
104 AssetBase asset = null;
105 if (pack.AssetBlock.Type == 0)
106 {
107
108 //first packet for transaction
109 asset = new AssetBase();
110 asset.FullID = assetID;
111 asset.Type = pack.AssetBlock.Type;
112 asset.InvType = asset.Type;
113 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
114 asset.Data = pack.AssetBlock.AssetData;
115
116
117 }
118 else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7)
119 {
120
121 asset = new AssetBase();
122 asset.FullID = assetID;
123 // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated());
124 asset.Type = pack.AssetBlock.Type;
125 asset.InvType = asset.Type;
126 asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000");
127 asset.Data = pack.AssetBlock.AssetData;
128
129
130 }
131
132 if (asset != null)
133 {
134 this.AddUpload(pack.AssetBlock.TransactionID, asset);
135 }
136 else
137 {
138
139 //currently we don't support this asset type
140 //so lets just tell the client that the upload is complete
141 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
142 response.AssetBlock.Type = pack.AssetBlock.Type;
143 response.AssetBlock.Success = true;
144 response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID);
145 this.ourClient.OutPacket(response);
146 }
147
148 }
149
150 #region Xfer packet system for larger uploads
151
152 public void HandleXferPacket(SendXferPacketPacket xferPacket)
153 {
154 lock (this.transactions)
155 {
156 foreach (AssetTransaction trans in this.transactions.Values)
157 {
158 if (trans.XferID == xferPacket.XferID.ID)
159 {
160 if (trans.Asset.Data.Length > 1)
161 {
162 byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length];
163 Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length);
164 Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length);
165 trans.Asset.Data = newArray;
166 }
167 else
168 {
169 byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4];
170 Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4);
171 trans.Asset.Data = newArray;
172 }
173
174 if ((xferPacket.XferID.Packet & 2147483648) != 0)
175 {
176 //end of transfer
177 trans.UploadComplete = true;
178 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
179 response.AssetBlock.Type = trans.Asset.Type;
180 response.AssetBlock.Success = true;
181 response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID);
182 this.ourClient.OutPacket(response);
183
184 m_assetCache.AddAsset(trans.Asset);
185 //check if we should add it to inventory
186 if (trans.AddToInventory)
187 {
188 // m_assetCache.AddAsset(trans.Asset);
189 //m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
190 }
191
192
193 }
194 break;
195 }
196
197 }
198 }
199
200 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
201 confirmXfer.XferID.ID = xferPacket.XferID.ID;
202 confirmXfer.XferID.Packet = xferPacket.XferID.Packet;
203 this.ourClient.OutPacket(confirmXfer);
204 }
205
206 #endregion
207
208 public AssetBase AddUploadToAssetCache(LLUUID transactionID)
209 {
210 AssetBase asset = null;
211 if (this.transactions.ContainsKey(transactionID))
212 {
213 AssetTransaction trans = this.transactions[transactionID];
214 if (trans.UploadComplete)
215 {
216 m_assetCache.AddAsset(trans.Asset);
217 asset = trans.Asset;
218 }
219 }
220
221 return asset;
222 }
223
224 public void CreateInventoryItem(CreateInventoryItemPacket packet)
225 {
226 if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID))
227 {
228 AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID];
229 trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description);
230 trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name);
231 trans.Asset.Type = packet.InventoryBlock.Type;
232 trans.Asset.InvType = packet.InventoryBlock.InvType;
233 if (trans.UploadComplete)
234 {
235 //already complete so we can add it to the inventory
236 //m_assetCache.AddAsset(trans.Asset);
237 // m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset);
238 }
239 else
240 {
241 trans.AddToInventory = true;
242 trans.InventFolder = packet.InventoryBlock.FolderID;
243 }
244 }
245 }
246
247 private class AssetTransaction
248 {
249 public uint XferID;
250 public AssetBase Asset;
251 public bool AddToInventory;
252 public LLUUID InventFolder = LLUUID.Zero;
253 public bool UploadComplete = false;
254 public LLUUID TransactionID = LLUUID.Zero;
255
256 public AssetTransaction()
257 {
258
259 }
260 }
261
262 //new class , not currently used.
263 public class AssetXferUploader
264 {
265 private IClientAPI ourClient;
266
267 public bool UploadComplete = false;
268
269 public bool AddToInventory;
270 public LLUUID InventFolder = LLUUID.Zero;
271
272 public uint XferID;
273 public AssetBase Asset;
274 public LLUUID TransactionID = LLUUID.Zero;
275
276
277 public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data)
278 {
279 ourClient = remoteClient;
280 Asset = new AssetBase();
281 Asset.FullID = assetID;
282 Asset.InvType = type;
283 Asset.Type = type;
284 Asset.Data = data;
285 Asset.Name = "blank";
286 Asset.Description = "empty";
287 TransactionID = transaction;
288
289 if (Asset.Data.Length > 2)
290 {
291 //data block should only have data in it, if there is no more data to be uploaded
292 this.SendCompleteMessage();
293 }
294 else
295 {
296 this.ReqestStartXfer();
297 }
298 }
299
300 protected void SendCompleteMessage()
301 {
302 UploadComplete = true;
303 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
304 response.AssetBlock.Type = Asset.Type;
305 response.AssetBlock.Success = true;
306 response.AssetBlock.UUID = Asset.FullID;
307 this.ourClient.OutPacket(response);
308
309 //TODO trigger event
310 }
311
312 protected void ReqestStartXfer()
313 {
314 UploadComplete = false;
315 XferID = Util.GetNextXferID();
316 RequestXferPacket xfer = new RequestXferPacket();
317 xfer.XferID.ID = XferID;
318 xfer.XferID.VFileType = Asset.Type;
319 xfer.XferID.VFileID = Asset.FullID;
320 xfer.XferID.FilePath = 0;
321 xfer.XferID.Filename = new byte[0];
322 this.ourClient.OutPacket(xfer);
323 }
324
325 public void HandleXferPacket(uint xferID, uint packetID, byte[] data)
326 {
327 if (XferID == xferID)
328 {
329 if (Asset.Data.Length > 1)
330 {
331 byte[] newArray = new byte[Asset.Data.Length + data.Length];
332 Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length);
333 Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length);
334 Asset.Data = newArray;
335 }
336 else
337 {
338 byte[] newArray = new byte[data.Length - 4];
339 Array.Copy(data, 4, newArray, 0, data.Length - 4);
340 Asset.Data = newArray;
341 }
342
343 ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
344 confirmXfer.XferID.ID = xferID;
345 confirmXfer.XferID.Packet = packetID;
346 this.ourClient.OutPacket(confirmXfer);
347
348 if ((packetID & 2147483648) != 0)
349 {
350 this.SendCompleteMessage();
351 }
352 }
353 }
354 }
355 }
356 }
357}
diff --git a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs
deleted file mode 100644
index 0efa570..0000000
--- a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs
+++ /dev/null
@@ -1,724 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Xml;
4using System.Xml.Serialization;
5using Axiom.Math;
6using libsecondlife;
7using libsecondlife.Packets;
8using OpenSim.Framework.Interfaces;
9using OpenSim.Framework.Inventory;
10using OpenSim.Framework.Types;
11
12using InventoryItem = OpenSim.Framework.Inventory.InventoryItem;
13
14namespace OpenSim.Region.Environment.Scenes
15{
16 public delegate void PrimCountTaintedDelegate();
17
18 public class Primitive : EntityBase
19 {
20 private const uint FULL_MASK_PERMISSIONS = 2147483647;
21
22 private LLVector3 m_positionLastFrame = new LLVector3(0, 0, 0);
23 private ulong m_regionHandle;
24 private byte m_updateFlag;
25 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
26
27 private Dictionary<LLUUID, InventoryItem> m_inventoryItems;
28
29 private string m_description = "";
30
31 public LLUUID CreatorID;
32 public LLUUID OwnerID;
33 public LLUUID LastOwnerID;
34
35 public Int32 CreationDate;
36
37 public uint ParentID = 0;
38
39 public uint OwnerMask = FULL_MASK_PERMISSIONS;
40 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
41 public uint GroupMask = 0;// FULL_MASK_PERMISSIONS;
42 public uint EveryoneMask = 0;//FULL_MASK_PERMISSIONS;
43 public uint BaseMask = 0;//FULL_MASK_PERMISSIONS;
44
45 private PrimitiveBaseShape m_shape;
46 private byte[] m_particleSystem = new byte[0];
47
48 public SceneObjectOLD m_RootParent;
49 public bool m_isRootPrim;
50 public EntityBase m_Parent;
51
52 public event PrimCountTaintedDelegate OnPrimCountTainted;
53
54 #region Properties
55
56 /// <summary>
57 /// If rootprim, will return world position
58 /// otherwise will return local offset from rootprim
59 /// </summary>
60 public override LLVector3 AbsolutePosition
61 {
62 get
63 {
64 if (m_isRootPrim)
65 {
66 //if we are rootprim then our offset should be zero
67 return m_pos + m_Parent.AbsolutePosition;
68 }
69 else
70 {
71 return m_pos;
72 }
73 }
74 set
75 {
76 if (m_isRootPrim)
77 {
78 m_Parent.AbsolutePosition = value;
79 }
80 m_pos = value - m_Parent.AbsolutePosition;
81 }
82 }
83
84 public PrimitiveBaseShape Shape
85 {
86 get { return m_shape; }
87 }
88
89 public LLVector3 WorldPos
90 {
91 get
92 {
93 if (!m_isRootPrim)
94 {
95 Primitive parentPrim = (Primitive)m_Parent;
96 Vector3 offsetPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
97 offsetPos = parentPrim.Rotation * offsetPos;
98 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z);
99 }
100 else
101 {
102 return AbsolutePosition;
103 }
104 }
105 }
106
107 public string Description
108 {
109 get { return m_description; }
110 set { m_description = value; }
111 }
112
113 public LLVector3 Scale
114 {
115 set { m_shape.Scale = value; }
116 get { return m_shape.Scale; }
117 }
118
119 private string m_sitName = "";
120 public string SitName
121 {
122 get { return m_sitName; }
123 }
124
125 private string m_touchName = "";
126 public string TouchName
127 {
128 get { return m_touchName; }
129 }
130
131 private string m_text = "";
132 public string Text
133 {
134 get { return m_text; }
135 set
136 {
137 m_text = value;
138 ScheduleFullUpdate();
139 }
140 }
141
142 #endregion
143
144 #region Constructors
145
146 public Primitive(ulong regionHandle, Scene scene, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
147 SceneObjectOLD rootObject, PrimitiveBaseShape shape, LLVector3 pos)
148 {
149 m_regionHandle = regionHandle;
150 m_scene = scene;
151 m_inventoryItems = new Dictionary<LLUUID, InventoryItem>();
152 m_Parent = parent;
153 m_isRootPrim = isRoot;
154 m_RootParent = rootObject;
155 ClearUpdateSchedule();
156 CreateFromShape(ownerID, localID, pos, shape);
157
158 Rotation = Quaternion.Identity;
159
160 m_scene.AcknowledgeNewPrim(this);
161
162 OnPrimCountTainted();
163 }
164
165 /// <summary>
166 ///
167 /// </summary>
168 /// <remarks>Empty constructor for duplication</remarks>
169 public Primitive()
170 {
171 }
172
173 #endregion
174
175 #region Destructors
176
177 ~Primitive()
178 {
179 if (OnPrimCountTainted != null)
180 OnPrimCountTainted();
181 }
182
183 #endregion
184
185 #region Duplication
186
187 public Primitive Copy(EntityBase parent, SceneObjectOLD rootParent)
188 {
189 Primitive dupe = (Primitive)MemberwiseClone();
190
191 dupe.m_Parent = parent;
192 dupe.m_RootParent = rootParent;
193
194 // TODO: Copy this properly.
195
196 dupe.m_inventoryItems = m_inventoryItems;
197 dupe.m_children = new List<EntityBase>();
198 dupe.m_shape = m_shape.Copy();
199 dupe.m_regionHandle = m_regionHandle;
200 dupe.m_scene = m_scene;
201
202
203 uint newLocalID = m_scene.PrimIDAllocate();
204 dupe.m_uuid = LLUUID.Random();
205 dupe.LocalId = newLocalID;
206
207 if (parent is SceneObjectGroup)
208 {
209 dupe.m_isRootPrim = true;
210 dupe.ParentID = 0;
211 }
212 else
213 {
214 dupe.m_isRootPrim = false;
215 dupe.ParentID = ((Primitive)parent).LocalId;
216 }
217
218 dupe.Scale = new LLVector3(Scale.X, Scale.Y, Scale.Z);
219 dupe.Rotation = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
220 dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
221
222 rootParent.AddChildToList(dupe);
223 m_scene.AcknowledgeNewPrim(dupe);
224 dupe.TriggerOnPrimCountTainted();
225
226
227 foreach (Primitive prim in m_children)
228 {
229 Primitive primClone = prim.Copy(dupe, rootParent);
230
231 dupe.m_children.Add(primClone);
232 }
233
234 return dupe;
235 }
236
237 #endregion
238
239 #region Override from EntityBase
240
241 /// <summary>
242 ///
243 /// </summary>
244 public override void Update()
245 {
246 if (m_updateFlag == 1) //some change has been made so update the clients
247 {
248 SendTerseUpdateToALLClients();
249 ClearUpdateSchedule();
250 }
251 else
252 {
253 if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes
254 {
255 SendFullUpdateToAllClients();
256 ClearUpdateSchedule();
257 }
258 }
259
260 foreach (EntityBase child in m_children)
261 {
262 child.Update();
263 }
264 }
265
266 private void ClearUpdateSchedule()
267 {
268 m_updateFlag = 0;
269 }
270
271 #endregion
272
273 #region Setup
274
275 /// <summary>
276 ///
277 /// </summary>
278 /// <param name="addPacket"></param>
279 /// <param name="ownerID"></param>
280 /// <param name="localID"></param>
281 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
282 {
283 CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
284 OwnerID = ownerID;
285 CreatorID = OwnerID;
286 LastOwnerID = LLUUID.Zero;
287 AbsolutePosition = pos;
288 m_uuid = LLUUID.Random();
289 m_localId = (uint)(localID);
290
291 m_shape = shape;
292
293 ScheduleFullUpdate();
294 }
295
296 private void ScheduleFullUpdate()
297 {
298 m_updateFlag = 2;
299 }
300
301 private void ScheduleTerseUpdate()
302 {
303 if (m_updateFlag < 1)
304 {
305 m_updateFlag = 1;
306 }
307 }
308
309 #endregion
310
311 #region Linking / unlinking
312
313 /// <summary>
314 ///
315 /// </summary>
316 /// <param name="linkObject"></param>
317 public void AddNewChildren(SceneObjectOLD linkObject)
318 {
319 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
320 //TODO check permissions
321
322 m_children.Add(linkObject.rootPrimitive);
323 linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
324
325 m_scene.DeleteEntity(linkObject.rootUUID);
326 linkObject.DeleteAllChildren();
327
328 OnPrimCountTainted();
329 }
330
331 /// <summary>
332 ///
333 /// </summary>
334 /// <param name="newParent"></param>
335 /// <param name="rootParent"></param>
336 public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent)
337 {
338 LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
339 m_isRootPrim = false;
340 m_Parent = newParent;
341 ParentID = newParent.LocalId;
342 m_RootParent = rootParent;
343 m_RootParent.AddChildToList(this);
344 AbsolutePosition = oldPos;
345 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
346 axPos = m_Parent.Rotation.Inverse() * axPos;
347 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
348 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
349 Rotation = m_Parent.Rotation.Inverse() * Rotation;
350 ScheduleFullUpdate();
351
352
353 foreach (Primitive child in m_children)
354 {
355 child.SetRootParent(rootParent, newParent, oldPos, oldRot);
356 }
357
358 m_children.Clear();
359
360 }
361
362 /// <summary>
363 ///
364 /// </summary>
365 /// <param name="newRoot"></param>
366 public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition,
367 Quaternion oldParentRotation)
368 {
369 LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
370 Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z);
371 axOldPos = oldParentRotation * axOldPos;
372 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z);
373 oldPos += oldParentPosition;
374 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
375 m_isRootPrim = false;
376 m_Parent = newParent;
377 ParentID = newParent.LocalId;
378 newParent.AddToChildrenList(this);
379
380 m_RootParent = newRoot;
381 m_RootParent.AddChildToList(this);
382 AbsolutePosition = oldPos;
383 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
384 axPos = m_Parent.Rotation.Inverse() * axPos;
385 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
386 Rotation = oldParentRotation * Rotation;
387 Rotation = m_Parent.Rotation.Inverse() * Rotation;
388 ScheduleFullUpdate();
389 foreach (Primitive child in m_children)
390 {
391 child.SetRootParent(newRoot, newParent, oldPos, oldRot);
392 }
393
394 m_children.Clear();
395
396 }
397
398 /// <summary>
399 ///
400 /// </summary>
401 /// <param name="offset"></param>
402 public void AddOffsetToChildren(LLVector3 offset)
403 {
404 foreach (Primitive prim in m_children)
405 {
406 prim.m_pos += offset;
407 prim.ScheduleTerseUpdate();
408 }
409 OnPrimCountTainted();
410 }
411
412 /// <summary>
413 ///
414 /// </summary>
415 /// <param name="prim"></param>
416 public void AddToChildrenList(Primitive prim)
417 {
418 m_children.Add(prim);
419 }
420
421 #endregion
422
423 #region Resizing/Scale
424
425 /// <summary>
426 ///
427 /// </summary>
428 /// <param name="scale"></param>
429 public void ResizeGoup(LLVector3 scale)
430 {
431 m_shape.Scale = scale;
432
433 ScheduleFullUpdate();
434 }
435
436 #endregion
437
438 #region Position
439
440 /// <summary>
441 ///
442 /// </summary>
443 /// <param name="pos"></param>
444 public void UpdateGroupPosition(LLVector3 pos)
445 {
446 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
447
448 AbsolutePosition = newPos;
449 ScheduleTerseUpdate();
450
451 OnPrimCountTainted();
452 }
453
454 /// <summary>
455 ///
456 /// </summary>
457 /// <param name="pos"></param>
458 public void UpdateSinglePosition(LLVector3 pos)
459 {
460 // Console.WriteLine("updating single prim position");
461 if (m_isRootPrim)
462 {
463 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
464 LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
465 LLVector3 diff = oldPos - newPos;
466 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
467 axDiff = Rotation.Inverse() * axDiff;
468 diff.X = axDiff.x;
469 diff.Y = axDiff.y;
470 diff.Z = axDiff.z;
471 AbsolutePosition = newPos;
472
473 foreach (Primitive prim in m_children)
474 {
475 prim.m_pos += diff;
476 prim.ScheduleTerseUpdate();
477 }
478 ScheduleTerseUpdate();
479 }
480 else
481 {
482 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
483 m_pos = newPos;
484 ScheduleTerseUpdate();
485 }
486 }
487
488 #endregion
489
490 #region Rotation
491
492 /// <summary>
493 ///
494 /// </summary>
495 /// <param name="rot"></param>
496 public void UpdateGroupRotation(LLQuaternion rot)
497 {
498 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
499 ScheduleTerseUpdate();
500 }
501
502 /// <summary>
503 ///
504 /// </summary>
505 /// <param name="pos"></param>
506 /// <param name="rot"></param>
507 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
508 {
509 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
510 AbsolutePosition = pos;
511 ScheduleTerseUpdate();
512 }
513
514 /// <summary>
515 ///
516 /// </summary>
517 /// <param name="rot"></param>
518 public void UpdateSingleRotation(LLQuaternion rot)
519 {
520 //Console.WriteLine("updating single prim rotation");
521
522 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
523 Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
524 Rotation = axRot;
525 foreach (Primitive prim in m_children)
526 {
527 Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
528 axPos = oldParentRot * axPos;
529 axPos = axRot.Inverse() * axPos;
530 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
531 prim.Rotation = oldParentRot * prim.Rotation;
532 prim.Rotation = axRot.Inverse() * prim.Rotation;
533 prim.ScheduleTerseUpdate();
534 }
535 ScheduleTerseUpdate();
536 }
537
538 #endregion
539
540 #region Shape
541
542 /// <summary>
543 ///
544 /// </summary>
545 /// <param name="shapeBlock"></param>
546 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
547 {
548 m_shape.PathBegin = shapeBlock.PathBegin;
549 m_shape.PathEnd = shapeBlock.PathEnd;
550 m_shape.PathScaleX = shapeBlock.PathScaleX;
551 m_shape.PathScaleY = shapeBlock.PathScaleY;
552 m_shape.PathShearX = shapeBlock.PathShearX;
553 m_shape.PathShearY = shapeBlock.PathShearY;
554 m_shape.PathSkew = shapeBlock.PathSkew;
555 m_shape.ProfileBegin = shapeBlock.ProfileBegin;
556 m_shape.ProfileEnd = shapeBlock.ProfileEnd;
557 m_shape.PathCurve = shapeBlock.PathCurve;
558 m_shape.ProfileCurve = shapeBlock.ProfileCurve;
559 m_shape.ProfileHollow = shapeBlock.ProfileHollow;
560 m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
561 m_shape.PathRevolutions = shapeBlock.PathRevolutions;
562 m_shape.PathTaperX = shapeBlock.PathTaperX;
563 m_shape.PathTaperY = shapeBlock.PathTaperY;
564 m_shape.PathTwist = shapeBlock.PathTwist;
565 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
566 ScheduleFullUpdate();
567 }
568
569 #endregion
570
571 #region Inventory
572 public void GetInventory(IClientAPI client, uint localID)
573 {
574 if (localID == this.m_localId)
575 {
576 client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
577 }
578 }
579 #endregion
580
581 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
582 {
583 this.m_shape.ExtraParams = new byte[data.Length + 7];
584 int i =0;
585 uint length = (uint) data.Length;
586 this.m_shape.ExtraParams[i++] = 1;
587 this.m_shape.ExtraParams[i++] = (byte)(type % 256);
588 this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256);
589
590 this.m_shape.ExtraParams[i++] = (byte)(length % 256);
591 this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256);
592 this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256);
593 this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256);
594 Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length);
595
596 this.ScheduleFullUpdate();
597 }
598
599 #region Texture
600
601 /// <summary>
602 ///
603 /// </summary>
604 /// <param name="textureEntry"></param>
605 public void UpdateTextureEntry(byte[] textureEntry)
606 {
607 m_shape.TextureEntry = textureEntry;
608 ScheduleFullUpdate();
609 }
610
611 #endregion
612
613 public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem)
614 {
615 this.m_particleSystem = pSystem.GetBytes();
616 ScheduleFullUpdate();
617 }
618
619 #region Client Update Methods
620
621 /// <summary>
622 ///
623 /// </summary>
624 /// <param name="remoteClient"></param>
625 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
626 {
627
628 SendFullUpdateToClient(remoteClient);
629 for (int i = 0; i < m_children.Count; i++)
630
631 {
632
633 if (m_children[i] is Primitive)
634 {
635 ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient);
636 }
637 }
638 }
639
640 /// <summary>
641 ///
642 /// </summary>
643 /// <param name="remoteClient"></param>
644 public void SendFullUpdateToClient(IClientAPI remoteClient)
645 {
646 LLVector3 lPos;
647 lPos = AbsolutePosition;
648 LLQuaternion lRot;
649 lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w);
650
651 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_shape, lPos, m_flags, m_uuid, OwnerID,
652 m_text, ParentID, this.m_particleSystem, lRot);
653 }
654
655 /// <summary>
656 ///
657 /// </summary>
658 public void SendFullUpdateToAllClients()
659 {
660 List<ScenePresence> avatars = m_scene.RequestAvatarList();
661 for (int i = 0; i < avatars.Count; i++)
662 {
663 SendFullUpdateToClient(avatars[i].ControllingClient);
664 }
665 }
666
667 /// <summary>
668 ///
669 /// </summary>
670 /// <param name="remoteClient"></param>
671 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
672 {
673
674 SendTerseUpdateToClient(remoteClient);
675 for (int i = 0; i < m_children.Count; i++)
676 {
677 if (m_children[i] is Primitive)
678 {
679 ((Primitive)m_children[i]).SendTerseUpdateForAllChildren(remoteClient);
680 }
681 }
682 }
683
684 /// <summary>
685 ///
686 /// </summary>
687 /// <param name="RemoteClient"></param>
688 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
689 {
690 LLVector3 lPos;
691 Quaternion lRot;
692
693 lPos = AbsolutePosition;
694 lRot = Rotation;
695
696 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
697 RemoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalId, lPos, mRot);
698 }
699
700 /// <summary>
701 ///
702 /// </summary>
703 public void SendTerseUpdateToALLClients()
704 {
705 List<ScenePresence> avatars = m_scene.RequestAvatarList();
706 for (int i = 0; i < avatars.Count; i++)
707 {
708 SendTerseUpdateToClient(avatars[i].ControllingClient);
709 }
710 }
711
712 #endregion
713
714 public void TriggerOnPrimCountTainted()
715 {
716 OnPrimCountTainted();
717 }
718
719 public override void SetText(string text, Vector3 color, double alpha)
720 {
721 throw new Exception("The method or operation is not implemented.");
722 }
723 }
724} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index e0fd459..16cd484 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -281,11 +281,9 @@ namespace OpenSim.Region.Environment.Scenes
281 281
282 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 282 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
283 ((SceneObjectGroup)ent).GetProperites(remoteClient); 283 ((SceneObjectGroup)ent).GetProperites(remoteClient);
284
285 } 284 }
286 } 285 }
287 } 286 }
288
289 } 287 }
290 } 288 }
291 } 289 }
@@ -301,7 +299,6 @@ namespace OpenSim.Region.Environment.Scenes
301 { 299 {
302 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 300 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
303 301
304
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 302 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 303 {
307 //currently following code not used (or don't know of any case of destination being zero 304 //currently following code not used (or don't know of any case of destination being zero
@@ -421,8 +418,6 @@ namespace OpenSim.Region.Environment.Scenes
421 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 418 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
422 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 419 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
423 } 420 }
424
425
426 } 421 }
427 422
428} 423}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 49ba655..1fca719 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -513,13 +513,7 @@ namespace OpenSim.Region.Environment.Scenes
513 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 513 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
514 } 514 }
515 515
516 /// <summary> 516
517 /// Loads a specific object from storage
518 /// </summary>
519 /// <param name="prim">The object to load</param>
520 public void PrimFromStorage(PrimData prim)
521 {
522 }
523 517
524 /// <summary> 518 /// <summary>
525 /// Returns a new unallocated primitive ID 519 /// Returns a new unallocated primitive ID
@@ -603,7 +597,7 @@ namespace OpenSim.Region.Environment.Scenes
603 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to 597 /// Called by a prim when it has been created/cloned, so that its events can be subscribed to
604 /// </summary> 598 /// </summary>
605 /// <param name="prim"></param> 599 /// <param name="prim"></param>
606 public void AcknowledgeNewPrim(Primitive prim) 600 public void AcknowledgeNewPrim(SceneObjectGroup prim)
607 { 601 {
608 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; 602 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
609 } 603 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
deleted file mode 100644
index 6f06b5a..0000000
--- a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
+++ /dev/null
@@ -1,319 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.Collections.Generic;
29using System.Text;
30using System.IO;
31using System.Xml;
32using System.Xml.Serialization;
33using libsecondlife;
34using libsecondlife.Packets;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types;
37using OpenSim.Physics.Manager;
38
39namespace OpenSim.Region.Environment.Scenes
40{
41 public class SceneObjectOLD : EntityBase
42 {
43 private Encoding enc = Encoding.ASCII;
44 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
45 public Primitive rootPrimitive;
46 protected ulong m_regionHandle;
47
48 private EventManager m_eventManager;
49
50 public bool isSelected = false;
51
52 public LLUUID rootUUID
53 {
54 get
55 {
56 this.m_uuid = this.rootPrimitive.m_uuid;
57 return this.m_uuid;
58 }
59 }
60
61 public uint rootLocalID
62 {
63 get
64 {
65 this.m_localId = this.rootPrimitive.LocalId;
66 return this.LocalId;
67 }
68 }
69
70 public int primCount
71 {
72 get
73 {
74 return this.ChildPrimitives.Count;
75 }
76 }
77
78 public Dictionary<LLUUID, Primitive> Children
79 {
80 get
81 {
82 return this.ChildPrimitives;
83 }
84 }
85
86 /// <summary>
87 ///
88 /// </summary>
89 public SceneObjectOLD(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
90 {
91 m_regionHandle = world.RegionInfo.RegionHandle;
92 m_scene = world;
93 m_eventManager = eventManager;
94
95 this.AbsolutePosition = pos;
96 this.CreateRootFromShape(ownerID, localID, shape, pos);
97
98 registerEvents();
99 }
100
101 /// <summary>
102 ///
103 /// </summary>
104 /// <remarks>Need a null constructor for duplication</remarks>
105 public SceneObjectOLD()
106 {
107
108 }
109
110 public void registerEvents()
111 {
112 m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup);
113 m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
114 }
115
116 public void unregisterEvents()
117 {
118 m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup);
119 m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
120 }
121
122 /// <summary>
123 /// Processes backup
124 /// </summary>
125 /// <param name="datastore"></param>
126 public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
127 {
128 // datastore.StoreObject(this);
129 }
130
131 /// <summary>
132 /// Sends my primitive info to the land manager for it to keep tally of all of the prims!
133 /// </summary>
134 private void ProcessParcelPrimCountUpdate()
135 {
136
137 // m_eventManager.TriggerParcelPrimCountAdd(this);
138 }
139
140 /// <summary>
141 ///
142 /// </summary>
143 /// <param name="addPacket"></param>
144 /// <param name="agentID"></param>
145 /// <param name="localID"></param>
146 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
147 {
148
149 // this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos);
150 this.m_children.Add(rootPrimitive);
151
152 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
153 }
154
155 /// <summary>
156 ///
157 /// </summary>
158 /// <param name="data"></param>
159 public void CreateFromBytes(byte[] data)
160 {
161
162 }
163
164 /// <summary>
165 /// Makes a copy of this SceneObject (and child primitives)
166 /// </summary>
167 /// <returns>A complete copy of the object</returns>
168 public new SceneObjectOLD Copy()
169 {
170 SceneObjectOLD dupe = new SceneObjectOLD();
171
172 dupe.m_scene = this.m_scene;
173 dupe.m_eventManager = this.m_eventManager;
174 dupe.m_regionHandle = this.m_regionHandle;
175 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
176 dupe.rootPrimitive = newRoot;
177
178 dupe.m_children.Add(dupe.rootPrimitive);
179 dupe.rootPrimitive.AbsolutePosition = this.AbsolutePosition;
180 dupe.Rotation = this.Rotation;
181 dupe.LocalId = m_scene.PrimIDAllocate();
182
183 dupe.registerEvents();
184 return dupe;
185 }
186
187 /// <summary>
188 ///
189 /// </summary>
190 public void Serialise()
191 {
192
193 }
194
195 /// <summary>
196 ///
197 /// </summary>
198 public void DeleteAllChildren()
199 {
200 this.m_children.Clear();
201 this.ChildPrimitives.Clear();
202 this.rootPrimitive = null;
203 unregisterEvents();
204 }
205
206 /// <summary>
207 ///
208 /// </summary>
209 /// <param name="primObject"></param>
210 public void AddNewChildPrims(SceneObjectOLD primObject)
211 {
212 this.rootPrimitive.AddNewChildren(primObject);
213 }
214
215 public void AddChildToList(Primitive prim)
216 {
217 if (!this.ChildPrimitives.ContainsKey(prim.m_uuid))
218 {
219 this.ChildPrimitives.Add(prim.m_uuid, prim);
220 }
221 }
222 /// <summary>
223 ///
224 /// </summary>
225 /// <param name="primID"></param>
226 /// <returns></returns>
227 public Primitive HasChildPrim(LLUUID primID)
228 {
229 if (this.ChildPrimitives.ContainsKey(primID))
230 {
231 return this.ChildPrimitives[primID];
232 }
233
234 return null;
235 }
236
237 /// <summary>
238 ///
239 /// </summary>
240 /// <param name="localID"></param>
241 /// <returns></returns>
242 public Primitive HasChildPrim(uint localID)
243 {
244 Primitive returnPrim = null;
245 foreach (Primitive prim in this.ChildPrimitives.Values)
246 {
247 if (prim.LocalId == localID)
248 {
249 returnPrim = prim;
250 break;
251 }
252 }
253 return returnPrim;
254 }
255
256 public void SendAllChildPrimsToClient(IClientAPI client)
257 {
258 this.rootPrimitive.SendFullUpdateForAllChildren(client);
259 }
260
261 /// <summary>
262 ///
263 /// </summary>
264 public override void BackUp()
265 {
266
267 }
268
269 /// <summary>
270 ///
271 /// </summary>
272 /// <param name="offset"></param>
273 /// <param name="pos"></param>
274 /// <param name="remoteClient"></param>
275 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
276 {
277 this.rootPrimitive.AbsolutePosition = pos;
278 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
279 }
280
281 /// <summary>
282 ///
283 /// </summary>
284 /// <param name="client"></param>
285 public void GetProperites(IClientAPI client)
286 {
287 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
288 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
289 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
290 proper.ObjectData[0].ItemID = LLUUID.Zero;
291 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
292 proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
293 proper.ObjectData[0].FolderID = LLUUID.Zero;
294 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
295 proper.ObjectData[0].GroupID = LLUUID.Zero;
296 proper.ObjectData[0].InventorySerial = 0;
297 proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
298 proper.ObjectData[0].ObjectID = this.rootUUID;
299 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
300 proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
301 proper.ObjectData[0].TextureID = new byte[0];
302 proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0");
303 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0");
304 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0");
305 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
306 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
307 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
308 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
309 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
310
311 client.OutPacket(proper);
312 }
313
314 public override void SetText(string text, Axiom.Math.Vector3 color, double alpha)
315 {
316 throw new System.Exception("The method or operation is not implemented.");
317 }
318 }
319}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index b3e3fe3..2fd7b57 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -14,7 +14,7 @@ using OpenSim.Framework.Data;
14 14
15namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
16{ 16{
17 // public delegate void PrimCountTaintedDelegate(); 17 public delegate void PrimCountTaintedDelegate();
18 18
19 public class SceneObjectGroup : EntityBase 19 public class SceneObjectGroup : EntityBase
20 { 20 {
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
index 97b1ada..80d77f2 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Scripting.Examples
51 }*/ 51 }*/
52 } 52 }
53 53
54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim) 54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim)
55 { 55 {
56 /*string desc = prim.Description; 56 /*string desc = prim.Description;
57 string name = prim.Name; 57 string name = prim.Name;
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
index 7cfdb46..9c950f8 100644
--- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
@@ -7,7 +7,6 @@ using OpenSim.Framework.Types;
7using System.Timers; 7using System.Timers;
8using System.Diagnostics; 8using System.Diagnostics;
9using System.IO; 9using System.IO;
10using Primitive = OpenSim.Region.Environment.Scenes.Primitive;
11 10
12namespace SimpleApp 11namespace SimpleApp
13{ 12{
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index daa4203..2346109 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -12,7 +12,6 @@ using OpenSim.Region.Capabilities;
12using OpenSim.Region.ClientStack; 12using OpenSim.Region.ClientStack;
13using OpenSim.Region.Communications.Local; 13using OpenSim.Region.Communications.Local;
14using OpenSim.Framework.Communications.Caches; 14using OpenSim.Framework.Communications.Caches;
15using OpenSim.Region.GridInterfaces.Local;
16using System.Timers; 15using System.Timers;
17using OpenSim.Region.Environment.Scenes; 16using OpenSim.Region.Environment.Scenes;
18using OpenSim.Framework.Data; 17using OpenSim.Framework.Data;
diff --git a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs
deleted file mode 100644
index 61adf80..0000000
--- a/OpenSim/Region/GridInterfaces/Local/AssemblyInfo.cs
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.Reflection;
29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following
31// attributes.
32//
33// change them to the information which is associated with the assembly
34// you compile.
35
36[assembly: AssemblyTitle("LocalGridServers")]
37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("LocalGridServers")]
41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")]
44
45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)]
48
49// The assembly version has following format :
50//
51// Major.Minor.Build.Revision
52//
53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default):
55
56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
deleted file mode 100644
index 835212e..0000000
--- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
+++ /dev/null
@@ -1,403 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.IO;
30using System.Threading;
31using Db4objects.Db4o;
32using Db4objects.Db4o.Query;
33using libsecondlife;
34using Nini.Config;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types;
38using OpenSim.Framework.Utilities;
39
40namespace OpenSim.Region.GridInterfaces.Local
41{
42 public class LocalAssetPlugin : IAssetPlugin
43 {
44 public LocalAssetPlugin()
45 {
46
47 }
48
49 public IAssetServer GetAssetServer()
50 {
51 return (new LocalAssetServer());
52 }
53 }
54
55 public class LocalAssetServer : IAssetServer
56 {
57 private IAssetReceiver _receiver;
58 private BlockingQueue<ARequest> _assetRequests;
59 private IObjectContainer db;
60 private Thread _localAssetServerThread;
61
62 public LocalAssetServer()
63 {
64 bool yapfile;
65 this._assetRequests = new BlockingQueue<ARequest>();
66 yapfile = File.Exists(Path.Combine(Util.dataDir(),"regionassets.yap"));
67
68 MainLog.Instance.Verbose("Local Asset Server class created");
69 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(),"regionassets.yap"));
70 MainLog.Instance.Verbose("Db4 Asset database creation");
71
72 if (!yapfile)
73 {
74 this.SetUpAssetDatabase();
75 }
76
77 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
78 this._localAssetServerThread.IsBackground = true;
79 this._localAssetServerThread.Start();
80
81 }
82
83 public void SetReceiver(IAssetReceiver receiver)
84 {
85 this._receiver = receiver;
86 }
87
88 public void RequestAsset(LLUUID assetID, bool isTexture)
89 {
90 ARequest req = new ARequest();
91 req.AssetID = assetID;
92 req.IsTexture = isTexture;
93 this._assetRequests.Enqueue(req);
94 }
95
96 public void UpdateAsset(AssetBase asset)
97 {
98
99 }
100
101 public void UploadNewAsset(AssetBase asset)
102 {
103 AssetStorage store = new AssetStorage();
104 store.Data = asset.Data;
105 store.Name = asset.Name;
106 store.UUID = asset.FullID;
107 db.Set(store);
108 db.Commit();
109 }
110
111 public void SetServerInfo(string ServerUrl, string ServerKey)
112 {
113
114 }
115 public void Close()
116 {
117 if (db != null)
118 {
119 MainLog.Instance.Verbose("Closing local asset server database");
120 db.Close();
121 }
122 }
123
124 private void RunRequests()
125 {
126 while (true)
127 {
128 byte[] idata = null;
129 bool found = false;
130 AssetStorage foundAsset = null;
131 ARequest req = this._assetRequests.Dequeue();
132 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
133 if (result.Count > 0)
134 {
135 foundAsset = (AssetStorage)result.Next();
136 found = true;
137 }
138
139 AssetBase asset = new AssetBase();
140 if (found)
141 {
142 asset.FullID = foundAsset.UUID;
143 asset.Type = foundAsset.Type;
144 asset.InvType = foundAsset.Type;
145 asset.Name = foundAsset.Name;
146 idata = foundAsset.Data;
147 asset.Data = idata;
148 _receiver.AssetReceived(asset, req.IsTexture);
149 }
150 else
151 {
152 //asset.FullID = ;
153 _receiver.AssetNotFound(req.AssetID);
154 }
155
156 }
157
158 }
159
160 private void SetUpAssetDatabase()
161 {
162 MainLog.Instance.Verbose("Setting up asset database");
163
164 AssetBase Image = new AssetBase();
165 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
166 Image.Name = "Bricks";
167 this.LoadAsset(Image, true, "bricks.jp2");
168 AssetStorage store = new AssetStorage();
169 store.Data = Image.Data;
170 store.Name = Image.Name;
171 store.UUID = Image.FullID;
172 db.Set(store);
173 db.Commit();
174
175 Image = new AssetBase();
176 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
177 Image.Name = "Plywood";
178 this.LoadAsset(Image, true, "plywood.jp2");
179 store = new AssetStorage();
180 store.Data = Image.Data;
181 store.Name = Image.Name;
182 store.UUID = Image.FullID;
183 db.Set(store);
184 db.Commit();
185
186 Image = new AssetBase();
187 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
188 Image.Name = "Rocks";
189 this.LoadAsset(Image, true, "rocks.jp2");
190 store = new AssetStorage();
191 store.Data = Image.Data;
192 store.Name = Image.Name;
193 store.UUID = Image.FullID;
194 db.Set(store);
195 db.Commit();
196
197 Image = new AssetBase();
198 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
199 Image.Name = "Granite";
200 this.LoadAsset(Image, true, "granite.jp2");
201 store = new AssetStorage();
202 store.Data = Image.Data;
203 store.Name = Image.Name;
204 store.UUID = Image.FullID;
205 db.Set(store);
206 db.Commit();
207
208 Image = new AssetBase();
209 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
210 Image.Name = "Hardwood";
211 this.LoadAsset(Image, true, "hardwood.jp2");
212 store = new AssetStorage();
213 store.Data = Image.Data;
214 store.Name = Image.Name;
215 store.UUID = Image.FullID;
216 db.Set(store);
217 db.Commit();
218
219 Image = new AssetBase();
220 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
221 Image.Name = "Prim Base Texture";
222 this.LoadAsset(Image, true, "plywood.jp2");
223 store = new AssetStorage();
224 store.Data = Image.Data;
225 store.Name = Image.Name;
226 store.UUID = Image.FullID;
227 db.Set(store);
228 db.Commit();
229
230 Image = new AssetBase();
231 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
232 Image.Name = "Map Base Texture";
233 this.LoadAsset(Image, true, "map_base.jp2");
234 store = new AssetStorage();
235 store.Data = Image.Data;
236 store.Name = Image.Name;
237 store.UUID = Image.FullID;
238 db.Set(store);
239 db.Commit();
240
241 Image = new AssetBase();
242 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
243 Image.Name = "Map Texture";
244 this.LoadAsset(Image, true, "map1.jp2");
245 store = new AssetStorage();
246 store.Data = Image.Data;
247 store.Name = Image.Name;
248 store.UUID = Image.FullID;
249 db.Set(store);
250 db.Commit();
251
252 Image = new AssetBase();
253 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010");
254 Image.Name = "Female Body Texture";
255 this.LoadAsset(Image, true, "femalebody.jp2");
256 store = new AssetStorage();
257 store.Data = Image.Data;
258 store.Name = Image.Name;
259 store.UUID = Image.FullID;
260 db.Set(store);
261 db.Commit();
262
263 Image = new AssetBase();
264 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011");
265 Image.Name = "Female Bottom Texture";
266 this.LoadAsset(Image, true, "femalebottom.jp2");
267 store = new AssetStorage();
268 store.Data = Image.Data;
269 store.Name = Image.Name;
270 store.UUID = Image.FullID;
271 db.Set(store);
272 db.Commit();
273
274 Image = new AssetBase();
275 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012");
276 Image.Name = "Female Face Texture";
277 this.LoadAsset(Image, true, "femaleface.jp2");
278 store = new AssetStorage();
279 store.Data = Image.Data;
280 store.Name = Image.Name;
281 store.UUID = Image.FullID;
282 db.Set(store);
283 db.Commit();
284
285 Image = new AssetBase();
286 Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb");
287 Image.Name = "Skin";
288 Image.Type = 13;
289 Image.InvType = 13;
290 this.LoadAsset(Image, false, "base_skin.dat");
291 store = new AssetStorage();
292 store.Data = Image.Data;
293 store.Name = Image.Name;
294 store.UUID = Image.FullID;
295 db.Set(store);
296 db.Commit();
297
298
299 Image = new AssetBase();
300 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
301 Image.Name = "Shape";
302 Image.Type = 13;
303 Image.InvType = 13;
304 this.LoadAsset(Image, false, "base_shape.dat");
305 store = new AssetStorage();
306 store.Data = Image.Data;
307 store.Name = Image.Name;
308 store.UUID = Image.FullID;
309 db.Set(store);
310 db.Commit();
311
312 Image = new AssetBase();
313 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110");
314 Image.Name = "Shirt";
315 Image.Type = 5;
316 Image.InvType = 18;
317 this.LoadAsset(Image, false, "newshirt.dat");
318 store = new AssetStorage();
319 store.Data = Image.Data;
320 store.Name = Image.Name;
321 store.UUID = Image.FullID;
322 db.Set(store);
323 db.Commit();
324
325 Image = new AssetBase();
326 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120");
327 Image.Name = "Shirt";
328 Image.Type = 5;
329 Image.InvType = 18;
330 this.LoadAsset(Image, false, "newpants.dat");
331 store = new AssetStorage();
332 store.Data = Image.Data;
333 store.Name = Image.Name;
334 store.UUID = Image.FullID;
335 db.Set(store);
336 db.Commit();
337
338 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
339 if(File.Exists(filePath))
340 {
341 XmlConfigSource source = new XmlConfigSource(filePath);
342 ReadAssetDetails(source);
343 }
344 }
345
346 protected void ReadAssetDetails(IConfigSource source)
347 {
348 AssetBase newAsset = null;
349 for (int i = 0; i < source.Configs.Count; i++)
350 {
351 newAsset = new AssetBase();
352 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
353 newAsset.Name = source.Configs[i].GetString("name", "");
354 newAsset.Type =(sbyte) source.Configs[i].GetInt("assetType", 0);
355 newAsset.InvType =(sbyte) source.Configs[i].GetInt("inventoryType", 0);
356 string fileName = source.Configs[i].GetString("fileName", "");
357 if (fileName != "")
358 {
359 this.LoadAsset(newAsset, false, fileName);
360 AssetStorage store = new AssetStorage();
361 store.Data = newAsset.Data;
362 store.Name = newAsset.Name;
363 store.UUID = newAsset.FullID;
364 db.Set(store);
365 db.Commit();
366 }
367 }
368 }
369
370 private void LoadAsset(AssetBase info, bool image, string filename)
371 {
372 //should request Asset from storage manager
373 //but for now read from file
374
375 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
376 string fileName = Path.Combine(dataPath, filename);
377 FileInfo fInfo = new FileInfo(fileName);
378 long numBytes = fInfo.Length;
379 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
380 byte[] idata = new byte[numBytes];
381 BinaryReader br = new BinaryReader(fStream);
382 idata = br.ReadBytes((int)numBytes);
383 br.Close();
384 fStream.Close();
385 info.Data = idata;
386 //info.loaded=true;
387 }
388 }
389 public class AssetUUIDQuery : Predicate
390 {
391 private LLUUID _findID;
392
393 public AssetUUIDQuery(LLUUID find)
394 {
395 _findID = find;
396 }
397 public bool Match(AssetStorage asset)
398 {
399 return (asset.UUID == _findID);
400 }
401 }
402
403}
diff --git a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs
deleted file mode 100644
index a658f2f..0000000
--- a/OpenSim/Region/GridInterfaces/Remote/AssemblyInfo.cs
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.Reflection;
29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following
31// attributes.
32//
33// change them to the information which is associated with the assembly
34// you compile.
35
36[assembly: AssemblyTitle("RemoteGridServers")]
37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("RemoteGridServers")]
41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")]
44
45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)]
48
49// The assembly version has following format :
50//
51// Major.Minor.Build.Revision
52//
53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default):
55
56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs
deleted file mode 100644
index f81bb8d..0000000
--- a/OpenSim/Region/GridInterfaces/Remote/RemoteAssetServer.cs
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.IO;
29using System.Net;
30using System.Text;
31using System.Threading;
32using libsecondlife;
33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities;
37
38namespace OpenSim.Region.GridInterfaces.Remote
39{
40 public class RemoteAssetServer : IAssetServer
41 {
42 private IAssetReceiver _receiver;
43 private BlockingQueue<ARequest> _assetRequests;
44 private Thread _remoteAssetServerThread;
45 private string AssetServerUrl;
46 private string AssetSendKey;
47
48 public RemoteAssetServer()
49 {
50 this._assetRequests = new BlockingQueue<ARequest>();
51 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
52 this._remoteAssetServerThread.IsBackground = true;
53 this._remoteAssetServerThread.Start();
54 MainLog.Instance.Verbose("Remote Asset Server class created");
55 }
56
57 public void SetReceiver(IAssetReceiver receiver)
58 {
59 this._receiver = receiver;
60 }
61
62 public void RequestAsset(LLUUID assetID, bool isTexture)
63 {
64 ARequest req = new ARequest();
65 req.AssetID = assetID;
66 req.IsTexture = isTexture;
67 this._assetRequests.Enqueue(req);
68 }
69
70 public void UpdateAsset(AssetBase asset)
71 {
72
73 }
74
75 public void UploadNewAsset(AssetBase asset)
76 {
77 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
78 string ret = Windows1252Encoding.GetString(asset.Data);
79 byte[] buffer = Windows1252Encoding.GetBytes(ret);
80 WebClient client = new WebClient();
81 client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer);
82
83 }
84
85 public void SetServerInfo(string ServerUrl, string ServerKey)
86 {
87 this.AssetServerUrl = ServerUrl;
88 this.AssetSendKey = ServerKey;
89 }
90
91 private void RunRequests()
92 {
93 while (true)
94 {
95 //we need to add support for the asset server not knowing about a requested asset
96 // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM
97 ARequest req = this._assetRequests.Dequeue();
98 LLUUID assetID = req.AssetID;
99 // OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID);
100 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID);
101 WebResponse AssetResponse = AssetLoad.GetResponse();
102 byte[] idata = new byte[(int)AssetResponse.ContentLength];
103 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
104 idata = br.ReadBytes((int)AssetResponse.ContentLength);
105 br.Close();
106
107 AssetBase asset = new AssetBase();
108 asset.FullID = assetID;
109 asset.Data = idata;
110 _receiver.AssetReceived(asset, req.IsTexture);
111 }
112 }
113
114 public void Close()
115 {
116
117 }
118 }
119
120 public class RemoteAssetPlugin : IAssetPlugin
121 {
122 public RemoteAssetPlugin()
123 {
124
125 }
126
127 public IAssetServer GetAssetServer()
128 {
129 return (new RemoteAssetServer());
130 }
131 }
132
133}