diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | 45 |
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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | ||
2 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
3 | using System.Text; | 4 | using System.Text; |
4 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Utilities; | ||
5 | using OpenSim.Framework.Data; | 7 | using OpenSim.Framework.Data; |
8 | using Nini.Config; | ||
6 | 9 | ||
7 | namespace OpenSim.Framework.Communications.Caches | 10 | namespace 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 | } |