public byte[] Get(Coord coord, string Format)
{
int z = coord.Z;
int x = coord.X;
int y = coord.Y;
byte[] img = null;
if (Format.Equals(this._format, StringComparison.OrdinalIgnoreCase))
{
using(SQLiteConnection con = new SQLiteConnection((string.Format("Data Source={0}", this.Database))))
{
con.Open();
string query = "SELECT tile_data FROM tiles WHERE zoom_level=@z AND tile_column=@x AND tile_row=@y";
using (SQLiteCommand cmd = new SQLiteCommand(query, con))
{
cmd.Parameters.AddWithValue("@z", z);
cmd.Parameters.AddWithValue("@x", x);
cmd.Parameters.AddWithValue("@y", y);
using (SQLiteDataReader dr = cmd.ExecuteReader())
{
if (dr.Read())
{
img = (byte[])dr[0];
}
}
}
}
}
return img;
}