1- using System ;
21using System . Collections . Generic ;
32using System . Threading . Tasks ;
43using SabreTools . RedumpLib . Data ;
@@ -25,32 +24,9 @@ public static async Task<List<int>> DownloadUser(this RedumpClient client,
2524 bool lastModified = false ,
2625 int limit = - 1 )
2726 {
28- List < int > ids = [ ] ;
29- if ( string . IsNullOrEmpty ( username ) )
30- {
31- Console . WriteLine ( "A username must be specified!" ) ;
32- return ids ;
33- }
34-
35- // Keep getting user pages until there are none left
36- int pageNumber = 1 ;
37- while ( true )
38- {
39- if ( limit > 0 && pageNumber >= limit )
40- break ;
41-
42- var pageIds = lastModified
43- ? await client . CheckSingleDiscsPage ( outDir , dumper : username , sort : SortCategory . Modified , sortDir : SortDirection . Descending , page : pageNumber ++ )
44- : await client . CheckSingleDiscsPage ( outDir , dumper : username , page : pageNumber ++ ) ;
45- if ( pageIds is null )
46- return [ ] ;
47-
48- ids . AddRange ( pageIds ) ;
49- if ( pageIds . Count == 0 )
50- break ;
51- }
52-
53- return ids ;
27+ return lastModified
28+ ? await client . DownloadDiscsResults ( outDir , dumper : username , sort : SortCategory . Modified , sortDir : SortDirection . Descending , limit : limit )
29+ : await client . DownloadDiscsResults ( outDir , dumper : username , limit : limit ) ;
5430 }
5531
5632 /// <summary>
@@ -64,38 +40,7 @@ public static async Task<List<int>> ListUser(this RedumpClient client,
6440 string ? username ,
6541 int limit = - 1 )
6642 {
67- List < int > ids = [ ] ;
68- if ( string . IsNullOrEmpty ( username ) )
69- {
70- Console . WriteLine ( "A username must be specified!" ) ;
71- return ids ;
72- }
73-
74- // Keep getting user pages until there are none left
75- try
76- {
77- int pageNumber = 1 ;
78- while ( true )
79- {
80- if ( limit > 0 && pageNumber >= limit )
81- break ;
82-
83- var pageIds = await client . CheckSingleDiscsPage ( dumper : username , sort : SortCategory . Modified , sortDir : SortDirection . Descending , page : pageNumber ++ ) ;
84- if ( pageIds is null )
85- return [ ] ;
86-
87- ids . AddRange ( pageIds ) ;
88- if ( pageIds . Count <= 1 )
89- break ;
90- }
91- }
92- catch ( Exception ex )
93- {
94- Console . WriteLine ( $ "An exception occurred while trying to log in: { ex } ") ;
95- return [ ] ;
96- }
97-
98- return ids ;
43+ return await client . ListDiscsResults ( dumper : username , limit : limit ) ;
9944 }
10045 }
10146}
0 commit comments