示例#1
0
 internal void addLocalTypeItem(TypeItem item)
 {
     if (!this.isTypeItemExist(this.localTypeCollection, item))
     {
         this.addTypeItemToCollection(this.localTypeCollection, item);
     }
 }
示例#2
0
 internal void addOnlineTypeItem(TypeItem item)
 {
     if (!this.isTypeItemExist(this.onlineTypeCollection, item))
     {
         this.addTypeItemToCollection(this.onlineTypeCollection, item);
     }
 }
示例#3
0
 private void addTypeItemToCollection(TypeCollection collection, TypeItem item)
 {
     if (item.ParentType == 0)
     {
         collection.Add(item);
     }
     else
     {
         foreach (TypeItem temp in collection)
         {
             if (temp.Type == item.ParentType)
             {
                 temp.SubTypeItems.Add(item);
                 break;
             }
         }
     }
 }
示例#4
0
        private bool isTypeItemExist(TypeCollection collection, TypeItem item)
        {
            foreach (TypeItem temp in collection)
            {
                if (temp.Type == item.Type)
                {
                    return(true);
                }

                foreach (TypeItem subTemp in temp.SubTypeItems)
                {
                    if (subTemp.Type == item.Type)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }