Beispiel #1
0
 /// <summary>
 /// Executes a shell command on the remote device
 /// </summary>
 /// <param name="client">
 /// An instance of a class that implements the <see cref="IAdbClient"/> interface.
 /// </param>
 /// <param name="command">The command to execute</param>
 /// <param name="device">The device to execute on</param>
 /// <param name="rcvr">The shell output receiver</param>
 /// <param name="encoding">The encoding to use.</param>
 public static void ExecuteRemoteCommand(this IAdbClient client, string command, DeviceData device, IShellOutputReceiver rcvr, Encoding encoding)
 {
     try
     {
         client.ExecuteRemoteCommandAsync(command, device, rcvr, CancellationToken.None, int.MaxValue).Wait();
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count == 1)
         {
             throw ex.InnerException;
         }
         else
         {
             throw;
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Executes a shell command on the device.
 /// </summary>
 /// <param name="device">
 /// The device on which to run the command.
 /// </param>
 /// <param name="client">
 /// The <see cref="IAdbClient"/> to use when executing the command.
 /// </param>
 /// <param name="command">
 /// The command to execute.
 /// </param>
 /// <param name="receiver">
 /// Optionally, a <see cref="IShellOutputReceiver"/> that processes the command output.
 /// </param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the Task.</param>
 /// <param name="maxTimeToOutputResponse">The max time to output response.</param>
 public static Task ExecuteShellCommandAsync(
     this DeviceData device, IAdbClient client, string command, IShellOutputReceiver receiver, CancellationToken cancellationToken,
     int maxTimeToOutputResponse = int.MaxValue)
 {
     return(client.ExecuteRemoteCommandAsync(command, device, receiver, cancellationToken, maxTimeToOutputResponse));
 }