// Server public bool Kick(string characterName) { ClientSession session = Sessions.FirstOrDefault(s => s.Character != null && s.Character.Name.Equals(characterName)); if (session == null) { return(false); } session.Disconnect(); return(true); }
private void OnSessionKicked(object sender, EventArgs e) { if (sender != null) { Tuple <long?, string> kickedSession = (Tuple <long?, string>)sender; ClientSession targetSession = Sessions.FirstOrDefault(s => (!kickedSession.Item1.HasValue || s.SessionId == kickedSession.Item1.Value) && ((String.IsNullOrEmpty(kickedSession.Item2) || s.Account.Name == kickedSession.Item2))); if (targetSession != null) { targetSession.Disconnect(); } } }