Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SortAction.cs
Go to the documentation of this file.
3
5
6internal class SortAction : CompiledAction
7{
8 private int _selectKey = -1;
9
10 private Avt _langAvt;
11
13
14 private Avt _orderAvt;
15
17
18 private string _lang;
19
21
22 private XmlSortOrder _order = XmlSortOrder.Ascending;
23
25
26 private Sort _sort;
27
29
31
32 private string ParseLang(string value)
33 {
34 if (value == null)
35 {
36 return null;
37 }
39 if (!XmlComplianceUtil.IsValidLanguageID(value.ToCharArray(), 0, value.Length) && (value.Length == 0 || cultureInfo == null))
40 {
42 {
43 return null;
44 }
46 }
47 return value;
48 }
49
51 {
52 if (value == null)
53 {
54 return XmlDataType.Text;
55 }
56 if (value == "text")
57 {
58 return XmlDataType.Text;
59 }
60 if (value == "number")
61 {
62 return XmlDataType.Number;
63 }
65 manager.ResolveXmlNamespace(prefix);
66 if (prefix.Length == 0 && !_forwardCompatibility)
67 {
69 }
70 return XmlDataType.Text;
71 }
72
74 {
75 if (value == null)
76 {
77 return XmlSortOrder.Ascending;
78 }
79 if (value == "ascending")
80 {
81 return XmlSortOrder.Ascending;
82 }
83 if (value == "descending")
84 {
85 return XmlSortOrder.Descending;
86 }
88 {
89 return XmlSortOrder.Ascending;
90 }
92 }
93
95 {
96 if (value == null)
97 {
98 return XmlCaseOrder.None;
99 }
100 if (value == "upper-first")
101 {
102 return XmlCaseOrder.UpperFirst;
103 }
104 if (value == "lower-first")
105 {
106 return XmlCaseOrder.LowerFirst;
107 }
109 {
110 return XmlCaseOrder.None;
111 }
113 }
114
134
135 internal override bool CompileAttribute(Compiler compiler)
136 {
137 string localName = compiler.Input.LocalName;
138 string value = compiler.Input.Value;
139 if (Ref.Equal(localName, compiler.Atoms.Select))
140 {
141 _selectKey = compiler.AddQuery(value);
142 }
143 else if (Ref.Equal(localName, compiler.Atoms.Lang))
144 {
146 }
147 else if (Ref.Equal(localName, compiler.Atoms.DataType))
148 {
150 }
151 else if (Ref.Equal(localName, compiler.Atoms.Order))
152 {
154 }
155 else
156 {
157 if (!Ref.Equal(localName, compiler.Atoms.CaseOrder))
158 {
159 return false;
160 }
162 }
163 return true;
164 }
165
166 internal override void Execute(Processor processor, ActionFrame frame)
167 {
169 frame.Finished();
170 }
171}
static string Xslt_InvalidAttrValue
Definition SR.cs:1884
Definition SR.cs:7
static bool Equal(string strA, string strB)
Definition Ref.cs:5
static bool IsValidLanguageID(char[] value, int startPos, int length)
static XsltException Create(string res, params string[] args)
string Evaluate(Processor processor, ActionFrame frame)
Definition Avt.cs:37
static Avt CompileAvt(Compiler compiler, string avtText)
Definition Avt.cs:52
void CompileAttributes(Compiler compiler)
static string PrecalculateAvt(ref Avt avt)
static void ParseQualifiedName(string qname, out string prefix, out string local)
XmlCaseOrder ParseCaseOrder(string value)
Definition SortAction.cs:94
override void Execute(Processor processor, ActionFrame frame)
string ParseLang(string value)
Definition SortAction.cs:32
override void Compile(Compiler compiler)
XmlSortOrder ParseOrder(string value)
Definition SortAction.cs:73
override bool CompileAttribute(Compiler compiler)
XmlDataType ParseDataType(string value, InputScopeManager manager)
Definition SortAction.cs:50