Exemplo n.º 1
0
        public static AppSettingsBase LoadFromXmlFile(string FileName)
        {
            AppSettingsBase result     = new AppSettingsBase();
            XmlSerializer   serializer = new XmlSerializer(typeof(AppSettingsBase));

            if (!File.Exists(FileName))
            {
                return(result);
            }

            FileStream fs = new FileStream(FileName, FileMode.Open);

            try
            {
                result = (AppSettingsBase)serializer.Deserialize(fs);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public static AppSettingsBase Load(string filename)
        {
            AppSettingsBase settings = new AppSettingsBase();

            Filename = filename;

            settings = LoadFromXmlFile(Filename);

            settings.OnLoad();

            return(settings);
        }