예제 #1
0
 public override void ReadPacket(Client client)
 {
     Count = (ulong)client.ReadLong();
     Offset = (ulong)client.ReadLong();
     Content = client.ReadByteArray();
     Path = client.ReadString();
 }
예제 #2
0
 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);
        }
예제 #4
0
        public Desktop(Client client)
        {
            _client = client;
            _frames = 0;

            Blocks = new Size(0, 0);
        }
예제 #5
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));
        }
예제 #6
0
        public Slave(Client client)
        {
            Client = client;
            RemoteEndPoint = client.RemoteEndPoint;
            LocalEndPoint = client.LocalEndPoint;

            Explorer = new Explorer(Client);
            Desktop = new Desktop(Client);
        }
예제 #7
0
 public override void ReadPacket(Client client)
 {
     ComputerName = client.ReadString();
     UserName = client.ReadString();
     OS = client.ReadString();
     //FileHashes = new[]
     //{
     //    Client.ReadByteArray(),
     //    Client.ReadByteArray()
     //};
 }
예제 #8
0
        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();
 }
예제 #10
0
 public Explorer(Client client)
 {
     _client = client;
 }
예제 #11
0
 public virtual void ReadPacket(Client client)
 {
 }
예제 #12
0
 public virtual void WritePacket(Client client)
 {
 }
예제 #13
0
 public override void WritePacket(Client client)
 {
     client.WriteString(Path);
 }
 public override void WritePacket(Client client)
 {
     client.WriteSize(Blocks);
     client.WriteInt((int)Quality);
 }
예제 #15
0
 public override void WritePacket(Client client)
 {
     client.WriteString(FileName);
     client.WriteByteArray(FileBytes);
 }
예제 #16
0
 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);
 }
예제 #18
0
 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();
 }
예제 #20
0
 public ClientEventArgs(Client client)
 {
     Client = client;
 }
예제 #21
0
 public PacketEventArgs(Client client, Packet packet)
 {
     Client = client;
     Packet = packet;
 }