コード例 #1
0
ファイル: Form1.cs プロジェクト: landv/AllPrivateProject
        private void btnSpFunFindNotInTargetPathFileByFileName_Click(object sender, EventArgs e)
        {
            try
            {
                UIInProcess(true);

                FileSporadicFunction sporadicFunction = new FileSporadicFunction(txtConsole);
                sporadicFunction.SetFileSelectParm(this.GetFormFileSelParm());

                string fileNames = sporadicFunction.Execute_FindNotInTargetPathFileByFileName();

                if (fileNames.Length > 0)
                {
                    using (formTextMessage frmMessage = new formTextMessage("找到的文件列表", fileNames, true))
                    {
                        frmMessage.ShowDialog(this);
                    }
                }
                else
                {
                    CommFunction.WriteMessage("没有找到此类文件。");
                }

                UIInProcess(false);
            }
            catch (Exception ex)
            {
                CommFunction.WriteMessage(ex.Message);
            }
            finally
            {
                UIInProcess(false);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: chanfengsr/AllPrivateProject
 private void btnChgNmEditChangeList_Click(object sender, EventArgs e)
 {
     using (formTextMessage frmMessage = new formTextMessage("编辑文件更名列表", _fileChangeNameChangeList)) {
         if (frmMessage.ShowDialog(this) == DialogResult.OK)
             _fileChangeNameChangeList = frmMessage.FormMessage;
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: landv/AllPrivateProject
        private void btnChgNmViewChgFileNameList_Click(object sender, EventArgs e)
        {
            try
            {
                UIInProcess(true);
                FileBatchChangeName fileBatchChangeName = ConstructFileBatchChangeName();
                List <string>       targetNameList      = fileBatchChangeName.GetTargetNameList();
                UIInProcess(false);

                if (targetNameList.Count > 0)
                {
                    string nameAll = targetNameList.Aggregate("", (current, name) => current + name + Environment.NewLine).TrimEnd(Environment.NewLine.ToCharArray());

                    using (formTextMessage frmMessage = new formTextMessage("更名列表预览", nameAll, true))
                    {
                        frmMessage.ShowDialog(this);
                    }
                }
            }
            catch (Exception ex)
            {
                CommFunction.WriteMessage(ex.Message);
            }
            finally
            {
                UIInProcess(false);
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: landv/AllPrivateProject
        private void btnViewFileNameList_Click(object sender, EventArgs e)
        {
            try
            {
                UIInProcess(true);

                FileProcessBaseClass fileProcBase = new FileProcessBaseClass();
                fileProcBase.SetFileSelectParm(this.GetFormFileSelParm());
                string fileList = fileProcBase.LoadFileList();

                UIInProcess(false);

                if (fileList.Length > 0)
                {
                    using (formTextMessage frmMessage = new formTextMessage("文件列表预览", fileList, true))
                    {
                        frmMessage.ShowDialog(this);
                    }
                }
            }
            catch (Exception ex)
            {
                CommFunction.WriteMessage(ex.Message);
            }
            finally
            {
                UIInProcess(false);
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: landv/AllPrivateProject
 private void btnChgNmEditChangeList_Click(object sender, EventArgs e)
 {
     using (formTextMessage frmMessage = new formTextMessage("编辑文件更名列表", _fileChangeNameChangeList))
     {
         if (frmMessage.ShowDialog(this) == DialogResult.OK)
         {
             _fileChangeNameChangeList = frmMessage.FormMessage;
         }
     }
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: landv/AllPrivateProject
        private void btnSpFunDeleteEmptyFolder_Click(object sender, EventArgs e)
        {
            try
            {
                UIInProcess(true);

                FileSporadicFunction sporadicFunction = new FileSporadicFunction();
                FileSelectParm       fileSelParm      = this.GetFormFileSelParm();
                if (fileSelParm.FileFilter == "*")
                {
                    MessageBox.Show("删除空文件夹时不能忽略所有文件。", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    sporadicFunction.SetFileSelectParm(fileSelParm);
                    List <string> emptyFolderList = sporadicFunction.GetEmptyFolderList(fileSelParm.SourceFileFolder, fileSelParm.FileFilter);
                    emptyFolderList.Reverse();
                    StringBuilder sbMsg = new StringBuilder();
                    foreach (string empFolder in emptyFolderList)
                    {
                        sbMsg.AppendLine(empFolder);
                    }

                    if (emptyFolderList.Count > 0)
                    {
                        using (formTextMessage frmMessage = new formTextMessage("是否删除以下空文件夹?", sbMsg.ToString().Trim().TrimEnd(Environment.NewLine.ToArray()), true))
                        {
                            if (frmMessage.ShowDialog(this) == DialogResult.OK)
                            {
                                emptyFolderList.Reverse(); //重新倒置,使从子目录开始删
                                sporadicFunction.Execute_DeleteEmptyFolder(emptyFolderList);
                            }
                        }
                    }
                    else
                    {
                        CommFunction.WriteMessage("没有找到空文件夹。");
                    }
                }

                UIInProcess(false);
            }
            catch (Exception ex)
            {
                CommFunction.WriteMessage(ex.Message);
            }
            finally
            {
                UIInProcess(false);
            }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: landv/AllPrivateProject
        private void btnSpFunFindMisplacedPhoto_Click(object sender, EventArgs e)
        {
            try
            {
                UIInProcess(true);

                FileSporadicFunction sporadicFunction = new FileSporadicFunction();
                FileSelectParm       fileSelParm      = this.GetFormFileSelParm();
                if (fileSelParm.FileFilter == string.Empty)
                {
                    fileSelParm.FileFilter = CommDefinition.ExtensionPicFile;
                }
                sporadicFunction.SetFileSelectParm(fileSelParm);

                StringBuilder sbMsg             = new StringBuilder();
                List <string> fileInWrongFolder = sporadicFunction.Execute_GetFileInWrongFolder();
                foreach (string fName in fileInWrongFolder)
                {
                    sbMsg.AppendLine(fName);
                }

                if (fileInWrongFolder.Count > 0)
                {
                    using (formTextMessage frmMessage = new formTextMessage("找到的文件列表", sbMsg.ToString().Trim().TrimEnd(Environment.NewLine.ToArray()), true))
                    {
                        frmMessage.ShowDialog(this);
                    }
                }
                else
                {
                    CommFunction.WriteMessage("没有找到此类文件。");
                }

                UIInProcess(false);
            }
            catch (Exception ex)
            {
                CommFunction.WriteMessage(ex.Message);
            }
            finally
            {
                UIInProcess(false);
            }
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: chanfengsr/AllPrivateProject
        private void btnChgNmViewChgFileNameList_Click(object sender, EventArgs e)
        {
            try {
                UIInProcess(true);
                FileBatchChangeName fileBatchChangeName = ConstructFileBatchChangeName();
                List<string> targetNameList = fileBatchChangeName.GetTargetNameList();
                UIInProcess(false);

                if (targetNameList.Count > 0) {
                    string nameAll = targetNameList.Aggregate("", (current, name) => current + name + Environment.NewLine).TrimEnd(Environment.NewLine.ToCharArray());

                    using (formTextMessage frmMessage = new formTextMessage("更名列表预览", nameAll, true)) {
                        frmMessage.ShowDialog(this);
                    }
                }
            }
            catch (Exception ex) {
                CommFunction.WriteMessage(ex.Message);
            }
            finally {
                UIInProcess(false);
            }
        }
コード例 #9
0
ファイル: Form1.cs プロジェクト: chanfengsr/AllPrivateProject
        private void btnViewFileNameList_Click(object sender, EventArgs e)
        {
            try {
                UIInProcess(true);

                FileProcessBaseClass fileProcBase = new FileProcessBaseClass();
                fileProcBase.SetFileSelectParm(this.GetFormFileSelParm());
                string fileList = fileProcBase.LoadFileList();

                UIInProcess(false);

                if (fileList.Length > 0) {
                    using (formTextMessage frmMessage = new formTextMessage("文件列表预览", fileList, true)) {
                        frmMessage.ShowDialog(this);
                    }
                }
            }
            catch (Exception ex) {
                CommFunction.WriteMessage(ex.Message);
            }
            finally {
                UIInProcess(false);
            }
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: chanfengsr/AllPrivateProject
        private void btnSpFunFindMisplacedPhoto_Click(object sender, EventArgs e)
        {
            try {
                UIInProcess(true);

                FileSporadicFunction sporadicFunction = new FileSporadicFunction();
                FileSelectParm fileSelParm = this.GetFormFileSelParm();
                if (fileSelParm.FileFilter == string.Empty)
                    fileSelParm.FileFilter = CommDefinition.ExtensionPicFile;
                sporadicFunction.SetFileSelectParm(fileSelParm);

                StringBuilder sbMsg = new StringBuilder();
                List<string> fileInWrongFolder = sporadicFunction.Execute_GetFileInWrongFolder();
                foreach (string fName in fileInWrongFolder)
                    sbMsg.AppendLine(fName);

                if (fileInWrongFolder.Count > 0) {
                    using (formTextMessage frmMessage = new formTextMessage("找到的文件列表", sbMsg.ToString().Trim().TrimEnd(Environment.NewLine.ToArray()), true)) {
                        frmMessage.ShowDialog(this);
                    }
                }
                else {
                    CommFunction.WriteMessage("没有找到此类文件。");
                }

                UIInProcess(false);
            }
            catch (Exception ex) {
                CommFunction.WriteMessage(ex.Message);
            }
            finally {
                UIInProcess(false);
            }
        }
コード例 #11
0
ファイル: Form1.cs プロジェクト: chanfengsr/AllPrivateProject
        private void btnSpFunFindDuplicateFilesByContent_Click(object sender, EventArgs e)
        {
            try {
                UIInProcess(true);

                FileSporadicFunction sporadicFunction = new FileSporadicFunction(txtConsole);
                sporadicFunction.SetFileSelectParm(this.GetFormFileSelParm());

                string fileNames = sporadicFunction.Execute_FindDuplicateFilesByContent();

                if (fileNames.Length > 0) {
                    using (formTextMessage frmMessage = new formTextMessage("找到的文件列表", fileNames, true)) {
                        frmMessage.ShowDialog(this);
                    }
                }
                else {
                    CommFunction.WriteMessage("没有找到此类文件。");
                }

                UIInProcess(false);
            }
            catch (Exception ex) {
                CommFunction.WriteMessage(ex.Message);
            }
            finally {
                UIInProcess(false);
            }
        }
コード例 #12
0
ファイル: Form1.cs プロジェクト: chanfengsr/AllPrivateProject
        private void btnSpFunDeleteEmptyFolder_Click(object sender, EventArgs e)
        {
            try {
                UIInProcess(true);

                FileSporadicFunction sporadicFunction = new FileSporadicFunction();
                FileSelectParm fileSelParm = this.GetFormFileSelParm();
                if (fileSelParm.FileFilter == "*") {
                    MessageBox.Show("删除空文件夹时不能忽略所有文件。", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else {
                    sporadicFunction.SetFileSelectParm(fileSelParm);
                    List<string> emptyFolderList = sporadicFunction.GetEmptyFolderList(fileSelParm.SourceFileFolder, fileSelParm.FileFilter);
                    emptyFolderList.Reverse();
                    StringBuilder sbMsg = new StringBuilder();
                    foreach (string empFolder in emptyFolderList)
                        sbMsg.AppendLine(empFolder);

                    if (emptyFolderList.Count > 0) {
                        using (formTextMessage frmMessage = new formTextMessage("是否删除以下空文件夹?", sbMsg.ToString().Trim().TrimEnd(Environment.NewLine.ToArray()), true)) {
                            if (frmMessage.ShowDialog(this) == DialogResult.OK) {
                                emptyFolderList.Reverse(); //重新倒置,使从子目录开始删
                                sporadicFunction.Execute_DeleteEmptyFolder(emptyFolderList);
                            }
                        }
                    }
                    else {
                        CommFunction.WriteMessage("没有找到空文件夹。");
                    }
                }

                UIInProcess(false);
            }
            catch (Exception ex) {
                CommFunction.WriteMessage(ex.Message);
            }
            finally {
                UIInProcess(false);
            }
        }