Example #1
0
		static Game GameExists(string system, string name)
		{
			var game = new Game();
			var cmd = Con.CreateCommand();
			cmd.CommandText = "SELECT game_id, system, name, developer, publisher, classification, release_date, players, game_metadata, tags, alternate_names, notes FROM game WHERE system = @System and name = @Name";
			cmd.Parameters.Add(new SqliteParameter("@System", system));
			cmd.Parameters.Add(new SqliteParameter("@Name", name));
			var reader = cmd.ExecuteReader();
			if (reader.NextResult())
			{
				game.GameId = reader.GetInt64(0);
				game.System = reader.GetString(1);
				game.Name = reader.GetString(2);
				game.Developer = reader.GetString(3);
				game.Publisher = reader.GetString(4);
				game.Classification = reader.GetString(5);
				game.ReleaseDate = reader.GetString(6);
				game.Players = reader.GetString(7);
				game.GameMetadata = reader.GetString(8);
				game.Tags = reader.GetString(9);
				game.AltNames = reader.GetString(10);
				game.Notes = reader.GetString(11);
			}
			reader.Dispose();
			cmd.Dispose();

			if (game.GameId == 0) return null;
			return game;
		}
Example #2
0
		static void LoadGames(string system)
		{
			var cmd = Con.CreateCommand();
			cmd.CommandText = 
				"SELECT game_id, system, name, developer, publisher, classification, release_date, players, game_metadata, tags, alternate_names, notes "+
				"FROM game "+
				"WHERE system = @System";
			cmd.Parameters.Add(new SqliteParameter("@System", system));
			var reader = cmd.ExecuteReader();
			while (reader.NextResult())
			{
				var game = new Game();
				game.GameId = reader.GetInt64(0);
				game.System = reader.GetString(1);
				game.Name = reader.GetString(2);
				game.Developer = reader.GetString(3);
				game.Publisher = reader.GetString(4);
				game.Classification = reader.GetString(5);
				game.ReleaseDate = reader.GetString(6);
				game.Players = reader.GetString(7);
				game.GameMetadata = reader.GetString(8);
				game.Tags = reader.GetString(9);
				game.AltNames = reader.GetString(10);
				game.Notes = reader.GetString(11);
				Games.Add(game);
				GameMap[game.Name] = game;
			}
			reader.Dispose();
			cmd.Dispose();
		}