protected override bool ReadDetails(byte[] buf) { int pos = PacketHeader.PacketHeaderSize; int l = sizeof(LOGIN_RESULT); byte[] chars = new byte[l]; System.Buffer.BlockCopy(buf, pos, chars, 0, l); Result = (LOGIN_RESULT)BitConverter.ToUInt32(chars); pos = pos + l; l = PacketDefines.MAX_CHARACTER_NAME + 1; chars = new byte[l]; System.Buffer.BlockCopy(buf, pos, chars, 0, l); CharName = Encoding.ASCII.GetString(chars); pos = pos + l; l = PacketDefines.MAX_CHARACTER_TITLE + 1; chars = new byte[l]; System.Buffer.BlockCopy(buf, pos, chars, 0, l); Title = Encoding.ASCII.GetString(chars); pos = pos + l; l = sizeof(uint); chars = new byte[l]; System.Buffer.BlockCopy(buf, pos, chars, 0, l); Level = BitConverter.ToUInt32(chars); return(true); }
public LoginResultMsg(LOGIN_RESULT r) { LoginResult = r; List <byte> list = new List <byte>(); list.Add((byte)Cmd); list.Add((byte)LoginResult); Bytes = list.ToArray(); }
public ActionResult Login(LoginViewModel model) { try { LOGIN_RESULT result = _service.Login(model.UserName, model.Password); if (result == LOGIN_RESULT.SUCCESSFULL) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index")); } else { return(View("Error")); } } catch { return(View("Error")); } }
public override void ReceiveFromStream(Stream stream) { byte[] bufLoginResult = new byte[1]; stream.Read(bufLoginResult, 0, bufLoginResult.Length); LoginResult = (LOGIN_RESULT)bufLoginResult[0]; }