Example #1
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Read([NotNull] FilePath file, [NotNull] Com.Drew.Metadata.Metadata metadata)
 {
     if (!file.IsFile())
     {
         throw new IOException("File object must reference a file");
     }
     if (!file.Exists())
     {
         throw new IOException("File does not exist");
     }
     if (!file.CanRead())
     {
         throw new IOException("File is not readable");
     }
     FileMetadataDirectory directory = new FileMetadataDirectory();
     directory.SetString(FileMetadataDirectory.TagFileName, file.GetName());
     directory.SetLong(FileMetadataDirectory.TagFileSize, file.Length());
     directory.SetDate(FileMetadataDirectory.TagFileModifiedDate, Sharpen.Extensions.CreateDate(file.LastModified()));
     metadata.AddDirectory(directory);
 }
Example #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void Read([NotNull] FilePath file, [NotNull] Com.Drew.Metadata.Metadata metadata)
        {
            if (!file.IsFile())
            {
                throw new IOException("File object must reference a file");
            }
            if (!file.Exists())
            {
                throw new IOException("File does not exist");
            }
            if (!file.CanRead())
            {
                throw new IOException("File is not readable");
            }
            FileMetadataDirectory directory = new FileMetadataDirectory();

            directory.SetString(FileMetadataDirectory.TagFileName, file.GetName());
            directory.SetLong(FileMetadataDirectory.TagFileSize, file.Length());
            directory.SetDate(FileMetadataDirectory.TagFileModifiedDate, Sharpen.Extensions.CreateDate(file.LastModified()));
            metadata.AddDirectory(directory);
        }