Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public LoginResultMsg(LOGIN_RESULT r)
        {
            LoginResult = r;
            List <byte> list = new List <byte>();

            list.Add((byte)Cmd);
            list.Add((byte)LoginResult);
            Bytes = list.ToArray();
        }
Esempio n. 3
0
 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"));
     }
 }
Esempio n. 4
0
 public override void ReceiveFromStream(Stream stream)
 {
     byte[] bufLoginResult = new byte[1];
     stream.Read(bufLoginResult, 0, bufLoginResult.Length);
     LoginResult = (LOGIN_RESULT)bufLoginResult[0];
 }