diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index dbaf2aa..b66aad5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
69 | /// The path to the required folder. | 69 | /// The path to the required folder. |
70 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. | 70 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. |
71 | /// </param> | 71 | /// </param> |
72 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an | 72 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an |
73 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> | 73 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> |
74 | public static InventoryFolderBase FindFolderByPath( | 74 | public static InventoryFolderBase FindFolderByPath( |
75 | IInventoryService inventoryService, UUID userId, string path) | 75 | IInventoryService inventoryService, UUID userId, string path) |
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
102 | /// The path to the required folder. | 102 | /// The path to the required folder. |
103 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. | 103 | /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. |
104 | /// </param> | 104 | /// </param> |
105 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an | 105 | /// <returns>The folder found. Please note that if there are multiple folders with the same name then an |
106 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> | 106 | /// unspecified one will be returned. If no such folder eixsts then null is returned</returns> |
107 | public static InventoryFolderBase FindFolderByPath( | 107 | public static InventoryFolderBase FindFolderByPath( |
108 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) | 108 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) |
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
149 | 149 | ||
150 | return FindFoldersByPath(inventoryService, rootFolder, path); | 150 | return FindFoldersByPath(inventoryService, rootFolder, path); |
151 | } | 151 | } |
152 | 152 | ||
153 | /// <summary> | 153 | /// <summary> |
154 | /// Find a set of folders given a PATH_DELIMITER delimited path starting from this folder | 154 | /// Find a set of folders given a PATH_DELIMITER delimited path starting from this folder |
155 | /// </summary> | 155 | /// </summary> |
@@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) | 175 | IInventoryService inventoryService, InventoryFolderBase startFolder, string path) |
176 | { | 176 | { |
177 | List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>(); | 177 | List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>(); |
178 | 178 | ||
179 | if (path == string.Empty) | 179 | if (path == string.Empty) |
180 | { | 180 | { |
181 | foundFolders.Add(startFolder); | 181 | foundFolders.Add(startFolder); |
@@ -189,17 +189,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
189 | foundFolders.Add(startFolder); | 189 | foundFolders.Add(startFolder); |
190 | return foundFolders; | 190 | return foundFolders; |
191 | } | 191 | } |
192 | 192 | ||
193 | // If the path isn't just / then trim any starting extraneous slashes | 193 | // If the path isn't just / then trim any starting extraneous slashes |
194 | path = path.TrimStart(new char[] { PATH_DELIMITER }); | 194 | path = path.TrimStart(new char[] { PATH_DELIMITER }); |
195 | 195 | ||
196 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path); | 196 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path); |
197 | 197 | ||
198 | string[] components = SplitEscapedPath(path); | 198 | string[] components = SplitEscapedPath(path); |
199 | components[0] = UnescapePath(components[0]); | 199 | components[0] = UnescapePath(components[0]); |
200 | 200 | ||
201 | //string[] components = path.Split(new string[] { PATH_DELIMITER.ToString() }, 2, StringSplitOptions.None); | 201 | //string[] components = path.Split(new string[] { PATH_DELIMITER.ToString() }, 2, StringSplitOptions.None); |
202 | 202 | ||
203 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); | 203 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); |
204 | 204 | ||
205 | // m_log.DebugFormat( | 205 | // m_log.DebugFormat( |
@@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
230 | /// | 230 | /// |
231 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. | 231 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. |
232 | /// </remarks> | 232 | /// </remarks> |
233 | /// | 233 | /// |
234 | /// <param name="inventoryService"> | 234 | /// <param name="inventoryService"> |
235 | /// Inventory service to query | 235 | /// Inventory service to query |
236 | /// </param> | 236 | /// </param> |
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
301 | /// | 301 | /// |
302 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. | 302 | /// FIXME: Delimitors which occur in names themselves are not currently escapable. |
303 | /// </remarks> | 303 | /// </remarks> |
304 | /// | 304 | /// |
305 | /// <param name="inventoryService">Inventory service to query</param> | 305 | /// <param name="inventoryService">Inventory service to query</param> |
306 | /// <param name="startFolder">The folder from which the path starts</param> | 306 | /// <param name="startFolder">The folder from which the path starts</param> |
307 | /// <param name="path">The path to the required item.</param> | 307 | /// <param name="path">The path to the required item.</param> |
@@ -313,10 +313,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
313 | 313 | ||
314 | // If the path isn't just / then trim any starting extraneous slashes | 314 | // If the path isn't just / then trim any starting extraneous slashes |
315 | path = path.TrimStart(new char[] { PATH_DELIMITER }); | 315 | path = path.TrimStart(new char[] { PATH_DELIMITER }); |
316 | 316 | ||
317 | string[] components = SplitEscapedPath(path); | 317 | string[] components = SplitEscapedPath(path); |
318 | components[0] = UnescapePath(components[0]); | 318 | components[0] = UnescapePath(components[0]); |
319 | 319 | ||
320 | //string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); | 320 | //string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); |
321 | 321 | ||
322 | if (components.Length == 1) | 322 | if (components.Length == 1) |
@@ -324,15 +324,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
324 | // m_log.DebugFormat( | 324 | // m_log.DebugFormat( |
325 | // "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}", | 325 | // "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}", |
326 | // components[0], startFolder.Name, startFolder.ID); | 326 | // components[0], startFolder.Name, startFolder.ID); |
327 | 327 | ||
328 | List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); | 328 | List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); |
329 | 329 | ||
330 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count); | 330 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count); |
331 | 331 | ||
332 | foreach (InventoryItemBase item in items) | 332 | foreach (InventoryItemBase item in items) |
333 | { | 333 | { |
334 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID); | 334 | // m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID); |
335 | 335 | ||
336 | if (item.Name == components[0]) | 336 | if (item.Name == components[0]) |
337 | foundItems.Add(item); | 337 | foundItems.Add(item); |
338 | } | 338 | } |
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
342 | // m_log.DebugFormat("FOUND COMPONENTS [{0}] and [{1}]", components[0], components[1]); | 342 | // m_log.DebugFormat("FOUND COMPONENTS [{0}] and [{1}]", components[0], components[1]); |
343 | 343 | ||
344 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); | 344 | InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); |
345 | 345 | ||
346 | foreach (InventoryFolderBase folder in contents.Folders) | 346 | foreach (InventoryFolderBase folder in contents.Folders) |
347 | { | 347 | { |
348 | if (folder.Name == components[0]) | 348 | if (folder.Name == components[0]) |
@@ -365,9 +365,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
365 | public static string[] SplitEscapedPath(string path) | 365 | public static string[] SplitEscapedPath(string path) |
366 | { | 366 | { |
367 | // m_log.DebugFormat("SPLITTING PATH {0}", path); | 367 | // m_log.DebugFormat("SPLITTING PATH {0}", path); |
368 | 368 | ||
369 | bool singleEscapeChar = false; | 369 | bool singleEscapeChar = false; |
370 | 370 | ||
371 | for (int i = 0; i < path.Length; i++) | 371 | for (int i = 0; i < path.Length; i++) |
372 | { | 372 | { |
373 | if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar) | 373 | if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar) |
@@ -395,7 +395,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
395 | public static string UnescapePath(string path) | 395 | public static string UnescapePath(string path) |
396 | { | 396 | { |
397 | // m_log.DebugFormat("ESCAPING PATH {0}", path); | 397 | // m_log.DebugFormat("ESCAPING PATH {0}", path); |
398 | 398 | ||
399 | StringBuilder sb = new StringBuilder(); | 399 | StringBuilder sb = new StringBuilder(); |
400 | 400 | ||
401 | bool singleEscapeChar = false; | 401 | bool singleEscapeChar = false; |
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
418 | } | 418 | } |
419 | 419 | ||
420 | // m_log.DebugFormat("ESCAPED PATH TO {0}", sb); | 420 | // m_log.DebugFormat("ESCAPED PATH TO {0}", sb); |
421 | 421 | ||
422 | return sb.ToString(); | 422 | return sb.ToString(); |
423 | } | 423 | } |
424 | 424 | ||