这个类似于 ini 文件的文件格式是什么?
我是在旧系统之上的编程工具,该系统使用某种准标记格式的大量配置文件。或者,这可能是一种混蛋格式,曾经从某种真正的格式中分支出来。没有标题。 开始
#
( section1
Val1 = ""
Val2 = "1"
Val3 = "1"
Val3 = "2"
Val3 = "Anchor"
)
( slave
Name = ""
Val1 = ""
Val2 = "1"
Val3 = "1"
Val7 = "0x42"
Val8 = "Default"
Val9 = 0
Val10 = 2.000000000
)
( trend_sys
# tr_sav_intv 20 1700
# tr_max_ps_len 300
# ps_trobj "IG1115" "Meas1" "PRIM" 2 1 1 1 0 300 0 0 1.000000 150 150 "" 0 0 0
# hs_trobj "IG1115" "Meas1" "PRIM" 2 1 1 0 0 40 0 0 0.000000 0 0
)
它从另一个示例(实际示例)
# storedate 21/04/10 12:07.22 (station1) station0
( Device
BlockNo = 1
BlockType = 1
)
( Device
BlockNo = 2
BlockType = 1
)
( Device
BlockNo = 3
BlockType = 1
)
另一个版本有一个额外的部分级别。
{ SuperSection1
( Section1
val1 = ""
)
( Section2
val1 = ""
)
}
{ SuperSection2
( Section1
val1 = ""
)
( Section2
val1 = ""
)
}
请注意,
- 文件中的节名称可以相同。
- 一个节内的值名称可以相同。
- 值可以是字符串,其他可以是数字(包括浮点数)
- 以“#”开头的行不是注释。至少,它们不仅仅用作注释。它们必须得到保存并易于获取。
这种格式有名字吗? .NET 支持这种格式吗?
I am programming tools on top of an old system that uses a lot of configuration files in some quasi markup format. Or, possibly, this is a bastard format that once in the past branched off some genuine format. There is no header. It starts right in
#
( section1
Val1 = ""
Val2 = "1"
Val3 = "1"
Val3 = "2"
Val3 = "Anchor"
)
( slave
Name = ""
Val1 = ""
Val2 = "1"
Val3 = "1"
Val7 = "0x42"
Val8 = "Default"
Val9 = 0
Val10 = 2.000000000
)
( trend_sys
# tr_sav_intv 20 1700
# tr_max_ps_len 300
# ps_trobj "IG1115" "Meas1" "PRIM" 2 1 1 1 0 300 0 0 1.000000 150 150 "" 0 0 0
# hs_trobj "IG1115" "Meas1" "PRIM" 2 1 1 0 0 40 0 0 0.000000 0 0
)
Another example (an actual example)
# storedate 21/04/10 12:07.22 (station1) station0
( Device
BlockNo = 1
BlockType = 1
)
( Device
BlockNo = 2
BlockType = 1
)
( Device
BlockNo = 3
BlockType = 1
)
Another version has an extra section level.
{ SuperSection1
( Section1
val1 = ""
)
( Section2
val1 = ""
)
}
{ SuperSection2
( Section1
val1 = ""
)
( Section2
val1 = ""
)
}
Note that
- section names can be identical within a file.
- value names can be identical within a section.
- values can be strings, others can be numbers (including floating point)
- lines starting with "#" are not comments. At least, they are not used only as comments. They must be preserved and accessible.
Does this format have a name? Is there any .NET support for this format?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这种格式没有我所知道的名称,而且 .NET 不为其提供本机支持。但它使您能够构建解析器:-)
No, this format doesn't have a name I know of and no, .NET doesn't provide native support for it. But it gives you the power to build a parser :-)