Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CopyNodeSetAction.cs
Go to the documentation of this file.
2
4
5internal sealed class CopyNodeSetAction : Action
6{
7 private static readonly CopyNodeSetAction s_Action = new CopyNodeSetAction();
8
9 internal static CopyNodeSetAction GetAction()
10 {
11 return s_Action;
12 }
13
14 internal override void Execute(Processor processor, ActionFrame frame)
15 {
16 while (processor.CanContinue)
17 {
18 switch (frame.State)
19 {
20 default:
21 return;
22 case 0:
23 if (frame.NextNode(processor))
24 {
25 frame.State = 2;
26 goto case 2;
27 }
28 frame.Finished();
29 return;
30 case 2:
31 if (SendBeginEvent(processor, frame.Node))
32 {
33 frame.State = 3;
34 continue;
35 }
36 return;
37 case 3:
38 {
39 XPathNodeType nodeType = frame.Node.NodeType;
40 if (nodeType == XPathNodeType.Element || nodeType == XPathNodeType.Root)
41 {
42 processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet);
43 frame.State = 4;
44 }
45 else if (SendTextEvent(processor, frame.Node))
46 {
47 frame.State = 7;
48 continue;
49 }
50 return;
51 }
52 case 4:
53 processor.PushActionFrame(CopyAttributesAction.GetAction(), frame.NodeSet);
54 frame.State = 5;
55 return;
56 case 5:
57 if (frame.Node.HasChildren)
58 {
59 processor.PushActionFrame(GetAction(), frame.Node.SelectChildren(XPathNodeType.All));
60 frame.State = 6;
61 return;
62 }
63 frame.State = 7;
64 break;
65 case 6:
66 frame.State = 7;
67 continue;
68 case 7:
69 break;
70 case 1:
71 return;
72 }
73 if (SendEndEvent(processor, frame.Node))
74 {
75 frame.State = 0;
76 continue;
77 }
78 break;
79 }
80 }
81
83 {
84 return processor.CopyBeginEvent(node, node.IsEmptyElement);
85 }
86
88 {
89 return processor.CopyTextEvent(node);
90 }
91
93 {
94 return processor.CopyEndEvent(node);
95 }
96}
virtual XPathNodeIterator SelectChildren(XPathNodeType type)
static bool SendBeginEvent(Processor processor, XPathNavigator node)
static bool SendTextEvent(Processor processor, XPathNavigator node)
static readonly CopyNodeSetAction s_Action
override void Execute(Processor processor, ActionFrame frame)
static bool SendEndEvent(Processor processor, XPathNavigator node)