public InventoryFolderImpl FindFolderByPath (string path)
{
if (path == string.Empty)
return this;
path = path.Trim ();
if (path == PATH_DELIMITER)
return this;
string [] components = path.Split (new [] { PATH_DELIMITER }, 2, StringSplitOptions.None);
lock (m_childFolders) {
foreach (
InventoryFolderImpl folder in m_childFolders.Values.Where (folder => folder.Name == components [0])) {
if (components.Length > 1)
return folder.FindFolderByPath (components [1]);
return folder;
}
}
// We didn't find a folder with the given name
return null;
}