Example #1
0
        public override bool SupportsItem(Item item)
        {
            item = ProxyItem.Unwrap(item);

            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(false);
            }

            try {
                return(Act.SupportsItem(item));
            } catch (Exception e) {
                SafeElement.LogSafeError(Act, e, "SupportsItem");
            }
            return(false);
        }
Example #2
0
        public override IEnumerable <Item> ChildrenOfItem(Item item)
        {
            IEnumerable <Item> children = null;

            item = ProxyItem.Unwrap(item);

            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(Enumerable.Empty <Item> ());
            }

            try {
                // Strictly evaluate the IEnumerable before we leave the try block.
                children = ItemSource.ChildrenOfItem(item).ToArray();
            } catch (Exception e) {
                children = null;
                SafeElement.LogSafeError(ItemSource, e, "ChildrenOfItem");
            } finally {
                children = children ?? Enumerable.Empty <Item> ();
            }
            return(children);
        }
Example #3
0
        public override IEnumerable <Item> DynamicModifierItemsForItem(Item item)
        {
            IEnumerable <Item> modItems = null;

            item = ProxyItem.Unwrap(item);

            // This is a duplicate check, so we may want to remove it.
            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(Enumerable.Empty <Item> ());
            }

            try {
                // Strictly evaluate the IEnumerable before we leave the try block.
                modItems = Act.DynamicModifierItemsForItem(item).ToArray();
            } catch (Exception e) {
                modItems = null;
                SafeElement.LogSafeError(Act, e, "DynamicModifierItemsForItem");
            } finally {
                modItems = modItems ?? Enumerable.Empty <Item> ();
            }
            return(modItems);
        }