OpenMetaverse.InventoryManager.LocalFind C# (CSharp) Method

LocalFind() public method

Search inventory Store object for an item or folder
public LocalFind ( UUID baseFolder, string path, int level, bool firstOnly ) : List
baseFolder UUID The folder to begin the search in
path string An array which creates a path to search
level int Number of levels below baseFolder to conduct searches
firstOnly bool if True, will stop searching after first match is found
return List
        public List<InventoryBase> LocalFind(UUID baseFolder, string[] path, int level, bool firstOnly)
        {
            List<InventoryBase> objects = new List<InventoryBase>();
            //List<InventoryFolder> folders = new List<InventoryFolder>();
            List<InventoryBase> contents = _Store.GetContents(baseFolder);

            foreach (InventoryBase inv in contents)
            {
                if (inv.Name.CompareTo(path[level]) == 0)
                {
                    if (level == path.Length - 1)
                    {
                        objects.Add(inv);
                        if (firstOnly) return objects;
                    }
                    else if (inv is InventoryFolder)
                        objects.AddRange(LocalFind(inv.UUID, path, level + 1, firstOnly));
                }
            }

            return objects;
        }