Levels
{
Flags
{
"reservation" "a" //Reserved slots
"generic" "b" //Generic admin, required for admins
"kick" "c" //Kick other players
"ban" "d" //Banning other players
"unban" "e" //Removing bans
"slay" "f" //Slaying other players
"changemap" "g" //Changing the map
"cvars" "h" //Changing cvars
"config" "i" //Changing configs
"chat" "j" //Special chat privileges
"vote" "k" //Voting
"password" "l" //Password the server
"rcon" "m" //Remote console
"cheats" "n" //Change sv_cheats and related commands
"custom1" "o"
"custom2" "p"
"custom3" "q"
"custom4" "r"
"custom5" "s"
"custom6" "t"
"root" "z"
}
}
这是一个sourcemod配置文件,我很好奇它是什么数组类型,我想开始用C#解析它。
我知道那不是JSON / PHP ARRAY或基本的C#数组,那它是什么?
它包含主键,子键和子键变量..
提前致谢!
答案 0 :(得分:-2)
至于我收到的评论,看起来它不是数组类型..只是一个文本文件,可以帮助程序理解它..
通过C#创建它非常简单。
Dictionary<string, Flags> test = new Dictionary<string, Flags> ();
void Populate()
{
Flags test2 = new Flags();
var returnx = test2.Return();
test.Add("Levels", returnx);
}
internal class Flags
{
Dictionary<string,string> Flags = new Dictionary<string,string>();
public Dictionary<string, string> Return()
{
Flags.Add("reservation", "a");
Flags.Add("generic", "b");
// Etc...
return Flags;
}
}
无论如何,谢谢你的帮助。