aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-08-08 17:11:02 +0000
committerMW2007-08-08 17:11:02 +0000
commitcf203cf5ee809d3832daafbed12eb130bd590f5c (patch)
treee34f1266ecd9d1434153156cec76f0dd4b08a368 /OpenSim
parent* upgraded Tedd to 'developer' (diff)
downloadopensim-SC_OLD-cf203cf5ee809d3832daafbed12eb130bd590f5c.zip
opensim-SC_OLD-cf203cf5ee809d3832daafbed12eb130bd590f5c.tar.gz
opensim-SC_OLD-cf203cf5ee809d3832daafbed12eb130bd590f5c.tar.bz2
opensim-SC_OLD-cf203cf5ee809d3832daafbed12eb130bd590f5c.tar.xz
The startup set of assets in the local asset server can now be set from a xml file (OpenSimAssetSet.xml). (remember to make changes to the set, you will also need to delete the old asset .yap file, so that it is recreated).
Also the set of items in the OpenSim inventory Library can also now be set from a xml file (OpenSimLibrary.xml).
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs45
-rw-r--r--OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs2
3 files changed, 74 insertions, 6 deletions
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 9e54701..b214598 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -1,8 +1,11 @@
1using System; 1using System;
2using System.IO;
2using System.Collections.Generic; 3using System.Collections.Generic;
3using System.Text; 4using System.Text;
4using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Utilities;
5using OpenSim.Framework.Data; 7using OpenSim.Framework.Data;
8using Nini.Config;
6 9
7namespace OpenSim.Framework.Communications.Caches 10namespace OpenSim.Framework.Communications.Caches
8{ 11{
@@ -18,7 +21,7 @@ namespace OpenSim.Framework.Communications.Caches
18 this.name = "OpenSim Library"; 21 this.name = "OpenSim Library";
19 this.parentID = LLUUID.Zero; 22 this.parentID = LLUUID.Zero;
20 this.type = (short)-1; 23 this.type = (short)-1;
21 this.version = (ushort) 1; 24 this.version = (ushort)1;
22 25
23 InventoryFolder folderInfo = new InventoryFolder(); 26 InventoryFolder folderInfo = new InventoryFolder();
24 folderInfo.agentID = libOwner; 27 folderInfo.agentID = libOwner;
@@ -31,11 +34,15 @@ namespace OpenSim.Framework.Communications.Caches
31 this.m_textureFolder = folderInfo; 34 this.m_textureFolder = folderInfo;
32 35
33 this.CreateLibraryItems(); 36 this.CreateLibraryItems();
37
38 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml");
39 XmlConfigSource source = new XmlConfigSource(filePath);
40 this.ReadItemsFromFile(source);
34 } 41 }
35 42
36 private void CreateLibraryItems() 43 private void CreateLibraryItems()
37 { 44 {
38 45
39 InventoryItemBase item = new InventoryItemBase(); 46 InventoryItemBase item = new InventoryItemBase();
40 item.avatarID = libOwner; 47 item.avatarID = libOwner;
41 item.creatorsID = libOwner; 48 item.creatorsID = libOwner;
@@ -167,6 +174,7 @@ namespace OpenSim.Framework.Communications.Caches
167 item.inventoryNextPermissions = 0; 174 item.inventoryNextPermissions = 0;
168 this.Items.Add(item.inventoryID, item); 175 this.Items.Add(item.inventoryID, item);
169 176
177 /*
170 item = new InventoryItemBase(); 178 item = new InventoryItemBase();
171 item.avatarID = libOwner; 179 item.avatarID = libOwner;
172 item.creatorsID = libOwner; 180 item.creatorsID = libOwner;
@@ -181,7 +189,38 @@ namespace OpenSim.Framework.Communications.Caches
181 item.inventoryNextPermissions = (1 << 15); 189 item.inventoryNextPermissions = (1 << 15);
182 item.inventoryEveryOnePermissions = (1 << 15); 190 item.inventoryEveryOnePermissions = (1 << 15);
183 item.inventoryBasePermissions = (1 << 15); 191 item.inventoryBasePermissions = (1 << 15);
184 this.Items.Add(item.inventoryID, item); 192 this.Items.Add(item.inventoryID, item);
193 */
194 }
195
196 private void ReadItemsFromFile(IConfigSource source)
197 {
198 for (int i = 0; i < source.Configs.Count; i++)
199 {
200 InventoryItemBase item = new InventoryItemBase();
201 item.avatarID = libOwner;
202 item.creatorsID = libOwner;
203 item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated()));
204 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
205 item.inventoryDescription = source.Configs[i].GetString("description", "");
206 item.inventoryName = source.Configs[i].GetString("name", "");
207 item.assetType = source.Configs[i].GetInt("assetType", 0);
208 item.invType = source.Configs[i].GetInt("inventoryType", 0);
209 item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF);
210 item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF);
211 item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
212 item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
213 if (item.assetType == 0)
214 {
215 item.parentFolderID = this.m_textureFolder.folderID;
216 this.m_textureFolder.Items.Add(item.inventoryID, item);
217 }
218 else
219 {
220 item.parentFolderID = this.folderID;
221 this.Items.Add(item.inventoryID, item);
222 }
223 }
185 } 224 }
186 225
187 } 226 }
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
index ea4824b..17d2680 100644
--- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
+++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs
@@ -31,6 +31,7 @@ using System.Threading;
31using Db4objects.Db4o; 31using Db4objects.Db4o;
32using Db4objects.Db4o.Query; 32using Db4objects.Db4o.Query;
33using libsecondlife; 33using libsecondlife;
34using Nini.Config;
34using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 37using OpenSim.Framework.Types;
@@ -345,7 +346,7 @@ namespace OpenSim.Region.GridInterfaces.Local
345 db.Set(store); 346 db.Set(store);
346 db.Commit(); 347 db.Commit();
347 348
348 Image = new AssetBase(); 349 /*Image = new AssetBase();
349 Image.FullID = new LLUUID("00000000-0000-2222-3333-000000000001"); 350 Image.FullID = new LLUUID("00000000-0000-2222-3333-000000000001");
350 Image.Name = "WelcomeNote"; 351 Image.Name = "WelcomeNote";
351 Image.Type = 7; 352 Image.Type = 7;
@@ -357,7 +358,35 @@ namespace OpenSim.Region.GridInterfaces.Local
357 store.UUID = Image.FullID; 358 store.UUID = Image.FullID;
358 db.Set(store); 359 db.Set(store);
359 db.Commit(); 360 db.Commit();
360 361 */
362
363 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
364 XmlConfigSource source = new XmlConfigSource(filePath);
365 ReadAssetDetails(source);
366 }
367
368 protected void ReadAssetDetails(IConfigSource source)
369 {
370 AssetBase newAsset = null;
371 for (int i = 0; i < source.Configs.Count; i++)
372 {
373 newAsset = new AssetBase();
374 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
375 newAsset.Name = source.Configs[i].GetString("name", "");
376 newAsset.Type =(sbyte) source.Configs[i].GetInt("assetType", 0);
377 newAsset.InvType =(sbyte) source.Configs[i].GetInt("inventoryType", 0);
378 string fileName = source.Configs[i].GetString("fileName", "");
379 if (fileName != "")
380 {
381 this.LoadAsset(newAsset, false, fileName);
382 AssetStorage store = new AssetStorage();
383 store.Data = newAsset.Data;
384 store.Name = newAsset.Name;
385 store.UUID = newAsset.FullID;
386 db.Set(store);
387 db.Commit();
388 }
389 }
361 } 390 }
362 391
363 private void LoadAsset(AssetBase info, bool image, string filename) 392 private void LoadAsset(AssetBase info, bool image, string filename)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs
index 81caf2d..2db35c4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine.Compiler.LSL/Engine.cs
@@ -30,7 +30,7 @@ using System;
30using System.Reflection; 30using System.Reflection;
31using System.Reflection.Emit; 31using System.Reflection.Emit;
32using System.Threading; 32using System.Threading;
33//using System.Windows.Forms; 33
34 34
35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
36{ 36{