1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Add button to compress log files for bug submission

This commit is contained in:
Dean Herbert 2023-11-27 17:13:11 +09:00
parent ff18f80559
commit 11f1f44237
No known key found for this signature in database

View File

@ -14,6 +14,7 @@ using osu.Game.Localisation;
using osu.Game.Overlays.Notifications;
using osu.Game.Overlays.Settings.Sections.Maintenance;
using osu.Game.Updater;
using SharpCompress.Archives.Zip;
namespace osu.Game.Overlays.Settings.Sections.General
{
@ -72,6 +73,29 @@ namespace osu.Game.Overlays.Settings.Sections.General
Action = () => storage.PresentExternally(),
});
Add(new SettingsButton
{
Text = "Compress log files",
Keywords = new[] { @"bug", "report", "logs" },
Action = () =>
{
var logStorage = storage.GetStorageForDirectory(@"logs");
const string archive_filename = "exports/compressed-logs.zip";
using (var outStream = storage.CreateFileSafely(archive_filename))
using (var zip = ZipArchive.Create())
{
foreach (string? f in logStorage.GetFiles(string.Empty, "*.log"))
zip.AddEntry(f, logStorage.GetStream(f), true);
zip.SaveTo(outStream);
}
storage.PresentFileExternally(archive_filename);
},
});
Add(new SettingsButton
{
Text = GeneralSettingsStrings.ChangeFolderLocation,