void LoadConfig() { string configFile = "appsettings.json"; try { config = MiniJson.Parse(File.ReadAllText(configFile)) as MJDict; } catch (FileNotFoundException) { config = new MJDict(); } }
public MatchInfo(string matchMessage) { var msg = MiniJson.Parse(matchMessage); var attr = (msg as MJDict)["attr"] as MJDict; if (!attr.TryGetValue("mm_players", out object plVal) && !attr.TryGetValue("mm_mmPlayers", out plVal)) { return; } var players = MiniJson.Parse((plVal as MJDict)["S"] as string) as MJList; PlayerCount = players.Count; foreach (var pl in players) { if (((pl as MJDict)["PlayerAttributes"] as MJDict).TryGetValue("private_match_data", out object data)) { PrivateMatchData = new PrivateMatchData(System.Convert.FromBase64String((data as MJDict)["valueAttribute"] as string)); HasMatchData = true; Creator = PrivateMatchData.Creator; Level = PrivateMatchData.LevelName; IsTeams = PrivateMatchData.Mode == 1; } } }