FubarDevelopment / FtpServer

Portable FTP server written in .NET
http://fubardevelopment.github.io/FtpServer/
MIT License
482 stars 163 forks source link

Add paging & increase pagesize to 1000 #60

Closed Gee19 closed 5 years ago

Gee19 commented 5 years ago

First time using your library and wanted to say thanks, it makes stuff really easy :)

Anyway, some context for this is PR. I am using https://github.com/Aida-Enna/LGMAConsole to connect to my personal gdrive and access it as an FTP server for usage on my nintendo switch. It seems I am only able to view 100 files so I assumed it was because no explicit PageSize was being set.

I also started working on adding nextPageToken to the FileExtensions.DefaultListFields and grabbing it from the previous response. Pretty sure I am doing this wrong or in the wrong spot but it's a start.

Some resources I was using: https://developers.google.com/drive/api/v3/quickstart/dotnet https://developers.google.com/drive/api/v3/reference/files/list https://stackoverflow.com/questions/41572228/how-to-list-of-more-than-1000-records-from-google-drive-api-v3-in-c-sharp

fubar-coder commented 5 years ago

I think that you should put response.Files into a new List<File> - but only when we have a response.NextPageToken. The returned files of every response must be appended to the previously created list of File objects.

Gee19 commented 5 years ago

Fixed that stuff up. This could probably be pulled out into a helper function somewhere but I'll leave that up to you. Also, I couldn't test this because I have no idea how to install it as a local nuget package :)

fubar-coder commented 5 years ago

@Gee19 You don't need to install it as NuGet package. You could've used the sample application with the following parameters:

google-drive user "your-path-to-client_id.json" "your_google_email@google.com"

That has the same result as launching the LGMAConsole - except that you don't need to enter your user name interactively.

fan3k commented 5 years ago

Max 1000 files?

fubar-coder commented 5 years ago

@fan3k More. It loads 1000 file entries per request and continues until there are no more file entries.