protected void InitRootWithDirDirFileWithDir() { InitRootWithDir(); var dirEntry2 = new DirEntry(true) { Path = @"Test2" }; var dirEntry3 = new DirEntry(true) { Path = @"Test3", Size = 12312, Modified = new DateTime(2009, 10, 03, 19, 17, 13, DateTimeKind.Unspecified), }; var dirEntry4 = new DirEntry { Path = @"Test4", Size = 32312, Modified = new DateTime(2008, 10, 04, 20, 18, 14, DateTimeKind.Unspecified), }; _dirEntry.Children.Add(dirEntry2); _rootEntry.Children.Add(dirEntry3); _rootEntry.Children.Add(dirEntry4); _rootEntry.SetInMemoryFields(); _pairDirEntry = new PairDirEntry(_rootEntry, _dirEntry); _rootList.Add(_rootEntry); }
protected void InitRootWithFile() { var nowUtc = new DateTime(2011, 12, 01, 17, 15, 13, DateTimeKind.Utc); _rootEntry = new RootEntry { Path = @"T:\", VolumeName = "TestVolume", DirEntryCount = 1, FileEntryCount = 0, DriveLetterHint = @"Z", AvailSpace = 754321, TotalSpace = 654321, ScanStartUTC = nowUtc, ScanEndUTC = nowUtc.AddMilliseconds(34), DefaultFileName = "TestRootEntry.cde", ActualFileName = @".\TestRootEntry.cde", Description = "Test Root Entry Description", }; _dirEntry = new DirEntry { Path = @"Test", Size = 531, Modified = new DateTime(2010, 11, 02, 18, 16, 12, DateTimeKind.Unspecified), }; _rootEntry.Children.Add(_dirEntry); _rootEntry.SetInMemoryFields(); _pairDirEntry = new PairDirEntry(_rootEntry, _dirEntry); _rootList.Add(_rootEntry); }
private void ViewFileInDirectoryTab(PairDirEntry pde) { var dirEntry = pde.ChildDE; SetDirectoryWithExpand(dirEntry); SelectFileInDirectoryTab(dirEntry); }
private void ViewFolderInDirectoryTab(PairDirEntry pde) { var dirEntry = pde.ChildDE; if (dirEntry.IsDirectory) { SetDirectoryWithExpand(dirEntry); } }
private void DirectoryGetContextMenuPairDirEntryThatExists(Action <PairDirEntry> gotContextAction) { _clientForm.DirectoryListViewHelper.ActionOnSelectedItem(d => { var pde = new PairDirEntry(_directoryListCommonEntry, d); if (pde.ExistsOnFileSystem()) { gotContextAction(pde); } }); }
public void DirectoryContextMenuCopyFullPathClick() { DirectoryGetContextMenuPairDirEntrys(enumerableDirEntry => { // we dont have parent dir entry here ... var s = new StringBuilder(); foreach (var dirEntry in enumerableDirEntry) { var pde = new PairDirEntry(_directoryListCommonEntry, dirEntry); s.Append(pde.FullPath + Environment.NewLine); } Clipboard.SetText(s.ToString()); }); }
protected void InitRootWithDir() { _rootEntry = new RootEntry { Path = @"T:\" }; _dirEntry = new DirEntry(true) { Path = @"Test1" }; _rootEntry.Children.Add(_dirEntry); _rootEntry.SetInMemoryFields(); _pairDirEntry = new PairDirEntry(_rootEntry, _dirEntry); _rootList.Add(_rootEntry); }
private bool FindMatchesOnFileSize2(CommonEntry ce, DirEntry de) { if (de.IsDirectory || de.Size == 0) // || dirEntry.Size < 4096) { return(true); } var flatDirEntry = new PairDirEntry(ce, de); if (_duplicateFileSize.ContainsKey(de.Size)) { _duplicateFileSize[de.Size].Add(flatDirEntry); } else { _duplicateFileSize[de.Size] = new List <PairDirEntry> { flatDirEntry }; } return(true); }
private int SearchResultCompare(PairDirEntry pde1, PairDirEntry pde2) { int compareResult; var de1 = pde1.ChildDE; var de2 = pde2.ChildDE; var searchResultHelper = _clientForm.SearchResultListViewHelper; var sortColumn = searchResultHelper.SortColumn; switch (sortColumn) { case 0: // SearchResult ListView Name column compareResult = de1.PathCompareWithDirTo(de2); break; case 1: // SearchResult ListView Size column compareResult = de1.SizeCompareWithDirTo(de2); break; case 2: // SearchResult ListView Modified column compareResult = de1.ModifiedCompareTo(de2); break; case 3: // SearchResult ListView Path column //var compareResult = _myCompareInfo.Compare(pde1.FullPath, pde2.FullPath, MyCompareOptions); compareResult = _config.MyCompareInfo.Compare(pde1.ParentDE.FullPath, pde2.ParentDE.FullPath, _config.MyCompareOptions); if (compareResult == 0) { compareResult = _config.MyCompareInfo.Compare(de1.Path, de2.Path, _config.MyCompareOptions); } break; default: throw new Exception($"Problem column {sortColumn} not handled for sort."); } if (searchResultHelper.ColumnSortOrder == SortOrder.Descending) { compareResult *= -1; } return(compareResult); }
private bool BuildDuplicateListIncludePartialHash(CommonEntry parentEntry, DirEntry dirEntry) { if (dirEntry.IsDirectory || !dirEntry.IsHashDone || dirEntry.Size == 0) { //TODO: how to deal with uncalculated files? return(true); } var info = new PairDirEntry(parentEntry, dirEntry); if (_duplicateFile.ContainsKey(dirEntry)) { _duplicateFile[dirEntry].Add(info); } else { _duplicateFile[dirEntry] = new List <PairDirEntry> { info }; } return(true); }