/// <summary> /// Get item for type and identifier. /// </summary> /// <param name="type">Type of item.</param> /// <param name="ident">Identifier of item.</param> /// <returns>Unspecified common item.</returns> public IItem get(ItemType type, Ident ident) { bool isFull = (ident.guid != null && ident.item != null); switch(type) { case ItemType.EW: { // check with part from identifier IItem item = itemEW.FirstOrDefault(i => (isFull && ident.guid.CompareGuids(i.Key.guid) && ident.item == i.Key.item) || (!isFull && ident.guid != null && ident.guid.CompareGuids(i.Key.guid)) || (!isFull && ident.item != null && ident.item == i.Key.item) ).Value; if(item == null && isFull) { itemEW[ident] = new ItemEW(); return itemEW[ident]; } else if(item == null && ident.item == Settings._.DefaultOWPItem) { //TODO: return new ItemEW(); } else if(item == null) { throw new NotFoundException("OWP Items-EW: The '{0}:{1}' is not found.", ident.guid, ident.item); } return item; } } throw new NotFoundException("OWP Items: Type '{0}' is not supported.", type); }
/// <summary> /// Get item for type and identifier. /// </summary> /// <param name="type">Type of item.</param> /// <param name="ident">Identifier of item.</param> /// <returns>Unspecified common item.</returns> public IItem get(ItemType type, Ident ident) { bool isFull = (ident.guid != null && ident.item != null); switch (type) { case ItemType.EW: { // check with part from identifier IItem item = itemEW.FirstOrDefault(i => (isFull && ident.guid.CompareGuids(i.Key.guid) && ident.item == i.Key.item) || (!isFull && ident.guid != null && ident.guid.CompareGuids(i.Key.guid)) || (!isFull && ident.item != null && ident.item == i.Key.item) ).Value; if (item == null && isFull) { itemEW[ident] = new ItemEW(); return(itemEW[ident]); } else if (item == null && ident.item == Settings._.DefaultOWPItem) //TODO: { return(new ItemEW()); } else if (item == null) { throw new NotFoundException("OWP Items-EW: The '{0}:{1}' is not found.", ident.guid, ident.item); } return(item); } } throw new NotFoundException("OWP Items: Type '{0}' is not supported.", type); }
/// <summary> /// Get EW item for identifier. /// </summary> /// <param name="ident">Identifier of item.</param> /// <returns>EW item.</returns> public IItemEW getEW(Ident ident) { return (IItemEW)get(ItemType.EW, ident); }
/// <summary> /// Get EW item for identifier. /// </summary> /// <param name="ident">Identifier of item.</param> /// <returns>EW item.</returns> public IItemEW getEW(Ident ident) { return((IItemEW)get(ItemType.EW, ident)); }