Created
January 28, 2022 00:25
-
-
Save tonysneed/5f7409dcfa66d800179618b44ec24a41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JsonFilesRepository | |
{ | |
private const string Root = "../../../json/"; | |
public Dictionary<string, string> Files { get; } = new(); | |
public JsonFilesRepository(params string[] files) | |
{ | |
var filesList = files.ToList(); | |
if (!filesList.Any()) | |
foreach (var file in Directory.GetFiles(Root)) | |
filesList.Add(Path.GetFileName(file)); | |
foreach (var file in filesList) | |
{ | |
var path = Path.Combine(Root, file); | |
var contents = File.ReadAllText(path); | |
Files.Add(file, contents); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment