Exemple #1
0
        public ListeJournee ChargerJournees(ListeJournee journees)
        {
            XMLPersistJournees journeesXMLPersister = new XMLPersistJournees();

            journees = journeesXMLPersister.Load(journees, UserFilePath);

            return(journees);
        }
Exemple #2
0
        public void Save(ListeJournee journees, string fileName)
        {
            XmlSerializer mySerializer = new XmlSerializer(typeof(ListeJournee));
            // To write to a file, create a StreamWriter object.
            StreamWriter myWriter = new StreamWriter(fileName);

            mySerializer.Serialize(myWriter, journees);
            myWriter.Close();
        }
Exemple #3
0
        public ListeJournee Load(ListeJournee journees, string fileName)
        {
            // Constructs an instance of the XmlSerializer with the type
            // of object that is being deserialized.
            XmlSerializer mySerializer = new XmlSerializer(typeof(ListeJournee));
            // To read the file, creates a FileStream.
            FileStream myFileStream = new FileStream(fileName, FileMode.Open);

            // Calls the Deserialize method and casts to the object type.
            journees = (ListeJournee)mySerializer.Deserialize(myFileStream);
            myFileStream.Close();

            return(journees);
        }
Exemple #4
0
        public void SauverJournees(ListeJournee journees)
        {
            XMLPersistJournees journeesXMLPersister = new XMLPersistJournees();

            journeesXMLPersister.Save(journees, UserFilePath);
        }