An open source component of an automatic read-write configuration file written in C #

Source: Internet
Author: User

Demand

In order to achieve the purpose of automatic reading and writing, we need to meet the following requirements:

1, for different formats of the configuration file, just add the appropriate configuration mode interface implementation, you can make the component automatically read the same format configuration file.

2, can easily set the parameters of different modes, such as INI configuration file, we need to set the section, Key,defautvalue and other parameters.

3, all the automatic read and write process is encapsulated in the base class implementation, the user does not need to care about the format of the configuration file, or as in the past must be from the configuration file to read out the corresponding fields and assign values to the corresponding fields in the entity. The consumer only needs to derive an entity class from the base class and define the property fields in that entity class.

4, according to the configuration file, automatic generation of entity class tools

5, support format: support three kinds of common configuration file format, respectively, is Xml,ini and registry. Users can refer to these three configuration patterns, write their own special format of the pattern interface implementation.

Version planning

V1.0 implementation Requirements 1, 2, 3. and provides the pattern interface implementation of Xml,ini two kinds of configuration file formats

V1.1 provides schema interface implementations for registry configuration formats

V1.2 provides an entity class automatic generation tool for the first three modes

Design ideas

As shown in the figure above, the entire component consists of three parts:

The Configuration class is the base class for all configuration file entity classes. All entity classes are derived classes of this base class.

Iconfigurationpattern is the interface of configuration mode

The third part is the implementation class of configuration mode interface, there are two kinds of configuration mode Xmlpattern and Inipattern at present.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.