Giter Club home page Giter Club logo

visualconfiguration's Introduction

可视化配置__加载器

  • 功能:可以通过可视化界面进行配置的输入,并导出成多种配置文件。

使用

  1. 编写XML文件 XML文件基本格式如下

其中windos节点是根节点,使用title表示输出后文件的名称height和weight表示可视化界面的高度和宽度。 row是表示一类配置,其中key属性会转化为ini文件中的Seciton。 除了两个基础节点控制,还要通过以下节点实现配置输入。

  1. 文本输入(text)
<text key="DefEncodingNoFound" label_name="文本框"></text>
  1. 单选(radio)
<radio key="CacheSitePage" label_name="单选按钮">Y(true)|N(false)</radio>
  1. 多选框(checkbox)
<checkbox key="DefPageSuffix" label_name="多选框">C1(cb1)|C2(cb2)|C3(cb3)</checkbox>	
  1. 下拉框(select)
<select key="NumThread" label_name="下拉框">1|2|4|8|16|32|64</select>

上述,key属性会转化为ini文件中键(Key),你做的配置会保存为对应键(Key)的值(Value),label_name属性是,可视化界面的该项目的输入提示 text节点的值为空(不用编辑),其他节点如果有多个选项,使用|分割,并且如果选项后带有小括号(英文),则在保存数据时,保存对于的小括号中的值

例如,给定的demo.xml

<?xml version="1.0" encoding="utf-8"?>
<windows title="演示配置" height="550" widht="500">
<row key="Request">
	<select key="UA" label_name="UA选择">随机生成(1)|来源于文件(2)</select>
</row>
<row key="Coding">
	<checkbox key="DefEncoding" label_name="默认使用编码">utf-8|big5|gbk</checkbox>
	<text key="DefEncodingNoFound" label_name="编码不确定,强制使用"></text>
</row>
<row key="SavePage">
	<radio key="CacheSitePage" label_name="是否缓存网页">缓存(true)|不缓存(false)</radio>
	<checkbox key="DefPageSuffix" label_name="允许缓存的网页后缀">html|htm|asp|shtml|php|jsp|nsp|sp</checkbox>
</row>
<row key="LoadFunc">
	<radio key="UseStatic" label_name="静态请求">静态请求(true)|动态请求(false)</radio>
	<select key="NumThread" label_name="请求线程数量">1|2|4|8|16|32|64l</select>
</row>
</windows>
  1. 运行程序

安装,并运行程序。

  1. 输入配置

配置中不能含有空、未选选择的属性,否者无法保存。

  1. 保存并导出

目前支持导出文件类型(xml,ini,json,csv)。

  1. 导出文件示例

1.Json

{
"Request": {
"UA": 2.0
},
"Coding": {
"DefEncoding": [
    "utf-8",
    "big5"
],
"DefEncodingNoFound": "utf-8"
},
"SavePage": {
"CacheSitePage": true,
"DefPageSuffix": [
    "html",
    "htm",
    "asp"
]
},
"LoadFunc": {
"UseStatic": true,
"NumThread": 4.0
}
}

2.XMl

<root type="object">
<Request type="object">
	<UA type="number">
		2.0
	</UA>
</Request>
<Coding type="object">
	<DefEncoding type="array">
		<item type="string">
			utf-8
		</item>
		<item type="string">
			big5
		</item>
	</DefEncoding>
	<DefEncodingNoFound type="string">
		utf-8
	</DefEncodingNoFound>
</Coding>
<SavePage type="object">
	<CacheSitePage type="boolean">
		true
	</CacheSitePage>
	<DefPageSuffix type="array">
		<item type="string">
			html
		</item>
		<item type="string">
			htm
		</item>
		<item type="string">
			asp
		</item>
	</DefPageSuffix>
</SavePage>
<LoadFunc type="object">
	<UseStatic type="boolean">
		true
	</UseStatic>
	<NumThread type="number">
		4.0
	</NumThread>
</LoadFunc>
</root>

3.Ini(这是ini文件类型)

[Request]
UA=	2.0
[Coding]
DefEncoding=	[utf-8,big5]
DefEncodingNoFound=	utf-8
[SavePage]
CacheSitePage=	true
DefPageSuffix=	[html,htm,asp]
[LoadFunc]
UseStatic=	true
NumThread=	4.0

4.csv(csv类型)

Request,UA,2.0
Coding,DefEncoding,utf-8,big5
Coding,DefEncodingNoFound,utf-8
SavePage,CacheSitePage,true
SavePage,DefPageSuffix,html,htm,asp
LoadFunc,UseStatic,true
LoadFunc,NumThread,4.0

visualconfiguration's People

Contributors

3hexv avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.