Changeset 345 for trunk/Include/Classes/System
- Timestamp:
- Sep 29, 2007, 9:26:35 PM (17 years ago)
- Location:
- trunk/Include/Classes/System/IO
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/IO/DirectoryInfo.ab
r333 r345 10 10 OriginalPath = path 11 11 FullPath = Path.GetFullPath(path) 12 Refresh()13 12 End Sub 14 13 … … 160 159 find = FindFirstFile(ToTCStr(Path.Combine(FullPath, searchPattern)), findData) 161 160 If find = INVALID_HANDLE_VALUE Then 162 debug 'Exception 163 Return Nothing 161 Return New List<DirectoryInfo> 164 162 End If 165 163 166 164 Dim files As List<FileSystemInfo> 167 Dim i = 0 As Long168 165 Do 169 If i > 1 Then 170 Dim s = New String(findData.cFileName As PCTSTR) 171 If (findData.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY Then 172 files.Add(New DirectoryInfo(Path.Combine(FullPath, s))) 173 Else 174 files.Add(New FileInfo(Path.Combine(FullPath, s))) 175 End If 166 Dim s = New String(findData.cFileName As PCTSTR) 167 If (findData.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY Then 168 files.Add(New DirectoryInfo(Path.Combine(FullPath, s))) 169 Else 170 files.Add(New FileInfo(Path.Combine(FullPath, s))) 176 171 End If 177 i++178 172 Loop While FindNextFile(find, findData) 179 173 FindClose(find) 174 175 files.Remove(New DirectoryInfo(Path.Combine(FullPath, "."))) 176 files.Remove(New DirectoryInfo(Path.Combine(FullPath, ".."))) 180 177 181 178 If GetLastError() = ERROR_NO_MORE_FILES Then -
trunk/Include/Classes/System/IO/FileInfo.ab
r318 r345 9 9 OriginalPath = path 10 10 FullPath = Path.GetFullPath(path) 11 Refresh()12 11 End Sub 13 12 -
trunk/Include/Classes/System/IO/FileSystemInfo.ab
r333 r345 8 8 m_LastWriteTime As FILETIME 9 9 m_FileAttributes As DWord 10 11 m_IsFreshed As Boolean 10 12 Protected 11 13 FullPath As String 12 14 OriginalPath As String 13 15 Public 16 Sub FileSystemInfo() 17 m_IsFreshed = False 18 End Sub 19 20 Sub ~FileSystemInfo() 21 End Sub 14 22 15 23 Override Function Equals( object As Object ) As Boolean … … 27 35 'Public Properties 28 36 Function Attributes() As DWord'FileAttributes 37 If Not m_IsFreshed Then Refresh() 29 38 Return m_FileAttributes 30 39 End Function … … 38 47 39 48 Function CreationTime() As DateTime 49 If Not m_IsFreshed Then Refresh() 40 50 Return DateTime.FromFileTime(m_CreationTime) 41 51 End Function … … 55 65 56 66 Function LastAccessTime() As DateTime 67 If Not m_IsFreshed Then Refresh() 57 68 Return DateTime.FromFileTime(m_LastAccessTime) 58 69 End Function … … 72 83 73 84 Function LastWriteTime() As DateTime 85 If Not m_IsFreshed Then Refresh() 74 86 Return DateTime.FromFileTime(m_LastWriteTime) 75 87 End Function … … 89 101 90 102 Function Exists() As Boolean 103 If Not m_IsFreshed Then Refresh() 91 104 If m_FileAttributes = 0 Then 92 105 Return False … … 128 141 Private 129 142 Sub setFileTime() 143 If Not m_IsFreshed Then Refresh() 130 144 Dim hFile = CreateFile(ToTCStr(FullPath), GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) 131 145 If hFile = INVALID_HANDLE_VALUE Then
Note:
See TracChangeset
for help on using the changeset viewer.