public static void Deserialize() { FileStream fss = new FileStream("xexe.xml", FileMode.Open, FileAccess.Read); XmlSerializer xs = new XmlSerializer(typeof(Constr)); Constr cnstr2 = xs.Deserialize(fss) as Constr; Returnlvl.Uroven = cnstr2.lvl1; Returnlvl.coordinatexx = cnstr2.xx; Returnlvl.coordinateyy = cnstr2.yy; Returnlvl.count = cnstr2.cnt; Returnlvl.login = cnstr2.login; Returnlvl.score = cnstr2.score; fss.Close(); }
public void Serialize() { Constr cnstr = new Constr(lvl, username, x, y); cnstr.lvl = lvl1; cnstr.username = login; cnstr.x = xx; cnstr.y = yy; FileStream fs = new FileStream("cnstr.xml", FileMode.OpenOrCreate, FileAccess.Write); XmlSerializer xs = new XmlSerializer(typeof(Constr)); xs.Serialize(fs, cnstr); fs.Close(); }
public static void Serialize(int lvl, string username, int x, int y, int count, int score) { File.Delete("xexe.xml"); Constr cnstr = new Constr(); cnstr.lvl1 = lvl; cnstr.login = username; cnstr.xx = x; cnstr.yy = y; cnstr.cnt = count; cnstr.score = score; FileStream fs = new FileStream("xexe.xml", FileMode.OpenOrCreate, FileAccess.Write); XmlSerializer xs = new XmlSerializer(typeof(Constr)); xs.Serialize(fs, cnstr); fs.Close(); }