Skip to content

Commit

Permalink
feat: 导出诊断信息时导出近期日志
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloWRC committed Sep 30, 2024
1 parent 865b48b commit bd3f798
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ClassIsland/Services/DiagnosticService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,21 @@ public async Task ExportDiagnosticData(string path)
{
var temp = Directory.CreateTempSubdirectory("ClassIslandDiagnosticExport").FullName;
var logs = string.Join('\n', AppLogService.Logs);
await File.WriteAllTextAsync(Path.Combine(temp, "Logs.log"), logs);
//await File.WriteAllTextAsync(Path.Combine(temp, "Logs.log"), logs);
await File.WriteAllTextAsync(Path.Combine(temp, "DiagnosticInfo.txt"), GetDiagnosticInfo());
File.Copy("./Settings.json", Path.Combine(temp, "Settings.json"));
var profile = App.GetService<IProfileService>().CurrentProfilePath;
Directory.CreateDirectory(Path.Combine(temp, "Profiles/"));
Directory.CreateDirectory(Path.Combine(temp, "Management/"));
Directory.CreateDirectory(Path.Combine(temp, "Config/"));
Directory.CreateDirectory(Path.Combine(temp, "Logs/"));
foreach (var file in Directory.GetFiles(ManagementService.ManagementConfigureFolderPath))
{
File.Copy(file, Path.Combine(temp, "Management/", Path.GetFileName(file)));
}
File.Copy(Path.Combine("./Profiles", profile), Path.Combine(temp, "Profiles/", profile));
FileFolderService.CopyFolder(Path.Combine(App.AppConfigPath), Path.Combine(temp, "Config/"));
FileFolderService.CopyFolder(Path.Combine(App.AppLogFolderPath), Path.Combine(temp, "Logs/"));

File.Delete(path);
await Task.Run(() =>
Expand Down
2 changes: 1 addition & 1 deletion ClassIsland/Views/SettingsWindowNew.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private async void MenuItemExportDiagnosticInfo_OnClick(object sender, RoutedEve
{
try
{
var r = CommonDialog.ShowDialog("ClassIsland", $"您正在导出应用的诊断数据。导出的诊断数据将包含应用当前运行的日志、系统及环境信息、应用设置、当前加载的档案和集控设置(如有),可能包含敏感信息,请在导出后注意检查。", new BitmapImage(new Uri("/Assets/HoYoStickers/帕姆_注意.png", UriKind.Relative)),
var r = CommonDialog.ShowDialog("ClassIsland", $"您正在导出应用的诊断数据。导出的诊断数据将包含应用 30 天内产生的日志、系统及环境信息、应用设置、当前加载的档案和集控设置(如有),可能包含敏感信息,请在导出后注意检查。", new BitmapImage(new Uri("/Assets/HoYoStickers/帕姆_注意.png", UriKind.Relative)),
60, 60, [
new DialogAction()
{
Expand Down

0 comments on commit bd3f798

Please sign in to comment.