public override void ReadPacket(Client client) { Block = client.ReadPoint(); var bytes = client.ReadByteArray(); BlockHash = (uint)client.ReadInt(); Compressed = client.ReadByte() != 0x00; var size = client.ReadInt(); if (bytes == null) return; if (Compressed) { try { var buffer = LZ4Codec.Decode(bytes, 0, bytes.Length, size); bytes = buffer; } catch (ArgumentException arg) { Console.WriteLine(arg); } } if (bytes.Length == 0) return; using (var ms = new MemoryStream(bytes)) Image = (Bitmap)Bitmap.FromStream(ms); }
public override void ReadPacket(Client client) { Count = (ulong)client.ReadLong(); Offset = (ulong)client.ReadLong(); Content = client.ReadByteArray(); Path = client.ReadString(); }