コード例 #1
0
ファイル: SettingsManager.cs プロジェクト: erisonliang/Blaze
 public AutomationOptionsInfo GetAutomationOptionsInfo()
 {
     if (_automation_options_info == null)
     {
         bool          is_monitoring   = true;
         bool          stop_monitoring = true;
         List <string> categories      = INIManipulator.GetCategories(_config_file);
         if (categories.Count > 0)
         {
             string category = "automation";
             if (categories.Contains(category))
             {
                 List <string> keys = INIManipulator.GetKeys(_config_file, category);
                 if (keys.Count > 0)
                 {
                     string is_monitoring_name   = "monitoringEnabled";
                     string stop_monitoring_name = "stopMonitoringOnBattery";
                     if (keys.Contains(is_monitoring_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, is_monitoring_name, "true"), out is_monitoring);
                     }
                     if (keys.Contains(stop_monitoring_name))
                     {
                         Boolean.TryParse(INIManipulator.GetValue(_config_file, category, stop_monitoring_name, "true"), out stop_monitoring);
                     }
                 }
             }
         }
         _automation_options_info = new AutomationOptionsInfo(is_monitoring, stop_monitoring);
     }
     return(_automation_options_info);
 }
コード例 #2
0
ファイル: SettingsManager.cs プロジェクト: erisonliang/Blaze
        public void SaveAutomationOptionsInfo(AutomationOptionsInfo info)
        {
            _automation_options_info = info;
            string category = "automation";

            INIManipulator.WriteValue(_config_file, category, "monitoringEnabled", info.IsMonitoringEnabled.ToString());
            INIManipulator.WriteValue(_config_file, category, "stopMonitoringOnBattery", info.StopAutoUpdateOnBattery.ToString());
        }