Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CopyAction.cs
Go to the documentation of this file.
2
4
5internal class CopyAction : ContainerAction
6{
7 private bool _empty;
8
9 internal override void Compile(Compiler compiler)
10 {
12 if (compiler.Recurse())
13 {
15 compiler.ToParent();
16 }
17 if (containedActions == null)
18 {
19 _empty = true;
20 }
21 }
22
23 internal override bool CompileAttribute(Compiler compiler)
24 {
25 string localName = compiler.Input.LocalName;
26 if (Ref.Equal(localName, compiler.Atoms.UseAttributeSets))
27 {
28 AddAction(compiler.CreateUseAttributeSetsAction());
29 return true;
30 }
31 return false;
32 }
33
34 internal override void Execute(Processor processor, ActionFrame frame)
35 {
36 while (processor.CanContinue)
37 {
38 switch (frame.State)
39 {
40 default:
41 return;
42 case 0:
43 if (Processor.IsRoot(frame.Node))
44 {
45 processor.PushActionFrame(frame);
46 frame.State = 8;
47 return;
48 }
49 if (processor.CopyBeginEvent(frame.Node, _empty))
50 {
51 frame.State = 5;
52 break;
53 }
54 return;
55 case 5:
56 frame.State = 6;
57 if (frame.Node.NodeType == XPathNodeType.Element)
58 {
59 processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet);
60 return;
61 }
62 break;
63 case 6:
64 if (frame.Node.NodeType == XPathNodeType.Element && !_empty)
65 {
66 processor.PushActionFrame(frame);
67 frame.State = 7;
68 return;
69 }
70 if (processor.CopyTextEvent(frame.Node))
71 {
72 frame.State = 7;
73 break;
74 }
75 return;
76 case 7:
77 if (processor.CopyEndEvent(frame.Node))
78 {
79 frame.Finished();
80 }
81 return;
82 case 8:
83 frame.Finished();
84 return;
85 case 1:
86 case 2:
87 case 3:
88 case 4:
89 return;
90 }
91 }
92 }
93}
static bool Equal(string strA, string strB)
Definition Ref.cs:5
void CompileAttributes(Compiler compiler)
override void Compile(Compiler compiler)
Definition CopyAction.cs:9
override bool CompileAttribute(Compiler compiler)
Definition CopyAction.cs:23
override void Execute(Processor processor, ActionFrame frame)
Definition CopyAction.cs:34
static bool IsRoot(XPathNavigator navigator)
Definition Processor.cs:695