From e46ddeafb7a8a8c2f092271126816cd51881e956 Mon Sep 17 00:00:00 2001 From: miyaji255 <84168445+miyaji255@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:09:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=83=AA=E3=81=AE=E5=AD=98=E5=9C=A8=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KoeBook/Services/CoreMocks/AnalyzerServiceMock.cs | 1 + KoeBook/Services/GenerationTaskRunnerService.cs | 8 ++++++-- KoeBook/appsettings.json | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/KoeBook/Services/CoreMocks/AnalyzerServiceMock.cs b/KoeBook/Services/CoreMocks/AnalyzerServiceMock.cs index fcf54be..80141db 100644 --- a/KoeBook/Services/CoreMocks/AnalyzerServiceMock.cs +++ b/KoeBook/Services/CoreMocks/AnalyzerServiceMock.cs @@ -11,6 +11,7 @@ public class AnalyzerServiceMock(IDisplayStateChangeService stateService) : IAna public async ValueTask AnalyzeAsync(BookProperties bookProperties, string tempDirectory, CancellationToken cancellationToken) { + Directory.CreateDirectory(tempDirectory); DisplayStateChanging stateChanging; if (bookProperties.SourceType == SourceType.Url) { diff --git a/KoeBook/Services/GenerationTaskRunnerService.cs b/KoeBook/Services/GenerationTaskRunnerService.cs index cd814bc..68fddbe 100644 --- a/KoeBook/Services/GenerationTaskRunnerService.cs +++ b/KoeBook/Services/GenerationTaskRunnerService.cs @@ -52,7 +52,8 @@ private async ValueTask RunAsync(GenerationTask task) return; await RunAsyncCore(task, true); - await RunAsyncCore(task, false); + if (task.SkipEdit) + await RunAsyncCore(task, false); } public async void RunGenerateEpubAsync(GenerationTask task) @@ -83,7 +84,10 @@ private async ValueTask RunAsyncCore(GenerationTask task, bool firstStep) task.Progress = 1; task.MaximumProgress = 1; var fileName = Path.GetFileName(resultPath); - File.Move(resultPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "KoeBook", fileName), true); + var resultDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "KoeBook"); + if (!Directory.Exists(resultDirectory)) + Directory.CreateDirectory(resultDirectory); + File.Move(resultPath, Path.Combine(resultDirectory, fileName), true); } else throw new InvalidOperationException(); diff --git a/KoeBook/appsettings.json b/KoeBook/appsettings.json index 5fbea09..22d7e54 100644 --- a/KoeBook/appsettings.json +++ b/KoeBook/appsettings.json @@ -4,9 +4,9 @@ "LocalSettingsFile": "LocalSettings.json" }, "MockOptions": { - "IAnalyzerService": false, - "IEpubGenerateService": false, - "ISoundGenerationSelectorService": false, - "ISoundGenerationService": false + "IAnalyzerService": true, + "IEpubGenerateService": true, + "ISoundGenerationSelectorService": true, + "ISoundGenerationService": true } } From 360b32dc9e420d11bf1c0b799fb6f3d62113a70e Mon Sep 17 00:00:00 2001 From: miyaji255 <84168445+miyaji255@users.noreply.github.com> Date: Sun, 14 Apr 2024 00:15:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KoeBook/appsettings.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KoeBook/appsettings.json b/KoeBook/appsettings.json index 22d7e54..5fbea09 100644 --- a/KoeBook/appsettings.json +++ b/KoeBook/appsettings.json @@ -4,9 +4,9 @@ "LocalSettingsFile": "LocalSettings.json" }, "MockOptions": { - "IAnalyzerService": true, - "IEpubGenerateService": true, - "ISoundGenerationSelectorService": true, - "ISoundGenerationService": true + "IAnalyzerService": false, + "IEpubGenerateService": false, + "ISoundGenerationSelectorService": false, + "ISoundGenerationService": false } }