示例#1
0
 private void Games_Detach(Games entity)
 {
     this.SendPropertyChanging();
     entity.Accounts = null;
 }
示例#2
0
        public static int CreateGame(
            AsyncRPGDataContext context,
            int account_id,
            string game_name,
            GameConstants.eDungeonSize dungeonSize,
            GameConstants.eDungeonDifficulty dungeonDifficulty,
            bool irc_enabled,
            string irc_server,
            int irc_port,
            bool irc_encryption_enabled)
        {
            int new_game_id = -1;

            // Create a random 256-bit (32 byte) encryption key for encrypting chat
            string irc_encryption_key = RNGUtilities.CreateNonDeterministicRandomBase64String(256);
            Debug.Assert(irc_encryption_key.Length == 44);

            if (irc_server.Length == 0)
            {
                irc_server = IrcConstants.DEFAULT_IRC_SERVER;
            }

            if (irc_port < IrcConstants.LOWEST_VALID_IRC_PORT || irc_port > IrcConstants.HIGHEST_VALID_IRC_PORT)
            {
                irc_port = IrcConstants.DEFAULT_IRC_PORT;
            }

            {
                Games newGame = new Games
                {
                    OwnerAccountID = account_id,
                    Name = game_name,
                    DungeonSize = (int)dungeonSize,
                    DungeonDifficulty = (int)dungeonDifficulty,
                    IrcEnabed = irc_enabled,
                    IrcServer = irc_server,
                    IrcPort = irc_port,
                    IrcEncryptionKey = irc_encryption_key,
                    IrcEncryptionEnabed = irc_encryption_enabled
                };

                context.Games.InsertOnSubmit(newGame);
                context.SubmitChanges();

                new_game_id = newGame.GameID;
            }

            return new_game_id;
        }
示例#3
0
 private void Games_Attach(Games entity)
 {
     this.SendPropertyChanging();
     entity.Accounts = this;
 }