-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcCheatCollection.cls
More file actions
152 lines (131 loc) · 4.55 KB
/
cCheatCollection.cls
File metadata and controls
152 lines (131 loc) · 4.55 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "cCheatCollection"
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 = "Collection" ,"cCheats"
Attribute VB_Ext_KEY = "Member0" ,"cCheats"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'Value to Index Key matrix array collection class (uses cCheats)
'local variable to hold collection
Private mCol As Collection
Public Function AddCheatClass(ByRef cNewCheat As cCheats) As Boolean
On Error Resume Next
mCol.Add cNewCheat, cNewCheat.sUID
AddCheatClass = True
End Function
Public Function Add(ByVal sUID As String, _
ByVal sFolder As String, _
ByVal sDescription As String, _
ByVal sCheatString As String) As cCheats
On Error Resume Next
'create a new object
Dim objNewMember As New cCheats
'set the properties passed into the method
objNewMember.sUID = sUID
objNewMember.sFolder = sFolder
objNewMember.sDescription = sDescription
objNewMember.sCheatString = sCheatString
mCol.Add objNewMember, sUID
'return the object created
Set Add = objNewMember
Set objNewMember = Nothing
End Function
Public Property Get Item(ByVal iIndexKey As Long) As cCheats
Attribute Item.VB_UserMemId = 0
On Error Resume Next 'do not let this property to fire an alarm. if wanted key does not exis, just generate it
Set Item = mCol(iIndexKey)
End Property
Public Property Get CheatCount() As Long
On Error Resume Next
CheatCount = mCol.Count
End Property
Public Function GetDumpString(ByVal iIndexKey As Long) As String
On Error Resume Next
With mCol(iIndexKey)
GetDumpString = .sUID & "|" & .sFolder & "|" & .sCheatString & "|" & .sDescription
End With
End Function
Public Function GetDumpStringByUID(ByVal sUID As String) As String
On Error Resume Next
With mCol(sUID)
GetDumpStringByUID = .sUID & "|" & .sFolder & "|" & .sCheatString & "|" & .sDescription
End With
End Function
Public Function GetItemByUID(ByVal sUID As String) As cCheats
On Error Resume Next 'loop the contents of cShortcuts's, and deliver the wanted object
Set GetItemByUID = mCol(sUID)
End Function
Public Function GetIndexByUID(ByVal sUID As String) As Long
On Error Resume Next 'loop the contents of cShortcuts's, and deliver the wanted object
GetIndexByUID = -1
Static lngItemCounter As Long
For lngItemCounter = 1 To mCol.Count
If mCol(lngItemCounter).sUID = sUID Then
GetIndexByUID = lngItemCounter
Exit For
End If
Next lngItemCounter
End Function
Public Function RemoveByIndex(ByVal iIndexKey As Long) As Boolean
On Error Resume Next
If iIndexKey > -1 And iIndexKey <= mCol.Count Then
mCol.Remove iIndexKey
RemoveByIndex = True
Else
RemoveByIndex = False
End If
End Function
Public Function RemoveByUID(ByVal sUID As String) As Boolean
On Error Resume Next
Static iIndexKey As Long
iIndexKey = GetIndexByUID(sUID)
If iIndexKey > -1 Then
mCol.Remove iIndexKey
RemoveByUID = True
Else
RemoveByUID = False
End If
End Function
Public Function CloneByIndex(ByVal iIndexKey As Long) As cCheats
On Error Resume Next
Set CloneByIndex = New cCheats
With mCol(iIndexKey)
CloneByIndex.sUID = .sUID
CloneByIndex.sFolder = .sFolder
CloneByIndex.sCheatString = .sCheatString
CloneByIndex.sDescription = .sDescription
End With
End Function
Public Function CloneByUID(ByVal sUID As String) As cCheats
On Error Resume Next
Set CloneByUID = New cCheats
With mCol(sUID)
CloneByUID.sUID = .sUID
CloneByUID.sFolder = .sFolder
CloneByUID.sCheatString = .sCheatString
CloneByUID.sDescription = .sDescription
End With
End Function
Public Function RemoveAll() As Boolean
On Error Resume Next
Set mCol = New Collection
End Function
Private Sub Class_Initialize()
'creates the collection when this class is created
Set mCol = New Collection
End Sub
Private Sub Class_Terminate()
'destroys collection when this class is terminated
Set mCol = Nothing
End Sub