Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XElementAttributePropertyDescriptor.cs
Go to the documentation of this file.
1
using
System
;
2
using
System.Xml.Linq
;
3
4
namespace
MS.Internal.Xml.Linq.ComponentModel
;
5
6
internal
sealed
class
XElementAttributePropertyDescriptor
:
XPropertyDescriptor
<XElement, object>
7
{
8
private
XDeferredSingleton<XAttribute>
_value
;
9
10
private
XAttribute
_changeState
;
11
12
public
XElementAttributePropertyDescriptor
()
13
: base(
"Attribute"
)
14
{
15
}
16
17
public
override
object
GetValue
(
object
component)
18
{
19
return
_value
=
new
XDeferredSingleton<XAttribute>
((
XElement
e,
XName
n) => e.
Attribute
(n), component as
XElement
,
null
);
20
}
21
22
protected
override
void
OnChanged
(
object
sender,
XObjectChangeEventArgs
args)
23
{
24
if
(
_value
==
null
)
25
{
26
return
;
27
}
28
switch
(args.
ObjectChange
)
29
{
30
case
XObjectChange
.Add:
31
if
(sender is
XAttribute
xAttribute2 &&
_value
.
element
== xAttribute2.
Parent
&&
_value
.
name
== xAttribute2.Name)
32
{
33
OnValueChanged(
_value
.
element
,
EventArgs
.
Empty
);
34
}
35
break
;
36
case
XObjectChange
.Remove:
37
if
(sender is
XAttribute
xAttribute &&
_changeState
== xAttribute)
38
{
39
_changeState
=
null
;
40
OnValueChanged(
_value
.
element
,
EventArgs
.
Empty
);
41
}
42
break
;
43
}
44
}
45
46
protected
override
void
OnChanging
(
object
sender,
XObjectChangeEventArgs
args)
47
{
48
if
(
_value
!=
null
)
49
{
50
XObjectChange
objectChange = args.
ObjectChange
;
51
if
(objectChange ==
XObjectChange
.Remove)
52
{
53
XAttribute
xAttribute = sender as
XAttribute
;
54
_changeState
= ((xAttribute !=
null
&& _value.element == xAttribute.Parent && _value.name == xAttribute.
Name
) ? xAttribute :
null
);
55
}
56
}
57
}
58
}
MS.Internal.Xml.Linq.ComponentModel.XDeferredSingleton.name
XName name
Definition
XDeferredSingleton.cs:12
MS.Internal.Xml.Linq.ComponentModel.XDeferredSingleton.element
XElement element
Definition
XDeferredSingleton.cs:10
MS.Internal.Xml.Linq.ComponentModel.XDeferredSingleton
Definition
XDeferredSingleton.cs:7
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor.GetValue
override object GetValue(object component)
Definition
XElementAttributePropertyDescriptor.cs:17
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor.OnChanging
override void OnChanging(object sender, XObjectChangeEventArgs args)
Definition
XElementAttributePropertyDescriptor.cs:46
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor.OnChanged
override void OnChanged(object sender, XObjectChangeEventArgs args)
Definition
XElementAttributePropertyDescriptor.cs:22
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor._changeState
XAttribute _changeState
Definition
XElementAttributePropertyDescriptor.cs:10
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor.XElementAttributePropertyDescriptor
XElementAttributePropertyDescriptor()
Definition
XElementAttributePropertyDescriptor.cs:12
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor._value
XDeferredSingleton< XAttribute > _value
Definition
XElementAttributePropertyDescriptor.cs:8
MS.Internal.Xml.Linq.ComponentModel.XElementAttributePropertyDescriptor
Definition
XElementAttributePropertyDescriptor.cs:7
MS.Internal.Xml.Linq.ComponentModel.XPropertyDescriptor
Definition
XPropertyDescriptor.cs:8
System.EventArgs.Empty
static readonly EventArgs Empty
Definition
EventArgs.cs:9
System.EventArgs
Definition
EventArgs.cs:8
System.Xml.Linq.XAttribute.Name
XName Name
Definition
XAttribute.cs:33
System.Xml.Linq.XAttribute
Definition
XAttribute.cs:11
System.Xml.Linq.XElement.Attribute
XAttribute? Attribute(XName name)
Definition
XElement.cs:218
System.Xml.Linq.XElement
Definition
XElement.cs:19
System.Xml.Linq.XName
Definition
XName.cs:7
System.Xml.Linq.XObjectChangeEventArgs.ObjectChange
XObjectChange ObjectChange
Definition
XObjectChangeEventArgs.cs:15
System.Xml.Linq.XObjectChangeEventArgs
Definition
XObjectChangeEventArgs.cs:4
System.Xml.Linq.XObject.Parent
XElement? Parent
Definition
XObject.cs:53
MS.Internal.Xml.Linq.ComponentModel
Definition
XAttributeValuePropertyDescriptor.cs:4
System.Xml.Linq.XObjectChange
XObjectChange
Definition
XObjectChange.cs:4
System.Xml.Linq
Definition
BaseUriAnnotation.cs:1
System
Definition
BlockingCollection.cs:8
source
System.ComponentModel.TypeConverter
MS.Internal.Xml.Linq.ComponentModel
XElementAttributePropertyDescriptor.cs
Generated by
1.10.0