public void ChangeDetails(MClient c, MNetMessage m) { MUserAccount mu = MUserAccount.Deserialize <MUserAccount>(m.Payload); // TODO: Validate account mu.CopyTo(c.Account); // c.Save(); c.Account.ClientIP = c.Address.ToString(); string UserID = _DataBase.UpdatePlayer(c.Account); MNetMessage mn = new MNetMessage(); mn.Command = MNetMessage.CHANGEDETAILS; mn.UserID = UserID; //TODO: VALIDATE USERACCOUNT MChangeDetailsResult res = new MChangeDetailsResult(); res.Success = true; res.Message = "Details Changed"; mn.Payload = res.Serialize(); Send(c, "Message", mn.Serialize()); }
public void RegisterUser(MClient c, MNetMessage m) { MUserAccount mu = MUserAccount.Deserialize <MUserAccount>(m.Payload); mu.CopyTo(c.Account); c.Account.ClientIP = c.Address.ToString(); string UserID = _DataBase.RegisterUser(c.Account); MNetMessage mn = new MNetMessage(); mn.Command = MNetMessage.REGISTERUSER; mn.UserID = UserID; MChangeDetailsResult res = new MChangeDetailsResult(); res.Success = true; res.Message = "User Registered"; mn.Payload = res.Serialize(); Send(c, "Message", mn.Serialize()); }