Exemple #1
0
        // Guarda un Oferts en un XML
        public static bool SaveAs(string filename, Oferts oferts)
        {
            bool tResult = false;

            try
            {
                System.IO.File.WriteAllText(filename, oferts.ToString(), Encoding.Unicode);
                tResult = true;
            }
            catch
            {
                tResult = false;
            }

            return(tResult);
        }
Exemple #2
0
        // Carga un Oferts desde un XML
        public static Oferts LoadFrom(string filename)
        {
            Oferts tOferts = null;

            try
            {
                var          serializer = new XmlSerializer(typeof(Oferts));
                FileStream   fs         = new FileStream(filename, FileMode.Open);
                StreamReader stream     = new StreamReader(fs, Encoding.Unicode);
                tOferts = (Oferts)serializer.Deserialize(stream);
                fs.Close();
            }
            catch
            { }

            return(tOferts);
        }