ITextFileStore.cs 573 B

123456789101112131415
  1. namespace RackPeek.Domain.Persistence.Yaml;
  2. public interface ITextFileStore {
  3. Task<bool> ExistsAsync(string path);
  4. Task<string> ReadAllTextAsync(string path);
  5. Task WriteAllTextAsync(string path, string contents);
  6. }
  7. public sealed class PhysicalTextFileStore : ITextFileStore {
  8. public Task<bool> ExistsAsync(string path) => Task.FromResult(File.Exists(path));
  9. public Task<string> ReadAllTextAsync(string path) => File.ReadAllTextAsync(path);
  10. public Task WriteAllTextAsync(string path, string contents) => File.WriteAllTextAsync(path, contents);
  11. }