ファイル整理用ツールのWinFormサンプル実装
Revisão | d19c9a5c86ce0f1b3c3485a0be892a9b46bba277 (tree) |
---|---|
Hora | 2018-12-27 11:47:31 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
リファクタ- 抽象クラスにAbstract接頭辞を付与
@@ -1643,14 +1643,14 @@ namespace FolderCategorizer.Presentation.View | ||
1643 | 1643 | ABORTED = 2, |
1644 | 1644 | } |
1645 | 1645 | |
1646 | - public FileSystemOperationRequest Request { get; private set; } | |
1646 | + public AbstractFileSystemOperationRequest Request { get; private set; } | |
1647 | 1647 | |
1648 | 1648 | public ResultType Result { get; set; } |
1649 | 1649 | = ResultType.SUCCESS; |
1650 | 1650 | |
1651 | 1651 | public string Message { get; set; } = string.Empty; |
1652 | 1652 | |
1653 | - public FileSystemOperationResult(FileSystemOperationRequest request) | |
1653 | + public FileSystemOperationResult(AbstractFileSystemOperationRequest request) | |
1654 | 1654 | { |
1655 | 1655 | Request = request; |
1656 | 1656 | } |
@@ -1706,12 +1706,12 @@ namespace FolderCategorizer.Presentation.View | ||
1706 | 1706 | public List<string> TargetPathsForMsg1 { get; private set; } = new List<string>(); |
1707 | 1707 | public List<string> TargetPathsForMsg2 { get; private set; } = new List<string>(); |
1708 | 1708 | |
1709 | - public FileSystemCreateNewTargetListOperationResult(FileSystemOperationRequest request) : base(request) | |
1709 | + public FileSystemCreateNewTargetListOperationResult(AbstractFileSystemOperationRequest request) : base(request) | |
1710 | 1710 | { |
1711 | 1711 | } |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - public abstract class FileSystemOperationRequest | |
1714 | + public abstract class AbstractFileSystemOperationRequest | |
1715 | 1715 | { |
1716 | 1716 | public MainForm Form { get; private set; } |
1717 | 1717 | public FileSystemOperationUIInfo UIInfo { get; private set; } |
@@ -1720,7 +1720,7 @@ namespace FolderCategorizer.Presentation.View | ||
1720 | 1720 | |
1721 | 1721 | public FileSystemOperationResult Result { get; set; } |
1722 | 1722 | |
1723 | - public FileSystemOperationRequest(MainForm form, FileSystemOperationUIInfo uiInfo) | |
1723 | + public AbstractFileSystemOperationRequest(MainForm form, FileSystemOperationUIInfo uiInfo) | |
1724 | 1724 | { |
1725 | 1725 | Form = form; |
1726 | 1726 | UIInfo = uiInfo; |
@@ -1755,7 +1755,7 @@ namespace FolderCategorizer.Presentation.View | ||
1755 | 1755 | } |
1756 | 1756 | } |
1757 | 1757 | |
1758 | - public abstract class FileSystemTargetOperationRequest : FileSystemOperationRequest | |
1758 | + public abstract class AbstractFileSystemTargetOperationRequest : AbstractFileSystemOperationRequest | |
1759 | 1759 | { |
1760 | 1760 | public string TargetTopPath1 { get; private set; } |
1761 | 1761 |
@@ -1763,7 +1763,7 @@ namespace FolderCategorizer.Presentation.View | ||
1763 | 1763 | |
1764 | 1764 | public string RefreshPath { get; private set; } |
1765 | 1765 | |
1766 | - public FileSystemTargetOperationRequest( | |
1766 | + public AbstractFileSystemTargetOperationRequest( | |
1767 | 1767 | MainForm form, FileSystemOperationUIInfo uiInfo, string targetTopPath1, string targetTopPath2, string refreshPath) |
1768 | 1768 | : base(form, uiInfo) |
1769 | 1769 | { |
@@ -1783,7 +1783,7 @@ namespace FolderCategorizer.Presentation.View | ||
1783 | 1783 | } |
1784 | 1784 | } |
1785 | 1785 | |
1786 | - public abstract class FileSystemSrcDstOperationRequest : FileSystemOperationRequest | |
1786 | + public abstract class AbstractFileSystemSrcDstOperationRequest : AbstractFileSystemOperationRequest | |
1787 | 1787 | { |
1788 | 1788 | public string DstFullPath1 { get; private set; } |
1789 | 1789 |
@@ -1797,7 +1797,7 @@ namespace FolderCategorizer.Presentation.View | ||
1797 | 1797 | |
1798 | 1798 | public string SrcRefreshPath { get; private set; } |
1799 | 1799 | |
1800 | - public FileSystemSrcDstOperationRequest( | |
1800 | + public AbstractFileSystemSrcDstOperationRequest( | |
1801 | 1801 | MainForm form, FileSystemOperationUIInfo uiInfo, |
1802 | 1802 | string dstFullPath1, string dstFullPath2, string srcTopPath1, string srcTopPath2, |
1803 | 1803 | string dstRefreshPath, string srcRefreshPath) |
@@ -1826,11 +1826,11 @@ namespace FolderCategorizer.Presentation.View | ||
1826 | 1826 | } |
1827 | 1827 | } |
1828 | 1828 | |
1829 | - public abstract class FileSystemSingleTargetOperationRequest : FileSystemTargetOperationRequest | |
1829 | + public abstract class AbstractFileSystemSingleTargetOperationRequest : AbstractFileSystemTargetOperationRequest | |
1830 | 1830 | { |
1831 | 1831 | public FileListEntry TargetEntry { get; private set; } |
1832 | 1832 | |
1833 | - public FileSystemSingleTargetOperationRequest( | |
1833 | + public AbstractFileSystemSingleTargetOperationRequest( | |
1834 | 1834 | MainForm form, FileSystemOperationUIInfo uiInfo, |
1835 | 1835 | string targetTopPath1, string targetTopPath2, FileListEntry targetEntry, string refreshPath) |
1836 | 1836 | : base(form, uiInfo, targetTopPath1, targetTopPath2, refreshPath) |
@@ -1839,11 +1839,11 @@ namespace FolderCategorizer.Presentation.View | ||
1839 | 1839 | } |
1840 | 1840 | } |
1841 | 1841 | |
1842 | - public abstract class FileSystemMultiTargetOperationRequest : FileSystemTargetOperationRequest | |
1842 | + public abstract class AbstractFileSystemMultiTargetOperationRequest : AbstractFileSystemTargetOperationRequest | |
1843 | 1843 | { |
1844 | 1844 | public List<FileListEntry> TargetEntries { get; private set; } |
1845 | 1845 | |
1846 | - public FileSystemMultiTargetOperationRequest( | |
1846 | + public AbstractFileSystemMultiTargetOperationRequest( | |
1847 | 1847 | MainForm form, FileSystemOperationUIInfo uiInfo, |
1848 | 1848 | string targetTopPath1, string targetTopPath2, List<FileListEntry> targetEntries, string refreshPath) |
1849 | 1849 | : base(form, uiInfo, targetTopPath1, targetTopPath2, refreshPath) |
@@ -1852,11 +1852,11 @@ namespace FolderCategorizer.Presentation.View | ||
1852 | 1852 | } |
1853 | 1853 | } |
1854 | 1854 | |
1855 | - public abstract class FileSystemMultiSrcDstOperationRequest : FileSystemSrcDstOperationRequest | |
1855 | + public abstract class AbstractFileSystemMultiSrcDstOperationRequest : AbstractFileSystemSrcDstOperationRequest | |
1856 | 1856 | { |
1857 | 1857 | public List<FileListEntry> SrcEntries { get; private set; } |
1858 | 1858 | |
1859 | - public FileSystemMultiSrcDstOperationRequest( | |
1859 | + public AbstractFileSystemMultiSrcDstOperationRequest( | |
1860 | 1860 | MainForm form, FileSystemOperationUIInfo uiInfo, |
1861 | 1861 | string dstFullPath1, string dstFullPath2, string srcTopPath1, string srcTopPath2, List<FileListEntry> srcEntries, |
1862 | 1862 | string dstRefreshPath, string srcRefreshPath) |
@@ -1866,7 +1866,7 @@ namespace FolderCategorizer.Presentation.View | ||
1866 | 1866 | } |
1867 | 1867 | } |
1868 | 1868 | |
1869 | - public class FileSystemDeleteOperationRequest : FileSystemMultiTargetOperationRequest | |
1869 | + public class FileSystemDeleteOperationRequest : AbstractFileSystemMultiTargetOperationRequest | |
1870 | 1870 | { |
1871 | 1871 | private const string OPERATION = "削除"; |
1872 | 1872 |
@@ -1878,7 +1878,7 @@ namespace FolderCategorizer.Presentation.View | ||
1878 | 1878 | } |
1879 | 1879 | } |
1880 | 1880 | |
1881 | - public class FileSystemRenameOperationRequest : FileSystemSingleTargetOperationRequest | |
1881 | + public class FileSystemRenameOperationRequest : AbstractFileSystemSingleTargetOperationRequest | |
1882 | 1882 | { |
1883 | 1883 | private const string TARGET_SUB_TYPE = "名"; |
1884 | 1884 | private const string OPERATION = "変更"; |
@@ -1895,13 +1895,13 @@ namespace FolderCategorizer.Presentation.View | ||
1895 | 1895 | } |
1896 | 1896 | } |
1897 | 1897 | |
1898 | - public abstract class FileSystemOverwriteTimeOperationRequest : FileSystemMultiTargetOperationRequest | |
1898 | + public abstract class AbstractFileSystemOverwriteTimeOperationRequest : AbstractFileSystemMultiTargetOperationRequest | |
1899 | 1899 | { |
1900 | 1900 | protected const string OPERATION = "削除"; |
1901 | 1901 | |
1902 | 1902 | public FileSystemOperationType OpType { get; set; } |
1903 | 1903 | |
1904 | - public FileSystemOverwriteTimeOperationRequest( | |
1904 | + public AbstractFileSystemOverwriteTimeOperationRequest( | |
1905 | 1905 | MainForm form, FileSystemOperationUIInfo uiInfo, |
1906 | 1906 | string targetTopPath1, string targetTopPath2, List<FileListEntry> targetEntries, |
1907 | 1907 | FileSystemOperationType opType, string refreshPath) |
@@ -1911,7 +1911,7 @@ namespace FolderCategorizer.Presentation.View | ||
1911 | 1911 | } |
1912 | 1912 | } |
1913 | 1913 | |
1914 | - public class FileSystemOverwriteCreationTimeOperationRequest : FileSystemOverwriteTimeOperationRequest | |
1914 | + public class FileSystemOverwriteCreationTimeOperationRequest : AbstractFileSystemOverwriteTimeOperationRequest | |
1915 | 1915 | { |
1916 | 1916 | private const string SUB_TYPE_NAME = "作成日時"; |
1917 | 1917 |
@@ -1925,7 +1925,7 @@ namespace FolderCategorizer.Presentation.View | ||
1925 | 1925 | } |
1926 | 1926 | } |
1927 | 1927 | |
1928 | - public class FileSystemOverwriteLastWriteTimeOperationRequest : FileSystemOverwriteTimeOperationRequest | |
1928 | + public class FileSystemOverwriteLastWriteTimeOperationRequest : AbstractFileSystemOverwriteTimeOperationRequest | |
1929 | 1929 | { |
1930 | 1930 | private const string SUB_TYPE_NAME = "更新日時"; |
1931 | 1931 |
@@ -1939,7 +1939,7 @@ namespace FolderCategorizer.Presentation.View | ||
1939 | 1939 | } |
1940 | 1940 | } |
1941 | 1941 | |
1942 | - public class FileSystemExchangeCreationAndLastWriteTimeOperationRequest : FileSystemMultiTargetOperationRequest | |
1942 | + public class FileSystemExchangeCreationAndLastWriteTimeOperationRequest : AbstractFileSystemMultiTargetOperationRequest | |
1943 | 1943 | { |
1944 | 1944 | private const string SUB_TYPE_NAME = "作成/更新日時"; |
1945 | 1945 | private const string OPERATION = "交換"; |
@@ -1956,7 +1956,7 @@ namespace FolderCategorizer.Presentation.View | ||
1956 | 1956 | } |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - public class FileSystemAutoFixFolderTimeOperationRequest : FileSystemMultiTargetOperationRequest | |
1959 | + public class FileSystemAutoFixFolderTimeOperationRequest : AbstractFileSystemMultiTargetOperationRequest | |
1960 | 1960 | { |
1961 | 1961 | private const string SUB_TYPE_NAME = "作成/更新日時"; |
1962 | 1962 | private const string OPERATION = "自動修正"; |
@@ -1973,7 +1973,7 @@ namespace FolderCategorizer.Presentation.View | ||
1973 | 1973 | } |
1974 | 1974 | } |
1975 | 1975 | |
1976 | - public class FileSystemCreateNewFolderOperationRequest : FileSystemSingleTargetOperationRequest | |
1976 | + public class FileSystemCreateNewFolderOperationRequest : AbstractFileSystemSingleTargetOperationRequest | |
1977 | 1977 | { |
1978 | 1978 | private const string TARGET_TYPE = "フォルダ"; |
1979 | 1979 | private const string OPERATION = "作成"; |
@@ -1995,13 +1995,13 @@ namespace FolderCategorizer.Presentation.View | ||
1995 | 1995 | } |
1996 | 1996 | } |
1997 | 1997 | |
1998 | - public abstract class FileSystemMoveOrCopyOperationRequest : FileSystemMultiSrcDstOperationRequest | |
1998 | + public abstract class AbstractFileSystemMoveOrCopyOperationRequest : AbstractFileSystemMultiSrcDstOperationRequest | |
1999 | 1999 | { |
2000 | 2000 | public FileListEntry NewFolderEntry { get; set; } |
2001 | 2001 | |
2002 | 2002 | public FileSystemOperationType OpType { get; set; } |
2003 | 2003 | |
2004 | - public FileSystemMoveOrCopyOperationRequest( | |
2004 | + public AbstractFileSystemMoveOrCopyOperationRequest( | |
2005 | 2005 | MainForm form, FileSystemOperationUIInfo uiInfo, |
2006 | 2006 | string dstFullPath1, string dstFullPath2, string srcTopPath1, string srcTopPath2, |
2007 | 2007 | List<FileListEntry> srcEntries, FileListEntry newFolderEntry, FileSystemOperationType opType, |
@@ -2015,7 +2015,7 @@ namespace FolderCategorizer.Presentation.View | ||
2015 | 2015 | } |
2016 | 2016 | } |
2017 | 2017 | |
2018 | - public class FileSystemMoveOperationRequest : FileSystemMoveOrCopyOperationRequest | |
2018 | + public class FileSystemMoveOperationRequest : AbstractFileSystemMoveOrCopyOperationRequest | |
2019 | 2019 | { |
2020 | 2020 | private const string OPERATION = "移動"; |
2021 | 2021 |
@@ -2039,7 +2039,7 @@ namespace FolderCategorizer.Presentation.View | ||
2039 | 2039 | } |
2040 | 2040 | } |
2041 | 2041 | |
2042 | - public class FileSystemCopyOperationRequest : FileSystemMoveOrCopyOperationRequest | |
2042 | + public class FileSystemCopyOperationRequest : AbstractFileSystemMoveOrCopyOperationRequest | |
2043 | 2043 | { |
2044 | 2044 | private const string OPERATION = "コピー"; |
2045 | 2045 |
@@ -2063,7 +2063,7 @@ namespace FolderCategorizer.Presentation.View | ||
2063 | 2063 | } |
2064 | 2064 | } |
2065 | 2065 | |
2066 | - private FileSystemOperationResult DoFileSystemOperation(FileSystemOperationRequest req) | |
2066 | + private FileSystemOperationResult DoFileSystemOperation(AbstractFileSystemOperationRequest req) | |
2067 | 2067 | { |
2068 | 2068 | FileSystemOperationResult res = req.Handle(); |
2069 | 2069 |
@@ -2147,7 +2147,7 @@ namespace FolderCategorizer.Presentation.View | ||
2147 | 2147 | return req.Result; |
2148 | 2148 | } |
2149 | 2149 | |
2150 | - private static FileSystemOperationResult MoveOrCopySelectedFiles(FileSystemMoveOrCopyOperationRequest req) | |
2150 | + private static FileSystemOperationResult MoveOrCopySelectedFiles(AbstractFileSystemMoveOrCopyOperationRequest req) | |
2151 | 2151 | { |
2152 | 2152 | string dstPath1 = req.DstFullPath1; |
2153 | 2153 | string dstPath2 = req.DstFullPath2; |
@@ -2316,7 +2316,7 @@ namespace FolderCategorizer.Presentation.View | ||
2316 | 2316 | return req.Result; |
2317 | 2317 | } |
2318 | 2318 | |
2319 | - private static FileSystemOperationResult OverwriteTimeSelectedFiles(FileSystemOverwriteTimeOperationRequest req) | |
2319 | + private static FileSystemOperationResult OverwriteTimeSelectedFiles(AbstractFileSystemOverwriteTimeOperationRequest req) | |
2320 | 2320 | { |
2321 | 2321 | List<string> targetPaths = new List<string>(); |
2322 | 2322 | List<string> targetPathsForMsg1 = new List<string>(); |
@@ -2652,7 +2652,7 @@ namespace FolderCategorizer.Presentation.View | ||
2652 | 2652 | return FileSystemRawOperationResult.SUCCESS; |
2653 | 2653 | } |
2654 | 2654 | |
2655 | - private static FileSystemRawOperationResult OverwriteTimeFile(string path, FileSystemOverwriteTimeOperationRequest req) | |
2655 | + private static FileSystemRawOperationResult OverwriteTimeFile(string path, AbstractFileSystemOverwriteTimeOperationRequest req) | |
2656 | 2656 | { |
2657 | 2657 | Retry: |
2658 | 2658 | try |
@@ -3130,7 +3130,7 @@ namespace FolderCategorizer.Presentation.View | ||
3130 | 3130 | |
3131 | 3131 | private static bool CreateModifyMultiTargetFileList( |
3132 | 3132 | List<string> outTargetPaths, List<string> outTargetPathsForMsg1, List<string> outTargetPathsForMsg2, |
3133 | - FileSystemMultiTargetOperationRequest req) | |
3133 | + AbstractFileSystemMultiTargetOperationRequest req) | |
3134 | 3134 | { |
3135 | 3135 | return CreateModifyMultiTargetFileList( |
3136 | 3136 | outTargetPaths, outTargetPaths, outTargetPathsForMsg1, outTargetPathsForMsg2, |
@@ -3141,7 +3141,7 @@ namespace FolderCategorizer.Presentation.View | ||
3141 | 3141 | private static bool CreateModifyMultiTargetFileList( |
3142 | 3142 | List<string> outTargetPaths1, List<string> outTargetPaths2, |
3143 | 3143 | List<string> outTargetPathsForMsg1, List<string> outTargetPathsForMsg2, |
3144 | - FileSystemMultiSrcDstOperationRequest req) | |
3144 | + AbstractFileSystemMultiSrcDstOperationRequest req) | |
3145 | 3145 | { |
3146 | 3146 | return CreateModifyMultiTargetFileList( |
3147 | 3147 | outTargetPaths1, outTargetPaths2, outTargetPathsForMsg1, outTargetPathsForMsg2, |
@@ -3191,7 +3191,7 @@ namespace FolderCategorizer.Presentation.View | ||
3191 | 3191 | private static CreateExistsSingleTargetResult CreateExistsSingleTargetFileList( |
3192 | 3192 | List<string> outTargetPaths1, List<string> outTargetPaths2, |
3193 | 3193 | List<string> outTargetPathsForMsg1, List<string> outTargetPathsForMsg2, |
3194 | - FileSystemSingleTargetOperationRequest req, bool ignoreAllNotFoundErrorTarget2 = false) | |
3194 | + AbstractFileSystemSingleTargetOperationRequest req, bool ignoreAllNotFoundErrorTarget2 = false) | |
3195 | 3195 | { |
3196 | 3196 | return CreateExistsSingleTargetFileList( |
3197 | 3197 | outTargetPaths1, outTargetPaths2, outTargetPathsForMsg1, outTargetPathsForMsg2, |
@@ -3363,7 +3363,7 @@ namespace FolderCategorizer.Presentation.View | ||
3363 | 3363 | |
3364 | 3364 | private static bool CreateNewTargetFileList(List<string> outTargetPaths1, List<string> outTargetPaths2, |
3365 | 3365 | List<string> outTargetPathsForMsg1, List<string> outTargetPathsForMsg2, |
3366 | - FileSystemSingleTargetOperationRequest req) | |
3366 | + AbstractFileSystemSingleTargetOperationRequest req) | |
3367 | 3367 | { |
3368 | 3368 | if (!string.IsNullOrEmpty(req.TargetTopPath1)) |
3369 | 3369 | { |