public override void UpdateItems() { try { ItemSource.UpdateItems(); } catch (Exception e) { SafeElement.LogSafeError(ItemSource, e, "UpdateItems"); } }
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 bool SupportsModifierItemForItems(IEnumerable <Item> items, Item modItem) { items = ProxyItem.Unwrap(items); modItem = ProxyItem.Unwrap(modItem); if (!SupportedModifierItemTypes.Any(type => type.IsInstanceOfType(modItem))) { return(false); } try { return(Act.SupportsModifierItemForItems(items, modItem)); } catch (Exception e) { SafeElement.LogSafeError(Act, e, "SupportsModifierItemForItems"); } 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> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems) { IEnumerable <Item> results = null; items = ProxyItem.Unwrap(items); modItems = ProxyItem.Unwrap(modItems); try { // Strictly evaluate the IEnumerable before we leave the try block. results = Act.Perform(items, modItems); if (results != null) { results = results.ToArray(); } } catch (Exception e) { results = null; SafeElement.LogSafeError(Act, e, "Perform"); } finally { results = results ?? Enumerable.Empty <Item> (); } return(results); }
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); }