aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs82
1 files changed, 38 insertions, 44 deletions
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 60f9b6b..765c42e 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -26,12 +26,8 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.IO; 29using System.IO;
31using System.Collections.Generic;
32using System.Text;
33using libsecondlife; 30using libsecondlife;
34using OpenSim.Framework;
35using Nini.Config; 31using Nini.Config;
36 32
37namespace OpenSim.Framework.Communications.Cache 33namespace OpenSim.Framework.Communications.Cache
@@ -40,43 +36,42 @@ namespace OpenSim.Framework.Communications.Cache
40 /// Basically a hack to give us a Inventory library while we don't have a inventory server 36 /// Basically a hack to give us a Inventory library while we don't have a inventory server
41 /// once the server is fully implemented then should read the data from that 37 /// once the server is fully implemented then should read the data from that
42 /// </summary> 38 /// </summary>
43 public class LibraryRootFolder : Cache.InventoryFolderImpl 39 public class LibraryRootFolder : InventoryFolderImpl
44 { 40 {
45 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 41 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
46 private Cache.InventoryFolderImpl m_textureFolder; 42 private InventoryFolderImpl m_textureFolder;
47 43
48 public LibraryRootFolder() 44 public LibraryRootFolder()
49 { 45 {
50 this.agentID = libOwner; 46 agentID = libOwner;
51 this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); 47 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
52 this.name = "OpenSim Library"; 48 name = "OpenSim Library";
53 this.parentID = LLUUID.Zero; 49 parentID = LLUUID.Zero;
54 this.type = (short)-1; 50 type = (short) -1;
55 this.version = (ushort)1; 51 version = (ushort) 1;
56 52
57 Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl(); 53 InventoryFolderImpl folderInfo = new InventoryFolderImpl();
58 folderInfo.agentID = libOwner; 54 folderInfo.agentID = libOwner;
59 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); 55 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001");
60 folderInfo.name = "Texture Library"; 56 folderInfo.name = "Texture Library";
61 folderInfo.parentID = this.folderID; 57 folderInfo.parentID = folderID;
62 folderInfo.type = -1; 58 folderInfo.type = -1;
63 folderInfo.version = 1; 59 folderInfo.version = 1;
64 this.SubFolders.Add(folderInfo.folderID, folderInfo); 60 SubFolders.Add(folderInfo.folderID, folderInfo);
65 this.m_textureFolder = folderInfo; 61 m_textureFolder = folderInfo;
66 62
67 this.CreateLibraryItems(); 63 CreateLibraryItems();
68 64
69 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); 65 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml");
70 if (File.Exists(filePath)) 66 if (File.Exists(filePath))
71 { 67 {
72 XmlConfigSource source = new XmlConfigSource(filePath); 68 XmlConfigSource source = new XmlConfigSource(filePath);
73 this.ReadItemsFromFile(source); 69 ReadItemsFromFile(source);
74 } 70 }
75 } 71 }
76 72
77 private void CreateLibraryItems() 73 private void CreateLibraryItems()
78 { 74 {
79
80 InventoryItemBase item = new InventoryItemBase(); 75 InventoryItemBase item = new InventoryItemBase();
81 item.avatarID = libOwner; 76 item.avatarID = libOwner;
82 item.creatorsID = libOwner; 77 item.creatorsID = libOwner;
@@ -90,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache
90 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 85 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
91 item.inventoryCurrentPermissions = 0x7FFFFFFF; 86 item.inventoryCurrentPermissions = 0x7FFFFFFF;
92 item.inventoryNextPermissions = 0x7FFFFFFF; 87 item.inventoryNextPermissions = 0x7FFFFFFF;
93 this.m_textureFolder.Items.Add(item.inventoryID, item); 88 m_textureFolder.Items.Add(item.inventoryID, item);
94 89
95 item = new InventoryItemBase(); 90 item = new InventoryItemBase();
96 item.avatarID = libOwner; 91 item.avatarID = libOwner;
@@ -105,7 +100,7 @@ namespace OpenSim.Framework.Communications.Cache
105 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 100 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
106 item.inventoryCurrentPermissions = 0x7FFFFFFF; 101 item.inventoryCurrentPermissions = 0x7FFFFFFF;
107 item.inventoryNextPermissions = 0x7FFFFFFF; 102 item.inventoryNextPermissions = 0x7FFFFFFF;
108 this.m_textureFolder.Items.Add(item.inventoryID, item); 103 m_textureFolder.Items.Add(item.inventoryID, item);
109 104
110 item = new InventoryItemBase(); 105 item = new InventoryItemBase();
111 item.avatarID = libOwner; 106 item.avatarID = libOwner;
@@ -120,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache
120 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 115 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
121 item.inventoryCurrentPermissions = 0x7FFFFFFF; 116 item.inventoryCurrentPermissions = 0x7FFFFFFF;
122 item.inventoryNextPermissions = 0x7FFFFFFF; 117 item.inventoryNextPermissions = 0x7FFFFFFF;
123 this.m_textureFolder.Items.Add(item.inventoryID, item); 118 m_textureFolder.Items.Add(item.inventoryID, item);
124 119
125 item = new InventoryItemBase(); 120 item = new InventoryItemBase();
126 item.avatarID = libOwner; 121 item.avatarID = libOwner;
@@ -135,7 +130,7 @@ namespace OpenSim.Framework.Communications.Cache
135 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 130 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
136 item.inventoryCurrentPermissions = 0x7FFFFFFF; 131 item.inventoryCurrentPermissions = 0x7FFFFFFF;
137 item.inventoryNextPermissions = 0x7FFFFFFF; 132 item.inventoryNextPermissions = 0x7FFFFFFF;
138 this.m_textureFolder.Items.Add(item.inventoryID, item); 133 m_textureFolder.Items.Add(item.inventoryID, item);
139 134
140 item = new InventoryItemBase(); 135 item = new InventoryItemBase();
141 item.avatarID = libOwner; 136 item.avatarID = libOwner;
@@ -150,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
150 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 145 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
151 item.inventoryCurrentPermissions = 0x7FFFFFFF; 146 item.inventoryCurrentPermissions = 0x7FFFFFFF;
152 item.inventoryNextPermissions = 0x7FFFFFFF; 147 item.inventoryNextPermissions = 0x7FFFFFFF;
153 this.m_textureFolder.Items.Add(item.inventoryID, item); 148 m_textureFolder.Items.Add(item.inventoryID, item);
154 149
155 item = new InventoryItemBase(); 150 item = new InventoryItemBase();
156 item.avatarID = libOwner; 151 item.avatarID = libOwner;
@@ -161,10 +156,10 @@ namespace OpenSim.Framework.Communications.Cache
161 item.inventoryName = "Default Shape"; 156 item.inventoryName = "Default Shape";
162 item.assetType = 13; 157 item.assetType = 13;
163 item.invType = 18; 158 item.invType = 18;
164 item.parentFolderID = this.folderID; 159 item.parentFolderID = folderID;
165 item.inventoryCurrentPermissions = 0; 160 item.inventoryCurrentPermissions = 0;
166 item.inventoryNextPermissions = 0; 161 item.inventoryNextPermissions = 0;
167 this.Items.Add(item.inventoryID, item); 162 Items.Add(item.inventoryID, item);
168 163
169 item = new InventoryItemBase(); 164 item = new InventoryItemBase();
170 item.avatarID = libOwner; 165 item.avatarID = libOwner;
@@ -175,10 +170,10 @@ namespace OpenSim.Framework.Communications.Cache
175 item.inventoryName = "Default Skin"; 170 item.inventoryName = "Default Skin";
176 item.assetType = 13; 171 item.assetType = 13;
177 item.invType = 18; 172 item.invType = 18;
178 item.parentFolderID = this.folderID; 173 item.parentFolderID = folderID;
179 item.inventoryCurrentPermissions = 0; 174 item.inventoryCurrentPermissions = 0;
180 item.inventoryNextPermissions = 0; 175 item.inventoryNextPermissions = 0;
181 this.Items.Add(item.inventoryID, item); 176 Items.Add(item.inventoryID, item);
182 177
183 item = new InventoryItemBase(); 178 item = new InventoryItemBase();
184 item.avatarID = libOwner; 179 item.avatarID = libOwner;
@@ -189,10 +184,10 @@ namespace OpenSim.Framework.Communications.Cache
189 item.inventoryName = "Default Shirt"; 184 item.inventoryName = "Default Shirt";
190 item.assetType = 5; 185 item.assetType = 5;
191 item.invType = 18; 186 item.invType = 18;
192 item.parentFolderID = this.folderID; 187 item.parentFolderID = folderID;
193 item.inventoryCurrentPermissions = 0; 188 item.inventoryCurrentPermissions = 0;
194 item.inventoryNextPermissions = 0; 189 item.inventoryNextPermissions = 0;
195 this.Items.Add(item.inventoryID, item); 190 Items.Add(item.inventoryID, item);
196 191
197 item = new InventoryItemBase(); 192 item = new InventoryItemBase();
198 item.avatarID = libOwner; 193 item.avatarID = libOwner;
@@ -203,11 +198,10 @@ namespace OpenSim.Framework.Communications.Cache
203 item.inventoryName = "Default Pants"; 198 item.inventoryName = "Default Pants";
204 item.assetType = 5; 199 item.assetType = 5;
205 item.invType = 18; 200 item.invType = 18;
206 item.parentFolderID = this.folderID; 201 item.parentFolderID = folderID;
207 item.inventoryCurrentPermissions = 0; 202 item.inventoryCurrentPermissions = 0;
208 item.inventoryNextPermissions = 0; 203 item.inventoryNextPermissions = 0;
209 this.Items.Add(item.inventoryID, item); 204 Items.Add(item.inventoryID, item);
210
211 } 205 }
212 206
213 private void ReadItemsFromFile(IConfigSource source) 207 private void ReadItemsFromFile(IConfigSource source)
@@ -217,28 +211,28 @@ namespace OpenSim.Framework.Communications.Cache
217 InventoryItemBase item = new InventoryItemBase(); 211 InventoryItemBase item = new InventoryItemBase();
218 item.avatarID = libOwner; 212 item.avatarID = libOwner;
219 item.creatorsID = libOwner; 213 item.creatorsID = libOwner;
220 item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); 214 item.inventoryID =
215 new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated()));
221 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); 216 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
222 item.inventoryDescription = source.Configs[i].GetString("description", ""); 217 item.inventoryDescription = source.Configs[i].GetString("description", "");
223 item.inventoryName = source.Configs[i].GetString("name", ""); 218 item.inventoryName = source.Configs[i].GetString("name", "");
224 item.assetType = source.Configs[i].GetInt("assetType", 0); 219 item.assetType = source.Configs[i].GetInt("assetType", 0);
225 item.invType = source.Configs[i].GetInt("inventoryType", 0); 220 item.invType = source.Configs[i].GetInt("inventoryType", 0);
226 item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); 221 item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF);
227 item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); 222 item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF);
228 item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); 223 item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
229 item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); 224 item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
230 if (item.assetType == 0) 225 if (item.assetType == 0)
231 { 226 {
232 item.parentFolderID = this.m_textureFolder.folderID; 227 item.parentFolderID = m_textureFolder.folderID;
233 this.m_textureFolder.Items.Add(item.inventoryID, item); 228 m_textureFolder.Items.Add(item.inventoryID, item);
234 } 229 }
235 else 230 else
236 { 231 {
237 item.parentFolderID = this.folderID; 232 item.parentFolderID = folderID;
238 this.Items.Add(item.inventoryID, item); 233 Items.Add(item.inventoryID, item);
239 } 234 }
240 } 235 }
241 } 236 }
242
243 } 237 }
244} \ No newline at end of file 238} \ No newline at end of file