dfm to json
v1.0.0.0
將DFM轉換為JSON,以獲取更多信息問題-HELP命令
您可以在此處下載最新版本。
您可以在此處檢查語法(EBNF)。
考慮此dfm sample.dfm:
object Form1: TForm1
Left = 192
Font. Name = ' MS Sans Serif '
Font.Style = []
object Image1: TImage
Picture.Data = {
07544269746D617036550000424D365500000000000036000000280000005500
000055000000010018000000000000550000C40E0000C40E0000000000000000
}
end
object ListBox1: TListBox
Items.Strings =
( ' this is string. '
+ ' and another one... '
+ ' and another one... '
+ ' now with apostrophe '' ' # 13 # 10
+ ' even with control characters ' # 7 # 9 ' mixed in the string '
)
end
object DBGrid1: TDBGrid
Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgConfirmDelete, dgCancelOnExit]
Columns = <
item
Expanded = False
Visible = True
end
item
Expanded = False
Visible = True
end >
end
end執行命令:
$ dfm-to-json resources/sample.dfm產生以下JSON:
{
"kind" : " object " ,
"name" : " Form1 " ,
"type" : {
"name" : " TForm1 " ,
"index" : null
},
"properties" : {
"font.name" : " MS Sans Serif " ,
"font.style" : [],
"left" : 192
},
"objects" : [
{
"kind" : " object " ,
"name" : " Image1 " ,
"type" : {
"name" : " TImage " ,
"index" : null
},
"properties" : {
"picture.data" : " 07544269746D617036550000424D365500000000000036000000280000005500000055000000010018000000000000550000C40E0000C40E0000000000000000 "
},
"objects" : []
},
{
"kind" : " object " ,
"name" : " ListBox1 " ,
"type" : {
"name" : " TListBox " ,
"index" : null
},
"properties" : {
"items.strings" : [
" this is string.and another one...and another one...now with apostrophe ' rn even with control characters u0007 t mixed in the string "
]
},
"objects" : []
},
{
"kind" : " object " ,
"name" : " DBGrid1 " ,
"type" : {
"name" : " TDBGrid " ,
"index" : null
},
"properties" : {
"columns" : {
"items" : [
{
"name" : " item " ,
"properties" : {
"expanded" : false ,
"visible" : true
}
},
{
"name" : " item " ,
"properties" : {
"expanded" : false ,
"visible" : true
}
}
]
},
"options" : [
" dgTitles " ,
" dgIndicator " ,
" dgColumnResize " ,
" dgColLines " ,
" dgRowLines " ,
" dgTabs " ,
" dgRowSelect " ,
" dgConfirmDelete " ,
" dgCancelOnExit "
]
},
"objects" : []
}
]
}$ git clone https://github.com/jean-lopes/dfm-to-json.git
$ cd dfm-to-json
$ stack install
$ dfm-to-json --version如果您無法執行最後一個命令,則意味著您在環境PATH變量中沒有默認的stack install目錄。檢查本地鍵路
Windows用戶的提示:默認stack Local-bin-Path是: %APPDATA%localbin