SharpAdb / AdvancedSharpAdbClient

AdvancedSharpAdbClient is a .NET library that allows .NET, Mono and Unity applications to communicate with Android devices. It's improved version of SharpAdbClient.
https://sharpadb.github.io
Apache License 2.0
203 stars 54 forks source link

A temporary solution of #19 #21

Closed wherewhere closed 2 years ago

wherewhere commented 2 years ago

When using GetDirectoryListing for the second time, it will not functional. The temporary solution is renew the class before the second function.

SyncService service = new SyncService(client, device);
var a = service.GetDirectoryListing("/");
service = new SyncService(client, device);
var b = service.GetDirectoryListing("/sdcard");

So I add a Reopen function to renew it. Now the solution is:

SyncService service = new SyncService(client, device);
var a = service.GetDirectoryListing("/");
service.Reopen(client);
var b = service.GetDirectoryListing("/sdcard");

But it is not the best solution, hope someone can make a true fix.

Issue: System.ArgumentOutOfRangeException: '' #19

wherewhere commented 2 years ago

Add unit test, but can't pass in one time...

megapro17 commented 2 years ago

Why, just why... It's awful workaround What if I need want to scan each folder in my phone, how much overhead it will create

wherewhere commented 2 years ago

Why, just why... It's awful workaround What if I need want to scan each folder in my phone, how much overhead it will create

I don't know... The usually way is

using (SyncService service = new SyncService(client, device))
{
    ...
}

It will only use once so nobody find that it can't use secondly...

wherewhere commented 2 years ago

Why, just why... It's awful workaround What if I need want to scan each folder in my phone, how much overhead it will create

By the way, adb shell has cd and ls command. You can use this to get dir... image image

megapro17 commented 2 years ago

Damn you're a genius, I completely forgot about that way, it's even better

wherewhere commented 2 years ago

LOL

wherewhere commented 2 years ago

@yungd1plomat merge?

wherewhere commented 2 years ago

@yungd1plomat

yungd1plomat commented 2 years ago

sry it's very bad solution

wherewhere commented 2 years ago

sry it's very bad solution

But the solution is just the name of this pull. I add a test and some bug fix...

wherewhere commented 2 years ago

And I think it need publish a perelease now.

wherewhere commented 2 years ago

@yungd1plomat