维护多个设置文件 [英] Maintaining multiple settings files

查看:167
本文介绍了维护多个设置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有一个包含各种单选按钮,目录浏览器,日期选择器等的表单。应用程序使用设置,并执行文件删除任务。我想知道将这些设置保存到可以在以后加载的外部文件的最佳策略是什么。因此,基本上可以加载,执行每个配置,然后加载另一个配置。此外,配置可以跨安装/用户传递。

Currently, I have a form that has various radio buttons, directory browsers, date pickers etc. The application uses the settings, and executes a file deletion task. I was wondering what is the best strategy to save these settings to an external file that can be loaded at a later date. So essentially each configuration can be loaded, executed, and then another configuration loaded. Also, the configuration can be passed across installations / users.

我不相信我可以使用内部.settings文件,因为我将有多组可以加载的设置。

I dont believe I can use the internal .settings file because I will have multiple sets of settings that can be loaded.

推荐答案

有多种格式可供选择,用于存储以下设置:

There are many formats to choose from for storing settings such as:


  • INI

  • CSV

  • YAML

  • JSON

  • XML

  • INI
  • CSV
  • YAML
  • JSON
  • XML

最好的策略之一就是使用XML。 XML是最流行的设置/配置文件格式之一,因为它易于解析,语法规范,功能强大且易于阅读。

One of the best strategies would be to use XML. XML is one of the most popular formats for setting/configuration files because its easy to parse, the syntax is well specified and is powerful yet easy to read.

使用XML文件允许配置跨安装传递并在用户之间共享。

Using XML files allows configurations to be passed across installations and shared among users.

此外,如果您有一个描述XML配置文件的XSD(模式文件),那么它对您来说是微不足道的。用于验证不同配置文件的应用程序。

In addition if you have an XSD (schema file) that describes your XML configuration files, it is trivial for your application to validate different configuration files.

这篇关于维护多个设置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆