Example #1
0
        private void SetData(IDirectoryDiffRoot results,
                             DiffViewModeEnum requestedViewMode)
        {
            string currentPathA = results.RootPathA;
            string currentPathB = results.RootPathB;

            List <IDirEntryViewModel> dirs = null;

            switch (requestedViewMode)
            {
            case DiffViewModeEnum.DirectoriesAndFiles:
                dirs = CreateViewModelEntries(results.RootEntry.Subentries, currentPathA, currentPathB);
                break;

            case DiffViewModeEnum.FilesOnly:
                // Sort list of different files by their type of difference and show them in UI
                var sortedList = results.DifferentFiles
                                 .OrderByDescending(x => (int)(x.EditContext))
                                 .ToList();

                dirs = CreateViewModelEntries(sortedList, currentPathA, currentPathB);
                break;

            default:
                throw new ArgumentOutOfRangeException(requestedViewMode.ToString());
            }

            _DirPathStack.Clear();
            SetDirDiffCollectionData(dirs);

            CountFilesDeleted = results.CountFilesDeleted;
            CountFilesAdded   = results.CountFilesAdded;
            CountFilesChanged = results.CountFilesChanged;

            PathA = string.Empty;
            PathB = string.Empty;

            // Set a filter description
            if (results.Filter == null)
            {
                this.LblFilter = "All Files";
            }
            else
            {
                DirectoryDiffFileFilter filter = results.Filter;
                this.LblFilter = string.Format("{0}: {1}", filter.Include ? "Includes" : "Excludes", filter.FilterString);
            }
        }
Example #2
0
        internal void ShowDifferences(DirDiffArgs args,
                                      IDirectoryDiffRoot diffResults
                                      )
        {
            try
            {
                SetData(diffResults, _CurrentViewMode);
                _Results = diffResults;

                _CompareOptions = args;                 // Record comparison options for later

                IsDiffDataAvailable = true;
            }
            catch
            {
                IsDiffDataAvailable = false;
            }
        }