Exemple #1
0
        /// <summary>
        /// Write Metadata to the Jpeg file, with no expection handling
        /// </summary>
        private void UnhandledWriteMetadata()
        {
            List <CompareResult> changes = new List <CompareResult>();

            // Compare the two
            PhotoMetadataTools.CompareMetadata(this.InternalPhotoMetadataInFile, this.InternalPhotoMetadata, ref changes);

            // Save if there have been changes to the Metadata
            if (changes.Count > 0)
            {
                // Set the Last Edit Date
                this.Metadata.FotoflyDateLastSave = DateTime.Now;
                this.Metadata.CreationSoftware    = FotoflyAssemblyInfo.ShortBuildVersion;

                // Read the file
                using (WpfFileManager wpfFileManager = new WpfFileManager(this.FileFullName, true))
                {
                    // Copy values across
                    PhotoMetadataTools.WriteBitmapMetadata(wpfFileManager.BitmapMetadata, this.InternalPhotoMetadata);

                    // Save file
                    wpfFileManager.WriteMetadata();

                    // Save new BitmapMetadata as MetadataInFile
                    this.InternalPhotoMetadataInFile = PhotoMetadataTools.ReadBitmapMetadata(wpfFileManager.BitmapMetadata);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Read Metadata from the Jpeg file, with no expection handling
        /// </summary>
        private void UnhandledReadMetadata()
        {
            this.InternalPhotoMetadata       = new PhotoMetadata();
            this.InternalPhotoMetadataInFile = new PhotoMetadata();

            // Read BitmapMetadata
            using (WpfFileManager wpfFileManager = new WpfFileManager(this.FileFullName))
            {
                // Copy that gets changed
                this.InternalPhotoMetadata = PhotoMetadataTools.ReadBitmapMetadata(wpfFileManager.BitmapMetadata, wpfFileManager.BitmapDecoder);

                this.InternalPhotoMetadata.ImageHeight = wpfFileManager.BitmapDecoder.Frames[0].PixelHeight;
                this.InternalPhotoMetadata.ImageWidth  = wpfFileManager.BitmapDecoder.Frames[0].PixelWidth;

                // Copy saved metadata for comparisons
                this.InternalPhotoMetadataInFile = PhotoMetadataTools.ReadBitmapMetadata(wpfFileManager.BitmapMetadata, wpfFileManager.BitmapDecoder);

                this.InternalPhotoMetadataInFile.ImageHeight = wpfFileManager.BitmapDecoder.Frames[0].PixelHeight;
                this.InternalPhotoMetadataInFile.ImageWidth  = wpfFileManager.BitmapDecoder.Frames[0].PixelWidth;
            }
        }
Exemple #3
0
 public static PhotoMetadata ReadBitmapMetadata(BitmapMetadata bitmapMetadata)
 {
     return(PhotoMetadataTools.ReadBitmapMetadata(bitmapMetadata, null));
 }