1234567891011121314151617181920212223 |
- using System.Text.Json;
- using Microsoft.Extensions.Configuration;
- using System.IO;
- using System;
- namespace sera_slackbot.Library
- {
- public class JsonFileReader
- {
- private string path;
- public JsonFileReader(IConfiguration config)
- {
- path = config.GetSection("Persistence").GetValue<string>("Path");
- }
- public dynamic Read(string filename)
- {
- var filePath = path + "/" + filename;
- var text = File.ReadAllText(filePath);
- return JsonSerializer.Deserialize<dynamic>(text);
- }
- }
- }
|