public int addItem(string loc, string crc, string gameId, bool copyNfo = false, bool favourite = false) { if (this.activeDb < 0) { MessageBox.Show("No collection database is activated"); return(-1); } if (this.db[this.activeDb].filled >= 0x61a8) { return(-1); } for (int i = 0; i < this.db[this.activeDb].filled; i++) { if ((this.db[this.activeDb].item[i] != null) && (this.db[this.activeDb].item[i].crc == crc)) { return(-2); } } if (this.db[this.activeDb].item[this.db[this.activeDb].filled] == null) { this.db[this.activeDb].item[this.db[this.activeDb].filled] = new collectionDbItemType(); } this.db[this.activeDb].item[this.db[this.activeDb].filled].gameLoc = loc; this.db[this.activeDb].item[this.db[this.activeDb].filled].crc = crc; this.db[this.activeDb].item[this.db[this.activeDb].filled].gameCode = gameId; this.db[this.activeDb].item[this.db[this.activeDb].filled].delete = false; this.db[this.activeDb].item[this.db[this.activeDb].filled].favourite = favourite; if (copyNfo && System.IO.File.Exists("data/web/nfo/" + crc + ".nfo")) { string str = ""; str = this.db[this.activeDb].item[this.db[this.activeDb].filled].gameLoc.Substring(0, this.db[this.activeDb].item[this.db[this.activeDb].filled].gameLoc.LastIndexOf(".")); if (System.IO.File.Exists(str + ".nfo")) { System.IO.File.Delete(str + ".nfo"); } System.IO.File.Copy("data/web/nfo/" + crc + ".nfo", str + ".nfo"); } collectionDbType type1 = this.db[this.activeDb]; type1.filled++; return(1); }
public int removeMarkedItems() { int num = 0; for (int i = 0; i < this.db[this.activeDb].filled; i++) { if ((this.db[this.activeDb].item[i] != null) && this.db[this.activeDb].item[i].delete) { num++; } else { this.db[this.activeDb].item[i - num] = this.db[this.activeDb].item[i]; } } collectionDbType type1 = this.db[this.activeDb]; type1.filled -= num; this.saveDb(this.activeDb); return(num); }