public static ArmyMember Parse(JToken token) { var result = new ArmyMember(); result.Id = (long)token["playerid"]; result.Level = (int)token["playerlevel"]; result.Name = (string)token["playername"]; return(result); }
private async void ParseMembers(JToken token) { members.Clear(); foreach (var memberToken in token) { var member = ArmyMember.Parse(memberToken); members.Add(member); } var oldSelectedIndex = memberList.SelectedIndex; memberList.SetObjects(members, true); memberList.SelectedIndex = oldSelectedIndex; //kiem tra co con trong to doi hay ko if (members.Count == 0) { isJoinning = false; isCreating = false; } //auto kick if (this.chkKick.Checked) { for (int i = 1; i < members.Count; i++) { if (!findInList(members[i].Name)) { var packet = await packetWriter.KickArmyPlayerAsync(members[i].Id); //nếu bị kick host thì giai tan lập lại if (!"".Equals(packet.Message)) { string str = Parse34104(packet); if ("Thành viên không Quân đội không tồn tại".Equals(str)) { await packetWriter.DisbandArmyAsync(); createArmy(); } } } } } }