/// <summary> /// Constructs and initializes a new instance of <see /// cref="File" /> for a specified file abstraction and /// specified read style. /// </summary> /// <param name="abstraction"> /// A <see cref="File.IFileAbstraction" /> object to use when /// reading from and writing to the file. /// </param> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="abstraction" /> is <see langword="null" /// />. /// </exception> public File(File.IFileAbstraction abstraction, ReadStyle propertiesStyle) : base(abstraction) { ImageTag = new CombinedImageTag (TagTypes.TiffIFD | TagTypes.XMP); Mode = AccessMode.Read; try { Read (propertiesStyle); TagTypesOnDisk = TagTypes; } finally { Mode = AccessMode.Closed; } }
/// <summary> /// Reads the information from file with a specified read style. /// </summary> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> private void Read (ReadStyle propertiesStyle) { Mode = AccessMode.Read; try { ImageTag = new CombinedImageTag (TagTypes.XMP | TagTypes.Png); ValidateHeader (); ReadMetadata (); TagTypesOnDisk = TagTypes; if (propertiesStyle != ReadStyle.None) properties = ExtractProperties (); } finally { Mode = AccessMode.Closed; } }
/// <summary> /// Reads the information from file with a specified read style. /// </summary> /// <param name="propertiesStyle"> /// A <see cref="ReadStyle" /> value specifying at what level /// of accuracy to read the media properties, or <see /// cref="ReadStyle.None" /> to ignore the properties. /// </param> private void Read(ReadStyle propertiesStyle) { Mode = AccessMode.Read; try { ImageTag = new CombinedImageTag (TagTypes.TiffIFD); ReadFile (); TagTypesOnDisk = TagTypes; if (propertiesStyle != ReadStyle.None) properties = ExtractProperties (); } finally { Mode = AccessMode.Closed; } }