// check duplication of files at folder public static List <DupFiles> CheckDup(DupRequestInfo dupRequestInfo) { string[] filesPatterns = MediaFileInfo.GetFilesPatterns(dupRequestInfo.MediaType); var sortFunc = MediaFileInfo.GetSortFunc(dupRequestInfo.MediaSortType); DupMap dupMap = BuildDupMap(dupRequestInfo.CheckedDir, filesPatterns, sortFunc); List <DupFiles> dupsFiles = BuildDupList(dupMap); return(dupsFiles); }
private void Button_checkDupFiles_Click(object sender, EventArgs e) { DupRequestInfo dri = new DupRequestInfo(); dri.CheckedDir = textBox_checkFolder.Text; dri.MediaType = GetSelectedMediaType(); dri.MediaSortType = GetSelectedMediaSortType(); OpenDupResultsForm(dri); }
public DupProgressForm(DupRequestInfo dupRequestInfo) { this.dupRequestInfo = dupRequestInfo; InitializeComponent(); linkLabel_checkedFolder.Text = dupRequestInfo.CheckedDir; backgroundWorker_buildResults.WorkerReportsProgress = true; backgroundWorker_buildResults.WorkerSupportsCancellation = true; // start build results backgroundWorker_buildResults.RunWorkerAsync(); }
// open duplications result form private void OpenDupResultsForm(DupRequestInfo dupRequestInfo) { DupProgressForm dupProgressForm = new DupProgressForm(dupRequestInfo); DialogResult dialogResult = dupProgressForm.ShowDialog(); if (dialogResult == DialogResult.OK) { // get result data List <DupFiles> dupsFiles = dupProgressForm.ResultDupFiles; // check if have duplications if (dupsFiles.Count > 0) { OpenDupResultsForm(dupsFiles); } else { string dialogTitle = "No duplications"; string dialogMessage = "Not found duplication files."; DialogResult result = MessageBox.Show(dialogMessage, dialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }