SHARE
TWEET

Deserialize

a guest Feb 18th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      public void Deserialize(byte[] buffer)
  2.         {
  3.             var myPacket = new byte[buffer.Length - 8];
  4.             for (int i = 0; i < myPacket.Length; i++)
  5.             {
  6.                 myPacket[i] = buffer[i];
  7.             }
  8.             using (var memoryStream = new System.IO.MemoryStream(myPacket))
  9.             {
  10.                 Info = Serializer.DeserializeWithLengthPrefix<MsgActionProto>(memoryStream, PrefixStyle.Fixed32);
  11.             }
  12.             ID = Info.ID;
  13.             UID = Info.UID;
  14.             TimeStamp = new Time32(Info.TimeStamp);
  15.             NpcID = Info.NpcID;
  16.             Facing = Info.Facing;
  17.             PositionX = Info.PositionX;
  18.         }
  19.         public byte[] ToArray()
  20.         {
  21.             Info = new DataProto()
  22.             {
  23.                   ID = ID, UID = UID, Facing = Facing,
  24.                   TimeStamp = (uint)TimeStamp.Value,
  25.                   PositionX = PositionX,
  26.                
  27.             };
  28.             return Kernel.FinalizeProtoBuf(Info, 10010);
  29.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top