aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/InventoryFolderImpl.cs
diff options
context:
space:
mode:
authorJeff Ames2009-06-09 17:48:22 +0000
committerJeff Ames2009-06-09 17:48:22 +0000
commit135ff63c3dd2a2c68351669afbd2f57c2fe64d2d (patch)
tree4bb44c0e0a61289d6405de30eb140b8a7b1f6e42 /OpenSim/Framework/InventoryFolderImpl.cs
parentARGH!!!! note to self: ALWAYS use String.IsNullOrEmpty(...)! (diff)
downloadopensim-SC-135ff63c3dd2a2c68351669afbd2f57c2fe64d2d.zip
opensim-SC-135ff63c3dd2a2c68351669afbd2f57c2fe64d2d.tar.gz
opensim-SC-135ff63c3dd2a2c68351669afbd2f57c2fe64d2d.tar.bz2
opensim-SC-135ff63c3dd2a2c68351669afbd2f57c2fe64d2d.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Framework/InventoryFolderImpl.cs')
-rw-r--r--OpenSim/Framework/InventoryFolderImpl.cs932
1 files changed, 466 insertions, 466 deletions
diff --git a/OpenSim/Framework/InventoryFolderImpl.cs b/OpenSim/Framework/InventoryFolderImpl.cs
index 248783f..00462f9 100644
--- a/OpenSim/Framework/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/InventoryFolderImpl.cs
@@ -1,466 +1,466 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
33{ 33{
34 public class InventoryFolderImpl : InventoryFolderBase 34 public class InventoryFolderImpl : InventoryFolderBase
35 { 35 {
36 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 36 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
37 37
38 public static readonly string PATH_DELIMITER = "/"; 38 public static readonly string PATH_DELIMITER = "/";
39 39
40 /// <summary> 40 /// <summary>
41 /// Items that are contained in this folder 41 /// Items that are contained in this folder
42 /// </summary> 42 /// </summary>
43 public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>(); 43 public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>();
44 44
45 /// <summary> 45 /// <summary>
46 /// Child folders that are contained in this folder 46 /// Child folders that are contained in this folder
47 /// </summary> 47 /// </summary>
48 protected Dictionary<UUID, InventoryFolderImpl> m_childFolders = new Dictionary<UUID, InventoryFolderImpl>(); 48 protected Dictionary<UUID, InventoryFolderImpl> m_childFolders = new Dictionary<UUID, InventoryFolderImpl>();
49 49
50 // Constructors 50 // Constructors
51 public InventoryFolderImpl(InventoryFolderBase folderbase) 51 public InventoryFolderImpl(InventoryFolderBase folderbase)
52 { 52 {
53 Owner = folderbase.Owner; 53 Owner = folderbase.Owner;
54 ID = folderbase.ID; 54 ID = folderbase.ID;
55 Name = folderbase.Name; 55 Name = folderbase.Name;
56 ParentID = folderbase.ParentID; 56 ParentID = folderbase.ParentID;
57 Type = folderbase.Type; 57 Type = folderbase.Type;
58 Version = folderbase.Version; 58 Version = folderbase.Version;
59 } 59 }
60 60
61 public InventoryFolderImpl() 61 public InventoryFolderImpl()
62 { 62 {
63 } 63 }
64 64
65 /// <summary> 65 /// <summary>
66 /// Create a new subfolder. 66 /// Create a new subfolder.
67 /// </summary> 67 /// </summary>
68 /// <param name="folderID"></param> 68 /// <param name="folderID"></param>
69 /// <param name="folderName"></param> 69 /// <param name="folderName"></param>
70 /// <param name="type"></param> 70 /// <param name="type"></param>
71 /// <returns>The newly created subfolder. Returns null if the folder already exists</returns> 71 /// <returns>The newly created subfolder. Returns null if the folder already exists</returns>
72 public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type) 72 public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type)
73 { 73 {
74 lock (m_childFolders) 74 lock (m_childFolders)
75 { 75 {
76 if (!m_childFolders.ContainsKey(folderID)) 76 if (!m_childFolders.ContainsKey(folderID))
77 { 77 {
78 InventoryFolderImpl subFold = new InventoryFolderImpl(); 78 InventoryFolderImpl subFold = new InventoryFolderImpl();
79 subFold.Name = folderName; 79 subFold.Name = folderName;
80 subFold.ID = folderID; 80 subFold.ID = folderID;
81 subFold.Type = (short)type; 81 subFold.Type = (short)type;
82 subFold.ParentID = this.ID; 82 subFold.ParentID = this.ID;
83 subFold.Owner = Owner; 83 subFold.Owner = Owner;
84 m_childFolders.Add(subFold.ID, subFold); 84 m_childFolders.Add(subFold.ID, subFold);
85 85
86 return subFold; 86 return subFold;
87 } 87 }
88 } 88 }
89 89
90 return null; 90 return null;
91 } 91 }
92 92
93 /// <summary> 93 /// <summary>
94 /// Add a folder that already exists. 94 /// Add a folder that already exists.
95 /// </summary> 95 /// </summary>
96 /// <param name="folder"></param> 96 /// <param name="folder"></param>
97 public void AddChildFolder(InventoryFolderImpl folder) 97 public void AddChildFolder(InventoryFolderImpl folder)
98 { 98 {
99 lock (m_childFolders) 99 lock (m_childFolders)
100 { 100 {
101 folder.ParentID = ID; 101 folder.ParentID = ID;
102 m_childFolders[folder.ID] = folder; 102 m_childFolders[folder.ID] = folder;
103 } 103 }
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// Does this folder contain the given child folder? 107 /// Does this folder contain the given child folder?
108 /// </summary> 108 /// </summary>
109 /// <param name="folderID"></param> 109 /// <param name="folderID"></param>
110 /// <returns></returns> 110 /// <returns></returns>
111 public bool ContainsChildFolder(UUID folderID) 111 public bool ContainsChildFolder(UUID folderID)
112 { 112 {
113 return m_childFolders.ContainsKey(folderID); 113 return m_childFolders.ContainsKey(folderID);
114 } 114 }
115 115
116 /// <summary> 116 /// <summary>
117 /// Get a child folder 117 /// Get a child folder
118 /// </summary> 118 /// </summary>
119 /// <param name="folderID"></param> 119 /// <param name="folderID"></param>
120 /// <returns>The folder if it exists, null if it doesn't</returns> 120 /// <returns>The folder if it exists, null if it doesn't</returns>
121 public InventoryFolderImpl GetChildFolder(UUID folderID) 121 public InventoryFolderImpl GetChildFolder(UUID folderID)
122 { 122 {
123 InventoryFolderImpl folder = null; 123 InventoryFolderImpl folder = null;
124 124
125 lock (m_childFolders) 125 lock (m_childFolders)
126 { 126 {
127 m_childFolders.TryGetValue(folderID, out folder); 127 m_childFolders.TryGetValue(folderID, out folder);
128 } 128 }
129 129
130 return folder; 130 return folder;
131 } 131 }
132 132
133 /// <summary> 133 /// <summary>
134 /// Removes the given child subfolder. 134 /// Removes the given child subfolder.
135 /// </summary> 135 /// </summary>
136 /// <param name="folderID"></param> 136 /// <param name="folderID"></param>
137 /// <returns> 137 /// <returns>
138 /// The folder removed, or null if the folder was not present. 138 /// The folder removed, or null if the folder was not present.
139 /// </returns> 139 /// </returns>
140 public InventoryFolderImpl RemoveChildFolder(UUID folderID) 140 public InventoryFolderImpl RemoveChildFolder(UUID folderID)
141 { 141 {
142 InventoryFolderImpl removedFolder = null; 142 InventoryFolderImpl removedFolder = null;
143 143
144 lock (m_childFolders) 144 lock (m_childFolders)
145 { 145 {
146 if (m_childFolders.ContainsKey(folderID)) 146 if (m_childFolders.ContainsKey(folderID))
147 { 147 {
148 removedFolder = m_childFolders[folderID]; 148 removedFolder = m_childFolders[folderID];
149 m_childFolders.Remove(folderID); 149 m_childFolders.Remove(folderID);
150 } 150 }
151 } 151 }
152 152
153 return removedFolder; 153 return removedFolder;
154 } 154 }
155 155
156 /// <summary> 156 /// <summary>
157 /// Delete all the folders and items in this folder. 157 /// Delete all the folders and items in this folder.
158 /// </summary> 158 /// </summary>
159 public void Purge() 159 public void Purge()
160 { 160 {
161 foreach (InventoryFolderImpl folder in m_childFolders.Values) 161 foreach (InventoryFolderImpl folder in m_childFolders.Values)
162 { 162 {
163 folder.Purge(); 163 folder.Purge();
164 } 164 }
165 165
166 m_childFolders.Clear(); 166 m_childFolders.Clear();
167 Items.Clear(); 167 Items.Clear();
168 } 168 }
169 169
170 /// <summary> 170 /// <summary>
171 /// Returns the item if it exists in this folder or in any of this folder's descendant folders 171 /// Returns the item if it exists in this folder or in any of this folder's descendant folders
172 /// </summary> 172 /// </summary>
173 /// <param name="itemID"></param> 173 /// <param name="itemID"></param>
174 /// <returns>null if the item is not found</returns> 174 /// <returns>null if the item is not found</returns>
175 public InventoryItemBase FindItem(UUID itemID) 175 public InventoryItemBase FindItem(UUID itemID)
176 { 176 {
177 lock (Items) 177 lock (Items)
178 { 178 {
179 if (Items.ContainsKey(itemID)) 179 if (Items.ContainsKey(itemID))
180 { 180 {
181 return Items[itemID]; 181 return Items[itemID];
182 } 182 }
183 } 183 }
184 184
185 lock (m_childFolders) 185 lock (m_childFolders)
186 { 186 {
187 foreach (InventoryFolderImpl folder in m_childFolders.Values) 187 foreach (InventoryFolderImpl folder in m_childFolders.Values)
188 { 188 {
189 InventoryItemBase item = folder.FindItem(itemID); 189 InventoryItemBase item = folder.FindItem(itemID);
190 190
191 if (item != null) 191 if (item != null)
192 { 192 {
193 return item; 193 return item;
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 return null; 198 return null;
199 } 199 }
200 200
201 public InventoryItemBase FindAsset(UUID assetID) 201 public InventoryItemBase FindAsset(UUID assetID)
202 { 202 {
203 lock (Items) 203 lock (Items)
204 { 204 {
205 foreach (InventoryItemBase item in Items.Values) 205 foreach (InventoryItemBase item in Items.Values)
206 { 206 {
207 if (item.AssetID == assetID) 207 if (item.AssetID == assetID)
208 return item; 208 return item;
209 } 209 }
210 } 210 }
211 211
212 lock (m_childFolders) 212 lock (m_childFolders)
213 { 213 {
214 foreach (InventoryFolderImpl folder in m_childFolders.Values) 214 foreach (InventoryFolderImpl folder in m_childFolders.Values)
215 { 215 {
216 InventoryItemBase item = folder.FindAsset(assetID); 216 InventoryItemBase item = folder.FindAsset(assetID);
217 217
218 if (item != null) 218 if (item != null)
219 { 219 {
220 return item; 220 return item;
221 } 221 }
222 } 222 }
223 } 223 }
224 224
225 return null; 225 return null;
226 } 226 }
227 227
228 /// <summary> 228 /// <summary>
229 /// Deletes an item if it exists in this folder or any children 229 /// Deletes an item if it exists in this folder or any children
230 /// </summary> 230 /// </summary>
231 /// <param name="folderID"></param> 231 /// <param name="folderID"></param>
232 /// <returns></returns> 232 /// <returns></returns>
233 public bool DeleteItem(UUID itemID) 233 public bool DeleteItem(UUID itemID)
234 { 234 {
235 bool found = false; 235 bool found = false;
236 236
237 lock (Items) 237 lock (Items)
238 { 238 {
239 if (Items.ContainsKey(itemID)) 239 if (Items.ContainsKey(itemID))
240 { 240 {
241 Items.Remove(itemID); 241 Items.Remove(itemID);
242 return true; 242 return true;
243 } 243 }
244 } 244 }
245 245
246 lock (m_childFolders) 246 lock (m_childFolders)
247 { 247 {
248 foreach (InventoryFolderImpl folder in m_childFolders.Values) 248 foreach (InventoryFolderImpl folder in m_childFolders.Values)
249 { 249 {
250 found = folder.DeleteItem(itemID); 250 found = folder.DeleteItem(itemID);
251 251
252 if (found == true) 252 if (found == true)
253 { 253 {
254 break; 254 break;
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 return found; 259 return found;
260 } 260 }
261 261
262 /// <summary> 262 /// <summary>
263 /// Returns the folder requested if it is this folder or is a descendent of this folder. The search is depth 263 /// Returns the folder requested if it is this folder or is a descendent of this folder. The search is depth
264 /// first. 264 /// first.
265 /// </summary> 265 /// </summary>
266 /// <returns>The requested folder if it exists, null if it does not.</returns> 266 /// <returns>The requested folder if it exists, null if it does not.</returns>
267 public InventoryFolderImpl FindFolder(UUID folderID) 267 public InventoryFolderImpl FindFolder(UUID folderID)
268 { 268 {
269 if (folderID == ID) 269 if (folderID == ID)
270 return this; 270 return this;
271 271
272 lock (m_childFolders) 272 lock (m_childFolders)
273 { 273 {
274 foreach (InventoryFolderImpl folder in m_childFolders.Values) 274 foreach (InventoryFolderImpl folder in m_childFolders.Values)
275 { 275 {
276 InventoryFolderImpl returnFolder = folder.FindFolder(folderID); 276 InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
277 277
278 if (returnFolder != null) 278 if (returnFolder != null)
279 return returnFolder; 279 return returnFolder;
280 } 280 }
281 } 281 }
282 282
283 return null; 283 return null;
284 } 284 }
285 285
286 /// <summary> 286 /// <summary>
287 /// Look through all child subfolders for a folder marked as one for a particular asset type, and return it. 287 /// Look through all child subfolders for a folder marked as one for a particular asset type, and return it.
288 /// </summary> 288 /// </summary>
289 /// <param name="type"></param> 289 /// <param name="type"></param>
290 /// <returns>Returns null if no such folder is found</returns> 290 /// <returns>Returns null if no such folder is found</returns>
291 public InventoryFolderImpl FindFolderForType(int type) 291 public InventoryFolderImpl FindFolderForType(int type)
292 { 292 {
293 lock (m_childFolders) 293 lock (m_childFolders)
294 { 294 {
295 foreach (InventoryFolderImpl f in m_childFolders.Values) 295 foreach (InventoryFolderImpl f in m_childFolders.Values)
296 { 296 {
297 if (f.Type == type) 297 if (f.Type == type)
298 return f; 298 return f;
299 } 299 }
300 } 300 }
301 301
302 return null; 302 return null;
303 } 303 }
304 304
305 /// <summary> 305 /// <summary>
306 /// Find a folder given a PATH_DELIMITER delimited path starting from this folder 306 /// Find a folder given a PATH_DELIMITER delimited path starting from this folder
307 /// </summary> 307 /// </summary>
308 /// 308 ///
309 /// This method does not handle paths that contain multiple delimitors 309 /// This method does not handle paths that contain multiple delimitors
310 /// 310 ///
311 /// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some 311 /// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
312 /// XPath like expression 312 /// XPath like expression
313 /// 313 ///
314 /// FIXME: Delimitors which occur in names themselves are not currently escapable. 314 /// FIXME: Delimitors which occur in names themselves are not currently escapable.
315 /// 315 ///
316 /// <param name="path"> 316 /// <param name="path">
317 /// The path to the required folder. 317 /// The path to the required folder.
318 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. 318 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
319 /// </param> 319 /// </param>
320 /// <returns>null if the folder is not found</returns> 320 /// <returns>null if the folder is not found</returns>
321 public InventoryFolderImpl FindFolderByPath(string path) 321 public InventoryFolderImpl FindFolderByPath(string path)
322 { 322 {
323 if (path == string.Empty) 323 if (path == string.Empty)
324 return this; 324 return this;
325 325
326 path = path.Trim(); 326 path = path.Trim();
327 327
328 if (path == PATH_DELIMITER) 328 if (path == PATH_DELIMITER)
329 return this; 329 return this;
330 330
331 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); 331 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
332 332
333 lock (m_childFolders) 333 lock (m_childFolders)
334 { 334 {
335 foreach (InventoryFolderImpl folder in m_childFolders.Values) 335 foreach (InventoryFolderImpl folder in m_childFolders.Values)
336 { 336 {
337 if (folder.Name == components[0]) 337 if (folder.Name == components[0])
338 if (components.Length > 1) 338 if (components.Length > 1)
339 return folder.FindFolderByPath(components[1]); 339 return folder.FindFolderByPath(components[1]);
340 else 340 else
341 return folder; 341 return folder;
342 } 342 }
343 } 343 }
344 344
345 // We didn't find a folder with the given name 345 // We didn't find a folder with the given name
346 return null; 346 return null;
347 } 347 }
348 348
349 /// <summary> 349 /// <summary>
350 /// Find an item given a PATH_DELIMITOR delimited path starting from this folder. 350 /// Find an item given a PATH_DELIMITOR delimited path starting from this folder.
351 /// 351 ///
352 /// This method does not handle paths that contain multiple delimitors 352 /// This method does not handle paths that contain multiple delimitors
353 /// 353 ///
354 /// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some 354 /// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some
355 /// XPath like expression 355 /// XPath like expression
356 /// 356 ///
357 /// FIXME: Delimitors which occur in names themselves are not currently escapable. 357 /// FIXME: Delimitors which occur in names themselves are not currently escapable.
358 /// </summary> 358 /// </summary>
359 /// <param name="path"> 359 /// <param name="path">
360 /// The path to the required item. 360 /// The path to the required item.
361 /// </param> 361 /// </param>
362 /// <returns>null if the item is not found</returns> 362 /// <returns>null if the item is not found</returns>
363 public InventoryItemBase FindItemByPath(string path) 363 public InventoryItemBase FindItemByPath(string path)
364 { 364 {
365 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); 365 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
366 366
367 if (components.Length == 1) 367 if (components.Length == 1)
368 { 368 {
369 lock (Items) 369 lock (Items)
370 { 370 {
371 foreach (InventoryItemBase item in Items.Values) 371 foreach (InventoryItemBase item in Items.Values)
372 { 372 {
373 if (item.Name == components[0]) 373 if (item.Name == components[0])
374 return item; 374 return item;
375 } 375 }
376 } 376 }
377 } 377 }
378 else 378 else
379 { 379 {
380 lock (m_childFolders) 380 lock (m_childFolders)
381 { 381 {
382 foreach (InventoryFolderImpl folder in m_childFolders.Values) 382 foreach (InventoryFolderImpl folder in m_childFolders.Values)
383 { 383 {
384 if (folder.Name == components[0]) 384 if (folder.Name == components[0])
385 return folder.FindItemByPath(components[1]); 385 return folder.FindItemByPath(components[1]);
386 } 386 }
387 } 387 }
388 } 388 }
389 389
390 // We didn't find an item or intermediate folder with the given name 390 // We didn't find an item or intermediate folder with the given name
391 return null; 391 return null;
392 } 392 }
393 393
394 /// <summary> 394 /// <summary>
395 /// Return a copy of the list of child items in this folder. The items themselves are the originals. 395 /// Return a copy of the list of child items in this folder. The items themselves are the originals.
396 /// </summary> 396 /// </summary>
397 public List<InventoryItemBase> RequestListOfItems() 397 public List<InventoryItemBase> RequestListOfItems()
398 { 398 {
399 List<InventoryItemBase> itemList = new List<InventoryItemBase>(); 399 List<InventoryItemBase> itemList = new List<InventoryItemBase>();
400 400
401 lock (Items) 401 lock (Items)
402 { 402 {
403 foreach (InventoryItemBase item in Items.Values) 403 foreach (InventoryItemBase item in Items.Values)
404 { 404 {
405 itemList.Add(item); 405 itemList.Add(item);
406 } 406 }
407 } 407 }
408 408
409 //m_log.DebugFormat("[INVENTORY FOLDER IMPL]: Found {0} items", itemList.Count); 409 //m_log.DebugFormat("[INVENTORY FOLDER IMPL]: Found {0} items", itemList.Count);
410 410
411 return itemList; 411 return itemList;
412 } 412 }
413 413
414 /// <summary> 414 /// <summary>
415 /// Return a copy of the list of child folders in this folder. The folders themselves are the originals. 415 /// Return a copy of the list of child folders in this folder. The folders themselves are the originals.
416 /// </summary> 416 /// </summary>
417 public List<InventoryFolderBase> RequestListOfFolders() 417 public List<InventoryFolderBase> RequestListOfFolders()
418 { 418 {
419 List<InventoryFolderBase> folderList = new List<InventoryFolderBase>(); 419 List<InventoryFolderBase> folderList = new List<InventoryFolderBase>();
420 420
421 lock (m_childFolders) 421 lock (m_childFolders)
422 { 422 {
423 foreach (InventoryFolderBase folder in m_childFolders.Values) 423 foreach (InventoryFolderBase folder in m_childFolders.Values)
424 { 424 {
425 folderList.Add(folder); 425 folderList.Add(folder);
426 } 426 }
427 } 427 }
428 428
429 return folderList; 429 return folderList;
430 } 430 }
431 431
432 public List<InventoryFolderImpl> RequestListOfFolderImpls() 432 public List<InventoryFolderImpl> RequestListOfFolderImpls()
433 { 433 {
434 List<InventoryFolderImpl> folderList = new List<InventoryFolderImpl>(); 434 List<InventoryFolderImpl> folderList = new List<InventoryFolderImpl>();
435 435
436 lock (m_childFolders) 436 lock (m_childFolders)
437 { 437 {
438 foreach (InventoryFolderImpl folder in m_childFolders.Values) 438 foreach (InventoryFolderImpl folder in m_childFolders.Values)
439 { 439 {
440 folderList.Add(folder); 440 folderList.Add(folder);
441 } 441 }
442 } 442 }
443 443
444 return folderList; 444 return folderList;
445 } 445 }
446 446
447 /// <value> 447 /// <value>
448 /// The total number of items in this folder and in the immediate child folders (though not from other 448 /// The total number of items in this folder and in the immediate child folders (though not from other
449 /// descendants). 449 /// descendants).
450 /// </value> 450 /// </value>
451 public int TotalCount 451 public int TotalCount
452 { 452 {
453 get 453 get
454 { 454 {
455 int total = Items.Count; 455 int total = Items.Count;
456 456
457 foreach (InventoryFolderImpl folder in m_childFolders.Values) 457 foreach (InventoryFolderImpl folder in m_childFolders.Values)
458 { 458 {
459 total = total + folder.TotalCount; 459 total = total + folder.TotalCount;
460 } 460 }
461 461
462 return total; 462 return total;
463 } 463 }
464 } 464 }
465 } 465 }
466} 466}