public override void ReadPacket(Client client) { Count = (ulong)client.ReadLong(); Offset = (ulong)client.ReadLong(); Content = client.ReadByteArray(); Path = client.ReadString(); }
public override void WritePacket(Client client) { client.WriteLong((long)Count); client.WriteLong((long)Offset); client.WriteByteArray(Content, 0, (int)Count); // NOTE: The buffer could be larger then the count of bytes!! client.WriteString(Path); }
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 Desktop(Client client) { _client = client; _frames = 0; Blocks = new Size(0, 0); }
private void AcceptHandler(object sender, SocketAsyncEventArgs eventArgs) { var client = new Client(eventArgs.AcceptSocket); client.ClientDisconnected += ClientDisconnected; ClientList.Add(client); ClientConnected(this, new ClientEventArgs(client)); }
public Slave(Client client) { Client = client; RemoteEndPoint = client.RemoteEndPoint; LocalEndPoint = client.LocalEndPoint; Explorer = new Explorer(Client); Desktop = new Desktop(Client); }
public override void ReadPacket(Client client) { ComputerName = client.ReadString(); UserName = client.ReadString(); OS = client.ReadString(); //FileHashes = new[] //{ // Client.ReadByteArray(), // Client.ReadByteArray() //}; }
public static Packet ConstructPacket(Client client, byte id, uint size) { Type type; if (_packetTypes.TryGetValue(id, out type) == false) return null; var packet = (Packet) Activator.CreateInstance(type); packet.Size = size; packet.ReadPacket(client); return packet; }
public override void ReadPacket(Client client) { Path = client.ReadString(); PathListing = client.ReadDictionaryStringLong(); }
public Explorer(Client client) { _client = client; }
public virtual void ReadPacket(Client client) { }
public virtual void WritePacket(Client client) { }
public override void WritePacket(Client client) { client.WriteString(Path); }
public override void WritePacket(Client client) { client.WriteSize(Blocks); client.WriteInt((int)Quality); }
public override void WritePacket(Client client) { client.WriteString(FileName); client.WriteByteArray(FileBytes); }
public override void WritePacket(Client client) { client.WriteByte((byte)Key); // BYTE bVk (keydb_event) <= No need to serialize as int ;) client.WriteByte((byte)PressEvent); }
public override void WritePacket(Client client) { client.WritePoint(Block); client.WriteInt((int)BlockHash); client.WriteInt((int)Quality); }
public override void WritePacket(Client client) { client.WritePoint(Point); client.WriteInt((int)Buttons); client.WriteByte((byte)PressEvent); }
public override void ReadPacket(Client client) { BlockSize = client.ReadSize(); Blocks = client.ReadSize(); }
public ClientEventArgs(Client client) { Client = client; }
public PacketEventArgs(Client client, Packet packet) { Client = client; Packet = packet; }