-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d74542f
commit e94a5b1
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Reflection; | ||
using System.Security.Cryptography; | ||
|
||
namespace ArcaneLibs; | ||
|
||
public static class FileUtils { | ||
public static async Task<string> GetFileSha384Async(string path) { | ||
using var sha384 = SHA384.Create(); | ||
await using var stream = File.OpenRead(path); | ||
return Convert.ToBase64String(await sha384.ComputeHashAsync(stream)); | ||
} | ||
|
||
public static string GetBinDir() { | ||
var assembly = Assembly.GetEntryAssembly(); | ||
var uri = new Uri(assembly!.Location); | ||
Check warning on line 15 in ArcaneLibs/FileUtils.cs GitHub Actions / build
|
||
return Path.GetDirectoryName(uri.LocalPath)!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters