public static async Task LoadSampleFileAsync(SampleFileStore store, HttpClient httpClient) { var sampleFileConfigs = await httpClient.GetFromJsonAsync <SampleFileConfig[]>($"{SAMPLE_FILES_LOCATION}/sample-files-config.json"); foreach (var sampleFileConfig in sampleFileConfigs) { await LoadConfiguredSampleFileAsync(sampleFileConfig, store, httpClient); } }
private static async Task LoadConfiguredSampleFileAsync(SampleFileConfig sampleFileConfig, SampleFileStore store, HttpClient httpClient) { var content = await httpClient.GetStringAsync($"{SAMPLE_FILES_LOCATION}/{sampleFileConfig.Path}"); var fileSpecification = new SampleFile { Name = sampleFileConfig.Name, Content = content }; store.AddSampleFile(fileSpecification); }