Exemplo n.º 1
0
 protected DbModule(DbInterface dbInterface, IDbInstance db)
 {
     DbInterface    = dbInterface;
     Db             = db;
     AllColumnNames = new string[AllColumns.Length];
     for (int i = 0; i < AllColumns.Length; i++)
     {
         AllColumnNames[i] = AllColumns[i].Name;
     }
 }
Exemplo n.º 2
0
        public IDbInstance createInstance(string Name, string ConnectionString, string type)
        {
            string nspace = typeof(IDbInstance).Namespace;
            Type   t      = Type.GetType(nspace + "." + type);
            object obj    = Activator.CreateInstance(t, new object[] { Name, pro, ConnectionString });

            IDbInstance instance = obj as IDbInstance;

            Server.Add(Name, instance);

            return(instance);
        }
Exemplo n.º 3
0
        public DbInterface()
        {
            _campaignDb = new SqLiteDb(Properties.Settings.Default.CampaignDatabaseName);
            _mapDb      = new SqLiteDb(Properties.Settings.Default.MapDatabaseName);

            Party   = new DbParty(this, _campaignDb);
            Session = new DbSession(this, _campaignDb);

            Hexes          = new DbHex(this, _mapDb);
            HexConnections = new DbHexConnection(this, _mapDb);
            DbUpdater.CheckForCampaignDbSchemaUpdates(_campaignDb, Party, Session);
            DbUpdater.CheckForMapDbSchemaUpdates(_mapDb, Hexes, HexConnections);
        }
Exemplo n.º 4
0
        public static void CheckForMapDbSchemaUpdates(IDbInstance db, DbHex hexes, DbHexConnection hexConnections)
        {
            long version = db.GetVersion();

            if (version == 0)
            {
                db.CreateTables(new IDbModule[] { hexes, hexConnections });
            }
            else
            {
                if (version <= 1)
                {
                    db.AlterAddColumn(hexes.TableName, DbHex.PlayerIcons, DbColumn.Text, true, "'0'");
                }
                if (version <= 2)
                {
                    db.AlterAddColumn(hexes.TableName, DbHex.FogOfWar, DbColumn.Integer, true, "0");
                }
            }


            db.SetVersion(CurrentMapDbVersion);
        }
Exemplo n.º 5
0
        public static void CheckForCampaignDbSchemaUpdates(IDbInstance db, DbParty party, DbSession session)
        {
            long version = db.GetVersion();

            if (version == 0)
            {
                db.CreateTables(new IDbModule[] { party });
                party.CreateDefault();
            }
            if (version <= 1)
            {
                db.CreateTables(new IDbModule[] { session });

                session.CreateDefault();
            }
            if (version == 2)
            {
                db.AlterAddColumn(session.TableName, DbSession.Year, DbColumn.Integer, true, "382");
                db.AlterAddColumn(session.TableName, DbSession.Day, DbColumn.Integer, true, "218");
                db.AlterAddColumn(session.TableName, DbSession.Minutes, DbColumn.Integer, true, "1080");
            }

            db.SetVersion(CurrentCampaignDbVersion);
        }
Exemplo n.º 6
0
 public DbHex(DbInterface dbInterface, IDbInstance db) : base(dbInterface, db)
 {
     _oneItemCache = new Dictionary <string, KeyValuePair <Rectangle, List <Hex> > >();
 }
 public DbHexConnection(DbInterface dbInterface, IDbInstance db) : base(dbInterface, db)
 {
 }
Exemplo n.º 8
0
 public DbParty(DbInterface dbInterface, IDbInstance db) : base(dbInterface, db)
 {
 }
Exemplo n.º 9
0
 public Export()
 {
     excIns = new NPOI.Export();
     dbIns  = new SQLite.Export();
 }
Exemplo n.º 10
0
 public DbHelper createConnection(string Name, string ConnectionString, string type)
 {
     this.Name = Name;
     instance  = control.createInstance(Name, ConnectionString, type);
     return(this);
 }
Exemplo n.º 11
0
 public DbSession(DbInterface dbInterface, IDbInstance db) : base(dbInterface, db)
 {
 }