public GameServer(GameSettings settings)
     : base(IPAddress.Any, settings.Port, settings.LogFilename)
 {
     OnDisconnect += Handle_OnDisconnect;
     OnConnect += Handle_OnConnect;
     PlayerTable = new BidirectionalDict<string, Client>();
     Game = new Game(settings);
     Settings = settings;
 }
        public GameClient(string server, string username)
        {
            Settings = ScreenManager.Settings;
            _username = username;
            Cards = new List<Card>();
            CurrentCardIndex = 0;
            Players = new List<string>();
            PlayerHandSizes = new Dictionary<string, int>();
            PlayerTextBoxes = new DefaultObjDict<string, TextBox>();
            RecalculateTextBoxes();
            CurrentPlayerIndex = 0;
            Top = new Card();
            DeckSize = -1;
            Reverse = false;
            IsGameStarted = false;
            Connect(server);

            CurrentPlayerArrowTexture = ScreenManager.Content.Load<Texture2D>(@"arrow");
        }
        public static GameSettings ParseSettings(string filename)
        {
            var settings = new GameSettings();
            var parser = new ConfigParser(filename);

            const string game = "Game Settings";
            settings.MaxPlayers = parser.Get(game, "maxplayers", "7").ToInt();
            settings.DrawUntilPlayable = parser.Get(game, "drawuntilplayable", "true").ToBool();
            settings.CanPlayAfterDraw = parser.Get(game, "playafterdraw", "true").ToBool();
            settings.CardsPerStartingHand = parser.Get(game, "cardsinfirsthand", "7").ToInt();
            settings.DeckFilename = parser.Get(game, "deck", null);

            const string server = "Server Settings";
            settings.HostIP = parser.Get(server, "ip", "127.0.0.1");
            settings.LogFilename = parser.Get(server, "log", null);
            settings.Port = parser.Get(server, "port", "2012").ToInt();

            return settings;
        }