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); }
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); }
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); }