Skip to content

fcmai/UnifiedConfig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnifiedConfig

A common C# class to manipulate xml, ini and json config files with unified interfaces.

Version Downloads

Features

  • Wrapped the difference among xml, ini and json, you can access the config file without the consideration of format.
  • Provide XPath as default locating method.
  • Saving file will not change the original format.

Usage

Recommend nuget package

Install-Package UnifiedConfig

OR

  1. compile the class library and add reference of the dlls including the "UnifiedConfig.dll" to your project.
  2. add using statement to your namespaces.
  3. you can call the functions by using the following code or just read the test class.
ConfigManager config = new ConfigManager("test.ini");
Assert.Equal("5", config[@"//Default/Interval"]);

alternatively, you can directly start a project from the solution. By adding a new project into the solution, you can easily make use of the class. A unittest project is provided.

Roadmap

Issues and PRs are welcomed.

  • Support for json
  • Nuget package
  • Auto-inference the type of config file without extension detection
  • Support returning more types other than string (via ToObject method)
  • Support of IEnumerable for sophisticated query
  • Support for int indexer is removed since the xpath supported already
  • Ready to go template project
  • Case-sensitive swtich for path matching

Update Notes

UPDATE 2017/07/29: Add Case-sensitive swtich for path matching

UPDATE 2017/07/25: Add Name property and fix the IEnumerable bug.

UPDATE 2017/07/24: Add IEnumerable support for sophisticated query.

UPDATE 2017/07/22: Add Auto-inference and type conversion.

UPDATE 2017/07/20: Add json support.

UPDATE 2017/07/18: Nuget package supported.

About

A common configuration utility which operates xml and ini as well as json. It enable you to invoke unified method for different config files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%