Class FileSystemInfo m_CreationTime As FILETIME m_LastAccessTime As FILETIME m_LastWriteTime As FILETIME m_FileAttributes As DWord Protected FullPath As String OriginalPath As String Public 'Public Properties Function Attributes() As FileAttributes Select Case m_FileAttributes Case FILE_ATTRIBUTE_ARCHIVE Return Archive Case FILE_ATTRIBUTE_COMPRESSED Return Compressed Case FILE_ATTRIBUTE_DIRECTORY Return Directory Case FILE_ATTRIBUTE_ENCRYPTED Return Encrypted Case FILE_ATTRIBUTE_HIDDEN Return Hidden Case FILE_ATTRIBUTE_NORMAL Return Normal Case FILE_ATTRIBUTE_OFFLINE Return Offline Case FILE_ATTRIBUTE_READONLY Return ReadOnly Case FILE_ATTRIBUTE_REPARSE_POINT Return ReparsePoint Case FILE_ATTRIBUTE_SPARSE_FILE Return SparseFile Case FILE_ATTRIBUTE_SYSTEM Return System Case FILE_ATTRIBUTE_TEMPORARY Return Temporary Case Else 'Exception Debug Return 0 End Select End Function Sub Attributes(ByRef value As FileAttributes) Dim attributes As DWord Select Case value Case Archive attributes = FILE_ATTRIBUTE_ARCHIVE Case Compressed attributes = FILE_ATTRIBUTE_COMPRESSED Case Directory attributes = FILE_ATTRIBUTE_DIRECTORY Case Hidden attributes = FILE_ATTRIBUTE_HIDDEN Case Normal attributes = FILE_ATTRIBUTE_NORMAL Case Offline attributes = FILE_ATTRIBUTE_OFFLINE Case ReadOnly attributes = FILE_ATTRIBUTE_READONLY Case System attributes = FILE_ATTRIBUTE_SYSTEM Case Temporary attributes = FILE_ATTRIBUTE_TEMPORARY Case Else 'Exception Exit Sub End Select If SetFileAttributes(FullPath, attributes) = FALSE Then 'Exception Debug End If End Sub Function CreationTime() As DateTime Return DateTime.FromFileTime(m_CreationTime) End Function Sub CreationTime(ByRef value As DateTime) m_CreationTime = value.ToFileTimeUtc() If setFileTime() = False Then 'Exception debug End If End Sub Function CreationTimeUtc() As DateTime Dim date = CreationTime As DateTime Return date.ToUniversalTime() End Function Sub CreationTimeUtc(ByRef value As DateTime) CreationTime = value End Sub Function LastAccessTime() As DateTime Return DateTime.FromFileTime(m_LastAccessTime) End Function Sub LastAccessTime(ByRef value As DateTime) m_LastAccessTime = value.ToFileTimeUtc() If setFileTime() = False Then 'Exception debug End If End Sub Function LastAccessTimeUtc() As DateTime Dim date = LastAccessTime As DateTime Return date.ToUniversalTime() End Function Sub LastAccessTimeUtc(ByRef value As DateTime) LastAccessTime = value End Sub Function LastWriteTime() As DateTime Return DateTime.FromFileTime(m_LastWriteTime) End Function Sub LastWriteTime(ByRef value As DateTime) m_LastWriteTime = value.ToFileTimeUtc() If setFileTime() = False Then 'Exception debug End If End Sub Function LastWriteTimeUtc() As DateTime Dim date = LastWriteTime As DateTime Return date.ToUniversalTime() End Function Sub LastWriteTimeUtc(ByRef value As DateTime) LastWriteTime = value End Sub Function Exists() As Boolean If m_FileAttributes = 0 Then Return False Else Return True End If End Function Function Extension() As String Return Path.GetExtension(FullPath) End Function Function FullName() As String Return FullPath End Function Function Name() As String Return Path.GetFileName(FullPath) End Function 'Public Methods Virtual Sub Delete() If DeleteFile(FullPath) = FALSE Then 'Exception debug End If End Sub Sub Refresh() Dim data As WIN32_FIND_DATA Dim hFind As HANDLE hFind = FindFirstFile(FullPath, data) CloseHandle(hFind) m_FileAttributes = data.dwFileAttributes m_CreationTime = data.ftCreationTime m_LastAccessTime = data.ftLastAccessTime m_LastWriteTime = data.ftLastWriteTime End Sub Private Function setFileTime() As Boolean Dim hFile As HANDLE hFile = CreateFile(FullPath, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) If hFile = INVALID_HANDLE_VALUE Then setFileTime = False Exit Function End If If SetFileTime(hFile, m_CreationTime, m_LastAccessTime, m_LastWriteTime) Then setFileTime = True Else setFileTime = False End If CloseHandle(hFile) End Function End Class