예제 #1
0
        private async Task <IList <IExifDataDto> > GenerateImageList(string startName, DateTime startDateTime, int isoLevel, int numberOfImages)
        {
            var listOfImages = new List <IExifDataDto>();

            await Task.Run(() =>
            {
                for (int i = 0; i < numberOfImages; i++)
                {
                    var image = new ExifDataDto
                    {
                        FileName      = string.Format(startName, i),
                        TakenDateTime = startDateTime.AddSeconds(i * 5),
                        IsoLevel      = isoLevel
                    };
                    listOfImages.Add(image);
                }
            });

            return(listOfImages);
        }
예제 #2
0
        public async Task <IExifDataDto> ReadExifData(string fullPath)
        {
            var directory = ImageMetadataReader.ReadMetadata(fullPath).OfType <ExifSubIfdDirectory>().FirstOrDefault();

            if (directory == null)
            {
                return(null);
            }

            var exifData = new ExifDataDto();

            exifData.FileName  = Path.GetFileName(fullPath);
            exifData.Directory = Path.GetDirectoryName(fullPath);
            exifData.FullPath  = fullPath;

            exifData.TakenDateTime = await Task.Run(() => GetTakendateTime(directory)) ?? default(DateTime);

            exifData.IsoLevel = await Task.Run(() => GetIsoLevel(directory)) ?? default(int);

            return(exifData);
        }
예제 #3
0
        private IList <IExifDataDto> GenerateImageList(int numberOfImages)
        {
            string imageStartName = "IMG17{0:00}.CR2";
            string fullPath       = @"D:\Pictures\2018\2018_10_31\{0}";
            string directory      = @"D:\Pictures\2018\2018_10_31";

            var listOfImages = new List <IExifDataDto>();

            for (int i = 0; i < numberOfImages; i++)
            {
                string fileName = string.Format(imageStartName, i);
                var    image    = new ExifDataDto
                {
                    FileName  = fileName,
                    FullPath  = string.Format(fullPath, fileName),
                    Directory = directory,
                    IsoLevel  = 800
                };
                listOfImages.Add(image);
            }
            return(listOfImages);
        }
예제 #4
0
        public void CheckSettingFullPathForImage()
        {
            string containerName = "var1";
            var    image         = new ExifDataDto
            {
                FileName  = "IMG1780.CR2",
                Directory = @"D:\Pictures\2018\2018_10_31",
                FullPath  = @"D:\Pictures\2018\2018_10_31\IMG1780.CR2"
            };
            var imageDataSortPreparator = kernel.Get <IImageDataSortPreparator>();

            imageDataSortPreparator.SetNewFullPathForImage(containerName, image);

            string expectedDirectoryNew = @"D:\Pictures\2018\2018_10_31\var1";
            string actualDirectoryNew   = image.DirectoryNew;

            Assert.AreEqual(expectedDirectoryNew, actualDirectoryNew);

            string expectedFullPathNew = @"D:\Pictures\2018\2018_10_31\var1\IMG1780.CR2";
            string actualFullPathNew   = image.FullPathNew;

            Assert.AreEqual(expectedFullPathNew, actualFullPathNew);
        }