Skip to content

Commit

Permalink
增加错误收集附加信息
Browse files Browse the repository at this point in the history
  • Loading branch information
dawn-lc committed Oct 2, 2022
1 parent 15d1d33 commit 68fb7c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ArchivePasswordTestTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ static async Task Main(string[] args)
{
try
{
SentrySdk.CaptureMessage("Start", SentryLevel.Info);
await AnsiConsole.Status().StartAsync("初始化...", async ctx => {
await Initialization(ctx);
});
Expand Down Expand Up @@ -223,6 +224,7 @@ await AnsiConsole.Progress().AutoClear(true).HideCompleted(true).StartAsync(asyn
}
Process.Start("Explorer.exe", $"/select, \"{ArchiveFile}[测试报告].txt\"");
}
SentrySdk.CaptureMessage($"End {EncryptArchivePassword??"Null"}", SentryLevel.Info);
}
catch (Exception ex)
{
Expand Down
11 changes: 11 additions & 0 deletions ArchivePasswordTestTool/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public static bool Equals(byte[] A, byte[] B)
return false;
return true;
}

/// <summary>
/// 计算文件Hash
/// </summary>
/// <param name="File">文件流</param>
/// <returns>Hash</returns>
public static byte[] FileHash(Stream File)
{
using MD5 FileMD5 = MD5.Create();
return FileMD5.ComputeHash(File);
}
/// <summary>
/// 比较文件Hash是否一致
/// </summary>
Expand Down

0 comments on commit 68fb7c2

Please sign in to comment.