public void load() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "RT Files | *.rt"; List <Object> loadObjects = new List <object>(); if (ofd.ShowDialog() == DialogResult.OK) { Stream stream = File.Open(ofd.FileName, FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); Saver saver = (Saver)bf.Deserialize(stream); this.listeAccesPoints = saver.listeAccesPoints; this.listeStations = saver.listeStations; this.listeObstacles = saver.listeObstacles; this.generator = saver.generator; this.nbrAccesPoint = saver.nbrAccesPoint; this.nbrStation = saver.nbrStation; this.backTableau = saver.backTableau; this.defaultPuissance = saver.defaultPuissance; this.file = ofd.FileName; stream.Close(); } }
public Saver(List <AccesPoint> listeAccesPoints, List <Station> listeStations, List <Obstacle> listeObstacles, GenerateColor generator, int nbrAccesPoint, int nbrStation, float defaultPuissance, Color backTableau) { this.listeAccesPoints = listeAccesPoints; this.listeObstacles = listeObstacles; this.listeStations = listeStations; this.generator = generator; this.nbrAccesPoint = nbrAccesPoint; this.nbrStation = nbrStation; this.defaultPuissance = defaultPuissance; this.backTableau = backTableau; }