/// <summary> /// The method is called when a preview is request. /// </summary> /// <param name="request">The <see cref="ManualCompareRequest"/> request to compare.</param> /// <returns>The <see cref="RootCompareObject"/> containing information of the comparison.</returns> public RootCompareObject Preview(ManualCompareRequest request) { _currPreviewProgress = new PreviewProgress(request.TagName); RootCompareObject rco = ManualSyncer.Compare(request, _currPreviewProgress); _currPreviewProgress = null; return rco; }
/// <summary> /// Cancels the currently previewing job. /// </summary> /// <param name="tagName">The tag name to cancel.</param> public void CancelPreview(string tagName) { if (_currPreviewProgress != null && _currPreviewProgress.TagName == tagName) { _currPreviewProgress.Cancel(); _currPreviewProgress = null; } }
/// <summary> /// Compares/previews a job given a <see cref="ManualCompareRequest"/> and a <see cref="PreviewProgress"/>. /// </summary> /// <param name="request">The <see cref="ManualCompareRequest"/> to pass in.</param> /// <param name="progress">The <see cref="PreviewProgress"/> to pass in.</param> /// <returns></returns> public static RootCompareObject Compare(ManualCompareRequest request, PreviewProgress progress) { List<Filter> filters = request.Filters.ToList(); filters.Add(FilterFactory.CreateArchiveFilter(request.Config.ArchiveName)); filters.Add(FilterFactory.CreateArchiveFilter(request.Config.ConflictDir)); RootCompareObject rco = new RootCompareObject(request.Paths); List<string> typeConflicts = new List<string>(); CompareObjectHelper.PreTraverseFolder(rco, new BuilderVisitor(filters, typeConflicts, progress), progress); CompareObjectHelper.PreTraverseFolder(rco, new XMLMetadataVisitor(), progress); CompareObjectHelper.PreTraverseFolder(rco, new ProcessMetadataVisitor(), progress); CompareObjectHelper.LevelOrderTraverseFolder(rco, new FolderRenameVisitor(), progress); ComparerVisitor comparerVisitor = new ComparerVisitor(); CompareObjectHelper.PostTraverseFolder(rco, comparerVisitor, progress); return rco; }