首先,我将使用C#编写一个应用程序,该应用程序将允许用户轻松地指定一系列带有参数和窗口位置的程序,命令或网站,然后单击即可启动它们。我试图确定使用XML或JSON编码用户文件是否会更好。
这是我对数据结构的初步设计:
XML格式
<AutoLauncher>
<Program>
<Location>C:\example.exe</Location>
<Arguments>
<Argument>
<Key>a</Key>
<Value>true</Value>
</Argument>
</Arguments>
<Position>
<Monitor>1</Monitor>
<X>0</X>
<Y>0</Y>
</Position>
</Program>
<Cmd>
<Command>example</Command>
<Arguments>...</Arguments>
<Position>...</Position>
</Cmd>
<Website>
<Url>www.example.com</Url>
<Browser>Default</Browser>
<Arguments>...</Arguments>
<Position>...</Position>
</Website>
</AutoLauncher>
JSON格式
{
Programs: [
{ Location: "C:\example.exe",
Arguments: [
{Key: "a", Value: true}
],
Position: {
Monitor: 1,
X: 0,
Y: 0
}
}
],
Commands:[
{ Command: "example",
Arguments:[...],
Position: {...}
],
Websites: [
{ Url: "www.example.com",
Browser: "default",
Arguments: [...],
Position: {...}
]
}
注意:我在命令和网站的参数和位置中使用了...,因为其结构与程序结构完全一样。
哪种数据结构最好(或者还有其他更好的数据结构)?
潇潇雨雨
慕工程0101907
相关分类