예제 #1
0
        public IEnumerable <T> SelectSiblings <T>(IItemWrapper wrapper) where T : IItemWrapper
        {
            var parent = wrapper.Parent <IItemWrapper>();

            if (parent != null)
            {
                return(SelectChildren <T>(parent));
            }
            return(Enumerable.Empty <T>());
        }
예제 #2
0
        public T GetContextItemsItem <T>(string key) where T : IItemWrapper
        {
            IItemWrapper wrapper = null;

            if (Sitecore.Context.Items.Contains(key) && Sitecore.Context.Items[key].GetType() == typeof(Item))
            {
                wrapper = SpawnProvider.FromItem <T>((Item)Sitecore.Context.Items[key]);
            }

            return((T)((wrapper is T) ? wrapper : null));
        }
예제 #3
0
        public T SelectSibling <T>(IItemWrapper wrapper) where T : IItemWrapper
        {
            var parent = wrapper.Parent <IItemWrapper>();

            if (parent != null)
            {
                return(SelectChild <T>(parent));
            }

            return(default(T));
        }
예제 #4
0
        public T SelectChild <T>(string path) where T : IItemWrapper
        {
            var          children   = SelectChildren <T>(path);
            IItemWrapper firstChild = null;

            if (children.Count() > 0)
            {
                firstChild = children.First();
            }

            return((T)((firstChild is T) ? firstChild : null));
        }
예제 #5
0
 public ApplicationErrorFactory([NotNull] IItemWrapper<CorrelationId> correlationIdWrapper,
                                [NotNull] IIncludeErrorDetailsResolver includeErrorDetailsResolver,
                                [NotNull] IHttpStatusFactory httpStatusFactory,
                                [NotNull] ILog logger)
 {
     if (correlationIdWrapper == null) throw new ArgumentNullException(nameof(correlationIdWrapper));
     if (includeErrorDetailsResolver == null) throw new ArgumentNullException(nameof(includeErrorDetailsResolver));
     if (httpStatusFactory == null) throw new ArgumentNullException(nameof(httpStatusFactory));
     if (logger == null) throw new ArgumentNullException(nameof(logger));
     _correlationIdWrapper = correlationIdWrapper;
     _includeErrorDetailsResolver = includeErrorDetailsResolver;
     _httpStatusFactory = httpStatusFactory;
     _logger = logger;
 }
        /// <summary>
        /// Iterates all the item's ancestors and returns the first one that is of the specified type.
        /// </summary>
        /// <typeparam name="T">The type of ancestor that is needed.</typeparam>
        /// <returns>A typed wrapper for the first ancestor of the specified type.</returns>
        public virtual T GetFirstAncestor <T>() where T : class, IItemWrapper
        {
            IItemWrapper parent = Parent;

            if (parent == null)
            {
                return(null);
            }
            else if (parent as T != null)
            {
                return(parent as T);
            }
            return(parent.GetFirstAncestor <T>());
        }
예제 #7
0
        protected T Parent <T>(Item parent) where T : IItemWrapper
        {
            IItemWrapper wrapper = null;

            while (parent != null)
            {
                wrapper = Spawn.FromItem <T>(parent);

                if (wrapper is T)
                {
                    return((T)wrapper);
                }

                parent = parent.Parent;
            }

            return((T)((wrapper is T) ? wrapper : null));
        }
예제 #8
0
        protected T Ancestor <T>(Item parent) where T : IItemWrapper
        {
            IItemWrapper wrapper = null;

            while (parent != null)
            {
                wrapper = _spawnProvider.FromItem <T>(parent);

                if (wrapper is T)
                {
                    return((T)wrapper);
                }

                parent = parent.Parent;
            }

            return((T)((wrapper is T) ? wrapper : null));
        }
예제 #9
0
        public IEnumerable <T> SelectChildrenRecursive <T>(IItemWrapper wrapper) where T : IItemWrapper
        {
            var children = SelectChildren <IItemWrapper>(wrapper);

            foreach (IItemWrapper item in children)
            {
                if (item is T)
                {
                    yield return((T)item);
                }

                if (item.HasChildren)
                {
                    var innerChildren = SelectChildrenRecursive <T>(item);

                    foreach (IItemWrapper innerChild in innerChildren)
                    {
                        yield return((T)innerChild);
                    }
                }
            }
        }
예제 #10
0
        protected virtual IEnumerable <T> ChildrenRecursive <T>(IItemWrapper wrapper) where T : IItemWrapper
        {
            var children = wrapper.Children <IItemWrapper>();

            foreach (var child in children)
            {
                if (child is T)
                {
                    yield return((T)child);
                }

                if (child.HasChildren)
                {
                    var innerChildren = ChildrenRecursive <T>(child);

                    foreach (var innerChild in innerChildren)
                    {
                        yield return((T)innerChild);
                    }
                }
            }
        }
예제 #11
0
 public void grabItemFromInventory(IItemWrapper item, IFarmerWrapper who)
 {
 }
예제 #12
0
 public IItemWrapper addItem(IItemWrapper item) => null;
예제 #13
0
 public void grabItemFromChest(IItemWrapper item, IFarmerWrapper who)
 {
 }
예제 #14
0
 public IItemWrapper addItemToInventory(IItemWrapper item) => null;
예제 #15
0
 public RenderingContext(IItemWrapper context)
 {
     _context = context;
 }
예제 #16
0
 public T SelectChild <T>(IItemWrapper item) where T : IItemWrapper
 {
     return(SelectChild <T>(item.ItemID));
 }
예제 #17
0
 public int getIndexOfInventoryItem(IItemWrapper item) => 0;
예제 #18
0
 public void removeItemFromInventory(IItemWrapper which)
 {
 }
예제 #19
0
 public bool addItemToInventoryBool(IItemWrapper item, bool makeActiveObject = false) => false;
예제 #20
0
 public bool couldInventoryAcceptThisItem(IItemWrapper item) => false;
예제 #21
0
 public IItemWrapper addItemToInventory(IItemWrapper item, int position) => null;
예제 #22
0
 public T Create <T>(IItemWrapper parent, string itemName) where T : IItemWrapper
 {
     return(Create <T>(parent.ItemID, itemName));
 }
예제 #23
0
 public bool IsEquippedItem(IItemWrapper item) => false;
예제 #24
0
 public void holdUpItemThenMessage(IItemWrapper item, bool showMessage = true)
 {
 }
 public bool HighlightAcceptableItems(IItemWrapper item) => false;
예제 #26
0
 public IEnumerable <T> SelectChildren <T>(IItemWrapper item) where T : IItemWrapper
 {
     return(SelectChildren <T>(item.ItemID));
 }
 public int GetAcceptCount(IItemWrapper item) => 0;
예제 #28
0
 public void addItemByMenuIfNecessary(IItemWrapper item, ItemGrabMenu.behaviorOnItemSelect itemSelectedCallback = null)
 {
 }
예제 #29
0
 public void addContents(int coins, IItemWrapper item)
 {
 }
예제 #30
0
 public void dropItem(IItemWrapper i)
 {
 }
예제 #31
0
 public IItemWrapper addItemToInventory(IItemWrapper item, IEnumerable <IItemWrapper> affected_items_list) => null;
예제 #32
0
 public bool checkForQuestComplete(INPCWrapper n, int number1, int number2, IItemWrapper item, string str, int questType = -1,
                                   int questTypeToIgnore = -1) =>
 false;
 public string GetLink(IItemWrapper item)
 {
     return LinkManager.GetItemUrl(item.Item);
 }