mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2025-01-13 15:18:14 +03:00
fixed https://github.com/EpicMorg/UniversalValveToolbox/issues/3 fixed https://github.com/EpicMorg/UniversalValveToolbox/issues/7
This commit is contained in:
parent
0f75355142
commit
5f7fefdc32
@ -10,7 +10,13 @@ namespace UniversalValveToolbox.Utils {
|
||||
static class JsonFileUtil {
|
||||
public static T ReadValue<T>(string path) => JsonConvert.DeserializeObject<T>(File.ReadAllText(path));
|
||||
|
||||
public static T[] ReadValues<T>(string directoryPath) => Directory.GetFiles(directoryPath, "*").Select(path => ReadValue<T>(path)).ToArray();
|
||||
public static T[] ReadValues<T>(string directoryPath) {
|
||||
if (!Directory.Exists(directoryPath)) {
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
|
||||
return Directory.GetFiles(directoryPath, "*").Select(path => ReadValue<T>(path)).ToArray();
|
||||
}
|
||||
|
||||
public static List<T> ReadListValues<T>(string directoryPath) => new List<T>(ReadValues<T>(directoryPath));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user