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;
        }
Exemplo n.º 2
0
        public override Photo VisitPhoto(Photo photo, AnalyzerExecutionContext executionContext)
        {
            if (photo.Tag(Constants.Namespace, Constants.HashMetadataKey) == null)
            {
                var streamFeature = Source.Feature<IPhotoStreamFeature>();

                string value = null;

                using (var photoStream = streamFeature.GetStream(photo))
                {
                    value = CreateImageHash(photoStream);
                }

                var tag = new Tag(Constants.Namespace, Constants.HashMetadataKey, value);

                photo = photo.WithTag(tag);
            }

            return photo;
        }