예제 #1
0
파일: Main.cs 프로젝트: bivy/bdub
        private void tsbDubFinder_Click(object sender, EventArgs e)
        {
            FileScanOptions scanOptionsDialog = new FileScanOptions();
            scanOptionsDialog.Mode = ScanOptionDialogModeEnum.FindDubs;
            IList<bSnapshot> snapshotList = new List<bSnapshot>();

            if (scanOptionsDialog.ShowDialog(this) == DialogResult.OK)
            {
                foreach (string folder in scanOptionsDialog.Folders)
                {
                    CreateSnapshotAction action = new CreateSnapshotAction();

                    action.Comment = scanOptionsDialog.Comment;
                    action.Folder = folder;
                    action.ScanSubfolders = scanOptionsDialog.ScanSubfolders;
                    action.FileMasks = scanOptionsDialog.FileMasks;

                    new ThinkingForm().ExecuteAction(this, action, action.Folder);
                }
                BuildUniqueFilesListAction uniqueFilesAction = new BuildUniqueFilesListAction();
                uniqueFilesAction.SnapshotList = snapshotList;
                new ThinkingForm().ExecuteAction(this, uniqueFilesAction, "Поиск совпадений файлов");

                DubsControlDialog dubsDialog = new DubsControlDialog();
                dubsDialog.FileDict = uniqueFilesAction.FileDict;
                dubsDialog.SnapshotsFiles = uniqueFilesAction.SnapshotsFiles;
                dubsDialog.FolderDict = uniqueFilesAction.FolderDict;
                dubsDialog.ShowDialog(this);
            }
        }
예제 #2
0
파일: Main.cs 프로젝트: bivy/bdub
        private void tsbCompare_Click(object sender, EventArgs e)
        {
            bDatabase database = (bDatabase)lvDatabases.SelectedItems[0].Tag;

            FileScanOptions optionsDialog = new FileScanOptions();
            optionsDialog.Mode = ScanOptionDialogModeEnum.CompareDatabase;

            IList<bSnapshot> snapshotList = new List<bSnapshot>();

            if (optionsDialog.ShowDialog(this) == DialogResult.OK)
            {
                foreach (string folder in optionsDialog.Folders)
                {
                    CreateSnapshotAction action = new CreateSnapshotAction();

                    action.Comment = optionsDialog.Comment;
                    action.Folder = folder;
                    action.ScanSubfolders = optionsDialog.ScanSubfolders;
                    action.FileMasks = optionsDialog.FileMasks;

                    new ThinkingForm().ExecuteAction(this, action, action.Folder);
                    snapshotList.Add(action.Snapshot);
                }

                BuildUniqueFilesListAction uniqueFilesAction = new BuildUniqueFilesListAction();
                uniqueFilesAction.Database = database;
                uniqueFilesAction.SnapshotList = snapshotList;
                new ThinkingForm().ExecuteAction(this, uniqueFilesAction, "Поиск совпадений файлов");

                DubsControlDialog dubsDialog = new DubsControlDialog();
                dubsDialog.FileDict = uniqueFilesAction.FileDict;
                dubsDialog.FolderDict = uniqueFilesAction.FolderDict;
                dubsDialog.SnapshotsFiles = uniqueFilesAction.SnapshotsFiles;
                dubsDialog.ShowDialog(this);
            }
        }