public override Photo VisitPhoto(Photo photo, AnalyzerExecutionContext executionContext)
        {
            var tag = photo.Tag(Constants.Namespace, Constants.HashMetadataKey);

            if (tag != null)
            {
                List<Photo> list = null;

                if (_cache.ContainsKey(tag.Value))
                {
                    list = _cache[tag.Value];
                }
                else
                {
                    list = new List<Photo>();
                    _cache.Add(tag.Value, list);
                }

                list.Add(photo);

                if (list.Count == 2)
                {
                    var activity = new ResolveDuplicateActivity(list);

                    _currentFolderDuplicates.Add(activity);
                }
            }

            return photo;
        }
        public override PhotoSet VisitPhotoSetAfter(PhotoSet photoSet, AnalyzerExecutionContext executionContext)
        {
            if (_currentFolderDuplicates.Count() == photoSet.Photos.Count())
            {
                executionContext.Activities.Add(new ResolveDuplicatePhotoSetActivity(photoSet, _currentFolderDuplicates));
            }
            else
            {
                executionContext.Activities.AddRange(_currentFolderDuplicates);
            }

            _currentFolderDuplicates = null;

            return photoSet;
        }
Example #3
0
        public async Task<AnalyzerExecutionContext> AnalyzeArchive(IPhotoSource photoSource)
        {
            var archive = await photoSource.GetAbstractPhotoModel();

            var executionContext = new AnalyzerExecutionContext(archive);

            var idx = 0;
            var containers = new Container[archive.Containers.Count()];

            foreach (var container in archive.Containers)
            {
                containers[idx++] = VisitContainer(container);
            }

            executionContext.Archive = archive.WithContainers(containers);

            return executionContext;
        }
        public override PhotoSet VisitPhotoSetBefore(PhotoSet photoSet, AnalyzerExecutionContext executionContext)
        {
            _currentFolderDuplicates = new List<ActivityBase>();

            return photoSet;
        }