Skip to content

Commit

Permalink
给CLI的i菜单增加Debug快照功能
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Sep 17, 2024
1 parent 969ba6a commit 4617661
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Core/Tools/DebuggingRecord.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Core.LogModule;
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Linq;
Expand Down Expand Up @@ -63,7 +64,7 @@ public static string GenerateReportSnapshot()
string ZipFilePath = string.Empty;
try
{
string GID = Guid.NewGuid().ToString();
string GID = $"Debug_{DateTime.Now.ToString("yyyy-MM-ddTHH-mm-ss-fff")}";
GIDPath = $"{Config.Core_RunConfig._TemporaryFileDirectory}{GID}/";
if(!Directory.Exists(GIDPath))
{
Expand All @@ -88,6 +89,7 @@ public static string GenerateReportSnapshot()
FileInfo ZipFileInfo = new(ZipFilePath);
string EncryofFilaName = $"{Config.Core_RunConfig._DebugFileDirectory}{ZipFileInfo.Name}_Encryof.{ZipFileInfo.Extension}";
EncryptFile(ZipFilePath, EncryofFilaName);
Log.Info(nameof(GenerateReportSnapshot),$"生成Debug快照成功,生成文件{EncryofFilaName}");
return EncryofFilaName;
}
catch (Exception e)
Expand Down
6 changes: 6 additions & 0 deletions Server/TerminalDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ internal static void SeKey()
}
break;
}
case ConsoleKey.D:
{
Console.WriteLine("触发Debug快照");
Core.Tools.DebuggingRecord.GenerateReportSnapshot();
break;
}
case ConsoleKey.Z:
{
Console.WriteLine((Config.Core_RunConfig._DebugMode ? "关闭" : "打开") + "调试模式");
Expand Down

0 comments on commit 4617661

Please sign in to comment.