Exemplo n.º 1
0
        public static void Deserialize()
        {
            FileStream    fss   = new FileStream("champions.xml", FileMode.Open, FileAccess.Read);
            XmlSerializer xs    = new XmlSerializer(typeof(CanstrForsave));
            CanstrForsave cnst2 = xs.Deserialize(fss) as CanstrForsave;

            DesOutput.counter = cnst2.counter;
            DesOutput.list    = cnst2.list;
            DesOutput.listint = cnst2.listint;


            fss.Close();
        }
Exemplo n.º 2
0
        public static void Serialize()
        {
            File.Delete("champions.xml");

            CanstrForsave cnst = new CanstrForsave();

            cnst.list.Add(Butter.username);
            cnst.listint.Add(Butter.score);
            cnst.counter++;
            FileStream    fs = new FileStream("champions.xml", FileMode.OpenOrCreate, FileAccess.Write);
            XmlSerializer xs = new XmlSerializer(typeof(CanstrForsave));

            xs.Serialize(fs, cnst);
            fs.Close();
        }