Пример #1
0
        public static void SaveSettings(ProSettings data)
        {
            string        fileName   = "ProConfig.config";
            XmlSerializer serializer = new XmlSerializer(typeof(ProSettings));

            // serialize the object
            FileStream fs = new FileStream(fileName, FileMode.Create);

            serializer.Serialize(fs, data);
            fs.Close();
        }
Пример #2
0
        public static ProSettings GetSettings()
        {
            ProSettings   data       = null;
            XmlSerializer serializer = new XmlSerializer(typeof(ProSettings));

            try
            {
                string     fileName = "ProConfig.config";
                FileStream fs       = new FileStream(fileName, FileMode.Open);
                data = (ProSettings)serializer.Deserialize(fs);
                fs.Close();
            }
            catch
            {
                data = new ProSettings();
            }


            return(data);
        }