Ejemplo n.º 1
0
        public async void FileToStreamWriteTest()
        {
            var opts = new ExifToolOptions();
            var et   = new ExifTool(opts);

            var result = await et.WriteTagsAsync(SRC_FILE, UPDATES);

            Assert.True(result.Success);
            Assert.NotNull(result.Output);

            ValidateTags(await et.GetTagsAsync(result.Output));
        }
Ejemplo n.º 2
0
        public async void StreamToFileWriteTest()
        {
            var opts = new ExifToolOptions();
            var et   = new ExifTool(opts);
            var src  = new FileStream(SRC_FILE, FileMode.Open);

            var result = await et.WriteTagsAsync(src, UPDATES, "stream_to_file_test.jpg");

            Assert.True(result.Success);
            Assert.Null(result.Output);

            ValidateTag(await et.GetTagsAsync("stream_to_file_test.jpg"));
        }
Ejemplo n.º 3
0
        public async void FileToFileWriteTest()
        {
            var opts = new ExifToolOptions();
            var et   = new ExifTool(opts);

            var result = await et.WriteTagsAsync(SRC_FILE, UPDATES, "file_to_file_test.jpg");

            Assert.True(result.Success);
            Assert.Null(result.Output);

            ValidateTags(await et.GetTagsAsync("file_to_file_test.jpg"));

            File.Delete("file_to_file_test.jpg");
        }
Ejemplo n.º 4
0
        internal void UpdateDateTimeOriginal(FileInfo fileInfo, DateTime dateTime)
        {
            Console.WriteLine($"Updating exif date to {dateTime} to file {fileInfo.FullName}");
            var update = new List <Operation>
            {
                new SetOperation(new Tag(ExifToolExtensions.DatetimeOriginal, dateTime.ToString("u"))),
            };


            var writeResult = _exifTool.WriteTagsAsync(fileInfo.FullName, update).Result;

            var writeFileStream = new FileStream(fileInfo.FullName, FileMode.Open);

            writeResult.Output.Seek(0, SeekOrigin.Begin);
            writeResult.Output.CopyTo(writeFileStream);
            writeFileStream.Close();
            writeFileStream.Dispose();
        }
Ejemplo n.º 5
0
        public async void FileToFileWriteTestEncoded()
        {
            var opts = new ExifToolOptions()
            {
                EscapeTagValues = true
            };

            var et = new ExifTool(opts);

            var result = await et.WriteTagsAsync(SRC_FILE, UPDATES_ENCODED, "file_to_file_encoded_test.jpg");

            Assert.True(result.Success);
            Assert.Null(result.Output);

            ValidateEncodedTag(await et.GetTagsAsync("file_to_file_encoded_test.jpg"));

            File.Delete("file_to_file_encoded_test.jpg");
        }