-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttributeList.cs
109 lines (95 loc) · 2.27 KB
/
AttributeList.cs
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
using System;
using System.Collections;
namespace SensePost.Wikto
{
/// <summary>
/// The AttributeList class is used to store list of
/// Attribute classes.
///
/// This spider is copyright 2003 by Jeff Heaton. However, it is
/// released under a Limited GNU Public License (LGPL). You may
/// use it freely in your own programs. For the latest version visit
/// http://www.jeffheaton.com.
/// ****************************************************************
/// Changes by SensePost (Pty) Ltd. - Ian de Villiers
/// http://www.sensepost.com
///
/// Fixed the somewhat broken monitor methods causing thread issues
/// on VS2005 .Net where threads would not terminate.
///
/// Removed the Done (Monitor) Class. Not entirely neccessary and
/// actually causes more problems than it assists with in VS 2005.
/// </summary>
///
public class AttributeList:Attribute
{
protected ArrayList m_list;
public override Object Clone()
{
AttributeList rtn = new AttributeList();
for ( int i=0;i<m_list.Count;i++ ) rtn.Add( (Attribute)this[i].Clone() );
return rtn;
}
public AttributeList():base("","")
{
m_list = new ArrayList();
}
public void Add(Attribute a)
{
try
{
m_list.Add(a);
}
catch { }
}
public void Clear()
{
m_list.Clear();
}
public bool IsEmpty()
{
return( m_list.Count<=0);
}
public void Set(string name,string value)
{
if ( name==null ) return;
if ( value==null ) value="";
Attribute a = this[name];
if ( a==null )
{
a = new Attribute(name,value);
Add(a);
}
else a.Value = value;
}
public int Count
{
get { return m_list.Count; }
}
public ArrayList List
{
get { return m_list; }
}
public Attribute this[int index]
{
get
{
if ( index<m_list.Count ) return(Attribute)m_list[index];
else return null;
}
}
public Attribute this[string index]
{
get
{
int i=0;
while ( this[i]!=null )
{
if ( this[i].Name.ToLower().Equals( (index.ToLower()) )) return this[i];
i++;
}
return null;
}
}
}
}