Skip to content

Commit

Permalink
Add new File methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Sella-GH committed Jun 9, 2024
1 parent 776a1f6 commit ace484c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions AzzyBot-Next/Utilities/FileOperations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

Expand All @@ -22,4 +23,18 @@ public static void DeleteTempFilePath(string path)

File.Delete(path);
}

public static Task<string> GetFileContentAsync(string path)
{
ArgumentException.ThrowIfNullOrWhiteSpace(path, nameof(path));

return File.ReadAllTextAsync(path);
}

public static IReadOnlyList<string> GetFilesInDirectory(string path)
{
ArgumentException.ThrowIfNullOrWhiteSpace(path, nameof(path));

return Directory.GetFiles(path);
}
}

0 comments on commit ace484c

Please sign in to comment.