예제 #1
0
파일: AppInfoDB.cs 프로젝트: pzaro/qwinapt
 public void Add(AppInfoBase newItem)
 {
     if (Contains(newItem)!=-1)
         return;
     newItem.setIndex(index++);
     Items.Add(newItem);
 }
예제 #2
0
        /// <summary>
        /// find items in db
        /// </summary>
        /// <param name="type"></param>
        /// <param name="catalog"></param>
        /// <param name="prefix"></param>
        /// <returns></returns>
        public ArrayList FindItems(string type, string catalog, string prefix)
        {
            ArrayList ret = new ArrayList();

            for (int i = 0; i < Items.Count; i++)
            {
                AppInfoBase item = (AppInfoBase)Items[i];

                if (item.type != type)
                {
                    continue;
                }

                if (item.name.IndexOf(prefix) == -1)
                {
                    continue;
                }

                if (catalog == "All" || item.catalog == catalog)
                {
                    ret.Add(item.ToHashtable());
                }
            }
            return(ret);
        }
예제 #3
0
파일: AppInfoDB.cs 프로젝트: pzaro/qwinapt
 /// <summary>
 /// check wether it contains the item. useful when merge.
 /// </summary>
 /// <param name="newItem"></param>
 /// <returns></returns>
 public int Contains(AppInfoBase newItem)
 {
     foreach (AppInfoBase item in Items)
     {
         if (item.Equals(newItem))
             return item.getIndex();
     }
     return -1;
 }
예제 #4
0
 public void Add(AppInfoBase newItem)
 {
     if (Contains(newItem) != -1)
     {
         return;
     }
     newItem.setIndex(index++);
     Items.Add(newItem);
 }
예제 #5
0
 public override bool Equals(object obj)
 {
     if (obj is AppInfoBase)
     {
         AppInfoBase newItem = (AppInfoBase)obj;
         return(newItem.name == name && newItem.version == version);
     }
     return(false);
 }
예제 #6
0
 /// <summary>
 /// check wether it contains the item. useful when merge.
 /// </summary>
 /// <param name="newItem"></param>
 /// <returns></returns>
 public int Contains(AppInfoBase newItem)
 {
     foreach (AppInfoBase item in Items)
     {
         if (item.Equals(newItem))
         {
             return(item.getIndex());
         }
     }
     return(-1);
 }
예제 #7
0
 /// <summary>
 /// check wether has older version of that app.
 /// </summary>
 /// <param name="newItem"></param>
 /// <returns></returns>
 public int HasOldVersion(AppInfoBase newItem)
 {
     foreach (AppInfoBase item in Items)
     {
         if (item.name == newItem.name && item.version != newItem.version)
         {
             return(item.getIndex());
         }
     }
     return(-1);
 }
예제 #8
0
파일: AppInfoDB.cs 프로젝트: pzaro/qwinapt
 /// <summary>
 /// check wether has older version of that app.
 /// </summary>
 /// <param name="newItem"></param>
 /// <returns></returns>
 public int HasOldVersion(AppInfoBase newItem)
 {
     foreach (AppInfoBase item in Items)
     {
         if (item.name == newItem.name && item.version != newItem.version)
             return item.getIndex();
     }
     return -1;
 }