/// <summary> /// Write commands to ExifTool for ThumbnailWriteStream (Does NOT work with mono/legacy) /// </summary> /// <param name="fileHash">the location</param> /// <param name="command">exifTool command line args</param> /// <returns>true=success</returns> public async Task <bool> WriteTagsThumbnailAsync(string fileHash, string command) { var inputStream = _thumbnailStorage.ReadStream(fileHash); var runner = new StreamToStreamRunner(_appSettings, inputStream, _logger); var stream = await runner.RunProcessAsync(command); // Need to Dispose for Windows inputStream.Close(); return(await _thumbnailStorage.WriteStreamAsync(stream, fileHash)); }
/// <summary> /// Write commands to ExifTool for ReadStream /// </summary> /// <param name="subPath">the location</param> /// <param name="command">exifTool command line args</param> /// <returns>true=success</returns> public async Task <KeyValuePair <bool, string> > WriteTagsAndRenameThumbnailAsync(string subPath, string command) { var inputStream = _iStorage.ReadStream(subPath); var oldFileHashCodeKeyPair = (await new FileHash(_iStorage).GetHashCodeAsync(subPath)); var runner = new StreamToStreamRunner(_appSettings, inputStream, _logger); var stream = await runner.RunProcessAsync(command); var newHashCode = await RenameThumbnailByStream(oldFileHashCodeKeyPair, stream); // Set stream to begin for use afterwards stream.Seek(0, SeekOrigin.Begin); // Need to Dispose for Windows inputStream.Close(); return(new KeyValuePair <bool, string>(await _iStorage.WriteStreamAsync(stream, subPath), newHashCode)); }