From 4bdea63982dae9c17b7a5fbda38d505655b8d4b3 Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Thu, 30 May 2024 21:39:12 +0200 Subject: Changes --- .../Bot/FileStorageProvider.cs | 72 +++++++++++----------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'Utilities/LibMatrix.DevTestBot/Bot') diff --git a/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs b/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs index cc866e6..05b357e 100644 --- a/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs +++ b/Utilities/LibMatrix.DevTestBot/Bot/FileStorageProvider.cs @@ -1,36 +1,36 @@ -using System.Text.Json; -using ArcaneLibs.Extensions; -using LibMatrix.Interfaces.Services; -using Microsoft.Extensions.Logging; - -namespace LibMatrix.ExampleBot.Bot; - -public class FileStorageProvider : IStorageProvider { - private readonly ILogger _logger; - - public string TargetPath { get; } - - /// - /// Creates a new instance of . - /// - /// - public FileStorageProvider(string targetPath) { - new Logger(new LoggerFactory()).LogInformation("test"); - Console.WriteLine($"Initialised FileStorageProvider with path {targetPath}"); - TargetPath = targetPath; - if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath); - } - - public async Task SaveObjectAsync(string key, T value) => await File.WriteAllTextAsync(Path.Join(TargetPath, key), value?.ToJson()); - - public async Task LoadObjectAsync(string key) => JsonSerializer.Deserialize(await File.ReadAllTextAsync(Path.Join(TargetPath, key))); - - public Task ObjectExistsAsync(string key) => Task.FromResult(File.Exists(Path.Join(TargetPath, key))); - - public Task> GetAllKeysAsync() => Task.FromResult(Directory.GetFiles(TargetPath).Select(Path.GetFileName).ToList()); - - public Task DeleteObjectAsync(string key) { - File.Delete(Path.Join(TargetPath, key)); - return Task.CompletedTask; - } -} \ No newline at end of file +// using System.Text.Json; +// using ArcaneLibs.Extensions; +// using LibMatrix.Interfaces.Services; +// using Microsoft.Extensions.Logging; +// +// namespace LibMatrix.ExampleBot.Bot; +// +// public class FileStorageProvider : IStorageProvider { +// private readonly ILogger _logger; +// +// public string TargetPath { get; } +// +// /// +// /// Creates a new instance of . +// /// +// /// +// public FileStorageProvider(string targetPath) { +// new Logger(new LoggerFactory()).LogInformation("test"); +// Console.WriteLine($"Initialised FileStorageProvider with path {targetPath}"); +// TargetPath = targetPath; +// if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath); +// } +// +// public async Task SaveObjectAsync(string key, T value) => await File.WriteAllTextAsync(Path.Join(TargetPath, key), value?.ToJson()); +// +// public async Task LoadObjectAsync(string key) => JsonSerializer.Deserialize(await File.ReadAllTextAsync(Path.Join(TargetPath, key))); +// +// public Task ObjectExistsAsync(string key) => Task.FromResult(File.Exists(Path.Join(TargetPath, key))); +// +// public Task> GetAllKeysAsync() => Task.FromResult(Directory.GetFiles(TargetPath).Select(Path.GetFileName).ToList()); +// +// public Task DeleteObjectAsync(string key) { +// File.Delete(Path.Join(TargetPath, key)); +// return Task.CompletedTask; +// } +// } \ No newline at end of file -- cgit 1.4.1