Exemplo n.º 1
0
        public void build_new_path_with_hour_name()
        {
            _mediaFileInfo.ModifiedDate = new DateTime(1, 1, 1, 15, 0, 0);
            var newPath = DirectoryBuilder.BuildNewPathByDate(_mediaFileInfo, DateInterval.Hour);

            newPath.Should().Be(@"x:\3 PM\test.jpg");
        }
Exemplo n.º 2
0
        public void build_new_path_with_day_name()
        {
            _mediaFileInfo.ModifiedDate = new DateTime(1, 1, 1);
            var newPath = DirectoryBuilder.BuildNewPathByDate(_mediaFileInfo, DateInterval.Day);

            newPath.Should().Be(@"x:\1-Monday\test.jpg");
        }
Exemplo n.º 3
0
        private void ApplyMultipleIntervals(DateInterval interval, MediaFileInfo mediaFile)
        {
            var initialPath = mediaFile.CurrentPath;

            for (var i = (int)DateInterval.Year; i >= (int)interval; i--)
            {
                mediaFile.NewPath     = DirectoryBuilder.BuildNewPathByDate(mediaFile, (DateInterval)i);
                mediaFile.CurrentPath = mediaFile.NewPath;
            }

            mediaFile.CurrentPath = initialPath;
        }
Exemplo n.º 4
0
        public void Classify(List <MediaFileInfo> images, ClassifierArgs args)
        {
            var dateArgs = args as DateClassifierArgs;

            if (images == null)
            {
                throw new ArgumentNullException(nameof(images));
            }
            if (dateArgs == null)
            {
                throw new ArgumentNullException(nameof(dateArgs));
            }
            foreach (var image in images)
            {
                if (!dateArgs.UseMultipleClassifiers)
                {
                    image.NewPath = DirectoryBuilder.BuildNewPathByDate(image, dateArgs.Interval);
                }
                else
                {
                    ApplyMultipleIntervals(dateArgs.Interval, image);
                }
            }
        }