Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
TemplateManager.cs
Go to the documentation of this file.
3
5
6internal sealed class TemplateManager
7{
8 private sealed class TemplateComparer : IComparer
9 {
10 public int Compare(object x, object y)
11 {
14 if (templateAction.Priority == templateAction2.Priority)
15 {
17 }
18 if (!(templateAction.Priority > templateAction2.Priority))
19 {
20 return -1;
21 }
22 return 1;
23 }
24 }
25
26 private readonly XmlQualifiedName _mode;
27
29
30 private readonly Stylesheet _stylesheet;
31
32 private static readonly TemplateComparer s_TemplateComparer = new TemplateComparer();
33
34 internal TemplateManager(Stylesheet stylesheet, XmlQualifiedName mode)
35 {
36 _mode = mode;
37 _stylesheet = stylesheet;
38 }
39
40 internal void AddTemplate(TemplateAction template)
41 {
42 if (templates == null)
43 {
44 templates = new ArrayList();
45 }
46 templates.Add(template);
47 }
48
49 internal void ProcessTemplates()
50 {
51 if (templates != null)
52 {
54 }
55 }
56
58 {
59 if (templates == null)
60 {
61 return null;
62 }
63 for (int num = templates.Count - 1; num >= 0; num--)
64 {
66 int matchKey = templateAction.MatchKey;
67 if (matchKey != -1 && processor.Matches(navigator, matchKey))
68 {
69 return templateAction;
70 }
71 }
72 return null;
73 }
74}
virtual int Add(object? value)
static readonly TemplateComparer s_TemplateComparer
TemplateAction FindTemplate(Processor processor, XPathNavigator navigator)
void AddTemplate(TemplateAction template)
TemplateManager(Stylesheet stylesheet, XmlQualifiedName mode)