예제 #1
0
        public void SaveSystemOptionsInfo(SystemOptionsInfo info)
        {
            _system_options_info = info;
            string category = "system";

            INIManipulator.WriteValue(_config_file, category, "updateTime", info.UpdateTime.ToString());
            INIManipulator.WriteValue(_config_file, category, "stopAutoUpdateOnBattery", info.StopAutoUpdateOnBattery.ToString());
            INIManipulator.WriteValue(_config_file, category, "autoUpdate", info.AutoUpdates.ToString());
        }
예제 #2
0
 public SystemOptionsInfo GetSystemOptionsInfo()
 {
     if (_system_options_info == null)
     {
         int           update_time      = 20;
         bool          stop_auto_update = true;
         bool          auto_update      = true;
         List <string> categories       = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "system";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Count > 0)
                 {
                     string update_time_name      = "updateTime";
                     string stop_auto_update_name = "stopAutoUpdateOnBattery";
                     string auto_update_name      = "autoUpdate";
                     if (keys.Contains(update_time_name))
                     {
                         Int32.TryParse(INIManipulator.GetValue(_config_file, category, update_time_name, "20"), out update_time);
                     }
                     if (keys.Contains(stop_auto_update_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, stop_auto_update_name, "true"), out stop_auto_update);
                     }
                     if (keys.Contains(auto_update_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, auto_update_name, "true"), out auto_update);
                     }
                 }
             }
         }
         _system_options_info = new SystemOptionsInfo(update_time, stop_auto_update, auto_update);
     }
     return(_system_options_info);
 }