public List <Emulator> GetEmulators(bool forcePC = false) { List <Emulator> emus = new List <Emulator>(); SQLiteResultSet result = Execute("SELECT * FROM {0} ORDER BY position ASC", Emulator.TABLE_NAME); foreach (SQLiteResultSet.Row row in result.Rows) { emus.Add(Emulator.CreateEmulator(row)); } Emulator pc = Emulator.GetPC(); if (forcePC || GetGames(pc).Count > 0) { //sanitise position just in case if (pc.Position < 0) { pc.Position = 0; } else if (pc.Position > emus.Count) { pc.Position = emus.Count; } emus.Insert(pc.Position, pc); //Insert PC into correct position in list } return(emus); }
public Emulator GetEmulator(int uid) { if (uid == -1) { return(Emulator.GetPC()); } SQLiteResultSet result = Execute("SELECT * FROM {0} WHERE uid={1}", Emulator.TABLE_NAME, uid); if (result.Rows.Count < 1) { Logger.LogError("Unable to locate Emulator with uid {0}", uid); return(null); } return(Emulator.CreateEmulator(result.Rows[0])); }