Beispiel #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);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Compares the Metadata with the metadata stored in the original file
        /// </summary>
        /// <returns>A list of changes</returns>
        public List <CompareResult> CompareMetadataToFileMetadata()
        {
            if (!this.IsFileNameValid)
            {
                throw new Exception("File does not exist or is not valid: " + this.FileFullName);
            }

            List <CompareResult> compareResults = new List <CompareResult>();

            // Compare the two
            PhotoMetadataTools.CompareMetadata(this.MetadataInFile, this.Metadata, ref compareResults);

            // Sort
            var query = from x in compareResults
                        orderby x
                        select x;

            return(query.ToList());
        }