AdvancedSharpAdbClient icon indicating copy to clipboard operation
AdvancedSharpAdbClient copied to clipboard

Pushing/pulling files from the device

Open itapi opened this issue 1 year ago • 1 comments

What can we do for you?

I'm using the following code:

void DownloadFile()
{
    using (SyncService service = new SyncService(device))
    {
        string path = Environment.CurrentDirectory + @"\test.txt";
        using (FileStream stream = File.OpenWrite(path))
        {
            service.PullAsync("/data/local/tmp/a.txt", stream, null);
        }
    }
}

void UploadFile()
{
    using (SyncService service = new SyncService(device))
    {
        string path = Environment.CurrentDirectory + @"\test.txt";
        using (FileStream stream = File.OpenRead(path))
        {
            service.PushAsync(stream, "/data/local/tmp/a.txt", 777, DateTimeOffset.Now, null);
        }
    }
}

But nothing happends... Neither the "UploadFile" method works, nor the other. What I'm doing wrong..?

itapi avatar Mar 07 '24 20:03 itapi

You never await your task. So your service just disposed after it gone...

wherewhere avatar Mar 08 '24 06:03 wherewhere