Geting/seting the properties of a file
-
Does anyone know how I can get (and eventually set) the properties of a file. I have some pictures take with a digital camera. In all the pictures properties (attributes?) are set for lot o things. E.g. Widht, Height, Bit Depth, Flash Mode, Focal Length, etc... I guess that the attributes are dynamic. But how can I read them using the Framework? I have not been able to find the attributes using a FileInfo-object. I have seen someone doing this on the net using a COM-object with prog-id "DSOLEFILE.PropertyReader". Do I have to use this in stead? And in that case where can I find it? Thanks in advance, Mattias
-
Does anyone know how I can get (and eventually set) the properties of a file. I have some pictures take with a digital camera. In all the pictures properties (attributes?) are set for lot o things. E.g. Widht, Height, Bit Depth, Flash Mode, Focal Length, etc... I guess that the attributes are dynamic. But how can I read them using the Framework? I have not been able to find the attributes using a FileInfo-object. I have seen someone doing this on the net using a COM-object with prog-id "DSOLEFILE.PropertyReader". Do I have to use this in stead? And in that case where can I find it? Thanks in advance, Mattias
Here is a class I have used before:
Imports System.IO Public Class ProjectFile Private _path As String Private fi As FileInfo Private _Name As String Private _DirectoryName As String Private _Extension As String Private _Attributes As String Private _CreationTime As Date Private _LastAccessTime As Date Private _LastWriteTime As Date Private _Length As Long Private _FullName As String Public Sub New(ByVal path As String) _path = path fi = New FileInfo(_path) _Name = fi.Name _DirectoryName = fi.DirectoryName _Extension = fi.Extension _Attributes = fi.Attributes.ToString() _CreationTime = fi.CreationTime _LastAccessTime = fi.LastAccessTime _LastWriteTime = fi.LastWriteTime _Length = fi.Length _FullName = fi.FullName End Sub Public ReadOnly Property FullName() As String Get Return _FullName End Get End Property Public ReadOnly Property Length() As Long Get Return _Length End Get End Property Public ReadOnly Property Path() As String Get Return _path End Get End Property Public ReadOnly Property Name() As String Get Return _Name End Get End Property Public ReadOnly Property DirectoryName() As String Get Return _DirectoryName End Get End Property Public ReadOnly Property Extension() As String Get Return _Extension.ToLower End Get End Property Public ReadOnly Property Attributes() As String Get Return _Attributes End Get End Property Public ReadOnly Property CreationTime() As Date Get Return _CreationTime End Get End Property Public ReadOnly Property LastAccessTime() As Date Get Return _LastAccessTime End Get End Property Public ReadOnly Property LastWriteTime() As Date Get Return _LastWriteTime End Get End Property End Class
Also check out this link: LookCool, an image browser application (JPG only) and Photo Properties By Jeffrey S. Gangel Jim -
Here is a class I have used before:
Imports System.IO Public Class ProjectFile Private _path As String Private fi As FileInfo Private _Name As String Private _DirectoryName As String Private _Extension As String Private _Attributes As String Private _CreationTime As Date Private _LastAccessTime As Date Private _LastWriteTime As Date Private _Length As Long Private _FullName As String Public Sub New(ByVal path As String) _path = path fi = New FileInfo(_path) _Name = fi.Name _DirectoryName = fi.DirectoryName _Extension = fi.Extension _Attributes = fi.Attributes.ToString() _CreationTime = fi.CreationTime _LastAccessTime = fi.LastAccessTime _LastWriteTime = fi.LastWriteTime _Length = fi.Length _FullName = fi.FullName End Sub Public ReadOnly Property FullName() As String Get Return _FullName End Get End Property Public ReadOnly Property Length() As Long Get Return _Length End Get End Property Public ReadOnly Property Path() As String Get Return _path End Get End Property Public ReadOnly Property Name() As String Get Return _Name End Get End Property Public ReadOnly Property DirectoryName() As String Get Return _DirectoryName End Get End Property Public ReadOnly Property Extension() As String Get Return _Extension.ToLower End Get End Property Public ReadOnly Property Attributes() As String Get Return _Attributes End Get End Property Public ReadOnly Property CreationTime() As Date Get Return _CreationTime End Get End Property Public ReadOnly Property LastAccessTime() As Date Get Return _LastAccessTime End Get End Property Public ReadOnly Property LastWriteTime() As Date Get Return _LastWriteTime End Get End Property End Class
Also check out this link: LookCool, an image browser application (JPG only) and Photo Properties By Jeffrey S. Gangel JimThanks a lot... :-) That helpt me out completely. :-) /Mattias