Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushing/pulling files from the device #96

Open
itapi opened this issue Mar 7, 2024 · 1 comment
Open

Pushing/pulling files from the device #96

itapi opened this issue Mar 7, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@itapi
Copy link

itapi commented Mar 7, 2024

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 itapi added the help wanted Extra attention is needed label Mar 7, 2024
@wherewhere
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants