diff --git a/AdvancedSharpAdbClient/DeviceCommands/DeviceExtensions.cs b/AdvancedSharpAdbClient/DeviceCommands/DeviceExtensions.cs
index 5d71abe4..ac94a3f6 100644
--- a/AdvancedSharpAdbClient/DeviceCommands/DeviceExtensions.cs
+++ b/AdvancedSharpAdbClient/DeviceCommands/DeviceExtensions.cs
@@ -3,11 +3,13 @@
//
using AdvancedSharpAdbClient.Receivers;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
+using System.Threading;
namespace AdvancedSharpAdbClient.DeviceCommands
{
@@ -44,6 +46,76 @@ public static FileStatistics Stat(this IAdbClient client, DeviceData device, str
}
}
+ ///
+ /// Lists the contents of a directory on the device.
+ ///
+ /// The to use when executing the command.
+ /// The device on which to list the directory.
+ /// The path to the directory on the device.
+ ///
+ public static IEnumerable List(this IAdbClient client, DeviceData device,
+ string remotePath)
+ {
+ using (ISyncService service = Factories.SyncServiceFactory(client, device))
+ {
+ return service.GetDirectoryListing(remotePath);
+ }
+ }
+
+ ///
+ /// Pulls (downloads) a file from the remote device.
+ ///
+ /// The to use when executing the command.
+ /// The device on which to pull the file.
+ /// The path, on the device, of the file to pull.
+ /// A that will receive the contents of the file.
+ /// An optional handler for the event.
+ /// An optional parameter which, when specified, returns progress notifications. The progress is reported as a value between 0 and 100, representing the percentage of the file which has been transferred.
+ /// A that can be used to cancel the task.
+ public static void Pull(this IAdbClient client, DeviceData device,
+ string remotePath, Stream stream,
+ EventHandler syncProgressEventHandler = null,
+ IProgress progress = null, CancellationToken cancellationToken = default)
+ {
+ using (ISyncService service = Factories.SyncServiceFactory(client, device))
+ {
+ if (syncProgressEventHandler != null)
+ {
+ service.SyncProgressChanged += syncProgressEventHandler;
+ }
+
+ service.Pull(remotePath, stream, progress, cancellationToken);
+ }
+ }
+
+ ///
+ /// Pushes (uploads) a file to the remote device.
+ ///
+ /// The to use when executing the command.
+ /// The device on which to put the file.
+ /// The path, on the device, to which to push the file.
+ /// A that contains the contents of the file.
+ /// The permission octet that contains the permissions of the newly created file on the device.
+ /// The time at which the file was last modified.
+ /// An optional handler for the event.
+ /// An optional parameter which, when specified, returns progress notifications. The progress is reported as a value between 0 and 100, representing the percentage of the file which has been transferred.
+ /// A that can be used to cancel the task.
+ public static void Push(this IAdbClient client, DeviceData device,
+ string remotePath, Stream stream, int permissions, DateTimeOffset timestamp,
+ EventHandler syncProgressEventHandler = null,
+ IProgress progress = null, CancellationToken cancellationToken = default)
+ {
+ using (ISyncService service = Factories.SyncServiceFactory(client, device))
+ {
+ if (syncProgressEventHandler != null)
+ {
+ service.SyncProgressChanged += syncProgressEventHandler;
+ }
+
+ service.Push(stream, remotePath, permissions, timestamp, progress, cancellationToken);
+ }
+ }
+
///
/// Gets the property of a device.
///