Esempio n. 1
0
        public static void SaveSettings(AllSettings ObjSettings)
        {
            System.Xml.Serialization.XmlSerializer writer =
                new System.Xml.Serialization.XmlSerializer(typeof(AllSettings));

            var fileName = HttpContext.Current.Server.MapPath("/App_Data/AllSettings.xml");

            System.IO.FileStream file = System.IO.File.Create(fileName);

            writer.Serialize(file, ObjSettings);
            file.Close();
        }
Esempio n. 2
0
        public static AllSettings LoadSettings()
        {
            AllSettings Setting = new AllSettings();

            try {
                var fileName = HttpContext.Current.Server.MapPath("/App_Data/AllSettings.xml");
                System.Xml.Serialization.XmlSerializer reader =
                    new System.Xml.Serialization.XmlSerializer(typeof(AllSettings));
                System.IO.StreamReader file = new System.IO.StreamReader(fileName);
                Setting = (AllSettings)reader.Deserialize(file);
                file.Close();
                return(Setting);
            }
            catch (Exception)
            {
                return(Setting);
            }
        }