diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServer.cs | 392 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCache.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/PrimData.cs | 228 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/RegionInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/General/UserProfile.cs | 87 |
6 files changed, 397 insertions, 320 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 1b3bb18..3d31ba6 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
72 | /// </summary> | 72 | /// </summary> |
73 | public AssetCache(IAssetServer assetServer) | 73 | public AssetCache(IAssetServer assetServer) |
74 | { | 74 | { |
75 | Console.WriteLine("Creating Asset cache"); | 75 | System.Console.WriteLine("Creating Asset cache"); |
76 | _assetServer = assetServer; | 76 | _assetServer = assetServer; |
77 | _assetServer.SetReceiver(this); | 77 | _assetServer.SetReceiver(this); |
78 | Assets = new Dictionary<LLUUID, AssetInfo>(); | 78 | Assets = new Dictionary<LLUUID, AssetInfo>(); |
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
89 | 89 | ||
90 | public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) | 90 | public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) |
91 | { | 91 | { |
92 | Console.WriteLine("Creating Asset cache"); | 92 | System.Console.WriteLine("Creating Asset cache"); |
93 | _assetServer = this.LoadAssetDll(assetServerDLLName); | 93 | _assetServer = this.LoadAssetDll(assetServerDLLName); |
94 | _assetServer.SetServerInfo(assetServerURL, assetServerKey); | 94 | _assetServer.SetServerInfo(assetServerURL, assetServerKey); |
95 | _assetServer.SetReceiver(this); | 95 | _assetServer.SetReceiver(this); |
@@ -119,7 +119,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
119 | } | 119 | } |
120 | catch (Exception e) | 120 | catch (Exception e) |
121 | { | 121 | { |
122 | Console.WriteLine(e.Message + " : " + e.StackTrace); | 122 | System.Console.WriteLine(e.Message + " : " + e.StackTrace); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } |
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs new file mode 100644 index 0000000..fd203f7 --- /dev/null +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs | |||
@@ -0,0 +1,392 @@ | |||
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 | */ | ||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Threading; | ||
31 | using Db4objects.Db4o; | ||
32 | using Db4objects.Db4o.Query; | ||
33 | using libsecondlife; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework.Types; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | |||
40 | namespace OpenSim.Framework.Communications.Caches | ||
41 | { | ||
42 | |||
43 | public class LocalAssetServer : IAssetServer | ||
44 | { | ||
45 | private IAssetReceiver _receiver; | ||
46 | private BlockingQueue<ARequest> _assetRequests; | ||
47 | private IObjectContainer db; | ||
48 | private Thread _localAssetServerThread; | ||
49 | |||
50 | public LocalAssetServer() | ||
51 | { | ||
52 | bool yapfile; | ||
53 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
54 | yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); | ||
55 | |||
56 | MainLog.Instance.Verbose("Local Asset Server class created"); | ||
57 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); | ||
58 | MainLog.Instance.Verbose("Db4 Asset database creation"); | ||
59 | |||
60 | if (!yapfile) | ||
61 | { | ||
62 | this.SetUpAssetDatabase(); | ||
63 | } | ||
64 | |||
65 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
66 | this._localAssetServerThread.IsBackground = true; | ||
67 | this._localAssetServerThread.Start(); | ||
68 | |||
69 | } | ||
70 | |||
71 | public void SetReceiver(IAssetReceiver receiver) | ||
72 | { | ||
73 | this._receiver = receiver; | ||
74 | } | ||
75 | |||
76 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
77 | { | ||
78 | ARequest req = new ARequest(); | ||
79 | req.AssetID = assetID; | ||
80 | req.IsTexture = isTexture; | ||
81 | this._assetRequests.Enqueue(req); | ||
82 | } | ||
83 | |||
84 | public void UpdateAsset(AssetBase asset) | ||
85 | { | ||
86 | |||
87 | } | ||
88 | |||
89 | public void UploadNewAsset(AssetBase asset) | ||
90 | { | ||
91 | AssetStorage store = new AssetStorage(); | ||
92 | store.Data = asset.Data; | ||
93 | store.Name = asset.Name; | ||
94 | store.UUID = asset.FullID; | ||
95 | db.Set(store); | ||
96 | db.Commit(); | ||
97 | } | ||
98 | |||
99 | public void SetServerInfo(string ServerUrl, string ServerKey) | ||
100 | { | ||
101 | |||
102 | } | ||
103 | public void Close() | ||
104 | { | ||
105 | if (db != null) | ||
106 | { | ||
107 | MainLog.Instance.Verbose("Closing local asset server database"); | ||
108 | db.Close(); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | private void RunRequests() | ||
113 | { | ||
114 | while (true) | ||
115 | { | ||
116 | byte[] idata = null; | ||
117 | bool found = false; | ||
118 | AssetStorage foundAsset = null; | ||
119 | ARequest req = this._assetRequests.Dequeue(); | ||
120 | IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); | ||
121 | if (result.Count > 0) | ||
122 | { | ||
123 | foundAsset = (AssetStorage)result.Next(); | ||
124 | found = true; | ||
125 | } | ||
126 | |||
127 | AssetBase asset = new AssetBase(); | ||
128 | if (found) | ||
129 | { | ||
130 | asset.FullID = foundAsset.UUID; | ||
131 | asset.Type = foundAsset.Type; | ||
132 | asset.InvType = foundAsset.Type; | ||
133 | asset.Name = foundAsset.Name; | ||
134 | idata = foundAsset.Data; | ||
135 | asset.Data = idata; | ||
136 | _receiver.AssetReceived(asset, req.IsTexture); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | //asset.FullID = ; | ||
141 | _receiver.AssetNotFound(req.AssetID); | ||
142 | } | ||
143 | |||
144 | } | ||
145 | |||
146 | } | ||
147 | |||
148 | private void SetUpAssetDatabase() | ||
149 | { | ||
150 | MainLog.Instance.Verbose("Setting up asset database"); | ||
151 | |||
152 | AssetBase Image = new AssetBase(); | ||
153 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
154 | Image.Name = "Bricks"; | ||
155 | this.LoadAsset(Image, true, "bricks.jp2"); | ||
156 | AssetStorage store = new AssetStorage(); | ||
157 | store.Data = Image.Data; | ||
158 | store.Name = Image.Name; | ||
159 | store.UUID = Image.FullID; | ||
160 | db.Set(store); | ||
161 | db.Commit(); | ||
162 | |||
163 | Image = new AssetBase(); | ||
164 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
165 | Image.Name = "Plywood"; | ||
166 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
167 | store = new AssetStorage(); | ||
168 | store.Data = Image.Data; | ||
169 | store.Name = Image.Name; | ||
170 | store.UUID = Image.FullID; | ||
171 | db.Set(store); | ||
172 | db.Commit(); | ||
173 | |||
174 | Image = new AssetBase(); | ||
175 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
176 | Image.Name = "Rocks"; | ||
177 | this.LoadAsset(Image, true, "rocks.jp2"); | ||
178 | store = new AssetStorage(); | ||
179 | store.Data = Image.Data; | ||
180 | store.Name = Image.Name; | ||
181 | store.UUID = Image.FullID; | ||
182 | db.Set(store); | ||
183 | db.Commit(); | ||
184 | |||
185 | Image = new AssetBase(); | ||
186 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
187 | Image.Name = "Granite"; | ||
188 | this.LoadAsset(Image, true, "granite.jp2"); | ||
189 | store = new AssetStorage(); | ||
190 | store.Data = Image.Data; | ||
191 | store.Name = Image.Name; | ||
192 | store.UUID = Image.FullID; | ||
193 | db.Set(store); | ||
194 | db.Commit(); | ||
195 | |||
196 | Image = new AssetBase(); | ||
197 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
198 | Image.Name = "Hardwood"; | ||
199 | this.LoadAsset(Image, true, "hardwood.jp2"); | ||
200 | store = new AssetStorage(); | ||
201 | store.Data = Image.Data; | ||
202 | store.Name = Image.Name; | ||
203 | store.UUID = Image.FullID; | ||
204 | db.Set(store); | ||
205 | db.Commit(); | ||
206 | |||
207 | Image = new AssetBase(); | ||
208 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | ||
209 | Image.Name = "Prim Base Texture"; | ||
210 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
211 | store = new AssetStorage(); | ||
212 | store.Data = Image.Data; | ||
213 | store.Name = Image.Name; | ||
214 | store.UUID = Image.FullID; | ||
215 | db.Set(store); | ||
216 | db.Commit(); | ||
217 | |||
218 | Image = new AssetBase(); | ||
219 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); | ||
220 | Image.Name = "Map Base Texture"; | ||
221 | this.LoadAsset(Image, true, "map_base.jp2"); | ||
222 | store = new AssetStorage(); | ||
223 | store.Data = Image.Data; | ||
224 | store.Name = Image.Name; | ||
225 | store.UUID = Image.FullID; | ||
226 | db.Set(store); | ||
227 | db.Commit(); | ||
228 | |||
229 | Image = new AssetBase(); | ||
230 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); | ||
231 | Image.Name = "Map Texture"; | ||
232 | this.LoadAsset(Image, true, "map1.jp2"); | ||
233 | store = new AssetStorage(); | ||
234 | store.Data = Image.Data; | ||
235 | store.Name = Image.Name; | ||
236 | store.UUID = Image.FullID; | ||
237 | db.Set(store); | ||
238 | db.Commit(); | ||
239 | |||
240 | Image = new AssetBase(); | ||
241 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); | ||
242 | Image.Name = "Female Body Texture"; | ||
243 | this.LoadAsset(Image, true, "femalebody.jp2"); | ||
244 | store = new AssetStorage(); | ||
245 | store.Data = Image.Data; | ||
246 | store.Name = Image.Name; | ||
247 | store.UUID = Image.FullID; | ||
248 | db.Set(store); | ||
249 | db.Commit(); | ||
250 | |||
251 | Image = new AssetBase(); | ||
252 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); | ||
253 | Image.Name = "Female Bottom Texture"; | ||
254 | this.LoadAsset(Image, true, "femalebottom.jp2"); | ||
255 | store = new AssetStorage(); | ||
256 | store.Data = Image.Data; | ||
257 | store.Name = Image.Name; | ||
258 | store.UUID = Image.FullID; | ||
259 | db.Set(store); | ||
260 | db.Commit(); | ||
261 | |||
262 | Image = new AssetBase(); | ||
263 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); | ||
264 | Image.Name = "Female Face Texture"; | ||
265 | this.LoadAsset(Image, true, "femaleface.jp2"); | ||
266 | store = new AssetStorage(); | ||
267 | store.Data = Image.Data; | ||
268 | store.Name = Image.Name; | ||
269 | store.UUID = Image.FullID; | ||
270 | db.Set(store); | ||
271 | db.Commit(); | ||
272 | |||
273 | Image = new AssetBase(); | ||
274 | Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); | ||
275 | Image.Name = "Skin"; | ||
276 | Image.Type = 13; | ||
277 | Image.InvType = 13; | ||
278 | this.LoadAsset(Image, false, "base_skin.dat"); | ||
279 | store = new AssetStorage(); | ||
280 | store.Data = Image.Data; | ||
281 | store.Name = Image.Name; | ||
282 | store.UUID = Image.FullID; | ||
283 | db.Set(store); | ||
284 | db.Commit(); | ||
285 | |||
286 | |||
287 | Image = new AssetBase(); | ||
288 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
289 | Image.Name = "Shape"; | ||
290 | Image.Type = 13; | ||
291 | Image.InvType = 13; | ||
292 | this.LoadAsset(Image, false, "base_shape.dat"); | ||
293 | store = new AssetStorage(); | ||
294 | store.Data = Image.Data; | ||
295 | store.Name = Image.Name; | ||
296 | store.UUID = Image.FullID; | ||
297 | db.Set(store); | ||
298 | db.Commit(); | ||
299 | |||
300 | Image = new AssetBase(); | ||
301 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); | ||
302 | Image.Name = "Shirt"; | ||
303 | Image.Type = 5; | ||
304 | Image.InvType = 18; | ||
305 | this.LoadAsset(Image, false, "newshirt.dat"); | ||
306 | store = new AssetStorage(); | ||
307 | store.Data = Image.Data; | ||
308 | store.Name = Image.Name; | ||
309 | store.UUID = Image.FullID; | ||
310 | db.Set(store); | ||
311 | db.Commit(); | ||
312 | |||
313 | Image = new AssetBase(); | ||
314 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); | ||
315 | Image.Name = "Shirt"; | ||
316 | Image.Type = 5; | ||
317 | Image.InvType = 18; | ||
318 | this.LoadAsset(Image, false, "newpants.dat"); | ||
319 | store = new AssetStorage(); | ||
320 | store.Data = Image.Data; | ||
321 | store.Name = Image.Name; | ||
322 | store.UUID = Image.FullID; | ||
323 | db.Set(store); | ||
324 | db.Commit(); | ||
325 | |||
326 | string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); | ||
327 | if (File.Exists(filePath)) | ||
328 | { | ||
329 | XmlConfigSource source = new XmlConfigSource(filePath); | ||
330 | ReadAssetDetails(source); | ||
331 | } | ||
332 | } | ||
333 | |||
334 | protected void ReadAssetDetails(IConfigSource source) | ||
335 | { | ||
336 | AssetBase newAsset = null; | ||
337 | for (int i = 0; i < source.Configs.Count; i++) | ||
338 | { | ||
339 | newAsset = new AssetBase(); | ||
340 | newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); | ||
341 | newAsset.Name = source.Configs[i].GetString("name", ""); | ||
342 | newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); | ||
343 | newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); | ||
344 | string fileName = source.Configs[i].GetString("fileName", ""); | ||
345 | if (fileName != "") | ||
346 | { | ||
347 | this.LoadAsset(newAsset, false, fileName); | ||
348 | AssetStorage store = new AssetStorage(); | ||
349 | store.Data = newAsset.Data; | ||
350 | store.Name = newAsset.Name; | ||
351 | store.UUID = newAsset.FullID; | ||
352 | db.Set(store); | ||
353 | db.Commit(); | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | |||
358 | private void LoadAsset(AssetBase info, bool image, string filename) | ||
359 | { | ||
360 | //should request Asset from storage manager | ||
361 | //but for now read from file | ||
362 | |||
363 | string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; | ||
364 | string fileName = Path.Combine(dataPath, filename); | ||
365 | FileInfo fInfo = new FileInfo(fileName); | ||
366 | long numBytes = fInfo.Length; | ||
367 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | ||
368 | byte[] idata = new byte[numBytes]; | ||
369 | BinaryReader br = new BinaryReader(fStream); | ||
370 | idata = br.ReadBytes((int)numBytes); | ||
371 | br.Close(); | ||
372 | fStream.Close(); | ||
373 | info.Data = idata; | ||
374 | //info.loaded=true; | ||
375 | } | ||
376 | } | ||
377 | public class AssetUUIDQuery : Predicate | ||
378 | { | ||
379 | private LLUUID _findID; | ||
380 | |||
381 | public AssetUUIDQuery(LLUUID find) | ||
382 | { | ||
383 | _findID = find; | ||
384 | } | ||
385 | public bool Match(AssetStorage asset) | ||
386 | { | ||
387 | return (asset.UUID == _findID); | ||
388 | } | ||
389 | } | ||
390 | |||
391 | } | ||
392 | |||
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index a599a19..07d7cf4 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
70 | } | 70 | } |
71 | else | 71 | else |
72 | { | 72 | { |
73 | Console.WriteLine("CACHE", "User profile for user not found"); | 73 | System.Console.WriteLine("CACHE", "User profile for user not found"); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
diff --git a/OpenSim/Framework/General/Types/PrimData.cs b/OpenSim/Framework/General/Types/PrimData.cs deleted file mode 100644 index 9b24c0f..0000000 --- a/OpenSim/Framework/General/Types/PrimData.cs +++ /dev/null | |||
@@ -1,228 +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 | */ | ||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | |||
31 | namespace OpenSim.Framework.Types | ||
32 | { | ||
33 | public class PrimData | ||
34 | { | ||
35 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
36 | |||
37 | public LLUUID OwnerID; | ||
38 | public byte PCode; | ||
39 | public ushort PathBegin; | ||
40 | public ushort PathEnd; | ||
41 | public byte PathScaleX; | ||
42 | public byte PathScaleY; | ||
43 | public byte PathShearX; | ||
44 | public byte PathShearY; | ||
45 | public sbyte PathSkew; | ||
46 | public ushort ProfileBegin; | ||
47 | public ushort ProfileEnd; | ||
48 | public LLVector3 Scale; | ||
49 | public byte PathCurve; | ||
50 | public byte ProfileCurve; | ||
51 | public uint ParentID = 0; | ||
52 | public ushort ProfileHollow; | ||
53 | public sbyte PathRadiusOffset; | ||
54 | public byte PathRevolutions; | ||
55 | public sbyte PathTaperX; | ||
56 | public sbyte PathTaperY; | ||
57 | public sbyte PathTwist; | ||
58 | public sbyte PathTwistBegin; | ||
59 | public byte[] TextureEntry; // a LL textureEntry in byte[] format | ||
60 | |||
61 | public Int32 CreationDate; | ||
62 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
63 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
64 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
65 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
66 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
67 | |||
68 | //following only used during prim storage | ||
69 | public LLVector3 Position; | ||
70 | public LLQuaternion Rotation = new LLQuaternion(0, 1, 0, 0); | ||
71 | public uint LocalID; | ||
72 | public LLUUID FullID; | ||
73 | |||
74 | public PrimData() | ||
75 | { | ||
76 | |||
77 | } | ||
78 | |||
79 | public PrimData(byte[] data) | ||
80 | { | ||
81 | int i = 0; | ||
82 | |||
83 | this.OwnerID = new LLUUID(data, i); i += 16; | ||
84 | this.PCode = data[i++]; | ||
85 | this.PathBegin = (ushort)(data[i++] + (data[i++] << 8)); | ||
86 | this.PathEnd = (ushort)(data[i++] + (data[i++] << 8)); | ||
87 | this.PathScaleX = data[i++]; | ||
88 | this.PathScaleY = data[i++]; | ||
89 | this.PathShearX = data[i++]; | ||
90 | this.PathShearY = data[i++]; | ||
91 | this.PathSkew = (sbyte)data[i++]; | ||
92 | this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8)); | ||
93 | this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8)); | ||
94 | this.Scale = new LLVector3(data, i); i += 12; | ||
95 | this.PathCurve = data[i++]; | ||
96 | this.ProfileCurve = data[i++]; | ||
97 | this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
98 | this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8)); | ||
99 | this.PathRadiusOffset = (sbyte)data[i++]; | ||
100 | this.PathRevolutions = data[i++]; | ||
101 | this.PathTaperX = (sbyte)data[i++]; | ||
102 | this.PathTaperY = (sbyte)data[i++]; | ||
103 | this.PathTwist = (sbyte)data[i++]; | ||
104 | this.PathTwistBegin = (sbyte)data[i++]; | ||
105 | ushort length = (ushort)(data[i++] + (data[i++] << 8)); | ||
106 | this.TextureEntry = new byte[length]; | ||
107 | Array.Copy(data, i, TextureEntry, 0, length); i += length; | ||
108 | this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
109 | this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
110 | this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
111 | this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
112 | this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
113 | this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
114 | this.Position = new LLVector3(data, i); i += 12; | ||
115 | this.Rotation = new LLQuaternion(data, i, true); i += 12; | ||
116 | this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
117 | this.FullID = new LLUUID(data, i); i += 16; | ||
118 | |||
119 | } | ||
120 | |||
121 | public byte[] ToBytes() | ||
122 | { | ||
123 | int i = 0; | ||
124 | byte[] bytes = new byte[126 + TextureEntry.Length]; | ||
125 | Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; | ||
126 | bytes[i++] = this.PCode; | ||
127 | bytes[i++] = (byte)(this.PathBegin % 256); | ||
128 | bytes[i++] = (byte)((this.PathBegin >> 8) % 256); | ||
129 | bytes[i++] = (byte)(this.PathEnd % 256); | ||
130 | bytes[i++] = (byte)((this.PathEnd >> 8) % 256); | ||
131 | bytes[i++] = this.PathScaleX; | ||
132 | bytes[i++] = this.PathScaleY; | ||
133 | bytes[i++] = this.PathShearX; | ||
134 | bytes[i++] = this.PathShearY; | ||
135 | bytes[i++] = (byte)this.PathSkew; | ||
136 | bytes[i++] = (byte)(this.ProfileBegin % 256); | ||
137 | bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256); | ||
138 | bytes[i++] = (byte)(this.ProfileEnd % 256); | ||
139 | bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256); | ||
140 | Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; | ||
141 | bytes[i++] = this.PathCurve; | ||
142 | bytes[i++] = this.ProfileCurve; | ||
143 | bytes[i++] = (byte)(ParentID % 256); | ||
144 | bytes[i++] = (byte)((ParentID >> 8) % 256); | ||
145 | bytes[i++] = (byte)((ParentID >> 16) % 256); | ||
146 | bytes[i++] = (byte)((ParentID >> 24) % 256); | ||
147 | bytes[i++] = (byte)(this.ProfileHollow % 256); | ||
148 | bytes[i++] = (byte)((this.ProfileHollow >> 8) % 256); | ||
149 | bytes[i++] = ((byte)this.PathRadiusOffset); | ||
150 | bytes[i++] = this.PathRevolutions; | ||
151 | bytes[i++] = ((byte)this.PathTaperX); | ||
152 | bytes[i++] = ((byte)this.PathTaperY); | ||
153 | bytes[i++] = ((byte)this.PathTwist); | ||
154 | bytes[i++] = ((byte)this.PathTwistBegin); | ||
155 | bytes[i++] = (byte)(TextureEntry.Length % 256); | ||
156 | bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256); | ||
157 | Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length; | ||
158 | bytes[i++] = (byte)(this.CreationDate % 256); | ||
159 | bytes[i++] = (byte)((this.CreationDate >> 8) % 256); | ||
160 | bytes[i++] = (byte)((this.CreationDate >> 16) % 256); | ||
161 | bytes[i++] = (byte)((this.CreationDate >> 24) % 256); | ||
162 | bytes[i++] = (byte)(this.OwnerMask % 256); | ||
163 | bytes[i++] = (byte)((this.OwnerMask >> 8) % 256); | ||
164 | bytes[i++] = (byte)((this.OwnerMask >> 16) % 256); | ||
165 | bytes[i++] = (byte)((this.OwnerMask >> 24) % 256); | ||
166 | bytes[i++] = (byte)(this.NextOwnerMask % 256); | ||
167 | bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256); | ||
168 | bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256); | ||
169 | bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256); | ||
170 | bytes[i++] = (byte)(this.GroupMask % 256); | ||
171 | bytes[i++] = (byte)((this.GroupMask >> 8) % 256); | ||
172 | bytes[i++] = (byte)((this.GroupMask >> 16) % 256); | ||
173 | bytes[i++] = (byte)((this.GroupMask >> 24) % 256); | ||
174 | bytes[i++] = (byte)(this.EveryoneMask % 256); | ||
175 | bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256); | ||
176 | bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256); | ||
177 | bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256); | ||
178 | bytes[i++] = (byte)(this.BaseMask % 256); | ||
179 | bytes[i++] = (byte)((this.BaseMask >> 8) % 256); | ||
180 | bytes[i++] = (byte)((this.BaseMask >> 16) % 256); | ||
181 | bytes[i++] = (byte)((this.BaseMask >> 24) % 256); | ||
182 | Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12; | ||
183 | if (this.Rotation == new LLQuaternion(0, 0, 0, 0)) | ||
184 | { | ||
185 | this.Rotation = new LLQuaternion(0, 1, 0, 0); | ||
186 | } | ||
187 | Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12; | ||
188 | bytes[i++] = (byte)(this.LocalID % 256); | ||
189 | bytes[i++] = (byte)((this.LocalID >> 8) % 256); | ||
190 | bytes[i++] = (byte)((this.LocalID >> 16) % 256); | ||
191 | bytes[i++] = (byte)((this.LocalID >> 24) % 256); | ||
192 | Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; | ||
193 | |||
194 | return bytes; | ||
195 | } | ||
196 | |||
197 | //public static PrimData DefaultCube() | ||
198 | //{ | ||
199 | // PrimData primData = new PrimData(); | ||
200 | // primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
201 | // primData.FullID = LLUUID.Random(); | ||
202 | // primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | ||
203 | // primData.Rotation = new LLQuaternion(0, 0, 0, 1); | ||
204 | // primData.PCode = 9; | ||
205 | // primData.ParentID = 0; | ||
206 | // primData.PathBegin = 0; | ||
207 | // primData.PathEnd = 0; | ||
208 | // primData.PathScaleX = 0; | ||
209 | // primData.PathScaleY = 0; | ||
210 | // primData.PathShearX = 0; | ||
211 | // primData.PathShearY = 0; | ||
212 | // primData.PathSkew = 0; | ||
213 | // primData.ProfileBegin = 0; | ||
214 | // primData.ProfileEnd = 0; | ||
215 | // primData.PathCurve = 16; | ||
216 | // primData.ProfileCurve = 1; | ||
217 | // primData.ProfileHollow = 0; | ||
218 | // primData.PathRadiusOffset = 0; | ||
219 | // primData.PathRevolutions = 0; | ||
220 | // primData.PathTaperX = 0; | ||
221 | // primData.PathTaperY = 0; | ||
222 | // primData.PathTwist = 0; | ||
223 | // primData.PathTwistBegin = 0; | ||
224 | |||
225 | // return primData; | ||
226 | //} | ||
227 | } | ||
228 | } | ||
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index c567aa6..b7dff17 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs | |||
@@ -216,7 +216,7 @@ namespace OpenSim.Framework.Types | |||
216 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false); | 216 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false); |
217 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); | 217 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); |
218 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); | 218 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); |
219 | configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "localworld.yap", false); | 219 | configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); |
220 | configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); | 220 | configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); |
221 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000", false); | 221 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000", false); |
222 | configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); | 222 | configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); |
diff --git a/OpenSim/Framework/General/UserProfile.cs b/OpenSim/Framework/General/UserProfile.cs deleted file mode 100644 index ec5a485..0000000 --- a/OpenSim/Framework/General/UserProfile.cs +++ /dev/null | |||
@@ -1,87 +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 | */ | ||
28 | using System.Collections.Generic; | ||
29 | using System.Security.Cryptography; | ||
30 | using libsecondlife; | ||
31 | using OpenSim.Framework.Inventory; | ||
32 | |||
33 | namespace OpenSim.Framework.User | ||
34 | { | ||
35 | public class UserProfile | ||
36 | { | ||
37 | |||
38 | public string firstname; | ||
39 | public string lastname; | ||
40 | public ulong homeregionhandle; | ||
41 | public LLVector3 homepos; | ||
42 | public LLVector3 homelookat; | ||
43 | |||
44 | public bool IsGridGod = false; | ||
45 | public bool IsLocal = true; // will be used in future for visitors from foreign grids | ||
46 | public string AssetURL; | ||
47 | public string MD5passwd; | ||
48 | |||
49 | public LLUUID CurrentSessionID; | ||
50 | public LLUUID CurrentSecureSessionID; | ||
51 | public LLUUID UUID; | ||
52 | public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes | ||
53 | |||
54 | public AgentInventory Inventory; | ||
55 | |||
56 | public UserProfile() | ||
57 | { | ||
58 | Circuits = new Dictionary<LLUUID, uint>(); | ||
59 | Inventory = new AgentInventory(); | ||
60 | homeregionhandle = Helpers.UIntsToLong((1000 * 256), (1000 * 256)); | ||
61 | homepos = new LLVector3(); | ||
62 | homelookat = new LLVector3(); | ||
63 | } | ||
64 | |||
65 | public void InitSessionData() | ||
66 | { | ||
67 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); | ||
68 | |||
69 | byte[] randDataS = new byte[16]; | ||
70 | byte[] randDataSS = new byte[16]; | ||
71 | |||
72 | rand.GetBytes(randDataS); | ||
73 | rand.GetBytes(randDataSS); | ||
74 | |||
75 | CurrentSecureSessionID = new LLUUID(randDataSS,0); | ||
76 | CurrentSessionID = new LLUUID(randDataS,0); | ||
77 | |||
78 | } | ||
79 | |||
80 | public void AddSimCircuit(uint circuitCode, LLUUID regionUUID) | ||
81 | { | ||
82 | if (this.Circuits.ContainsKey(regionUUID) == false) | ||
83 | this.Circuits.Add(regionUUID, circuitCode); | ||
84 | } | ||
85 | |||
86 | } | ||
87 | } | ||