public void UpdateConfigFile()
 {
     //读取配置项
     SettingItem[] arrItems = ConfigurationUtils.readFile(CONFIG_FILE_PATH);
     //修改数据
     foreach (SettingItem si in arrItems)
     {
         if (Configuration.ContainsKey(si.key))
         {
             si.value = Configuration[si.key];
         }
     }
     //保存配置项
     ConfigurationUtils.saveFile(CONFIG_FILE_PATH, arrItems);
 }
Ejemplo n.º 2
0
        private void saveFile()
        {
            SettingItem[] arrItems  = new SettingItem[lvSettingItem.Items.Count];
            JArray        jsonArray = new JArray();

            int index = 0;

            foreach (ListViewItem lvi in lvSettingItem.Items)
            {
                arrItems[index].key   = lvi.SubItems[0].Text;
                arrItems[index].value = lvi.SubItems[1].Text;
                arrItems[index].note  = lvi.SubItems[2].Text;
                arrItems[index].group = lvi.Group.Header;
                index++;
            }

            //保存配置文件
            ConfigurationUtils.saveFile(UserInstance.CONFIG_FILE_PATH, arrItems);
        }