Exemplo n.º 1
0
        public void DeserializeRaces()
        {
            FileStream file = new FileStream(savedFileName, FileMode.Open, FileAccess.Read);

            allRaces = (RaceList)formatter.Deserialize(file);
            file.Close();
        }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            try
            {
                DeserializeRaces();
            }
            catch (SerializationException)
            {
                allRaces = new RaceList();
                MessageBox.Show("Corrupt data file.");
            }
            catch (FileNotFoundException)
            {
                allRaces = new RaceList();
            }
        }