Esempio n. 1
0
        public void RemoveItem(string path, IComposite item)
        {
            IComposite inventory = this;

            var names = path.Split('/');

            foreach (var name in names)
            {
                inventory = inventory.GetItem(name);

                if (inventory == null)
                {
                    return;
                }
            }

            inventory.RemoveItem(item);

            if (inventory.Count < 1)
            {
                prune(path);
            }
        }
Esempio n. 2
0
        public void RemoveItem(string path, string name)
        {
            IComposite inventory = this;

            var segments = path.Split('/');

            foreach (var segment in segments)
            {
                inventory = inventory.GetItem(segment);

                if (inventory == null)
                {
                    return;
                }
            }

            inventory.RemoveItem(name);

            if (inventory.Count < 1)
            {
                prune(path);
            }
        }