public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { UserManage.Instance.CleareUsers(); var users = Tool.SerializeHelp.DeserializeList <User>(commandInfo.Data[0]); foreach (var user in users) { UserManage.Instance.AddUser(user); } session.OnGetAllUser(users); }
public override void ExecuteCommand(ChatEngine session, BaseCommandInfo commandInfo) { try { var msg = Tool.SerializeHelp.Deserialize <Message>(commandInfo.Data[0]); session.ChatEvents.OnUserChat(msg); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var user = Tool.SerializeHelp.Deserialize <User>(commandInfo.Data[0]); session.OnGetUser(user); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var remoteAddr = Encoding.UTF8.GetString(commandInfo.Data[0]); var remotePort = Convert.ToInt32(Encoding.UTF8.GetString(commandInfo.Data[1])); session.OnCreateChat(remoteAddr, remotePort); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var newuser = SerializeHelp.Deserialize <User>(commandInfo.Data[0]); UserManage.Instance.AddUser(newuser); session.UserEvents.OnUserJoin(new UserJoinEventArgs(newuser)); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var fromUserSessionId = System.Text.Encoding.UTF8.GetString(commandInfo.Data[0]); var msg = Tool.SerializeHelp.Deserialize <Message>(commandInfo.Data[1]); var fromUser = UserManage.Instance.GetUser(fromUserSessionId); session.UserEvents.OnUserWhisper(new UserWhisperEventArgs(fromUser, msg)); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var leaveUserSessionId = System.Text.Encoding.UTF8.GetString(commandInfo.Data[0]); var leaveUser = UserManage.Instance.GetUser(leaveUserSessionId); session.UserEvents.OnUserLeave(new UserLeaveEventArgs(leaveUser)); UserManage.Instance.DelUser(leaveUserSessionId); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { var result = bool.Parse(Encoding.UTF8.GetString(commandInfo.Data[0])); var errormsg = Encoding.UTF8.GetString(commandInfo.Data[1]); session.OnLoginComplete(result, errormsg); if (!result)//登陆失败 { session.Client.Close(); } else { } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var toUserSessionId = Encoding.UTF8.GetString(commandInfo.Data[0]); var toUserAddr = System.Text.Encoding.UTF8.GetString(commandInfo.Data[1]); var toUserPort = Convert.ToInt32(System.Text.Encoding.UTF8.GetString(commandInfo.Data[2])); session.OnUserStartCreateChat(toUserSessionId, toUserAddr, toUserPort); } catch (Exception ex) { throw; } }
public override void ExecuteCommand(UserClientEngine session, BaseCommandInfo commandInfo) { try { var strfromUser = Encoding.UTF8.GetString(commandInfo.Data[0]); var fromUser = UserManage.Instance.GetUser(strfromUser); if (fromUser == null) { return; } var msg = Tool.SerializeHelp.Deserialize <Message>(commandInfo.Data[1]); session.UserEvents.OnReceiveMsg(new ReceiveMsgEventArgs(fromUser, msg)); } catch (Exception ex) { throw; } }
public static TDerived RemoveEngineFlags <TDerived>(this BaseCommandInfo <TDerived> info, EngineCommandFlags flags) where TDerived : BaseCommandInfo <TDerived> { return(info.RemoveUserFlags((uint)flags)); }