• 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

Revisiónf5a5b5a1044e418083638adc24ea9a4050085a1c (tree)
Tiempo2022-07-31 02:09:29
Autoryoshy <yoshy.org.bitbucket@gz.j...>
Commiteryoshy

Log Message

[MOD] FileSystemSourceFiles, FileSystemTargetFolder が保持するパスを TargetPath と RelativePath に分けたまま持つように修正

Cambiar Resumen

Diferencia incremental

--- a/FolderCategorizer2.01Domain/Boundary/Service/IFileListService.cs
+++ b/FolderCategorizer2.01Domain/Boundary/Service/IFileListService.cs
@@ -5,8 +5,8 @@ namespace FolderCategorizer2.Domain.Boundary.Service
55 {
66 public interface IFileListService
77 {
8- FileListDiff ReplaceFileListDiff(string tabId, IEnumerable<(string treeId, string path)> targets);
8+ FileListDiff ReplaceFileListDiff(string tabId, IEnumerable<(string treeId, string targetPath, string relativePath)> targets);
99 FileListDiff RestoreFileListDiff(string tabId);
10- FileListDiff RefreshFileListDiff(string tabId, IEnumerable<(string TreeID, string Path)> enumerable);
10+ FileListDiff RefreshFileListDiff(string tabId, IEnumerable<(string TreeID, string targetPath, string relativePath)> enumerable);
1111 }
1212 }
--- a/FolderCategorizer2.01Domain/Model/Entity/FileList.cs
+++ b/FolderCategorizer2.01Domain/Model/Entity/FileList.cs
@@ -1,4 +1,5 @@
1-using System;
1+using CleanAuLait.Core.IO;
2+using System;
23 using System.Collections.Generic;
34
45 namespace FolderCategorizer2.Domain.Model.Entity
@@ -7,14 +8,17 @@ namespace FolderCategorizer2.Domain.Model.Entity
78 {
89 public string TreeID { get; init; }
910 public string TargetPath { get; init; }
11+ public string RelativePath { get; init; }
12+ public string AbsolutePath => PathHelper.CreateCanonicalPath(TargetPath, RelativePath);
1013 public IEnumerable<FileListRow> Rows { get; init; }
1114
1215 private bool disposedValue;
1316
14- public FileList(string treeId, string targetPath, IEnumerable<FileListRow> rows)
17+ public FileList(string treeId, string targetPath, string relativePath, IEnumerable<FileListRow> rows)
1518 {
1619 this.TreeID = treeId;
1720 this.TargetPath = targetPath;
21+ this.RelativePath = relativePath;
1822 this.Rows = rows;
1923
2024 foreach (var row in rows)
--- a/FolderCategorizer2.01Domain/Service/Dto/FileSystemSourceFiles.cs
+++ b/FolderCategorizer2.01Domain/Service/Dto/FileSystemSourceFiles.cs
@@ -1,11 +1,14 @@
1-using System.Collections.Generic;
1+using CleanAuLait.Core.IO;
2+using System.Collections.Generic;
23
34 namespace FolderCategorizer2.Domain.Service.Dto
45 {
56 public record class FileSystemSourceFiles(
67 string TreeID,
7- string Path, // TODO AbsolutePath
8+ string TargetPath,
9+ string RelativePath,
810 IList<string> Names
911 ){
12+ public string AbsolutePath = PathHelper.CreateCanonicalPath(TargetPath, RelativePath);
1013 }
1114 }
--- a/FolderCategorizer2.01Domain/Service/Dto/FileSystemTargetFolder.cs
+++ b/FolderCategorizer2.01Domain/Service/Dto/FileSystemTargetFolder.cs
@@ -1,21 +1,28 @@
11 using CleanAuLait.Core.IO;
22 using FolderCategorizer2.Domain.Model.Entity;
3+using System.IO;
34
45 namespace FolderCategorizer2.Domain.Service.Dto
56 {
67 public record class FileSystemTargetFolder(
78 string TreeID,
8- string Path // TODO AbsolutePath
9+ string TargetPath,
10+ string RelativePath
911 ) {
12+ public string AbsolutePath => PathHelper.CreateCanonicalPath(TargetPath, RelativePath);
13+
1014 public FileSystemTargetFolder(FileList fileList, string name) : this(
1115 TreeID: fileList.TreeID,
12- Path: PathHelper.CreateCanonicalPath(fileList.TargetPath, name)
13- ) {
16+ TargetPath: fileList.TargetPath,
17+ RelativePath: Path.Combine(fileList.RelativePath, name)
18+ )
19+ {
1420 }
1521
1622 public FileSystemTargetFolder(FolderTree folderTree, string name) : this(
1723 TreeID: folderTree.ID,
18- Path: PathHelper.CreateCanonicalPath(folderTree.TargetPath, name)
24+ TargetPath: folderTree.TargetPath,
25+ RelativePath: name
1926 ) {
2027 }
2128 }
--- a/FolderCategorizer2.01Domain/Service/FileListService.cs
+++ b/FolderCategorizer2.01Domain/Service/FileListService.cs
@@ -1,4 +1,5 @@
1-using FolderCategorizer2.Domain.Boundary.Repository;
1+using CleanAuLait.Core.IO;
2+using FolderCategorizer2.Domain.Boundary.Repository;
23 using FolderCategorizer2.Domain.Boundary.Service;
34 using FolderCategorizer2.Domain.Model.Entity;
45 using FolderCategorizer2.Domain.Translator;
@@ -58,7 +59,7 @@ namespace FolderCategorizer2.Domain.Service
5859
5960 #endregion
6061
61- public FileListDiff ReplaceFileListDiff(string tabId, IEnumerable<(string treeId, string path)> targets)
62+ public FileListDiff ReplaceFileListDiff(string tabId, IEnumerable<(string treeId, string targetPath, string relativePath)> targets)
6263 {
6364 FileListDiff diff = CreateFileListDiff(targets);
6465
@@ -74,20 +75,22 @@ namespace FolderCategorizer2.Domain.Service
7475 return diff;
7576 }
7677
77- public FileListDiff RefreshFileListDiff(string tabId, IEnumerable<(string TreeID, string Path)> targets)
78+ public FileListDiff RefreshFileListDiff(string tabId, IEnumerable<(string TreeID, string targetPath, string relativePath)> targets)
7879 {
7980 return ReplaceFileListDiff(tabId, targets);
8081 }
8182
82- private FileListDiff CreateFileListDiff(IEnumerable<(string treeId, string path)> targets)
83+ private FileListDiff CreateFileListDiff(IEnumerable<(string treeId, string targetPath, string relativePath)> targets)
8384 {
8485 IList<FileList> fileLists = new List<FileList>();
8586
86- foreach (var (treeId, path) in targets)
87+ foreach (var (treeId, targetPath, relativePath) in targets)
8788 {
89+ string path = PathHelper.CreateCanonicalPath(targetPath, relativePath);
90+
8891 IList<FileListRow> rows = fileSystem.SearchFileList(path).Select(e => rowTranslator.Translate(e)).ToList();
8992
90- FileList fileList = new(treeId, path, rows);
93+ FileList fileList = new(treeId, targetPath, relativePath, rows);
9194
9295 fileLists.Add(fileList);
9396 }
--- a/FolderCategorizer2.01Domain/Service/FileSystemService.cs
+++ b/FolderCategorizer2.01Domain/Service/FileSystemService.cs
@@ -28,7 +28,7 @@ namespace FolderCategorizer2.Domain.Service
2828
2929 foreach(FileSystemTargetFolder targetFolder in targetFolders)
3030 {
31- FileEntryType type = localFileSystem.GetFileEntryType(targetFolder.Path);
31+ FileEntryType type = localFileSystem.GetFileEntryType(targetFolder.AbsolutePath);
3232
3333 if (type != FileEntryType.FOLDER)
3434 {
@@ -62,7 +62,7 @@ namespace FolderCategorizer2.Domain.Service
6262
6363 foreach (string name in sourceFiles.Names)
6464 {
65- FileEntryType type = localFileSystem.GetFileEntryType(Path.Combine(sourceFiles.Path, name));
65+ FileEntryType type = localFileSystem.GetFileEntryType(Path.Combine(sourceFiles.AbsolutePath, name));
6666
6767 switch (type)
6868 {
@@ -76,7 +76,7 @@ namespace FolderCategorizer2.Domain.Service
7676 }
7777
7878 return errorFiles.Any()
79- ? new FileSystemSourceFiles(sourceFiles.TreeID, sourceFiles.Path, errorFiles)
79+ ? new FileSystemSourceFiles(sourceFiles.TreeID, sourceFiles.TargetPath, sourceFiles.RelativePath, errorFiles)
8080 : null;
8181 }
8282
--- a/FolderCategorizer2.01Domain/Service/FolderTreeService.cs
+++ b/FolderCategorizer2.01Domain/Service/FolderTreeService.cs
@@ -121,11 +121,7 @@ namespace FolderCategorizer2.Domain.Service
121121 $"absolute path {absolutePath} must be under tree target path {tree.TargetPath}");
122122 }
123123
124- string relativePath = Path.GetRelativePath(tree.TargetPath, absolutePath);
125-
126- return relativePath == FileSystemConst.RELATIVE_PATH_TOP
127- ? relativePath
128- : Path.Combine(FileSystemConst.RELATIVE_PATH_TOP, relativePath);
124+ return PathHelper.EnsureLeadingDotPath(Path.GetRelativePath(tree.TargetPath, absolutePath));
129125 }
130126
131127 public void SelectNode(string treeId, string relativePath)
@@ -162,7 +158,7 @@ namespace FolderCategorizer2.Domain.Service
162158 node.IsExpanded.Value = isExpanded;
163159 }
164160
165- private FolderTreeNode FindNodeByRelativePath(FolderTree tree, string relativePath)
161+ private static FolderTreeNode FindNodeByRelativePath(FolderTree tree, string relativePath)
166162 {
167163 if (relativePath == FileSystemConst.RELATIVE_PATH_TOP)
168164 {
--- a/FolderCategorizer2.02UseCase/FileListOperation/Request/ReplaceFileListRequest.cs
+++ b/FolderCategorizer2.02UseCase/FileListOperation/Request/ReplaceFileListRequest.cs
@@ -7,7 +7,7 @@ namespace FolderCategorizer2.UseCase.FileListOperation.Request
77 {
88 public record class ReplaceFileListRequest(
99 string TabId,
10- IEnumerable<(string treeId, string path)> Targets) : UseCaseRequest
10+ IEnumerable<(string treeId, string targetPath, string relativePath)> Targets) : UseCaseRequest
1111 {
1212 public override Type GetInteractorType()
1313 {
--- a/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemCopyOperationInteractor.cs
+++ b/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemCopyOperationInteractor.cs
@@ -47,7 +47,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
4747 string msg = "【仮】コピー先フォルダが見つかりません";
4848 foreach (FileSystemTargetFolder errorFolder in errorFolders)
4949 {
50- msg += "\nコピー先:" + errorFolder.Path;
50+ msg += "\nコピー先:" + errorFolder.AbsolutePath;
5151 }
5252 return UseCaseResponse.Abort<FileSystemCopyOperationResponse>(msg);
5353 }
@@ -61,7 +61,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
6161 string msg = "【仮】コピー元ファイルが見つかりません";
6262 foreach (FileSystemSourceFiles errorFiles in errorFilesList)
6363 {
64- msg += "\nコピー元:" + errorFiles.Path;
64+ msg += "\nコピー元:" + errorFiles.AbsolutePath;
6565 foreach (string name in errorFiles.Names)
6666 {
6767 msg += "\n・" + name;
@@ -77,12 +77,12 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
7777 string msg = "【仮】コピーしてもよろしいですか";
7878 foreach (FileSystemSourceTargetEntry sourceTargetEntry in sourceTargetEntries)
7979 {
80- msg += "\n\nコピー元:" + sourceTargetEntry.SourceFiles.Path;
80+ msg += "\n\nコピー元:" + sourceTargetEntry.SourceFiles.AbsolutePath;
8181 foreach (string name in sourceTargetEntry.SourceFiles.Names)
8282 {
8383 msg += "\n・" + name;
8484 }
85- msg += "\n↓\nコピー先:" + sourceTargetEntry.TargetFolder.Path;
85+ msg += "\n↓\nコピー先:" + sourceTargetEntry.TargetFolder.AbsolutePath;
8686 }
8787
8888 IDialogResult result = this.dialog.ShowYesNoDialog("ファイルのコピー - 確認", msg, MessageBoxImage.Question);
@@ -95,13 +95,13 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
9595
9696 foreach (FileSystemSourceTargetEntry sourceTargetEntry in sourceTargetEntries)
9797 {
98- string targetPath = PathHelper.CreateCanonicalPath(sourceTargetEntry.TargetFolder.Path);
99- string sourcePath = PathHelper.CreateCanonicalPath(sourceTargetEntry.SourceFiles.Path);
98+ string targetFolderPath = sourceTargetEntry.TargetFolder.AbsolutePath;
99+ string sourceFolderPath = sourceTargetEntry.SourceFiles.AbsolutePath;
100100
101101 foreach (string name in sourceTargetEntry.SourceFiles.Names)
102102 {
103- string sourceFullPath = PathHelper.CreateCanonicalPath(sourcePath, name);
104- string targetFullPath = PathHelper.CreateCanonicalPath(targetPath, name);
103+ string sourceFullPath = PathHelper.CreateCanonicalPath(sourceFolderPath, name);
104+ string targetFullPath = PathHelper.CreateCanonicalPath(targetFolderPath, name);
105105
106106 Retry:
107107 try
@@ -112,7 +112,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
112112 {
113113 string msg = string.Format(
114114 "ファイルのコピー中に次のエラーが発生しました。\n{0}\n\nコピー元:{1}\nコピー先:{2}",
115- e.Message, sourceFullPath, targetPath);
115+ e.Message, sourceFullPath, targetFolderPath);
116116
117117 IDialogResult result = this.dialog.ShowAbortRetryIgnoreDialog("ファイルのコピー - エラー", msg, MessageBoxImage.Hand);
118118
@@ -131,14 +131,8 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
131131
132132 string treeId = sourceTargetEntry.TreeID;
133133
134- string sourceRelativePath = this.folderTree.ConvertTreeRelativePath(
135- treeId, sourceTargetEntry.SourceFiles.Path);
136-
137- string targetRelativePath = this.folderTree.ConvertTreeRelativePath(
138- treeId, sourceTargetEntry.TargetFolder.Path);
139-
140- this.folderTree.RefreshFolderTree(treeId, sourceRelativePath);
141- this.folderTree.RefreshFolderTree(treeId, targetRelativePath);
134+ this.folderTree.RefreshFolderTree(treeId, sourceTargetEntry.SourceFiles.RelativePath);
135+ this.folderTree.RefreshFolderTree(treeId, sourceTargetEntry.TargetFolder.RelativePath);
142136 }
143137
144138 {
@@ -146,10 +140,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
146140
147141 string treeId = sourceTargetEntry.TreeID;
148142
149- string targetRelativePath = this.folderTree.ConvertTreeRelativePath(
150- treeId, sourceTargetEntry.TargetFolder.Path);
151-
152- this.folderTree.SelectNode(treeId, targetRelativePath);
143+ this.folderTree.SelectNode(treeId, sourceTargetEntry.TargetFolder.RelativePath);
153144 }
154145
155146 return new FileSystemCopyOperationResponse();
--- a/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemDeleteOperationInteractor.cs
+++ b/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemDeleteOperationInteractor.cs
@@ -52,7 +52,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
5252 string msg = "【仮】削除してもよろしいですか";
5353 foreach (FileSystemSourceFiles sourceFiles in sourceFilesList)
5454 {
55- msg += "\n\n削除元:" + sourceFiles.Path;
55+ msg += "\n\n削除元:" + sourceFiles.AbsolutePath;
5656 foreach (string name in sourceFiles.Names)
5757 {
5858 msg += "\n・" + name;
@@ -69,7 +69,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
6969
7070 foreach (FileSystemSourceFiles sourceFiles in sourceFilesList)
7171 {
72- string sourcePath = PathHelper.CreateCanonicalPath(sourceFiles.Path);
72+ string sourcePath = PathHelper.CreateCanonicalPath(sourceFiles.AbsolutePath);
7373
7474 foreach (string name in sourceFiles.Names)
7575 {
@@ -103,17 +103,14 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
103103
104104 string treeId = sourceFiles.TreeID;
105105
106- string sourceRelativePath = this.folderTree.ConvertTreeRelativePath(
107- treeId, sourceFiles.Path);
108-
109- this.folderTree.RefreshFolderTree(treeId, sourceRelativePath);
106+ this.folderTree.RefreshFolderTree(treeId, sourceFiles.RelativePath);
110107 }
111108
112109 {
113110 // TODO implement extract tab id function
114111 string tabId = sourceFilesList.First().TreeID.Split('/').First();
115112
116- FileListDiff newDiff = this.fileList.RefreshFileListDiff( tabId, sourceFilesList.Select(v => (v.TreeID, v.Path)) );
113+ FileListDiff newDiff = this.fileList.RefreshFileListDiff( tabId, sourceFilesList.Select(v => (v.TreeID, v.TargetPath, v.RelativePath)) );
117114
118115 FileSystemDeleteOperationResponse res = new(newDiff);
119116
--- a/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemMoveOperationInteractor.cs
+++ b/FolderCategorizer2.02UseCase/FileSystemOperation/Interactor/FileSystemMoveOperationInteractor.cs
@@ -47,7 +47,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
4747 string msg = "【仮】移動先フォルダが見つかりません";
4848 foreach (FileSystemTargetFolder errorFolder in errorFolders)
4949 {
50- msg += "\n移動先:" + errorFolder.Path;
50+ msg += "\n移動先:" + errorFolder.AbsolutePath;
5151 }
5252 return UseCaseResponse.Abort<FileSystemMoveOperationResponse>(msg);
5353 }
@@ -61,7 +61,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
6161 string msg = "【仮】移動元ファイルが見つかりません";
6262 foreach (FileSystemSourceFiles errorFiles in errorFilesList)
6363 {
64- msg += "\n移動元:" + errorFiles.Path;
64+ msg += "\n移動元:" + errorFiles.AbsolutePath;
6565 foreach (string name in errorFiles.Names)
6666 {
6767 msg += "\n・" + name;
@@ -77,12 +77,12 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
7777 string msg = "【仮】移動してもよろしいですか";
7878 foreach (FileSystemSourceTargetEntry sourceTargetEntry in sourceTargetEntries)
7979 {
80- msg += "\n\n移動元:" + sourceTargetEntry.SourceFiles.Path;
80+ msg += "\n\n移動元:" + sourceTargetEntry.SourceFiles.AbsolutePath;
8181 foreach (string name in sourceTargetEntry.SourceFiles.Names)
8282 {
8383 msg += "\n・" + name;
8484 }
85- msg += "\n↓\n移動先:" + sourceTargetEntry.TargetFolder.Path;
85+ msg += "\n↓\n移動先:" + sourceTargetEntry.TargetFolder.AbsolutePath;
8686 }
8787
8888 IDialogResult result = this.dialog.ShowYesNoDialog("ファイルの移動 - 確認", msg, MessageBoxImage.Question);
@@ -95,13 +95,13 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
9595
9696 foreach (FileSystemSourceTargetEntry sourceTargetEntry in sourceTargetEntries)
9797 {
98- string targetPath = PathHelper.CreateCanonicalPath(sourceTargetEntry.TargetFolder.Path);
99- string sourcePath = PathHelper.CreateCanonicalPath(sourceTargetEntry.SourceFiles.Path);
98+ string targetFolderPath = sourceTargetEntry.TargetFolder.AbsolutePath;
99+ string sourceFolderPath = sourceTargetEntry.SourceFiles.AbsolutePath;
100100
101101 foreach (string name in sourceTargetEntry.SourceFiles.Names)
102102 {
103- string sourceFullPath = PathHelper.CreateCanonicalPath(sourcePath, name);
104- string targetFullPath = PathHelper.CreateCanonicalPath(targetPath, name);
103+ string sourceFullPath = PathHelper.CreateCanonicalPath(sourceFolderPath, name);
104+ string targetFullPath = PathHelper.CreateCanonicalPath(targetFolderPath, name);
105105
106106 Retry:
107107 try
@@ -112,7 +112,7 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
112112 {
113113 string msg = string.Format(
114114 "ファイルの移動中に次のエラーが発生しました。\n{0}\n\n移動元:{1}\n移動先:{2}",
115- e.Message, sourceFullPath, targetPath);
115+ e.Message, sourceFullPath, targetFolderPath);
116116
117117 IDialogResult result = this.dialog.ShowAbortRetryIgnoreDialog("ファイルの移動 - エラー", msg, MessageBoxImage.Hand);
118118
@@ -131,25 +131,17 @@ namespace FolderCategorizer2.UseCase.FileSystemOperation.Interactor
131131
132132 string treeId = sourceTargetEntry.TreeID;
133133
134- string sourceRelativePath = this.folderTree.ConvertTreeRelativePath(
135- treeId, sourceTargetEntry.SourceFiles.Path);
136-
137- string targetRelativePath = this.folderTree.ConvertTreeRelativePath(
138- treeId, sourceTargetEntry.TargetFolder.Path);
139-
140- this.folderTree.RefreshFolderTree(treeId, sourceRelativePath);
141- this.folderTree.RefreshFolderTree(treeId, targetRelativePath);
134+ this.folderTree.RefreshFolderTree(treeId, sourceTargetEntry.SourceFiles.RelativePath);
135+ this.folderTree.RefreshFolderTree(treeId, sourceTargetEntry.TargetFolder.RelativePath);
142136 }
143137
138+ if (false)
144139 {
145140 FileSystemSourceTargetEntry sourceTargetEntry = sourceTargetEntries.First();
146141
147142 string treeId = sourceTargetEntry.TreeID;
148143
149- string targetRelativePath = this.folderTree.ConvertTreeRelativePath(
150- treeId, sourceTargetEntry.TargetFolder.Path);
151-
152- this.folderTree.SelectNode(treeId, targetRelativePath);
144+ this.folderTree.SelectNode(treeId, sourceTargetEntry.TargetFolder.RelativePath);
153145 }
154146
155147 return new FileSystemMoveOperationResponse();
--- a/FolderCategorizer2.03Adaptor/Boundary/ViewModel/Child/IFolderTreeNodeViewModel.cs
+++ b/FolderCategorizer2.03Adaptor/Boundary/ViewModel/Child/IFolderTreeNodeViewModel.cs
@@ -10,6 +10,7 @@ namespace FolderCategorizer2.Adaptor.Boundary.ViewModel.Child
1010 public interface IFolderTreeNodeViewModel
1111 {
1212 ReadOnlyReactivePropertySlim<string> Text { get; }
13+ ReadOnlyReactivePropertySlim<string> RelativePath { get; }
1314 ReadOnlyReactivePropertySlim<ImageSource> ItemImage { get; }
1415 ReactivePropertySlim<bool> IsExpanded { get; }
1516 ReactivePropertySlim<bool> IsSelected { get; }
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Child/FileListRowViewModel.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Child/FileListRowViewModel.cs
@@ -108,7 +108,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
108108 {
109109 if (target != null)
110110 {
111- logger.Trace("FileListRowViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.Path);
111+ logger.Trace("FileListRowViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.AbsolutePath);
112112 }
113113 }
114114
@@ -118,14 +118,6 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
118118 _ = this.ParentVm.WindowController.Execute(req);
119119 }
120120
121- private IEnumerable<FileSystemTargetFolder> CreateTargetFolders()
122- {
123- // TODO LINKの場合
124- return this.Source.Sources
125- .Where(row => row.Type.Value == FileEntryType.FOLDER)
126- .Select(row => new FileSystemTargetFolder(row.Parent, this.Name.Value));
127- }
128-
129121 public void NotifyMoveFileListDropped(DnDSourceFileInfo draggedFileList)
130122 {
131123 // TODO LINKの場合
@@ -137,7 +129,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
137129 {
138130 if (target != null)
139131 {
140- logger.Trace("FileListRowViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.Path);
132+ logger.Trace("FileListRowViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.AbsolutePath);
141133 }
142134 }
143135
@@ -147,6 +139,14 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
147139 _ = this.ParentVm.WindowController.Execute(req);
148140 }
149141
142+ private IEnumerable<FileSystemTargetFolder> CreateTargetFolders()
143+ {
144+ // TODO LINKの場合
145+ return this.Source.Sources
146+ .Where(row => row.Type.Value == FileEntryType.FOLDER)
147+ .Select(row => new FileSystemTargetFolder(row.Parent, this.Name.Value));
148+ }
149+
150150 #endregion
151151
152152 #region IEditableObject
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Child/FolderTreeNodeViewModel.FolderTreeDragSource.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Child/FolderTreeNodeViewModel.FolderTreeDragSource.cs
@@ -1,11 +1,14 @@
1-using FolderCategorizer2.Adaptor.Boundary.ViewModel;
1+using CleanAuLait.Core.IO;
2+using FolderCategorizer2.Adaptor.Boundary.ViewModel;
23 using FolderCategorizer2.Adaptor.Boundary.ViewModel.Child;
34 using FolderCategorizer2.Adaptor.Gateway.ViewModel.Dto;
5+using FolderCategorizer2.Domain.Model.Const;
46 using FolderCategorizer2.Domain.Service.Dto;
57 using GongSolutions.Wpf.DragDrop;
68 using NLog;
79 using System;
810 using System.Collections.Generic;
11+using System.IO;
912 using System.Windows;
1013
1114 namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
@@ -19,7 +22,9 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
1922 /// <inheritdoc/>
2023 public bool CanStartDrag(IDragInfo dragInfo)
2124 {
22- return true;
25+ var item = (IFolderTreeNodeViewModel)dragInfo.SourceItem;
26+
27+ return item.RelativePath.Value != FileSystemConst.RELATIVE_PATH_TOP;
2328 }
2429
2530 /// <inheritdoc/>
@@ -41,8 +46,12 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
4146 foreach (IFolderTreeViewModel vm
4247 in treeNaviVm.InterVmStore.FindTreeViewModelsByTabId(treeVm.TabID))
4348 {
49+ string relativePath = PathHelper.EnsureLeadingDotPath(
50+ PathHelper.CreateCanonicalRelativePath(
51+ item.RelativePath.Value, FileSystemConst.RELATIVE_PATH_UPWARDS));
52+
4453 sourceFilesList.Add(new FileSystemSourceFiles(
45- vm.TreeID, vm.TargetPath, new string[] { item.Text.Value }));
54+ vm.TreeID, vm.TargetPath, relativePath, new string[] { item.Text.Value }));
4655 }
4756
4857 dragInfo.Data = new DnDSourceFileInfo(draggedImages, sourceFilesList);
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Child/FolderTreeNodeViewModel.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Child/FolderTreeNodeViewModel.cs
@@ -45,12 +45,12 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
4545 { get; private set; } = Level;
4646 public ReadOnlyReactivePropertySlim<string> RelativePath
4747 { get; private set; } = RelativePath;
48+ public ReadOnlyReactivePropertySlim<ImageSource> ItemImage
49+ { get; private set; } = ItemImage;
4850 public ReactivePropertySlim<bool> IsExpanded
4951 { get; private set; } = IsExpanded;
5052 public ReactivePropertySlim<bool> IsSelected
5153 { get; private set; } = IsSelected;
52- public ReadOnlyReactivePropertySlim<ImageSource> ItemImage
53- { get; private set; } = ItemImage;
5454
5555 public string AbsolutePath => PathHelper.CreateCanonicalPath(this.ParentVm.TargetPath, this.RelativePath.Value);
5656 public INotifyCollectionChangedSynchronizedSingleView<FolderTreeNode, IFolderTreeNodeViewModel> Children
@@ -92,16 +92,18 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
9292 if (this.Children?.Count > 0)
9393 {
9494 logger.Trace("OnExpandedChanged: {0}, SerchLevel {1}, RelativePath [{2}]",
95- Text.Value, Level.Value, RelativePath.Value);
95+ this.Text.Value, this.Level.Value, this.RelativePath.Value);
9696
9797 // TODO Notify のイベント化
98- this.ParentVm.NotifyExpandedFolderChanged(RelativePath.Value, Level.Value, IsExpanded.Value);
98+ this.ParentVm.NotifyExpandedFolderChanged(
99+ this.RelativePath.Value, this.Level.Value, this.IsExpanded.Value);
99100 }
100101 }
101102
102103 public bool IsDroppableTarget(DnDSourceFileInfo draggedFileList)
103104 {
104- FileSystemTargetFolder targetFolder = new(this.ParentVm.TreeID, this.AbsolutePath);
105+ FileSystemTargetFolder targetFolder = new(
106+ this.ParentVm.TreeID, this.ParentVm.TargetPath, this.RelativePath.Value);
105107
106108 FileSystemSourceFiles sourceFiles = draggedFileList.SourceFilesList
107109 .Where(list => list.TreeID == this.ParentVm.TreeID).FirstOrDefault();
@@ -131,7 +133,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
131133 {
132134 if (target != null)
133135 {
134- logger.Trace("FolderTreeNodeViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.Path);
136+ logger.Trace("FolderTreeNodeViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.AbsolutePath);
135137 }
136138 }
137139
@@ -158,7 +160,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Child
158160 {
159161 if (target != null)
160162 {
161- logger.Trace("FolderTreeNodeViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.Path);
163+ logger.Trace("FolderTreeNodeViewModel: TargetTree {0}, TargetPath {1}", target.TreeID, target.AbsolutePath);
162164 }
163165 }
164166
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/DroppableTargetHelper.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/DroppableTargetHelper.cs
@@ -16,8 +16,8 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel
1616 public static bool IsDroppableTarget(
1717 FileSystemTargetFolder targetFolder, FileSystemSourceFiles sourceFiles)
1818 {
19- string targetFolderFullPath = targetFolder.Path;
20- string sourceFolderFullPath = sourceFiles.Path;
19+ string targetFolderFullPath = targetFolder.AbsolutePath;
20+ string sourceFolderFullPath = sourceFiles.AbsolutePath;
2121
2222 //logger.Trace("CheckFileListDragOver: target {0}, source {1}", targetFolderFullPath, sourceFolderFullPath);
2323
@@ -30,7 +30,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel
3030 {
3131 string sourceFullPath = PathHelper.CreateCanonicalPath(sourceFolderFullPath, name);
3232
33- if (PathHelper.IsSameOrChild(sourceFullPath, targetFolder.Path))
33+ if (PathHelper.IsSameOrChild(sourceFullPath, targetFolder.AbsolutePath))
3434 {
3535 return false;
3636 }
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Dto/DnDSourceFileInfo.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/Dto/DnDSourceFileInfo.cs
@@ -16,7 +16,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel.Dto
1616 {
1717 foreach (FileSystemSourceFiles sourceFiles in SourceFilesList)
1818 {
19- logger.Trace("DnDSourceFileInfo: SourceTree {0}, SourcePath {1}", sourceFiles.TreeID, sourceFiles.Path);
19+ logger.Trace("DnDSourceFileInfo: SourceTree {0}, SourcePath {1}", sourceFiles.TreeID, sourceFiles.AbsolutePath);
2020
2121 foreach (string name in sourceFiles.Names)
2222 {
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/FileListViewModel.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/FileListViewModel.cs
@@ -1,4 +1,5 @@
1-using FolderCategorizer2.Adaptor.Boundary.Controller;
1+using CleanAuLait.Core.IO;
2+using FolderCategorizer2.Adaptor.Boundary.Controller;
23 using FolderCategorizer2.Adaptor.Boundary.ViewModel;
34 using FolderCategorizer2.Adaptor.Boundary.ViewModel.Child;
45 using FolderCategorizer2.Adaptor.Gateway.ViewModel.Dto;
@@ -6,12 +7,14 @@ using FolderCategorizer2.Adaptor.Translator;
67 using FolderCategorizer2.Domain.Model.Entity;
78 using FolderCategorizer2.Domain.Service.Dto;
89 using FolderCategorizer2.UseCase.FileSystemOperation.Request;
10+using FolderCategorizer2.UseCase.FolderTreeOperation.Request;
911 using GongSolutions.Wpf.DragDrop;
1012 using NLog;
1113 using ObservableCollections;
1214 using Prism.Navigation;
1315 using Reactive.Bindings;
1416 using Reactive.Bindings.Extensions;
17+using System;
1518 using System.Collections.Generic;
1619 using System.ComponentModel;
1720 using System.Linq;
@@ -102,8 +105,8 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel
102105
103106 public IList<FileSystemSourceFiles> CreateSelectedSourceFilesList()
104107 {
105- IDictionary<(string id, string path), IList<string>> map =
106- new Dictionary<(string, string), IList<string>>();
108+ IDictionary<(string id, string targetPath, string relativePath), IList<string>> map =
109+ new Dictionary<(string, string, string), IList<string>>();
107110
108111 foreach (var vmRow in this.internalRows.Where(x => x.IsSelected.Value))
109112 {
@@ -111,7 +114,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel
111114
112115 foreach (var key in vmRow.Source.Sources
113116 .Select(s => s.Parent).Where(p => p != null)
114- .Select(s => (s.TreeID, s.TargetPath)))
117+ .Select(s => (s.TreeID, s.TargetPath, s.RelativePath)))
115118 {
116119 if (!map.TryGetValue(key, out var names))
117120 {
@@ -127,7 +130,7 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel
127130
128131 foreach (var key in map.Keys.OrderBy(k => k))
129132 {
130- sourceFilesList.Add(new FileSystemSourceFiles(key.id, key.path, map[key]));
133+ sourceFilesList.Add(new FileSystemSourceFiles(key.id, key.targetPath, key.relativePath, map[key]));
131134 }
132135
133136 return sourceFilesList;
--- a/FolderCategorizer2.03Adaptor/Gateway/ViewModel/TreeNavigationViewModel.cs
+++ b/FolderCategorizer2.03Adaptor/Gateway/ViewModel/TreeNavigationViewModel.cs
@@ -345,19 +345,12 @@ namespace FolderCategorizer2.Adaptor.Gateway.ViewModel
345345 {
346346 string tabId = this.SelectedTabId.Value;
347347
348- string fullPath1 = !string.IsNullOrEmpty(this.TargetPath1.Value)
349- ? PathHelper.CreateCanonicalPath(this.TargetPath1.Value, relativePath)
350- : string.Empty;
351- string fullPath2 = !string.IsNullOrEmpty(this.TargetPath2.Value)
352- ? PathHelper.CreateCanonicalPath(this.TargetPath2.Value, relativePath)
353- : string.Empty;
354-
355348 ReplaceFileListRequest req = new(
356349 tabId,
357- new (string treeId, string targetPath)[]
350+ new (string treeId, string targetPath, string relativePath)[]
358351 {
359- (TranslateTreeId(REGION_NAME_TREE_VIEW_PANE0, tabId), fullPath1),
360- (TranslateTreeId(REGION_NAME_TREE_VIEW_PANE1, tabId), fullPath2),
352+ (TranslateTreeId(REGION_NAME_TREE_VIEW_PANE0, tabId), this.TargetPath1.Value, relativePath),
353+ (TranslateTreeId(REGION_NAME_TREE_VIEW_PANE1, tabId), this.TargetPath2.Value, relativePath),
361354 }
362355 );
363356