From 782b58fa610048707f745dc279b1973d0535b817 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Mon, 22 Jul 2024 19:55:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/SettingsImportExportService.cs | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/BiliLite.UWP/Services/SettingsImportExportService.cs b/src/BiliLite.UWP/Services/SettingsImportExportService.cs index 963fb4ed..72275ac8 100644 --- a/src/BiliLite.UWP/Services/SettingsImportExportService.cs +++ b/src/BiliLite.UWP/Services/SettingsImportExportService.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; @@ -148,11 +149,21 @@ private byte[] Encode(string text) return bin; } + private async Task GetExportFile() + { + var savePicker = new FileSavePicker(); + savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; + savePicker.FileTypeChoices.Add("bililite设置文件", new List() { ".bililiteSettings" }); + var fileName = $"{DateTime.Now.ToString("yyyy-M-d-HH_mm_ss")}"; + savePicker.SuggestedFileName = fileName; + var file = await savePicker.PickSaveFileAsync(); + return file; + } + public async Task ExportSettings() { - var folder = await new FolderPicker().PickSingleFolderAsync(); - if (folder == null) return false; - var file = await folder.CreateFileAsync($"{DateTime.Now.ToString("yyyy-M-d-HH_mm_ss")}.bililiteSettings"); + var file = await GetExportFile(); + if (file == null) return false; try { @@ -185,9 +196,8 @@ public async Task ExportSettings() public async Task ExportSettingsWithAccount() { - var folder = await new FolderPicker().PickSingleFolderAsync(); - if (folder == null) return false; - var file = await folder.CreateFileAsync($"{DateTime.Now.ToString("yyyy-M-d-HH_mm_ss")}.bililiteSettings"); + var file = await GetExportFile(); + if (file == null) return false; try {