Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ContextStack.cs
Go to the documentation of this file.
1
using
System.Collections
;
2
3
namespace
System.ComponentModel.Design.Serialization
;
4
5
public
sealed
class
ContextStack
6
{
7
private
ArrayList
_contextStack
;
8
9
public
object
?
Current
10
{
11
get
12
{
13
if
(
_contextStack
!=
null
&&
_contextStack
.
Count
> 0)
14
{
15
return
_contextStack
[_contextStack.Count - 1];
16
}
17
return
null
;
18
}
19
}
20
21
public
object
?
this
[
int
level]
22
{
23
get
24
{
25
if
(level < 0)
26
{
27
throw
new
ArgumentOutOfRangeException
(
"level"
);
28
}
29
if
(
_contextStack
!=
null
&& level <
_contextStack
.
Count
)
30
{
31
return
_contextStack
[_contextStack.Count - 1 - level];
32
}
33
return
null
;
34
}
35
}
36
37
public
object
?
this
[
Type
type
]
38
{
39
get
40
{
41
if
(
type
==
null
)
42
{
43
throw
new
ArgumentNullException
(
"type"
);
44
}
45
if
(
_contextStack
!=
null
)
46
{
47
int
num =
_contextStack
.
Count
;
48
while
(num > 0)
49
{
50
object
obj
=
_contextStack
[--num];
51
if
(
type
.IsInstanceOfType(
obj
))
52
{
53
return
obj
;
54
}
55
}
56
}
57
return
null
;
58
}
59
}
60
61
public
void
Append
(
object
context)
62
{
63
if
(context ==
null
)
64
{
65
throw
new
ArgumentNullException
(
"context"
);
66
}
67
if
(
_contextStack
==
null
)
68
{
69
_contextStack
=
new
ArrayList
();
70
}
71
_contextStack
.
Insert
(0, context);
72
}
73
74
public
object
?
Pop
()
75
{
76
object
result =
null
;
77
if
(
_contextStack
!=
null
&&
_contextStack
.
Count
> 0)
78
{
79
int
index
= _contextStack.Count - 1;
80
result =
_contextStack
[
index
];
81
_contextStack
.
RemoveAt
(
index
);
82
}
83
return
result;
84
}
85
86
public
void
Push
(
object
context)
87
{
88
if
(context ==
null
)
89
{
90
throw
new
ArgumentNullException
(
"context"
);
91
}
92
if
(
_contextStack
==
null
)
93
{
94
_contextStack
=
new
ArrayList
();
95
}
96
_contextStack
.
Add
(context);
97
}
98
}
System.ArgumentNullException
Definition
ArgumentNullException.cs:10
System.ArgumentOutOfRangeException
Definition
ArgumentOutOfRangeException.cs:9
System.Collections.ArrayList.Add
virtual int Add(object? value)
Definition
ArrayList.cs:2302
System.Collections.ArrayList.RemoveAt
virtual void RemoveAt(int index)
Definition
ArrayList.cs:2602
System.Collections.ArrayList.Count
virtual int Count
Definition
ArrayList.cs:2225
System.Collections.ArrayList.Insert
virtual void Insert(int index, object? value)
Definition
ArrayList.cs:2499
System.Collections.ArrayList
Definition
ArrayList.cs:11
System.ComponentModel.Design.Serialization.ContextStack._contextStack
ArrayList _contextStack
Definition
ContextStack.cs:7
System.ComponentModel.Design.Serialization.ContextStack.Current
object? Current
Definition
ContextStack.cs:10
System.ComponentModel.Design.Serialization.ContextStack.Push
void Push(object context)
Definition
ContextStack.cs:86
System.ComponentModel.Design.Serialization.ContextStack.Pop
object? Pop()
Definition
ContextStack.cs:74
System.ComponentModel.Design.Serialization.ContextStack.Append
void Append(object context)
Definition
ContextStack.cs:61
System.ComponentModel.Design.Serialization.ContextStack
Definition
ContextStack.cs:6
System.Type
Definition
Type.cs:14
System.Collections
Definition
BlockingCollection.cs:8
System.ComponentModel.Design.Serialization
Definition
DesignerSerializerAttribute.cs:1
System.ExceptionArgument.type
@ type
System.ExceptionArgument.index
@ index
System.ExceptionArgument.obj
@ obj
source
System.ComponentModel.TypeConverter
System.ComponentModel.Design.Serialization
ContextStack.cs
Generated by
1.10.0