Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Geting/seting the properties of a file

Geting/seting the properties of a file

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncomadobe
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mattias Olgerfelt
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • M Mattias Olgerfelt

      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

      J Offline
      J Offline
      Jim Taylor
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • J Jim Taylor

        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

        M Offline
        M Offline
        Mattias Olgerfelt
        wrote on last edited by
        #3

        Thanks a lot... :-) That helpt me out completely. :-) /Mattias

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups