aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
authorMW2007-08-08 17:11:02 +0000
committerMW2007-08-08 17:11:02 +0000
commitcf203cf5ee809d3832daafbed12eb130bd590f5c (patch)
treee34f1266ecd9d1434153156cec76f0dd4b08a368 /OpenSim/Framework/Communications/Cache
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/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs45
1 files changed, 42 insertions, 3 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 }