public void Add(AppInfoBase newItem) { if (Contains(newItem)!=-1) return; newItem.setIndex(index++); Items.Add(newItem); }
/// <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); }
/// <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; }
public void Add(AppInfoBase newItem) { if (Contains(newItem) != -1) { return; } newItem.setIndex(index++); Items.Add(newItem); }
public override bool Equals(object obj) { if (obj is AppInfoBase) { AppInfoBase newItem = (AppInfoBase)obj; return(newItem.name == name && newItem.version == version); } return(false); }
/// <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); }
/// <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); }
/// <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; }