internal byte[] Write(RotMGConnection con) { var s = new MemoryStream(); Write(new DWriter(s)); var content = s.ToArray(); var ret = new byte[5 + content.Length]; content = Crypt(con, content, content.Length); Buffer.BlockCopy(BitConverter.GetBytes(IPAddress.HostToNetworkOrder(ret.Length)), 0, ret, 0, 4); ret[4] = (byte)ID; Buffer.BlockCopy(content, 0, ret, 5, content.Length); return(ret); }
internal abstract byte[] Crypt(RotMGConnection con, byte[] dat, int len);
internal void Read(RotMGConnection con, byte[] body, int len) { Read(new DReader(new MemoryStream(Crypt(con, body, len)))); }
internal override byte[] Crypt(RotMGConnection con, byte[] dat, int len) { return(dat); }