Exemple #1
0
        public void SaveToXml()
        {
            try
            {
                Presets.CheckFilePaths();

                XmlSerializer serializer = new XmlSerializer(typeof(Presets));

                TextWriter writer = new StreamWriter(xmlLocation);
                serializer.Serialize(writer, this);
                writer.Close();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
        }
Exemple #2
0
        public static Presets LoadFromXml()
        {
            try
            {
                Presets.CheckFilePaths();

                TextReader reader = new StreamReader(xmlLocation);

                XmlSerializer serializer = new XmlSerializer(typeof(Presets));

                Presets p = (Presets)serializer.Deserialize(reader);

                reader.Close();

                return(p);
            }
            catch
            {
                return(new Presets());
            }
        }