Exemplo n.º 1
0
        private void NudPlyrCount_ValueChanged(object sender, EventArgs e)
        {
            GameData.Instance.PlayersCount = (int)nudPlyrCount.Value;

            XMLSettings settings = new XMLSettings
            {
                PlayersCount = (int)nudPlyrCount.Value
            };

            XmlSerializer writer = new XmlSerializer(typeof(XMLSettings));
            var           path   = _pathToSettings;
            FileStream    file   = File.Create(path);

            writer.Serialize(file, settings);
            file.Close();
        }
Exemplo n.º 2
0
        private void LoadSettings()
        {
            XmlSerializer reader =
                new XmlSerializer(typeof(XMLSettings));

            if (File.Exists(_pathToSettings))
            {
                StreamReader file = new StreamReader(
                    _pathToSettings);
                XMLSettings settings = (XMLSettings)reader.Deserialize(file);
                file.Close();

                GameData.Instance.PlayersCount = settings.PlayersCount;
                nudPlyrCount.Value             = GameData.Instance.PlayersCount;
            }
        }