@@ -25,7 +25,7 @@ static FlatpakSourcesGenerator()
2525 } ;
2626 }
2727
28- public async Task < bool > CheckRuntimeAsync ( string runtime , bool runAsUser )
28+ public static async Task < bool > CheckRuntimeAsync ( string runtime , bool runAsUser )
2929 {
3030 using var process = new Process
3131 {
@@ -68,7 +68,7 @@ public async Task<bool> CheckRuntimeAsync(string runtime, bool runAsUser)
6868 return false ;
6969 }
7070
71- public async Task < List < NugetSource > > GenerateSourcesAsync ( string input , int dotnetVersion , string ? temp , bool selfContained , bool runAsUser )
71+ public static async Task < List < NugetSource > > GenerateSourcesAsync ( string input , int dotnetVersion , string ? temp , bool selfContained , bool runAsUser )
7272 {
7373 input = input . Replace ( "~" , Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ;
7474 temp = Path . Combine ( temp ? . Replace ( "~" , Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ?? Directory . GetCurrentDirectory ( ) , "nuget-temp" ) ;
@@ -169,7 +169,22 @@ public async Task<List<NugetSource>> GenerateSourcesAsync(string input, int dotn
169169 return sources ;
170170 }
171171
172- private async Task < NugetSource ? > GetExtraSourceAsync ( string name )
172+ public static async Task WriteSourcesFileAsync ( List < NugetSource > sources , string ? output )
173+ {
174+ output = output ? . Replace ( "~" , Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ;
175+ if ( string . IsNullOrEmpty ( output ) )
176+ {
177+ output = "nuget-sources.json" ;
178+ }
179+ else if ( ! string . IsNullOrEmpty ( output ) && Path . GetExtension ( output ) != ".json" )
180+ {
181+ output += ".json" ;
182+ }
183+ await File . WriteAllTextAsync ( output , JsonSerializer . Serialize ( sources , JsonSerializerOptions ) ) ;
184+ Console . WriteLine ( $ "[Info] Sources file written to { Path . GetFullPath ( output ) } ") ;
185+ }
186+
187+ private static async Task < NugetSource ? > GetExtraSourceAsync ( string name )
173188 {
174189 name = name . ToLower ( ) ;
175190 var catalog = await HttpClient . GetFromJsonAsync < NugetCatalog > ( $ "https://api.nuget.org/v3/registration5-semver1/{ name } /index.json", JsonSerializerOptions ) ;
@@ -202,19 +217,4 @@ public async Task<List<NugetSource>> GenerateSourcesAsync(string input, int dotn
202217 DestinationFileName = filename
203218 } ;
204219 }
205-
206- public async Task WriteSourcesFileAsync ( List < NugetSource > sources , string ? output )
207- {
208- output = output ? . Replace ( "~" , Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ) ;
209- if ( string . IsNullOrEmpty ( output ) )
210- {
211- output = "nuget-sources.json" ;
212- }
213- else if ( ! string . IsNullOrEmpty ( output ) && Path . GetExtension ( output ) != ".json" )
214- {
215- output += ".json" ;
216- }
217- await File . WriteAllTextAsync ( output , JsonSerializer . Serialize ( sources , JsonSerializerOptions ) ) ;
218- Console . WriteLine ( $ "[Info] Sources file written to { Path . GetFullPath ( output ) } ") ;
219- }
220220}
0 commit comments