public override bool ParseKey(string key, TomlObject tomlObj, ParseContext ctx) { if (base.ParseKey(key, tomlObj, ctx)) { return(true); } switch (key) { case "host": var host = TomlTools.GetValues <string>(tomlObj); if (host == null) { ctx.Errors.Add("<host> Field has invalid data."); } else { MatchHost = new HashSet <string>(host); } return(true); case "groupid": var groupid = TomlTools.GetValues <ulong>(tomlObj); if (groupid == null) { ctx.Errors.Add("<groupid> Field has invalid data."); } else { MatchClientGroupId = new HashSet <ulong>(groupid); } return(true); case "channelgroupid": var cgroupid = TomlTools.GetValues <ulong>(tomlObj); if (cgroupid == null) { ctx.Errors.Add("<channelgroupid> Field has invalid data."); } else { MatchChannelGroupId = new HashSet <ulong>(cgroupid); } return(true); case "useruid": var useruid = TomlTools.GetValues <string>(tomlObj); if (useruid == null) { ctx.Errors.Add("<useruid> Field has invalid data."); } else { MatchClientUid = new HashSet <string>(useruid); } return(true); case "perm": var perm = TomlTools.GetValues <string>(tomlObj); if (perm == null) { ctx.Errors.Add("<perm> Field has invalid data."); } else { MatchPermission = new HashSet <string>(perm); } return(true); case "apitoken": var apitoken = TomlTools.GetValues <string>(tomlObj); if (apitoken == null) { ctx.Errors.Add("<apitoken> Field has invalid data."); } else { MatchToken = new HashSet <string>(apitoken); } return(true); case "isapi": if (!TomlTools.TryGetValue <bool>(tomlObj, out var isapi)) { ctx.Errors.Add("<isapi> Field has invalid data."); } else { MatchIsApi = isapi; } return(true); case "visibility": var visibility = TomlTools.GetValues <TextMessageTargetMode>(tomlObj); if (visibility == null) { ctx.Errors.Add("<visibility> Field has invalid data."); } else { MatchVisibility = visibility; } return(true); case "rule": if (tomlObj.TomlType == TomlObjectType.ArrayOfTables) { var childTables = (TomlTableArray)tomlObj; foreach (var childTable in childTables.Items) { var rule = new RightsRule(); Children.Add(rule); rule.Parent = this; rule.ParseChilden(childTable, ctx); } return(true); } else { ctx.Errors.Add("Misused key with reserved name \"rule\"."); return(false); } default: // group if (key.StartsWith("$")) { if (tomlObj.TomlType == TomlObjectType.Table) { var childTable = (TomlTable)tomlObj; var group = new RightsGroup(key); Children.Add(group); group.Parent = this; group.ParseChilden(childTable, ctx); return(true); } else { ctx.Errors.Add($"Misused key for group declaration: {key}."); } } return(false); } }