예제 #1
0
        public static T GetInfo(string type, string key)
        {
            ConfigurationList <T> list = GetList(type);

            if (list == null)
            {
                return(default(T));
            }
            return(list[key]);
        }
예제 #2
0
 public static void SaveList(string type, ConfigurationList <T> list)
 {
     try
     {
         ConfigFilesManager <ConfigurationList <T> > .SaveToXml(type, list);
     }
     catch (System.Exception ex)
     {
         throw (ex);
     }
 }
예제 #3
0
        public void SetCityName(string name)
        {
            ConfigurationList <KeyConfig> list = ConfigManager <KeyConfig> .GetList("WeatherCitySetting");

            if (list != null)
            {
                list["CityName"].KeyValue = name;
                ConfigManager <KeyConfig> .SaveList("WeatherCitySetting", list);
            }
            else
            {
                list = new ConfigurationList <KeyConfig>();
                list.Add(new KeyConfig {
                    Key = "CityName", KeyValue = name
                });
                ConfigManager <KeyConfig> .SaveList("WeatherCitySetting", list);
            }
        }
예제 #4
0
        public static void SaveToList(string type, T info)
        {
            ConfigurationList <T> list;

            try
            {
                list = ConfigFilesManager <ConfigurationList <T> > .GetFromXml(type);
            }
            catch
            {
                list = new ConfigurationList <T>();
            }
            list.Add(info.Key, info);
            try
            {
                ConfigFilesManager <ConfigurationList <T> > .SaveToXml(type, list);
            }
            catch (System.Exception ex)
            {
                throw (ex);
            }
        }