Ejemplo n.º 1
0
        public static void SaveToFile(string filename, RomSettings settings)
        {
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            using (FileStream stream = new FileStream(filename, FileMode.CreateNew))
            {
                XmlSerializer ser = new XmlSerializer(typeof(RomSettings));
                ser.Serialize(stream, settings);
            }
        }
Ejemplo n.º 2
0
        public static RomSettings ReadFromFile(string filename)
        {
            RomSettings result = new RomSettings();

            if (File.Exists(filename))
            {
                using (FileStream stream = new FileStream(filename, FileMode.Open))
                {
                    XmlSerializer ser = new XmlSerializer(typeof(RomSettings));
                    result = (RomSettings)ser.Deserialize(stream);
                }
            }

            return(result);
        }