perf: compute hash while writing
This commit is contained in:
parent
4f4e168583
commit
0abe73ad41
|
@ -58,12 +58,11 @@ internal class Command : IDisposable {
|
|||
return;
|
||||
}
|
||||
|
||||
using var stream = this.OpenFile(ext);
|
||||
using var stream = new Blake3Stream(this.OpenFile(ext));
|
||||
stream.Write(imageData);
|
||||
|
||||
var meta = ScreenshotMetadata.Capture(this.Plugin);
|
||||
var hash = new Blake3HashAlgorithm().ComputeHash(imageData);
|
||||
meta.Blake3Hash = Convert.ToHexString(hash);
|
||||
meta.Blake3Hash = Convert.ToHexString(stream.ComputeHash().AsSpan());
|
||||
var json = JsonConvert.SerializeObject(meta, Formatting.Indented);
|
||||
Plugin.Log.Info(json);
|
||||
|
||||
|
|
Loading…
Reference in New Issue