Beispiel #1
0
        private int DirectoryCompare(DirEntry de1, DirEntry de2)
        {
            int compareResult;
            var directoryHelper = _clientForm.DirectoryListViewHelper;
            var column          = directoryHelper.SortColumn;

            switch (column)
            {
            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;

            default:
                throw new Exception($"Problem column {column} not handled for sort.");
            }
            if (directoryHelper.ColumnSortOrder == SortOrder.Descending)
            {
                compareResult *= -1;
            }
            return(compareResult);
        }