예제 #1
0
        private void SerializeNotCompletedGame()
        {
            BinaryFormatter     binFormat = new BinaryFormatter();
            NotCompletedGameCfg cfg       = new NotCompletedGameCfg(_configuration, _players, NumberOfTeam, NumberOfMotion);

            using (Stream fStream = new FileStream(string.Format("({0})({1})({2})({3})({4})NCGConfig.dat", DateTime.Today.Day, DateTime.Today.Month, DateTime.Today.Year, DateTime.Now.TimeOfDay.Minutes, DateTime.Now.TimeOfDay.Seconds), FileMode.Create))
            {
                binFormat.Serialize(fStream, cfg);
                fStream.Close();
            }
        }
예제 #2
0
        public GameWindow(NotCompletedGameCfg ncgcfg)
        {
            InitializeWindow();

            _configuration = ncgcfg.Cfg;
            _players       = ncgcfg.Players;
            NumberOfMotion = ncgcfg.NumberOFMotion;
            NumberOfTeam   = ncgcfg.NumberOfTeam;

            InitializeTableParameters();

            StartGame();
        }
예제 #3
0
        private NotCompletedGameCfg DeserializeNCGCfg(string fileName)
        {
            BinaryFormatter     binFormat     = new BinaryFormatter();
            NotCompletedGameCfg configuration = new NotCompletedGameCfg();

            using (Stream fStream = File.OpenRead(fileName))
            {
                try
                {
                    configuration = (NotCompletedGameCfg)binFormat.Deserialize(fStream);
                }
                catch
                {
                    MessageBox.Show("Выберите файл с правильной конфигурацией ()", "Справка");
                }
            }
            return(configuration);
        }