State Cache/DB, tile info

Topics: Feature Requests
Jul 29, 2011 at 5:54 AM

The cache (and hence in the file database) can be a lot of different cards would be nice to be able to get the state of the cache / database, for example, how many cards there are, how many tiles of each card there. Any ideas?

Jul 29, 2011 at 5:42 PM

yes, it would be nice ;} any volunteers?

Jul 29, 2011 at 6:17 PM

If the owner of the project in the near future in this direction is not going to do anything, you have to do it)).

What information must be obtained as Cache / DB?
For example:
- The names of cards
- The number of tiles for every card

any ideas?

Jul 29, 2011 at 6:40 PM

anything you want, create fork, experiment ;}

Aug 13, 2011 at 3:10 PM
Edited Aug 13, 2011 at 3:28 PM

That's what I got:

public class CachInfo
        static readonly string singleSqlSelect = "select Type, count(Type) from Tiles group by Type";

        public static Dictionary<Int64, Int64> GetInfo(string db)
            var res = new Dictionary<Int64, Int64>();

            string ConnectionString = string.Format("Data Source=\"{0}\";Page Size=32768;Pooling=True", db);

            using (SQLiteConnection cn = new SQLiteConnection())
                cn.ConnectionString = ConnectionString;
                        using (DbCommand cmd = cn.CreateCommand())
                            cmd.CommandText = singleSqlSelect;

                            // Retrieve the data.
                            DbDataReader reader = cmd.ExecuteReader();
                            while (reader.Read())
                                res.Add((Int64)reader[0], (Int64)reader[1]);
                    catch (Exception ex)
            return res;
Based on this information, you can automatically select the type of card, choosing the type of card with the highest count tiles.
I still want to make the automatic selection of the type of card, the known current position, so long poking around in the code, I will ask the question:
1) Is there an event when the visible tiles are not images in the cache, the argument should be an information about a missing tile, is there?
2) How can I get the address of the database file in the kernel?

Still, why the author does not rule, "the interface name starting with an "I""?

Aug 13, 2011 at 3:58 PM

because ;}