Ejemplo n.º 1
0
            public ClientDrive[] RequestDrives(IDevice device)
            {
                DrivesRequestEventArgs args = new DrivesRequestEventArgs(device);

                BroadcastDrivesRequest(args);

                return(args.Drives.ToArray());
            }
Ejemplo n.º 2
0
        private void Broadcaster_BroadcastDrivesRequest(DrivesRequestEventArgs args)
        {
            if (Status == (int)SocketStatus.LoggedIn && device.Type == ClientType.Device && args.Device.Account.Id == device.Account.Id && args.Device.DeviceIP.Equals(socket.RemoteEndPoint))
            {
                IPacket packet = PacketFactory.CreateServerDrivesRequest();
                Utils.SendPacket(SocketStream, packet);

                messageQueue.Wait(PacketType.ClientDrivesResponse);
                ClientMessage message = messageQueue.Dequeue();
                foreach (var drive in (DriveInformation[])message.Payload)
                {
                    args.Drives.Add(new ClientDrive((IPEndPoint)socket.RemoteEndPoint, drive));
                }
            }
        }