protected void S2D_ReqCreateUser(IIncommingMessage reader) { var msg = reader.Parse <Msg_CreateAccount>(); _authDb.GetAccount(msg.account, (dbData) => { if (dbData == null) { var newInfo = _authDb.CreateAccountObject(); newInfo.Username = msg.account; newInfo.Password = msg.password; newInfo.Email = "null" + LRandom.Next(); newInfo.Token = "aaa"; newInfo.IsAdmin = true; newInfo.IsGuest = false; newInfo.IsEmailConfirmed = false; _authDb.InsertNewAccount(newInfo , (userId) => { reader.Respond(EMsgDS.D2S_RepCreateUser, new Msg_RepCreateResult() { result = 0, userId = userId }); }); } else { reader.Respond(EMsgDS.D2S_RepCreateUser, new Msg_RepCreateResult() { result = 1 }); } }); }
protected void OnMsg_S2D_ReqCreateUser(IServerProxy proxy, Deserializer reader) { var msg = reader.Parse <Msg_CreateAccount>(); _authDb.GetAccount(msg.account, (dbData) => { if (dbData == null) { var newInfo = _authDb.CreateAccountObject(); newInfo.Username = msg.account; newInfo.Password = msg.password; newInfo.Email = "null" + new Random().Next(); newInfo.Token = "aaa"; newInfo.IsAdmin = true; newInfo.IsGuest = false; newInfo.IsEmailConfirmed = false; _authDb.InsertNewAccount(newInfo , () => { proxy.SendMsg(EMsgDS.D2S_RepCreateUser, new Msg_RepCreateResult() { result = 0 }); }); } else { proxy.SendMsg(EMsgDS.D2S_RepCreateUser, new Msg_RepCreateResult() { result = 1 }); } }); }