示例#1
0
        private FileInfo CreateGameDatabaseFiles(Game game, DirectoryInfo dir)
        {
            FileInfo gameFile = GameTableFile(game);
            var      db       = CreateSQLLiteConnection.Create(gameFile);

            db.CreateTable <GameTable>();
            db.CreateTable <PlayersTable>();
            db.CreateTable <PlayerTable>();

            GameTable gametable = new GameTable();

            gametable.ID = game.ID;

            int turnID = 0;

            foreach (Player player in game.Players)
            {
                PlayerTable playerTable = new PlayerTable();
                playerTable.ID    = player.ID;
                playerTable.Name  = player.Name;
                playerTable.Email = player.EMail;

                PlayersTable playersTable = new PlayersTable();
                playersTable.GameID   = game.ID;
                playersTable.PlayerID = player.ID;
                playersTable.Turn     = turnID;

                turnID++;
            }

            return(gameFile);
        }
示例#2
0
        private void CreateOrEditMasterTable(Game game, IStorage storage)
        {
            var db = CreateSQLLiteConnection.Create(MasterTableFile);

            db.CreateTable <MasterTable>();
            MasterTable master = new MasterTable();

            master.GameGuid    = game.ID;
            master.Me          = game.Me.ID;
            master.GameType    = game.GameType;
            master.StorageType = storage.Type;
            db.Insert(master);

            storage.Accept(db);
        }