Example #1
0
        public IFolderDiff Build(ISyncPair syncPair)
        {
            IsNotNull(syncPair);

            var diffInfo = _diffInfoBuilder.BuildInfo(syncPair);

            diffInfo.Destination.EnsureExists();

            if (!diffInfo.Source.Exists)
            {
                throw new NodeNotFoundException();
            }

            _fileScanner.FileFound += _fileScanner_SourceFileFound;

            var sourceScan = _fileScanner.Scan(diffInfo.Source);

            _fileScanner.FileFound -= _fileScanner_SourceFileFound;
            _fileScanner.FileFound += _fileScanner_DestinationFileFound;

            var destinationScan = _fileScanner.Scan(diffInfo.Destination);

            _fileScanner.FileFound -= _fileScanner_DestinationFileFound;

            return(_folderDiffer.BuildDiff(sourceScan, destinationScan));
        }
Example #2
0
        public IDiffInfo BuildInfo(ISyncPair syncPair)
        {
            var source      = syncPair.Source;
            var destination = syncPair.Destination;

            if (syncPair.Level == SyncLevel.Parent)
            {
                destination = Path.Combine(destination, new KoreFolderInfo(syncPair.Source).Name);
            }

            return(new DiffInfo
            {
                Source = new KoreFolderInfo(source),
                Destination = new KoreFolderInfo(destination)
            });
        }
Example #3
0
        private void SetupCurrentTestFolder(string testFolder, SyncLevel syncLevel = SyncLevel.Flat)
        {
            _currentTest = Path.Combine(CurrentWorkingFolder, testFolder);

            _sourceFolder      = Path.Combine(_currentTest, "src");
            _destinationFolder = Path.Combine(_currentTest, "dest");

            EnsureFolderExists(_sourceFolder);
            EnsureFolderExists(_destinationFolder);

            _syncPair = new SyncPair
            {
                Source      = _sourceFolder,
                Destination = _destinationFolder,
                Level       = syncLevel
            };

            _kontrol.Settings.SyncPairs.Add(_syncPair);
        }
Example #4
0
 private IFolderDiffResult BuildFolderDiffResult(ISyncPair syncPair)
 {
     return(new FolderDiffResult(syncPair, _diffBuilder.Build(syncPair)));
 }
Example #5
0
 public FolderDiffResult(ISyncPair syncPair, IFolderDiff folderDiff)
 {
     SyncPair   = syncPair;
     FolderDiff = folderDiff;
 }