• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ファイル整理用ツールのPrism+WPFサンプル実装


Commit MetaInfo

Revisãoc9bc8463b68010f7a79e231fe70e883aaeccaffc (tree)
Hora2022-11-06 11:35:15
Autoryoshy <yoshy.org.bitbucket@gz.j...>
Commiteryoshy

Mensagem de Log

[MOD] ファイルシステム操作系インタラクタのソースチェック処理を切り出し

Mudança Sumário

Diff

--- a/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemCopyOperationInteractor.cs
+++ b/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemCopyOperationInteractor.cs
@@ -17,19 +17,19 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
1717 {
1818 //private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
1919
20- private readonly IFileSystemService fileSystem;
2120 private readonly IFileSystemOperationLogic operation;
21+ private readonly IFileSystemVerifyLogic verifier;
2222 private readonly IFileSystemDialogLogic dialog;
2323 private readonly IFolderTreeService folderTree;
2424
2525 public FileSystemCopyOperationInteractor(
26- IFileSystemService fileSystem,
2726 IFileSystemOperationLogic operation,
27+ IFileSystemVerifyLogic verifier,
2828 IFileSystemDialogLogic dialog,
2929 IFolderTreeService folderTree)
3030 {
31- this.fileSystem = fileSystem;
3231 this.operation = operation;
32+ this.verifier = verifier;
3333 this.dialog = dialog;
3434 this.folderTree = folderTree;
3535 }
@@ -41,12 +41,12 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
4141
4242 string verifyMsg;
4343
44- if (!VerifyTargetFolders(targetFolders, out verifyMsg))
44+ if (!this.verifier.VerifyCopyTargetFolders(targetFolders, out verifyMsg))
4545 {
4646 return UseCaseResponse.Abort<FileSystemCopyOperationResponse>(verifyMsg);
4747 }
4848
49- if (!VerifySourceFilesList(sourceFilesList, out verifyMsg))
49+ if (!this.verifier.VerifyCopySourceFilesList(sourceFilesList, out verifyMsg))
5050 {
5151 return UseCaseResponse.Abort<FileSystemCopyOperationResponse>(verifyMsg);
5252 }
@@ -70,62 +70,6 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
7070 return new();
7171 }
7272
73- private bool VerifyTargetFolders(IEnumerable<FileSystemTargetFolder> targetFolders, out string verifyMsg)
74- {
75- IEnumerable<FileSystemTargetFolder> errorFolders = this.fileSystem.VerifyTargetFolders(targetFolders);
76-
77- verifyMsg = CreateVerifyTargetFolderErrorMessage(errorFolders);
78-
79- return !string.IsNullOrEmpty(verifyMsg);
80- }
81-
82- private static string CreateVerifyTargetFolderErrorMessage(IEnumerable<FileSystemTargetFolder> errorFolders)
83- {
84- if (errorFolders.Any())
85- {
86- return string.Empty;
87- }
88-
89- string msg = "【仮】コピー先フォルダが見つかりません";
90-
91- foreach (FileSystemTargetFolder errorFolder in errorFolders)
92- {
93- msg += "\nコピー先:" + errorFolder.AbsolutePath;
94- }
95-
96- return msg;
97- }
98-
99- private bool VerifySourceFilesList(IEnumerable<FileSystemSourceFiles> sourceFilesList, out string verifyMsg)
100- {
101- IEnumerable<FileSystemSourceFiles> errorFilesList = this.fileSystem.VerifySourceFilesList(sourceFilesList);
102-
103- verifyMsg = CreateVerifySourceFilesErrorMesage(errorFilesList);
104-
105- return !string.IsNullOrEmpty(verifyMsg);
106- }
107-
108- private static string CreateVerifySourceFilesErrorMesage(IEnumerable<FileSystemSourceFiles> errorFilesList)
109- {
110- if (errorFilesList.Any())
111- {
112- return string.Empty;
113- }
114-
115- string msg = "【仮】コピー元ファイルが見つかりません";
116-
117- foreach (FileSystemSourceFiles errorFiles in errorFilesList)
118- {
119- msg += "\nコピー元:" + errorFiles.AbsolutePath;
120- foreach (string name in errorFiles.Names)
121- {
122- msg += "\n・" + name;
123- }
124- }
125-
126- return msg;
127- }
128-
12973 private void SelectNode(IEnumerable<FileSystemSourceFilesTargetFolder> sourceTargetEntries)
13074 {
13175 FileSystemSourceFilesTargetFolder sourceTargetEntry = sourceTargetEntries.First();
--- a/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemMoveOperationInteractor.cs
+++ b/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemMoveOperationInteractor.cs
@@ -17,19 +17,19 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
1717 {
1818 //private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
1919
20- private readonly IFileSystemService fileSystem;
2120 private readonly IFileSystemOperationLogic operation;
21+ private readonly IFileSystemVerifyLogic verifier;
2222 private readonly IFileSystemDialogLogic dialog;
2323 private readonly IFolderTreeService folderTree;
2424
2525 public FileSystemMoveOperationInteractor(
26- IFileSystemService fileSystem,
2726 IFileSystemOperationLogic operation,
27+ IFileSystemVerifyLogic verifier,
2828 IFileSystemDialogLogic dialog,
2929 IFolderTreeService folderTree)
3030 {
31- this.fileSystem = fileSystem;
3231 this.operation = operation;
32+ this.verifier = verifier;
3333 this.dialog = dialog;
3434 this.folderTree = folderTree;
3535 }
@@ -41,12 +41,12 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
4141
4242 string verifyMsg;
4343
44- if (!VerifyTargetFolders(targetFolders, out verifyMsg))
44+ if (!this.verifier.VerifyMoveTargetFolders(targetFolders, out verifyMsg))
4545 {
4646 return UseCaseResponse.Abort<FileSystemMoveOperationResponse>(verifyMsg);
4747 }
4848
49- if (!VerifySourceFilesList(sourceFilesList, out verifyMsg))
49+ if (!this.verifier.VerifyMoveSourceFilesList(sourceFilesList, out verifyMsg))
5050 {
5151 return UseCaseResponse.Abort<FileSystemMoveOperationResponse>(verifyMsg);
5252 }
@@ -70,62 +70,6 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
7070 return new();
7171 }
7272
73- private bool VerifyTargetFolders(IEnumerable<FileSystemTargetFolder> targetFolders, out string verifyMsg)
74- {
75- IEnumerable<FileSystemTargetFolder> errorFolders = this.fileSystem.VerifyTargetFolders(targetFolders);
76-
77- verifyMsg = CreateVerifyTargetFolderErrorMessage(errorFolders);
78-
79- return !string.IsNullOrEmpty(verifyMsg);
80- }
81-
82- private static string CreateVerifyTargetFolderErrorMessage(IEnumerable<FileSystemTargetFolder> errorFolders)
83- {
84- if (errorFolders.Any())
85- {
86- return string.Empty;
87- }
88-
89- string msg = "【仮】移動先フォルダが見つかりません";
90-
91- foreach (FileSystemTargetFolder errorFolder in errorFolders)
92- {
93- msg += "\n移動先:" + errorFolder.AbsolutePath;
94- }
95-
96- return msg;
97- }
98-
99- private bool VerifySourceFilesList(IEnumerable<FileSystemSourceFiles> sourceFilesList, out string verifyMsg)
100- {
101- IEnumerable<FileSystemSourceFiles> errorFilesList = this.fileSystem.VerifySourceFilesList(sourceFilesList);
102-
103- verifyMsg = CreateVerifySourceFilesErrorMesage(errorFilesList);
104-
105- return !string.IsNullOrEmpty(verifyMsg);
106- }
107-
108- private static string CreateVerifySourceFilesErrorMesage(IEnumerable<FileSystemSourceFiles> errorFilesList)
109- {
110- if (errorFilesList.Any())
111- {
112- return string.Empty;
113- }
114-
115- string msg = "【仮】移動元ファイルが見つかりません";
116-
117- foreach (FileSystemSourceFiles errorFiles in errorFilesList)
118- {
119- msg += "\n移動元:" + errorFiles.AbsolutePath;
120- foreach (string name in errorFiles.Names)
121- {
122- msg += "\n・" + name;
123- }
124- }
125-
126- return msg;
127- }
128-
12973 private void SelectNode(IEnumerable<FileSystemSourceFilesTargetFolder> sourceTargetEntries)
13074 {
13175 // FIX ME
--- /dev/null
+++ b/FolderCategorizer2.02UseCase/Internal/FileSystemVerifyLogic.cs
@@ -0,0 +1,130 @@
1+using FolderCategorizer2.Domain.Boundary.Service;
2+using FolderCategorizer2.Domain.Service.Dto;
3+using System.Collections.Generic;
4+using System.Linq;
5+
6+namespace FolderCategorizer2.UseCase.Internal
7+{
8+ internal class FileSystemVerifyLogic : IFileSystemVerifyLogic
9+ {
10+ private readonly IFileSystemService fileSystem;
11+
12+ public FileSystemVerifyLogic(IFileSystemService fileSystem)
13+ {
14+ this.fileSystem = fileSystem;
15+ }
16+
17+ public bool VerifyCopyTargetFolders(IEnumerable<FileSystemTargetFolder> targetFolders, out string verifyMsg)
18+ {
19+ IEnumerable<FileSystemTargetFolder> errorFolders = this.fileSystem.VerifyTargetFolders(targetFolders);
20+
21+ verifyMsg = CreateVerifyCopyTargetFolderErrorMessage(errorFolders);
22+
23+ return !string.IsNullOrEmpty(verifyMsg);
24+ }
25+
26+ private static string CreateVerifyCopyTargetFolderErrorMessage(IEnumerable<FileSystemTargetFolder> errorFolders)
27+ {
28+ if (errorFolders.Any())
29+ {
30+ return string.Empty;
31+ }
32+
33+ string msg = "【仮】コピー先フォルダが見つかりません";
34+
35+ foreach (FileSystemTargetFolder errorFolder in errorFolders)
36+ {
37+ msg += "\nコピー先:" + errorFolder.AbsolutePath;
38+ }
39+
40+ return msg;
41+ }
42+
43+ public bool VerifyCopySourceFilesList(IEnumerable<FileSystemSourceFiles> sourceFilesList, out string verifyMsg)
44+ {
45+ IEnumerable<FileSystemSourceFiles> errorFilesList = this.fileSystem.VerifySourceFilesList(sourceFilesList);
46+
47+ verifyMsg = CreateVerifyCopySourceFilesErrorMesage(errorFilesList);
48+
49+ return !string.IsNullOrEmpty(verifyMsg);
50+ }
51+
52+ private static string CreateVerifyCopySourceFilesErrorMesage(IEnumerable<FileSystemSourceFiles> errorFilesList)
53+ {
54+ if (errorFilesList.Any())
55+ {
56+ return string.Empty;
57+ }
58+
59+ string msg = "【仮】コピー元ファイルが見つかりません";
60+
61+ foreach (FileSystemSourceFiles errorFiles in errorFilesList)
62+ {
63+ msg += "\nコピー元:" + errorFiles.AbsolutePath;
64+ foreach (string name in errorFiles.Names)
65+ {
66+ msg += "\n・" + name;
67+ }
68+ }
69+
70+ return msg;
71+ }
72+
73+ public bool VerifyMoveTargetFolders(IEnumerable<FileSystemTargetFolder> targetFolders, out string verifyMsg)
74+ {
75+ IEnumerable<FileSystemTargetFolder> errorFolders = this.fileSystem.VerifyTargetFolders(targetFolders);
76+
77+ verifyMsg = CreateVerifyMoveTargetFolderErrorMessage(errorFolders);
78+
79+ return !string.IsNullOrEmpty(verifyMsg);
80+ }
81+
82+ private static string CreateVerifyMoveTargetFolderErrorMessage(IEnumerable<FileSystemTargetFolder> errorFolders)
83+ {
84+ if (errorFolders.Any())
85+ {
86+ return string.Empty;
87+ }
88+
89+ string msg = "【仮】移動先フォルダが見つかりません";
90+
91+ foreach (FileSystemTargetFolder errorFolder in errorFolders)
92+ {
93+ msg += "\n移動先:" + errorFolder.AbsolutePath;
94+ }
95+
96+ return msg;
97+ }
98+
99+ public bool VerifyMoveSourceFilesList(IEnumerable<FileSystemSourceFiles> sourceFilesList, out string verifyMsg)
100+ {
101+ IEnumerable<FileSystemSourceFiles> errorFilesList = this.fileSystem.VerifySourceFilesList(sourceFilesList);
102+
103+ verifyMsg = CreateVerifyMoveSourceFilesErrorMesage(errorFilesList);
104+
105+ return !string.IsNullOrEmpty(verifyMsg);
106+ }
107+
108+ private static string CreateVerifyMoveSourceFilesErrorMesage(IEnumerable<FileSystemSourceFiles> errorFilesList)
109+ {
110+ if (errorFilesList.Any())
111+ {
112+ return string.Empty;
113+ }
114+
115+ string msg = "【仮】移動元ファイルが見つかりません";
116+
117+ foreach (FileSystemSourceFiles errorFiles in errorFilesList)
118+ {
119+ msg += "\n移動元:" + errorFiles.AbsolutePath;
120+ foreach (string name in errorFiles.Names)
121+ {
122+ msg += "\n・" + name;
123+ }
124+ }
125+
126+ return msg;
127+ }
128+
129+ }
130+}
--- /dev/null
+++ b/FolderCategorizer2.02UseCase/Internal/IFileSystemVerifyLogic.cs
@@ -0,0 +1,13 @@
1+using FolderCategorizer2.Domain.Service.Dto;
2+using System.Collections.Generic;
3+
4+namespace FolderCategorizer2.UseCase.Internal
5+{
6+ internal interface IFileSystemVerifyLogic
7+ {
8+ bool VerifyCopySourceFilesList(IEnumerable<FileSystemSourceFiles> sourceFilesList, out string verifyMsg);
9+ bool VerifyCopyTargetFolders(IEnumerable<FileSystemTargetFolder> targetFolders, out string verifyMsg);
10+ bool VerifyMoveSourceFilesList(IEnumerable<FileSystemSourceFiles> sourceFilesList, out string verifyMsg);
11+ bool VerifyMoveTargetFolders(IEnumerable<FileSystemTargetFolder> targetFolders, out string verifyMsg);
12+ }
13+}
\ No newline at end of file
--- a/FolderCategorizer2.02UseCase/UseCaseModule.cs
+++ b/FolderCategorizer2.02UseCase/UseCaseModule.cs
@@ -67,6 +67,7 @@ namespace FolderCategorizer2.UseCase
6767
6868 containerRegistry.Register<IFileSystemOperationLogic, FileSystemOperationLogic>();
6969 containerRegistry.Register<IFileSystemDialogLogic, FileSystemDialogLogic>();
70+ containerRegistry.Register<IFileSystemVerifyLogic, FileSystemVerifyLogic>();
7071
7172 logger.Trace("RegisterTypes end");
7273 }