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)); }
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")); }
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"); }
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(); }
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"); }