forked from DNNCommunity/DNN.IFrame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIFrameParameterCollection.vb
142 lines (107 loc) · 4.49 KB
/
IFrameParameterCollection.vb
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
'
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
'
Namespace DotNetNuke.Modules.IFrame.Domain
''' <summary>
''' Represents a collection of <see cref="IFrameParameter"/> objects.
''' </summary>
''' <history>
''' [flanakin] 04/15/2006 Genesis
''' </history>
Public NotInheritable Class IFrameParameterCollection
Inherits CollectionBase
#Region "| Fields |"
Private _key As IFrameParameter.UniqueKey
Private _moduleID As Integer
Private _ParamName As String
Private _type As IFrameParameterType
Private _typeArgument As String
#End Region
#Region "| Initialization |"
''' <summary>
''' Instantiates a new instance of the <c>IFrameParameterCollection</c> module.
''' </summary>
Public Sub New()
End Sub
#End Region
#Region "| Properties |"
Default Public Overloads Property Item(ByVal index As Integer) As IFrameParameter
Get
Return CType(Me.List.Item(index), IFrameParameter)
End Get
Set(ByVal value As IFrameParameter)
Me.List.Item(index) = value
End Set
End Property
Default Public Overloads ReadOnly Property Item(ByVal ParamName As String) As IFrameParameter
Get
Return Me(IndexOf(ParamName))
End Get
End Property
#End Region
#Region "| Methods [Public] |"
Public Function Add(ByVal Param As IFrameParameter) As Integer
Return Me.List.Add(Param)
End Function
Public Overloads Function Contains(ByVal Param As IFrameParameter) As Boolean
Return Me.List.Contains(Param)
End Function
Public Overloads Function Contains(ByVal ParamName As String) As Boolean
Return (IndexOf(ParamName) >= 0)
End Function
Public Overloads Function IndexOf(ByVal Param As IFrameParameter) As Integer
Return Me.List.IndexOf(Param)
End Function
Public Overloads Function IndexOf(ByVal ParamName As String) As Integer
For i As Integer = 0 To Count - 1
If Me(i).Name = ParamName Then
Return i
End If
Next
Return -1
End Function
Public Overloads Sub Remove(ByVal Param As IFrameParameter)
InnerList.Remove(Param)
End Sub
Public Overloads Sub Remove(ByVal ParamName As String)
Me.RemoveAt(IndexOf(ParamName))
End Sub
Public Overrides Function ToString() As String
Dim sbValue As New StringBuilder
Dim bParameterAdded As Boolean = False
For i As Integer = 0 To Me.Count - 1
Dim param As String = Me(i).ToString()
If param.Length > 0 Then
If bParameterAdded Then sbValue.Append("&")
sbValue.Append(param)
bParameterAdded = True
End If
Next
Return sbValue.ToString()
End Function
#End Region
#Region "| Methods [Protected] |"
Protected Overrides Sub OnValidate(ByVal value As Object)
If Not TypeOf value Is IFrameParameter Then
Throw New ArgumentException("Must add a IFrameParameter")
End If
End Sub
#End Region
End Class
End Namespace