Esempio n. 1
0
 public byte[] Find(TileIndex index)
 {
     if (IsTileIndexValid(index))
     {
         byte[] result;
         var    cn = new SQLiteConnectionWithLock(_platform, _connectionString);
         using (cn.Lock())
         {
             const string sql =
                 "SELECT tile_data FROM \"tiles\" WHERE zoom_level=? AND tile_row=? AND tile_column=?;";
             result = cn.ExecuteScalar <byte[]>(sql, int.Parse(index.Level), index.Row, index.Col);
         }
         return(result == null || result.Length == 0
             ? null
             : result);
     }
     return(null);
 }
Esempio n. 2
0
        public byte[] GetTile(TileInfo tileInfo)
        {
            var index = tileInfo.Index;

            if (IsTileIndexValid(index))
            {
                byte[] result;
                using (var cn = new SQLiteConnectionWithLock(_connectionString))
                    using (cn.Lock())
                    {
                        var sql = "SELECT tile_data FROM \"tiles\" WHERE zoom_level=? AND tile_row=? AND tile_column=?;";
                        result = cn.ExecuteScalar <byte[]>(sql, index.Level, index.Row, index.Col);
                    }
                return(result == null || result.Length == 0
                    ? null
                    : result);
            }
            return(null);
        }