public static void Compress(RakNet.BitStream source, int offset, RakNet.BitStream dest) { MemoryStream ms = new MemoryStream(); MemoryStream sms = new MemoryStream(); byte[] sData = source.GetData(); sms.Write(sData, offset, sData.Length - offset); Compress(sms, ms); sms.Close(); sms.Dispose(); byte[] arr = ms.ToArray(); dest.Write(arr.Length); dest.Write(arr, (uint)arr.Length); }