forked from WindowStations/VB6NameSpaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DirectoryList.cls
82 lines (78 loc) · 2.72 KB
/
DirectoryList.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
VERSION 1.0 CLASS
BEGIN
MultiUse = -1
Persistable = 0
DataBindingBehavior = 0
DataSourceBehavior = 0
MTSTransactionMode = 0
END
Attribute VB_Name = "DirectoryList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'VERSION 1.0 CLASS
'BEGIN
' MultiUse = -1 'True
' Persistable = 0 'NotPersistable
' DataBindingBehavior = 0 'vbNone
' DataSourceBehavior = 0 'vbNone
' MTSTransactionMode = 0 'NotAnMTSObject
'END
'Attribute VB_Name = "DirectoryList"
'Attribute VB_GlobalNameSpace = False
'Attribute VB_Creatable = True
'Attribute VB_PredeclaredId = False
'Attribute VB_Exposed = False
'Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
'Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
'Option Explicit
Private Const FILE_ATTRIBUTE_READONLY = &H1
Private Const FILE_ATTRIBUTE_HIDDEN = &H2
Private Const FILE_ATTRIBUTE_SYSTEM = &H4
Private Const FILE_ATTRIBUTE_DIRECTORY = &H10
Private Const FILE_ATTRIBUTE_ARCHIVE = &H20
Private Const FILE_ATTRIBUTE_NORMAL = &H80
Private Const FILE_ATTRIBUTE_TEMPORARY = &H100
Private Const FILE_ATTRIBUTE_COMPRESSED = &H800
Private Const FILE_ATTRIBUTE_OFFLINE = &H1000
Private mCol As New Collection
Public Function Add(lAttrib As Long, dtCreationTime As Date, dtLastAccessTime As Date, dtLastWriteTime As Date, lFileSize As Long, sFilename As String) As DirectoryItem
Dim newItem As New DirectoryItem
With newItem
.Archive = (lAttrib And FILE_ATTRIBUTE_ARCHIVE)
.Compressed = (lAttrib And FILE_ATTRIBUTE_COMPRESSED)
.Directory = (lAttrib And FILE_ATTRIBUTE_DIRECTORY)
.Hidden = (lAttrib And FILE_ATTRIBUTE_HIDDEN)
.Normal = (lAttrib And FILE_ATTRIBUTE_NORMAL)
.Offline = (lAttrib And FILE_ATTRIBUTE_OFFLINE)
.ReadOnly = (lAttrib And FILE_ATTRIBUTE_READONLY)
.System = (lAttrib And FILE_ATTRIBUTE_SYSTEM)
.Temporary = (lAttrib And FILE_ATTRIBUTE_TEMPORARY)
.CreationTime = dtCreationTime
.LastAccessTime = dtLastAccessTime
.LastWriteTime = dtLastWriteTime
.FileSize = lFileSize
.FileName = sFilename
End With
mCol.Add newItem, sFilename
End Function
Public Function Clear()
Dim lIndex As Long
If mCol.Count > 0 Then
For lIndex = 1 To mCol.Count - 1
mCol.Remove lIndex
Next
End If
End Function
Public Function Item(Index As Variant) As DirectoryItem
'Attribute Item.VB_UserMemId = 0
Set Item = mCol(Index)
End Function
Public Function Count() As Long
Count = mCol.Count
End Function
'Public Function NewEnum() As IUnknown
' Set NewEnum = mCol.[_NewEnum]
'End Function